pull/1/head
z 2024-01-15 15:11:17 +08:00
parent fee5d6f786
commit 6184e2c723
23 changed files with 522 additions and 635 deletions

View File

@ -214,6 +214,9 @@ import {
import { getUserListAll } from "@/request/data_dictionary.js";
import useFormValidate from "@/assets/js/useFormValidate.js";
defineOptions({
name: "LayoutHiddenAdd",
});
const props = defineProps({
form: {
type: Object,
@ -286,7 +289,7 @@ const fnVideoPreview = (event) => {
}
};
const fnGetHiddenDangerDatabaseList = async () => {
if (props.hiddenType !== "unqualified" || props.hiddenType !== "otherHidden")
if (props.hiddenType !== "unqualified" && props.hiddenType !== "otherHidden")
return;
if (!form.value.HIDDENPART) return;
const resData = await getHiddenDangerDatabaseList({

View File

@ -239,6 +239,9 @@ import { VideoPlay } from "@element-plus/icons-vue";
import LayoutVideo from "@/components/video/index.vue";
import { getHiddenDangerView } from "@/request/hazard_investigation.js";
defineOptions({
name: "LayoutHiddenView",
});
const VITE_FILE_URL = import.meta.env.VITE_FILE_URL;
const props = defineProps({
hiddenId: {

View File

@ -0,0 +1,387 @@
<template>
<el-form ref="formRef" :rules="rules" :model="form" label-width="240px">
<el-row>
<el-col :span="24" v-if="!infoIsEmpty">
<el-form-item label="管控部门" prop="DEPTNAME">
<el-input :model-value="info.DEPTNAME" disabled />
</el-form-item>
</el-col>
<el-col :span="24" v-if="infoIsEmpty">
<el-form-item label="管控部门" prop="DEPARTMENT_ID">
<layout-department
v-model="form.DEPARTMENT_ID"
@update:model-value="fnDepartmentChange"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="管控责任人" prop="USER_ID">
<el-input v-model="form.USER_ID" />
</el-form-item>
</el-col>
<template v-if="!infoIsEmpty">
<el-col :span="24">
<el-form-item label="风险点(单元)" prop="RISKUNITNAME">
<el-input :model-value="info.RISKUNITNAME" disabled />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="辨识部位" prop="PARTSNAME">
<el-input :model-value="info.PARTSNAME" disabled />
</el-form-item>
</el-col>
</template>
<template v-if="infoIsEmpty">
<el-col :span="24">
<el-form-item label="风险点(单元)" prop="RISK_UNIT_ID">
<el-select v-model="form.RISK_UNIT_ID" @change="fnRiskUnitChange">
<el-option
v-for="item in unitList"
:key="item.RISKUNIT_ID"
:label="item.DEPT_NAME + '-' + item.RISKUNITNAME"
:value="item.RISKUNIT_ID"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="辨识部位" prop="IDENTIFICATION_ID">
<el-select v-model="form.IDENTIFICATION_ID">
<el-option
v-for="item in partsList"
:key="item.IDENTIFICATIONPARTS_ID"
:label="item.PARTSNAME"
:value="item.IDENTIFICATIONPARTS_ID"
/>
</el-select>
</el-form-item>
</el-col>
</template>
<el-col :span="24">
<el-form-item label="存在风险" prop="RISK_DESCR">
<el-input
v-model="form.RISK_DESCR"
type="textarea"
:autosize="{
minRows: 3,
}"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="事故发生的可能性" prop="LIKELIHOOD">
<el-select v-model="form.LIKELIHOOD">
<el-option :value="10" label="完全可以预料" />
<el-option :value="6" label="相当可能" />
<el-option :value="3" label="可能,但不经常" />
<el-option :value="1" label="可能性小,完全意外" />
<el-option :value="0.5" label="很不可能,可以设想" />
<el-option :value="0.2" label="极不可能" />
<el-option :value="0.1" label="实际不可能" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分值">
{{ form.LIKELIHOOD }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="人员暴露于危险环境中的频繁程度" prop="EXPOSURE">
<el-select v-model="form.EXPOSURE">
<el-option :value="10" label="连续暴露" />
<el-option :value="6" label="每天工作时间内暴露" />
<el-option :value="3" label="每周一次或偶然暴露" />
<el-option :value="2" label="每月一次暴露,完全意外" />
<el-option :value="1" label="每年几次暴露" />
<el-option :value="0.5" label="非常罕见暴露" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分值">
{{ form.EXPOSURE }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="一旦发生事故可能造成的后果" prop="CONSEQUENCE">
<el-select v-model="form.CONSEQUENCE">
<el-option :value="100" label="10人以上死亡" />
<el-option :value="40" label="39人死亡" />
<el-option :value="15" label="12人死亡" />
<el-option :value="7" label="严重" />
<el-option :value="3" label="重大,伤残" />
<el-option :value="1" label="引人注意" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分值">
{{ form.CONSEQUENCE }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="风险分级" prop="LEVEL_NAME">
{{ form.LEVEL_NAME }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总分值" prop="DANGER">
{{ form.DANGER }}
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="管控措施" prop="MEASURES">
<el-input
v-model="form.MEASURES"
type="textarea"
:autosize="{
minRows: 3,
}"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="事故类型" prop="ACCIDENTS">
<el-select v-model="form.ACCIDENTS" multiple>
<el-option
v-for="item in accidentTypeList"
:key="item.BIANMA"
:label="item.NAME"
:value="item.BIANMA"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="应急处置措施" prop="EME_MEASURES">
<el-input
v-model="form.EME_MEASURES"
type="textarea"
:autosize="{
minRows: 3,
}"
/>
</el-form-item>
</el-col>
<template v-if="control">
<el-col :span="24">
<el-form-item label="管控措施分类1" prop="MANAGEMENT_CONTROL_ONE">
<el-select
v-model="form.MANAGEMENT_CONTROL_ONE"
@change="form.MANAGEMENT_CONTROL_TWO = ''"
>
<el-option
v-for="item in controlList1"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="管控措施分类2" prop="MANAGEMENT_CONTROL_TWO">
<el-select v-model="form.MANAGEMENT_CONTROL_TWO">
<el-option
v-for="item in controlList2"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="管控措施分类3" prop="MANAGEMENT_CONTROL_THREE">
<el-input
v-model="form.MANAGEMENT_CONTROL_THREE"
type="textarea"
:autosize="{
minRows: 3,
}"
/>
</el-form-item>
</el-col>
</template>
</el-row>
</el-form>
</template>
<script setup>
import { ref, watch, watchEffect } from "vue";
import { useVModel } from "@vueuse/core";
import {
layoutFnGetAccidentType,
layoutFnGetControlMeasures1,
layoutFnGetControlMeasures2,
} from "@/assets/js/data_dictionary.js";
import useFormValidate from "@/assets/js/useFormValidate.js";
import LayoutDepartment from "@/components/department/index.vue";
import { isEmpty } from "lodash-es";
import {
getIdentifyingPartsListAll,
getRiskPointListAllById,
} from "@/request/risk_control.js";
defineOptions({
name: "LayoutRiskAdd",
});
const props = defineProps({
form: {
type: Object,
required: true,
default: () => ({}),
},
info: {
type: Object,
default: () => ({}),
},
control: {
type: Boolean,
default: false,
},
});
const emits = defineEmits(["update:form"]);
const form = useVModel(props, "form", emits);
const rules = {
USER_ID: [{ required: true, message: "管控责任人不能为空", trigger: "blur" }],
RISK_DESCR: [
{ required: true, message: "存在风险不能为空", trigger: "blur" },
],
LIKELIHOOD: [
{ required: true, message: "事故发生的可能性不能为空", trigger: "change" },
],
EXPOSURE: [
{
required: true,
message: "人员暴露于危险环境中的频繁程度不能为空",
trigger: "change",
},
],
CONSEQUENCE: [
{
required: true,
message: "一旦发生事故可能造成的后果不能为空",
trigger: "change",
},
],
LEVEL_NAME: [
{ required: true, message: "风险分级不能为空", trigger: "change" },
],
MEASURES: [{ required: true, message: "管控措施不能为空", trigger: "blur" }],
EME_MEASURES: [
{ required: true, message: "应急处置措施不能为空", trigger: "blur" },
],
ACCIDENTS: [
{ required: true, message: "事故类型不能为空", trigger: "change" },
],
DEPARTMENT_ID: [
{ required: true, message: "部门不能为空", trigger: "change" },
],
RISK_UNIT_ID: [
{ required: true, message: "风险点(单元)不能为空", trigger: "change" },
],
IDENTIFICATION_ID: [
{ required: true, message: "辨识部位不能为空", trigger: "change" },
],
};
const formRef = ref(null);
const infoIsEmpty = ref(isEmpty(props.info));
const unitList = ref([]);
const partsList = ref([]);
const controlList2 = ref([]);
const fnGetLevelName = (LIKELIHOOD, EXPOSURE, CONSEQUENCE) => {
const DANGER = (LIKELIHOOD * EXPOSURE * CONSEQUENCE).toFixed(2);
if (DANGER > 320) {
form.value.LEVELID = "levelA";
form.value.LEVEL_NAME = "重大风险/A级";
} else if (DANGER > 160) {
form.value.LEVELID = "levelB";
form.value.LEVEL_NAME = "较大风险/B级";
} else if (DANGER > 70) {
form.value.LEVELID = "levelC";
form.value.LEVEL_NAME = "一般风险/C级";
} else {
form.value.LEVELID = "levelD";
form.value.LEVEL_NAME = "低风险/D级";
}
form.value.DANGER = DANGER;
};
watch(
[
() => props.form.LIKELIHOOD,
() => props.form.EXPOSURE,
() => props.form.CONSEQUENCE,
],
([LIKELIHOOD, EXPOSURE, CONSEQUENCE]) => {
if (!LIKELIHOOD || !EXPOSURE || !CONSEQUENCE) return;
fnGetLevelName(LIKELIHOOD, EXPOSURE, CONSEQUENCE);
}
);
const fnGetUnitList = async () => {
const resData = await getRiskPointListAllById({
DEPARTMENT_ID: form.value.DEPARTMENT_ID,
});
unitList.value = resData.unitList;
};
const fnGetPartsList = async () => {
const resData = await getIdentifyingPartsListAll({
RISK_UNIT_ID: form.value.RISK_UNIT_ID,
});
partsList.value = resData.partsList;
};
const fnControlList1Change = () => {
controlList2.value = [];
const id = form.value.MANAGEMENT_CONTROL_ONE;
let BZ = "";
for (let i = 0; i < controlList1.value.length; i++) {
if (controlList1.value[i].id === id) {
BZ = controlList1.value[i].BZ;
break;
}
}
for (let i = 0; i < controlList2All.value.length; i++) {
if (controlList2All.value[i].TBFIELD === BZ) {
controlList2.value.push(controlList2All.value[i]);
}
}
};
const fnDepartmentChange = () => {
form.value.RISK_UNIT_ID = "";
form.value.IDENTIFICATION_ID = "";
unitList.value = [];
partsList.value = [];
};
const fnRiskUnitChange = () => {
form.value.IDENTIFICATION_ID = "";
partsList.value = [];
};
watchEffect(() => {
if (form.value.DEPARTMENT_ID) fnGetUnitList();
if (form.value.RISK_UNIT_ID) fnGetPartsList();
if (form.value.MANAGEMENT_CONTROL_ONE) fnControlList1Change();
});
const fnReset = () => {
formRef.value.resetFields();
};
const fnFormValidate = async () => {
await useFormValidate(formRef);
};
const fnAccidentsName = () => {
return accidentTypeList.value
.filter((item) => form.value.ACCIDENTS.includes(item.BIANMA))
.map((item) => item.NAME)
.join(",");
};
defineExpose({
reset: fnReset,
formValidate: fnFormValidate,
accidentsName: fnAccidentsName,
});
const accidentTypeList = await layoutFnGetAccidentType();
const controlList1 = props.control && (await layoutFnGetControlMeasures1());
const controlList2All = props.control && (await layoutFnGetControlMeasures2());
</script>
<style scoped lang="scss"></style>

View File

@ -114,7 +114,7 @@ const fnGetInfo = async () => {
data.avatar = FILE_URL + resData.userPhoto;
} catch {
data.avatar = new URL(
"../../../assets/images/public/tx.png",
"../../assets/images/public/tx.png",
import.meta.url
).href;
}

View File

@ -32,9 +32,9 @@
</template>
<script setup>
import LayoutBreadcrumb from "@/components/layout/breadcrumb/index";
import LayoutHeader from "@/components/layout/header/index";
import LayoutMenu from "@/components/layout/menu/index";
import LayoutBreadcrumb from "./breadcrumb/index";
import LayoutHeader from "./header/index";
import LayoutMenu from "./menu/index";
import { computed } from "vue";
import { useMenuStore } from "@/pinia/menu";
import { useRoute } from "vue-router";

View File

@ -1,5 +1,5 @@
import { createRouter, createWebHashHistory } from "vue-router";
import layout from "../components/layout/index.vue";
import layout from "../layout/index.vue";
// import children from "../components/children/index.vue";
const routes = [

View File

@ -1,7 +1,7 @@
<template>
<layout-card>
<div id="printContent">
<hidden-view :hidden-id="HIDDEN_ID" />
<layout-hidden-view :hidden-id="HIDDEN_ID" />
</div>
<div class="tc mt-10" v-if="print">
<el-button type="primary" v-print="'#printContent'"></el-button>
@ -10,7 +10,7 @@
</template>
<script setup>
import HiddenView from "./components/hidden_view.vue";
import LayoutHiddenView from "@/components/hidden_view/index.vue";
import { useRoute } from "vue-router";
const route = useRoute();

View File

@ -1,11 +1,11 @@
<template>
<layout-card>
<hidden-view :hiddenId="HIDDEN_ID" />
<layout-hidden-view :hiddenId="HIDDEN_ID" />
</layout-card>
</template>
<script setup>
import HiddenView from "../checklist_inspection_status/components/hidden_view.vue";
import LayoutHiddenView from "@/components/hidden_view/index.vue";
import { useRoute } from "vue-router";
const route = useRoute();

View File

@ -217,7 +217,6 @@
type="add"
v-model:visible="data.addOrEditDialog.visible"
v-model:form="data.addOrEditDialog.form"
:control="false"
@get-data="fnAddRiskSubmit"
/>
<select-risk

View File

@ -5,7 +5,7 @@
:on-close="fnClose"
width="1200"
>
<hidden-add
<layout-hidden-add
:hidden-type="hiddenType"
:info="info"
v-model:form="form"
@ -28,7 +28,7 @@ import {
setHiddenDangerListAdd,
} from "@/request/hazard_investigation.js";
import { setUploadImg } from "@/request/api.js";
import HiddenAdd from "./hidden_add.vue";
import LayoutHiddenAdd from "@/components/hidden_add/index.vue";
import { ref } from "vue";
const props = defineProps({

View File

@ -1,6 +1,6 @@
<template>
<layout-card>
<HiddenView :hidden-id="HIDDEN_ID" />
<layout-hidden-view :hidden-id="HIDDEN_ID" />
<el-divider content-position="left">隐患验收</el-divider>
<el-form
ref="formRef"
@ -58,7 +58,7 @@
</template>
<script setup>
import HiddenView from "@/views/hazard_investigation/checklist_inspection_status/components/hidden_view.vue";
import LayoutHiddenView from "@/components/hidden_view/index.vue";
import { useRoute, useRouter } from "vue-router";
import { reactive, ref } from "vue";
import { debounce } from "throttle-debounce";

View File

@ -1,6 +1,10 @@
<template>
<layout-card>
<hidden-add hidden-type="ledger" v-model:form="form" ref="hiddenAddRef" />
<layout-hidden-add
hidden-type="ledger"
v-model:form="form"
ref="hiddenAddRef"
/>
<div class="tc mt-10">
<el-button type="primary" @click="fnSubmit"></el-button>
</div>
@ -8,7 +12,7 @@
</template>
<script setup>
import HiddenAdd from "@/views/hazard_investigation/inventory_troubleshooting/components/hidden_add.vue";
import LayoutHiddenAdd from "@/components/hidden_add/index.vue";
import { ref } from "vue";
import { debounce } from "throttle-debounce";
import { setHiddenDangerAdd } from "@/request/hazard_investigation.js";

View File

@ -1,7 +1,7 @@
<template>
<layout-card>
<div id="printContent">
<hidden-view :hidden-id="HIDDEN_ID" />
<layout-hidden-view :hidden-id="HIDDEN_ID" />
</div>
<div class="tc mt-10">
<el-button type="primary" @click="fnConfirm" v-if="type === 'confirm'">
@ -15,7 +15,7 @@
</template>
<script setup>
import HiddenView from "@/views/hazard_investigation/checklist_inspection_status/components/hidden_view.vue";
import LayoutHiddenView from "@/components/hidden_view/index.vue";
import { useRoute, useRouter } from "vue-router";
import { debounce } from "throttle-debounce";
import { ElMessage } from "element-plus";

View File

@ -1,6 +1,9 @@
<template>
<layout-card>
<HiddenView :hidden-id="HIDDEN_ID" @throw-data="data.info = $event" />
<layout-hidden-view
:hidden-id="HIDDEN_ID"
@throw-data="data.info = $event"
/>
<el-divider content-position="left">隐患整改</el-divider>
<el-row :gutter="24">
<el-col :span="12">
@ -293,7 +296,7 @@
</template>
<script setup>
import HiddenView from "@/views/hazard_investigation/checklist_inspection_status/components/hidden_view.vue";
import LayoutHiddenView from "@/components/hidden_view/index.vue";
import { useRoute, useRouter } from "vue-router";
import { reactive, ref, watch } from "vue";
import LayoutDepartment from "@/components/department/index.vue";

View File

@ -1,288 +0,0 @@
<template>
<el-dialog v-model="visible" :title="title" :before-close="fnClose">
<el-form ref="formRef" :rules="rules" :model="form" label-width="240px">
<el-row>
<el-col :span="24">
<el-form-item label="管控部门" prop="DEPTNAME">
<el-input :model-value="info.DEPTNAME" disabled />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="管控责任人" prop="USER_ID">
<el-input v-model="form.USER_ID" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="风险点(单元)" prop="RISKUNITNAME">
<el-input :model-value="info.RISKUNITNAME" disabled />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="辨识部位" prop="PARTSNAME">
<el-input :model-value="info.PARTSNAME" disabled />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="存在风险" prop="RISK_DESCR">
<el-input
v-model="form.RISK_DESCR"
type="textarea"
:autosize="{
minRows: 3,
}"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="事故发生的可能性" prop="LIKELIHOOD">
<el-select v-model="form.LIKELIHOOD">
<el-option :value="10" label="完全可以预料" />
<el-option :value="6" label="相当可能" />
<el-option :value="3" label="可能,但不经常" />
<el-option :value="1" label="可能性小,完全意外" />
<el-option :value="0.5" label="很不可能,可以设想" />
<el-option :value="0.2" label="极不可能" />
<el-option :value="0.1" label="实际不可能" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分值">
{{ form.LIKELIHOOD }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="人员暴露于危险环境中的频繁程度" prop="EXPOSURE">
<el-select v-model="form.EXPOSURE">
<el-option :value="10" label="连续暴露" />
<el-option :value="6" label="每天工作时间内暴露" />
<el-option :value="3" label="每周一次或偶然暴露" />
<el-option :value="2" label="每月一次暴露,完全意外" />
<el-option :value="1" label="每年几次暴露" />
<el-option :value="0.5" label="非常罕见暴露" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分值">
{{ form.EXPOSURE }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="一旦发生事故可能造成的后果" prop="CONSEQUENCE">
<el-select v-model="form.CONSEQUENCE">
<el-option :value="100" label="10人以上死亡" />
<el-option :value="40" label="39人死亡" />
<el-option :value="15" label="12人死亡" />
<el-option :value="7" label="严重" />
<el-option :value="3" label="重大,伤残" />
<el-option :value="1" label="引人注意" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分值">
{{ form.CONSEQUENCE }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="风险分级" prop="LEVEL_NAME">
{{ form.LEVEL_NAME }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总分值" prop="DANGER">
{{ form.DANGER }}
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="管控措施" prop="MEASURES">
<el-input
v-model="form.MEASURES"
type="textarea"
:autosize="{
minRows: 3,
}"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="事故类型" prop="ACCIDENTS">
<el-select v-model="form.ACCIDENTS" multiple>
<el-option
v-for="item in accidentTypeList"
:key="item.BIANMA"
:label="item.NAME"
:value="item.BIANMA"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="应急处置措施" prop="EME_MEASURES">
<el-input
v-model="form.EME_MEASURES"
type="textarea"
:autosize="{
minRows: 3,
}"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button @click="fnClose"></el-button>
<el-button type="primary" @click="fnSubmit"> </el-button>
</template>
</el-dialog>
</template>
<script setup>
import { ref, watch } from "vue";
import { useVModels } from "@vueuse/core";
import { debounce } from "throttle-debounce";
import useFormValidate from "@/assets/js/useFormValidate.js";
import { ElMessage } from "element-plus";
import { layoutFnGetAccidentType } from "@/assets/js/data_dictionary.js";
import {
setIdentifyingPartsRiskAdd,
setIdentifyingPartsRiskEdit,
} from "@/request/risk_control.js";
const props = defineProps({
visible: {
type: Boolean,
required: true,
default: false,
},
form: {
type: Object,
required: true,
default: () => ({}),
},
info: {
type: Object,
required: true,
default: () => ({}),
},
type: {
type: Number,
required: true,
default: 0,
},
title: {
type: String,
required: true,
default: "",
},
id: {
type: String,
required: true,
default: "",
},
time: {
type: Number,
required: true,
default: 0,
},
});
const emits = defineEmits(["update:visible", "update:form", "get-data"]);
const { visible, form } = useVModels(props, emits);
const rules = {
USER_ID: [{ required: true, message: "管控责任人不能为空", trigger: "blur" }],
RISK_DESCR: [
{ required: true, message: "存在风险不能为空", trigger: "blur" },
],
LIKELIHOOD: [
{ required: true, message: "事故发生的可能性不能为空", trigger: "change" },
],
EXPOSURE: [
{
required: true,
message: "人员暴露于危险环境中的频繁程度不能为空",
trigger: "change",
},
],
CONSEQUENCE: [
{
required: true,
message: "一旦发生事故可能造成的后果不能为空",
trigger: "change",
},
],
LEVEL_NAME: [
{ required: true, message: "风险分级不能为空", trigger: "change" },
],
MEASURES: [{ required: true, message: "管控措施不能为空", trigger: "blur" }],
EME_MEASURES: [
{ required: true, message: "应急处置措施不能为空", trigger: "blur" },
],
ACCIDENTS: [
{ required: true, message: "事故类型不能为空", trigger: "change" },
],
};
const formRef = ref(null);
const accidentTypeList = await layoutFnGetAccidentType();
const fnGetLevelName = (LIKELIHOOD, EXPOSURE, CONSEQUENCE) => {
const DANGER = (LIKELIHOOD * EXPOSURE * CONSEQUENCE).toFixed(2);
if (DANGER > 320) {
form.value.LEVELID = "levelA";
form.value.LEVEL_NAME = "重大风险/A级";
} else if (DANGER > 160) {
form.value.LEVELID = "levelB";
form.value.LEVEL_NAME = "较大风险/B级";
} else if (DANGER > 70) {
form.value.LEVELID = "levelC";
form.value.LEVEL_NAME = "一般风险/C级";
} else {
form.value.LEVELID = "levelD";
form.value.LEVEL_NAME = "低风险/D级";
}
form.value.DANGER = DANGER;
};
watch(
[
() => props.form.LIKELIHOOD,
() => props.form.EXPOSURE,
() => props.form.CONSEQUENCE,
],
([LIKELIHOOD, EXPOSURE, CONSEQUENCE]) => {
if (!LIKELIHOOD || !EXPOSURE || !CONSEQUENCE) return;
fnGetLevelName(LIKELIHOOD, EXPOSURE, CONSEQUENCE);
}
);
const fnClose = () => {
formRef.value.resetFields();
visible.value = false;
};
const fnSubmit = debounce(
1000,
async () => {
await useFormValidate(formRef);
const ACCIDENTS_NAME = accidentTypeList.value
.filter((item) => form.value.ACCIDENTS.includes(item.BIANMA))
.map((item) => item.NAME)
.join(",");
const params = {
...form.value,
RISK_UNIT_ID: props.info.RISK_UNIT_ID,
DEPARTMENT_ID: props.info.DEPARTMENT_ID,
IDENTIFICATION_ID: props.id,
CHECK_CONTENT: form.value.MEASURES,
ACCIDENTS: form.value.ACCIDENTS.join(","),
ACCIDENTS_NAME,
SETUPTIME: props.time,
TYPE: props.type,
};
if (!props.type) await setIdentifyingPartsRiskAdd(params);
else await setIdentifyingPartsRiskEdit(params);
ElMessage.success("操作成功");
fnClose();
emits("get-data");
},
{ atBegin: true }
);
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,91 @@
<template>
<el-dialog v-model="visible" :title="title" :before-close="fnClose">
<layout-risk-add v-model:form="form" :info="info" ref="riskAddRef" />
<template #footer>
<el-button @click="fnClose"></el-button>
<el-button type="primary" @click="fnSubmit"> </el-button>
</template>
</el-dialog>
</template>
<script setup>
import { useVModels } from "@vueuse/core";
import { debounce } from "throttle-debounce";
import { ElMessage } from "element-plus";
import {
setIdentifyingPartsRiskAdd,
setIdentifyingPartsRiskEdit,
} from "@/request/risk_control.js";
import LayoutRiskAdd from "@/components/risk_add/index.vue";
import { ref } from "vue";
const props = defineProps({
visible: {
type: Boolean,
required: true,
default: false,
},
form: {
type: Object,
required: true,
default: () => ({}),
},
info: {
type: Object,
required: true,
default: () => ({}),
},
type: {
type: Number,
required: true,
default: 0,
},
title: {
type: String,
required: true,
default: "",
},
id: {
type: String,
required: true,
default: "",
},
time: {
type: Number,
required: true,
default: 0,
},
});
const emits = defineEmits(["update:visible", "update:form", "get-data"]);
const { visible, form } = useVModels(props, emits);
const riskAddRef = ref(null);
const fnClose = () => {
riskAddRef.value.reset();
visible.value = false;
};
const fnSubmit = debounce(
1000,
async () => {
await riskAddRef.value.formValidate();
const params = {
...form.value,
RISK_UNIT_ID: props.info.RISK_UNIT_ID,
DEPARTMENT_ID: props.info.DEPARTMENT_ID,
IDENTIFICATION_ID: props.id,
CHECK_CONTENT: form.value.MEASURES,
ACCIDENTS: form.value.ACCIDENTS.join(","),
ACCIDENTS_NAME: riskAddRef.value.accidentsName(),
SETUPTIME: props.time,
TYPE: props.type,
};
if (!props.type) await setIdentifyingPartsRiskAdd(params);
else await setIdentifyingPartsRiskEdit(params);
ElMessage.success("操作成功");
fnClose();
emits("get-data");
},
{ atBegin: true }
);
</script>
<style scoped lang="scss"></style>

View File

@ -89,7 +89,7 @@
<div class="tc mt-10">
<el-button type="primary" @click="fnSubmit"></el-button>
</div>
<add-risk
<risk-add
v-model:visible="data.addDialog.visible"
v-model:form="data.addDialog.form"
:type="data.addDialog.type"
@ -112,7 +112,7 @@ import {
getIdentifyingPartsRiskView3,
} from "@/request/risk_control.js";
import { useRoute, useRouter } from "vue-router";
import AddRisk from "./components/add_risk.vue";
import RiskAdd from "./components/risk_add.vue";
import { debounce } from "throttle-debounce";
import { ElMessage } from "element-plus";

View File

@ -4,194 +4,7 @@
:title="title ? title : type === 'add' ? '新增' : '修改'"
:before-close="fnClose"
>
<el-form ref="formRef" :rules="rules" :model="form" label-width="240px">
<el-row>
<el-col :span="24">
<el-form-item label="管控部门" prop="DEPARTMENT_ID">
<layout-department
v-model="form.DEPARTMENT_ID"
@update:model-value="fnDepartmentChange"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="管控责任人" prop="USER_ID">
<el-input v-model="form.USER_ID" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="风险点(单元)" prop="RISK_UNIT_ID">
<el-select v-model="form.RISK_UNIT_ID" @change="fnRiskUnitChange">
<el-option
v-for="item in unitList"
:key="item.RISKUNIT_ID"
:label="item.DEPT_NAME + '-' + item.RISKUNITNAME"
:value="item.RISKUNIT_ID"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="辨识部位" prop="IDENTIFICATION_ID">
<el-select v-model="form.IDENTIFICATION_ID">
<el-option
v-for="item in partsList"
:key="item.IDENTIFICATIONPARTS_ID"
:label="item.PARTSNAME"
:value="item.IDENTIFICATIONPARTS_ID"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="存在风险" prop="RISK_DESCR">
<el-input
v-model="form.RISK_DESCR"
type="textarea"
:autosize="{
minRows: 3,
}"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="事故发生的可能性" prop="LIKELIHOOD">
<el-select v-model="form.LIKELIHOOD">
<el-option :value="10" label="完全可以预料" />
<el-option :value="6" label="相当可能" />
<el-option :value="3" label="可能,但不经常" />
<el-option :value="1" label="可能性小,完全意外" />
<el-option :value="0.5" label="很不可能,可以设想" />
<el-option :value="0.2" label="极不可能" />
<el-option :value="0.1" label="实际不可能" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分值">
{{ form.LIKELIHOOD }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="人员暴露于危险环境中的频繁程度" prop="EXPOSURE">
<el-select v-model="form.EXPOSURE">
<el-option :value="10" label="连续暴露" />
<el-option :value="6" label="每天工作时间内暴露" />
<el-option :value="3" label="每周一次或偶然暴露" />
<el-option :value="2" label="每月一次暴露,完全意外" />
<el-option :value="1" label="每年几次暴露" />
<el-option :value="0.5" label="非常罕见暴露" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分值">
{{ form.EXPOSURE }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="一旦发生事故可能造成的后果" prop="CONSEQUENCE">
<el-select v-model="form.CONSEQUENCE">
<el-option :value="100" label="10人以上死亡" />
<el-option :value="40" label="39人死亡" />
<el-option :value="15" label="12人死亡" />
<el-option :value="7" label="严重" />
<el-option :value="3" label="重大,伤残" />
<el-option :value="1" label="引人注意" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分值">
{{ form.CONSEQUENCE }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="风险分级" prop="LEVEL_NAME">
{{ form.LEVEL_NAME }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总分值" prop="DANGER">
{{ form.DANGER }}
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="管控措施" prop="MEASURES">
<el-input
v-model="form.MEASURES"
type="textarea"
:autosize="{
minRows: 3,
}"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="事故类型" prop="ACCIDENTS">
<el-select v-model="form.ACCIDENTS" multiple>
<el-option
v-for="item in accidentTypeList"
:key="item.BIANMA"
:label="item.NAME"
:value="item.BIANMA"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="应急处置措施" prop="EME_MEASURES">
<el-input
v-model="form.EME_MEASURES"
type="textarea"
:autosize="{
minRows: 3,
}"
/>
</el-form-item>
</el-col>
<template v-if="control">
<el-col :span="24">
<el-form-item label="管控措施分类1" prop="MANAGEMENT_CONTROL_ONE">
<el-select
v-model="form.MANAGEMENT_CONTROL_ONE"
@change="form.MANAGEMENT_CONTROL_TWO = ''"
>
<el-option
v-for="item in controlList1"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="管控措施分类2" prop="MANAGEMENT_CONTROL_TWO">
<el-select v-model="form.MANAGEMENT_CONTROL_TWO">
<el-option
v-for="item in controlList2"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="管控措施分类3" prop="MANAGEMENT_CONTROL_THREE">
<el-input
v-model="form.MANAGEMENT_CONTROL_THREE"
type="textarea"
:autosize="{
minRows: 3,
}"
/>
</el-form-item>
</el-col>
</template>
</el-row>
</el-form>
<layout-risk-add v-model:form="form" :control="control" ref="riskAddRef" />
<template #footer>
<el-button @click="fnClose"></el-button>
<el-button type="primary" @click="fnSubmit"> </el-button>
@ -200,23 +13,15 @@
</template>
<script setup>
import { ref, watch, watchEffect } from "vue";
import { ref } from "vue";
import { useVModels } from "@vueuse/core";
import { debounce } from "throttle-debounce";
import useFormValidate from "@/assets/js/useFormValidate.js";
import { ElMessage } from "element-plus";
import {
layoutFnGetAccidentType,
layoutFnGetControlMeasures1,
layoutFnGetControlMeasures2,
} from "@/assets/js/data_dictionary.js";
import {
getIdentifyingPartsListAll,
getRiskPointListAllById,
setRiskControlLedgerAdd,
setRiskControlLedgerEdit,
} from "@/request/risk_control.js";
import LayoutDepartment from "@/components/department/index.vue";
import LayoutRiskAdd from "@/components/risk_add/index.vue";
const props = defineProps({
visible: {
@ -236,7 +41,7 @@ const props = defineProps({
},
control: {
type: Boolean,
default: true,
default: false,
},
title: {
type: String,
@ -245,141 +50,20 @@ const props = defineProps({
});
const emits = defineEmits(["update:visible", "update:form", "get-data"]);
const { visible, form } = useVModels(props, emits);
const rules = {
DEPARTMENT_ID: [
{ required: true, message: "部门不能为空", trigger: "change" },
],
USER_ID: [{ required: true, message: "管控责任人不能为空", trigger: "blur" }],
RISK_UNIT_ID: [
{ required: true, message: "风险点(单元)不能为空", trigger: "change" },
],
IDENTIFICATION_ID: [
{ required: true, message: "辨识部位不能为空", trigger: "change" },
],
RISK_DESCR: [
{ required: true, message: "存在风险不能为空", trigger: "blur" },
],
LIKELIHOOD: [
{ required: true, message: "事故发生的可能性不能为空", trigger: "change" },
],
EXPOSURE: [
{
required: true,
message: "人员暴露于危险环境中的频繁程度不能为空",
trigger: "change",
},
],
CONSEQUENCE: [
{
required: true,
message: "一旦发生事故可能造成的后果不能为空",
trigger: "change",
},
],
LEVELID: [{ required: true, message: "风险分级不能为空", trigger: "blur" }],
MEASURES: [{ required: true, message: "管控措施不能为空", trigger: "blur" }],
EME_MEASURES: [
{ required: true, message: "应急处置措施不能为空", trigger: "blur" },
],
ACCIDENTS: [
{ required: true, message: "事故类型不能为空", trigger: "change" },
],
};
const formRef = ref(null);
const unitList = ref([]);
const partsList = ref([]);
const controlList2 = ref([]);
const controlList1 = await layoutFnGetControlMeasures1();
const controlList2All = await layoutFnGetControlMeasures2();
const fnGetUnitList = async () => {
const resData = await getRiskPointListAllById({
DEPARTMENT_ID: form.value.DEPARTMENT_ID,
});
unitList.value = resData.unitList;
};
const fnGetPartsList = async () => {
const resData = await getIdentifyingPartsListAll({
RISK_UNIT_ID: form.value.RISK_UNIT_ID,
});
partsList.value = resData.partsList;
};
const fnDepartmentChange = () => {
form.value.RISK_UNIT_ID = "";
form.value.IDENTIFICATION_ID = "";
unitList.value = [];
partsList.value = [];
};
const fnRiskUnitChange = () => {
form.value.IDENTIFICATION_ID = "";
partsList.value = [];
};
const accidentTypeList = await layoutFnGetAccidentType();
const fnGetLevelName = (LIKELIHOOD, EXPOSURE, CONSEQUENCE) => {
const DANGER = (LIKELIHOOD * EXPOSURE * CONSEQUENCE).toFixed(2);
if (DANGER > 320) {
form.value.LEVELID = "levelA";
form.value.LEVEL_NAME = "重大风险/A级";
} else if (DANGER > 160) {
form.value.LEVELID = "levelB";
form.value.LEVEL_NAME = "较大风险/B级";
} else if (DANGER > 70) {
form.value.LEVELID = "levelC";
form.value.LEVEL_NAME = "一般风险/C级";
} else {
form.value.LEVELID = "levelD";
form.value.LEVEL_NAME = "低风险/D级";
}
form.value.DANGER = DANGER;
};
watch(
[
() => props.form.LIKELIHOOD,
() => props.form.EXPOSURE,
() => props.form.CONSEQUENCE,
],
([LIKELIHOOD, EXPOSURE, CONSEQUENCE]) => {
if (!LIKELIHOOD || !EXPOSURE || !CONSEQUENCE) return;
fnGetLevelName(LIKELIHOOD, EXPOSURE, CONSEQUENCE);
}
);
watchEffect(() => {
if (form.value.DEPARTMENT_ID) fnGetUnitList();
if (form.value.RISK_UNIT_ID) fnGetPartsList();
if (form.value.MANAGEMENT_CONTROL_ONE) fnControlList1Change();
});
const fnControlList1Change = () => {
controlList2.value = [];
const id = form.value.MANAGEMENT_CONTROL_ONE;
let BZ = "";
for (let i = 0; i < controlList1.value.length; i++) {
if (controlList1.value[i].id === id) {
BZ = controlList1.value[i].BZ;
break;
}
}
for (let i = 0; i < controlList2All.value.length; i++) {
if (controlList2All.value[i].TBFIELD === BZ) {
controlList2.value.push(controlList2All.value[i]);
}
}
};
const riskAddRef = ref(null);
const fnClose = () => {
formRef.value.resetFields();
riskAddRef.value.reset();
visible.value = false;
};
const fnSubmit = debounce(
1000,
async () => {
await useFormValidate(formRef);
const ACCIDENTS_NAME = accidentTypeList.value
.filter((item) => form.value.ACCIDENTS.includes(item.BIANMA))
.map((item) => item.NAME)
.join(",");
await riskAddRef.value.formValidate();
const params = {
...form.value,
CHECK_CONTENT: form.value.MEASURES,
ACCIDENTS: form.value.ACCIDENTS.join(","),
ACCIDENTS_NAME,
ACCIDENTS_NAME: riskAddRef.value.accidentsName(),
};
let resData = {};
if (props.type === "add") resData = await setRiskControlLedgerAdd(params);

View File

@ -172,6 +172,7 @@
<add
v-model:visible="data.addOrEditDialog.visible"
v-model:form="data.addOrEditDialog.form"
control
:type="data.addOrEditDialog.type"
@get-data="fnResetPaginationTransfer"
/>