safety-eval-service-frontend/src/pages/Container/SafetyEvalBusiness/ProjectFlow/index.js

184 lines
4.3 KiB
JavaScript
Raw Normal View History

2026-07-20 16:57:49 +08:00
import React, { useState, useEffect } from "react";
import { Tabs, Tag, Flex } from "antd";
2026-07-20 11:16:32 +08:00
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
import { AntdTableFuncControl } from "@cqsjjb/jjb-common-decorator/antd";
2026-07-20 16:57:49 +08:00
import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace";
2026-07-22 16:06:26 +08:00
import { tools } from "@cqsjjb/jjb-common-lib";
2026-07-20 13:38:09 +08:00
import WpsEditor from "~/pages/Container/WpsEditor";
2026-07-20 15:03:26 +08:00
import RiskAnalysisContent from "./RiskAnalysisContent";
import ContractContent from "./ContractContent";
import TeamContent from "./TeamContent";
import SurveyContent from "./SurveyContent";
import InternalReviewContent from "./InternalReviewContent";
import TechnicalReviewContent from "./TechnicalReviewContent";
import ControlContent from "./ControlContent";
import "./index.less";
2026-07-20 11:16:32 +08:00
const PROCESS_TABS = [
2026-07-20 16:57:49 +08:00
{
key: "risk",
index: "1",
label: "风险分析",
state: "已完成",
stateType: "success",
role: "市场部经办人 / 市场部经理",
},
{
key: "contract",
index: "2",
label: "业务合同",
state: "已完成",
stateType: "success",
role: "机构管理员 / 项目负责人",
},
{
key: "team",
index: "3",
label: "项目组",
state: "已完成",
stateType: "success",
role: "评价部经理 / 机构主账号",
},
{
key: "survey",
index: "4",
label: "现场踏勘",
state: "已完成",
stateType: "success",
role: "项目组成员",
},
{
key: "report",
index: "5",
label: "报告编制",
state: "编制中",
stateType: "processing",
role: "报告编制人",
},
{
key: "internal",
index: "6",
label: "内部审核",
state: "待办理",
stateType: "default",
role: "内部审核人",
},
{
key: "technical",
index: "7",
label: "技术审核",
state: "待办理",
stateType: "default",
role: "技术负责人",
},
{
key: "control",
index: "8",
label: "过程控制",
state: "前置未完成",
stateType: "warning",
role: "过程控制负责人",
locked: true,
},
2026-07-20 11:16:32 +08:00
];
2026-07-22 16:06:26 +08:00
const { router } = tools;
2026-07-20 11:16:32 +08:00
2026-07-20 13:38:09 +08:00
const ProjectFlow = (props) => {
const [activeKey, setActiveKey] = useState("risk");
const [visible, setVisible] = useState(false);
2026-07-20 16:57:49 +08:00
const { wpsDoc } = props.safetyEvalBusiness || {};
2026-07-22 16:06:26 +08:00
const projectId = router.query?.id;
2026-07-20 13:38:09 +08:00
const handleTabChange = (key) => {
if (key === "report") {
2026-07-20 16:57:49 +08:00
openReportEditor();
2026-07-20 13:38:09 +08:00
return;
}
setActiveKey(key);
};
2026-07-20 16:57:49 +08:00
const openReportEditor = async () => {
setVisible(true);
};
useEffect(() => {
props.queryMyOrCreateDoc({
2026-07-22 16:06:26 +08:00
docxUrl: "",
});
props.evalProjectDetail({
id: projectId,
});
2026-07-20 16:57:49 +08:00
}, []);
2026-07-20 13:38:09 +08:00
const tabItems = PROCESS_TABS.map((item) => {
let children = null;
switch (item.key) {
2026-07-20 16:57:49 +08:00
case "risk":
children = <RiskAnalysisContent />;
break;
case "contract":
children = <ContractContent />;
break;
case "team":
children = <TeamContent />;
break;
case "survey":
children = <SurveyContent />;
break;
case "internal":
children = <InternalReviewContent />;
break;
case "technical":
children = <TechnicalReviewContent />;
break;
case "control":
children = <ControlContent />;
break;
default:
children = null;
2026-07-20 13:38:09 +08:00
}
return {
key: item.key,
disabled: item.locked,
label: (
2026-07-20 15:03:26 +08:00
<Flex align="center" gap={6}>
2026-07-20 13:38:09 +08:00
{item.index} {item.label}
2026-07-20 16:57:49 +08:00
<Tag color={item.stateType} className="pf-tag">
{item.state}
</Tag>
2026-07-20 15:03:26 +08:00
</Flex>
2026-07-20 13:38:09 +08:00
),
children,
};
});
2026-07-20 11:16:32 +08:00
return (
<PageLayout
2026-07-20 15:03:26 +08:00
history={props.history}
previous
2026-07-20 11:16:32 +08:00
title={
2026-07-20 16:57:49 +08:00
<div>
2026-07-20 13:38:09 +08:00
<span>项目法定流程工作台</span>
2026-07-20 16:57:49 +08:00
<div className="pageLayout-extra">
华安化工园区安全预评价 | XP-2026-001
</div>
2026-07-20 13:38:09 +08:00
</div>
2026-07-20 11:16:32 +08:00
}
>
2026-07-20 13:38:09 +08:00
<Tabs activeKey={activeKey} onChange={handleTabChange} items={tabItems} />
2026-07-20 16:57:49 +08:00
{visible && (
<WpsEditor onCancel={() => setVisible(false)} fileId={wpsDoc?.fileId} />
)}
2026-07-20 11:16:32 +08:00
</PageLayout>
);
};
2026-07-20 16:57:49 +08:00
export default Connect(
[NS_SAFETY_EVAL_BUSINESS],
true,
)(AntdTableFuncControl(ProjectFlow));