|
@@ -1,8 +1,9 @@
|
|
// 优化任务
|
|
// 优化任务
|
|
import PageContent from '@/components/PageContent';
|
|
import PageContent from '@/components/PageContent';
|
|
import PageTitle from '@/components/PageTitle';
|
|
import PageTitle from '@/components/PageTitle';
|
|
|
|
+import ScrollLoading from './components/ScrollLoading';
|
|
import {
|
|
import {
|
|
- queryMandate,
|
|
|
|
|
|
+ queryHistory,
|
|
queryMandateChildList,
|
|
queryMandateChildList,
|
|
querySimulationProfit,
|
|
querySimulationProfit,
|
|
} from '@/services/SmartOps';
|
|
} from '@/services/SmartOps';
|
|
@@ -16,10 +17,6 @@ import styles from './OptimizationTasks.less';
|
|
const OptimizationTasks = (props) => {
|
|
const OptimizationTasks = (props) => {
|
|
const { projectId } = useParams();
|
|
const { projectId } = useParams();
|
|
|
|
|
|
- const { data, run } = useRequest(queryMandate, {
|
|
|
|
- manual: true,
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
return (
|
|
return (
|
|
<PageContent closeable={false}>
|
|
<PageContent closeable={false}>
|
|
<PageTitle returnable>
|
|
<PageTitle returnable>
|
|
@@ -50,8 +47,28 @@ const Produce = ({ projectId }) => {
|
|
},
|
|
},
|
|
];
|
|
];
|
|
|
|
|
|
|
|
+ const historyColumns = [
|
|
|
|
+ {
|
|
|
|
+ title: '时间',
|
|
|
|
+ dataIndex: 'CreateTime',
|
|
|
|
+ render: (time) => dayjs(time).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '参数',
|
|
|
|
+ dataIndex: 'Title',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '任务内容',
|
|
|
|
+ dataIndex: 'Content',
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+
|
|
const [mandateID, setMandateID] = useState();
|
|
const [mandateID, setMandateID] = useState();
|
|
|
|
+ const [active, setActive] = useState(false);
|
|
|
|
+ const [list, setList] = useState([]);
|
|
|
|
+ const [curPagination, setCurPagination] = useState({});
|
|
|
|
|
|
|
|
+ // 当前记录
|
|
const { data } = useRequest(queryMandateChildList, {
|
|
const { data } = useRequest(queryMandateChildList, {
|
|
defaultParams: [
|
|
defaultParams: [
|
|
{
|
|
{
|
|
@@ -60,7 +77,20 @@ const Produce = ({ projectId }) => {
|
|
},
|
|
},
|
|
],
|
|
],
|
|
onSuccess: (data) => {
|
|
onSuccess: (data) => {
|
|
- setMandateID(data[0].MandateId);
|
|
|
|
|
|
+ setMandateID(data[0]?.MandateId);
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // 历史记录
|
|
|
|
+ const {
|
|
|
|
+ run,
|
|
|
|
+ loading,
|
|
|
|
+ data: historyData,
|
|
|
|
+ } = useRequest(queryHistory, {
|
|
|
|
+ defaultParams: [{ project_id: projectId, class: 1, currentPage: 1 }],
|
|
|
|
+ onSuccess: (data) => {
|
|
|
|
+ setList([...list, ...data.list]);
|
|
|
|
+ setCurPagination(data.pagination);
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|
|
@@ -73,52 +103,86 @@ const Produce = ({ projectId }) => {
|
|
};
|
|
};
|
|
|
|
|
|
return (
|
|
return (
|
|
- <div className={styles.pageCard}>
|
|
|
|
- <h3 className={styles.title} style={{ justifyContent: 'space-between' }}>
|
|
|
|
- <div>
|
|
|
|
- <i />
|
|
|
|
- 生产调度类
|
|
|
|
- </div>
|
|
|
|
- {mandateID && (
|
|
|
|
- <div className={styles.btnBlue} onClick={openDetail}>
|
|
|
|
- 查看任务
|
|
|
|
|
|
+ <>
|
|
|
|
+ <div className={styles.pageCard}>
|
|
|
|
+ <h3
|
|
|
|
+ className={styles.title}
|
|
|
|
+ style={{ justifyContent: 'space-between' }}
|
|
|
|
+ >
|
|
|
|
+ <div>
|
|
|
|
+ <i />
|
|
|
|
+ 生产调度类
|
|
</div>
|
|
</div>
|
|
|
|
+ {mandateID && (
|
|
|
|
+ <div className={styles.btnBlue} onClick={openDetail}>
|
|
|
|
+ 查看任务
|
|
|
|
+ </div>
|
|
|
|
+ )}
|
|
|
|
+ </h3>
|
|
|
|
+ {data?.length > 0 && (
|
|
|
|
+ <>
|
|
|
|
+ <div
|
|
|
|
+ className={styles.content}
|
|
|
|
+ style={{ backgroundColor: '#B1D2F3' }}
|
|
|
|
+ >
|
|
|
|
+ <h3 className={styles.left}>任务总结</h3>
|
|
|
|
+ <div className={styles.desc}>
|
|
|
|
+ 根据水质相关数据.建议您调节以下参数,水厂运行可达较优状态
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div
|
|
|
|
+ className={styles.content}
|
|
|
|
+ style={{ backgroundColor: '#EDF5FC' }}
|
|
|
|
+ >
|
|
|
|
+ <h3 className={styles.left}>任务内容</h3>
|
|
|
|
+ <Table
|
|
|
|
+ className={styles.taskTable}
|
|
|
|
+ style={{ width: '100%' }}
|
|
|
|
+ columns={columns}
|
|
|
|
+ dataSource={data}
|
|
|
|
+ pagination={false}
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </>
|
|
)}
|
|
)}
|
|
- </h3>
|
|
|
|
- {data?.length > 0 && (
|
|
|
|
- <>
|
|
|
|
|
|
+ {!data?.length && (
|
|
<div
|
|
<div
|
|
className={styles.content}
|
|
className={styles.content}
|
|
style={{ backgroundColor: '#B1D2F3' }}
|
|
style={{ backgroundColor: '#B1D2F3' }}
|
|
>
|
|
>
|
|
- <h3 className={styles.left}>任务总结</h3>
|
|
|
|
<div className={styles.desc}>
|
|
<div className={styles.desc}>
|
|
- 根据水质相关数据.建议您调节以下参数,水厂运行可达较优状态
|
|
|
|
|
|
+ 当前进水数据稳定,产水数据稳定,暂无调节任务,继续保持哦~
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div
|
|
|
|
- className={styles.content}
|
|
|
|
- style={{ backgroundColor: '#EDF5FC' }}
|
|
|
|
|
|
+ )}
|
|
|
|
+ <div
|
|
|
|
+ className={`${styles.bottomBtn} ${active ? styles.active : ''}`}
|
|
|
|
+ onClick={() => setActive(!active)}
|
|
|
|
+ >
|
|
|
|
+ 历史优化记录
|
|
|
|
+ <i></i>
|
|
|
|
+ </div>
|
|
|
|
+ <div style={{ display: active ? 'block' : 'none' }}>
|
|
|
|
+ <ScrollLoading
|
|
|
|
+ loading={loading}
|
|
|
|
+ pagination={curPagination}
|
|
|
|
+ handleLoadData={(current) =>
|
|
|
|
+ run({ project_id: projectId, currentPage: current, class: 1 })
|
|
|
|
+ }
|
|
|
|
+ height="3rem"
|
|
>
|
|
>
|
|
- <h3 className={styles.left}>任务内容</h3>
|
|
|
|
<Table
|
|
<Table
|
|
- className={styles.taskTable}
|
|
|
|
- style={{ width: '100%' }}
|
|
|
|
- columns={columns}
|
|
|
|
- dataSource={data}
|
|
|
|
|
|
+ rowKey={'id'}
|
|
|
|
+ loading={loading}
|
|
|
|
+ dataSource={list}
|
|
|
|
+ columns={historyColumns}
|
|
pagination={false}
|
|
pagination={false}
|
|
|
|
+ className={styles.table1}
|
|
/>
|
|
/>
|
|
- </div>
|
|
|
|
- </>
|
|
|
|
- )}
|
|
|
|
- {!data?.length && (
|
|
|
|
- <div className={styles.content} style={{ backgroundColor: '#B1D2F3' }}>
|
|
|
|
- <div className={styles.desc}>
|
|
|
|
- 当前进水数据稳定,产水数据稳定,暂无调节任务,继续保持哦~
|
|
|
|
- </div>
|
|
|
|
|
|
+ </ScrollLoading>
|
|
</div>
|
|
</div>
|
|
- )}
|
|
|
|
- </div>
|
|
|
|
|
|
+ </div>
|
|
|
|
+ </>
|
|
);
|
|
);
|
|
};
|
|
};
|
|
|
|
|
|
@@ -133,8 +197,26 @@ const Cost = ({ projectId }) => {
|
|
dataIndex: 'Content',
|
|
dataIndex: 'Content',
|
|
},
|
|
},
|
|
];
|
|
];
|
|
|
|
+ const historyColumns = [
|
|
|
|
+ {
|
|
|
|
+ title: '时间',
|
|
|
|
+ dataIndex: 'CreateTime',
|
|
|
|
+ render: (time) => dayjs(time).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '参数',
|
|
|
|
+ dataIndex: 'Title',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '任务内容',
|
|
|
|
+ dataIndex: 'Content',
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
|
|
const [mandateID, setMandateID] = useState();
|
|
const [mandateID, setMandateID] = useState();
|
|
|
|
+ const [active, setActive] = useState(false);
|
|
|
|
+ const [list, setList] = useState([]);
|
|
|
|
+ const [curPagination, setCurPagination] = useState({});
|
|
|
|
|
|
const { data: profit } = useRequest(querySimulationProfit, {
|
|
const { data: profit } = useRequest(querySimulationProfit, {
|
|
defaultParams: [
|
|
defaultParams: [
|
|
@@ -161,7 +243,16 @@ const Cost = ({ projectId }) => {
|
|
},
|
|
},
|
|
],
|
|
],
|
|
onSuccess: (data) => {
|
|
onSuccess: (data) => {
|
|
- setMandateID(data[0].MandateId);
|
|
|
|
|
|
+ setMandateID(data[0]?.MandateId);
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // 历史记录
|
|
|
|
+ const { run, loading } = useRequest(queryHistory, {
|
|
|
|
+ defaultParams: [{ project_id: projectId, class: 2, currentPage: 1 }],
|
|
|
|
+ onSuccess: (data) => {
|
|
|
|
+ setList([...list, ...data.list]);
|
|
|
|
+ setCurPagination(data.pagination);
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|
|
@@ -218,6 +309,32 @@ const Cost = ({ projectId }) => {
|
|
<div className={styles.desc}>暂无可降低成本,继续保持哦~</div>
|
|
<div className={styles.desc}>暂无可降低成本,继续保持哦~</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
)}
|
|
|
|
+ <div
|
|
|
|
+ className={`${styles.bottomBtn2} ${active ? styles.active : ''}`}
|
|
|
|
+ onClick={() => setActive(!active)}
|
|
|
|
+ >
|
|
|
|
+ 历史优化记录
|
|
|
|
+ <i></i>
|
|
|
|
+ </div>
|
|
|
|
+ <div style={{ display: active ? 'block' : 'none' }}>
|
|
|
|
+ <ScrollLoading
|
|
|
|
+ loading={loading}
|
|
|
|
+ pagination={curPagination}
|
|
|
|
+ handleLoadData={(current) =>
|
|
|
|
+ run({ project_id: projectId, currentPage: current, class: 2 })
|
|
|
|
+ }
|
|
|
|
+ height="3rem"
|
|
|
|
+ >
|
|
|
|
+ <Table
|
|
|
|
+ rowKey={'id'}
|
|
|
|
+ loading={loading}
|
|
|
|
+ dataSource={list}
|
|
|
|
+ columns={historyColumns}
|
|
|
|
+ pagination={false}
|
|
|
|
+ className={styles.table2}
|
|
|
|
+ />
|
|
|
|
+ </ScrollLoading>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
};
|
|
};
|