新需求修改
parent
d8050e3b56
commit
788f56b918
|
|
@ -32,7 +32,7 @@
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-to-print": "^3.2.0",
|
"react-to-print": "^3.2.0",
|
||||||
"zy-react-library": "^1.0.160"
|
"zy-react-library": "^1.0.167"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "^5.4.1",
|
"@antfu/eslint-config": "^5.4.1",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { declareRequest } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
|
||||||
|
export const planList = declareRequest(
|
||||||
|
"planLoading",
|
||||||
|
`Post > @/inspection/safetyEnvironmentalPlan/list`,
|
||||||
|
);
|
||||||
|
export const planListAll = declareRequest(
|
||||||
|
"planLoading",
|
||||||
|
`Get > /inspection/safetyEnvironmentalPlan/listAll`,
|
||||||
|
);
|
||||||
|
export const corpInfoList = declareRequest(
|
||||||
|
`Post > @/basicInfo/corpInfo/list`,
|
||||||
|
);
|
||||||
|
export const planDelete = declareRequest(
|
||||||
|
"planLoading",
|
||||||
|
`Delete > @/inspection/safetyEnvironmentalPlan/{id}`,
|
||||||
|
);
|
||||||
|
export const planAdd = declareRequest(
|
||||||
|
"planLoading",
|
||||||
|
`Post > @/inspection/safetyEnvironmentalPlan/save`,
|
||||||
|
);
|
||||||
|
export const planUpdate = declareRequest(
|
||||||
|
"planLoading",
|
||||||
|
`Put > @/inspection/safetyEnvironmentalPlan/edit`,
|
||||||
|
);
|
||||||
|
export const planView = declareRequest(
|
||||||
|
"planLoading",
|
||||||
|
`Get > /inspection/safetyEnvironmentalPlan/{id}`,
|
||||||
|
);
|
||||||
|
export const planUserList = declareRequest(
|
||||||
|
"planUserLoading",
|
||||||
|
`Post > @/inspection/safetyEnvironmentalPlan/planUserList`,
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
import { declareRequest } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
|
||||||
|
export const statisticsList = declareRequest(
|
||||||
|
"statisticsLoading",
|
||||||
|
`Post > @/inspection/safetyEnvironmentalPlan/statisticsList`,
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
import { ReactFlow, ReactFlowProvider } from "@xyflow/react";
|
||||||
|
import { Button, message, Modal } from "antd";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { NS_INSPECTION } from "~/enumerate/namespace";
|
||||||
|
import { getFlowData } from "~/utils/flow";
|
||||||
|
|
||||||
|
function HiddenFlowModal(props) {
|
||||||
|
const [nodes, setNodes] = useState([]);
|
||||||
|
const [edges, setEdges] = useState([]);
|
||||||
|
|
||||||
|
const getData = async () => {
|
||||||
|
const { success, data } = await props["hiddenFlowchart"]({ id: props.id });
|
||||||
|
if (success) {
|
||||||
|
const { nodes, edges } = getFlowData(data.flowCOList, data.thisFlow);
|
||||||
|
setNodes(nodes);
|
||||||
|
setEdges(edges);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error("获取数据失败");
|
||||||
|
props.onCancel();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
useEffect(() => {
|
||||||
|
getData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
title="查看流程图"
|
||||||
|
width={1000}
|
||||||
|
open
|
||||||
|
maskClosable={false}
|
||||||
|
onCancel={props.onCancel}
|
||||||
|
footer={[
|
||||||
|
<Button key="cancel" onClick={props.onCancel}>取消</Button>,
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<ReactFlowProvider>
|
||||||
|
<div style={{ width: "100%", height: 500 }}>
|
||||||
|
<style>
|
||||||
|
{`
|
||||||
|
.react-flow__attribution {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
</style>
|
||||||
|
<ReactFlow
|
||||||
|
nodes={nodes}
|
||||||
|
edges={edges}
|
||||||
|
fitView
|
||||||
|
preventScrolling={false}
|
||||||
|
connectionMode="loose"
|
||||||
|
zoomOnScroll={true}
|
||||||
|
zoomOnPinch={true}
|
||||||
|
panOnScroll={true}
|
||||||
|
panOnScrollSpeed={0.5}
|
||||||
|
connectionLineOptions={{
|
||||||
|
type: "straight",
|
||||||
|
style: { stroke: "transparent", strokeWidth: 0 },
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
</ReactFlow>
|
||||||
|
</div>
|
||||||
|
</ReactFlowProvider>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect([NS_INSPECTION], true)(HiddenFlowModal);
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
import { ReactFlow, ReactFlowProvider } from "@xyflow/react";
|
||||||
|
import { Button, Modal } from "antd";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { NS_INSPECTION } from "~/enumerate/namespace";
|
||||||
|
import { getFlowData } from "~/utils/flow";
|
||||||
|
|
||||||
|
function InspectionFlowModal(props) {
|
||||||
|
const [nodes, setNodes] = useState([]);
|
||||||
|
const [edges, setEdges] = useState([]);
|
||||||
|
|
||||||
|
const getData = async () => {
|
||||||
|
const { data } = await props["inspectionFlowchart"]({ id: props.id });
|
||||||
|
|
||||||
|
// 定义type的顺序
|
||||||
|
const typeOrder = [100, 200, 300, 600, 700, 400, 500];
|
||||||
|
|
||||||
|
// 根据type顺序对flowCOList进行排序
|
||||||
|
const sortedFlowList = [...data.flowCOList].sort((a, b) => {
|
||||||
|
const indexA = typeOrder.indexOf(a.type);
|
||||||
|
const indexB = typeOrder.indexOf(b.type);
|
||||||
|
// 如果type不在预定义顺序中,放到最后
|
||||||
|
return (indexA === -1 ? Infinity : indexA) - (indexB === -1 ? Infinity : indexB);
|
||||||
|
});
|
||||||
|
|
||||||
|
const { nodes, edges } = getFlowData(sortedFlowList, data.thisFlow);
|
||||||
|
setNodes(nodes);
|
||||||
|
setEdges(edges);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
title="查看流程图"
|
||||||
|
width={1000}
|
||||||
|
open
|
||||||
|
maskClosable={false}
|
||||||
|
onCancel={props.onCancel}
|
||||||
|
footer={[
|
||||||
|
<Button key="cancel" onClick={props.onCancel}>取消</Button>,
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<ReactFlowProvider>
|
||||||
|
<div style={{ width: "100%", height: 500 }}>
|
||||||
|
<style>
|
||||||
|
{`
|
||||||
|
.react-flow__attribution {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
</style>
|
||||||
|
<ReactFlow
|
||||||
|
nodes={nodes}
|
||||||
|
edges={edges}
|
||||||
|
fitView
|
||||||
|
preventScrolling={false}
|
||||||
|
connectionMode="loose"
|
||||||
|
zoomOnScroll={true}
|
||||||
|
zoomOnPinch={true}
|
||||||
|
panOnScroll={true}
|
||||||
|
panOnScrollSpeed={0.5}
|
||||||
|
connectionLineOptions={{
|
||||||
|
type: "straight",
|
||||||
|
style: { stroke: "transparent", strokeWidth: 0 },
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
</ReactFlow>
|
||||||
|
</div>
|
||||||
|
</ReactFlowProvider>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect([NS_INSPECTION], true)(InspectionFlowModal);
|
||||||
|
|
@ -22,6 +22,6 @@ export const INSPECTION_STATE_ENUM = [
|
||||||
];
|
];
|
||||||
|
|
||||||
export const PLAN_ENUM = [
|
export const PLAN_ENUM = [
|
||||||
{ bianma: "1", name: "计划外" },
|
{ bianma: "0", name: "计划外" },
|
||||||
{ bianma: "2", name: "计划内" },
|
{ bianma: "1", name: "计划内" },
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -6,3 +6,5 @@ import { defineNamespace } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
|
||||||
export const NS_GLOBAL = defineNamespace("global");
|
export const NS_GLOBAL = defineNamespace("global");
|
||||||
export const NS_INSPECTION = defineNamespace("inspection");
|
export const NS_INSPECTION = defineNamespace("inspection");
|
||||||
|
export const NS_PLAN = defineNamespace("plan");
|
||||||
|
export const NS_STATISTICS = defineNamespace("statistics");
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ function HiddenAddModal(props) {
|
||||||
props.onConfirm({
|
props.onConfirm({
|
||||||
...values,
|
...values,
|
||||||
hiddenPartType,
|
hiddenPartType,
|
||||||
hiddenFindTime: dayjs().format("YYYY-MM-DD hh:mm:ss"),
|
hiddenFindTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
||||||
rectificationType: 2,
|
rectificationType: 2,
|
||||||
});
|
});
|
||||||
props.onCancel();
|
props.onCancel();
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import useIsExistenceDuplicateSelection from "zy-react-library/hooks/useIsExiste
|
||||||
import useUploadFile from "zy-react-library/hooks/useUploadFile";
|
import useUploadFile from "zy-react-library/hooks/useUploadFile";
|
||||||
import { getFileUrl, validatorEndTime } from "zy-react-library/utils";
|
import { getFileUrl, validatorEndTime } from "zy-react-library/utils";
|
||||||
import { INSPECTION_QUESTION_ENUM, PLAN_ENUM } from "~/enumerate/constant";
|
import { INSPECTION_QUESTION_ENUM, PLAN_ENUM } from "~/enumerate/constant";
|
||||||
import { NS_INSPECTION } from "~/enumerate/namespace";
|
import { NS_INSPECTION, NS_PLAN } from "~/enumerate/namespace";
|
||||||
import HiddenAddModal from "./components/HiddenAdd";
|
import HiddenAddModal from "./components/HiddenAdd";
|
||||||
|
|
||||||
function Add(props) {
|
function Add(props) {
|
||||||
|
|
@ -37,9 +37,10 @@ function Add(props) {
|
||||||
const personUnderInspectionDepartmentId = Form.useWatch(["personUnderInspection", "departmentId"], form);
|
const personUnderInspectionDepartmentId = Form.useWatch(["personUnderInspection", "departmentId"], form);
|
||||||
const inspectorList = Form.useWatch("inspectorList", form);
|
const inspectorList = Form.useWatch("inspectorList", form);
|
||||||
const timeStart = Form.useWatch("timeStart", form);
|
const timeStart = Form.useWatch("timeStart", form);
|
||||||
const todo1 = Form.useWatch("todo1", form);
|
const planType = Form.useWatch("planType", form);
|
||||||
|
|
||||||
const [userInfo, setUserInfo] = useState({});
|
const [userInfo, setUserInfo] = useState({});
|
||||||
|
const [planList, setPlanList] = useState([]);
|
||||||
|
|
||||||
const [signatureFilePath, setSignatureFilePath] = useState("");
|
const [signatureFilePath, setSignatureFilePath] = useState("");
|
||||||
|
|
||||||
|
|
@ -50,6 +51,11 @@ function Add(props) {
|
||||||
const [currentHiddenInfo, setCurrentHiddenInfo] = useState({});
|
const [currentHiddenInfo, setCurrentHiddenInfo] = useState({});
|
||||||
const currentHiddenIndex = useRef(-1);
|
const currentHiddenIndex = useRef(-1);
|
||||||
|
|
||||||
|
const getPlanList = async () => {
|
||||||
|
const { data } = await props["planListAll"]();
|
||||||
|
setPlanList(data);
|
||||||
|
};
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
const userInfo = await getUserInfo();
|
const userInfo = await getUserInfo();
|
||||||
setUserInfo(userInfo);
|
setUserInfo(userInfo);
|
||||||
|
|
@ -98,6 +104,7 @@ function Add(props) {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getData();
|
getData();
|
||||||
|
getPlanList();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const getHiddenDiscovererUserList = () => {
|
const getHiddenDiscovererUserList = () => {
|
||||||
|
|
@ -311,7 +318,8 @@ function Add(props) {
|
||||||
<FormBuilder
|
<FormBuilder
|
||||||
form={form}
|
form={form}
|
||||||
values={{
|
values={{
|
||||||
todo1: "1",
|
planType: query.planId ? 1 : 0,
|
||||||
|
planId: query.planId,
|
||||||
situationList: [{ content: undefined }],
|
situationList: [{ content: undefined }],
|
||||||
}}
|
}}
|
||||||
loading={deleteFileLoading || getFileLoading || uploadFileLoading || props.inspection.inspectionLoading}
|
loading={deleteFileLoading || getFileLoading || uploadFileLoading || props.inspection.inspectionLoading}
|
||||||
|
|
@ -334,14 +342,23 @@ function Add(props) {
|
||||||
items: INSPECTION_QUESTION_ENUM,
|
items: INSPECTION_QUESTION_ENUM,
|
||||||
span: 24,
|
span: 24,
|
||||||
},
|
},
|
||||||
{ name: "todo1", label: "计划属性", render: FORM_ITEM_RENDER_ENUM.RADIO, items: PLAN_ENUM, span: todo1 === "1" ? 24 : 12 },
|
|
||||||
{
|
{
|
||||||
name: "todo2",
|
name: "planType",
|
||||||
|
label: "计划属性",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.RADIO,
|
||||||
|
items: PLAN_ENUM.map(item => ({ ...item, bianma: +item.bianma })),
|
||||||
|
span: planType === 0 ? 24 : 12,
|
||||||
|
componentProps: { disabled: query.planId },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "planId",
|
||||||
label: "计划名称",
|
label: "计划名称",
|
||||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||||
items: [],
|
items: planList,
|
||||||
dependencies: ["todo1"],
|
itemsField: { labelKey: "planName", valueKey: "id" },
|
||||||
hidden: formValues => !(formValues.todo1 === "2"),
|
dependencies: ["planType"],
|
||||||
|
hidden: formValues => !(formValues.planType === 1),
|
||||||
|
componentProps: { disabled: query.planId },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: ["personUnderInspection", "departmentId"],
|
name: ["personUnderInspection", "departmentId"],
|
||||||
|
|
@ -597,4 +614,4 @@ function Add(props) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Connect([NS_INSPECTION], true)(Add);
|
export default Connect([NS_INSPECTION, NS_PLAN], true)(Add);
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,27 @@
|
||||||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
import {
|
|
||||||
ReactFlow,
|
import { Button, Form, Space } from "antd";
|
||||||
ReactFlowProvider,
|
import { useState } from "react";
|
||||||
} from "@xyflow/react";
|
|
||||||
import { Button, Form, message, Modal, Space, Spin } from "antd";
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
||||||
import ExportIcon from "zy-react-library/components/Icon/ExportIcon";
|
|
||||||
import Search from "zy-react-library/components/Search";
|
import Search from "zy-react-library/components/Search";
|
||||||
import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj";
|
import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj";
|
||||||
import DictionarySelectTree from "zy-react-library/components/SelectTree/Dictionary";
|
import DictionarySelectTree from "zy-react-library/components/SelectTree/Dictionary";
|
||||||
import Table from "zy-react-library/components/Table";
|
import Table from "zy-react-library/components/Table";
|
||||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||||
|
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||||
import useTable from "zy-react-library/hooks/useTable";
|
import useTable from "zy-react-library/hooks/useTable";
|
||||||
import { getLabelName } from "zy-react-library/utils";
|
import { getLabelName } from "zy-react-library/utils";
|
||||||
|
import InspectionFlowModal from "~/components/InspectionFlowModal";
|
||||||
import { INSPECTION_QUESTION_ENUM, INSPECTION_STATE_ENUM, PLAN_ENUM } from "~/enumerate/constant";
|
import { INSPECTION_QUESTION_ENUM, INSPECTION_STATE_ENUM, PLAN_ENUM } from "~/enumerate/constant";
|
||||||
import { NS_INSPECTION } from "~/enumerate/namespace";
|
import { NS_INSPECTION } from "~/enumerate/namespace";
|
||||||
import { getFlowData } from "~/utils/flow";
|
|
||||||
import "@xyflow/react/dist/style.css";
|
import "@xyflow/react/dist/style.css";
|
||||||
|
|
||||||
function List(props) {
|
function List(props) {
|
||||||
|
const query = useGetUrlQuery();
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
const [flowModalOpen, setFlowModalOpen] = useState(false);
|
const [flowModalOpen, setFlowModalOpen] = useState(false);
|
||||||
const [currentId, setCurrentId] = useState("");
|
const [currentId, setCurrentId] = useState("");
|
||||||
const [count, setCount] = useState({
|
|
||||||
inspectCount: 0,
|
|
||||||
hiddenCount: 0,
|
|
||||||
safetyCount: 0,
|
|
||||||
environmentalCount: 0,
|
|
||||||
});
|
|
||||||
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
|
|
||||||
const { tableProps, getData } = useTable(props["inspectionList"], {
|
const { tableProps, getData } = useTable(props["inspectionList"], {
|
||||||
form,
|
form,
|
||||||
|
|
@ -37,29 +29,8 @@ function List(props) {
|
||||||
checkStartTime: formData.checkTime?.[0],
|
checkStartTime: formData.checkTime?.[0],
|
||||||
checkEndTime: formData.checkTime?.[1],
|
checkEndTime: formData.checkTime?.[1],
|
||||||
}),
|
}),
|
||||||
params: { status: "" },
|
params: { status: "", planId: query.planId, entrance: query.planId ? "2" : "1" },
|
||||||
});
|
});
|
||||||
const getCount = async () => {
|
|
||||||
const { data } = await props["inspectionCount"]();
|
|
||||||
setCount(data);
|
|
||||||
};
|
|
||||||
useEffect(() => {
|
|
||||||
getCount();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const onDelete = (id) => {
|
|
||||||
Modal.confirm({
|
|
||||||
title: "删除确认",
|
|
||||||
content: "确定要删除吗?",
|
|
||||||
onOk: async () => {
|
|
||||||
const { success } = await props["inspectionDelete"]({ id });
|
|
||||||
if (success) {
|
|
||||||
message.success("删除成功");
|
|
||||||
getData();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ padding: 20 }}>
|
<div style={{ padding: 20 }}>
|
||||||
|
|
@ -72,71 +43,30 @@ function List(props) {
|
||||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||||
items: INSPECTION_QUESTION_ENUM,
|
items: INSPECTION_QUESTION_ENUM,
|
||||||
},
|
},
|
||||||
{ name: "inspectionOriginatorUserName", label: "检查发起人" },
|
|
||||||
{ name: "inspectionDeptId", label: "检查部门", render: <DepartmentSelectTree /> },
|
{ name: "inspectionDeptId", label: "检查部门", render: <DepartmentSelectTree /> },
|
||||||
{ name: "inspectionUserName", label: "检查人员" },
|
{ name: "inspectionUserName", label: "检查人" },
|
||||||
{ name: "type", label: "检查类型", render: <DictionarySelectTree dictValue="inspectionType" onlyLastLevel /> },
|
{ name: "type", label: "检查类型", render: <DictionarySelectTree dictValue="inspectionType" onlyLastLevel /> },
|
||||||
|
{ name: "checkTime", label: "检查时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE },
|
||||||
{ name: "inspectedDepartmentId", label: "被检查单位", render: <DepartmentSelectTree searchType={props.searchType} /> },
|
{ name: "inspectedDepartmentId", label: "被检查单位", render: <DepartmentSelectTree searchType={props.searchType} /> },
|
||||||
{ name: "inspectedUserName", label: "被检查单位现场负责人" },
|
{ name: "inspectedUserName", label: "被检查单位现场负责人" },
|
||||||
{ name: "status", label: "检查状态", render: FORM_ITEM_RENDER_ENUM.SELECT, items: INSPECTION_STATE_ENUM },
|
|
||||||
{ name: "checkYear", label: "检查年度", render: FORM_ITEM_RENDER_ENUM.DATE_YEAR },
|
|
||||||
{ name: "checkTime", label: "检查时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE },
|
|
||||||
]}
|
]}
|
||||||
form={form}
|
form={form}
|
||||||
onFinish={getData}
|
onFinish={getData}
|
||||||
/>
|
/>
|
||||||
<Table
|
<Table
|
||||||
headerTitle={(
|
|
||||||
<Spin spinning={props.inspection.inspectionCountLoading}>
|
|
||||||
<Space
|
|
||||||
size={10}
|
|
||||||
style={{
|
|
||||||
padding: "8px 20px",
|
|
||||||
border: "1px solid #abdcff",
|
|
||||||
backgroundColor: "#f0faff",
|
|
||||||
borderRadius: "4px",
|
|
||||||
color: "#515a6e",
|
|
||||||
fontSize: "14px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
安全检查总数:
|
|
||||||
<span style={{ color: "#2d8cf0", fontWeight: 700 }}>{count.safetyCount}</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
环保检查总数:
|
|
||||||
<span style={{ color: "#2d8cf0", fontWeight: 700 }}>{count.environmentalCount}</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
综合检查总数:
|
|
||||||
<span style={{ color: "#2d8cf0", fontWeight: 700 }}>{count.comprehensiveCount}</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
涉及隐患总数:
|
|
||||||
<span style={{ color: "#2d8cf0", fontWeight: 700 }}>{count.hiddenCount}</span>
|
|
||||||
</div>
|
|
||||||
</Space>
|
|
||||||
</Spin>
|
|
||||||
)}
|
|
||||||
toolBarRender={() => (
|
toolBarRender={() => (
|
||||||
<Space>
|
<Space>
|
||||||
<Button
|
{query.edit !== "0" && (
|
||||||
type="primary"
|
<Button
|
||||||
icon={<AddIcon />}
|
type="primary"
|
||||||
onClick={() => {
|
icon={<AddIcon />}
|
||||||
props.history.push("./add");
|
onClick={() => {
|
||||||
}}
|
props.history.push("./add");
|
||||||
>
|
}}
|
||||||
新增
|
>
|
||||||
</Button>
|
新增
|
||||||
<Button
|
</Button>
|
||||||
type="primary"
|
)}
|
||||||
icon={<ExportIcon />}
|
|
||||||
onClick={() => {
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
导出
|
|
||||||
</Button>
|
|
||||||
</Space>
|
</Space>
|
||||||
)}
|
)}
|
||||||
columns={[
|
columns={[
|
||||||
|
|
@ -153,7 +83,7 @@ function List(props) {
|
||||||
dataIndex: "status",
|
dataIndex: "status",
|
||||||
render: (_, record) => (getLabelName({ list: INSPECTION_STATE_ENUM, status: record.status })),
|
render: (_, record) => (getLabelName({ list: INSPECTION_STATE_ENUM, status: record.status })),
|
||||||
},
|
},
|
||||||
{ title: "计划属性", dataIndex: "todo", render: (_, record) => getLabelName({ list: PLAN_ENUM, status: record.todo }) },
|
{ title: "计划属性", dataIndex: "planType", render: (_, record) => getLabelName({ list: PLAN_ENUM, status: record.planType }) },
|
||||||
{ title: "发现隐患数", dataIndex: "hiddenNumber" },
|
{ title: "发现隐患数", dataIndex: "hiddenNumber" },
|
||||||
{
|
{
|
||||||
title: "操作",
|
title: "操作",
|
||||||
|
|
@ -171,8 +101,16 @@ function List(props) {
|
||||||
编辑
|
编辑
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`../../inspectionView?id=${record.id}&inspectionId=${record.inspectionId}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</Button>
|
||||||
{
|
{
|
||||||
record.status !== -1 && (
|
(query.edit === "0" && record.status !== -1) && (
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
@ -184,21 +122,6 @@ function List(props) {
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
onClick={() => {
|
|
||||||
props.history.push(`../../inspectionView?id=${record.id}&inspectionId=${record.inspectionId}`);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
查看
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
type="link"
|
|
||||||
danger
|
|
||||||
onClick={() => onDelete(record.id)}
|
|
||||||
>
|
|
||||||
删除
|
|
||||||
</Button>
|
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
@ -207,7 +130,7 @@ function List(props) {
|
||||||
/>
|
/>
|
||||||
{
|
{
|
||||||
flowModalOpen && (
|
flowModalOpen && (
|
||||||
<FlowModal
|
<InspectionFlowModal
|
||||||
id={currentId}
|
id={currentId}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
setFlowModalOpen(false);
|
setFlowModalOpen(false);
|
||||||
|
|
@ -220,74 +143,4 @@ function List(props) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function FlowModalComponent(props) {
|
|
||||||
const [nodes, setNodes] = useState([]);
|
|
||||||
const [edges, setEdges] = useState([]);
|
|
||||||
|
|
||||||
const getData = async () => {
|
|
||||||
const { data } = await props["inspectionFlowchart"]({ id: props.id });
|
|
||||||
|
|
||||||
// 定义type的顺序
|
|
||||||
const typeOrder = [100, 200, 300, 600, 700, 400, 500];
|
|
||||||
|
|
||||||
// 根据type顺序对flowCOList进行排序
|
|
||||||
const sortedFlowList = [...data.flowCOList].sort((a, b) => {
|
|
||||||
const indexA = typeOrder.indexOf(a.type);
|
|
||||||
const indexB = typeOrder.indexOf(b.type);
|
|
||||||
// 如果type不在预定义顺序中,放到最后
|
|
||||||
return (indexA === -1 ? Infinity : indexA) - (indexB === -1 ? Infinity : indexB);
|
|
||||||
});
|
|
||||||
|
|
||||||
const { nodes, edges } = getFlowData(sortedFlowList, data.thisFlow);
|
|
||||||
setNodes(nodes);
|
|
||||||
setEdges(edges);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getData();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Modal
|
|
||||||
title="查看流程图"
|
|
||||||
width={1000}
|
|
||||||
open
|
|
||||||
maskClosable={false}
|
|
||||||
onCancel={props.onCancel}
|
|
||||||
footer={[
|
|
||||||
<Button key="cancel" onClick={props.onCancel}>取消</Button>,
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<ReactFlowProvider>
|
|
||||||
<div style={{ width: "100%", height: 500 }}>
|
|
||||||
<style>
|
|
||||||
{`
|
|
||||||
.react-flow__attribution {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
`}
|
|
||||||
</style>
|
|
||||||
<ReactFlow
|
|
||||||
nodes={nodes}
|
|
||||||
edges={edges}
|
|
||||||
fitView
|
|
||||||
preventScrolling={false}
|
|
||||||
connectionMode="loose"
|
|
||||||
zoomOnScroll={true}
|
|
||||||
zoomOnPinch={true}
|
|
||||||
panOnScroll={true}
|
|
||||||
panOnScrollSpeed={0.5}
|
|
||||||
connectionLineOptions={{
|
|
||||||
type: "straight",
|
|
||||||
style: { stroke: "transparent", strokeWidth: 0 },
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
</ReactFlow>
|
|
||||||
</div>
|
|
||||||
</ReactFlowProvider>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const FlowModal = Connect([NS_INSPECTION], true)(FlowModalComponent);
|
|
||||||
export default Connect([NS_INSPECTION], true)(List);
|
export default Connect([NS_INSPECTION], true)(List);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,226 @@
|
||||||
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
|
||||||
|
import { Button, Form, message, Modal, Space, Spin } from "antd";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import ExportIcon from "zy-react-library/components/Icon/ExportIcon";
|
||||||
|
import Search from "zy-react-library/components/Search";
|
||||||
|
import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj";
|
||||||
|
import DictionarySelectTree from "zy-react-library/components/SelectTree/Dictionary";
|
||||||
|
import Table from "zy-react-library/components/Table";
|
||||||
|
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||||
|
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||||
|
import useTable from "zy-react-library/hooks/useTable";
|
||||||
|
import { getLabelName } from "zy-react-library/utils";
|
||||||
|
import InspectionFlowModal from "~/components/InspectionFlowModal";
|
||||||
|
import { INSPECTION_QUESTION_ENUM, INSPECTION_STATE_ENUM, PLAN_ENUM } from "~/enumerate/constant";
|
||||||
|
import { NS_INSPECTION } from "~/enumerate/namespace";
|
||||||
|
import "@xyflow/react/dist/style.css";
|
||||||
|
|
||||||
|
function List(props) {
|
||||||
|
const query = useGetUrlQuery();
|
||||||
|
|
||||||
|
const [flowModalOpen, setFlowModalOpen] = useState(false);
|
||||||
|
const [currentId, setCurrentId] = useState("");
|
||||||
|
const [count, setCount] = useState({
|
||||||
|
inspectCount: 0,
|
||||||
|
hiddenCount: 0,
|
||||||
|
safetyCount: 0,
|
||||||
|
environmentalCount: 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
|
const { tableProps, getData } = useTable(props["inspectionList"], {
|
||||||
|
form,
|
||||||
|
transform: formData => ({
|
||||||
|
checkStartTime: formData.checkTime?.[0],
|
||||||
|
checkEndTime: formData.checkTime?.[1],
|
||||||
|
}),
|
||||||
|
params: {
|
||||||
|
status: "",
|
||||||
|
entrance: "0",
|
||||||
|
corpId: query.corpId,
|
||||||
|
checkStartTime: query.checkStartTime,
|
||||||
|
checkEndTime: query.checkEndTime,
|
||||||
|
planType: query.planType,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const getCount = async () => {
|
||||||
|
const { data } = await props["inspectionCount"]({
|
||||||
|
status: "",
|
||||||
|
entrance: "0",
|
||||||
|
corpId: query.corpId,
|
||||||
|
checkStartTime: query.checkStartTime || form.getFieldValue("checkTime")?.[0],
|
||||||
|
checkEndTime: query.checkEndTime || form.getFieldValue("checkTime").checkTime?.[1],
|
||||||
|
planType: query.planType,
|
||||||
|
});
|
||||||
|
setCount(data);
|
||||||
|
};
|
||||||
|
useEffect(() => {
|
||||||
|
getCount();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const onDelete = (id) => {
|
||||||
|
Modal.confirm({
|
||||||
|
title: "删除确认",
|
||||||
|
content: "是否确认删除?删除后连带隐患同时删除。",
|
||||||
|
onOk: async () => {
|
||||||
|
const { success } = await props["inspectionDelete"]({ id });
|
||||||
|
if (success) {
|
||||||
|
message.success("删除成功");
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ padding: 20 }}>
|
||||||
|
<Search
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
values={{
|
||||||
|
checkTime: [query.checkStartTime, query.checkEndTime],
|
||||||
|
planType: query.planType,
|
||||||
|
}}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "inspectionSubject",
|
||||||
|
label: "检查题目",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||||
|
items: INSPECTION_QUESTION_ENUM,
|
||||||
|
},
|
||||||
|
{ name: "inspectionOriginatorUserName", label: "检查发起人" },
|
||||||
|
{ name: "inspectionDeptId", label: "检查部门", render: <DepartmentSelectTree /> },
|
||||||
|
{ name: "inspectionUserName", label: "检查人" },
|
||||||
|
{ name: "type", label: "检查类型", render: <DictionarySelectTree dictValue="inspectionType" onlyLastLevel /> },
|
||||||
|
{ name: "inspectedDepartmentId", label: "被检查单位", render: <DepartmentSelectTree searchType={props.searchType} /> },
|
||||||
|
{ name: "inspectedUserName", label: "被检查单位现场负责人" },
|
||||||
|
{ name: "status", label: "检查状态", render: FORM_ITEM_RENDER_ENUM.SELECT, items: INSPECTION_STATE_ENUM },
|
||||||
|
{ name: "checkYear", label: "检查年度", render: FORM_ITEM_RENDER_ENUM.DATE_YEAR },
|
||||||
|
{ name: "checkTime", label: "检查时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE },
|
||||||
|
{ name: "planType", label: "计划属性", render: FORM_ITEM_RENDER_ENUM.SELECT, items: PLAN_ENUM },
|
||||||
|
]}
|
||||||
|
form={form}
|
||||||
|
onFinish={getData}
|
||||||
|
/>
|
||||||
|
<Table
|
||||||
|
headerTitle={(
|
||||||
|
<Spin spinning={props.inspection.inspectionCountLoading}>
|
||||||
|
<Space
|
||||||
|
size={10}
|
||||||
|
style={{
|
||||||
|
padding: "8px 20px",
|
||||||
|
border: "1px solid #abdcff",
|
||||||
|
backgroundColor: "#f0faff",
|
||||||
|
borderRadius: "4px",
|
||||||
|
color: "#515a6e",
|
||||||
|
fontSize: "14px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
安全检查总数:
|
||||||
|
<span style={{ color: "#2d8cf0", fontWeight: 700 }}>{count.safetyCount}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
环保检查总数:
|
||||||
|
<span style={{ color: "#2d8cf0", fontWeight: 700 }}>{count.environmentalCount}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
综合检查总数:
|
||||||
|
<span style={{ color: "#2d8cf0", fontWeight: 700 }}>{count.comprehensiveCount}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
涉及隐患总数:
|
||||||
|
<span style={{ color: "#2d8cf0", fontWeight: 700 }}>{count.hiddenCount}</span>
|
||||||
|
</div>
|
||||||
|
</Space>
|
||||||
|
</Spin>
|
||||||
|
)}
|
||||||
|
toolBarRender={() => (
|
||||||
|
<Space>
|
||||||
|
{query.entrance !== "statistics" && (
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
icon={<ExportIcon />}
|
||||||
|
onClick={() => {
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
导出
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</Space>
|
||||||
|
)}
|
||||||
|
columns={[
|
||||||
|
{ title: "检查题目", dataIndex: "subject" },
|
||||||
|
{ title: "检查发起人", dataIndex: "inspectionOriginatorUserName" },
|
||||||
|
{ title: "检查部门", dataIndex: "inspectionDepartmentName" },
|
||||||
|
{ title: "检查人", dataIndex: "inspectionInspectorUserName" },
|
||||||
|
{ title: "被检查单位", dataIndex: "inspectionSiteDepartmentName" },
|
||||||
|
{ title: "被检查单位现场负责人", dataIndex: "inspectedSiteManagerName", width: 200 },
|
||||||
|
{ title: "检查类型", dataIndex: "typeName" },
|
||||||
|
{ title: "检查时间", width: 200, render: (_, record) => (`${record.timeStart}至${record.timeEnd}`) },
|
||||||
|
{
|
||||||
|
title: "检查状态",
|
||||||
|
dataIndex: "status",
|
||||||
|
render: (_, record) => (getLabelName({ list: INSPECTION_STATE_ENUM, status: record.status })),
|
||||||
|
},
|
||||||
|
{ title: "计划属性", dataIndex: "planType", render: (_, record) => getLabelName({ list: PLAN_ENUM, status: record.planType }) },
|
||||||
|
{ title: "发现隐患数", dataIndex: "hiddenNumber" },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
fixed: "right",
|
||||||
|
width: 200,
|
||||||
|
render: (_, record) => (
|
||||||
|
<Space>
|
||||||
|
{
|
||||||
|
record.status !== -1 && (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
setFlowModalOpen(true);
|
||||||
|
setCurrentId(record.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
流程图
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`../../inspectionView?id=${record.id}&inspectionId=${record.inspectionId}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</Button>
|
||||||
|
{query.entrance !== "statistics" && (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
danger
|
||||||
|
onClick={() => onDelete(record.id)}
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
{
|
||||||
|
flowModalOpen && (
|
||||||
|
<InspectionFlowModal
|
||||||
|
id={currentId}
|
||||||
|
onCancel={() => {
|
||||||
|
setFlowModalOpen(false);
|
||||||
|
setCurrentId("");
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect([NS_INSPECTION], true)(List);
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Records(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Records;
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
import { ReactFlow, ReactFlowProvider } from "@xyflow/react";
|
import { Button, Descriptions, Divider, Modal, Space, Spin } from "antd";
|
||||||
import { Button, Descriptions, Divider, message, Modal, Space, Spin } from "antd";
|
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import { useReactToPrint } from "react-to-print";
|
import { useReactToPrint } from "react-to-print";
|
||||||
import HeaderBack from "zy-react-library/components/HeaderBack";
|
import HeaderBack from "zy-react-library/components/HeaderBack";
|
||||||
|
|
@ -12,9 +11,9 @@ import useGetFile from "zy-react-library/hooks/useGetFile";
|
||||||
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||||
import useGetUserInfo from "zy-react-library/hooks/useGetUserInfo";
|
import useGetUserInfo from "zy-react-library/hooks/useGetUserInfo";
|
||||||
import { getFileUrl, getLabelName } from "zy-react-library/utils";
|
import { getFileUrl, getLabelName } from "zy-react-library/utils";
|
||||||
|
import HiddenFlowModal from "~/components/HiddenFlowModal";
|
||||||
import { PLAN_ENUM } from "~/enumerate/constant";
|
import { PLAN_ENUM } from "~/enumerate/constant";
|
||||||
import { NS_INSPECTION } from "~/enumerate/namespace";
|
import { NS_INSPECTION } from "~/enumerate/namespace";
|
||||||
import { getFlowData } from "~/utils/flow";
|
|
||||||
import "./index.less";
|
import "./index.less";
|
||||||
|
|
||||||
function InspectionView(props) {
|
function InspectionView(props) {
|
||||||
|
|
@ -84,15 +83,15 @@ function InspectionView(props) {
|
||||||
bordered
|
bordered
|
||||||
styles={{ label: { width: 200 } }}
|
styles={{ label: { width: 200 } }}
|
||||||
items={[
|
items={[
|
||||||
{ label: "被检查单位", children: info.inspectedPartyConfirmation.departmentName },
|
{ label: "被检查单位", children: info.inspectedPartyConfirmation?.departmentName },
|
||||||
{ label: "被检查单位现场负责人", children: info.inspectedPartyConfirmation.userName },
|
{ label: "被检查单位现场负责人", children: info.inspectedPartyConfirmation?.userName },
|
||||||
{ label: "牵头检查部门", children: info.currentInspectorUser.departmentName },
|
{ label: "牵头检查部门", children: info.currentInspectorUser?.departmentName },
|
||||||
{ label: "检查人", children: info.currentInspectorUser.userName },
|
{ label: "检查人", children: info.currentInspectorUser?.userName },
|
||||||
{ label: "检查类型", children: info.typeName },
|
{ label: "检查类型", children: info.typeName },
|
||||||
{ label: "检查时间", children: `${info.timeStart}至${info.timeEnd}` },
|
{ label: "检查时间", children: `${info.timeStart}至${info.timeEnd}` },
|
||||||
{ label: "检查场所", children: info.place, span: 2 },
|
{ label: "检查场所", children: info.place, span: 2 },
|
||||||
{ label: "计划属性", children: getLabelName({ list: PLAN_ENUM, status: info.todo1 }), span: 2 },
|
{ label: "计划属性", children: getLabelName({ list: PLAN_ENUM, status: info.planType }), span: 2 },
|
||||||
{ label: "计划名称", children: info.todo2, span: 2 },
|
...(info.planType === 1 ? [{ label: "计划名称", children: info.planName, span: 2 }] : []),
|
||||||
{ label: "记录填写时间", children: info.createTime, span: 2 },
|
{ label: "记录填写时间", children: info.createTime, span: 2 },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|
@ -229,7 +228,7 @@ function InspectionView(props) {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{flowModalOpen && (
|
{flowModalOpen && (
|
||||||
<FlowModal
|
<HiddenFlowModal
|
||||||
id={currentId}
|
id={currentId}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
setFlowModalOpen(false);
|
setFlowModalOpen(false);
|
||||||
|
|
@ -258,68 +257,4 @@ function HiddenViewModal(props) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function FlowModalComponent(props) {
|
|
||||||
const [nodes, setNodes] = useState([]);
|
|
||||||
const [edges, setEdges] = useState([]);
|
|
||||||
|
|
||||||
const getData = async () => {
|
|
||||||
const { success, data } = await props["hiddenFlowchart"]({ id: props.id });
|
|
||||||
if (success) {
|
|
||||||
const { nodes, edges } = getFlowData(data.flowCOList, data.thisFlow);
|
|
||||||
setNodes(nodes);
|
|
||||||
setEdges(edges);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
message.error("获取数据失败");
|
|
||||||
props.onCancel();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
useEffect(() => {
|
|
||||||
getData();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Modal
|
|
||||||
title="查看流程图"
|
|
||||||
width={1000}
|
|
||||||
open
|
|
||||||
maskClosable={false}
|
|
||||||
onCancel={props.onCancel}
|
|
||||||
footer={[
|
|
||||||
<Button key="cancel" onClick={props.onCancel}>取消</Button>,
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<ReactFlowProvider>
|
|
||||||
<div style={{ width: "100%", height: 500 }}>
|
|
||||||
<style>
|
|
||||||
{`
|
|
||||||
.react-flow__attribution {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
`}
|
|
||||||
</style>
|
|
||||||
<ReactFlow
|
|
||||||
nodes={nodes}
|
|
||||||
edges={edges}
|
|
||||||
fitView
|
|
||||||
preventScrolling={false}
|
|
||||||
connectionMode="loose"
|
|
||||||
zoomOnScroll={true}
|
|
||||||
zoomOnPinch={true}
|
|
||||||
panOnScroll={true}
|
|
||||||
panOnScrollSpeed={0.5}
|
|
||||||
connectionLineOptions={{
|
|
||||||
type: "straight",
|
|
||||||
style: { stroke: "transparent", strokeWidth: 0 },
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
</ReactFlow>
|
|
||||||
</div>
|
|
||||||
</ReactFlowProvider>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const FlowModal = Connect([NS_INSPECTION], true)(FlowModalComponent);
|
|
||||||
|
|
||||||
export default Connect([NS_INSPECTION], true)(InspectionView);
|
export default Connect([NS_INSPECTION], true)(InspectionView);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,176 @@
|
||||||
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
import { Button, Form, Modal, Space } from "antd";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { useState } from "react";
|
||||||
|
import Search from "zy-react-library/components/Search";
|
||||||
|
import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj";
|
||||||
|
import DictionarySelectTree from "zy-react-library/components/SelectTree/Dictionary";
|
||||||
|
import Table from "zy-react-library/components/Table";
|
||||||
|
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||||
|
import useTable from "zy-react-library/hooks/useTable";
|
||||||
|
import { NS_PLAN } from "~/enumerate/namespace";
|
||||||
|
|
||||||
|
function List(props) {
|
||||||
|
const [planExecutionPersonnelModalOpen, setPlanExecutionPersonnelModalOpen] = useState(false);
|
||||||
|
const [currentId, setCurrentId] = useState("");
|
||||||
|
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const { tableProps, getData } = useTable(props["planList"], {
|
||||||
|
form,
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ padding: 20 }}>
|
||||||
|
<Search
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "planType",
|
||||||
|
label: "计划类型",
|
||||||
|
render: (<DictionarySelectTree dictValue="inspectionType" onlyLastLevel />),
|
||||||
|
},
|
||||||
|
{ name: "planName", label: "计划名称" },
|
||||||
|
{ name: "startTime", label: "计划开始时间", render: FORM_ITEM_RENDER_ENUM.DATE },
|
||||||
|
{ name: "endTime", label: "计划结束时间", render: FORM_ITEM_RENDER_ENUM.DATE },
|
||||||
|
]}
|
||||||
|
form={form}
|
||||||
|
onFinish={getData}
|
||||||
|
/>
|
||||||
|
<Table
|
||||||
|
columns={[
|
||||||
|
{ title: "计划名称", dataIndex: "planName" },
|
||||||
|
{ title: "计划类型", dataIndex: "planTypeName" },
|
||||||
|
{ title: "计划开始时间", dataIndex: "planStartTime" },
|
||||||
|
{ title: "计划结束时间", dataIndex: "planEndTime" },
|
||||||
|
{
|
||||||
|
title: "计划执行人员",
|
||||||
|
dataIndex: "userExecuteTotal",
|
||||||
|
render: (_, record) => (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
setPlanExecutionPersonnelModalOpen(true);
|
||||||
|
setCurrentId(record.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{record.userExecuteTotal}
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "计划状态",
|
||||||
|
dataIndex: "status",
|
||||||
|
render: (_, record) => {
|
||||||
|
const { planExecuteTotal, userExecuteNum, planStartTime, planEndTime } = record;
|
||||||
|
const currentTime = dayjs();
|
||||||
|
|
||||||
|
let statusText = "";
|
||||||
|
|
||||||
|
if (planExecuteTotal === userExecuteNum && planExecuteTotal > 0) {
|
||||||
|
statusText = "已完成";
|
||||||
|
}
|
||||||
|
else if (currentTime.isBefore(planStartTime, "day")) {
|
||||||
|
statusText = "未开始";
|
||||||
|
}
|
||||||
|
else if ((currentTime.isAfter(planStartTime, "day") || currentTime.isSame(planStartTime, "day"))
|
||||||
|
&& (currentTime.isBefore(planEndTime, "day") || currentTime.isSame(planEndTime, "day"))) {
|
||||||
|
statusText = "执行中";
|
||||||
|
}
|
||||||
|
|
||||||
|
return statusText;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
fixed: "right",
|
||||||
|
width: 200,
|
||||||
|
render: (_, record) => {
|
||||||
|
const { planStartTime, planEndTime } = record;
|
||||||
|
const currentTime = dayjs();
|
||||||
|
const isInProgress = (currentTime.isAfter(planStartTime, "day") || currentTime.isSame(planStartTime, "day"))
|
||||||
|
&& (currentTime.isBefore(planEndTime, "day") || currentTime.isSame(planEndTime, "day"));
|
||||||
|
return (
|
||||||
|
<Space>
|
||||||
|
{isInProgress && (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`../../inspection/inspection/add?planId=${record.id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
发起检查
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`../../inspection/inspection/list?planId=${record.id}&edit=0`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
检查记录
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
{
|
||||||
|
planExecutionPersonnelModalOpen && (
|
||||||
|
<PlanExecutionPersonnelModal
|
||||||
|
id={currentId}
|
||||||
|
onCancel={() => {
|
||||||
|
setPlanExecutionPersonnelModalOpen(false);
|
||||||
|
setCurrentId("");
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const PlanExecutionPersonnelModalComponent = (props) => {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const { tableProps, getData } = useTable(props["planUserList"], {
|
||||||
|
form,
|
||||||
|
params: { planId: props.id },
|
||||||
|
useStorageQueryCriteria: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
title="计划执行人员"
|
||||||
|
open
|
||||||
|
maskClosable={false}
|
||||||
|
width={1000}
|
||||||
|
onCancel={props.onCancel}
|
||||||
|
footer={[
|
||||||
|
<Button key="cancel" onClick={props.onCancel}>取消</Button>,
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Search
|
||||||
|
labelCol={{ span: 6 }}
|
||||||
|
options={[
|
||||||
|
{ name: "departmentId", label: "部门", render: <DepartmentSelectTree /> },
|
||||||
|
{ name: "userName", label: "人员" },
|
||||||
|
]}
|
||||||
|
form={form}
|
||||||
|
onFinish={getData}
|
||||||
|
/>
|
||||||
|
<Table
|
||||||
|
columns={[
|
||||||
|
{ title: "部门", dataIndex: "departmentName" },
|
||||||
|
{ title: "岗位", dataIndex: "postName" },
|
||||||
|
{ title: "姓名", dataIndex: "userName" },
|
||||||
|
]}
|
||||||
|
disabledResizer={true}
|
||||||
|
options={false}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const PlanExecutionPersonnelModal = Connect([NS_PLAN], true)(PlanExecutionPersonnelModalComponent);
|
||||||
|
export default Connect([NS_PLAN], true)(List);
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Execute(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Execute;
|
||||||
|
|
@ -0,0 +1,402 @@
|
||||||
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
import { Button, Form, message, Modal, Space } from "antd";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import FormBuilder from "zy-react-library/components/FormBuilder";
|
||||||
|
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
||||||
|
import Search from "zy-react-library/components/Search";
|
||||||
|
import PersonnelSelect from "zy-react-library/components/Select/Personnel/Gwj";
|
||||||
|
import DictionarySelectTree from "zy-react-library/components/SelectTree/Dictionary";
|
||||||
|
import Table from "zy-react-library/components/Table";
|
||||||
|
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||||
|
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||||
|
import useGetUserInfo from "zy-react-library/hooks/useGetUserInfo";
|
||||||
|
import useTable from "zy-react-library/hooks/useTable";
|
||||||
|
import { getLabelName, validatorEndTime } from "zy-react-library/utils";
|
||||||
|
import { NS_PLAN } from "~/enumerate/namespace";
|
||||||
|
import ViewInfo from "~/pages/Container/BranchCompany/Plan/ViewInfo";
|
||||||
|
|
||||||
|
function List(props) {
|
||||||
|
const query = useGetUrlQuery();
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const { tableProps, getData } = useTable(props["planList"], {
|
||||||
|
form,
|
||||||
|
params: {
|
||||||
|
corpId: query.corpId,
|
||||||
|
startTime: query.startTime,
|
||||||
|
endTime: query.endTime,
|
||||||
|
completedOnly: query.completedOnly,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||||
|
const [viewModalOpen, setViewModalOpen] = useState(false);
|
||||||
|
const [currentId, setCurrentId] = useState("");
|
||||||
|
|
||||||
|
const onDelete = (id) => {
|
||||||
|
Modal.confirm({
|
||||||
|
title: "删除确认",
|
||||||
|
content: "确定要删除吗?",
|
||||||
|
onOk: async () => {
|
||||||
|
const { success } = await props["planDelete"]({ id });
|
||||||
|
if (success) {
|
||||||
|
message.success("删除成功");
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ padding: 20 }}>
|
||||||
|
<Search
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "planType",
|
||||||
|
label: "计划类型",
|
||||||
|
render: (<DictionarySelectTree dictValue="inspectionType" onlyLastLevel />),
|
||||||
|
},
|
||||||
|
{ name: "planName", label: "计划名称" },
|
||||||
|
{ name: "startTime", label: "计划开始时间", render: FORM_ITEM_RENDER_ENUM.DATE },
|
||||||
|
{ name: "endTime", label: "计划结束时间", render: FORM_ITEM_RENDER_ENUM.DATE },
|
||||||
|
]}
|
||||||
|
form={form}
|
||||||
|
onFinish={getData}
|
||||||
|
/>
|
||||||
|
<Table
|
||||||
|
toolBarRender={() => (
|
||||||
|
<>
|
||||||
|
{query.entrance !== "statistics" && (
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
icon={<AddIcon />}
|
||||||
|
onClick={() => {
|
||||||
|
setAddModalOpen(true);
|
||||||
|
setCurrentId("");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
新增
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
columns={[
|
||||||
|
{ title: "计划名称", dataIndex: "planName" },
|
||||||
|
{ title: "计划类型", dataIndex: "planTypeName" },
|
||||||
|
{ title: "计划开始时间", dataIndex: "planStartTime" },
|
||||||
|
{ title: "计划结束时间", dataIndex: "planEndTime" },
|
||||||
|
{
|
||||||
|
title: "计划执行总次数",
|
||||||
|
dataIndex: "planExecuteTotal",
|
||||||
|
render: (_, record) => (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`./planExecutionDetails?planId=${record.id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{record.planExecuteTotal}
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "人员执行情况",
|
||||||
|
dataIndex: "userExecuteNum",
|
||||||
|
render: (_, record) => (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`./personnelExecutionRecords?planId=${record.id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{`${record.userExecuteNum}/${record.userExecuteTotal}`}
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "计划状态",
|
||||||
|
dataIndex: "status",
|
||||||
|
render: (_, record) => {
|
||||||
|
const { planExecuteTotal, userExecuteNum, planStartTime, planEndTime } = record;
|
||||||
|
const currentTime = dayjs();
|
||||||
|
|
||||||
|
let statusText = "";
|
||||||
|
|
||||||
|
if (planExecuteTotal === userExecuteNum && planExecuteTotal > 0) {
|
||||||
|
statusText = "已完成";
|
||||||
|
}
|
||||||
|
else if (currentTime.isBefore(planStartTime, "day")) {
|
||||||
|
statusText = "未开始";
|
||||||
|
}
|
||||||
|
else if ((currentTime.isAfter(planStartTime, "day") || currentTime.isSame(planStartTime, "day"))
|
||||||
|
&& (currentTime.isBefore(planEndTime, "day") || currentTime.isSame(planEndTime, "day"))) {
|
||||||
|
statusText = "执行中";
|
||||||
|
}
|
||||||
|
|
||||||
|
return statusText;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
fixed: "right",
|
||||||
|
width: 200,
|
||||||
|
render: (_, record) => {
|
||||||
|
const isBeforeStart = dayjs().isBefore(record.planStartTime, "day");
|
||||||
|
return (
|
||||||
|
<Space>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
setViewModalOpen(true);
|
||||||
|
setCurrentId(record.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</Button>
|
||||||
|
{
|
||||||
|
(isBeforeStart && query.entrance !== "statistics") && (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
setAddModalOpen(true);
|
||||||
|
setCurrentId(record.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(isBeforeStart && query.entrance !== "statistics") && (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
danger
|
||||||
|
onClick={() => {
|
||||||
|
onDelete(record.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
{addModalOpen && (
|
||||||
|
<AddModal
|
||||||
|
id={currentId}
|
||||||
|
onCancel={() => {
|
||||||
|
setAddModalOpen(false);
|
||||||
|
setCurrentId("");
|
||||||
|
}}
|
||||||
|
supervision={props.supervision}
|
||||||
|
getData={getData}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{viewModalOpen && (
|
||||||
|
<ViewModal
|
||||||
|
id={currentId}
|
||||||
|
supervision={props.supervision}
|
||||||
|
onCancel={() => {
|
||||||
|
setViewModalOpen(false);
|
||||||
|
setCurrentId("");
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const AddModalComponent = (props) => {
|
||||||
|
const [userInfo, setUserInfo] = useState({});
|
||||||
|
const [corpInfoList, setCorpInfoList] = useState([]);
|
||||||
|
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const planStartTime = Form.useWatch("planStartTime", form);
|
||||||
|
const corpId = Form.useWatch("corpId", form);
|
||||||
|
const { getUserInfo } = useGetUserInfo();
|
||||||
|
|
||||||
|
const getCorpInfoList = async () => {
|
||||||
|
const { data } = await props["corpInfoList"]({ pageSize: 9999, pageIndex: 1, enterpriseType: 2 });
|
||||||
|
setCorpInfoList(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getData = async () => {
|
||||||
|
if (props.supervision !== "1") {
|
||||||
|
const userInfo = await getUserInfo();
|
||||||
|
setUserInfo(userInfo);
|
||||||
|
}
|
||||||
|
if (props.id) {
|
||||||
|
const { data } = await props["planView"]({ id: props.id });
|
||||||
|
form.setFieldsValue({
|
||||||
|
...data,
|
||||||
|
userId: data.userId.split(","),
|
||||||
|
userName: data.userName.split(","),
|
||||||
|
departmentId: data.departmentId.split(","),
|
||||||
|
departmentName: data.departmentName.split(","),
|
||||||
|
postId: data.postId.split(","),
|
||||||
|
postName: data.postName.split(","),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getData();
|
||||||
|
props.supervision === "1" && getCorpInfoList();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const onSubmit = async (values) => {
|
||||||
|
const { success } = await props[!props.id ? "planAdd" : "planUpdate"]({
|
||||||
|
...values,
|
||||||
|
id: props.id,
|
||||||
|
userId: values.userId.join(","),
|
||||||
|
userName: values.userName.join(","),
|
||||||
|
departmentId: values.departmentId.join(","),
|
||||||
|
departmentName: values.departmentName.join(","),
|
||||||
|
postId: values.postId.join(","),
|
||||||
|
postName: values.postName.join(","),
|
||||||
|
});
|
||||||
|
if (success) {
|
||||||
|
message.success("操作成功");
|
||||||
|
props.onCancel();
|
||||||
|
props.getData();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
title={props.id ? "编辑" : "新增"}
|
||||||
|
width={800}
|
||||||
|
open
|
||||||
|
maskClosable={false}
|
||||||
|
onOk={form.submit}
|
||||||
|
onCancel={props.onCancel}
|
||||||
|
loading={props.plan.planLoading}
|
||||||
|
>
|
||||||
|
<FormBuilder
|
||||||
|
form={form}
|
||||||
|
showActionButtons={false}
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
span={24}
|
||||||
|
onFinish={onSubmit}
|
||||||
|
options={[
|
||||||
|
{ name: "planName", label: "计划名称" },
|
||||||
|
{
|
||||||
|
name: "planType",
|
||||||
|
label: "计划类型",
|
||||||
|
render: (
|
||||||
|
<DictionarySelectTree
|
||||||
|
dictValue="inspectionType"
|
||||||
|
onlyLastLevel
|
||||||
|
onGetLabel={label => form.setFieldValue("planTypeName", label)}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{ name: "planTypeName", label: "计划类型", onlyForLabel: true },
|
||||||
|
{ name: "planStartTime", label: "计划开始时间", render: FORM_ITEM_RENDER_ENUM.DATE },
|
||||||
|
{
|
||||||
|
name: "planEndTime",
|
||||||
|
label: "计划结束时间",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.DATE,
|
||||||
|
rules: [validatorEndTime(planStartTime)],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "corpId",
|
||||||
|
label: "计划执行单位",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||||
|
items: corpInfoList,
|
||||||
|
itemsField: { labelKey: "corpName", valueKey: "id" },
|
||||||
|
hidden: !(props.supervision === "1"),
|
||||||
|
componentProps: {
|
||||||
|
onChange: (event) => {
|
||||||
|
form.setFieldValue("corpName", getLabelName({ list: corpInfoList, status: event, idKey: "id", nameKey: "corpName" }));
|
||||||
|
form.setFieldValue("userId", []);
|
||||||
|
form.setFieldValue("userName", []);
|
||||||
|
form.setFieldValue("departmentId", []);
|
||||||
|
form.setFieldValue("departmentName", []);
|
||||||
|
form.setFieldValue("postId", []);
|
||||||
|
form.setFieldValue("postName", []);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ name: "corpName", label: "计划执行单位名称", onlyForLabel: true },
|
||||||
|
{
|
||||||
|
name: "userId",
|
||||||
|
label: "计划执行人员",
|
||||||
|
render: (() => {
|
||||||
|
const commonProps = {
|
||||||
|
mode: "multiple",
|
||||||
|
labelRender: item => `${item.name}(${[item.departmentName, item.postName].filter(Boolean).join("-")})`,
|
||||||
|
onGetLabel: (label) => {
|
||||||
|
form.setFieldValue("userName", label);
|
||||||
|
},
|
||||||
|
onGetOption: (option) => {
|
||||||
|
const departmentId = [];
|
||||||
|
const departmentName = [];
|
||||||
|
const postId = [];
|
||||||
|
const postName = [];
|
||||||
|
for (let i = 0; i < option.length; i++) {
|
||||||
|
departmentId.push(option[i].departmentId);
|
||||||
|
departmentName.push(option[i].departmentName);
|
||||||
|
postId.push(option[i].postId);
|
||||||
|
postName.push(option[i].postName);
|
||||||
|
}
|
||||||
|
form.setFieldValue("departmentId", departmentId);
|
||||||
|
form.setFieldValue("departmentName", departmentName);
|
||||||
|
form.setFieldValue("postId", postId);
|
||||||
|
form.setFieldValue("postName", postName);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return props.supervision === "1"
|
||||||
|
? (
|
||||||
|
<PersonnelSelect
|
||||||
|
params={{ corpinfoId: corpId }}
|
||||||
|
isNeedCorpInfoId={true}
|
||||||
|
isNeedDepartmentId={false}
|
||||||
|
{...commonProps}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
: (
|
||||||
|
<PersonnelSelect
|
||||||
|
params={{ departmentId: userInfo.departmentId }}
|
||||||
|
{...commonProps}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})(),
|
||||||
|
},
|
||||||
|
{ name: "userName", label: "计划执行人员名称", onlyForLabel: true },
|
||||||
|
{ name: "departmentId", label: "计划执行人员部门", onlyForLabel: true },
|
||||||
|
{ name: "departmentName", label: "计划执行人员部门名称", onlyForLabel: true },
|
||||||
|
{ name: "postId", label: "计划执行人员岗位", onlyForLabel: true },
|
||||||
|
{ name: "postName", label: "计划执行人员岗位名称", onlyForLabel: true },
|
||||||
|
{ name: "planExecuteNum", label: "计划执行次数", render: FORM_ITEM_RENDER_ENUM.NUMBER },
|
||||||
|
{ name: "remarks", label: "备注", required: false, render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const ViewModal = (props) => {
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
title="查看"
|
||||||
|
width={800}
|
||||||
|
open
|
||||||
|
maskClosable={false}
|
||||||
|
onCancel={props.onCancel}
|
||||||
|
footer={[
|
||||||
|
<Button key="cancel" onClick={props.onCancel}>取消</Button>,
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<ViewInfo id={props.id} supervision={props.supervision} />
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const AddModal = Connect([NS_PLAN], true)(AddModalComponent);
|
||||||
|
export default Connect([NS_PLAN], true)(List);
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
import { Button, Divider, Space } from "antd";
|
||||||
|
import HeaderBack from "zy-react-library/components/HeaderBack";
|
||||||
|
import Table from "zy-react-library/components/Table";
|
||||||
|
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||||
|
import useTable from "zy-react-library/hooks/useTable";
|
||||||
|
import { getLabelName } from "zy-react-library/utils";
|
||||||
|
import { INSPECTION_STATE_ENUM } from "~/enumerate/constant";
|
||||||
|
import { NS_INSPECTION } from "~/enumerate/namespace";
|
||||||
|
import ViewInfo from "~/pages/Container/BranchCompany/Plan/ViewInfo";
|
||||||
|
|
||||||
|
function PersonnelExecutionDetails(props) {
|
||||||
|
const query = useGetUrlQuery();
|
||||||
|
const { tableProps } = useTable(props["inspectionList"], { params: { status: "", entrance: "2", checkUserId: query.userId } });
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<HeaderBack title="计划执行总次数" />
|
||||||
|
<div style={{ padding: "0 20px 20px 20px" }}>
|
||||||
|
<Divider orientation="left">计划信息</Divider>
|
||||||
|
<ViewInfo id={query.planId} />
|
||||||
|
<Divider orientation="left">人员执行详情</Divider>
|
||||||
|
<Table
|
||||||
|
headerTitle={query.userName}
|
||||||
|
columns={[
|
||||||
|
{ title: "检查题目", dataIndex: "subject" },
|
||||||
|
{ title: "检查发起人", dataIndex: "inspectionOriginatorUserName" },
|
||||||
|
{ title: "检查部门", dataIndex: "inspectionDepartmentName" },
|
||||||
|
{ title: "检查人员", dataIndex: "inspectionInspectorUserName" },
|
||||||
|
{ title: "被检查单位", dataIndex: "inspectionSiteDepartmentName" },
|
||||||
|
{ title: "被检查单位现场负责人", dataIndex: "inspectedSiteManagerName", width: 200 },
|
||||||
|
{ title: "检查类型", dataIndex: "typeName" },
|
||||||
|
{ title: "检查时间", width: 200, render: (_, record) => (`${record.timeStart}至${record.timeEnd}`) },
|
||||||
|
{
|
||||||
|
title: "检查状态",
|
||||||
|
dataIndex: "status",
|
||||||
|
render: (_, record) => (getLabelName({ list: INSPECTION_STATE_ENUM, status: record.status })),
|
||||||
|
},
|
||||||
|
{ title: "发现隐患数", dataIndex: "hiddenNumber" },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
fixed: "right",
|
||||||
|
width: 100,
|
||||||
|
render: (_, record) => (
|
||||||
|
<Space>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`../../inspectionView?id=${record.id}&inspectionId=${record.inspectionId}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
disabledResizer={true}
|
||||||
|
options={false}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect([NS_INSPECTION], true)(PersonnelExecutionDetails);
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
import { Button, Form } from "antd";
|
||||||
|
import HeaderBack from "zy-react-library/components/HeaderBack";
|
||||||
|
import Search from "zy-react-library/components/Search";
|
||||||
|
import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj";
|
||||||
|
import Table from "zy-react-library/components/Table";
|
||||||
|
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||||
|
import useTable from "zy-react-library/hooks/useTable";
|
||||||
|
import { NS_PLAN } from "~/enumerate/namespace";
|
||||||
|
|
||||||
|
function PersonnelExecutionRecords(props) {
|
||||||
|
const query = useGetUrlQuery();
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const { tableProps, getData } = useTable(props["planUserList"], {
|
||||||
|
form,
|
||||||
|
params: { planId: query.planId },
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<HeaderBack title="人员执行情况" />
|
||||||
|
<div style={{ padding: "0 20px 20px 20px" }}>
|
||||||
|
<Search
|
||||||
|
labelCol={{ span: 4 }}
|
||||||
|
options={[
|
||||||
|
{ name: "departmentId", label: "部门", render: <DepartmentSelectTree /> },
|
||||||
|
{ name: "userName", label: "人员" },
|
||||||
|
]}
|
||||||
|
form={form}
|
||||||
|
onFinish={getData}
|
||||||
|
/>
|
||||||
|
<Table
|
||||||
|
columns={[
|
||||||
|
{ title: "部门", dataIndex: "departmentName" },
|
||||||
|
{ title: "岗位", dataIndex: "postName" },
|
||||||
|
{ title: "姓名", dataIndex: "userName" },
|
||||||
|
{
|
||||||
|
title: "计划执行情况",
|
||||||
|
dataIndex: "planExecuteNum",
|
||||||
|
render: (_, record) => (`${record.actualExecCount}/${record.planExecuteNum}`),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
fixed: "right",
|
||||||
|
width: 150,
|
||||||
|
render: (_, record) => (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`./personnelExecutionDetails?id=${record.id}&planId=${record.planId}&userId=${record.userId}&userName=${record.userName}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
人员执行详情
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect([NS_PLAN], true)(PersonnelExecutionRecords);
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
import { Button, Divider, Space } from "antd";
|
||||||
|
import HeaderBack from "zy-react-library/components/HeaderBack";
|
||||||
|
import Table from "zy-react-library/components/Table";
|
||||||
|
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||||
|
import useTable from "zy-react-library/hooks/useTable";
|
||||||
|
import { getLabelName } from "zy-react-library/utils";
|
||||||
|
import { INSPECTION_STATE_ENUM } from "~/enumerate/constant";
|
||||||
|
import { NS_INSPECTION } from "~/enumerate/namespace";
|
||||||
|
import ViewInfo from "~/pages/Container/BranchCompany/Plan/ViewInfo";
|
||||||
|
|
||||||
|
function PlanExecutionDetails(props) {
|
||||||
|
const query = useGetUrlQuery();
|
||||||
|
const { tableProps } = useTable(props["inspectionList"], {
|
||||||
|
params: { status: "", planId: query.planId, entrance: "2" },
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<HeaderBack title="计划执行总次数" />
|
||||||
|
<div style={{ padding: "0 20px 20px 20px" }}>
|
||||||
|
<Divider orientation="left">计划信息</Divider>
|
||||||
|
<ViewInfo id={query.planId} />
|
||||||
|
<Divider orientation="left">计划执行详情</Divider>
|
||||||
|
<Table
|
||||||
|
columns={[
|
||||||
|
{ title: "检查题目", dataIndex: "subject" },
|
||||||
|
{ title: "检查发起人", dataIndex: "inspectionOriginatorUserName" },
|
||||||
|
{ title: "检查部门", dataIndex: "inspectionDepartmentName" },
|
||||||
|
{ title: "检查人员", dataIndex: "inspectionInspectorUserName" },
|
||||||
|
{ title: "被检查单位", dataIndex: "inspectionSiteDepartmentName" },
|
||||||
|
{ title: "被检查单位现场负责人", dataIndex: "inspectedSiteManagerName", width: 200 },
|
||||||
|
{ title: "检查类型", dataIndex: "typeName" },
|
||||||
|
{ title: "检查时间", width: 200, render: (_, record) => (`${record.timeStart}至${record.timeEnd}`) },
|
||||||
|
{
|
||||||
|
title: "检查状态",
|
||||||
|
dataIndex: "status",
|
||||||
|
render: (_, record) => (getLabelName({ list: INSPECTION_STATE_ENUM, status: record.status })),
|
||||||
|
},
|
||||||
|
{ title: "发现隐患数", dataIndex: "hiddenNumber" },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
fixed: "right",
|
||||||
|
width: 100,
|
||||||
|
render: (_, record) => (
|
||||||
|
<Space>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`../../inspectionView?id=${record.id}&inspectionId=${record.inspectionId}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
disabledResizer={true}
|
||||||
|
options={false}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect([NS_INSPECTION], true)(PlanExecutionDetails);
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Management(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Management;
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
import { Descriptions, Spin } from "antd";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { NS_PLAN } from "~/enumerate/namespace";
|
||||||
|
|
||||||
|
function ViewInfo(props) {
|
||||||
|
const [info, setInfo] = useState({});
|
||||||
|
const getData = async () => {
|
||||||
|
const { data } = await props["planView"]({ id: props.id });
|
||||||
|
setInfo(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Spin spinning={props.plan.planLoading}>
|
||||||
|
<Descriptions
|
||||||
|
column={1}
|
||||||
|
bordered
|
||||||
|
styles={{ label: { width: 200 } }}
|
||||||
|
items={[
|
||||||
|
{ label: "计划名称", children: info.planName },
|
||||||
|
{ label: "计划类型", children: info.planTypeName },
|
||||||
|
{ label: "计划开始时间", children: info.planStartTime },
|
||||||
|
{ label: "计划结束时间", children: info.planEndTime },
|
||||||
|
...(props.supervision === "1" ? [{ label: "计划执行单位", children: info.corpName }] : []),
|
||||||
|
{ label: "计划执行人员", children: info.userName },
|
||||||
|
{ label: "计划执行次数", children: info.planExecuteNum },
|
||||||
|
{ label: "备注", children: info.remarks },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</Spin>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect([NS_PLAN], true)(ViewInfo);
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Plan(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Plan;
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
import HiddenInfo from "zy-react-library/components/HiddenInfo/gwj";
|
||||||
|
|
||||||
|
function HiddenView() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<HiddenInfo />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HiddenView;
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import RecordsList from "~/pages/Container/BranchCompany/Inspection/Records/List";
|
||||||
|
|
||||||
|
function List(props) {
|
||||||
|
return <RecordsList searchType="all" {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default List;
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Records(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Records;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import InspectionViewA from "../../BranchCompany/InspectionView";
|
import InspectionViewA from "~/pages/Container/BranchCompany/InspectionView";
|
||||||
|
|
||||||
function InspectionView() {
|
function InspectionView() {
|
||||||
return <InspectionViewA />;
|
return <InspectionViewA />;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import ExecuteList from "~/pages/Container/BranchCompany/Plan/Execute/List";
|
||||||
|
|
||||||
|
function List(props) {
|
||||||
|
return <ExecuteList {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default List;
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Execute(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Execute;
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import ManagementList from "~/pages/Container/BranchCompany/Plan/Management/List";
|
||||||
|
|
||||||
|
function List(props) {
|
||||||
|
return <ManagementList supervision="1" {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default List;
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import PersonnelExecutionDetailsA from "~/pages/Container/BranchCompany/Plan/Management/PersonnelExecutionDetails";
|
||||||
|
|
||||||
|
function PersonnelExecutionDetails(props) {
|
||||||
|
return <PersonnelExecutionDetailsA {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PersonnelExecutionDetails;
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import PersonnelExecutionRecordsA from "~/pages/Container/BranchCompany/Plan/Management/PersonnelExecutionRecords";
|
||||||
|
|
||||||
|
function PersonnelExecutionRecords(props) {
|
||||||
|
return <PersonnelExecutionRecordsA {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PersonnelExecutionRecords;
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import PlanExecutionDetailsA from "~/pages/Container/BranchCompany/Plan/Management/PlanExecutionDetails";
|
||||||
|
|
||||||
|
function PlanExecutionDetails(props) {
|
||||||
|
return <PlanExecutionDetailsA {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PlanExecutionDetails;
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Management(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Management;
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
import ViewInfoA from "~/pages/Container/BranchCompany/Plan/ViewInfo";
|
||||||
|
|
||||||
|
function ViewInfo(props) {
|
||||||
|
return (
|
||||||
|
<ViewInfoA {...props} />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ViewInfo;
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Plan(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Plan;
|
||||||
|
|
@ -0,0 +1,155 @@
|
||||||
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
import { Button, Form } from "antd";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import Search from "zy-react-library/components/Search";
|
||||||
|
import Table from "zy-react-library/components/Table";
|
||||||
|
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||||
|
import useTable from "zy-react-library/hooks/useTable";
|
||||||
|
import { NS_STATISTICS } from "~/enumerate/namespace";
|
||||||
|
|
||||||
|
function List(props) {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const dateType = Form.useWatch("dateType", form);
|
||||||
|
|
||||||
|
const getDate = () => {
|
||||||
|
const formData = form.getFieldsValue();
|
||||||
|
let startTime = "";
|
||||||
|
let endTime = "";
|
||||||
|
if (formData.dateType === "1") {
|
||||||
|
startTime = formData.dateYear ? dayjs(formData.dateYear).startOf("year").format("YYYY-MM-DD") : "";
|
||||||
|
endTime = formData.dateYear ? dayjs(formData.dateYear).endOf("year").format("YYYY-MM-DD") : "";
|
||||||
|
}
|
||||||
|
else if (formData.dateType === "2") {
|
||||||
|
startTime = formData.dateMonth ? dayjs(formData.dateMonth).startOf("month").format("YYYY-MM-DD") : "";
|
||||||
|
endTime = formData.dateMonth ? dayjs(formData.dateMonth).endOf("month").format("YYYY-MM-DD") : "";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
startTime = dayjs(formData.dates?.[0]);
|
||||||
|
endTime = dayjs(formData.dates?.[1]);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
startTime,
|
||||||
|
endTime,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const { tableProps, getData } = useTable(props["statisticsList"], {
|
||||||
|
form,
|
||||||
|
transform: () => getDate(),
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ padding: 20 }}>
|
||||||
|
<Search
|
||||||
|
values={{ dateType: "1" }}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "dateType",
|
||||||
|
label: "统计方式",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||||
|
items: [{ bianma: "1", name: "年份" }, { bianma: "2", name: "月份" }, { bianma: "3", name: "自定义" }],
|
||||||
|
},
|
||||||
|
...(dateType === "1" ? [{ name: "dateYear", label: "年份", render: FORM_ITEM_RENDER_ENUM.DATE_YEAR }] : []),
|
||||||
|
...(dateType === "2" ? [{ name: "dateMonth", label: "月份", render: FORM_ITEM_RENDER_ENUM.DATE_MONTH }] : []),
|
||||||
|
...(dateType === "3" ? [{ name: "dates", label: "自定义", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE }] : []),
|
||||||
|
{ name: "corpName", label: "企业名称" },
|
||||||
|
]}
|
||||||
|
form={form}
|
||||||
|
onFinish={getData}
|
||||||
|
/>
|
||||||
|
<Table
|
||||||
|
columns={[
|
||||||
|
{ title: "企业名称", dataIndex: "corpName" },
|
||||||
|
{
|
||||||
|
title: "计划执行情况",
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
title: "计划总数",
|
||||||
|
dataIndex: "planTotal",
|
||||||
|
render: (_, record) => (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
const dates = getDate();
|
||||||
|
props.history.push(`../plan/management/list?corpId=${record.corpId}&startTime=${dates.startTime}&endTime=${dates.endTime}&entrance=statistics`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{record.planTotal}
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "已完成计划数",
|
||||||
|
dataIndex: "completedPlanCount",
|
||||||
|
render: (_, record) => (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
const dates = getDate();
|
||||||
|
props.history.push(`../plan/management/list?corpId=${record.corpId}&startTime=${dates.startTime}&endTime=${dates.endTime}&entrance=statistics&completedOnly=1`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{record.completedPlanCount}
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "检查执行情况",
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
title: "检查总数",
|
||||||
|
dataIndex: "inspectionTotal",
|
||||||
|
render: (_, record) => (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
const dates = getDate();
|
||||||
|
props.history.push(`../inspection/records/list?corpId=${record.corpId}&checkStartTime=${dates.startTime}&checkEndTime=${dates.endTime}&entrance=statistics`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{record.inspectionTotal}
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "计划内检查数",
|
||||||
|
dataIndex: "planInCount",
|
||||||
|
render: (_, record) => (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
const dates = getDate();
|
||||||
|
props.history.push(`../inspection/records/list?corpId=${record.corpId}&checkStartTime=${dates.startTime}&checkEndTime=${dates.endTime}&entrance=statistics&planType=1`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{record.planInCount}
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "计划外检查数",
|
||||||
|
dataIndex: "planOutCount",
|
||||||
|
render: (_, record) => (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
const dates = getDate();
|
||||||
|
props.history.push(`../inspection/records/list?corpId=${record.corpId}&checkStartTime=${dates.startTime}&checkEndTime=${dates.endTime}&entrance=statistics&planType=0`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{record.planOutCount}
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect([NS_STATISTICS], true)(List);
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Statistics(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Statistics;
|
||||||
Loading…
Reference in New Issue