|
@@ -3,19 +3,19 @@ import { Table } from 'components'
|
|
import { Modal, Input } from 'antd'
|
|
import { Modal, Input } from 'antd'
|
|
import { ScenePage, sceneTitleColumn, sceneTimeColumn, modelSceneTimeColumn, modelSceneRawTypeColumn } from 'views/scene'
|
|
import { ScenePage, sceneTitleColumn, sceneTimeColumn, modelSceneTimeColumn, modelSceneRawTypeColumn } from 'views/scene'
|
|
import { fetchScenes, filterScenesSelector, useSelector, getSceneIdent } from 'store'
|
|
import { fetchScenes, filterScenesSelector, useSelector, getSceneIdent } from 'store'
|
|
-import { useThunkPaging, useRefersh } from 'hook'
|
|
|
|
|
|
+import { useThunkPaging, useRefershFoce } from 'hook'
|
|
import style from '../style.module.scss'
|
|
import style from '../style.module.scss'
|
|
|
|
|
|
import type { Scene, SceneIdents } from "api";
|
|
import type { Scene, SceneIdents } from "api";
|
|
|
|
|
|
-export type SelectScenesProps = {
|
|
|
|
|
|
+export type SelectScenesProps = {
|
|
sceneIdents: SceneIdents
|
|
sceneIdents: SceneIdents
|
|
onClose: () => void,
|
|
onClose: () => void,
|
|
onSelect: (ids: SelectScenesProps['sceneIdents']) => void
|
|
onSelect: (ids: SelectScenesProps['sceneIdents']) => void
|
|
}
|
|
}
|
|
|
|
|
|
export const SelectScenes = ({ sceneIdents, ...props }: SelectScenesProps) => {
|
|
export const SelectScenes = ({ sceneIdents, ...props }: SelectScenesProps) => {
|
|
- let idents:SceneIdents = sceneIdents.map(ident => ({
|
|
|
|
|
|
+ let idents: SceneIdents = sceneIdents.map(ident => ({
|
|
...ident,
|
|
...ident,
|
|
numList: [...ident.numList]
|
|
numList: [...ident.numList]
|
|
}))
|
|
}))
|
|
@@ -44,38 +44,42 @@ export const SelectScenes = ({ sceneIdents, ...props }: SelectScenesProps) => {
|
|
typeIdents.numList.push(sceneIdent)
|
|
typeIdents.numList.push(sceneIdent)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ console.log(typeIdents)
|
|
}
|
|
}
|
|
|
|
|
|
- const Content = ({type}: {type: SceneType}) => {
|
|
|
|
|
|
+ const Content = ({ type }: { type: SceneType }) => {
|
|
const scenes = useSelector((state) => filterScenesSelector(state, { type }))
|
|
const scenes = useSelector((state) => filterScenesSelector(state, { type }))
|
|
const states = useThunkPaging({ type, sceneName: '', status: QuoteSceneStatus.SUCCESS }, fetchScenes)
|
|
const states = useThunkPaging({ type, sceneName: '', status: QuoteSceneStatus.SUCCESS }, fetchScenes)
|
|
const [[paging, setPaging], [params, setParams]] = states
|
|
const [[paging, setPaging], [params, setParams]] = states
|
|
const selectedIds = getSelectIds(type, scenes)
|
|
const selectedIds = getSelectIds(type, scenes)
|
|
- const refersh = useRefersh()
|
|
|
|
|
|
+ const refersh = useRefershFoce()
|
|
|
|
+ console.log(selectedIds)
|
|
|
|
|
|
- const rowSelection: any = {
|
|
|
|
- selectedRowKeys: selectedIds,
|
|
|
|
|
|
+ const rowSelection: any = {
|
|
|
|
+ selectedRowKeys: selectedIds,
|
|
onChange(ids: string, selectScenes: Scene[]) {
|
|
onChange(ids: string, selectScenes: Scene[]) {
|
|
|
|
+ console.log(ids, selectScenes)
|
|
replaceIdents(type, scenes, selectScenes)
|
|
replaceIdents(type, scenes, selectScenes)
|
|
refersh()
|
|
refersh()
|
|
}
|
|
}
|
|
};
|
|
};
|
|
- const columns = type === SceneType.SWMX
|
|
|
|
- ? [modelSceneRawTypeColumn, modelSceneTimeColumn]
|
|
|
|
|
|
+ const columns = type === SceneType.SWMX
|
|
|
|
+ ? [modelSceneRawTypeColumn, modelSceneTimeColumn]
|
|
: [sceneTimeColumn]
|
|
: [sceneTimeColumn]
|
|
-
|
|
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|
|
<div className={style['model-header']}>
|
|
<div className={style['model-header']}>
|
|
<Input.Search
|
|
<Input.Search
|
|
allowClear
|
|
allowClear
|
|
className='content-header-search'
|
|
className='content-header-search'
|
|
- placeholder="输入名称搜索"
|
|
|
|
- onSearch={sceneName => setParams({ sceneName }) }
|
|
|
|
- style={{ width: 264, marginTop: '15px' }}
|
|
|
|
|
|
+ placeholder="输入名称搜索"
|
|
|
|
+ onSearch={sceneName => setParams({ sceneName })}
|
|
|
|
+ style={{ width: 264, marginTop: '15px' }}
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
- <Table
|
|
|
|
|
|
+ <Table
|
|
columns={[sceneTitleColumn, ...columns] as any}
|
|
columns={[sceneTitleColumn, ...columns] as any}
|
|
rowSelection={rowSelection}
|
|
rowSelection={rowSelection}
|
|
data={scenes}
|
|
data={scenes}
|
|
@@ -88,11 +92,11 @@ export const SelectScenes = ({ sceneIdents, ...props }: SelectScenesProps) => {
|
|
}
|
|
}
|
|
|
|
|
|
return (
|
|
return (
|
|
- <Modal
|
|
|
|
|
|
+ <Modal
|
|
width="800px"
|
|
width="800px"
|
|
- title="添加场景"
|
|
|
|
- visible={true}
|
|
|
|
- onOk={() => props.onSelect(idents)}
|
|
|
|
|
|
+ title="添加场景"
|
|
|
|
+ visible={true}
|
|
|
|
+ onOk={() => props.onSelect(idents)}
|
|
onCancel={props.onClose}
|
|
onCancel={props.onClose}
|
|
okText="确定"
|
|
okText="确定"
|
|
cancelText="取消"
|
|
cancelText="取消"
|