pull/1/head
z 2024-01-11 18:01:45 +08:00
parent 461d5e31e7
commit f12ae4a5bc
18 changed files with 1748 additions and 25 deletions

View File

@ -251,6 +251,60 @@ export default [
},
component: "hazard_investigation/inventory_management/add",
},
{
path: "/hazard_investigation/inventory_management/edit",
meta: {
title: "修改",
activeMenu: "/hazard_investigation/inventory_management",
},
component: "hazard_investigation/inventory_management/add",
},
{
path: "/hazard_investigation/inventory_management/inheritance_list",
meta: {
title: "继承清单",
activeMenu: "/hazard_investigation/inventory_management",
},
component: "hazard_investigation/inventory_management/add",
},
],
},
{
path: "/hazard_investigation/delete_inventory_management",
meta: { title: "删除清单管理", isSubMenu: false },
component: "children",
children: [
{
path: "",
component: "hazard_investigation/delete_inventory_management/index",
},
{
path: "/hazard_investigation/delete_inventory_management/view",
meta: {
title: "查看",
activeMenu: "/hazard_investigation/delete_inventory_management",
},
component: "hazard_investigation/delete_inventory_management/view",
},
],
},
{
path: "/hazard_investigation/inventory_troubleshooting",
meta: { title: "清单排查", isSubMenu: false },
component: "children",
children: [
{
path: "",
component: "hazard_investigation/inventory_troubleshooting/index",
},
{
path: "/hazard_investigation/inventory_troubleshooting/inspect",
meta: {
title: "开始检查",
activeMenu: "/hazard_investigation/inventory_troubleshooting",
},
component: "hazard_investigation/inventory_troubleshooting/inspect",
},
],
},
],

View File

@ -139,6 +139,27 @@ export const layoutFnGetTroubleshootingType = async () => {
});
return ref(resData.list);
};
// 隐患级别
export const layoutFnGetHazardLevel = async () => {
const resData = await getLevels({
DICTIONARIES_ID: "5e7cf8620ba54ad89719d0be62133c7a",
});
return ref(resData.list);
};
// 隐患类别
export const layoutFnGetHazardCategories = async () => {
const resData = await getLevels({
DICTIONARIES_ID: "ec1d6dcfd0f2438a88968feea542eab0",
});
return ref(resData.list);
};
// 各省隐患类型
export const layoutFnGetEveryProvinceHiddenDangerType = async () => {
const resData = await getLevels({
DICTIONARIES_ID: "3babc15144444bdc8d763d0af2bdfff8",
});
return ref(resData.list);
};
// 排查周期
export const layoutFnGetTroubleshootingCycle = async () => {
const resData = await getLevels({

View File

@ -0,0 +1,48 @@
<template>
<el-cascader
ref="cascaderRef"
v-model="modelValue"
:options="hiddenDangerTypeList"
:props="{
value: 'id',
label: 'name',
children: 'nodes',
checkStrictly: true,
}"
/>
</template>
<script setup>
import { useVModel } from "@vueuse/core";
import { getHiddenDangerType } from "@/request/data_dictionary.js";
import { ref } from "vue";
defineOptions({
name: "LayoutHiddenDangerType",
});
const props = defineProps({
modelValue: {
type: [String, Array],
required: true,
default: "",
},
joinSeparator: {
type: String,
default: "/",
},
});
const emits = defineEmits(["update:modelValue"]);
const modelValue = useVModel(props, "modelValue", emits);
const cascaderRef = ref(null);
const getCheckedNodes = () => {
return cascaderRef.value
.getCheckedNodes()[0]
.pathLabels.join(props.joinSeparator);
};
defineExpose({
getCheckedNodes,
});
const hiddenDangerTypeList = await getHiddenDangerType();
</script>
<style scoped lang="scss"></style>

View File

@ -1,4 +1,7 @@
import { post } from "@/request/axios.js";
import { useUserStore } from "@/pinia/user.js";
import pinia from "@/pinia/index.js";
import { layoutFnGetEveryProvinceHiddenDangerType } from "@/assets/js/data_dictionary.js";
// 获取数据字典
export const getLevels = (params) =>
@ -54,3 +57,18 @@ export const getUserListAll = (params) =>
loading: false,
...params,
});
// 获取当前用户省隐患类型
export const getHiddenDangerType = async () => {
const userStore = useUserStore(pinia);
const { value } = await layoutFnGetEveryProvinceHiddenDangerType();
for (let i = 0; i < value.length; i++) {
if (value[i].BIANMA.indexOf(userStore.getUserInfo.PROVINCE) > -1) {
const resData = await post("/dictionaries/listAllDictToParId", {
parentId: value[i].DICTIONARIES_ID,
loading: false,
});
return JSON.parse(resData.zTreeNodes.replaceAll('"nodes":[],', ""));
}
}
};

View File

@ -24,3 +24,21 @@ export const getInventoryManagementInspectionItems = (params) =>
post("/riskcheckitem/itemlistAll", params); // 清单管理检查项列表
export const getInventoryManagementOtherRiskList = (params) =>
post("/riskcheckitem/list", params); // 清单管理选择其他存在风险列表
export const setInventoryManagementAdd = (params) =>
post("/listmanager/add", params); // 清单管理新增
export const setInventoryManagementEdit = (params) =>
post("/listmanager/edit", params); // 清单管理修改
export const getDeleteInventoryManagementList = (params) =>
post("/stoplistmanager/list", params); // 删除清单管理列表
export const setDeleteInventoryManagementRecovery = (params) =>
post("/stoplistmanager/restore", params); // 删除清单管理恢复
export const getInventoryTroubleshootingList = (params) =>
post("/listmanager/checkList", params); // 清单排查列表
export const getInventoryTroubleshootingOtherHiddenList = (params) =>
post("/hidden/getOtherHidden", params); // 清单排查其它隐患列表
export const getHiddenDangerDatabaseList = (params) =>
post("/hiddenLibrary/list", params); // 隐患数据库列表
export const setInventoryTroubleshootingOtherHiddenDangerAdd = (params) =>
post("/hidden/add", params); // 清单排查其它隐患添加
export const setInventoryTroubleshootingOtherHiddenDangerView = (params) =>
post("/hidden/goEdit", params); // 清单排查其它隐患查看

View File

@ -38,7 +38,7 @@
/>
</el-form-item>
</el-form>
<div class="tc mt">
<div class="tc mt-10">
<el-button type="primary" @click="fnSubmit"></el-button>
</div>
</layout-card>

View File

@ -0,0 +1,247 @@
<template>
<div>
<el-card>
<el-form
:model="searchForm"
label-width="90px"
@submit.prevent="fnResetPaginationTransfer"
>
<el-row>
<el-col :span="6">
<el-form-item label="清单名称" prop="KEYWORDS">
<el-input
v-model="searchForm.KEYWORDS"
placeholder="请输入关键字"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="人员" prop="USERNAME">
<el-input
v-model="searchForm.USERNAME"
placeholder="请输入关键字"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="部门" prop="DEPTIDS">
<layout-department
v-model="searchForm.DEPTIDS"
multiple
show-checkbox
collapse-tags
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="清单类型" prop="TYPE">
<el-select v-model="searchForm.TYPE">
<el-option
v-for="item in inventoryTypeList"
:key="item.BIANMA"
:label="item.NAME"
:value="item.BIANMA"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="排查类型" prop="RISKCHECKLISTTYPE">
<el-select v-model="searchForm.RISKCHECKLISTTYPE">
<el-option
v-for="item in troubleshootingTypeList"
:key="item.BIANMA"
:label="item.NAME"
:value="item.BIANMA"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="清单级别" prop="LISTINGLEVEL">
<el-select v-model="searchForm.LISTINGLEVEL">
<el-option
v-for="item in [
{ BIANMA: '1', NAME: '公司' },
...inventoryLevelList,
]"
:key="item.BIANMA"
:label="item.NAME"
:value="item.BIANMA"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label-width="10px">
<el-button type="primary" native-type="submit">搜索</el-button>
<el-button native-type="reset" @click="fnResetPaginationTransfer">
重置
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<layout-card>
<layout-table
ref="tableRef"
:data="list"
v-model:pagination="pagination"
@get-data="fnGetDataTransfer"
row-key="LISTMANAGER_ID"
>
<el-table-column reserve-selection type="selection" width="55" />
<el-table-column label="序号" width="70">
<template v-slot="{ $index }">
{{ serialNumber(pagination, $index) }}
</template>
</el-table-column>
<el-table-column prop="NAME" label="清单名称" />
<el-table-column prop="DEPARTMENT_NAME_ALL" label="部门" />
<el-table-column prop="POST_NAME" label="岗位" />
<el-table-column
prop="USER_NAME"
label="人员"
width="100"
show-overflow-tooltip
/>
<el-table-column
prop="PERIODNAME"
label="排查周期"
width="100"
show-overflow-tooltip
/>
<el-table-column
prop="SCREENTYPENAME"
label="排查类型"
width="100"
show-overflow-tooltip
/>
<el-table-column
prop="TYPENAME"
label="清单类型"
width="100"
show-overflow-tooltip
/>
<el-table-column
v-if="SPECIAL_ENTERPRISES.includes(CORPINFO_ID)"
prop="TASK_TYPE_NAME"
label="任务类型"
width="100"
show-overflow-tooltip
/>
<el-table-column label="状态" width="100">
<template #default> 已删除 </template>
</el-table-column>
<el-table-column label="操作" width="100">
<template v-slot="{ row }">
<el-button
type="primary"
text
link
@click="
router.push({
path: '/hazard_investigation/delete_inventory_management/view',
query: { LISTMANAGER_ID: row.LISTMANAGER_ID },
})
"
>
查看
</el-button>
<el-button
type="primary"
text
link
@click="fnRecovery(row.LISTMANAGER_ID)"
>
启用
</el-button>
</template>
</el-table-column>
<template #button>
<el-button
v-if="buttonJurisdiction.del"
type="danger"
@click="fnBatchDelete"
>
彻底删除
</el-button>
</template>
</layout-table>
</layout-card>
</div>
</template>
<script setup>
import { serialNumber } from "@/assets/js/utils.js";
import useListData from "@/assets/js/useListData.js";
import LayoutDepartment from "@/components/department/index.vue";
import { debounce } from "throttle-debounce";
import { ElMessage, ElMessageBox } from "element-plus";
import useButtonJurisdiction from "@/assets/js/useButtonJurisdiction.js";
import {
layoutFnGetInventoryLevel,
layoutFnGetInventoryType,
layoutFnGetTroubleshootingType,
} from "@/assets/js/data_dictionary.js";
import { SPECIAL_ENTERPRISES } from "@/assets/js/constant.js";
import { useUserStore } from "@/pinia/user.js";
import {
getDeleteInventoryManagementList,
setDeleteInventoryManagementRecovery,
setInventoryManagementBatchDelete,
} from "@/request/hazard_investigation.js";
import { useRouter } from "vue-router";
const router = useRouter();
const { list, pagination, searchForm, fnGetData, fnResetPagination, tableRef } =
useListData(getDeleteInventoryManagementList);
const userStore = useUserStore();
const CORPINFO_ID = userStore.getUserInfo.CORPINFO_ID;
const buttonJurisdiction = await useButtonJurisdiction("stoplistmanager");
const inventoryTypeList = await layoutFnGetInventoryType();
const troubleshootingTypeList = await layoutFnGetTroubleshootingType();
const inventoryLevelList = await layoutFnGetInventoryLevel();
const fnGetDataTransfer = () => {
fnGetData({
DEPTIDS: searchForm.value.DEPTIDS?.join(","),
});
};
const fnResetPaginationTransfer = () => {
fnResetPagination({
DEPTIDS: searchForm.value.DEPTIDS?.join(","),
});
};
const fnRecovery = debounce(
1000,
async (LISTMANAGER_ID) => {
await ElMessageBox.confirm("确定要恢复吗?", { type: "warning" });
await setDeleteInventoryManagementRecovery({ LISTMANAGER_ID });
ElMessage.success("恢复成功");
fnResetPaginationTransfer();
},
{ atBegin: true }
);
const fnBatchDelete = debounce(
1000,
async () => {
const selectionData = tableRef.value.getSelectionRows();
if (selectionData.length === 0) {
ElMessage.warning("请选中要删除的项");
return;
}
await ElMessageBox.confirm(
"删除之后该清单无法恢复,确认要删除选中的数据吗?",
{ type: "warning" }
);
const DATA_IDS = selectionData.map((item) => item.LISTMANAGER_ID).join(",");
await setInventoryManagementBatchDelete({ DATA_IDS });
ElMessage.success("删除成功");
fnResetPaginationTransfer();
},
{ atBegin: true }
);
</script>
<style scoped></style>

View File

@ -0,0 +1,73 @@
<template>
<layout-card>
<el-divider content-position="left">清单信息</el-divider>
<el-descriptions :column="2" border>
<el-descriptions-item label="清单名称">
{{ info.NAME }}
</el-descriptions-item>
<el-descriptions-item label="是否包保责任人任务">
<span v-if="info.BAO_BAO_TYPE === '0'"></span>
<span v-if="info.BAO_BAO_TYPE === '1'"></span>
</el-descriptions-item>
<el-descriptions-item label="任务类型" v-if="info.BAO_BAO_TYPE === '1'">
{{ info.TASK_TYPE_NAME }}
</el-descriptions-item>
<el-descriptions-item label="部门">
{{ info.DEPARTMENT_NAME }}
</el-descriptions-item>
<el-descriptions-item label="岗位">
{{ info.POST_NAME }}
</el-descriptions-item>
<el-descriptions-item label="负责人">
{{ info.USER_NAME }}
</el-descriptions-item>
<el-descriptions-item label="排查类型">
{{ info.SCREENTYPENAME }}
</el-descriptions-item>
<el-descriptions-item label="排查周期">
{{ info.PERIODNAME }}
</el-descriptions-item>
<el-descriptions-item label="清单类型">
{{ info.TYPENAME }}
</el-descriptions-item>
<el-descriptions-item
label="排查日期"
v-if="info.TYPE === 'listType0005'"
>
{{ info.START_DATE }} - {{ info.END_DATE }}
</el-descriptions-item>
</el-descriptions>
<el-divider content-position="left">检查内容</el-divider>
<layout-table :data="list" :show-pagination="false">
<el-table-column type="index" label="序号" width="55" />
<el-table-column prop="RISKUNITNAME" label="风险点(单元)" width="180" />
<el-table-column prop="PARTSNAME" label="辨识部位" width="180" />
<el-table-column prop="RISK_DESCR" label="存在风险" width="300" />
<el-table-column prop="DNAME5" label="风险分级" width="180" />
<el-table-column prop="USERNAME" label="管控负责人" width="180" />
<el-table-column prop="CHECK_CONTENT" label="检查内容" />
</layout-table>
</layout-card>
</template>
<script setup>
import { useRoute } from "vue-router";
import useListData from "@/assets/js/useListData.js";
import { getInventoryManagementView } from "@/request/hazard_investigation.js";
import { ref } from "vue";
const route = useRoute();
const { LISTMANAGER_ID } = route.query;
const info = ref({});
const { list } = useListData(getInventoryManagementView, {
otherParams: { LISTMANAGER_ID },
usePagination: false,
callbackFn: (list, responseData) => {
info.value = responseData.pd;
},
});
console.log(list);
console.log(info);
</script>
<style scoped lang="scss"></style>

View File

@ -155,12 +155,12 @@
<el-divider content-position="left">检查内容</el-divider>
<el-form
:model="data.searchForm"
label-width="130px"
label-width="60px"
@submit.prevent="fnGetDataFilter"
>
<el-row>
<el-col :span="6">
<el-form-item label="风险点/辨识部位" prop="KEYWORDS">
<el-form-item label="关键字" prop="KEYWORDS">
<el-input
v-model="data.searchForm.KEYWORDS"
placeholder="请输入内容"
@ -220,7 +220,16 @@
:control="false"
@get-data="fnAddRiskSubmit"
/>
<select-risk v-model:visible="data.selectRiskDialogVisible" />
<select-risk
v-model:visible="data.selectRiskDialogVisible"
:list-data="data.listAll"
@submit="fnSelectRiskSubmit"
/>
<add-inspection-route
v-model:visible="data.inspectionRouteDialog.visible"
v-model:list="data.inspectionRouteDialog.list"
@submit="fnInspectionRouteSubmit"
/>
</layout-card>
</template>
@ -237,12 +246,18 @@ import {
import LayoutDepartment from "@/components/department/index.vue";
import { getPostListAll, getUserListAll } from "@/request/data_dictionary.js";
import { useRoute, useRouter } from "vue-router";
import { getInventoryManagementInspectionItems } from "@/request/hazard_investigation.js";
import {
getInventoryManagementInspectionItems,
getInventoryManagementView,
setInventoryManagementAdd,
setInventoryManagementEdit,
} from "@/request/hazard_investigation.js";
import { debounce } from "throttle-debounce";
import useFormValidate from "@/assets/js/useFormValidate.js";
import { ElMessage } from "element-plus";
import AddRisk from "@/views/risk_control/ledger/components/add.vue";
import SelectRisk from "./components/select_risk.vue";
import AddInspectionRoute from "./components/add_inspection_route.vue";
const route = useRoute();
const router = useRouter();
@ -314,19 +329,32 @@ const data = reactive({
EME_MEASURES: "",
},
},
inspectionRouteDialog: {
visible: false,
list: [],
},
});
const taskTypeList = await layoutFnGetTaskType();
const troubleshootingTypeList = await layoutFnGetTroubleshootingType();
const troubleshootingCycleList = await layoutFnGetTroubleshootingCycle();
const inventoryTypeList = await layoutFnGetInventoryType();
const fnGetData = async () => {
if (!LISTMANAGER_ID) return;
const resData = await getInventoryManagementView({ LISTMANAGER_ID });
data.form = resData.pd;
data.form.dates = [resData.pd.START_DATE, resData.pd.END_DATE];
data.list = resData.varList;
data.listAll = resData.varList;
};
fnGetData();
const fnGetInspectionItems = async () => {
const resData = await getInventoryManagementInspectionItems({
DEPARTMENT_ID: data.form.DEPARTMENT_ID,
POST_ID: data.form.POST_ID,
});
data.list = [...tableRef.value.getSelectionRows(), ...resData.varList];
data.listAll = [...tableRef.value.getSelectionRows(), ...resData.varList];
fnTableSelection();
await fnTableSelection();
};
const fnDepartmentChange = () => {
data.postList = [];
@ -339,7 +367,7 @@ const fnPostChange = () => {
data.userList = [];
data.form.USER_IDS = [];
data.form.USER_ID = "";
fnGetData();
fnGetInspectionItems();
};
const fnGetPost = async (DEPARTMENT_ID) => {
const resData = await getPostListAll({ DEPARTMENT_ID });
@ -357,8 +385,9 @@ const fnGetDataFilter = () => {
if (keyword) {
data.list = data.listAll.filter(
(item) =>
item.RISKUNITNAME.indexOf(keyword) > -1 ||
item.PARTSNAME.indexOf(keyword) > -1
item.RISKUNITNAME?.indexOf(keyword) > -1 ||
item.PARTSNAME?.indexOf(keyword) > -1 ||
item.USERNAME?.indexOf(keyword) > -1
);
} else {
data.list = data.listAll;
@ -372,14 +401,56 @@ const fnTableSelection = async () => {
tableRef.value.toggleRowSelection(item, true);
});
};
const fnAddRiskSubmit = (row) => {
data.list.push(row);
data.listAll.push(row);
const fnAddRiskSubmit = (item) => {
data.list.push(item);
data.listAll.push(item);
fnTableSelection();
};
const fnSubmit = debounce(
const fnSelectRiskSubmit = (listData) => {
data.list.push(...listData);
data.listAll.push(...listData);
fnTableSelection();
};
const fnSubmit = async () => {
await useFormValidate(formRef);
const selectionData = tableRef.value.getSelectionRows();
if (selectionData.length === 0) {
ElMessage.error("请选择检查内容");
return;
}
const allParts = [];
const allPartIds = [];
selectionData.forEach((item) => {
if (!allPartIds.includes(item.IDENTIFICATIONPARTS_ID)) {
allPartIds.push(item.IDENTIFICATIONPARTS_ID);
const part = {
ID: item.IDENTIFICATIONPARTS_ID,
NAME: item.PARTSNAME,
};
allParts.push(part);
}
});
data.inspectionRouteDialog.list = allParts;
data.inspectionRouteDialog.visible = true;
};
const fnInspectionRouteSubmit = debounce(
1000,
async () => {
await useFormValidate(formRef);
const selectionData = tableRef.value.getSelectionRows();
const params = {
...data.form,
USER_IDS: data.form.USER_IDS?.join(","),
LISTITEM: JSON.stringify(selectionData),
ROUTE: JSON.stringify(data.inspectionRouteDialog.list),
BAO_BAO_DEPARTMENT_ID: data.form.DEPARTMENT_ID,
BAO_BAO_USER_ID: data.form.USER_ID,
START_DATE: data.form.dates[0],
END_DATE: data.form.dates[1],
BAO_BAO_TYPE: data.form.BAO_BAO_TYPE || "0",
};
!LISTMANAGER_ID
? await setInventoryManagementAdd(params)
: await setInventoryManagementEdit(params);
ElMessage.success("保存成功");
router.back();
},

View File

@ -0,0 +1,53 @@
<template>
<el-dialog v-model="visible" title="设置巡检路线">
<vue-draggable
v-model="list"
style="display: flex; flex-wrap: wrap; gap: 10px 0"
>
<div
style="display: flex; align-items: center; cursor: move"
v-for="(item, index) in list"
:key="item.ID"
>
<el-tag>{{ index + 1 }}.{{ item.NAME }}</el-tag>
<el-icon v-if="index < list.length - 1">
<Right />
</el-icon>
</div>
</vue-draggable>
<template #footer>
<el-button @click="fnClose"></el-button>
<el-button type="primary" @click="fnSubmit"></el-button>
</template>
</el-dialog>
</template>
<script setup>
import { Right } from "@element-plus/icons-vue";
import { useVModels } from "@vueuse/core";
import { VueDraggable } from "vue-draggable-plus";
const props = defineProps({
visible: {
type: Boolean,
required: true,
default: false,
},
list: {
type: Array,
required: true,
default: () => [],
},
});
const emits = defineEmits(["update:visible", "update:list", "submit"]);
const { visible, list } = useVModels(props, emits);
const fnClose = () => {
visible.value = false;
};
const fnSubmit = async () => {
emits("submit");
fnClose();
};
</script>
<style scoped lang="scss"></style>

View File

@ -25,7 +25,10 @@
{{ info.TYPENAME }}
</el-descriptions-item>
<el-descriptions-item label="设置巡检路线" :span="2">
<vue-draggable v-model="list" style="display: flex">
<vue-draggable
v-model="list"
style="display: flex; flex-wrap: wrap; gap: 10px 0"
>
<div
style="display: flex; align-items: center; cursor: move"
v-for="(item, index) in list"

View File

@ -2,16 +2,12 @@
<el-dialog title="选择其他存在风险" v-model="visible" width="1500">
<el-form
:model="searchForm"
label-width="90px"
label-width="60px"
@submit.prevent="fnResetPagination"
>
<el-row>
<el-col :span="6">
<el-form-item
label="风险点(单元)/辨识部位"
prop="KEYWORDS"
label-width="170px"
>
<el-form-item label="关键字" prop="KEYWORDS">
<el-input
v-model="searchForm.KEYWORDS"
placeholder="请输入关键字"
@ -81,6 +77,7 @@ import { getInventoryManagementOtherRiskList } from "@/request/hazard_investigat
import { watch } from "vue";
import { serialNumber } from "@/assets/js/utils.js";
import { layoutFnGetRiskClassification } from "@/assets/js/data_dictionary.js";
import { differenceWith } from "lodash-es";
const props = defineProps({
visible: {
@ -88,17 +85,23 @@ const props = defineProps({
required: true,
default: false,
},
listData: {
type: Array,
required: true,
default: () => [],
},
});
const emits = defineEmits(["update:visible"]);
const emits = defineEmits(["update:visible", "submit"]);
const visible = useVModel(props, "visible", emits);
const { list, searchForm, pagination, fnGetData, fnResetPagination, tableRef } =
useListData(getInventoryManagementOtherRiskList, { immediate: false });
const riskClassificationList = await layoutFnGetRiskClassification();
watch(
const stop = watch(
() => props.visible,
(value) => {
if (value) {
fnGetData();
stop && stop();
}
}
);
@ -108,6 +111,11 @@ const fnClose = () => {
const fnSubmit = debounce(
1000,
() => {
const selectionData = tableRef.value.getSelectionRows();
const listData = differenceWith(selectionData, props.listData, (a, b) => {
return a.RISKCHECKITEM_ID === b.RISKCHECKITEM_ID;
});
emits("submit", listData);
fnClose();
},
{ atBegin: true }

View File

@ -173,6 +173,12 @@
type="primary"
text
link
@click="
router.push({
path: '/hazard_investigation/inventory_management/edit',
query: { LISTMANAGER_ID: row.LISTMANAGER_ID },
})
"
>
修改
</el-button>
@ -251,7 +257,9 @@
>
批量删除
</el-button>
<el-button type="primary"> 继承清单 </el-button>
<el-button type="primary" @click="fnInheritanceList">
继承清单
</el-button>
</template>
</layout-table>
</layout-card>
@ -393,6 +401,23 @@ const fnBatchDelete = debounce(
},
{ atBegin: true }
);
const fnInheritanceList = () => {
const selectionData = tableRef.value.getSelectionRows();
if (selectionData.length === 0) {
ElMessage.warning("请选中要继承的清单");
return;
}
if (selectionData.length > 1) {
ElMessage.warning("只能选择一个清单");
return;
}
router.push({
path: "/hazard_investigation/inventory_management/inheritance_list",
query: {
LISTMANAGER_ID: selectionData[0].LISTMANAGER_ID,
},
});
};
</script>
<style scoped></style>

View File

@ -0,0 +1,75 @@
<template>
<el-dialog v-model="visible" title="检查照片" :on-close="fnClose">
<el-form ref="formRef" :model="form" label-width="100px">
<el-row>
<el-col :span="24">
<el-form-item label="检查照片" prop="file">
<layout-upload
v-model:file-list="form.file"
:limit="99"
list-type="picture-card"
accept=".jpg,.jpeg,.png"
delete-to-server
/>
</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 } from "vue";
import LayoutUpload from "@/components/upload/index.vue";
import { useVModels } from "@vueuse/core";
import { debounce } from "throttle-debounce";
import { setUploadImg } from "@/request/api.js";
import { ElMessage } from "element-plus";
const props = defineProps({
visible: {
type: Boolean,
required: true,
default: false,
},
form: {
type: Object,
required: true,
default: () => ({}),
},
id: {
type: String,
required: true,
default: "",
},
});
const emits = defineEmits(["update:visible", "update:form"]);
const { visible, form } = useVModels(props, emits);
const formRef = ref(null);
const fnClose = () => {
formRef.value.resetFields();
visible.value = false;
};
const fnSubmit = debounce(
1000,
async () => {
const formData = new FormData();
for (let i = 0; i < form.value.file.length; i++) {
if (form.value.file[i].raw)
formData.append("FFILE", form.value.file[i].raw);
}
formData.append("FOREIGN_KEY", props.id);
formData.append("TYPE", 14);
await setUploadImg(formData);
fnClose();
ElMessage.success("保存成功");
},
{ atBegin: true }
);
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,424 @@
<template>
<el-dialog
v-model="visible"
:title="type === 'add' ? '修改隐患' : '添加隐患'"
:on-close="fnClose"
width="1200"
>
<el-row :gutter="24">
<el-col :span="12">
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="24" v-if="hiddenType === 'unqualified'">
<el-form-item label="检查内容" prop="CHECK_CONTENT">
<el-input
:model-value="info.CHECK_CONTENT"
disabled
type="textarea"
autosize
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="隐患部位" prop="HIDDENPART">
<el-input
v-model="form.HIDDENPART"
placeholder="请输入内容"
@blur="fnGetHiddenDangerDatabaseList"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="隐患描述" prop="HIDDENDESCR">
<el-input v-model="form.HIDDENDESCR" placeholder="请输入内容" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="隐患级别" prop="HIDDENLEVEL">
<el-select
v-model="form.HIDDENLEVEL"
@change="
form.HIDDENLEVEL === 'hiddenLevel0002'
? (form.RECTIFICATIONTYPE = '2')
: null
"
>
<el-option
v-for="item in hazardLevelList"
:key="item.BIANMA"
:label="item.NAME"
:value="item.BIANMA"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" v-if="info.BAO_BAO_TYPE === '1'">
<el-form-item label="隐患类别" prop="HIDDEN_CATEGORY">
<el-select v-model="form.HIDDEN_CATEGORY">
<el-option
v-for="item in hazardCategoriesList"
:key="item.DICTIONARIES_ID"
:label="item.NAME"
:value="item.DICTIONARIES_ID"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="隐患类型" prop="HIDDENTYPE">
<layout-hidden-danger-type
v-model="form.HIDDENTYPE"
ref="hiddenDangerTypeRef"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="隐患图片" prop="hiddenImgs">
<layout-upload
v-model:file-list="form.hiddenImgs"
list-type="picture-card"
accept=".jpg,.jpeg,.png"
:limit="99"
delete-to-server
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="隐患视频" prop="videoFiles">
<layout-upload
v-model:file-list="form.videoFiles"
accept=".mp4"
:size="50"
@preview="fnVideoPreview"
>
<template #tip>只能上传mp4文件且不超过50M</template>
</layout-upload>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="隐患处置" prop="RECTIFICATIONTYPE">
<el-radio-group v-model="form.RECTIFICATIONTYPE">
<el-radio
:disabled="form.HIDDENLEVEL === 'hiddenLevel0002'"
label="1"
>
立即整改
</el-radio>
<el-radio label="2">限期整改</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<template v-if="form.RECTIFICATIONTYPE === '1'">
<el-col :span="24">
<el-form-item prop="RECTIFYDESCR" label="整改描述">
<el-input
v-model="form.RECTIFYDESCR"
placeholder="请输入内容"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="整改后图片" prop="rectifyImgs">
<layout-upload
v-model:file-list="form.rectifyImgs"
list-type="picture-card"
accept=".jpg,.jpeg,.png"
:limit="99"
delete-to-server
/>
</el-form-item>
</el-col>
</template>
<template v-if="form.RECTIFICATIONTYPE === '2'">
<el-col :span="24">
<el-form-item prop="RECTIFICATIONDEADLINE" label="整改期限">
<el-date-picker
v-model="form.RECTIFICATIONDEADLINE"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
type="date"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="整改部门" prop="RECTIFICATIONDEPT">
<layout-department
v-model="form.RECTIFICATIONDEPT"
@update:model-value="form.RECTIFICATIONOR = ''"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="整改人" prop="RECTIFICATIONOR">
<el-select v-model="form.RECTIFICATIONOR">
<el-option
v-for="item in data.rectifyUserList"
:key="item.USER_ID"
:label="item.NAME"
:value="item.USER_ID"
/>
</el-select>
</el-form-item>
</el-col>
</template>
</el-row>
</el-form>
</el-col>
<el-col :span="12">
<div
v-for="item in data.list"
:key="item.HIDDEN_LIBRARY_ID"
class="item"
@click="fnChoice(item)"
>
<el-descriptions :column="1" border>
<el-descriptions-item label="风险单元名称">
{{ item.RISK_UNIT_NAME }}
</el-descriptions-item>
<el-descriptions-item label="隐患部位">
{{ item.HIDDEN_PART }}
</el-descriptions-item>
<el-descriptions-item label="隐患描述">
{{ item.INSPECTION_BASIS }}
</el-descriptions-item>
</el-descriptions>
</div>
</el-col>
</el-row>
<template #footer>
<el-button @click="fnClose"></el-button>
<el-button type="primary" @click="fnSubmit"></el-button>
</template>
</el-dialog>
<layout-video
v-model:visible="data.videoDialog.visible"
:src="data.videoDialog.src"
/>
</template>
<script setup>
import { reactive, ref, watchEffect } from "vue";
import LayoutUpload from "@/components/upload/index.vue";
import { useVModels } from "@vueuse/core";
import { debounce } from "throttle-debounce";
import { ElLoading, ElMessage } from "element-plus";
import {
getHiddenDangerDatabaseList,
setInventoryTroubleshootingOtherHiddenDangerAdd,
} from "@/request/hazard_investigation.js";
import {
layoutFnGetHazardCategories,
layoutFnGetHazardLevel,
} from "@/assets/js/data_dictionary.js";
import LayoutHiddenDangerType from "@/components/hazard_type/index.vue";
import LayoutVideo from "@/components/video/index.vue";
import LayoutDepartment from "@/components/department/index.vue";
import { getUserListAll } from "@/request/data_dictionary.js";
import useFormValidate from "@/assets/js/useFormValidate.js";
import { setUploadImg } from "@/request/api.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: String,
required: true,
default: "",
},
hiddenType: {
type: String,
required: true,
default: "",
},
listManagerId: {
type: String,
required: true,
default: "",
},
});
const emits = defineEmits(["update:visible", "update:form", "submit"]);
const { visible, form } = useVModels(props, emits);
const rules = {
HIDDENPART: [{ required: true, message: "请输入隐患部位", trigger: "blur" }],
HIDDENDESCR: [{ required: true, message: "请输入隐患描述", trigger: "blur" }],
HIDDENLEVEL: [
{ required: true, message: "请选择隐患级别", trigger: "change" },
],
HIDDEN_CATEGORY: [
{ required: true, message: "请选择隐患类别", trigger: "change" },
],
HIDDENTYPE: [
{ required: true, message: "请选择隐患类型", trigger: "change" },
],
hiddenImgs: [
{ required: true, message: "请上传隐患图片", trigger: "change" },
],
RECTIFICATIONTYPE: [
{ required: true, message: "请选择隐患处置", trigger: "change" },
],
RECTIFYDESCR: [
{ required: true, message: "请输入整改描述", trigger: "blur" },
],
rectifyImgs: [
{ required: true, message: "请上传整改后图片", trigger: "change" },
],
RECTIFICATIONDEADLINE: [
{ required: true, message: "请选择整改期限", trigger: "change" },
],
RECTIFICATIONDEPT: [
{ required: true, message: "请选择整改部门", trigger: "change" },
],
RECTIFICATIONOR: [
{ required: true, message: "请选择整改人", trigger: "change" },
],
};
const formRef = ref(null);
const hiddenDangerTypeRef = ref(null);
const data = reactive({
list: [],
rectifyUserList: [],
videoDialog: {
visible: false,
src: "",
},
});
const hazardLevelList = await layoutFnGetHazardLevel();
const hazardCategoriesList = await layoutFnGetHazardCategories();
const fnGetHiddenDangerDatabaseList = async () => {
if (!form.value.HIDDENPART) return;
const resData = await getHiddenDangerDatabaseList({
RISK_UNIT_NAME: props.info.RISKUNITNAME,
HIDDEN_PART: form.value.HIDDENPART,
});
data.list = resData.varList;
};
const fnChoice = (item) => {
form.value.HIDDENPART = item.HIDDEN_PART;
form.value.HIDDENDESCR = item.INSPECTION_BASIS;
form.value.HIDDENLEVEL = "hiddenLevel0001";
form.value.HIDDENTYPE = [
item.HIDDEN_TYPE_ONE,
item.HIDDEN_TYPE_TWO,
item.HIDDEN_TYPE_THREE,
];
};
const fnVideoPreview = (event) => {
if (event.url) {
data.videoDialog.visible = true;
data.videoDialog.src = event.url;
}
};
const fnRectificationDepartmentChange = async (event) => {
const resData = await getUserListAll({
DEPARTMENT_ID: event,
});
data.rectifyUserList = resData.userList;
};
watchEffect(() => {
if (form.value.RECTIFICATIONDEPT)
fnRectificationDepartmentChange(form.value.RECTIFICATIONDEPT);
});
const fnClose = () => {
formRef.value.resetFields();
visible.value = false;
};
const fnSubmit = debounce(
1000,
async () => {
await useFormValidate(formRef);
const loading = ElLoading.service({
lock: true,
text: "加载中...",
background: "rgba(0, 0, 0, 0.5)",
});
const geolocation = new window.BMapGL.Geolocation();
geolocation.getCurrentPosition(async (r) => {
loading.close();
if (!r) {
ElMessage.error("获取位置信息失败,请重新提交");
return;
}
let currentHiddenId = "";
let params = {};
if (props.hiddenType === "unqualified") {
params = {
...form.value,
SOURCE: "2",
STATE: "0",
RISK_UNIT: props.info.RISKUNITNAME,
IDENTIFICATION: props.info.PARTSNAME,
RISK_DESCR: props.info.RISK_DESCR,
RISK_POSITION: props.info.POSITIONNAME,
LEVEL: props.info.DNAME5,
CHECK_CONTENT: props.info.CHECK_CONTENT,
RECORDITEM_ID: props.info.RECORDITEM_ID,
RISKITEM_ID: props.info.LISTCHECKITEM_ID,
LISTMANAGER_ID: props.listManagerId,
LONGITUDE: r.longitude,
LATITUDE: r.latitude,
HIDDENTYPE1: form.value.HIDDENTYPE[0],
HIDDENTYPE2: form.value.HIDDENTYPE[1],
HIDDENTYPE3: form.value.HIDDENTYPE[2],
HIDDENTYPE_NAME: hiddenDangerTypeRef.value.getCheckedNodes(),
};
const resData = await setInventoryTroubleshootingOtherHiddenDangerAdd(
params
);
currentHiddenId = resData.pd.HIDDEN_ID;
}
for (let i = 0; i < form.value.hiddenImgs.length; i++) {
if (form.value.hiddenImgs[i].raw)
await fnUploadImage(currentHiddenId, form.value.hiddenImgs[i].raw, 3);
}
for (let i = 0; i < form.value.videoFiles.length; i++) {
if (form.value.videoFiles[i].raw)
await fnUploadImage(currentHiddenId, form.value.videoFiles[i].raw, 3);
}
for (let i = 0; i < form.value.rectifyImgs.length; i++) {
if (form.value.rectifyImgs[i].raw)
await fnUploadImage(
currentHiddenId,
form.value.rectifyImgs[i].raw,
4
);
}
fnClose();
ElMessage.success("保存成功");
emits("submit", currentHiddenId);
});
},
{ atBegin: true }
);
const fnUploadImage = async (HIDDEN_ID, FFILE, TYPE) => {
const formData = new FormData();
formData.append("FOREIGN_KEY", HIDDEN_ID);
formData.append("TYPE", TYPE);
formData.append("FFILE", FFILE);
await setUploadImg(formData);
};
</script>
<style scoped lang="scss">
.item {
cursor: pointer;
border-bottom: 1px dashed #ccc;
padding: 10px 0;
&:first-child {
padding-top: 0;
}
}
</style>

View File

@ -0,0 +1,189 @@
<template>
<div>
<el-card>
<el-form
:model="searchForm"
label-width="90px"
@submit.prevent="fnResetPaginationTransfer"
>
<el-row>
<el-col :span="6">
<el-form-item label="清单名称" prop="KEYWORDS">
<el-input
v-model="searchForm.KEYWORDS"
placeholder="请输入关键字"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="人员" prop="USERNAME">
<el-input
v-model="searchForm.USERNAME"
placeholder="请输入关键字"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="部门" prop="DEPTIDS">
<layout-department
v-model="searchForm.DEPTIDS"
multiple
show-checkbox
collapse-tags
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="检查状态" prop="STATUS">
<el-select v-model="searchForm.STATUS">
<el-option
v-for="item in [
{ ID: '0', NAME: '未检查' },
{ ID: '1', NAME: '已检查' },
]"
:key="item.ID"
:label="item.NAME"
:value="item.ID"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="排查周期" prop="PERIOD">
<el-select v-model="searchForm.PERIOD">
<el-option
v-for="item in troubleshootingCycleList"
:key="item.BIANMA"
:label="item.NAME"
:value="item.BIANMA"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="清单级别" prop="LISTINGLEVEL">
<el-select v-model="searchForm.LISTINGLEVEL">
<el-option
v-for="item in [
{ BIANMA: '1', NAME: '公司' },
...inventoryLevelList,
]"
:key="item.BIANMA"
:label="item.NAME"
:value="item.BIANMA"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label-width="10px">
<el-button type="primary" native-type="submit">搜索</el-button>
<el-button native-type="reset" @click="fnResetPaginationTransfer">
重置
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<layout-card>
<layout-table
:data="list"
v-model:pagination="pagination"
@get-data="fnGetDataTransfer"
>
<el-table-column label="序号" width="70">
<template v-slot="{ $index }">
{{ serialNumber(pagination, $index) }}
</template>
</el-table-column>
<el-table-column prop="NAME" label="清单名称" />
<el-table-column prop="DEPARTMENT_NAME_ALL" label="部门" />
<el-table-column prop="POST_NAME" label="岗位" />
<el-table-column
prop="USER_NAME"
label="人员"
width="140"
show-overflow-tooltip
/>
<el-table-column
prop="PERIODNAME"
label="排查周期"
width="140"
show-overflow-tooltip
/>
<el-table-column label="检查次数" width="140" show-overflow-tooltip>
<template v-slot="{ row }">
<span :class="{ 'text-red': row.checkCount === 0 }">
{{ row.checkCount }}/1
</span>
</template>
</el-table-column>
<el-table-column
prop="TYPENAME"
label="清单类型"
width="140"
show-overflow-tooltip
/>
<el-table-column label="操作" width="100">
<template v-slot="{ row }">
<el-button
type="primary"
text
link
@click="fnInspect(row.LISTMANAGER_ID)"
>
开始检查
</el-button>
</template>
</el-table-column>
</layout-table>
</layout-card>
</div>
</template>
<script setup>
import { serialNumber } from "@/assets/js/utils.js";
import useListData from "@/assets/js/useListData.js";
import LayoutDepartment from "@/components/department/index.vue";
import {
layoutFnGetInventoryLevel,
layoutFnGetTroubleshootingCycle,
} from "@/assets/js/data_dictionary.js";
import { getInventoryTroubleshootingList } from "@/request/hazard_investigation.js";
import { useRouter } from "vue-router";
import { ElMessageBox } from "element-plus";
const router = useRouter();
let ISREST = "";
const { list, pagination, searchForm, fnGetData, fnResetPagination } =
useListData(getInventoryTroubleshootingList, {
callbackFn: (list, responseData) => {
ISREST = responseData.ISREST;
},
});
const troubleshootingCycleList = await layoutFnGetTroubleshootingCycle();
const inventoryLevelList = await layoutFnGetInventoryLevel();
const fnGetDataTransfer = () => {
fnGetData({
DEPTIDS: searchForm.value.DEPTIDS?.join(","),
});
};
const fnResetPaginationTransfer = () => {
fnResetPagination({
DEPTIDS: searchForm.value.DEPTIDS?.join(","),
});
};
const fnInspect = (LISTMANAGER_ID) => {
if (ISREST === "1") {
ElMessageBox.alert("您处于离岗状态,无需检查清单");
return;
}
router.push({
path: "/hazard_investigation/inventory_troubleshooting/inspect",
query: { LISTMANAGER_ID },
});
};
</script>
<style scoped></style>

View File

@ -0,0 +1,396 @@
<template>
<layout-card>
<el-divider content-position="left">清单信息</el-divider>
<el-descriptions :column="2" border>
<el-descriptions-item label="清单名称">
{{ info.NAME }}
</el-descriptions-item>
<el-descriptions-item label="排查清单类型">
{{ info.SCREENTYPENAME }}
</el-descriptions-item>
<el-descriptions-item
:label="info.BAO_BAO_TYPE === '1' ? '包保责任人部门' : '所属部门'"
>
{{ info.DEPARTMENT_NAME }}
</el-descriptions-item>
<el-descriptions-item
:label="info.BAO_BAO_TYPE === '1' ? '包保责任人岗位' : '所属岗位'"
>
{{ info.POST_NAME }}
</el-descriptions-item>
<el-descriptions-item label="排查周期">
{{ info.PERIODNAME }}
</el-descriptions-item>
<el-descriptions-item label="清单类型">
{{ info.TYPENAME }}
</el-descriptions-item>
<el-descriptions-item
label="排查日期"
v-if="info.TYPE === 'listType0006'"
>
{{ info.START_DATE }} - {{ info.END_DATE }}
</el-descriptions-item>
<el-descriptions-item label="包保责任人" v-if="info.BAO_BAO_TYPE === '1'">
{{ info.USER_NAME }}
</el-descriptions-item>
</el-descriptions>
<el-divider content-position="left">检查内容</el-divider>
<layout-table :data="inspectionList" :show-pagination="false">
<el-table-column label="序号" width="70" type="index" />
<el-table-column prop="RISKUNITNAME" label="风险点(单元)" />
<el-table-column prop="PARTSNAME" label="辨识部位" />
<el-table-column prop="RISK_DESCR" label="存在风险" />
<el-table-column prop="DNAME5" label="风险分级" />
<el-table-column prop="CHECK_CONTENT" label="检查内容" />
<el-table-column label="操作" width="280">
<template v-slot="{ row, $index }">
<el-radio-group :disabled="row.HASHIDDEN > 0" v-model="row.ISNORMAL">
<el-radio :label="0" @click.prevent="fnQualified($index, row)">
合格
</el-radio>
<el-radio :label="1" @click.prevent="fnUnqualified($index, row)">
不合格
</el-radio>
<el-radio :label="2" @click.prevent="fnNotInvolved($index)">
不涉及
</el-radio>
</el-radio-group>
</template>
</el-table-column>
</layout-table>
<el-divider content-position="left">其他隐患</el-divider>
<div class="tr mb-10">
<el-button type="primary"> 添加 </el-button>
</div>
<layout-table :data="otherHiddenList" :show-pagination="false">
<el-table-column label="序号" width="70" type="index" />
<el-table-column prop="HIDDENDESCR" label="隐患描述" />
<el-table-column label="操作" width="280">
<template v-slot="{ row }">
<el-button
type="primary"
text
link
@click="editOtherHidden(row.HIDDEN_ID)"
>
修改
</el-button>
<el-button
type="primary"
text
link
@click="removeOtherHidden(row.HIDDEN_ID)"
>
删除
</el-button>
</template>
</el-table-column>
</layout-table>
<el-form
ref="formRef"
:model="data.form"
:rules="rules"
label-width="100px"
>
<el-row>
<el-col :span="24">
<el-form-item label="检查时间" prop="CHECK_TIME">
<el-date-picker
v-model="data.form.CHECK_TIME"
format="YYYY-MM-DD HH:mm:SS"
value-format="YYYY-MM-DD HH:mm:SS"
type="datetime"
placeholder="这里输入检查时间"
/>
</el-form-item>
</el-col>
<template
v-for="(item, index) in data.form.inspectedList"
:key="item.id"
>
<el-col :span="11">
<el-form-item
label="检查部门"
:prop="'inspectedList.' + index + '.DEPARTMENT_ID'"
:rules="{
required: true,
message: '请选择检查部门',
trigger: 'change',
}"
>
<layout-department
v-model="item.DEPARTMENT_ID"
@update:model-value="fnInspectDepartmentChange($event, index)"
/>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item
label="检查人"
:prop="'inspectedList.' + index + '.USER_ID'"
:rules="{
required: true,
message: '请选择检查人',
trigger: 'change',
}"
>
<el-select
:model-value="item.USER_ID"
@change="
verifyDuplicateSelection(
data.form.inspectedList,
index,
'USER_ID',
$event
)
"
>
<el-option
v-for="item in item.userList"
:key="item.USER_ID"
:label="item.NAME"
:value="item.USER_ID"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="2">
<el-form-item label-width="10px">
<el-button
type="primary"
v-if="index === 0"
@click="fnAddInspectedList"
>
添加
</el-button>
<el-button
type="danger"
v-if="index !== 0"
@click="data.form.inspectedList.splice(index, 1)"
>
删除
</el-button>
</el-form-item>
</el-col>
</template>
<el-col :span="24">
<el-form-item label="备注" prop="DESCR">
<el-input
v-model="data.form.DESCR"
type="textarea"
:autosize="{
minRows: 3,
}"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="tc mt-10">
<el-button type="primary" @click="fnSubmit"></el-button>
</div>
<qualified
v-model:visible="data.qualifiedDialog.visible"
v-model:form="data.qualifiedDialog.form"
:id="data.qualifiedDialog.RECORDITEM_ID"
/>
<un-qualified
v-model:visible="data.unQualifiedDialog.visible"
v-model:form="data.unQualifiedDialog.form"
:type="data.unQualifiedDialog.type"
:hidden-type="data.unQualifiedDialog.hiddenType"
:list-manager-id="LISTMANAGER_ID"
:info="{ ...data.unQualifiedDialog.info, ...info.value }"
@submit="fnHiddenSubmit"
/>
</layout-card>
</template>
<script setup>
import { nextTick, reactive, ref } from "vue";
import {
getInventoryManagementView,
getInventoryTroubleshootingOtherHiddenList,
setInventoryTroubleshootingOtherHiddenDangerView,
} from "@/request/hazard_investigation.js";
import { useRoute, useRouter } from "vue-router";
import useListData from "@/assets/js/useListData.js";
import LayoutDepartment from "@/components/department/index.vue";
import {
addingPrefixToFile,
getFileSuffix,
verifyDuplicateSelection,
} from "@/assets/js/utils.js";
import { getUserListAll } from "@/request/data_dictionary.js";
import { getViewImg } from "@/request/api.js";
import { debounce } from "throttle-debounce";
import useFormValidate from "@/assets/js/useFormValidate.js";
import { ElLoading, ElMessage } from "element-plus";
import Qualified from "./components/qualified.vue";
import UnQualified from "./components/un_qualified.vue";
const route = useRoute();
const router = useRouter();
const { LISTMANAGER_ID } = route.query;
const rules = {
CHECK_TIME: [
{ required: true, message: "请选择检查时间", trigger: "change" },
],
};
const formRef = ref(null);
const info = ref({});
const data = reactive({
form: {
CHECK_TIME: "",
inspectedList: [],
},
qualifiedDialog: {
visible: false,
RECORDITEM_ID: "",
form: { file: [] },
},
unQualifiedDialog: {
visible: false,
type: "",
index: "",
hiddenType: "",
info: {},
form: {
HIDDENPART: "",
HIDDENDESCR: "",
HIDDENLEVEL: "",
HIDDEN_CATEGORY: "",
HIDDENTYPE: [],
hiddenImgs: [],
videoFiles: [],
RECTIFICATIONTYPE: "2",
RECTIFYDESCR: "",
rectifyImgs: [],
RECTIFICATIONDEADLINE: "",
RECTIFICATIONDEPT: "",
RECTIFICATIONOR: "",
},
},
});
const { list: inspectionList } = useListData(getInventoryManagementView, {
otherParams: { LISTMANAGER_ID },
usePagination: false,
callbackFn: (list, responseData) => {
for (let i = 0; i < list.length; i++) {
if (list[i].HASHIDDEN <= 0) list[i].ISNORMAL = 0;
}
info.value = responseData.pd;
},
});
const { list: otherHiddenList } = useListData(
getInventoryTroubleshootingOtherHiddenList,
{
otherParams: { LISTMANAGER_ID },
usePagination: false,
key: "hiddenList",
}
);
const fnQualified = async (index, row) => {
data.qualifiedDialog.visible = true;
await nextTick();
data.qualifiedDialog.RECORDITEM_ID = row.RECORDITEM_ID;
if (row.ISNORMAL === 1) fnRemoveUnqualified(index);
else if (row.ISNORMAL !== 1) {
const resData = await getViewImg({
FOREIGN_KEY: row.RECORDITEM_ID,
TYPE: "14",
});
data.qualifiedDialog.form.file = addingPrefixToFile(resData.imgs);
}
inspectionList.value[index].ISNORMAL = 0;
};
const fnNotInvolved = (index) => {
fnRemoveUnqualified(index);
inspectionList.value[index].ISNORMAL = 2;
};
const fnRemoveUnqualified = (index) => {
inspectionList.value[index].HIDDEN_ID = "";
};
const fnUnqualified = async (index, row) => {
data.unQualifiedDialog.visible = true;
await nextTick();
if (
inspectionList.value[index].ISNORMAL === 0 ||
inspectionList.value[index].ISNORMAL === 2
)
data.unQualifiedDialog.type = "add";
else if (inspectionList.value[index].ISNORMAL === 1) {
data.unQualifiedDialog.type = "edit";
await fnGetHiddenDangerView(inspectionList.value[index].HIDDEN_ID);
}
data.unQualifiedDialog.info = row;
data.unQualifiedDialog.index = index;
data.unQualifiedDialog.hiddenType = "unqualified";
};
const fnGetHiddenDangerView = async (HIDDEN_ID) => {
const resData = await setInventoryTroubleshootingOtherHiddenDangerView({
HIDDEN_ID,
});
data.unQualifiedDialog.form = resData.pd;
const HIDDENTYPE = [];
const videoFiles = [];
const hiddenImgs = [];
for (let i = 0; i < resData.hImgs.length; i++) {
if (getFileSuffix(resData.hImgs[i].FILEPATH) === "mp4")
videoFiles.push(...addingPrefixToFile([resData.hImgs[i]]));
else hiddenImgs.push(...addingPrefixToFile([resData.hImgs[i]]));
}
data.unQualifiedDialog.form.videoFiles = videoFiles;
data.unQualifiedDialog.form.hiddenImgs = hiddenImgs;
data.unQualifiedDialog.form.rectifyImgs = addingPrefixToFile(resData.rImgs);
if (resData.pd.HIDDENTYPE1) HIDDENTYPE.push(resData.pd.HIDDENTYPE1);
if (resData.pd.HIDDENTYPE2) HIDDENTYPE.push(resData.pd.HIDDENTYPE2);
if (resData.pd.HIDDENTYPE3) HIDDENTYPE.push(resData.pd.HIDDENTYPE3);
data.unQualifiedDialog.form.HIDDENTYPE = HIDDENTYPE;
};
const fnHiddenSubmit = (currentHiddenId) => {
const { hiddenType, index } = data.unQualifiedDialog;
if (hiddenType === "unqualified") {
inspectionList.value[index].ISNORMAL = 1;
inspectionList.value[index].HIDDEN_ID = currentHiddenId;
}
};
const fnAddInspectedList = () => {
data.form.inspectedList.push({
id: Math.random(),
DEPARTMENT_ID: "",
USER_ID: "",
userList: [],
});
};
fnAddInspectedList();
const fnInspectDepartmentChange = async (event, index) => {
data.form.inspectedList[index].USER_ID = "";
const resData = await getUserListAll({
DEPARTMENT_ID: event,
NOMAIN: "1",
});
data.form.inspectedList[index].userList = resData.userList;
};
const fnSubmit = debounce(
1000,
async () => {
await useFormValidate(formRef);
const loading = ElLoading.service({
lock: true,
text: "加载中...",
background: "rgba(0, 0, 0, 0.5)",
});
const geolocation = new window.BMapGL.Geolocation();
geolocation.getCurrentPosition(async (r) => {
console.log(r);
loading.close();
});
ElMessage.success("操作成功");
router.back();
},
{ atBegin: true }
);
</script>
<style scoped lang="scss"></style>

View File

@ -1,5 +1,5 @@
<template>
<layout-print-table-package :entrance="entrance" :thead-height="65.5">
<layout-print-table-package :entrance="entrance">
<table>
<thead>
<tr>