diff --git a/package.json b/package.json index cde08aa..fe417ce 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "lint": "eslint --ext .js,.jsx,.tsx --fix src" }, "dependencies": { + "@ahooksjs/use-url-state": "^3.5.1", "@ant-design/icons": "^5.6.1", "@ant-design/pro-components": "^2.8.10", "@cqsjjb/jjb-common-decorator": "latest", @@ -30,7 +31,7 @@ "lodash-es": "^4.17.21", "react": "^18.2.0", "react-dom": "^18.2.0", - "zy-react-library": "^1.2.23" + "zy-react-library": "^1.2.28" }, "devDependencies": { "@antfu/eslint-config": "^5.4.1", diff --git a/router.md b/router.md index 1f5f6cd..80fde8b 100644 --- a/router.md +++ b/router.md @@ -64,3 +64,5 @@ `/emergencyRescue/container/enterprise/emergencyOrganization/emergencyRescueTeam/list` - 预案与演练/企业预案管理 `/emergencyRescue/container/enterprise/planAndDrill/enterprisePlan/list` +- 预案与演练/应急预案管理 + `/emergencyRescue/container/enterprise/planAndDrill/emergencyPlan/list` diff --git a/src/api/emergencyPlan/index.js b/src/api/emergencyPlan/index.js new file mode 100644 index 0000000..7f8b5e1 --- /dev/null +++ b/src/api/emergencyPlan/index.js @@ -0,0 +1,26 @@ +import { declareRequest } from "@cqsjjb/jjb-dva-runtime"; + +export const emergencyPlanList = declareRequest( + "emergencyPlanLoading", + "Post > @/emergencyRescue/emergencyPlanManagement/list", +); +export const emergencyPlanInfo = declareRequest( + "emergencyPlanLoading", + "Get > /emergencyRescue/emergencyPlanManagement/{id}", +); +export const emergencyPlanAdd = declareRequest( + "emergencyPlanLoading", + "Post > @/emergencyRescue/emergencyPlanManagement/save", +); +export const emergencyPlanUpdate = declareRequest( + "emergencyPlanLoading", + "Put > @/emergencyRescue/emergencyPlanManagement/edit", +); +export const emergencyPlanDelete = declareRequest( + "emergencyPlanLoading", + "Delete > @/emergencyRescue/emergencyPlanManagement/{id}", +); +export const emergencyPlanDeleteBatch = declareRequest( + "emergencyPlanLoading", + "Delete > @/emergencyRescue/emergencyPlanManagement/ids?ids={ids}", +); diff --git a/src/api/enterprisePlan/index.js b/src/api/enterprisePlan/index.js new file mode 100644 index 0000000..0a385e8 --- /dev/null +++ b/src/api/enterprisePlan/index.js @@ -0,0 +1,146 @@ +import { declareRequest } from "@cqsjjb/jjb-dva-runtime"; + +export const enterprisePlanBasicInfoList = declareRequest( + "enterprisePlanBasicInfoLoading", + "Post > @/emergencyRescue/enterprisePlanBasicInfo/list", +); +export const enterprisePlanBasicInfoInfo = declareRequest( + "enterprisePlanBasicInfoLoading", + "Get > /emergencyRescue/enterprisePlanBasicInfo/{id}", +); +export const enterprisePlanBasicInfoAdd = declareRequest( + "enterprisePlanBasicInfoLoading", + "Post > @/emergencyRescue/enterprisePlanBasicInfo/save", +); +export const enterprisePlanBasicInfoUpdate = declareRequest( + "enterprisePlanBasicInfoLoading", + "Put > @/emergencyRescue/enterprisePlanBasicInfo/edit", +); +export const enterprisePlanBasicInfoDelete = declareRequest( + "enterprisePlanBasicInfoLoading", + "Delete > @/emergencyRescue/enterprisePlanBasicInfo/{id}", +); +export const enterprisePlanLevelResponseList = declareRequest( + "enterprisePlanLevelResponseLoading", + "Post > @/emergencyRescue/enterprisePlanLevelResponse/list", +); +export const enterprisePlanLevelResponseListAll = declareRequest( + "enterprisePlanLevelResponseLoading", + "Get > /emergencyRescue/enterprisePlanLevelResponse/listAll", +); +export const enterprisePlanLevelResponseInfo = declareRequest( + "enterprisePlanLevelResponseLoading", + "Get > /emergencyRescue/enterprisePlanLevelResponse/{id}", +); +export const enterprisePlanLevelResponseAdd = declareRequest( + "enterprisePlanLevelResponseLoading", + "Post > @/emergencyRescue/enterprisePlanLevelResponse/save", +); +export const enterprisePlanLevelResponseUpdate = declareRequest( + "enterprisePlanLevelResponseLoading", + "Put > @/emergencyRescue/enterprisePlanLevelResponse/edit", +); +export const enterprisePlanLevelResponseDelete = declareRequest( + "enterprisePlanLevelResponseLoading", + "Delete > @/emergencyRescue/enterprisePlanLevelResponse/{id}", +); +export const enterprisePlanLevelOrganizationListTree = declareRequest( + "enterprisePlanLevelOrganizationLoading", + "Get > /emergencyRescue/enterprisePlanOrganization/listTree", +); +export const enterprisePlanLevelOrganizationInfo = declareRequest( + "enterprisePlanLevelOrganizationLoading", + "Get > /emergencyRescue/enterprisePlanOrganization/{id}", +); +export const enterprisePlanLevelOrganizationAdd = declareRequest( + "enterprisePlanLevelOrganizationLoading", + "Post > @/emergencyRescue/enterprisePlanOrganization/save", +); +export const enterprisePlanLevelOrganizationUpdate = declareRequest( + "enterprisePlanLevelOrganizationLoading", + "Put > @/emergencyRescue/enterprisePlanOrganization/edit", +); +export const enterprisePlanLevelOrganizationDelete = declareRequest( + "enterprisePlanLevelOrganizationLoading", + "Delete > @/emergencyRescue/enterprisePlanOrganization/{id}", +); +export const enterprisePlanOrganizationPersonnelList = declareRequest( + "enterprisePlanOrganizationPersonnelLoading", + "Post > @/emergencyRescue/enterprisePlanOrganizationPersonnel/list", +); +export const enterprisePlanOrganizationPersonnelInfo = declareRequest( + "enterprisePlanOrganizationPersonnelLoading", + "Get > /emergencyRescue/enterprisePlanOrganizationPersonnel/{id}", +); +export const enterprisePlanOrganizationPersonnelAdd = declareRequest( + "enterprisePlanOrganizationPersonnelLoading", + "Post > @/emergencyRescue/enterprisePlanOrganizationPersonnel/save", +); +export const enterprisePlanOrganizationPersonnelUpdate = declareRequest( + "enterprisePlanOrganizationPersonnelLoading", + "Put > @/emergencyRescue/enterprisePlanOrganizationPersonnel/edit", +); +export const enterprisePlanOrganizationPersonnelDelete = declareRequest( + "enterprisePlanOrganizationPersonnelLoading", + "Delete > @/emergencyRescue/enterprisePlanOrganizationPersonnel/{id}", +); +export const enterprisePlanResourceList = declareRequest( + "enterprisePlanResourceLoading", + "Post > @/emergencyRescue/enterprisePlanResource/list", +); +export const enterprisePlanResourceInfo = declareRequest( + "enterprisePlanResourceLoading", + "Get > /emergencyRescue/enterprisePlanResource/{id}", +); +export const enterprisePlanResourceAdd = declareRequest( + "enterprisePlanResourceLoading", + "Post > @/emergencyRescue/enterprisePlanResource/save", +); +export const enterprisePlanResourceUpdate = declareRequest( + "enterprisePlanResourceLoading", + "Put > @/emergencyRescue/enterprisePlanResource/edit", +); +export const enterprisePlanResourceDelete = declareRequest( + "enterprisePlanResourceLoading", + "Delete > @/emergencyRescue/enterprisePlanResource/{id}", +); +export const enterprisePlanCommandSettingList = declareRequest( + "enterprisePlanCommandSettingLoading", + "Post > @/emergencyRescue/enterprisePlanCommandSetting/list", +); +export const enterprisePlanCommandSettingInfo = declareRequest( + "enterprisePlanCommandSettingLoading", + "Get > /emergencyRescue/enterprisePlanCommandSetting/{id}", +); +export const enterprisePlanCommandSettingAdd = declareRequest( + "enterprisePlanCommandSettingLoading", + "Post > @/emergencyRescue/enterprisePlanCommandSetting/save", +); +export const enterprisePlanCommandSettingUpdate = declareRequest( + "enterprisePlanCommandSettingLoading", + "Put > @/emergencyRescue/enterprisePlanCommandSetting/edit", +); +export const enterprisePlanCommandSettingDelete = declareRequest( + "enterprisePlanCommandSettingLoading", + "Delete > @/emergencyRescue/enterprisePlanCommandSetting/{id}", +); +export const enterprisePlanAttachmentList = declareRequest( + "enterprisePlanAttachmentLoading", + "Post > @/emergencyRescue/enterprisePlanAttachment/list", +); +export const enterprisePlanAttachmentInfo = declareRequest( + "enterprisePlanAttachmentLoading", + "Get > /emergencyRescue/enterprisePlanAttachment/{id}", +); +export const enterprisePlanAttachmentAdd = declareRequest( + "enterprisePlanAttachmentLoading", + "Post > @/emergencyRescue/enterprisePlanAttachment/save", +); +export const enterprisePlanAttachmentUpdate = declareRequest( + "enterprisePlanAttachmentLoading", + "Put > @/emergencyRescue/enterprisePlanAttachment/edit", +); +export const enterprisePlanAttachmentDelete = declareRequest( + "enterprisePlanAttachmentLoading", + "Delete > @/emergencyRescue/enterprisePlanAttachment/{id}", +); diff --git a/src/api/expertEmergencyRescueExpertGroup/index.js b/src/api/expertEmergencyRescueExpertGroup/index.js index 1ca944e..2181a87 100644 --- a/src/api/expertEmergencyRescueExpertGroup/index.js +++ b/src/api/expertEmergencyRescueExpertGroup/index.js @@ -44,3 +44,7 @@ export const expertEmergencyRescueExpertGroupDownExpertEmergencyRescueExpertDele "expertEmergencyRescueExpertGroupDownExpertEmergencyRescueExpertLoading", "Delete > @/emergencyRescue/emergencyRescueExpertGroupRel/ids?ids={ids}", ); +export const expertEmergencyRescueExpertGroupDownExpertEmergencyRescueExpertCheckList = declareRequest( + "expertEmergencyRescueExpertGroupDownExpertEmergencyRescueExpertLoading", + "Get > /emergencyRescue/emergencyRescueExpertGroupRel/listAll", +); diff --git a/src/enumerate/constant/index.js b/src/enumerate/constant/index.js index f077757..bff7026 100644 --- a/src/enumerate/constant/index.js +++ b/src/enumerate/constant/index.js @@ -3,3 +3,14 @@ */ export {}; + +export const ENTERPRISE_PLAN_AUDIT_STATUS_ENUM = [ + { name: "待审核", bianma: "1" }, + { name: "已通过", bianma: "2" }, + { name: "已驳回", bianma: "3" }, +]; + +export const EMERGENCY_PLAN_FILING_STATUS_ENUM = [ + { name: "已备案", bianma: "1" }, + { name: "未备案", bianma: "2" }, +]; diff --git a/src/enumerate/namespace/index.js b/src/enumerate/namespace/index.js index eed39e1..6d0ce22 100644 --- a/src/enumerate/namespace/index.js +++ b/src/enumerate/namespace/index.js @@ -23,3 +23,5 @@ export const NS_TECHNICAL_SUPPORT_GUARANTEE_ORGANIZATION = defineNamespace("tech export const NS_ENTERPRISE_EMERGENCY_ORGANIZATION = defineNamespace("enterpriseEmergencyOrganization"); export const NS_ENTERPRISE_EMERGENCY_PERSONNEL = defineNamespace("enterpriseEmergencyPersonnel"); export const NS_EMERGENCY_RESCUE_TEAM = defineNamespace("emergencyRescueTeam"); +export const NS_ENTERPRISE_PLAN = defineNamespace("enterprisePlan"); +export const NS_EMERGENCY_PLAN = defineNamespace("emergencyPlan"); diff --git a/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueExpert/Add/index.js b/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueExpert/Add/index.js index 2373065..0b5c9e1 100644 --- a/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueExpert/Add/index.js +++ b/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueExpert/Add/index.js @@ -157,7 +157,7 @@ function Add(props) { { name: "workUnit", label: "工作单位" }, { name: "unitSupervisorDepartment", label: "单位主管部门" }, { name: "unitPostalCode", label: "单位邮编", rules: [{ pattern: POSTAL_CODE, message: "请输入正确的单位邮编" }] }, - { name: "sortOrder", label: "排序号", render: FORM_ITEM_RENDER_ENUM.NUMBER }, + { name: "sortOrder", label: "排序号", render: FORM_ITEM_RENDER_ENUM.INTEGER }, { name: "expertise", label: "专家特长" }, { name: "mainAchievements", label: "主要成果" }, { name: "emergencyWorkExperience", label: "应急工作经历" }, diff --git a/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueExpertGroup/Add/index.js b/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueExpertGroup/Add/index.js index 6609daa..3f79a46 100644 --- a/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueExpertGroup/Add/index.js +++ b/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueExpertGroup/Add/index.js @@ -71,7 +71,7 @@ function Add(props) { { name: "groupLevelName", label: "专家组级别名称", onlyForLabel: true }, { name: "contactPhone", label: "联系电话", rules: [{ pattern: PHONE, message: "请输入正确的联系电话" }] }, { name: "fax", label: "传真", rules: [{ pattern: TEL_PHONE, message: "请输入正确的传真" }] }, - { name: "memberCount", label: "人数", render: FORM_ITEM_RENDER_ENUM.NUMBER }, + { name: "memberCount", label: "人数", render: FORM_ITEM_RENDER_ENUM.INTEGER }, { name: "establishUnit", label: "组建单位" }, { name: "establishUnitPostalCode", label: "组件单位邮编", rules: [{ pattern: POSTAL_CODE, message: "请输入正确的组件单位邮编" }] }, { name: "establishUnitAddress", label: "组建单位地址", span: 24 }, @@ -84,7 +84,7 @@ function Add(props) { { name: "contactMobilePhone", label: "联系人移动电话", rules: [{ pattern: PHONE, message: "请输入正确的联系人移动电话" }] }, { name: "contactHomePhone", label: "联系人住宅电话", rules: [{ pattern: TEL_PHONE, message: "请输入正确的联系人住宅电话" }] }, { name: "contactEmail", label: "联系人电子邮箱", rules: [{ type: "email", message: "请输入正确的联系人电子邮箱" }] }, - { name: "sortOrder", label: "排序号", render: FORM_ITEM_RENDER_ENUM.NUMBER }, + { name: "sortOrder", label: "排序号", render: FORM_ITEM_RENDER_ENUM.INTEGER }, { name: "groupIntroduction", label: "专家组介绍", render: FORM_ITEM_RENDER_ENUM.TEXTAREA, span: 24 }, { name: "remarks", label: "备注", render: FORM_ITEM_RENDER_ENUM.TEXTAREA, span: 24 }, ]} diff --git a/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueExpertGroup/Member/List/index.js b/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueExpertGroup/Member/List/index.js index dcab230..c75cc92 100644 --- a/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueExpertGroup/Member/List/index.js +++ b/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueExpertGroup/Member/List/index.js @@ -1,6 +1,6 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { Button, message, Modal, Space } from "antd"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import AddIcon from "zy-react-library/components/Icon/AddIcon"; import DeleteIcon from "zy-react-library/components/Icon/DeleteIcon"; import Page from "zy-react-library/components/Page"; @@ -8,6 +8,7 @@ import Search from "zy-react-library/components/Search"; 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 { ArrayDeduplication } from "zy-react-library/utils"; import { NS_EXPERT_EMERGENCY_RESCUE_EXPERT, NS_EXPERT_EMERGENCY_RESCUE_EXPERT_GROUP } from "~/enumerate/namespace"; function List(props) { @@ -142,6 +143,7 @@ function List(props) { const AddModalComponent = (props) => { const [selectedRowKeys, setSelectedRowKeys] = useState([]); + const [disabledRowKeys, setDisabledRowKeys] = useState([]); const [form] = Search.useForm(); @@ -150,17 +152,27 @@ const AddModalComponent = (props) => { useStorageQueryCriteria: false, }); + const getCheckList = async () => { + const { data } = await props["expertEmergencyRescueExpertGroupDownExpertEmergencyRescueExpertCheckList"]({ likeGroupId: props.groupId }); + setDisabledRowKeys(data.map(item => item.expertId)); + setSelectedRowKeys(data.map(item => item.expertId)); + }; + + useEffect(() => { + getCheckList(); + }, []); + const onSubmit = async () => { if (selectedRowKeys.length === 0) { return message.warning("请选择要添加的记录"); } - const { success } = props["expertEmergencyRescueExpertGroupDownExpertEmergencyRescueExpertAddBatch"]({ - expertIds: selectedRowKeys, + const { success } = await props["expertEmergencyRescueExpertGroupDownExpertEmergencyRescueExpertAddBatch"]({ + expertIds: ArrayDeduplication(selectedRowKeys), groupId: props.groupId, }); if (success) { message.success("添加成功"); - props.onClose(); + props.onCancel(); props.getData(); } }; @@ -190,6 +202,9 @@ const AddModalComponent = (props) => { onChange: (selectedRowKeys) => { setSelectedRowKeys(selectedRowKeys); }, + getCheckboxProps: record => ({ + disabled: disabledRowKeys.includes(record.id), + }), }} options={false} disabledResizer={true} diff --git a/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueTeam/Add/index.js b/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueTeam/Add/index.js index 2d5a55b..006f441 100644 --- a/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueTeam/Add/index.js +++ b/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueTeam/Add/index.js @@ -161,7 +161,7 @@ function Add(props) { }, { name: "supervisorUnitName", label: "主管单位名称", onlyForLabel: true }, { name: "supervisorUnitAddress", label: "主管单位地址" }, - { name: "totalPeople", label: "总人数", render: FORM_ITEM_RENDER_ENUM.NUMBER }, + { name: "totalPeople", label: "总人数", render: FORM_ITEM_RENDER_ENUM.INTEGER }, { name: "establishDate", label: "成立时间", render: FORM_ITEM_RENDER_ENUM.DATE }, { name: "emergencyCommunication", label: "应急通讯方式", span: 24 }, { name: "mainDuty", label: "主要职责", span: 24, render: FORM_ITEM_RENDER_ENUM.TEXTAREA }, diff --git a/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueTeam/EmergencyRescuePersonnel/Add/index.js b/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueTeam/EmergencyRescuePersonnel/Add/index.js index 9831888..00c7d92 100644 --- a/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueTeam/EmergencyRescuePersonnel/Add/index.js +++ b/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyExpertTeam/ExpertEmergencyRescueTeam/EmergencyRescuePersonnel/Add/index.js @@ -56,7 +56,7 @@ function Add(props) { ), }, { name: "genderName", label: "性别名称", onlyForLabel: true }, - { name: "age", label: "年龄", render: FORM_ITEM_RENDER_ENUM.NUMBER }, + { name: "age", label: "年龄", render: FORM_ITEM_RENDER_ENUM.INTEGER }, { name: "mobilePhone", label: "手机号", diff --git a/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyManagementOrganization/EnterpriseEmergencyPersonnel/Add/index.js b/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyManagementOrganization/EnterpriseEmergencyPersonnel/Add/index.js index 869051d..f3b2ae2 100644 --- a/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyManagementOrganization/EnterpriseEmergencyPersonnel/Add/index.js +++ b/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyManagementOrganization/EnterpriseEmergencyPersonnel/Add/index.js @@ -95,7 +95,7 @@ function Add(props) { ), }, { name: "userName", label: "用户名称", onlyForLabel: true }, - { name: "sortOrder", label: "排序", render: FORM_ITEM_RENDER_ENUM.NUMBER }, + { name: "sortOrder", label: "排序", render: FORM_ITEM_RENDER_ENUM.INTEGER }, { name: "genderName", label: "性别", componentProps: { disabled: true } }, { name: "gender", label: "性别ID", onlyForLabel: true }, { name: "administrativePosition", label: "行政职务" }, diff --git a/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyRescueTeam/Add/index.js b/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyRescueTeam/Add/index.js index 34f15a0..ebb6460 100644 --- a/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyRescueTeam/Add/index.js +++ b/src/pages/Container/Enterprise/EmergencyOrganization/EmergencyRescueTeam/Add/index.js @@ -104,10 +104,10 @@ function Add(props) { label: "应急值班电话", rules: [{ pattern: TEL_PHONE, message: "请输入正确的应急值班电话" }], }, - { name: "totalPeople", label: "总人数", render: FORM_ITEM_RENDER_ENUM.NUMBER }, - { name: "commanderCount", label: "指战人数", render: FORM_ITEM_RENDER_ENUM.NUMBER }, - { name: "vehicleCount", label: "车辆数", render: FORM_ITEM_RENDER_ENUM.NUMBER }, - { name: "logisticsCount", label: "后勤人数", render: FORM_ITEM_RENDER_ENUM.NUMBER }, + { name: "totalPeople", label: "总人数", render: FORM_ITEM_RENDER_ENUM.INTEGER }, + { name: "commanderCount", label: "指战人数", render: FORM_ITEM_RENDER_ENUM.INTEGER }, + { name: "vehicleCount", label: "车辆数", render: FORM_ITEM_RENDER_ENUM.INTEGER }, + { name: "logisticsCount", label: "后勤人数", render: FORM_ITEM_RENDER_ENUM.INTEGER }, { name: "rescueMajor", label: "救援专业", diff --git a/src/pages/Container/Enterprise/EmergencyOrganization/ProfessionalGuaranteeOrganization/CommunicationGuaranteeOrganization/Add/index.js b/src/pages/Container/Enterprise/EmergencyOrganization/ProfessionalGuaranteeOrganization/CommunicationGuaranteeOrganization/Add/index.js index e66171e..6a7c1f2 100644 --- a/src/pages/Container/Enterprise/EmergencyOrganization/ProfessionalGuaranteeOrganization/CommunicationGuaranteeOrganization/Add/index.js +++ b/src/pages/Container/Enterprise/EmergencyOrganization/ProfessionalGuaranteeOrganization/CommunicationGuaranteeOrganization/Add/index.js @@ -82,10 +82,10 @@ function Add(props) { }, { name: "regionCodeName", label: "所属区域名称", onlyForLabel: true }, { key: "map", customizeRender: true, render: (), span: 24 }, - { name: "emergencyCommunicationVehicleCount", label: "应急通讯车数", render: FORM_ITEM_RENDER_ENUM.NUMBER }, - { name: "emergencyGeneratorVehicleCount", label: "应急发电车数", render: FORM_ITEM_RENDER_ENUM.NUMBER }, - { name: "satellitePhoneCount", label: "卫星电话数", render: FORM_ITEM_RENDER_ENUM.NUMBER }, - { name: "baseStationTotalCount", label: "基站总数", render: FORM_ITEM_RENDER_ENUM.NUMBER }, + { name: "emergencyCommunicationVehicleCount", label: "应急通讯车数", render: FORM_ITEM_RENDER_ENUM.INTEGER }, + { name: "emergencyGeneratorVehicleCount", label: "应急发电车数", render: FORM_ITEM_RENDER_ENUM.INTEGER }, + { name: "satellitePhoneCount", label: "卫星电话数", render: FORM_ITEM_RENDER_ENUM.INTEGER }, + { name: "baseStationTotalCount", label: "基站总数", render: FORM_ITEM_RENDER_ENUM.INTEGER }, { name: "emergencyCommunicationMode", label: "应急通讯方式", span: 24 }, { name: "leaderName", label: "负责人", rules: [{ required: true, message: "请输入负责人" }] }, { diff --git a/src/pages/Container/Enterprise/EmergencyOrganization/ProfessionalGuaranteeOrganization/MedicalGuaranteeOrganization/Add/index.js b/src/pages/Container/Enterprise/EmergencyOrganization/ProfessionalGuaranteeOrganization/MedicalGuaranteeOrganization/Add/index.js index c466feb..59740a3 100644 --- a/src/pages/Container/Enterprise/EmergencyOrganization/ProfessionalGuaranteeOrganization/MedicalGuaranteeOrganization/Add/index.js +++ b/src/pages/Container/Enterprise/EmergencyOrganization/ProfessionalGuaranteeOrganization/MedicalGuaranteeOrganization/Add/index.js @@ -82,10 +82,10 @@ function Add(props) { }, { name: "regionCodeName", label: "所属区域名称", onlyForLabel: true }, { key: "map", customizeRender: true, render: (), span: 24 }, - { name: "bedCount", label: "病床数", render: FORM_ITEM_RENDER_ENUM.NUMBER }, - { name: "doctorCount", label: "医生数", render: FORM_ITEM_RENDER_ENUM.NUMBER }, - { name: "nurseCount", label: "护士数", render: FORM_ITEM_RENDER_ENUM.NUMBER }, - { name: "ambulanceCount", label: "急救车辆数", render: FORM_ITEM_RENDER_ENUM.NUMBER }, + { name: "bedCount", label: "病床数", render: FORM_ITEM_RENDER_ENUM.INTEGER }, + { name: "doctorCount", label: "医生数", render: FORM_ITEM_RENDER_ENUM.INTEGER }, + { name: "nurseCount", label: "护士数", render: FORM_ITEM_RENDER_ENUM.INTEGER }, + { name: "ambulanceCount", label: "急救车辆数", render: FORM_ITEM_RENDER_ENUM.INTEGER }, { name: "emergencyCommunication", label: "应急通讯方式", span: 24 }, { name: "leaderName", label: "负责人", rules: [{ required: true, message: "请输入负责人" }] }, { @@ -136,7 +136,7 @@ function Add(props) { { name: "supervisorUnitAddress", label: "主管单位地址" }, { name: "features", label: "特色", render: FORM_ITEM_RENDER_ENUM.TEXTAREA, span: 24 }, { name: "mainMedicalEquipment", label: "主要医疗设备" }, - { name: "anticoagulationTreatmentCount", label: "抗震设防列数", render: FORM_ITEM_RENDER_ENUM.NUMBER }, + { name: "anticoagulationTreatmentCount", label: "抗震设防列数", render: FORM_ITEM_RENDER_ENUM.INTEGER }, { name: "remarks", label: "备注", render: FORM_ITEM_RENDER_ENUM.TEXTAREA, span: 24 }, ]} form={form} diff --git a/src/pages/Container/Enterprise/EmergencyResource/MaterialEquipment/Add/index.js b/src/pages/Container/Enterprise/EmergencyResource/MaterialEquipment/Add/index.js index 740d331..ff40c79 100644 --- a/src/pages/Container/Enterprise/EmergencyResource/MaterialEquipment/Add/index.js +++ b/src/pages/Container/Enterprise/EmergencyResource/MaterialEquipment/Add/index.js @@ -44,7 +44,7 @@ function Add(props) { { name: "warehouseName", label: "资源库名称" }, { name: "address", label: "所在地点" }, { name: "resourceCategory", label: "存放资源类别" }, - { name: "resourceQuantity", label: "资源数量", render: FORM_ITEM_RENDER_ENUM.NUMBER }, + { name: "resourceQuantity", label: "资源数量", render: FORM_ITEM_RENDER_ENUM.INTEGER }, { name: "contactPerson", label: "联系人" }, { name: "contactPhone", label: "联系人电话", rules: [{ pattern: TEL_PHONE, message: "请输入正确的电话号码" }] }, { name: "contactMobile", label: "联系手机号", rules: [{ pattern: PHONE, message: "请输入正确的手机号" }] }, diff --git a/src/pages/Container/Enterprise/EmergencyResource/MaterialEquipment/FacilitiesEquipment/Add/index.js b/src/pages/Container/Enterprise/EmergencyResource/MaterialEquipment/FacilitiesEquipment/Add/index.js index 0bb412d..ebc5008 100644 --- a/src/pages/Container/Enterprise/EmergencyResource/MaterialEquipment/FacilitiesEquipment/Add/index.js +++ b/src/pages/Container/Enterprise/EmergencyResource/MaterialEquipment/FacilitiesEquipment/Add/index.js @@ -29,8 +29,12 @@ function Add(props) { return; const { data } = await props["facilitiesEquipmentInfo"]({ id: query.id }); - fileIdRef.current = data.fileId; - const files = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM[701], eqForeignKey: data.fileId }); + const files = []; + if (data.fileId) { + fileIdRef.current = data.fileId; + const fileItems = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM[701], eqForeignKey: data.fileId }); + files.push(...fileItems); + } form.setFieldsValue({ ...data, files, diff --git a/src/pages/Container/Enterprise/EmergencyResource/MaterialEquipment/FacilitiesEquipment/View/index.js b/src/pages/Container/Enterprise/EmergencyResource/MaterialEquipment/FacilitiesEquipment/View/index.js index 9c5961d..ae444c8 100644 --- a/src/pages/Container/Enterprise/EmergencyResource/MaterialEquipment/FacilitiesEquipment/View/index.js +++ b/src/pages/Container/Enterprise/EmergencyResource/MaterialEquipment/FacilitiesEquipment/View/index.js @@ -18,7 +18,11 @@ function View(props) { const getData = async () => { const { data } = await props["facilitiesEquipmentInfo"]({ id: query.id }); - const files = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM[701], eqForeignKey: data.fileId }); + const files = []; + if (data.fileId) { + const fileItems = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM[701], eqForeignKey: data.fileId }); + files.push(...fileItems); + } setInfo({ ...data, files, @@ -64,7 +68,7 @@ function View(props) { { label: "第二联系人", children: info.secondContactPerson }, { label: "第二联系人电话", children: info.secondContactPhone }, { label: "概述", children: info.summary }, - { label: "附件", children: previewFile(info.files) }, + { label: "附件", children: previewFile(info.files), span: 2 }, ]} /> diff --git a/src/pages/Container/Enterprise/PlanAndDrill/EmergencyPlan/Add/index.js b/src/pages/Container/Enterprise/PlanAndDrill/EmergencyPlan/Add/index.js new file mode 100644 index 0000000..c69aadc --- /dev/null +++ b/src/pages/Container/Enterprise/PlanAndDrill/EmergencyPlan/Add/index.js @@ -0,0 +1,164 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { message } from "antd"; +import { useEffect, useRef } from "react"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import Page from "zy-react-library/components/Page"; +import DictionarySelect from "zy-react-library/components/Select/Dictionary"; +import Upload from "zy-react-library/components/Upload"; +import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; +import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj"; +import useDeleteFile from "zy-react-library/hooks/useDeleteFile"; +import useGetFile from "zy-react-library/hooks/useGetFile"; +import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; +import useUploadFile from "zy-react-library/hooks/useUploadFile"; +import { getLabelName } from "zy-react-library/utils"; +import { EMERGENCY_PLAN_FILING_STATUS_ENUM } from "~/enumerate/constant"; +import { NS_EMERGENCY_PLAN } from "~/enumerate/namespace"; + +function Add(props) { + const query = useGetUrlQuery(); + const { loading: getFileLoading, getFile } = useGetFile(); + const { loading: uploadFileLoading, uploadFile } = useUploadFile(); + const { loading: deleteFileLoading, deleteFile } = useDeleteFile(); + + const [form] = FormBuilder.useForm(); + + const fileIdRef = useRef(""); + + const getData = async () => { + if (!query.id) + return; + + const { data } = await props["emergencyPlanInfo"]({ id: query.id }); + const files = []; + if (data.fileId) { + fileIdRef.current = data.fileId; + const fileItems = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM[703], eqForeignKey: data.fileId }); + files.push(...fileItems); + } + form.setFieldsValue({ + ...data, + files, + }); + }; + + useEffect(() => { + getData(); + }, []); + + const onSubmit = async (values) => { + await deleteFile({ single: false, files: values.deleteFiles }); + const { id: fileId } = await uploadFile({ + single: false, + files: values.files, + params: { type: UPLOAD_FILE_TYPE_ENUM[703], foreignKey: fileIdRef.current }, + }); + const { success } = await props[query.id ? "emergencyPlanUpdate" : "emergencyPlanAdd"]({ + ...values, + fileId, + id: query.id, + }); + if (success) { + message.success(query.id ? "编辑成功" : "新增成功"); + props.history.goBack(); + } + }; + + return ( + + { + form.setFieldValue("applicableFieldName", label); + }} + /> + ), + }, + { name: "applicableFieldName", label: "适应领域名称", onlyForLabel: true }, + { + name: "planCategory", + label: "预案类别", + render: ( + { + form.setFieldValue("planCategoryName", label); + }} + /> + ), + }, + { name: "planCategoryName", label: "预案类别名称", onlyForLabel: true }, + { + name: "planType", + label: "预案级别", + render: ( + { + form.setFieldValue("planTypeName", label); + }} + /> + ), + }, + { name: "planTypeName", label: "预案级别名称", onlyForLabel: true }, + { name: "draftingUnit", label: "编制单位" }, + { name: "draftingPerson", label: "编制人" }, + { name: "releaseDate", label: "发布日期", render: FORM_ITEM_RENDER_ENUM.DATE }, + { name: "releaseNumber", label: "发布文号" }, + { name: "releaseUnit", label: "发布单位" }, + { name: "signatory", label: "签发人" }, + { + name: "recordStatus", + label: "备案状态", + render: FORM_ITEM_RENDER_ENUM.SELECT, + items: EMERGENCY_PLAN_FILING_STATUS_ENUM, + componentProps: { + onChange: (value) => { + form.setFieldValue("recordStatusName", getLabelName({ + list: EMERGENCY_PLAN_FILING_STATUS_ENUM, + status: value, + })); + }, + }, + }, + { name: "recordStatusName", label: "备案状态名称", onlyForLabel: true }, + { name: "recordTime", label: "备案时间", render: FORM_ITEM_RENDER_ENUM.DATE }, + { name: "recordReceivingUnit", label: "备案接收单位" }, + { name: "planSummary", label: "预案摘要", render: FORM_ITEM_RENDER_ENUM.TEXTAREA, span: 24 }, + { name: "remarks", label: "备注", render: FORM_ITEM_RENDER_ENUM.TEXTAREA, span: 24, required: false }, + { + name: "files", + label: "相关附件", + render: ( + { + form.setFieldValue("deleteFiles", [...(form.getFieldValue("deleteFiles") || []), file]); + }} + /> + ), + required: false, + span: 24, + }, + { name: "deleteFiles", label: "删除的附件", onlyForLabel: true }, + ]} + form={form} + onFinish={onSubmit} + /> + + ); +} + +export default Connect([NS_EMERGENCY_PLAN], true)(Add); diff --git a/src/pages/Container/Enterprise/PlanAndDrill/EmergencyPlan/List/index.js b/src/pages/Container/Enterprise/PlanAndDrill/EmergencyPlan/List/index.js new file mode 100644 index 0000000..b4220a8 --- /dev/null +++ b/src/pages/Container/Enterprise/PlanAndDrill/EmergencyPlan/List/index.js @@ -0,0 +1,138 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, message, Modal, Space } from "antd"; +import { useState } from "react"; +import AddIcon from "zy-react-library/components/Icon/AddIcon"; +import DeleteIcon from "zy-react-library/components/Icon/DeleteIcon"; +import Page from "zy-react-library/components/Page"; +import Search from "zy-react-library/components/Search"; +import Table from "zy-react-library/components/Table"; +import useTable from "zy-react-library/hooks/useTable"; +import { NS_EMERGENCY_PLAN } from "~/enumerate/namespace"; + +function List(props) { + const [selectedRowKeys, setSelectedRowKeys] = useState([]); + + const [form] = Search.useForm(); + + const { tableProps, getData } = useTable(props["emergencyPlanList"], { + form, + }); + + const onDelete = (record) => { + Modal.confirm({ + title: "删除确认", + content: `确定要删除【${record.planName}】吗`, + onOk: async () => { + const { success } = await props["emergencyPlanDelete"]({ id: record.id }); + if (success) { + message.success("删除成功"); + getData(); + } + }, + }); + }; + + const onDeleteBatch = () => { + if (selectedRowKeys.length === 0) { + message.warning("请选择要删除的记录"); + return; + } + Modal.confirm({ + title: "删除确认", + content: "确认要删除吗?", + onOk: async () => { + const { success } = await props["emergencyPlanDeleteBatch"]({ ids: selectedRowKeys }); + if (success) { + message.success("删除成功"); + getData(); + } + }, + }); + }; + + return ( + + + { + setSelectedRowKeys(selectedRowKeys); + }, + }} + toolBarRender={() => ( + + + + + )} + columns={[ + { title: "应急预案名称", dataIndex: "planName" }, + { title: "预案类别", dataIndex: "planCategoryName" }, + { title: "预案级别", dataIndex: "planTypeName" }, + { title: "备案状态", dataIndex: "recordStatusName" }, + { + title: "操作", + width: 150, + fixed: "right", + render: (_, record) => ( + + + + + + ), + }, + ]} + {...tableProps} + /> + + ); +} + +export default Connect([NS_EMERGENCY_PLAN], true)(List); diff --git a/src/pages/Container/Enterprise/PlanAndDrill/EmergencyPlan/View/index.js b/src/pages/Container/Enterprise/PlanAndDrill/EmergencyPlan/View/index.js new file mode 100644 index 0000000..f19024c --- /dev/null +++ b/src/pages/Container/Enterprise/PlanAndDrill/EmergencyPlan/View/index.js @@ -0,0 +1,86 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Descriptions, Spin } from "antd"; +import { useEffect, useState } from "react"; +import Page from "zy-react-library/components/Page"; +import PreviewImg from "zy-react-library/components/PreviewImg"; +import PreviewPdf from "zy-react-library/components/PreviewPdf"; +import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj"; +import useGetFile from "zy-react-library/hooks/useGetFile"; +import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; +import { getFileSuffix } from "zy-react-library/utils"; +import { NS_EMERGENCY_PLAN } from "~/enumerate/namespace"; + +function View(props) { + const query = useGetUrlQuery(); + const { loading: getFileLoading, getFile } = useGetFile(); + + const [info, setInfo] = useState({}); + + const getData = async () => { + const { data } = await props["emergencyPlanInfo"]({ id: query.id }); + const files = []; + if (data.fileId) { + const fileItems = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM[703], eqForeignKey: data.fileId }); + files.push(...fileItems); + } + setInfo({ + ...data, + files, + }); + }; + + useEffect(() => { + getData(); + }, []); + + const previewFile = (files = []) => { + const pdfFile = []; + const imgFile = []; + for (let i = 0; i < files.length; i++) { + const file = files[i]; + if (getFileSuffix(file.fileName) === "pdf") + pdfFile.push(file); + else + imgFile.push(file); + } + return ( + <> + + + + ); + }; + + return ( + + + + + + ); +} + +export default Connect([NS_EMERGENCY_PLAN], true)(View); diff --git a/src/pages/Container/Enterprise/PlanAndDrill/EmergencyPlan/index.js b/src/pages/Container/Enterprise/PlanAndDrill/EmergencyPlan/index.js new file mode 100644 index 0000000..dd22dfb --- /dev/null +++ b/src/pages/Container/Enterprise/PlanAndDrill/EmergencyPlan/index.js @@ -0,0 +1,5 @@ +function EmergencyPlan(props) { + return props.children; +} + +export default EmergencyPlan; diff --git a/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/BasicInfo/index.js b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/BasicInfo/index.js new file mode 100644 index 0000000..7f1a9a3 --- /dev/null +++ b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/BasicInfo/index.js @@ -0,0 +1,128 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { message } from "antd"; +import { useEffect, useState } from "react"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import Map from "zy-react-library/components/Map"; +import DictionarySelect from "zy-react-library/components/Select/Dictionary"; +import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; +import useDictionary from "zy-react-library/hooks/useDictionary"; +import { getLabelName } from "zy-react-library/utils"; +import { NS_ENTERPRISE_PLAN } from "~/enumerate/namespace"; + +function BasicInfo(props) { + const [form] = FormBuilder.useForm(); + + const { getDictionary } = useDictionary(); + + const [enterprisePlanEventType, setEnterprisePlanEventType] = useState([]); + + const getData = async () => { + if (!props.planId) + return; + + const { data } = await props["enterprisePlanBasicInfoInfo"]({ id: props.planId }); + form.setFieldsValue({ + ...data, + eventType: data.eventType ? data.eventType.split(",") : [], + eventTypeName: data.eventTypeName ? data.eventTypeName.split(",") : [], + }); + }; + + const getEnterprisePlanEventType = async () => { + const dictionaryItems = await getDictionary({ dictValue: "enterprisePlanEventType" }); + setEnterprisePlanEventType(dictionaryItems); + }; + + useEffect(() => { + getData(); + }, [props.planId]); + + useEffect(() => { + getEnterprisePlanEventType(); + }, []); + + const onSubmit = async (values) => { + const { success, data } = await props[!props.planId ? "enterprisePlanBasicInfoAdd" : "enterprisePlanBasicInfoUpdate"]({ + ...values, + eventType: values.eventType.join(","), + eventTypeName: values.eventTypeName.join(","), + }); + if (success) { + message.success("保存成功"); + props.setUrlState({ + planId: data?.id || props.planId, + planName: values.planName, + currentStep: "gradeResponse", + }); + } + }; + + return ( +
+ { + form.setFieldValue("planTypeName", label); + }} + /> + ), + }, + { name: "planTypeName", label: "预案类型名称", onlyForLabel: true }, + { name: "planCode", label: "预案编码" }, + { + name: "planLevel", + label: "预案等级", + render: ( + { + form.setFieldValue("planLevelName", label); + }} + /> + ), + }, + { name: "planLevelName", label: "预案等级名称", onlyForLabel: true }, + { + name: "eventType", + label: "事件类型", + span: 24, + render: FORM_ITEM_RENDER_ENUM.CHECKBOX, + items: enterprisePlanEventType, + itemsField: { valueKey: "dictValue", labelKey: "dictLabel" }, + componentProps: { + onChange: (value) => { + const eventTypeName = []; + for (let i = 0; i < value.length; i++) { + eventTypeName.push(getLabelName({ + list: enterprisePlanEventType, + status: value[i], + nameKey: "dictLabel", + idKey: "dictValue", + })); + } + form.setFieldValue("eventTypeName", eventTypeName); + }, + }, + }, + { name: "eventTypeName", label: "事件类型名称", onlyForLabel: true }, + { key: "map", customizeRender: true, span: 24, render: () }, + { name: "planOverview", label: "预案概述", span: 24, render: FORM_ITEM_RENDER_ENUM.TEXTAREA }, + { name: "remarks", label: "备注", span: 24, render: FORM_ITEM_RENDER_ENUM.TEXTAREA, required: false }, + ]} + form={form} + onFinish={onSubmit} + /> +
+ ); +} + +export default Connect([NS_ENTERPRISE_PLAN], true)(BasicInfo); diff --git a/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/GradeResponse/index.js b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/GradeResponse/index.js new file mode 100644 index 0000000..a859f9c --- /dev/null +++ b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/GradeResponse/index.js @@ -0,0 +1,161 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, message, Modal, Space } from "antd"; +import { useEffect, useState } from "react"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import AddIcon from "zy-react-library/components/Icon/AddIcon"; +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_ENTERPRISE_PLAN } from "~/enumerate/namespace"; + +function GradeResponse(props) { + const [addModalVisible, setAddModalVisible] = useState(false); + const [currentId, setCurrentId] = useState(""); + + const { tableProps, getData } = useTable(props["enterprisePlanLevelResponseList"], { + params: { + likePlanId: props.planId, + }, + useStorageQueryCriteria: false, + onSuccess: () => { + props.setResponseLevelRefresh(true); + }, + }); + + const onDelete = (id) => { + Modal.confirm({ + title: "删除确认", + content: "确定要删除吗?", + onOk: async () => { + const { success } = await props["enterprisePlanLevelResponseDelete"]({ id }); + if (success) { + message.success("删除成功"); + getData(); + } + }, + }); + }; + + return ( +
+
( + + )} + columns={[ + { title: "分级名称", dataIndex: "levelName" }, + { title: "分级描述", dataIndex: "levelDescription" }, + { title: "备注信息", dataIndex: "remarks" }, + { + title: "操作", + width: 150, + fixed: "right", + render: (_, record) => ( + + + + + ), + }, + ]} + options={false} + {...tableProps} + /> + { + addModalVisible && ( + { + setAddModalVisible(false); + setCurrentId(""); + }} + id={currentId} + planId={props.planId} + getData={getData} + /> + ) + } + + ); +} + +const AddModalComponent = (props) => { + const [form] = FormBuilder.useForm(); + + const getData = async () => { + if (!props.id) + return; + + const { data } = await props["enterprisePlanLevelResponseInfo"]({ id: props.id }); + form.setFieldsValue(data); + }; + + useEffect(() => { + getData(); + }, []); + + const onSubmit = async (values) => { + const { success } = await props[!props.id ? "enterprisePlanLevelResponseAdd" : "enterprisePlanLevelResponseUpdate"]({ + ...values, + id: props.id, + planId: props.planId, + }); + if (success) { + message.success("操作成功"); + props.onCancel(); + props.getData(); + } + }; + + return ( + + + + ); +}; + +const AddModal = Connect([NS_ENTERPRISE_PLAN], true)(AddModalComponent); +export default Connect([NS_ENTERPRISE_PLAN], true)(GradeResponse); diff --git a/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/OrganizationStructure/index.js b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/OrganizationStructure/index.js new file mode 100644 index 0000000..0e1f44a --- /dev/null +++ b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/OrganizationStructure/index.js @@ -0,0 +1,366 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, message, Modal, Space, Tag } from "antd"; +import { useEffect, useState } from "react"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import AddIcon from "zy-react-library/components/Icon/AddIcon"; +import DeleteIcon from "zy-react-library/components/Icon/DeleteIcon"; +import EditIcon from "zy-react-library/components/Icon/EditIcon"; +import BasicLeftTree from "zy-react-library/components/LeftTree/Basic"; +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 { PHONE } from "zy-react-library/regular"; +import { NS_ENTERPRISE_PLAN } from "~/enumerate/namespace"; + +const defaultParentId = 0; +const defaultParentName = "(无)此项为顶级分组"; +const addModalTypeNames = { + add: "新增", + update: "编辑", + addChild: "添加下级", +}; + +function OrganizationStructure(props) { + const [treeList, setTreeList] = useState([]); + + const [parentId, setParentId] = useState(defaultParentId); + const [parentName, setParentName] = useState(defaultParentName); + const [currentOrganization, setCurrentOrganization] = useState({}); + const [currentOrganizationId, setCurrentOrganizationId] = useState(""); + const [addOrganizationModalVisible, setAddOrganizationModalVisible] = useState(false); + const [addOrganizationModalType, setAddOrganizationModalType] = useState(""); + + const [currentOrganizationPersonnelId, setCurrentOrganizationPersonnelId] = useState(""); + const [addOrganizationPersonnelModalVisible, setAddOrganizationPersonnelModalVisible] = useState(false); + + const { tableProps, getData } = useTable(props["enterprisePlanOrganizationPersonnelList"], { + params: { planId: props.planId, organizationId: currentOrganization.id }, + useStorageQueryCriteria: false, + manual: true, + }); + + const getTreeList = async () => { + const { data } = await props["enterprisePlanLevelOrganizationListTree"]({ planId: props.planId }); + setTreeList(data); + props.setExecutingAgencyRefresh(true); + }; + + useEffect(() => { + getTreeList(); + }, []); + + const onDeleteOrganization = () => { + Modal.confirm({ + title: "删除确认", + content: "确定要删除该组织吗?", + onOk: async () => { + const { success } = await props["enterprisePlanLevelOrganizationDelete"]({ id: currentOrganization.id }); + if (success) { + message.success("删除成功"); + getTreeList(); + setCurrentOrganization({}); + } + }, + }); + }; + + const onDeleteOrganizationPersonnel = (id) => { + Modal.confirm({ + title: "删除确认", + content: "确定要删除该人员吗?", + onOk: async () => { + const { success } = await props["enterprisePlanOrganizationPersonnelDelete"]({ id }); + if (success) { + message.success("删除成功"); + getData(); + } + }, + }); + }; + + return ( +
+
+
+ + + + + + + { + const currentNode = nodes.at(-1); + setCurrentOrganization(currentNode); + getData(); + }} + /> +
+
+
( + + )} + options={false} + columns={[ + { title: "姓名", dataIndex: "userName" }, + { title: "职务", dataIndex: "position" }, + { title: "组内岗位", dataIndex: "groupPost" }, + { title: "联系电话", dataIndex: "contactPhone" }, + { title: "紧急联系电话", dataIndex: "emergencyContactPhone" }, + { + title: "操作", + width: 150, + fixed: "right", + render: (_, record) => ( + + + + + ), + }, + ]} + {...tableProps} + /> + + + { + addOrganizationModalVisible && ( + { + setAddOrganizationModalVisible(false); + setParentId(defaultParentId); + setParentName(defaultParentName); + setCurrentOrganizationId(""); + setAddOrganizationModalType(""); + }} + id={currentOrganizationId} + planId={props.planId} + getData={getTreeList} + parentId={parentId} + parentName={parentName} + addModalType={addOrganizationModalType} + /> + ) + } + { + addOrganizationPersonnelModalVisible && ( + { + setAddOrganizationPersonnelModalVisible(false); + setCurrentOrganizationPersonnelId(""); + }} + id={currentOrganizationPersonnelId} + organizationId={currentOrganization.id} + organizationName={currentOrganization.orgName} + planId={props.planId} + getData={getData} + /> + ) + } + + ); +} + +const AddOrganizationModalComponent = (props) => { + const [form] = FormBuilder.useForm(); + + const getData = async () => { + if (!props.id) + return; + + const { data } = await props["enterprisePlanLevelOrganizationInfo"]({ id: props.id }); + form.setFieldsValue(data); + }; + + useEffect(() => { + getData(); + }, []); + + const onSubmit = async (values) => { + const { success } = await props[!props.id ? "enterprisePlanLevelOrganizationAdd" : "enterprisePlanLevelOrganizationUpdate"]({ + ...values, + id: props.id, + planId: props.planId, + parentId: props.parentId, + parentName: props.parentName, + }); + if (success) { + message.success(`${addModalTypeNames[props.addModalType]}成功`); + props.onCancel(); + props.getData(); + } + }; + + return ( + + {props.addModalType === "add" ? defaultParentName : props.parentName}), + }, + { name: "orgName", label: "名称" }, + { name: "orgNameEn", label: "英文名称" }, + { name: "orgCode", label: "编码" }, + { name: "leaderName", label: "负责人" }, + { name: "contactPhone", label: "联系电话", rules: [{ pattern: PHONE, message: "请输入正确的电话号码" }] }, + { name: "departmentFunction", label: "部门职能", required: false }, + { name: "address", label: "地址", required: false }, + { name: "remarks", label: "备注", required: false, render: FORM_ITEM_RENDER_ENUM.TEXTAREA }, + ]} + form={form} + onFinish={onSubmit} + /> + + ); +}; + +const AddOrganizationPersonnelModalComponent = (props) => { + const [form] = FormBuilder.useForm(); + + const getData = async () => { + if (!props.id) + return; + + const { data } = await props["enterprisePlanOrganizationPersonnelInfo"]({ id: props.id }); + form.setFieldsValue(data); + }; + + useEffect(() => { + getData(); + }, []); + + const onSubmit = async (values) => { + const { success } = await props[!props.id ? "enterprisePlanOrganizationPersonnelAdd" : "enterprisePlanOrganizationPersonnelUpdate"]({ + ...values, + id: props.id, + planId: props.planId, + organizationId: props.organizationId, + }); + if (success) { + message.success(`${props.id ? "编辑" : "添加"}成功`); + props.onCancel(); + props.getData(); + } + }; + + return ( + + {props.organizationName}), + }, + { name: "userName", label: "姓名" }, + { name: "position", label: "职务" }, + { name: "groupPost", label: "组内岗位", required: false }, + { name: "contactPhone", label: "联系电话", rules: [{ pattern: PHONE, message: "请输入正确的电话号码" }] }, + { name: "emergencyContactPhone", label: "紧急联系电话", rules: [{ pattern: PHONE, message: "请输入正确的电话号码" }] }, + ]} + form={form} + onFinish={onSubmit} + /> + + ); +}; + +const AddOrganizationModal = Connect([NS_ENTERPRISE_PLAN], true)(AddOrganizationModalComponent); +const AddOrganizationPersonnelModal = Connect([NS_ENTERPRISE_PLAN], true)(AddOrganizationPersonnelModalComponent); +export default Connect([NS_ENTERPRISE_PLAN], true)(OrganizationStructure); diff --git a/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/PlanAttachments/index.js b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/PlanAttachments/index.js new file mode 100644 index 0000000..8cfe245 --- /dev/null +++ b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/PlanAttachments/index.js @@ -0,0 +1,226 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, message, Modal, Space } from "antd"; +import dayjs from "dayjs"; +import { useEffect, useRef, useState } from "react"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import AddIcon from "zy-react-library/components/Icon/AddIcon"; +import DictionarySelect from "zy-react-library/components/Select/Dictionary"; +import Table from "zy-react-library/components/Table"; +import Upload from "zy-react-library/components/Upload"; +import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj"; +import useDeleteFile from "zy-react-library/hooks/useDeleteFile"; +import useDownloadFile from "zy-react-library/hooks/useDownloadFile"; +import useGetFile from "zy-react-library/hooks/useGetFile"; +import useTable from "zy-react-library/hooks/useTable"; +import useUploadFile from "zy-react-library/hooks/useUploadFile"; +import { NS_ENTERPRISE_PLAN } from "~/enumerate/namespace"; + +function PlanAttachments(props) { + const { loading: getFileLoading, getFile } = useGetFile(); + const { loading: downloadFileLoading, downloadFile } = useDownloadFile(); + + const [addModalVisible, setAddModalVisible] = useState(false); + const [currentId, setCurrentId] = useState(""); + + const { tableProps, getData } = useTable(props["enterprisePlanAttachmentList"], { + params: { + likePlanId: props.planId, + }, + useStorageQueryCriteria: false, + }); + + const onDelete = (id) => { + Modal.confirm({ + title: "删除确认", + content: "确定要删除吗?", + onOk: async () => { + const { success } = await props["enterprisePlanAttachmentDelete"]({ id }); + if (success) { + message.success("删除成功"); + getData(); + } + }, + }); + }; + + return ( +
+
( + + )} + options={false} + columns={[ + { title: "文件名称", dataIndex: "fileName" }, + { title: "附件类型", dataIndex: "attachmentTypeName" }, + { title: "备注", dataIndex: "remarks" }, + { + title: "维护日期", + dataIndex: "createTime", + render: (_, record) => dayjs(record.updateTime || record.createTime).format("YYYY-MM-DD HH:mm:ss"), + }, + { + title: "操作", + width: 150, + fixed: "right", + render: (_, record) => ( + + + + + + ), + }, + ]} + {...tableProps} + loading={tableProps.loading || getFileLoading || downloadFileLoading} + /> + { + addModalVisible && ( + { + setAddModalVisible(false); + setCurrentId(""); + }} + id={currentId} + planId={props.planId} + getData={getData} + /> + ) + } + + ); +} + +const AddModalComponent = (props) => { + const [form] = FormBuilder.useForm(); + const { loading: getFileLoading, getFile } = useGetFile(); + const { loading: deleteFileLoading, deleteFile } = useDeleteFile(); + const { loading: uploadFileLoading, uploadFile } = useUploadFile(); + + const fileIdRef = useRef(""); + + const getData = async () => { + if (!props.id) + return; + + const { data } = await props["enterprisePlanAttachmentInfo"]({ id: props.id }); + fileIdRef.current = data.fileId; + const files = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM[702], eqForeignKey: data.fileId }); + form.setFieldsValue({ + ...data, + files, + }); + }; + + useEffect(() => { + getData(); + }, []); + + const onSubmit = async (values) => { + await deleteFile({ single: false, files: values.deleteFiles }); + const { id: fileId } = await uploadFile({ + single: false, + files: values.files, + params: { type: UPLOAD_FILE_TYPE_ENUM[702], foreignKey: fileIdRef.current }, + }); + const { success } = await props[!props.id ? "enterprisePlanAttachmentAdd" : "enterprisePlanAttachmentUpdate"]({ + ...values, + fileId, + id: props.id, + planId: props.planId, + }); + if (success) { + message.success("操作成功"); + props.onCancel(); + props.getData(); + } + }; + + return ( + + { + form.setFieldValue("attachmentTypeName", label); + }} + /> + ), + }, + { name: "attachmentTypeName", label: "附件类型名称", onlyForLabel: true }, + { name: "remarks", label: "备注", required: false }, + { + name: "files", + label: "附件", + render: ( + { + form.setFieldValue("deleteFiles", [...(form.getFieldValue("deleteFiles") || []), file]); + }} + /> + ), + }, + { name: "deleteFiles", label: "删除的附件", onlyForLabel: true }, + ]} + form={form} + onFinish={onSubmit} + /> + + ); +}; + +const AddModal = Connect([NS_ENTERPRISE_PLAN], true)(AddModalComponent); +export default Connect([NS_ENTERPRISE_PLAN], true)(PlanAttachments); diff --git a/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/PlanInstructions/index.js b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/PlanInstructions/index.js new file mode 100644 index 0000000..672dcdc --- /dev/null +++ b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/PlanInstructions/index.js @@ -0,0 +1,206 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, Divider, message, Modal, Space } from "antd"; +import { useEffect, useRef, useState } from "react"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import BasicSelectTree from "zy-react-library/components/SelectTree/Basic"; +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 { getLabelName } from "zy-react-library/utils"; +import { NS_ENTERPRISE_PLAN } from "~/enumerate/namespace"; + +function PlanInstructions(props) { + const [form] = FormBuilder.useForm(); + + const [responseLevelList, setResponseLevelList] = useState([]); + const [executingAgencyListTree, setExecutingAgencyListTree] = useState([]); + const isEditCommandIdRef = useRef(""); + + const { tableProps, getData } = useTable(props["enterprisePlanCommandSettingList"], { + params: { + likePlanId: props.planId, + }, + useStorageQueryCriteria: false, + }); + + const getResponseLevelList = async () => { + if (!props.responseLevelRefresh) + return; + + const { data } = await props["enterprisePlanLevelResponseListAll"]({ planId: props.planId }); + setResponseLevelList(data); + props.setResponseLevelRefresh(false); + }; + + const getTreeList = async () => { + if (!props.executingAgencyRefresh) + return; + + const { data } = await props["enterprisePlanLevelOrganizationListTree"]({ planId: props.planId }); + setExecutingAgencyListTree(data); + props.setExecutingAgencyRefresh(false); + }; + + useEffect(() => { + getTreeList(); + }, [props.executingAgencyRefresh]); + + useEffect(() => { + getResponseLevelList(); + }, [props.responseLevelRefresh]); + + const onSubmit = async (values) => { + const { success } = await props[!isEditCommandIdRef.current ? "enterprisePlanCommandSettingAdd" : "enterprisePlanCommandSettingUpdate"]({ + ...values, + responseLevel: values.responseLevel.join(","), + responseLevelName: values.responseLevelName.join(","), + executingAgencyId: values.executingAgencyId.join(","), + executingAgencyName: values.executingAgencyName.join(","), + planId: props.planId, + id: isEditCommandIdRef.current, + }); + if (success) { + message.success(`${isEditCommandIdRef.current ? "编辑" : "添加"}成功`); + form.resetFields(); + getData(); + isEditCommandIdRef.current = ""; + } + }; + + const onDelete = (id) => { + Modal.confirm({ + title: "删除指令", + content: "确定要删除该指令吗?", + onOk: async () => { + const { success } = await props["enterprisePlanCommandSettingDelete"]({ id }); + if (success) { + message.success("删除成功"); + form.resetFields(); + getData(); + isEditCommandIdRef.current = ""; + } + }, + }); + }; + + return ( +
+
+ { + const responseLevelName = []; + for (let i = 0; i < values.length; i++) { + responseLevelName.push(getLabelName({ + list: responseLevelList, + status: values[i], + idKey: "id", + nameKey: "levelName", + })); + } + form.setFieldValue("responseLevelName", responseLevelName); + }, + }, + }, + { name: "responseLevelName", label: "响应级别名称", onlyForLabel: true }, + { name: "commandContent", label: "指令内容", render: FORM_ITEM_RENDER_ENUM.TEXTAREA }, + { + name: "executingAgencyId", + label: "执行机构", + render: ( + { + form.setFieldValue("executingAgencyName", label); + }} + /> + ), + }, + { name: "executingAgencyName", label: "执行机构名称", onlyForLabel: true }, + ]} + form={form} + onFinish={onSubmit} + /> + + + + +
+
+ 指令列表 +
( + + + + + ), + }, + ]} + {...tableProps} + /> + + + ); +} + +export default Connect([NS_ENTERPRISE_PLAN], true)(PlanInstructions); diff --git a/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/PlanResources/index.js b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/PlanResources/index.js new file mode 100644 index 0000000..fce8af0 --- /dev/null +++ b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/PlanResources/index.js @@ -0,0 +1,237 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, Descriptions, message, Modal, Space } from "antd"; +import { useEffect, useState } from "react"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import AddIcon from "zy-react-library/components/Icon/AddIcon"; +import Map from "zy-react-library/components/Map"; +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 { PHONE } from "zy-react-library/regular"; +import { NS_ENTERPRISE_PLAN } from "~/enumerate/namespace"; + +function GradeResponse(props) { + const [addModalVisible, setAddModalVisible] = useState(false); + const [viewModalVisible, setViewModalVisible] = useState(false); + const [currentId, setCurrentId] = useState(""); + + const { tableProps, getData } = useTable(props["enterprisePlanResourceList"], { + params: { + likePlanId: props.planId, + }, + useStorageQueryCriteria: false, + }); + + const onDelete = (id) => { + Modal.confirm({ + title: "删除确认", + content: "确定要删除吗?", + onOk: async () => { + const { success } = await props["enterprisePlanResourceDelete"]({ id }); + if (success) { + message.success("删除成功"); + getData(); + } + }, + }); + }; + + return ( +
+
( + + )} + columns={[ + { title: "资源类型", dataIndex: "resourceType" }, + { title: "资源名称", dataIndex: "resourceName" }, + { title: "资源地址", dataIndex: "resourceAddress" }, + { title: "资源数量", dataIndex: "resourceQuantity" }, + { title: "联系人", dataIndex: "contactPerson" }, + { title: "电话", dataIndex: "contactPhone" }, + { + title: "操作", + width: 150, + fixed: "right", + render: (_, record) => ( + + + + + + ), + }, + ]} + options={false} + {...tableProps} + /> + { + addModalVisible && ( + { + setAddModalVisible(false); + setCurrentId(""); + }} + id={currentId} + planId={props.planId} + getData={getData} + /> + ) + } + { + viewModalVisible && ( + { + setViewModalVisible(false); + setCurrentId(""); + }} + id={currentId} + /> + ) + } + + ); +} + +const AddModalComponent = (props) => { + const [form] = FormBuilder.useForm(); + + const getData = async () => { + if (!props.id) + return; + + const { data } = await props["enterprisePlanResourceInfo"]({ id: props.id }); + form.setFieldsValue(data); + }; + + useEffect(() => { + getData(); + }, []); + + const onSubmit = async (values) => { + const { success } = await props[!props.id ? "enterprisePlanResourceAdd" : "enterprisePlanResourceUpdate"]({ + ...values, + id: props.id, + planId: props.planId, + }); + if (success) { + message.success("操作成功"); + props.onCancel(); + props.getData(); + } + }; + + return ( + + ) }, + ]} + form={form} + onFinish={onSubmit} + /> + + ); +}; + +const ViewModalComponent = (props) => { + const [info, setInfo] = useState({}); + + const getData = async () => { + const { data } = await props["enterprisePlanResourceInfo"]({ id: props.id }); + setInfo(data); + }; + + useEffect(() => { + getData(); + }, []); + + return ( + 取消, + ]} + loading={props.enterprisePlan.enterprisePlanResourceLoading} + > + + + ); +}; + +const AddModal = Connect([NS_ENTERPRISE_PLAN], true)(AddModalComponent); +const ViewModal = Connect([NS_ENTERPRISE_PLAN], true)(ViewModalComponent); +export default Connect([NS_ENTERPRISE_PLAN], true)(GradeResponse); diff --git a/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/PlanText/index.js b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/PlanText/index.js new file mode 100644 index 0000000..c848bb1 --- /dev/null +++ b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/components/PlanText/index.js @@ -0,0 +1,38 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { message } from "antd"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; +import { NS_ENTERPRISE_PLAN } from "~/enumerate/namespace"; + +function PlanText(props) { + const [form] = FormBuilder.useForm(); + + const onSubmit = async (values) => { + const { success } = await props["enterprisePlanBasicInfoUpdate"]({ + ...values, + id: props.planId, + }); + if (success) { + message.success("保存成功"); + props.setUrlState({ currentStep: "planAttachments" }); + } + }; + + return ( + + ); +} + +export default Connect([NS_ENTERPRISE_PLAN], true)(PlanText); diff --git a/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/index.js b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/index.js new file mode 100644 index 0000000..1117d2d --- /dev/null +++ b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/Add/index.js @@ -0,0 +1,245 @@ +import useUrlState from "@ahooksjs/use-url-state"; +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, message, Modal, Space, Tabs } from "antd"; +import { useEffect, useState } from "react"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import Page from "zy-react-library/components/Page"; +import PersonnelSelect from "zy-react-library/components/Select/Personnel/Gwj"; +import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; +import useGetUserInfo from "zy-react-library/hooks/useGetUserInfo"; +import { NS_ENTERPRISE_PLAN } from "~/enumerate/namespace"; +import BasicInfo from "./components/BasicInfo"; +import GradeResponse from "./components/GradeResponse"; +import OrganizationStructure from "./components/OrganizationStructure"; +import PlanAttachments from "./components/PlanAttachments"; +import PlanInstructions from "./components/PlanInstructions"; +import PlanResources from "./components/PlanResources"; +import PlanText from "./components/PlanText"; + +function Add(props) { + const query = useGetUrlQuery(); + const [urlState, setUrlState] = useUrlState( + { + currentStep: "basicInfo", + planId: query.id, + planName: query.planName, + }, + { navigateMode: "replace" }, + ); + + const [responseLevelRefresh, setResponseLevelRefresh] = useState(true); + const [executingAgencyRefresh, setExecutingAgencyRefresh] = useState(true); + const [reviewPersonModalVisible, setReviewPersonModalVisible] = useState(false); + + const subordinateTabDisabled = !urlState.planId; + const isShowFooter = ["basicInfo", "planText"].includes(urlState.currentStep); + + const previousStep = () => { + const stepMapping = { + gradeResponse: "basicInfo", + organizationStructure: "gradeResponse", + planResources: "organizationStructure", + planInstructions: "planResources", + planText: "planInstructions", + planAttachments: "planText", + }; + + const prevStep = stepMapping[urlState.currentStep]; + if (prevStep) + setUrlState({ currentStep: prevStep }); + }; + + const nextStep = () => { + const stepFlow = { + gradeResponse: "organizationStructure", + organizationStructure: "planResources", + planResources: "planInstructions", + planInstructions: "planText", + }; + + if (urlState.currentStep === "planText") { + return; + } + + if (urlState.currentStep === "planAttachments") { + setReviewPersonModalVisible(true); + return; + } + + const nextStep = stepFlow[urlState.currentStep]; + if (nextStep) { + setUrlState({ currentStep: nextStep }); + } + }; + + return ( + + + + + )} + > + setUrlState({ currentStep: key })} + items={[ + { + key: "basicInfo", + label: "基本信息", + children: ( + + ), + }, + { + key: "gradeResponse", + label: "分级响应", + children: ( + + ), + disabled: subordinateTabDisabled, + }, + { + key: "organizationStructure", + label: "组织结构", + children: ( + + ), + disabled: subordinateTabDisabled, + }, + { + key: "planResources", + label: "预案资源", + children: (), + disabled: subordinateTabDisabled, + }, + { + key: "planInstructions", + label: "预案指令", + children: ( + + ), + disabled: subordinateTabDisabled, + }, + { + key: "planText", + label: "预案文案", + children: ( + + ), + disabled: subordinateTabDisabled, + }, + { + key: "planAttachments", + label: "预案附件", + children: (), + disabled: subordinateTabDisabled, + }, + ]} + /> + { + reviewPersonModalVisible && ( + setReviewPersonModalVisible(false)} + planId={urlState.planId} + goBack={props.history.goBack} + /> + ) + } + + ); +} + +const ReviewPersonModalComponent = (props) => { + const [form] = FormBuilder.useForm(); + + const [userInfo, setUserInfo] = useState({}); + + const { getUserInfo } = useGetUserInfo(); + + useEffect(() => { + (async () => { + const userInfo = await getUserInfo(); + setUserInfo(userInfo); + })(); + }, []); + + const onSubmit = async (values) => { + const { success } = await props["enterprisePlanBasicInfoUpdate"]({ + ...values, + id: props.planId, + }); + if (success) { + message.success("保存成功"); + props.onCancel(); + props.goBack(); + } + }; + + return ( + + { + form.setFieldValue("auditUserName", option.name); + form.setFieldValue("auditCorpId", option.corpinfoId); + form.setFieldValue("auditCorpName", option.corpinfoName); + form.setFieldValue("auditDeptId", option.departmentId); + form.setFieldValue("auditDeptName", option.departmentName); + }} + /> + ) }, + { name: "auditUserName", label: "审核人员名称", onlyForLabel: true }, + { name: "auditCorpId", label: "审核人企业ID", onlyForLabel: true }, + { name: "auditCorpName", label: "审核人企业名称", onlyForLabel: true }, + { name: "auditDeptId", label: "审核人部门ID", onlyForLabel: true }, + { name: "auditDeptName", label: "审核人部门名称", onlyForLabel: true }, + ]} + form={form} + onFinish={onSubmit} + /> + + ); +}; + +const ReviewPersonModal = Connect([NS_ENTERPRISE_PLAN], true)(ReviewPersonModalComponent); +export default Add; diff --git a/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/List/index.js b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/List/index.js index d6ce256..8741878 100644 --- a/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/List/index.js +++ b/src/pages/Container/Enterprise/PlanAndDrill/EnterprisePlan/List/index.js @@ -1,9 +1,111 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, message, Modal, Space } from "antd"; +import AddIcon from "zy-react-library/components/Icon/AddIcon"; import Page from "zy-react-library/components/Page"; +import Search from "zy-react-library/components/Search"; +import Table from "zy-react-library/components/Table"; +import useTable from "zy-react-library/hooks/useTable"; +import { getLabelName } from "zy-react-library/utils"; +import { ENTERPRISE_PLAN_AUDIT_STATUS_ENUM } from "~/enumerate/constant"; +import { NS_ENTERPRISE_PLAN } from "~/enumerate/namespace"; function List(props) { + const [form] = Search.useForm(); + + const { tableProps, getData } = useTable(props["enterprisePlanBasicInfoList"], { + form, + }); + + const onDelete = (record) => { + Modal.confirm({ + title: "删除确认", + content: `确定要删除【${record.planName}】吗`, + onOk: async () => { + const { success } = await props["enterprisePlanBasicInfoDelete"]({ id: record.id }); + if (success) { + message.success("删除成功"); + getData(); + } + }, + }); + }; + return ( - + + +
( + + + + )} + columns={[ + { title: "预案名称", dataIndex: "planName" }, + { title: "预案编码", dataIndex: "planCode" }, + { title: "审核人", dataIndex: "auditUserName" }, + { title: "预案概述", dataIndex: "planOverview" }, + { + title: "审核状态", + dataIndex: "auditFlag", + render: (_, record) => getLabelName({ list: ENTERPRISE_PLAN_AUDIT_STATUS_ENUM, status: record.auditFlag }) || "暂存", + }, + { + title: "操作", + width: 150, + fixed: "right", + render: (_, record) => ( + + + {(!record.auditFlag || record.auditFlag !== 3) && ( + + )} + {(!record.auditFlag || record.auditFlag !== 3) && ( + + )} + + ), + }, + ]} + {...tableProps} + /> + ); } -export default List; +export default Connect([NS_ENTERPRISE_PLAN], true)(List);