生成安全事故档案bug优化

dev
WenShiJun 2024-03-29 10:48:10 +08:00
parent c57033a56f
commit 88b97b8037
6 changed files with 50 additions and 57 deletions

View File

@ -1,5 +1,8 @@
import { post, upload } from "@/request/axios.js"; import { post, upload } from "@/request/axios.js";
import { getLevelsByObject, getLevelsByParentId } from "@/request/data_dictionary.js"; import {
getLevelsByObject,
getLevelsByParentId,
} from "@/request/data_dictionary.js";
import { ref } from "vue"; import { ref } from "vue";
export const getSecurityNoticeList = (params) => export const getSecurityNoticeList = (params) =>
@ -15,6 +18,8 @@ export const getSecurityNoticeInfo = (params) =>
export const addSecurityNotice = (params) => export const addSecurityNotice = (params) =>
upload("/securitynotice/add", params); // 添加安全通知 upload("/securitynotice/add", params); // 添加安全通知
export const getUserListAll = (params) => post("/user/listSelect", params); export const getUserListAll = (params) => post("/user/listSelect", params);
export const getUserBuUserId = (params) =>
post("/user/getUserByUserId", params);
// 通知等级 // 通知等级
export const layoutFnGetNotificationsClassification = async () => { export const layoutFnGetNotificationsClassification = async () => {
@ -27,8 +32,8 @@ export const layoutFnGetNotificationsClassification = async () => {
// 从业类型(人员类型) // 从业类型(人员类型)
export const layoutFnGetSIGNEDSTATUSClassification = async () => { export const layoutFnGetSIGNEDSTATUSClassification = async () => {
const resData = await getLevelsByObject({ const resData = await getLevelsByObject({
DICTIONARIES_ID: '0b62f92b0b624aab8e89a77304a64d5e', DICTIONARIES_ID: "0b62f92b0b624aab8e89a77304a64d5e",
BIANMA: 'TRAFFIC_EMPLOYMENT' BIANMA: "TRAFFIC_EMPLOYMENT",
}); });
return ref(resData); return ref(resData);
}; };

View File

@ -79,6 +79,7 @@
<el-button type="primary" @click="fnSubmit"></el-button> <el-button type="primary" @click="fnSubmit"></el-button>
</div> </div>
</layout-card> </layout-card>
<map-dialog <map-dialog
v-model:visible="data.mapDialogVisible" v-model:visible="data.mapDialogVisible"
v-model:latitude="data.form.LATITUDE" v-model:latitude="data.form.LATITUDE"

View File

@ -51,9 +51,9 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="5"> <el-col :span="5">
<el-form-item label="工作部门" prop="DEPARTMENT"> <el-form-item label="工作部门" prop="CORP_NAME">
<el-input <el-input
v-model="data.form.DEPARTMENT" v-model="data.form.CORP_NAME"
placeholder="请输入工作部门" placeholder="请输入工作部门"
/> />
</el-form-item> </el-form-item>
@ -402,7 +402,7 @@
<script setup> <script setup>
import { getUserListAll } from "@/request/safety_production_related.js"; import { getUserListAll } from "@/request/safety_production_related.js";
import { reactive, ref, toRaw } from "vue"; import { onMounted, reactive, ref, toRaw } from "vue";
import { ACCIDENTNATUREMENU, EDUCATIONALMENU } from "@/assets/js/constant.js"; import { ACCIDENTNATUREMENU, EDUCATIONALMENU } from "@/assets/js/constant.js";
import LayoutUpload from "@/components/upload/index.vue"; import LayoutUpload from "@/components/upload/index.vue";
import useFormValidate from "@/assets/js/useFormValidate.js"; import useFormValidate from "@/assets/js/useFormValidate.js";
@ -411,9 +411,9 @@ import { useRouter, useRoute } from "vue-router";
import { import {
addAccidentInvestigationView, addAccidentInvestigationView,
editAccidentInvestigation, editAccidentInvestigation,
infoAccidentInvestigation
infoAccidentInvestigation, infoAccidentInvestigation,
} from "@/request/production_accident.js"; } from "@/request/production_accident.js";
import { addingPrefixFile } from "@/assets/js/utils.js";
// //
const route = useRoute(); const route = useRoute();
@ -512,32 +512,6 @@ const rules = reactive({
], ],
}); });
onMounted(() => {
isEditMode.value = route.query.mode === "edit";
ACCIDENTINVESTIGATION_ID.value = route.query.ACCIDENTINVESTIGATION_ID || "";
if (isEditMode.value) {
Object.keys(rules).forEach((key) => {
rules[key] = []; //
});
}
});
const fnGetData = async () => {
const ACCIDENTINVESTIGATION_ID = route.query.ACCIDENTINVESTIGATION_ID
if (!ACCIDENTINVESTIGATION_ID) return;
const resData = await infoAccidentInvestigation({ ACCIDENTINVESTIGATION_ID });
data.form = resData.pd;
};
fnGetData();
const router = useRouter();
const fnGetUnitsList = async () => {
const resData = await getUserListAll({});
data.unitsList = resData.userList;
};
fnGetUnitsList();
const data = reactive({ const data = reactive({
form: { form: {
USER_ID: "", USER_ID: "",
@ -580,23 +554,39 @@ const data = reactive({
}, },
}); });
const fnGetData = async () => { onMounted(() => {
isEditMode.value = route.query.mode === "edit"; isEditMode.value = route.query.mode === "edit";
ACCIDENTINVESTIGATION_ID.value = route.query.ACCIDENTINVESTIGATION_ID || ""; ACCIDENTINVESTIGATION_ID.value = route.query.ACCIDENTINVESTIGATION_ID || "";
if (ACCIDENTINVESTIGATION_ID.value) {
const resData = await infoAccidentInvestigation({ if (isEditMode.value) {
ACCIDENTINVESTIGATION_ID: ACCIDENTINVESTIGATION_ID.value, data.form.fileList = [];
}); data.form.ACCIDENTANALYSISRECORD = [];
if (resData && resData.pd) {
Object.keys(resData.pd).forEach((key) => {
if (Object.prototype.hasOwnProperty.call(data.form, key)) {
data.form[key] = resData.pd[key];
}
});
} }
if (isEditMode.value && ACCIDENTINVESTIGATION_ID.value) {
fnGetData();
} }
});
const fnGetData = async () => {
const ACCIDENTINVESTIGATION_ID = route.query.ACCIDENTINVESTIGATION_ID;
if (!ACCIDENTINVESTIGATION_ID) return;
const resData = await infoAccidentInvestigation({ ACCIDENTINVESTIGATION_ID });
data.form = resData.pd;
data.form.fileList = addingPrefixFile(resData.pd.ACCIDENTANALYSISRECORD);
data.form.ACCIDENTANALYSISRECORD = addingPrefixFile(
resData.pd.ACCIDENTREPORTRECORD
);
}; };
fnGetData(); fnGetData();
const router = useRouter();
const fnGetUnitsList = async () => {
const resData = await getUserListAll({});
data.unitsList = resData.userList;
};
fnGetUnitsList();
const fnSubmit = async () => { const fnSubmit = async () => {
await useFormValidate(formRef); await useFormValidate(formRef);

View File

@ -78,7 +78,7 @@
type="primary" type="primary"
text text
link link
@click="fnAddOrEdit(row.ACCIDENTINVESTIGATION_ID)" @click="fnAddOrEdit(row.ACCIDENTINVESTIGATION_ID, row.USER_ID)"
> >
编辑 编辑
</el-button> </el-button>
@ -140,12 +140,13 @@ const convertACCIDENTNATURE = (name) => {
const vehicle = ACCIDENTNATUREMENU.find((item) => item.name === name); const vehicle = ACCIDENTNATUREMENU.find((item) => item.name === name);
return vehicle ? vehicle.id : "未知"; return vehicle ? vehicle.id : "未知";
}; };
const fnAddOrEdit = (ACCIDENTINVESTIGATION_ID) => { const fnAddOrEdit = (ACCIDENTINVESTIGATION_ID, USER_ID) => {
router.push({ router.push({
path: "/mechanical_files/production_accident/add", path: "/mechanical_files/production_accident/add",
query: { query: {
mode: "edit", mode: "edit",
ACCIDENTINVESTIGATION_ID, ACCIDENTINVESTIGATION_ID,
USER_ID,
}, },
}); });
}; };

View File

@ -85,12 +85,9 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-col :span="50"> <el-col :span="24">
<el-form-item label="通知内容" prop="NOTIFICATIONCONTENT"> <el-form-item label="通知内容" prop="NOTIFICATIONCONTENT">
<layout-editor <layout-editor v-model="data.form.NOTIFICATIONCONTENT" />
v-model="data.form.NOTIFICATIONCONTENT"
placeholder="请输入内容"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -126,7 +123,9 @@ const rules = {
TITLE: [{ required: true, message: "请输入通知标题", trigger: "blur" }], TITLE: [{ required: true, message: "请输入通知标题", trigger: "blur" }],
LEVEL: [{ required: true, message: "请选择通知等级", trigger: "blur" }], LEVEL: [{ required: true, message: "请选择通知等级", trigger: "blur" }],
PERSON: [{ required: true, message: "请选择通知人员", trigger: "blur" }], PERSON: [{ required: true, message: "请选择通知人员", trigger: "blur" }],
NOTIFICATIONCONTENT: [{ required: true, message: "请输入通知内容", trigger: "blur" }], NOTIFICATIONCONTENT: [
{ required: true, message: "请输入通知内容", trigger: "blur" },
],
}; };
const relatedClassificationTempList = const relatedClassificationTempList =
await layoutFnGetNotificationsClassification(); await layoutFnGetNotificationsClassification();

View File

@ -46,7 +46,7 @@
row-key="RISKCHECKITEM_ID" row-key="RISKCHECKITEM_ID"
@get-data="fnGetData" @get-data="fnGetData"
> >
<el-table-column reserve-selection type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column label="序号" width="70"> <el-table-column label="序号" width="70">
<template #default="{ $index }"> <template #default="{ $index }">
{{ serialNumber(pagination, $index) }} {{ serialNumber(pagination, $index) }}
@ -97,9 +97,6 @@ const { list, searchForm, pagination, fnGetData, fnResetPagination, tableRef } =
clearSelection: false, clearSelection: false,
}); });
const stop = watch( const stop = watch(
() => props.visible, () => props.visible,
(value) => { (value) => {