diff --git a/src/api/eightwork/index.js b/src/api/eightwork/index.js index bf54efa..39f6e27 100644 --- a/src/api/eightwork/index.js +++ b/src/api/eightwork/index.js @@ -24,7 +24,15 @@ export const eightworkType = declareRequest( "eightworkLoading", `Post > @/eightwork/eightworkTask/listByWorkType`, ); -export const eightworkRecordsList = declareRequest( +export const forceTerminate = declareRequest( "eightworkLoading", - `Post > @/eightwork/eightworkInfo/list`, + `Post > @/eightwork/eightworkInfo/forceTerminate`, +); +export const statisticsByWorkType = declareRequest( + "eightworkLoading", + `Post > @/eightwork/eightworkInfo/statisticsByWorkType`, +); +export const corpInfoList = declareRequest( + "eightworkLoading", + "Post > @/basicInfo/corpInfo/list", ); diff --git a/src/components/ForceTerminationModal/index.js b/src/components/ForceTerminationModal/index.js index 57e7d38..6b5a27f 100644 --- a/src/components/ForceTerminationModal/index.js +++ b/src/components/ForceTerminationModal/index.js @@ -7,10 +7,13 @@ import { NS_EIGHTWORK } from "~/enumerate/namespace"; const ForceTerminationModal = (props) => { const [form] = FormBuilder.useForm(); - const onSubmit = async () => { - message.success("强制关闭成功"); - props.getData(); - props.onCancel(); + const onSubmit = async (values) => { + const { success } = await props["forceTerminate"]({ ...values, id: props.id }); + if (success) { + message.success("强制关闭成功"); + props.getData(); + props.onCancel(); + } }; return ( @@ -30,7 +33,7 @@ const ForceTerminationModal = (props) => { span={24} labelCol={{ span: 10 }} options={[ - { name: "todo", label: "强制关闭原因", render: FORM_ITEM_RENDER_ENUM.TEXTAREA }, + { name: "closeReason", label: "强制关闭原因", render: FORM_ITEM_RENDER_ENUM.TEXTAREA }, ]} form={form} showActionButtons={false} diff --git a/src/pages/Container/Enterprise/ConfinedSpaceWork/Homework/List/index.js b/src/pages/Container/Enterprise/ConfinedSpaceWork/Homework/List/index.js index 05c345f..ffa2603 100644 --- a/src/pages/Container/Enterprise/ConfinedSpaceWork/Homework/List/index.js +++ b/src/pages/Container/Enterprise/ConfinedSpaceWork/Homework/List/index.js @@ -89,7 +89,7 @@ function List(props) { dataIndex: "status", render: (_, record) => getLabelName({ list: STATUS_ENUM, status: record.status }), }, - { title: "强制关闭原因", dataIndex: "todo", hidden: !(props.status === 998) }, + { title: "强制关闭原因", dataIndex: ["info", "closeReason"], hidden: !(props.status === "998") }, { title: "操作", fixed: "right", diff --git a/src/pages/Container/Enterprise/HotWork/Homework/List/index.js b/src/pages/Container/Enterprise/HotWork/Homework/List/index.js index 99a31f8..bde4ad5 100644 --- a/src/pages/Container/Enterprise/HotWork/Homework/List/index.js +++ b/src/pages/Container/Enterprise/HotWork/Homework/List/index.js @@ -109,7 +109,7 @@ function List(props) { dataIndex: "status", render: (_, record) => getLabelName({ list: STATUS_ENUM, status: record.status }), }, - { title: "强制关闭原因", dataIndex: "todo", hidden: !(props.status === 998) }, + { title: "强制关闭原因", dataIndex: ["info", "closeReason"], hidden: !(props.status === "998") }, { title: "操作", fixed: "right", diff --git a/src/pages/Container/Supervision/HotWork/List/index.js b/src/pages/Container/Supervision/HotWork/List/index.js index 10dca48..5fae075 100644 --- a/src/pages/Container/Supervision/HotWork/List/index.js +++ b/src/pages/Container/Supervision/HotWork/List/index.js @@ -1,5 +1,6 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { Button } from "antd"; +import { useState } from "react"; import Page from "zy-react-library/components/Page"; import Search from "zy-react-library/components/Search"; import Table from "zy-react-library/components/Table"; @@ -7,28 +8,48 @@ import useTable from "zy-react-library/hooks/useTable"; import { NS_EIGHTWORK } from "~/enumerate/namespace"; function List(props) { + const [list, setList] = useState([]); + const [form] = Search.useForm(); - const { tableProps, getData } = useTable(props["eightworkRecordsList"], { + const getStatistics = async (list) => { + const { data } = await props["statisticsByWorkType"]({ + eqWorkType: props.eqWorkType || "hot_work", + inCorpInfoId: list.map(item => item.id), + }); + const mergedList = list.map((item) => { + const statistics = data.find(stat => stat.corpinfoId === item.id); + return { + ...item, + ...statistics, + }; + }); + setList(mergedList); + }; + + const { tableProps, getData } = useTable(props["corpInfoList"], { form, - params: { eqWorkType: props.eqWorkType || "hot_work" }, + params: { inType: [0, 1, 6, 3, 4, 5] }, + onSuccess: (data) => { + getStatistics(data.list); + }, }); return ( ( ), }, { title: "完成数", - dataIndex: "todo", + dataIndex: "doneCount", render: (_, record) => ( ), }, { title: "进行数", - dataIndex: "todo", + dataIndex: "doingCount", render: (_, record) => ( + ), + }, + { + title: "打回数", + dataIndex: "rejectedCount", + render: (_, record) => ( + ), }, { title: "废除数", - dataIndex: "todo", + dataIndex: "forceTerminateCount", render: (_, record) => ( ), }, ]} {...tableProps} + dataSource={list} + loading={props.eightwork.eightworkLoading || tableProps.loading} /> );