From bbfb21730c79c569b3a608e26e2eebef49a01817 Mon Sep 17 00:00:00 2001 From: tangjie <122778500@qq.com> Date: Mon, 27 Jul 2026 15:41:29 +0800 Subject: [PATCH] feat --- .../spec.json | 56 +++ .../type.d.ts | 11 + .../spec.json | 66 ++++ .../type.d.ts | 14 + .../spec.json | 45 +++ .../type.d.ts | 6 + src/api/safetyEvalBusiness/index.js | 19 + src/enumerate/constant/index.js | 17 + src/pages/Container/Layout/menuConfig.js | 6 + .../EvalProjectMonitor/Detail/index.js | 85 ++++- .../MonitorManage/SurveyMonitor/index.js | 354 ++++++++++++++++++ .../MonitorManage/SurveyMonitor/index.less | 3 + .../ProjectFlow/ContractContent.js | 13 +- .../ProjectFlow/SurveyContent.js | 50 ++- 14 files changed, 686 insertions(+), 59 deletions(-) create mode 100644 .api/safetyEval-regulator-eval-project-monitor-survey-clock-in-get/spec.json create mode 100644 .api/safetyEval-regulator-eval-project-monitor-survey-clock-in-get/type.d.ts create mode 100644 .api/safetyEval-regulator-eval-project-monitor-survey-page-get/spec.json create mode 100644 .api/safetyEval-regulator-eval-project-monitor-survey-page-get/type.d.ts create mode 100644 .api/safetyEval-regulator-eval-project-monitor-survey-stat-get/spec.json create mode 100644 .api/safetyEval-regulator-eval-project-monitor-survey-stat-get/type.d.ts create mode 100644 src/pages/Container/MonitorManage/SurveyMonitor/index.js create mode 100644 src/pages/Container/MonitorManage/SurveyMonitor/index.less diff --git a/.api/safetyEval-regulator-eval-project-monitor-survey-clock-in-get/spec.json b/.api/safetyEval-regulator-eval-project-monitor-survey-clock-in-get/spec.json new file mode 100644 index 0000000..62e97be --- /dev/null +++ b/.api/safetyEval-regulator-eval-project-monitor-survey-clock-in-get/spec.json @@ -0,0 +1,56 @@ +{ + "openapi": "3.0.1", + "info": { "title": "人员打卡信息查询", "version": "1.0.0" }, + "paths": { + "/safetyEval/regulator/eval-project-monitor/survey-clock-in": { + "get": { + "summary": "人员打卡信息查询", + "tags": ["监管端-安评项目"], + "parameters": [ + { "name": "projectId", "in": "query", "required": true, "schema": { "type": "string" } } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/SingleResponseListRegulatorEvalSurveyClockInCO" } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "SingleResponseListRegulatorEvalSurveyClockInCO": { + "type": "object", + "properties": { + "success": { "type": "boolean" }, + "code": { "type": "string" }, + "message": { "type": "string" }, + "errMessage": { "type": "string" }, + "data": { + "type": "array", + "items": { "$ref": "#/components/schemas/RegulatorEvalSurveyClockInCO" } + } + } + }, + "RegulatorEvalSurveyClockInCO": { + "type": "object", + "properties": { + "id": { "type": "integer" }, + "userName": { "type": "string" }, + "role": { "type": "string" }, + "faceState": { "type": "integer" }, + "gpsState": { "type": "integer" }, + "singInTime": { "type": "string" }, + "signOutTime": { "type": "string" }, + "sceneUrl": { "type": "string" }, + "signatureUrl": { "type": "string" } + } + } + } + } +} diff --git a/.api/safetyEval-regulator-eval-project-monitor-survey-clock-in-get/type.d.ts b/.api/safetyEval-regulator-eval-project-monitor-survey-clock-in-get/type.d.ts new file mode 100644 index 0000000..ff3d4b9 --- /dev/null +++ b/.api/safetyEval-regulator-eval-project-monitor-survey-clock-in-get/type.d.ts @@ -0,0 +1,11 @@ +export interface RegulatorEvalSurveyClockInCO { + id: number; + userName: string; + role: string; + faceState: number; + gpsState: number; + singInTime: string; + signOutTime: string; + sceneUrl: string; + signatureUrl: string; +} diff --git a/.api/safetyEval-regulator-eval-project-monitor-survey-page-get/spec.json b/.api/safetyEval-regulator-eval-project-monitor-survey-page-get/spec.json new file mode 100644 index 0000000..cdf4045 --- /dev/null +++ b/.api/safetyEval-regulator-eval-project-monitor-survey-page-get/spec.json @@ -0,0 +1,66 @@ +{ + "openapi": "3.0.1", + "info": { "title": "踏勘监管分页", "version": "1.0.0" }, + "paths": { + "/safetyEval/regulator/eval-project-monitor/survey-page": { + "get": { + "summary": "项目踏勘监管分页", + "tags": ["监管端-安评项目"], + "parameters": [ + { "name": "current", "in": "query", "schema": { "type": "integer", "default": 1 } }, + { "name": "size", "in": "query", "schema": { "type": "integer", "default": 10 } }, + { "name": "startTime", "in": "query", "schema": { "type": "string" } }, + { "name": "endTime", "in": "query", "schema": { "type": "string" } }, + { "name": "projectNameOrNo", "in": "query", "schema": { "type": "string" } }, + { "name": "orgId", "in": "query", "schema": { "type": "integer" } }, + { "name": "clockInStatus", "in": "query", "schema": { "type": "string" } } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/PageResponseRegulatorEvalProjectSurveyPageCO" } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "PageResponseRegulatorEvalProjectSurveyPageCO": { + "type": "object", + "properties": { + "success": { "type": "boolean" }, + "code": { "type": "string" }, + "message": { "type": "string" }, + "errMessage": { "type": "string" }, + "data": { + "type": "array", + "items": { "$ref": "#/components/schemas/RegulatorEvalProjectSurveyPageCO" } + }, + "total": { "type": "integer" } + } + }, + "RegulatorEvalProjectSurveyPageCO": { + "type": "object", + "properties": { + "id": { "type": "string" }, + "orgId": { "type": "string" }, + "projectNo": { "type": "string" }, + "projectName": { "type": "string" }, + "orgName": { "type": "string" }, + "expectedCount": { "type": "integer" }, + "actualCount": { "type": "integer" }, + "signInCount": { "type": "integer" }, + "signOutCount": { "type": "integer" }, + "faceCount": { "type": "integer" }, + "scenePhotoCount": { "type": "integer" }, + "notificationFileUrl": { "type": "string" } + } + } + } + } +} diff --git a/.api/safetyEval-regulator-eval-project-monitor-survey-page-get/type.d.ts b/.api/safetyEval-regulator-eval-project-monitor-survey-page-get/type.d.ts new file mode 100644 index 0000000..bbfe7c5 --- /dev/null +++ b/.api/safetyEval-regulator-eval-project-monitor-survey-page-get/type.d.ts @@ -0,0 +1,14 @@ +export interface RegulatorEvalProjectSurveyPageCO { + id: string; + orgId: string; + projectNo: string; + projectName: string; + orgName: string; + expectedCount: number; + actualCount: number; + signInCount: number; + signOutCount: number; + faceCount: number; + scenePhotoCount: number; + notificationFileUrl: string; +} diff --git a/.api/safetyEval-regulator-eval-project-monitor-survey-stat-get/spec.json b/.api/safetyEval-regulator-eval-project-monitor-survey-stat-get/spec.json new file mode 100644 index 0000000..d45ef1f --- /dev/null +++ b/.api/safetyEval-regulator-eval-project-monitor-survey-stat-get/spec.json @@ -0,0 +1,45 @@ +{ + "openapi": "3.0.1", + "info": { "title": "踏勘监管统计", "version": "1.0.0" }, + "paths": { + "/safetyEval/regulator/eval-project-monitor/survey-stat": { + "get": { + "summary": "项目踏勘监管统计", + "tags": ["监管端-安评项目"], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/SingleResponseRegulatorEvalProjectSurveyStatCO" } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "SingleResponseRegulatorEvalProjectSurveyStatCO": { + "type": "object", + "properties": { + "success": { "type": "boolean" }, + "code": { "type": "string" }, + "message": { "type": "string" }, + "errMessage": { "type": "string" }, + "data": { "$ref": "#/components/schemas/RegulatorEvalProjectSurveyStatCO" } + } + }, + "RegulatorEvalProjectSurveyStatCO": { + "type": "object", + "properties": { + "notificationArchivedCount": { "type": "integer", "description": "告知书已归档数" }, + "notificationAbnormalCount": { "type": "integer", "description": "告知异常数" }, + "clockInNormalCount": { "type": "integer", "description": "人员打卡正常数" }, + "clockInAbnormalCount": { "type": "integer", "description": "打卡异常数" } + } + } + } + } +} diff --git a/.api/safetyEval-regulator-eval-project-monitor-survey-stat-get/type.d.ts b/.api/safetyEval-regulator-eval-project-monitor-survey-stat-get/type.d.ts new file mode 100644 index 0000000..c0e1adc --- /dev/null +++ b/.api/safetyEval-regulator-eval-project-monitor-survey-stat-get/type.d.ts @@ -0,0 +1,6 @@ +export interface RegulatorEvalProjectSurveyStatCO { + notificationArchivedCount: number; + notificationAbnormalCount: number; + clockInNormalCount: number; + clockInAbnormalCount: number; +} diff --git a/src/api/safetyEvalBusiness/index.js b/src/api/safetyEvalBusiness/index.js index f064acb..01c01ca 100644 --- a/src/api/safetyEvalBusiness/index.js +++ b/src/api/safetyEvalBusiness/index.js @@ -263,4 +263,23 @@ export const evalProjectMonitorStat = declareRequest( export const evalProjectMonitorPage = declareRequest( "evalProjectMonitorPageLoading", "Get > /safetyEval/regulator/eval-project-monitor/realtime-page", +); + +// ===== 监管端-项目踏勘监管 ===== + +export const evalSurveyMonitorStat = declareRequest( + "evalSurveyMonitorStatLoading", + "Get > /safetyEval/regulator/eval-project-monitor/survey-stat", + "evalSurveyMonitorStat: {} | res.data || {}", +); + +export const evalSurveyMonitorPage = declareRequest( + "evalSurveyMonitorPageLoading", + "Get > /safetyEval/regulator/eval-project-monitor/survey-page", +); + +export const evalSurveyClockIn = declareRequest( + "evalSurveyClockInLoading", + "Get > /safetyEval/regulator/eval-project-monitor/survey-clock-in", + "evalSurveyClockIn: [] | res.data || []", ); \ No newline at end of file diff --git a/src/enumerate/constant/index.js b/src/enumerate/constant/index.js index 48ee0f4..6888c85 100644 --- a/src/enumerate/constant/index.js +++ b/src/enumerate/constant/index.js @@ -411,6 +411,23 @@ export const MONITOR_WARING_STATUS_OPTIONS = [ { label: "人员异常", value: "PERSONNEL_ABNORMAL" }, ]; +/** 监管端-项目踏勘监管 - 打卡状态筛选选项 */ +export const CLOCK_IN_STATUS_OPTIONS = [ + { label: "正常", value: "normal" }, + { label: "异常", value: "abnormal" }, +]; + +export const PROJECT_TYPE_OPTIONS = [ + { label: "新建项目", value: "NEW" }, + { label: "续评项目", value: "RENEW" }, + { label: "变更项目", value: "CHANGE" }, +]; + +export const PROJECT_TYPE_MAP= PROJECT_TYPE_OPTIONS.reduce((acc, cur) => { + acc[cur.value] = cur.label; + return acc; +}, {}); + export const ROLE_DEFINITIONS = [ { value: "MARKETING_BUSINESS_REP", name: "市场部业务员", unique: false, summary: "获取项目基础信息,形成风险分析记录;风险通过后签订合同并下达任务通知单。" }, diff --git a/src/pages/Container/Layout/menuConfig.js b/src/pages/Container/Layout/menuConfig.js index 2dea24e..c0973f8 100644 --- a/src/pages/Container/Layout/menuConfig.js +++ b/src/pages/Container/Layout/menuConfig.js @@ -22,6 +22,7 @@ import { CheckCircleOutlined, SyncOutlined, BellOutlined, + EnvironmentOutlined, } from "@ant-design/icons"; const menuItems = [ @@ -200,6 +201,11 @@ const menuItems = [ label: "安评项目实时监控", icon: , }, + { + key: "/safetyEval/container/MonitorManage/SurveyMonitor", + label: "项目踏勘监管", + icon: , + }, ], }, { diff --git a/src/pages/Container/MonitorManage/EvalProjectMonitor/Detail/index.js b/src/pages/Container/MonitorManage/EvalProjectMonitor/Detail/index.js index b97c9b4..cfdfb97 100644 --- a/src/pages/Container/MonitorManage/EvalProjectMonitor/Detail/index.js +++ b/src/pages/Container/MonitorManage/EvalProjectMonitor/Detail/index.js @@ -15,18 +15,13 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace"; import { tools } from "@cqsjjb/jjb-common-lib"; import { EVAL_TYPE_MAP, ROLE_DEFINITIONS_MAP } from "~/enumerate/constant"; -import { QUALIFICATION_INDUSTRY_OPTIONS_MAP } from "~/enumerate/enterpriseOptions"; +import { PROJECT_TYPE_MAP } from "~/enumerate/constant"; import "./index.less"; const { router } = tools; -const PROJECT_TYPE_MAP = { - NEW: "新建项目", - RENEW: "续评项目", - CHANGE: "变更项目", -}; -const YES_NO_MAP = { 1: "是", 2: "否" }; + const ATTACH_TYPE_LABELS = { PRACTICE_NOTIFICATION: "从业告知书", @@ -166,8 +161,36 @@ const TeamPanel = ({ data, loading }) => { ellipsis: true, }, ]; - - return ( + let leader=null; + let processLeader=null; + data.forEach((item) => { + if (item.role.includes('PROJECT_LEAD')) { + leader = item.personnelName; + } + if (item.role.includes('PROCESS_CONTROL_LEAD')) { + processLeader = item.personnelName; + } + }); + return <> +
+
+ 项目组人数 + + {data.length || 0}人 + +
+
+ 项目负责人 + {leader || "-"} +
+
+ 过程控制负责人 + + {processLeader || "-"} + +
+ +
{ size="small" scroll={{ x: 800 }} /> - ); + }; // ===== 踏勘情况面板 ===== @@ -315,7 +338,7 @@ const EvalProjectMonitorDetail = (props) => { const [teamMembers, setTeamMembers] = useState([]); const [surveyPersonnel, setSurveyPersonnel] = useState([]); const [surveyAttachments, setSurveyAttachments] = useState({}); - const [activeKey, setActiveKey] = useState("contract"); + const [activeKey, setActiveKey] = useState("BUSINESS_CONTRACT"); const fetchContract = async () => { if (!projectId) return; @@ -360,6 +383,24 @@ const EvalProjectMonitorDetail = (props) => { fetchSurvey(); }, []); + const projectNode = JSON.parse(evalProjectDetailData?.projectNode || "[]") || []; + const nodeMap = {}; + projectNode.forEach((n) => { + nodeMap[n.type] = n; + }); + + const renderTabLabel = (label, nodeType) => { + const done = nodeMap[nodeType]?.state === 1; + return ( + + {label} + + {done ? "已完成" : "待办理"} + + + ); + }; + const projectInfo = (
@@ -377,12 +418,16 @@ const EvalProjectMonitorDetail = (props) => {
评价机构 - {contractData?.orgName || evalProjectDetailData?.orgName || "-"} + {contractData?.orgName || "-"}
项目负责人 - {evalProjectDetailData?.leaderName || "-"} + {evalProjectDetailData?.projectLeaderName || "-"} +
+
+ 总体状态 + {projectNode.filter((item) => item.state === 1).length}/{projectNode.length}
); @@ -395,20 +440,20 @@ const EvalProjectMonitorDetail = (props) => { onChange={setActiveKey} items={[ { - key: "contract", - label: "项目合同", + key: "BUSINESS_CONTRACT", + label: renderTabLabel("项目合同", "BUSINESS_CONTRACT"), children: ( ), }, { - key: "team", - label: "项目组人员", - children: , + key: "PROJECT_GROUP", + label: renderTabLabel("项目组人员", "PROJECT_GROUP"), + children: , }, { - key: "survey", - label: "踏勘情况", + key: "SITE_SURVEY", + label: renderTabLabel("踏勘情况", "SITE_SURVEY"), children: ( { + if (!raw) return []; + try { + const parsed = typeof raw === "string" ? JSON.parse(raw) : raw; + return Array.isArray(parsed) ? parsed : []; + } catch { + return []; + } +}; + +/** 根据打卡数据计算状态 */ +const getClockInStatus = (record) => { + if (record.actualCount < record.expectedCount) { + return { color: "error", text: "人员未到齐" }; + } + if ( + record.signInCount < record.actualCount || + record.signOutCount < record.actualCount + ) { + return { color: "warning", text: "异常" }; + } + return { color: "success", text: "正常" }; +}; + +const SurveyMonitor = (props) => { + const [searchForm] = Form.useForm(); + const [dataSource, setDataSource] = useState([]); + const [total, setTotal] = useState(0); + const [clockInModal, setClockInModal] = useState(false); + const [clockInData, setClockInData] = useState([]); + const [clockInProjectName, setClockInProjectName] = useState(""); + + const { safetyEvalBusiness, evalSurveyMonitorStat, evalSurveyMonitorPage, + evalSurveyClockIn } = props; + const { evalSurveyMonitorStatLoading, evalSurveyMonitorPageLoading, + evalSurveyClockInLoading } = safetyEvalBusiness || {}; + const statData = safetyEvalBusiness?.evalSurveyMonitorStat || {}; + + const getStat = () => { + evalSurveyMonitorStat(); + }; + + const getData = async () => { + const params = { + ...router.query, + current: router.query.current || 1, + size: router.query.size || 10, + }; + const res = await evalSurveyMonitorPage(params); + if (res?.success !== false) { + setDataSource(res?.data || []); + setTotal(res?.total || 0); + } + }; + + useEffect(() => { + searchForm.setFieldsValue({ + ...router.query, + dateRange: + router.query.startTime && router.query.endTime + ? [router.query.startTime, router.query.endTime] + : undefined, + }); + getStat(); + getData(); + }, []); + + const handleSearch = (values) => { + const { dateRange, ...rest } = values; + router.query = { + ...rest, + startTime: dateRange?.[0]?.format?.("YYYY-MM-DD") || undefined, + endTime: dateRange?.[1]?.format?.("YYYY-MM-DD") || undefined, + current: 1, + size: 10, + }; + getData(); + }; + + const handleReset = (values) => { + searchForm.resetFields(); + router.query = { ...values, current: 1, size: 10 }; + getData(); + }; + + const handlePageChange = (pagination) => { + router.query = { + ...router.query, + current: pagination.current, + size: pagination.pageSize, + }; + getData(); + }; + + const handleViewClockIn = async (record) => { + setClockInProjectName(record.projectName); + setClockInModal(true); + const res = await evalSurveyClockIn({ projectId: record.id }); + if (res?.success !== false) { + setClockInData(res?.data || []); + } + }; + + const handleViewNotice = (record) => { + const files = parseFileList(record.notificationFileUrl); + if (files.length > 0 && files[0].url) { + window.open(files[0].url, "_blank"); + } + }; + + const clockInColumns = [ + { title: "人员", dataIndex: "userName", width: 100 }, + { + title: "项目角色", + dataIndex: "role", + width: 160, + ellipsis: true, + render: (v) => + Array.isArray(v) + ? v.map((r) => ROLE_DEFINITIONS_MAP[r] || r).join("、") + : v || "-", + }, + { + title: "人脸识别", + dataIndex: "faceState", + width: 90, + render: (v) => ( + + {v === 1 ? "通过" : "未通过"} + + ), + }, + { + title: "GPS定位", + dataIndex: "gpsState", + width: 90, + render: (v) => ( + + {v === 1 ? "正常" : "异常"} + + ), + }, + { title: "签到时间", dataIndex: "singInTime", width: 160 }, + { title: "签退时间", dataIndex: "signOutTime", width: 160 }, + { + title: "现场照片", + dataIndex: "sceneUrl", + width: 80, + render: (v) => { + const count = v ? v.split(",").filter(Boolean).length : 0; + return count > 0 ? `${count}张` : "-"; + }, + }, + { + title: "本人签字", + dataIndex: "signatureUrl", + width: 90, + render: (v) => ( + + {v ? "已签字" : "未签字"} + + ), + }, + ]; + + const columns = [ + { title: "项目编号", dataIndex: "projectNo", width: 140 }, + { title: "项目名称", dataIndex: "projectName", ellipsis: true, width: 220 }, + { title: "评价机构", dataIndex: "orgName", ellipsis: true, width: 200 }, + { + title: "告知书状态", + dataIndex: "notificationFileUrl", + width: 120, + render: (v) => { + const files = parseFileList(v); + return files.length > 0 ? ( + 已归档 + ) : ( + 待上传 + ); + }, + }, + { + title: "应到/实到", + width: 100, + render: (_, r) => `${r.expectedCount} / ${r.actualCount}`, + }, + { + title: "签到/签退", + width: 100, + render: (_, r) => `${r.signInCount} / ${r.signOutCount}`, + }, + { + title: "现场照片", + dataIndex: "scenePhotoCount", + width: 90, + render: (v) => (v ? `${v}张` : "-"), + }, + { + title: "打卡状态", + width: 100, + render: (_, r) => { + const status = getClockInStatus(r); + return {status.text}; + }, + }, + { + title: "操作", + width: 160, + fixed: "right", + render: (_, record) => ( + + + + + ), + }, + ]; + + return ( + + + {STAT_ITEMS.map((item) => ( +
+ + + + + ))} + + + + + , + + + , + + + , + ]} + onFinish={handleSearch} + onReset={handleReset} + /> + +
`共 ${t} 条`, + }} + onChange={handlePageChange} + /> + + setClockInModal(false)} + footer={null} + width={1000} + > +
+ + + ); +}; + +export default Connect( + [NS_SAFETY_EVAL_BUSINESS], + true, +)(AntdTableFuncControl(SurveyMonitor)); diff --git a/src/pages/Container/MonitorManage/SurveyMonitor/index.less b/src/pages/Container/MonitorManage/SurveyMonitor/index.less new file mode 100644 index 0000000..3d37fc5 --- /dev/null +++ b/src/pages/Container/MonitorManage/SurveyMonitor/index.less @@ -0,0 +1,3 @@ +.sm-stat-row { + margin-bottom: 16px; +} diff --git a/src/pages/Container/SafetyEvalBusiness/ProjectFlow/ContractContent.js b/src/pages/Container/SafetyEvalBusiness/ProjectFlow/ContractContent.js index 23b295c..a59e6c1 100644 --- a/src/pages/Container/SafetyEvalBusiness/ProjectFlow/ContractContent.js +++ b/src/pages/Container/SafetyEvalBusiness/ProjectFlow/ContractContent.js @@ -15,6 +15,7 @@ import { Spin, } from "antd"; import dayjs from "dayjs"; +import {PROJECT_TYPE_OPTIONS ,EVAL_TYPE_OPTIONS} from '~/enumerate/constant'; import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace"; import { district } from "~/enumerate/constant"; @@ -25,17 +26,9 @@ import AttachmentUpload from "~/components/AttachmentUpload"; const { router } = tools; const { TextArea } = Input; -const PROJECT_TYPE_OPTIONS = [ - { label: "新建项目", value: "NEW" }, - { label: "续评项目", value: "RENEW" }, - { label: "变更项目", value: "CHANGE" }, -]; -const EVAL_TYPE_OPTIONS = [ - { label: "安全预评价", value: "PRE" }, - { label: "安全验收评价", value: "ACCEPT" }, - { label: "安全现状评价", value: "STATUS" }, -]; + + const YES_NO_OPTIONS = [ { label: "是", value: 1 }, diff --git a/src/pages/Container/SafetyEvalBusiness/ProjectFlow/SurveyContent.js b/src/pages/Container/SafetyEvalBusiness/ProjectFlow/SurveyContent.js index 86c680e..7ddfe48 100644 --- a/src/pages/Container/SafetyEvalBusiness/ProjectFlow/SurveyContent.js +++ b/src/pages/Container/SafetyEvalBusiness/ProjectFlow/SurveyContent.js @@ -12,21 +12,13 @@ import dayjs from "dayjs"; const { router } = tools; const STAGES = [ - { key: "notice", index: "01", label: "从业告知" }, - { key: "inspection", index: "02", label: "现场勘查" }, - { key: "rectification", index: "03", label: "整改通知" }, - { key: "enterprise", index: "04", label: "企业整改" }, - { key: "review", index: "05", label: "整改复查" }, + { key: "PRACTICE_NOTIFICATION", index: "01", label: "从业告知" }, + { key: "SITE_INSPECTION_FORM", index: "02", label: "现场勘查" }, + { key: "RECTIFICATION_NOTICE", index: "03", label: "整改通知" }, + { key: "ENTERPRISE_RECTIFICATION", index: "04", label: "企业整改" }, + { key: "RECTIFICATION_REVIEW", index: "05", label: "整改复查" }, ]; -const ATTACH_TYPE = { - notice: "PRACTICE_NOTIFICATION", - inspection: "SITE_INSPECTION_FORM", - rectification: "RECTIFICATION_NOTICE", - enterprise: "ENTERPRISE_RECTIFICATION", - review: "RECTIFICATION_REVIEW", -}; - const downloadTemplate = async () => { try { const res = await fetch("https://test-dragon-yf-pub.oss-cn-hangzhou.aliyuncs.com/jjb/6a608cb30dc53ed98d0b13ae.pdf"); @@ -137,7 +129,7 @@ const SimpleUploadPanel = ({ index, title, desc }) => ( const SurveyContent = (props) => { const [form] = Form.useForm(); - const [activeStage, setActiveStage] = useState("notice"); + const [activeStage, setActiveStage] = useState("PRACTICE_NOTIFICATION"); const [attachMap, setAttachMap] = useState({}); const [surveyPersonnel, setSurveyPersonnel] = useState([]); const { evalSurveyListLoading, evalSurveySaveAttachLoading, evalProjectDetailData } = props.safetyEvalBusiness; @@ -163,8 +155,8 @@ const SurveyContent = (props) => { setAttachMap(map); // 回填所有步骤的附件到表单 const values = {}; - Object.entries(ATTACH_TYPE).forEach(([, typeCode]) => { - values[typeCode] = map[typeCode] || []; + STAGES.forEach((s) => { + values[s.key] = map[s.key] || []; }); form.setFieldsValue(values); } @@ -195,17 +187,17 @@ const SurveyContent = (props) => { const handleSave = async () => { const values = form.getFieldsValue(); const payload = []; - for (const [key, typeCode] of Object.entries(ATTACH_TYPE)) { - const fileList = values[typeCode] || []; + for (const s of STAGES) { + const fileList = values[s.key] || []; const validFiles = fileList.filter((f) => f.status === "done" && f.url); if (validFiles.length === 0) { - setActiveStage(key); - message.warning(`请先在"${STAGES.find((s) => s.key === key).label}"步骤上传附件`); + setActiveStage(s.key); + message.warning(`请先在"${s.label}"步骤上传附件`); return; } payload.push({ projectId, - attachTypeCode: typeCode, + attachTypeCode: s.key, fileUrl: JSON.stringify(fileList), }); } @@ -225,21 +217,21 @@ const SurveyContent = (props) => { items={STAGES.map((s) => ({ title: s.label }))} /> - {activeStage === "notice" && } - {activeStage === "inspection" && } - {activeStage === "rectification" && ( + {activeStage === "PRACTICE_NOTIFICATION" && } + {activeStage === "SITE_INSPECTION_FORM" && } + {activeStage === "RECTIFICATION_NOTICE" && ( )} - {activeStage === "enterprise" && ( + {activeStage === "ENTERPRISE_RECTIFICATION" && ( )} - {activeStage === "review" && ( + {activeStage === "RECTIFICATION_REVIEW" && ( { )}
- {Object.entries(ATTACH_TYPE).map(([key, typeCode]) => ( -
+ {STAGES.map((s) => ( +