隐患清单排查状态变更

pull/1/head
dearlin 2024-02-04 11:42:56 +08:00
parent ecf918bc38
commit 2dfe2e9ee7
3 changed files with 78 additions and 55 deletions

View File

@ -2,6 +2,11 @@
<el-dialog v-model="visible" title="检查照片" :on-close="fnClose"> <el-dialog v-model="visible" title="检查照片" :on-close="fnClose">
<el-form ref="formRef" :model="form" label-width="100px"> <el-form ref="formRef" :model="form" label-width="100px">
<el-row> <el-row>
<el-col v-if="writeresults" :span="24">
<el-form-item label="检查结果" prop="CHECK_RESULT">
<el-input v-model="form.CHECK_RESULT" placeholder="请输入检查结果" />
</el-form-item>
</el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="检查照片" prop="file"> <el-form-item label="检查照片" prop="file">
<layout-upload <layout-upload
@ -46,8 +51,18 @@ const props = defineProps({
required: true, required: true,
default: "", default: "",
}, },
writeresults: {
type: Boolean,
required: false,
default: false,
},
index: {
type: Number,
required: false,
default: 0,
},
}); });
const emits = defineEmits(["update:visible", "update:form"]); const emits = defineEmits(["update:visible", "update:form", "submit"]);
const { visible, form } = useVModels(props, emits); const { visible, form } = useVModels(props, emits);
const formRef = ref(null); const formRef = ref(null);
const fnClose = () => { const fnClose = () => {
@ -65,6 +80,7 @@ const fnSubmit = debounce(
formData.append("FOREIGN_KEY", props.id); formData.append("FOREIGN_KEY", props.id);
formData.append("TYPE", 14); formData.append("TYPE", 14);
await setUploadImg(formData); await setUploadImg(formData);
emits("submit", form.value.CHECK_RESULT, props.index);
fnClose(); fnClose();
ElMessage.success("保存成功"); ElMessage.success("保存成功");
}, },

View File

@ -97,7 +97,7 @@ const fnSubmit = debounce(
if (props.hiddenType === "unqualified") { if (props.hiddenType === "unqualified") {
if (!props.longitude && !props.latitude) { if (!props.longitude && !props.latitude) {
ElMessage.error("正在获取当前位置中,请等待"); ElMessage.error("正在获取当前位置中,请等待");
return; // return;
} }
params = { params = {
...params, ...params,
@ -144,7 +144,7 @@ const fnSubmit = debounce(
if (form.value.rectifyImgs[i].raw) if (form.value.rectifyImgs[i].raw)
await fnUploadImage(currentHiddenId, form.value.rectifyImgs[i].raw, 4); await fnUploadImage(currentHiddenId, form.value.rectifyImgs[i].raw, 4);
} }
emits("submit", currentHiddenId); emits("submit", currentHiddenId, form.value.HIDDENDESCR);
ElMessage.success("保存成功"); ElMessage.success("保存成功");
fnClose(); fnClose();
}, },

View File

@ -44,16 +44,8 @@
<el-table-column prop="CHECK_RESULT" label="检查结果" /> <el-table-column prop="CHECK_RESULT" label="检查结果" />
<el-table-column label="操作" width="280"> <el-table-column label="操作" width="280">
<template v-slot="{ row, $index }"> <template v-slot="{ row, $index }">
<el-radio-group <el-radio-group :disabled="row.HASHIDDEN > 0" v-model="row.ISNORMAL">
v-if="data.canDoCheck" <el-radio :label="0" @click.prevent="fnQualified($index, row)">
:disabled="row.HASHIDDEN > 0"
v-model="row.ISNORMAL"
>
<el-radio
:label="0"
:disabled="!data.canDoCheck"
@click.prevent="fnQualified($index, row)"
>
合格 合格
<el-tooltip <el-tooltip
content="注意:补录时,不允许添加隐患" content="注意:补录时,不允许添加隐患"
@ -63,18 +55,10 @@
<el-icon><warning-filled /></el-icon> <el-icon><warning-filled /></el-icon>
</el-tooltip> </el-tooltip>
</el-radio> </el-radio>
<el-radio <el-radio :label="1" @click.prevent="fnUnqualified($index, row)">
:label="1"
:disabled="entrance === 'supplementaryRecording'"
@click.prevent="fnUnqualified($index, row)"
>
不合格 不合格
</el-radio> </el-radio>
<el-radio <el-radio :label="2" @click.prevent="fnNotInvolved($index, row)">
:label="2"
:disabled="entrance === 'supplementaryRecording'"
@click.prevent="fnNotInvolved($index, row)"
>
不涉及 不涉及
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
@ -83,15 +67,9 @@
</layout-table> </layout-table>
<el-divider content-position="left">其他隐患</el-divider> <el-divider content-position="left">其他隐患</el-divider>
<div class="tr mb-10"> <div class="tr mb-10">
<el-button <el-button type="primary" @click="fnAddOrEditOtherHidden({}, 'add')">
v-if="data.canDoCheck"
type="primary"
@click="fnAddOrEditOtherHidden({}, 'add')"
:disabled="entrance === 'supplementaryRecording'"
>
添加 添加
</el-button> </el-button>
<el-button disabled v-else type="primary">添加</el-button>
</div> </div>
<layout-table :data="otherHiddenList" :show-pagination="false"> <layout-table :data="otherHiddenList" :show-pagination="false">
<el-table-column label="序号" width="70" type="index" /> <el-table-column label="序号" width="70" type="index" />
@ -100,7 +78,6 @@
<template v-slot="{ row }"> <template v-slot="{ row }">
<el-button <el-button
type="primary" type="primary"
:disabled="data.canDoCheck"
text text
link link
@click="fnAddOrEditOtherHidden(row, 'edit')" @click="fnAddOrEditOtherHidden(row, 'edit')"
@ -109,7 +86,6 @@
</el-button> </el-button>
<el-button <el-button
type="primary" type="primary"
:disabled="data.canDoCheck"
text text
link link
@click="fnDeleteOtherHidden(row.HIDDEN_ID)" @click="fnDeleteOtherHidden(row.HIDDEN_ID)"
@ -228,26 +204,27 @@
</el-row> </el-row>
</el-form> </el-form>
<div class="tc mt-10"> <div class="tc mt-10">
<el-button :disabled="!data.canDoCheck" type="primary" @click="fnSubmit" <el-button type="primary" @click="fnSubmit"></el-button>
>保存</el-button
>
</div> </div>
<qualified <qualified
v-model:visible="data.qualifiedDialog.visible" v-model:visible="data.qualifiedDialog.visible"
v-model:form="data.qualifiedDialog.form" v-model:form="data.qualifiedDialog.form"
:id="data.qualifiedDialog.RECORDITEM_ID" :id="data.qualifiedDialog.RECORDITEM_ID"
:index="data.qualifiedDialog.index"
:writeresults="data.qualifiedDialog.writeresults"
@submit="fnResultsSubmit"
/>
<un-qualified
v-model:visible="data.unQualifiedDialog.visible"
v-model:form="data.unQualifiedDialog.form"
:list-manager-id="ID"
:type="data.unQualifiedDialog.type"
:hidden-type="data.unQualifiedDialog.hiddenType"
:info="{ ...data.unQualifiedDialog.info, ...info.value }"
:longitude="data.longitude"
:latitude="data.latitude"
@submit="fnHiddenSubmit"
/> />
<!-- <un-qualified-->
<!-- v-model:visible="data.unQualifiedDialog.visible"-->
<!-- v-model:form="data.unQualifiedDialog.form"-->
<!-- :type="data.unQualifiedDialog.type"-->
<!-- :hidden-type="data.unQualifiedDialog.hiddenType"-->
<!-- :custom-id="CUSTOM_ID"-->
<!-- :info="{ ...data.unQualifiedDialog.info, ...info.value }"-->
<!-- :longitude="data.longitude"-->
<!-- :latitude="data.latitude"-->
<!-- @submit="fnHiddenSubmit"-->
<!-- />-->
</layout-card> </layout-card>
</template> </template>
@ -264,6 +241,8 @@ import {
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import useListData from "@/assets/js/useListData.js"; import useListData from "@/assets/js/useListData.js";
import LayoutDepartment from "@/components/department/index.vue"; import LayoutDepartment from "@/components/department/index.vue";
import UnQualified from "./components/un_qualified.vue";
import { import {
addingPrefixToFile, addingPrefixToFile,
getFileSuffix, getFileSuffix,
@ -298,8 +277,6 @@ const info = ref({});
const data = reactive({ const data = reactive({
longitude: 0, longitude: 0,
latitude: 0, latitude: 0,
//
canDoCheck: true,
form: { form: {
CHECK_TIME: "", CHECK_TIME: "",
REASON: "", REASON: "",
@ -307,6 +284,8 @@ const data = reactive({
}, },
qualifiedDialog: { qualifiedDialog: {
visible: false, visible: false,
writeresults: false,
index: 0,
RECORDITEM_ID: "", RECORDITEM_ID: "",
form: { file: [] }, form: { file: [] },
}, },
@ -338,11 +317,8 @@ const { list: inspectionList } = useListData(getCheckStandardManagementView, {
usePagination: false, usePagination: false,
callbackFn: (list, resData) => { callbackFn: (list, resData) => {
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
if (list[i].HASHIDDEN <= 0) list[i].ISNORMAL = 0; list[i].CHECK_RESULT = "不涉及";
if (list[i].ELECTRONIC_FENCE_ID) { if (list[i].HASHIDDEN <= 0) list[i].ISNORMAL = 2;
//
data.canDoCheck = false;
}
} }
info.value = resData.pd; info.value = resData.pd;
}, },
@ -368,6 +344,24 @@ onMounted(() => {
data.latitude = r.latitude; data.latitude = r.latitude;
}); });
}); });
const fnResultsSubmit = (CHECK_RESULT, index) => {
inspectionList.value[index].CHECK_RESULT = CHECK_RESULT;
};
const fnHiddenSubmit = (currentHiddenId, HIDDENDESCR) => {
const { hiddenType, index } = data.unQualifiedDialog;
if (hiddenType === "unqualified") {
inspectionList.value[index].ISNORMAL = 1;
inspectionList.value[index].HIDDEN_ID = currentHiddenId;
inspectionList.value[index].CHECK_RESULT = HIDDENDESCR;
inspectionList.value[index].CHECK_UNQUALIFIED = HIDDENDESCR;
nextTick();
}
if (hiddenType === "otherHidden") {
fnGetOtherHidden();
}
};
const fnDisabledDate = (time) => { const fnDisabledDate = (time) => {
if (DATEEND && DATESTART) if (DATEEND && DATESTART)
return ( return (
@ -376,10 +370,20 @@ const fnDisabledDate = (time) => {
); );
else return false; else return false;
}; };
//
const fnQualified = async (index, row) => { const fnQualified = async (index, row) => {
row.CHECK_RESULT = row.CHECK_QUALIFIED;
if (row.HASHIDDEN > 0) return; if (row.HASHIDDEN > 0) return;
// OPERATION_TYPE 1 2
if (row.OPERATION_TYPE === 1) {
row.CHECK_RESULT = row.CHECK_QUALIFIED;
data.qualifiedDialog.writeresults = false;
} else {
data.qualifiedDialog.writeresults = true;
data.qualifiedDialog.form.CHECK_RESULT =
row.CHECK_RESULT !== "不涉及" ? row.CHECK_RESULT : "";
}
data.qualifiedDialog.visible = true; data.qualifiedDialog.visible = true;
data.qualifiedDialog.index = index;
await nextTick(); await nextTick();
data.qualifiedDialog.RECORDITEM_ID = row.RECORDITEM_ID; data.qualifiedDialog.RECORDITEM_ID = row.RECORDITEM_ID;
if (row.ISNORMAL === 1) fnRemoveUnqualified(index); if (row.ISNORMAL === 1) fnRemoveUnqualified(index);
@ -392,16 +396,18 @@ const fnQualified = async (index, row) => {
} }
inspectionList.value[index].ISNORMAL = 0; inspectionList.value[index].ISNORMAL = 0;
}; };
//
const fnNotInvolved = (index, row) => { const fnNotInvolved = (index, row) => {
if (row.HASHIDDEN > 0 || props.entrance === "supplementaryRecording") return; if (row.HASHIDDEN > 0 || props.entrance === "supplementaryRecording") return;
fnRemoveUnqualified(index); fnRemoveUnqualified(index);
inspectionList.value[index].ISNORMAL = 2; inspectionList.value[index].ISNORMAL = 2;
row.CHECK_RESULT = "不涉及";
}; };
const fnRemoveUnqualified = (index) => { const fnRemoveUnqualified = (index) => {
inspectionList.value[index].HIDDEN_ID = ""; inspectionList.value[index].HIDDEN_ID = "";
}; };
const fnUnqualified = async (index, row) => { const fnUnqualified = async (index, row) => {
if (row.HASHIDDEN > 0 || props.entrance === "supplementaryRecording") return; if (row.HASHIDDEN > 0) return;
data.unQualifiedDialog.visible = true; data.unQualifiedDialog.visible = true;
await nextTick(); await nextTick();
if ( if (
@ -414,6 +420,7 @@ const fnUnqualified = async (index, row) => {
await fnGetHiddenDangerView(inspectionList.value[index].HIDDEN_ID); await fnGetHiddenDangerView(inspectionList.value[index].HIDDEN_ID);
} }
data.unQualifiedDialog.info = row; data.unQualifiedDialog.info = row;
data.unQualifiedDialog.form.HIDDENDESCR = row.CHECK_UNQUALIFIED;
data.unQualifiedDialog.index = index; data.unQualifiedDialog.index = index;
data.unQualifiedDialog.hiddenType = "unqualified"; data.unQualifiedDialog.hiddenType = "unqualified";
}; };