diff --git a/jjb.config.js b/jjb.config.js index 40d3b13..986ebec 100644 --- a/jjb.config.js +++ b/jjb.config.js @@ -12,8 +12,8 @@ module.exports = { // 可通过环境变量覆盖: SAFETY_EVAL_API_HOST=http://192.168.x.x:8095 //API_HOST: "https://gbs-gateway.qhdsafety.com", - //API_HOST: "http://192.168.0.152", - API_HOST: "http://192.168.0.150", //太浅 + API_HOST: "http://192.168.0.152", + //API_HOST: "http://192.168.0.150", //太浅 // API_HOST: "http://192.168.0.152", //API_HOST: "http://192.168.0.103", //huwei }, diff --git a/src/components/CustomerDetailModal/index.js b/src/components/CustomerDetailModal/index.js new file mode 100644 index 0000000..a11597b --- /dev/null +++ b/src/components/CustomerDetailModal/index.js @@ -0,0 +1,154 @@ +import { useState, useEffect } from "react"; +import { Modal, Button, Descriptions, Table, Tag } from "antd"; +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace"; +import { + ENTERPRISE_STATUS_OPTIONS, + ENTERPRISE_SCALE_OPTIONS, + EVAL_TYPE_MAP, +} from "~/enumerate/constant"; +import { QUALIFICATION_INDUSTRY_OPTIONS_MAP } from "~/enumerate/enterpriseOptions"; + +const CustomerDetailModal = ({ open, customerId, onCancel, ...props }) => { + const [detail, setDetail] = useState(null); + const { customerDetailLoading } = props.safetyEvalBusiness || {}; + + useEffect(() => { + if (!open || !customerId) { + setDetail(null); + return; + } + props.customerDetail({ id: customerId }).then((res) => { + if (res?.success !== false) { + setDetail(res?.data || null); + } + }); + }, [open, customerId]); + + return ( + 关闭} + width={700} + destroyOnHidden + > + {detail && ( + <> + + + {detail.customerName} + + + {detail.creditCode} + + + {(() => { + const statusOption = ENTERPRISE_STATUS_OPTIONS.find( + (opt) => opt.value === detail.enterpriseStatusCode, + ); + return statusOption?.label || detail.enterpriseStatusName; + })()} + + + {(() => { + const scaleOption = ENTERPRISE_SCALE_OPTIONS.find( + (opt) => opt.value === detail.enterpriseScaleCode, + ); + return scaleOption?.label || detail.enterpriseScaleName; + })()} + + + {detail.industryCode + ?.split(",") + .map( + (code) => + QUALIFICATION_INDUSTRY_OPTIONS_MAP[code.trim()] || + code.trim(), + ) + .join("、")} + + + {detail.districtName} + + + {detail.principalName} + + + {detail.principalPhone} + + + {detail.principalName} + + + {detail.principalPhone} + + + {detail.legalRepresentative} + + + {detail.legalRepresentativePhone} + + + {detail.businessAddress} + + + {detail.longitude} + + + {detail.latitude} + + + +

安全评价项目列表

+ EVAL_TYPE_MAP[s] || s || "", + }, + { title: "报告完成日期", dataIndex: "planEndDate", width: 130 }, + { + title: "项目状态", + dataIndex: "status", + width: 100, + fixed: "right", + render: (phase, record) => { + if (record.archiveFlag === 1) { + return 已归档; + } + if (record.projectPhaseCode === "NORMAL") { + return 正常; + } + if (record.projectPhaseCode === "DELAY") { + return 已延期; + } + return record.projectPhaseName; + }, + }, + ]} + pagination={false} + size="small" + /> + + )} + + ); +}; + +export default Connect( + [NS_SAFETY_EVAL_BUSINESS], + true, +)(CustomerDetailModal); diff --git a/src/enumerate/constant/index.js b/src/enumerate/constant/index.js index ce6e5eb..c7d783b 100644 --- a/src/enumerate/constant/index.js +++ b/src/enumerate/constant/index.js @@ -373,20 +373,22 @@ export const PROGRESS_STATUS_MAP = { /** 安评业务提醒 — 提醒等级映射 */ export const WARING_STATUS_MAP = { - first: { color: "success", text: "首次预警" }, - second: { color: "warning", text: "二次提醒" }, - urgent: { color: "error", text: "紧急预警" }, - overdue: { color: "default", text: "已逾期" }, - normal: { color: "default", text: "正常" }, + first_waring: { color: "success", text: "首次预警" }, + second_waring: { color: "warning", text: "二次预警" }, + emergency_waring: { color: "error", text: "紧急预警" }, + overdue_warning: { color: "default", text: "逾期预警" }, + end_warning: { color: "default", text: "结束预警" }, + non_warn: { color: "default", text: "暂时不预警" }, }; /** 安评业务提醒 — 提醒等级筛选选项 */ export const WARING_STATUS_OPTIONS = [ - { label: "首次预警(6个月)", value: "first" }, - { label: "二次提醒(3个月)", value: "second" }, - { label: "紧急预警(1个月)", value: "urgent" }, - { label: "已逾期", value: "overdue" }, - { label: "正常", value: "normal" }, + { label: "暂时不预警", value: "non_warn" }, + { label: "首次预警", value: "first_waring" }, + { label: "二次预警", value: "second_waring" }, + { label: "紧急预警", value: "emergency_waring" }, + { label: "逾期预警", value: "overdue_warning" }, + { label: "结束预警", value: "end_warning" }, ]; export const NODE_LABELS = { diff --git a/src/pages/Container/Layout/menuConfig.js b/src/pages/Container/Layout/menuConfig.js index 107b1c3..2d29247 100644 --- a/src/pages/Container/Layout/menuConfig.js +++ b/src/pages/Container/Layout/menuConfig.js @@ -137,11 +137,6 @@ const menuItems = [ }, ], }, - { - key: "/safetyEval/container/MonitorManage/RiskCenter", - label: "风险预警中心", - icon: , - }, { key: "/safetyEval/container/Supervision/InspectionNotice", label: "监督检查告知", diff --git a/src/pages/Container/SafetyEvalBusiness/BusinessReminder/index.js b/src/pages/Container/SafetyEvalBusiness/BusinessReminder/index.js index 0014d0b..cc171af 100644 --- a/src/pages/Container/SafetyEvalBusiness/BusinessReminder/index.js +++ b/src/pages/Container/SafetyEvalBusiness/BusinessReminder/index.js @@ -16,24 +16,24 @@ import SearchForm from "@cqsjjb/jjb-react-admin-component/SearchForm"; import ControlWrapper from "@cqsjjb/jjb-react-admin-component/ControlWrapper"; import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace"; import { WARING_STATUS_MAP, WARING_STATUS_OPTIONS } from "~/enumerate/constant"; +import { + QUALIFICATION_INDUSTRY_OPTIONS, + QUALIFICATION_INDUSTRY_OPTIONS_MAP, +} from "~/enumerate/enterpriseOptions"; import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { tools } from "@cqsjjb/jjb-common-lib"; +import CustomerDetailModal from "~/components/CustomerDetailModal"; import "./index.less"; const { router } = tools; -const INDUSTRY_OPTIONS = [ - { label: "危险化学品", value: "DANGEROUS_CHEMICAL" }, - { label: "非煤矿山", value: "NON_COAL_MINE" }, - { label: "城镇燃气", value: "URBAN_GAS" }, - { label: "一般工贸", value: "GENERAL_TRADE" }, -]; - const BusinessReminder = (props) => { const [searchForm] = Form.useForm(); const [dataSource, setDataSource] = useState([]); const [total, setTotal] = useState(0); const [statData, setStatData] = useState({}); + const [customerDetailOpen, setCustomerDetailOpen] = useState(false); + const [customerId, setCustomerId] = useState(null); const { projectWaringRemindPageLoading } = props.safetyEvalBusiness; @@ -84,7 +84,8 @@ const BusinessReminder = (props) => { }; const handleViewCustomer = (record) => { - // TODO: 查看企业资料 + setCustomerId(record.customerId); + setCustomerDetailOpen(true); }; const formatCycle = (days) => { @@ -99,19 +100,22 @@ const BusinessReminder = (props) => { const renderWaringStatus = (status) => { const cfg = WARING_STATUS_MAP[status]; if (!cfg) return {status}; - const labelMap = { - first: "首次预警 · 6个月", - second: "二次提醒 · 3个月", - urgent: "紧急预警 · 1个月", - overdue: "已逾期", - normal: "正常", - }; - return {labelMap[status] || cfg.text}; + return {cfg.text}; }; const columns = [ { title: "客户名称", dataIndex: "customerName", width: 180, ellipsis: true }, - { title: "行业 / 场景", dataIndex: "industryCode", width: 160, ellipsis: true }, + { + title: "业务范围", + dataIndex: "industryCode", + width: 160, + ellipsis: true, + render: (val) => + val + ?.split(",") + .map((code) => QUALIFICATION_INDUSTRY_OPTIONS_MAP[code]) + .join("、"), + }, { title: "最近报告完成日", dataIndex: "archiveDate", width: 140 }, { title: "周期", @@ -203,16 +207,16 @@ const BusinessReminder = (props) => { , , @@ -227,8 +231,8 @@ const BusinessReminder = (props) => { 下一次应开展日期 = 最近一次正式报告完成日期 + 对应行业评价周期 - - + {/* + */} @@ -248,6 +252,12 @@ const BusinessReminder = (props) => { }} onChange={handlePageChange} /> + + setCustomerDetailOpen(false)} + /> ); }; diff --git a/src/pages/Container/SafetyEvalBusiness/CustomerManage/index.js b/src/pages/Container/SafetyEvalBusiness/CustomerManage/index.js index 7084f29..d4ae3ea 100644 --- a/src/pages/Container/SafetyEvalBusiness/CustomerManage/index.js +++ b/src/pages/Container/SafetyEvalBusiness/CustomerManage/index.js @@ -9,11 +9,12 @@ import { Row, Col, message, - Descriptions, Flex, Tag, Space, + Tooltip, } from "antd"; + import { PlusOutlined } from "@ant-design/icons"; import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout"; import SearchForm from "@cqsjjb/jjb-react-admin-component/SearchForm"; @@ -22,12 +23,14 @@ import { AntdTableFuncControl } from "@cqsjjb/jjb-common-decorator/antd"; import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace"; import { Connect } from "@cqsjjb/jjb-dva-runtime"; import BaiduMapPicker from "~/components/BaiduMapPicker"; +import AttachmentUpload from "~/components/AttachmentUpload"; +import CustomerDetailModal from "~/components/CustomerDetailModal"; import { tools } from "@cqsjjb/jjb-common-lib"; import { district, ENTERPRISE_STATUS_OPTIONS, ENTERPRISE_SCALE_OPTIONS, - EVAL_TYPE_MAP, + NODE_LABELS } from "~/enumerate/constant"; import { QUALIFICATION_INDUSTRY_OPTIONS } from "~/enumerate/enterpriseOptions"; import { phoneRule, creditCodeRule } from "~/utils/validators"; @@ -42,10 +45,16 @@ const CustomerManage = (props) => { const [mapPickerVisible, setMapPickerVisible] = useState(false); const [modalOpen, setModalOpen] = useState(false); const [detailOpen, setDetailOpen] = useState(false); + const [detailCustomerId, setDetailCustomerId] = useState(null); + const [projectModalOpen, setProjectModalOpen] = useState(false); const [currentDetail, setCurrentDetail] = useState(null); const [editingId, setEditingId] = useState(null); - const { customerLoading, customerModifyLoading, customerSaveLoading } = - props.safetyEvalBusiness; + const { + customerLoading, + customerModifyLoading, + customerSaveLoading, + customerDetailLoading, + } = props.safetyEvalBusiness; const getData = async (pagination) => { const params = { @@ -103,22 +112,32 @@ const CustomerManage = (props) => { setModalOpen(true); }; - const handleOpenEdit = async (record) => { - const res = await props.customerDetail({ id: record.id }); - if (res?.success !== false) { - setEditingId(record.id); - setCurrentDetail(res?.data || {}); - modalForm.setFieldsValue(res?.data || {}); - setModalOpen(true); - } + const handleOpenEdit = (record) => { + setEditingId(record.id); + setCurrentDetail(null); + modalForm.resetFields(); + setModalOpen(true); + props.customerDetail({ id: record.id }).then((res) => { + if (res?.success !== false) { + setCurrentDetail(res?.data || {}); + modalForm.setFieldsValue(res?.data || {}); + } + }); }; - const handleViewDetail = async (record) => { - const res = await props.customerDetail({ id: record.id }); - if (res?.success !== false) { - setCurrentDetail(res?.data || {}); - setDetailOpen(true); - } + const handleViewDetail = (record) => { + setDetailCustomerId(record.id); + setDetailOpen(true); + }; + + const handleViewProjects = (record) => { + setCurrentDetail(null); + setProjectModalOpen(true); + props.customerDetail({ id: record.id }).then((res) => { + if (res?.success !== false) { + setCurrentDetail(res?.data || {}); + } + }); }; const handleDelete = async (record) => { @@ -182,8 +201,13 @@ const CustomerManage = (props) => { title: "服务项目数", dataIndex: "projectCount", width: 110, - render: (count) => ( - ), @@ -197,7 +221,6 @@ const CustomerManage = (props) => { } - width={700} - destroyOnHidden - > - {currentDetail && ( - <> - - - {currentDetail.customerName} - - - {currentDetail.creditCode} - - - {(() => { - const statusOption = ENTERPRISE_STATUS_OPTIONS.find( - (opt) => opt.value === currentDetail.enterpriseStatusCode, - ); - return ( - statusOption?.label || currentDetail.enterpriseStatusName - ); - })()} - - - {(() => { - const scaleOption = ENTERPRISE_SCALE_OPTIONS.find( - (opt) => opt.value === currentDetail.enterpriseScaleCode, - ); - return ( - scaleOption?.label || currentDetail.enterpriseScaleName - ); - })()} - - - {currentDetail.industryName || currentDetail.industryCode} - - - {currentDetail.districtName} - - - {currentDetail.principalName} - - - {currentDetail.principalPhone} - - - {currentDetail.principalName} - - - {currentDetail.principalPhone} - - - {currentDetail.legalRepresentative} - - - {currentDetail.legalRepresentativePhone} - - - {currentDetail.businessAddress} - - - {currentDetail.longitude} - - - {currentDetail.latitude} - - - -

安全评价项目列表

-
EVAL_TYPE_MAP[s] || s || "", - }, - { title: "报告完成日期", dataIndex: "planEndDate", width: 130 }, - { - title: "项目状态", - dataIndex: "status", - width: 100, - fixed: "right", - render: (phase) => { - const color = - phase === "延期" - ? "error" - : phase === "正常" - ? "success" - : undefined; - return {phase || "-"}; - }, - }, - ]} - pagination={false} - size="small" - /> - - )} - + /> setMapPickerVisible(false)} onConfirm={handleMapConfirm} /> + + {/* 服务项目列表弹窗 */} + setProjectModalOpen(false)} + footer={ + + } + width={800} + + destroyOnHidden + > +
{ + const nodes = parseProjectNode(record.projectNode); + if (nodes.length === 0) + return 暂无; + const total = nodes.length; + const done = nodes.filter((n) => n.state === 1).length; + + return ( +
+
+ {nodes.map((n, idx) => ( + + + + ))} +
+
+ {done}/{total} · {Math.round((done / total) * 100)}% +
+
+ ); + }, + }, + { title: "负责人", dataIndex: "projectLeaderName", width: 130 }, + { + title: "项目状态", + dataIndex: "status", + width: 100, + fixed: "right", + render: (phase, record) => { + if (record.archiveFlag === 1) { + return 已归档; + } + if (record.projectPhaseCode === "NORMAL") { + return 正常; + } + if (record.projectPhaseCode === "DELAY") { + return 已延期; + } + return record.projectPhaseName; + }, + }, + { + title: "操作", + width: 100, + + render: (_, record) => ( + + + + ), + } + ]} + pagination={false} + size="small" + /> + ); }; diff --git a/src/pages/Container/SafetyEvalBusiness/RiskWarning/index.js b/src/pages/Container/SafetyEvalBusiness/RiskWarning/index.js index 2a7c93a..aafd889 100644 --- a/src/pages/Container/SafetyEvalBusiness/RiskWarning/index.js +++ b/src/pages/Container/SafetyEvalBusiness/RiskWarning/index.js @@ -79,17 +79,7 @@ const RiskWarning = (props) => { getData(); }; - const handleCloseRisk = async (record) => { - Modal.confirm({ - title: "确认闭环", - content: `确定将"${record.projectName}"的风险标记为闭环吗?`, - onOk: async () => { - // TODO: 调用闭环接口 - message.success("已闭环"); - getData(); - }, - }); - }; + const columns = [ { title: "项目编号", dataIndex: "projectNo", width: 130 }, @@ -130,18 +120,7 @@ const RiskWarning = (props) => { return cfg ? {cfg.text} : ""; }, }, - { - title: "操作", - width: 130, - fixed: "right", - render: (_, record) => ( - - - - ), - }, + ]; return (