forked from integrated_whb/integrated_whb_vue
生成安全事故档案bug优化
parent
c57033a56f
commit
88b97b8037
|
@ -1,5 +1,8 @@
|
|||
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";
|
||||
|
||||
export const getSecurityNoticeList = (params) =>
|
||||
|
@ -15,6 +18,8 @@ export const getSecurityNoticeInfo = (params) =>
|
|||
export const addSecurityNotice = (params) =>
|
||||
upload("/securitynotice/add", params); // 添加安全通知
|
||||
export const getUserListAll = (params) => post("/user/listSelect", params);
|
||||
export const getUserBuUserId = (params) =>
|
||||
post("/user/getUserByUserId", params);
|
||||
|
||||
// 通知等级
|
||||
export const layoutFnGetNotificationsClassification = async () => {
|
||||
|
@ -27,8 +32,8 @@ export const layoutFnGetNotificationsClassification = async () => {
|
|||
// 从业类型(人员类型)
|
||||
export const layoutFnGetSIGNEDSTATUSClassification = async () => {
|
||||
const resData = await getLevelsByObject({
|
||||
DICTIONARIES_ID: '0b62f92b0b624aab8e89a77304a64d5e',
|
||||
BIANMA: 'TRAFFIC_EMPLOYMENT'
|
||||
DICTIONARIES_ID: "0b62f92b0b624aab8e89a77304a64d5e",
|
||||
BIANMA: "TRAFFIC_EMPLOYMENT",
|
||||
});
|
||||
return ref(resData);
|
||||
};
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
<el-button type="primary" @click="fnSubmit">确定</el-button>
|
||||
</div>
|
||||
</layout-card>
|
||||
|
||||
<map-dialog
|
||||
v-model:visible="data.mapDialogVisible"
|
||||
v-model:latitude="data.form.LATITUDE"
|
||||
|
|
|
@ -51,9 +51,9 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-form-item label="工作部门" prop="DEPARTMENT">
|
||||
<el-form-item label="工作部门" prop="CORP_NAME">
|
||||
<el-input
|
||||
v-model="data.form.DEPARTMENT"
|
||||
v-model="data.form.CORP_NAME"
|
||||
placeholder="请输入工作部门"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
@ -402,7 +402,7 @@
|
|||
|
||||
<script setup>
|
||||
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 LayoutUpload from "@/components/upload/index.vue";
|
||||
import useFormValidate from "@/assets/js/useFormValidate.js";
|
||||
|
@ -411,9 +411,9 @@ import { useRouter, useRoute } from "vue-router";
|
|||
import {
|
||||
addAccidentInvestigationView,
|
||||
editAccidentInvestigation,
|
||||
infoAccidentInvestigation
|
||||
infoAccidentInvestigation,
|
||||
} from "@/request/production_accident.js";
|
||||
import { addingPrefixFile } from "@/assets/js/utils.js";
|
||||
|
||||
// 获取路由实例
|
||||
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({
|
||||
form: {
|
||||
USER_ID: "",
|
||||
|
@ -580,23 +554,39 @@ const data = reactive({
|
|||
},
|
||||
});
|
||||
|
||||
const fnGetData = async () => {
|
||||
onMounted(() => {
|
||||
isEditMode.value = route.query.mode === "edit";
|
||||
ACCIDENTINVESTIGATION_ID.value = route.query.ACCIDENTINVESTIGATION_ID || "";
|
||||
if (ACCIDENTINVESTIGATION_ID.value) {
|
||||
const resData = await infoAccidentInvestigation({
|
||||
ACCIDENTINVESTIGATION_ID: ACCIDENTINVESTIGATION_ID.value,
|
||||
});
|
||||
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) {
|
||||
data.form.fileList = [];
|
||||
data.form.ACCIDENTANALYSISRECORD = [];
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
const router = useRouter();
|
||||
const fnGetUnitsList = async () => {
|
||||
const resData = await getUserListAll({});
|
||||
data.unitsList = resData.userList;
|
||||
};
|
||||
fnGetUnitsList();
|
||||
|
||||
const fnSubmit = async () => {
|
||||
await useFormValidate(formRef);
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
type="primary"
|
||||
text
|
||||
link
|
||||
@click="fnAddOrEdit(row.ACCIDENTINVESTIGATION_ID)"
|
||||
@click="fnAddOrEdit(row.ACCIDENTINVESTIGATION_ID, row.USER_ID)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
|
@ -140,12 +140,13 @@ const convertACCIDENTNATURE = (name) => {
|
|||
const vehicle = ACCIDENTNATUREMENU.find((item) => item.name === name);
|
||||
return vehicle ? vehicle.id : "未知";
|
||||
};
|
||||
const fnAddOrEdit = (ACCIDENTINVESTIGATION_ID) => {
|
||||
const fnAddOrEdit = (ACCIDENTINVESTIGATION_ID, USER_ID) => {
|
||||
router.push({
|
||||
path: "/mechanical_files/production_accident/add",
|
||||
query: {
|
||||
mode: "edit",
|
||||
ACCIDENTINVESTIGATION_ID,
|
||||
USER_ID,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
|
@ -85,12 +85,9 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-col :span="50">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="通知内容" prop="NOTIFICATIONCONTENT">
|
||||
<layout-editor
|
||||
v-model="data.form.NOTIFICATIONCONTENT"
|
||||
placeholder="请输入内容"
|
||||
/>
|
||||
<layout-editor v-model="data.form.NOTIFICATIONCONTENT" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -126,7 +123,9 @@ const rules = {
|
|||
TITLE: [{ required: true, message: "请输入通知标题", trigger: "blur" }],
|
||||
LEVEL: [{ 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 =
|
||||
await layoutFnGetNotificationsClassification();
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
row-key="RISKCHECKITEM_ID"
|
||||
@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">
|
||||
<template #default="{ $index }">
|
||||
{{ serialNumber(pagination, $index) }}
|
||||
|
@ -97,9 +97,6 @@ const { list, searchForm, pagination, fnGetData, fnResetPagination, tableRef } =
|
|||
clearSelection: false,
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
const stop = watch(
|
||||
() => props.visible,
|
||||
(value) => {
|
||||
|
|
Loading…
Reference in New Issue