From 4ee2018f1689d9bda4b57bf56bcc8f2a4c98b291 Mon Sep 17 00:00:00 2001 From: LiuJiaNan Date: Sat, 3 Feb 2024 14:07:23 +0800 Subject: [PATCH] init --- .env | 2 +- src/components/hazard_type/index.vue | 34 +++ src/components/hidden_view/index.vue | 8 +- src/components/sign/index.vue | 2 +- src/request/api.js | 1 + .../safety_environmental_management.js | 10 +- .../checklist_inspection_status/index.vue | 28 +-- .../safety_environmental/add.vue | 191 ++++++++++++++-- .../components/flow_chart.vue | 25 ++- .../components/hidden_add.vue | 166 ++++++++++++++ .../components/view_hidden.vue | 30 +++ .../safety_environmental/index.vue | 1 + .../safety_environmental/view.vue | 204 +++++++++++++++++- 13 files changed, 660 insertions(+), 42 deletions(-) create mode 100644 src/views/safety_environmental_management/safety_environmental/components/hidden_add.vue create mode 100644 src/views/safety_environmental_management/safety_environmental/components/view_hidden.vue diff --git a/.env b/.env index 31d0565..fa793de 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ -VITE_BASE_URL=http://192.168.0.17:8001/ +VITE_BASE_URL=http://192.168.0.42:8099/ VITE_PROXY=/api/ VITE_FILE_URL=https://file.zcloudchina.com/YTHFile VITE_TEMPLATE_URL=https://qaaq.qhdsafety.com/file/ diff --git a/src/components/hazard_type/index.vue b/src/components/hazard_type/index.vue index 2e2dca5..64e8eb3 100644 --- a/src/components/hazard_type/index.vue +++ b/src/components/hazard_type/index.vue @@ -1,5 +1,6 @@ diff --git a/src/components/hidden_view/index.vue b/src/components/hidden_view/index.vue index 33e34f2..95539ba 100644 --- a/src/components/hidden_view/index.vue +++ b/src/components/hidden_view/index.vue @@ -6,6 +6,8 @@ 隐患快报 隐患排查 隐患排查 + 安全环保检查 + 安全环保检查 diff --git a/src/components/sign/index.vue b/src/components/sign/index.vue index 2f3586c..c7f341b 100644 --- a/src/components/sign/index.vue +++ b/src/components/sign/index.vue @@ -14,7 +14,7 @@ :height="300" :is-crop="false" :line-width="6" - line-color="#fff" + line-color="#000" /> - + @@ -196,8 +243,51 @@ import LayoutDepartment from "@/components/department/index.vue"; import LayoutSign from "@/components/sign/index.vue"; import { getUserListAll } from "@/request/data_dictionary.js"; import LayoutInspectionType from "@/components/inspection_type/index.vue"; +import HiddenAdd from "./components/hidden_add.vue"; +import { useUserStore } from "@/pinia/user.js"; +import { debounce } from "throttle-debounce"; +import useFormValidate from "@/assets/js/useFormValidate.js"; +import { ElMessage } from "element-plus"; +import { useRouter } from "vue-router"; +import { setSafetyEnvironmentalAdd } from "@/request/safety_environmental_management.js"; +import { setUploadImg, setUploadVideo } from "@/request/api.js"; +import dayjs from "dayjs"; -const rules = {}; +const router = useRouter(); +const userStore = useUserStore(); +const rules = { + INSPECTION_SUBJECT: [ + { required: true, message: "请选择检查题目", trigger: "change" }, + ], + INSPECTED_DEPARTMENT_ID: [ + { required: true, message: "请选择被检查单位", trigger: "change" }, + ], + INSPECTED_SITEUSER_ID: [ + { + required: true, + message: "请选择被检查单位现场负责人", + trigger: "change", + }, + ], + INSPECTION_PLACE: [ + { required: true, message: "请输入检查场所", trigger: "blur" }, + ], + CONFIRM_MESSAGE: [ + { required: true, message: "请输入检查人意见", trigger: "blur" }, + ], + CONFIRM_MESSAGE_SIGN: [ + { required: true, message: "请上传检查人签名", trigger: "change" }, + ], + INSPECTION_TYPE: [ + { required: true, message: "请选择检查类型", trigger: "change" }, + ], + INSPECTION_TIME_START: [ + { required: true, message: "请选择检查开始时间", trigger: "change" }, + ], + INSPECTION_TIME_END: [ + { required: true, message: "请选择检查结束时间", trigger: "change" }, + ], +}; const formRef = ref(null); const data = reactive({ form: { @@ -205,8 +295,8 @@ const data = reactive({ INSPECTED_DEPARTMENT_ID: "", INSPECTED_SITEUSER_ID: "", INSPECTION_PLACE: "", - INSPECTION_USER_OPINION: "", - INSPECTION_USER_SIGN_IMG: "", + CONFIRM_MESSAGE: "", + CONFIRM_MESSAGE_SIGN: "", INSPECTION_TYPE: "", INSPECTION_TIME_START: "", INSPECTION_TIME_END: "", @@ -215,6 +305,10 @@ const data = reactive({ hiddenList: [], }, inspectedSiteUserList: [], + addHiddenDialog: { + visible: false, + hazardDiscovererList: [], + }, }); const fnAddInspectorList = () => { data.form.inspectorList.push({ @@ -233,12 +327,12 @@ const fnAddSituationList = () => { }; fnAddSituationList(); const fnInspectedDepartmentChange = () => { - data.inspectedSiteUserList.value = []; + data.inspectedSiteUserList = []; data.form.INSPECTED_SITEUSER_ID = ""; }; const fnGetInspectedSitUserList = async (DEPARTMENT_ID) => { const { userList } = await getUserListAll({ DEPARTMENT_ID }); - data.inspectedSiteUserList.value = userList; + data.inspectedSiteUserList = userList; }; const fnInspectionDepartmentChange = (value, index) => { data.form.inspectorList[index].INSPECTION_USER_ID = ""; @@ -246,13 +340,82 @@ const fnInspectionDepartmentChange = (value, index) => { fnGetInspectionSitUserList(value, index); }; const fnGetInspectionSitUserList = async (DEPARTMENT_ID, index) => { - const { userList } = await getUserListAll({ DEPARTMENT_ID }); + const { userList } = await getUserListAll({ DEPARTMENT_ID, NOMAIN: "1" }); data.form.inspectorList[index].inspectionUserList = userList; }; watchEffect(() => { if (data.form.INSPECTED_DEPARTMENT_ID) fnGetInspectedSitUserList(data.form.INSPECTED_DEPARTMENT_ID); }); +const fnAddHidden = () => { + data.addHiddenDialog.visible = true; + data.addHiddenDialog.hazardDiscovererList = [ + { + NAME: userStore.getUserInfo.NAME, + USER_ID: userStore.getUserInfo.USER_ID, + }, + ]; + const inspectorList = data.form.inspectorList; + for (let i = 0; i < inspectorList.length; i++) { + const inspectionUserList = inspectorList[i].inspectionUserList; + for (let j = 0; j < inspectionUserList.length; j++) { + if ( + inspectorList[i].INSPECTION_USER_ID === inspectionUserList[j].USER_ID + ) { + data.addHiddenDialog.hazardDiscovererList.push(inspectionUserList[j]); + break; + } + } + } +}; +const fnAddHiddenSubmit = (item) => { + data.form.hiddenList.push(item); +}; +const fnSubmit = debounce( + 1000, + async () => { + await useFormValidate(formRef); + const resData = await setSafetyEnvironmentalAdd({ + ...data.form, + INSPECTORJSON: JSON.stringify(data.form.inspectorList), + SITUATIONJSON: JSON.stringify(data.form.situationList), + HIDDENJSON: JSON.stringify(data.form.hiddenList), + CONFIRM_MESSAGE_TIME: dayjs().format("YYYY-MM-DD HH:mm"), + }); + const hiddenList = resData.pd.hiddenList; + for (let i = 0; i < hiddenList.length; i++) { + await fnUploadImage( + hiddenList[i].HIDDEN_ID, + data.form.hiddenList[i].hiddenImgs + ); + await fnUploadVideo( + hiddenList[i].HIDDEN_ID, + data.form.hiddenList[i].videoFiles + ); + } + ElMessage.success("提交成功"); + router.back(); + }, + { atBegin: true } +); +const fnUploadImage = async (HIDDEN_ID, files) => { + const formData = new FormData(); + for (let i = 0; i < files.length; i++) { + formData.append("FFILE", files[i]); + } + formData.append("FOREIGN_KEY", HIDDEN_ID); + formData.append("TYPE", 3); + await setUploadImg(formData); +}; +const fnUploadVideo = async (HIDDEN_ID, files) => { + const formData = new FormData(); + for (let i = 0; i < files.length; i++) { + formData.append("FFILE", files[i]); + } + formData.append("FOREIGN_KEY", HIDDEN_ID); + formData.append("TYPE", 102); + await setUploadVideo(formData); +}; diff --git a/src/views/safety_environmental_management/safety_environmental/components/flow_chart.vue b/src/views/safety_environmental_management/safety_environmental/components/flow_chart.vue index 13cc7ac..6a0cdbf 100644 --- a/src/views/safety_environmental_management/safety_environmental/components/flow_chart.vue +++ b/src/views/safety_environmental_management/safety_environmental/components/flow_chart.vue @@ -10,7 +10,10 @@ import { useVModel } from "@vueuse/core"; import RelationGraph from "relation-graph/vue3"; import { ref, watchEffect } from "vue"; -import { getSafetyEnvironmentalFlowChart } from "@/request/safety_environmental_management.js"; +import { + getSafetyEnvironmentalListFlowChart, + getSafetyEnvironmentalViewFlowChart, +} from "@/request/safety_environmental_management.js"; const props = defineProps({ visible: { @@ -23,6 +26,11 @@ const props = defineProps({ required: true, default: "", }, + type: { + type: String, + required: true, + default: "", + }, }); const emits = defineEmits(["update:visible"]); const visible = useVModel(props, "visible", emits); @@ -63,10 +71,17 @@ const graphOptions = ref({ defaultNodeWidth: 200, }); const fnGetData = async () => { - const { nodes, from } = await getSafetyEnvironmentalFlowChart({ - INSPECTION_ID: props.id, - }); - fnSeeksGraph(nodes, from); + if (props.type === "list") { + const { nodes, from } = await getSafetyEnvironmentalListFlowChart({ + INSPECTION_ID: props.id, + }); + fnSeeksGraph(nodes, from); + } else if (props.type === "view") { + const { nodes, from } = await getSafetyEnvironmentalViewFlowChart({ + HIDDEN_ID: props.id, + }); + fnSeeksGraph(nodes, from); + } }; const fnSeeksGraph = (nodes, links) => { relationGraphRef.value.setJsonData({ nodes, links }, () => {}); diff --git a/src/views/safety_environmental_management/safety_environmental/components/hidden_add.vue b/src/views/safety_environmental_management/safety_environmental/components/hidden_add.vue new file mode 100644 index 0000000..1b34641 --- /dev/null +++ b/src/views/safety_environmental_management/safety_environmental/components/hidden_add.vue @@ -0,0 +1,166 @@ + + + + + diff --git a/src/views/safety_environmental_management/safety_environmental/components/view_hidden.vue b/src/views/safety_environmental_management/safety_environmental/components/view_hidden.vue new file mode 100644 index 0000000..e471b76 --- /dev/null +++ b/src/views/safety_environmental_management/safety_environmental/components/view_hidden.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/src/views/safety_environmental_management/safety_environmental/index.vue b/src/views/safety_environmental_management/safety_environmental/index.vue index bfb101c..bc17423 100644 --- a/src/views/safety_environmental_management/safety_environmental/index.vue +++ b/src/views/safety_environmental_management/safety_environmental/index.vue @@ -213,6 +213,7 @@ - + +
+ + 秦港股份有限公司现场{{ data.info.INSPECTION_SUBJECT }}检查记录 + + + + {{ data.info.INSPECTED_DEPARTMENT_NAMES }} + + + {{ data.info.INSPECTED_SITEUSER_NAME }} + + + {{ data.info.INSPECTION_PLACE }} + + + {{ data.info.INSPECTION_LEADDEPARTMENT_NAME }} + + + {{ data.info.INSPECTION_USER_NAME }} + + + {{ data.info.INSPECTION_TYPE_NAME }} + + + {{ + dayjs(data.info.INSPECTION_TIME_START).format( + "YYYY年MM月DD日HH时mm分" + ) + }} + 至 + {{ + dayjs(data.info.INSPECTION_TIME_END).format( + "YYYY年MM月DD日HH时mm分" + ) + }} + + + {{ data.info.CREATTIME }} + + + 检查情况 + + + {{ item.SITUATION }} + + + 发现问题 + + + + + + + + + + + +
隐患描述隐患部位操作
{{ item.HIDDENDESCR }}{{ item.HIDDENPART_NAME || item.HIDDENPART }}
+ + + + + + + + + +
签名未生成
+
+
+
+
+ 打印 +
+
+ + + - + + +