|
|
@@ -175,10 +175,10 @@
|
|
|
</el-button>
|
|
|
</template>
|
|
|
<template #sign="scope">
|
|
|
- <template v-if="JSON.parse(scope.row.checkedPersonSign || '[]').length">
|
|
|
+ <template v-if="scope.row.checkedPersonSign.length">
|
|
|
<div
|
|
|
class="file-container--div"
|
|
|
- v-for="item in JSON.parse(scope.row.checkedPersonSign || '[]')"
|
|
|
+ v-for="item in scope.row.checkedPersonSign"
|
|
|
:key="item.fileUrl || item.fileName"
|
|
|
>
|
|
|
<!-- <img
|
|
|
@@ -201,7 +201,7 @@
|
|
|
<span v-else>-</span>
|
|
|
</template>
|
|
|
<template #action="scope">
|
|
|
- <el-button type="danger" link size="small" @click="onDeleteRecord(scope.row)">删除</el-button>
|
|
|
+ <el-button type="primary" link size="small" @click="onDeleteRecord(scope.row)">删除</el-button>
|
|
|
<el-button type="primary" link size="small" @click="onViewRecord(scope.row)">检查记录查看</el-button>
|
|
|
</template>
|
|
|
</BasicTable>
|
|
|
@@ -356,7 +356,181 @@
|
|
|
width="900px"
|
|
|
destroy-on-close
|
|
|
>
|
|
|
- <BasicForm
|
|
|
+ <el-form ref="sandHiddenDangerFormRef" label-width="150px" :model="sandHiddenDangerFormData" :rules="sandHiddenDangerFormRules">
|
|
|
+ <el-form-item prop="typeId" label="隐患问题类别:" style="width: 70%;">
|
|
|
+ <el-select
|
|
|
+ v-model="sandHiddenDangerFormData.typeId"
|
|
|
+ placeholder="请选择隐患问题类别"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in dangerTypeList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.categoryName"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="隐患问题:" prop="dangerProblem">
|
|
|
+ <el-input
|
|
|
+ v-model="sandHiddenDangerFormData.dangerProblem"
|
|
|
+ placeholder="请输入隐患问题描述"
|
|
|
+ style="width: 450px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="问题主要原因:" prop="reasonId">
|
|
|
+ <el-select
|
|
|
+ v-model="sandHiddenDangerFormData.reasonId"
|
|
|
+ placeholder="请选择问题主要原因"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ style="width: 450px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="option in REASON_OPTIONS"
|
|
|
+ :key="option.value"
|
|
|
+ :label="option.label"
|
|
|
+ :value="option.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="任务来源:" prop="taskSource">
|
|
|
+ <el-input
|
|
|
+ v-model="sandHiddenDangerFormData.taskSource"
|
|
|
+ placeholder="如:上级检查、院内自查"
|
|
|
+ style="width: 450px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="整改要求:" prop="rectificationRequirement">
|
|
|
+ <el-input
|
|
|
+ v-model="sandHiddenDangerFormData.rectificationRequirement"
|
|
|
+ placeholder="请输入整改要求"
|
|
|
+ style="width: 450px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item prop="rectificationDepartmentIds" label="整改责任部门:">
|
|
|
+ <el-cascader
|
|
|
+ ref="cascaderDeptRef"
|
|
|
+ v-model="sandHiddenDangerFormData.rectificationDepartmentIds"
|
|
|
+ :options="issueDeptTree"
|
|
|
+ :props="cascaderDeptProp"
|
|
|
+ :show-all-levels="false"
|
|
|
+ placeholder="请选择整改责任部门"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ style="width: 450px"
|
|
|
+ @change="onIssueDeptChange"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item prop="rectificationResponsibleIds" label="整改负责人">
|
|
|
+ <el-select
|
|
|
+ v-model="sandHiddenDangerFormData.rectificationResponsibleIds"
|
|
|
+ placeholder="选择整改负责人"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ style="width: 450px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="user in issueUserList"
|
|
|
+ :key="user.id"
|
|
|
+ :label="user.realname ?? user.username"
|
|
|
+ :value="user.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="整改日期:" prop="rectificationDeadline">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="sandHiddenDangerFormData.rectificationDeadline"
|
|
|
+ type="date"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ placeholder="请选择整改日期"
|
|
|
+ style="width: 450px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item prop="reviewDepartmentId" label="复查人员所属部门:">
|
|
|
+ <el-cascader
|
|
|
+ ref="reviewDeptRef"
|
|
|
+ v-model="sandHiddenDangerFormData.reviewDepartmentId"
|
|
|
+ :options="deptTree"
|
|
|
+ :props="cascaderDeptProp"
|
|
|
+ :show-all-levels="false"
|
|
|
+ placeholder="请选择复查人员所属部门"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ style="width: 450px"
|
|
|
+ @change="onReviewDeptChange"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="复查人员:" prop="reviewPersonId">
|
|
|
+ <el-select
|
|
|
+ v-model="sandHiddenDangerFormData.reviewPersonId"
|
|
|
+ placeholder="请选择复查人员"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ style="width: 450px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="u in reviewUserListDept"
|
|
|
+ :key="u.id"
|
|
|
+ :label="u.realname || u.username"
|
|
|
+ :value="u.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="举一反三是否推送:" prop="isDrawLessonsPush">
|
|
|
+ <el-radio-group v-model="sandHiddenDangerFormData.isDrawLessonsPush" >
|
|
|
+ <el-radio :value="0">否</el-radio>
|
|
|
+ <el-radio :value="1">是</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label-width="150px" v-if="sandHiddenDangerFormData.isDrawLessonsPush === 1">
|
|
|
+ <el-input placeholder="如:上级检查、院内自查" style="width: 450px" v-model="sandHiddenDangerFormData.drawLessonsContent" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="drawLessonsDepartmentIds" v-if="sandHiddenDangerFormData.isDrawLessonsPush === 1" label="举一反三责任部门:">
|
|
|
+ <el-select
|
|
|
+ v-model="drawLessonsDeptIdsArray"
|
|
|
+ placeholder="请选择举一反三责任部门,可多选"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ multiple
|
|
|
+ collapse-tags
|
|
|
+ collapse-tags-tooltip
|
|
|
+ style="width: 450px"
|
|
|
+ @change="() => { sandHiddenDangerFormData.drawLessonsDepartmentIds = drawLessonsDeptIdsArray.join(','); }"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="d in deptOptions"
|
|
|
+ :key="d.id"
|
|
|
+ :label="d.deptName"
|
|
|
+ :value="d.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item prop="drawLessonsDeadline" label="举一反三时限:" v-if="sandHiddenDangerFormData.isDrawLessonsPush === 1">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="sandHiddenDangerFormData.drawLessonsDeadline"
|
|
|
+ type="date"
|
|
|
+ style="width: 450px"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ placeholder="请选择举一反三截止日期(选填)"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <!-- <BasicForm
|
|
|
ref="sandHiddenDangerFormRef"
|
|
|
:formData="sandHiddenDangerFormData"
|
|
|
:formRules="sandHiddenDangerFormRules"
|
|
|
@@ -416,7 +590,7 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
- </BasicForm>
|
|
|
+ </BasicForm> -->
|
|
|
<template #footer>
|
|
|
<el-button @click="showSandConfirmDialog = false">取消</el-button>
|
|
|
<el-button type="primary" :loading="sandConfirmLoading" @click="confirmSandToHiddenDanger">
|
|
|
@@ -468,13 +642,18 @@
|
|
|
type SandAreaCheckRecordToHiddenDangerReq,
|
|
|
} from '@/api/production-safety-system';
|
|
|
import { queryDictTypeDetail } from '@/api/dict';
|
|
|
- import {
|
|
|
- HIDDEN_DANGER_FORM_CONFIG,
|
|
|
- HIDDEN_DANGER_FORM_DATA,
|
|
|
- HIDDEN_DANGER_FORM_RULES,
|
|
|
- } from '@/views/production-safety/hiddenTroubleInvestigationAndGovernance/hiddenTroubleAccountManagement/configs/form';
|
|
|
+ import {
|
|
|
+ queryDangerTypePage,
|
|
|
+ } from '@/api/production-safety';
|
|
|
+// import {
|
|
|
+// HIDDEN_DANGER_FORM_CONFIG,
|
|
|
+// HIDDEN_DANGER_FORM_DATA,
|
|
|
+// HIDDEN_DANGER_FORM_RULES,
|
|
|
+// } from '@/views/production-safety/hiddenTroubleInvestigationAndGovernance/hiddenTroubleAccountManagement/configs/form';
|
|
|
import { downloadByData } from '@/utils/file/download';
|
|
|
-import { id } from 'element-plus/es/locale';
|
|
|
+ import { queryAvailableUserList } from '@/api/production-safety/responsibility-implementation';
|
|
|
+ import { HIDDEN_DANGER_FORM_CONFIG, HIDDEN_DANGER_FORM_RULES, REASON_OPTIONS, HIDDEN_DANGER_FORM_DATA } from "../configs/form"
|
|
|
+ import type { CascaderInstance } from 'element-plus'
|
|
|
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
@@ -508,7 +687,55 @@ import { id } from 'element-plus/es/locale';
|
|
|
label: 'deptName',
|
|
|
emitPath: false,
|
|
|
};
|
|
|
+ const issueDeptTree = ref<DeptTree[]>([]);
|
|
|
+ const issueUserList = ref<Array<{ id: number; realname?: string; username?: string }>>([]);
|
|
|
|
|
|
+ const onIssueDialogOpen = async () => {
|
|
|
+ try {
|
|
|
+ const [deptRes, userRes] = await Promise.all([
|
|
|
+ getAllDepartments(),
|
|
|
+ queryAvailableUserList({ pageNumber: 1, pageSize: 9999, queryParam: {} }),
|
|
|
+ ]);
|
|
|
+ const fullTree = (deptRes as DeptTree[]) ?? [];
|
|
|
+ issueDeptTree.value = Array.isArray(fullTree) && fullTree[0]?.children ? fullTree[0].children : [];
|
|
|
+ issueUserList.value = (userRes as any)?.records ?? [];
|
|
|
+ } catch (e:any) {
|
|
|
+ console.error('获取部门/用户列表失败:', e);
|
|
|
+ ElMessage.error(e?.message || e?.data || '加载部门或负责人列表失败');
|
|
|
+ issueDeptTree.value = [];
|
|
|
+ issueUserList.value = [];
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const drawLessonsDeptIdsArray = ref<number[]>([]);
|
|
|
+ const reviewUserListDept = ref<Array<{ id: number; realname?: string; username?: string }>>([]);
|
|
|
+
|
|
|
+ const loadDeptAndUserOptionsDept = async () => {
|
|
|
+ try {
|
|
|
+ const [userRes] = await Promise.all([
|
|
|
+ // getAllDepartments(),
|
|
|
+ queryAvailableUserList({ pageNumber: 1, pageSize: 9999, queryParam: {} }),
|
|
|
+ ]);
|
|
|
+ // const fullTree = (deptRes as DeptTree[]) ?? [];
|
|
|
+ // deptTree.value = Array.isArray(fullTree) && fullTree[0]?.children ? fullTree[0].children : [];
|
|
|
+ reviewUserListDept.value = (userRes as any)?.records ?? [];
|
|
|
+ } catch (e) {
|
|
|
+ reviewUserListDept.value = [];
|
|
|
+ }
|
|
|
+ };
|
|
|
+ function flattenDeptTree(nodes: DeptTree[] | undefined): Array<{ id: number; deptName: string }> {
|
|
|
+ if (!nodes?.length) return [];
|
|
|
+ const list: Array<{ id: number; deptName: string }> = [];
|
|
|
+ const walk = (items: DeptTree[]) => {
|
|
|
+ items.forEach((n) => {
|
|
|
+ if (n.id != null) list.push({ id: n.id, deptName: n.deptName });
|
|
|
+ if (n.children?.length) walk(n.children);
|
|
|
+ });
|
|
|
+ };
|
|
|
+ walk(nodes);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+ const deptOptions = computed(() => flattenDeptTree(deptTree.value));
|
|
|
/** 部门树:主责部门、安全应急部门、院领导部门均使用 getAllDepartments 接口 */
|
|
|
const getDeptTreeData = async () => {
|
|
|
try {
|
|
|
@@ -519,7 +746,39 @@ import { id } from 'element-plus/es/locale';
|
|
|
deptTree.value = [];
|
|
|
}
|
|
|
};
|
|
|
+ const cascaderDeptRef = ref<CascaderInstance | null>(null)
|
|
|
+ // 整改责任部门
|
|
|
+ const onIssueDeptChange = async () => {
|
|
|
+ const nodes = cascaderDeptRef.value?.getCheckedNodes()
|
|
|
+
|
|
|
+ if (!nodes || nodes.length === 0) return
|
|
|
+ const currentDept = nodes[0]
|
|
|
+ sandHiddenDangerFormData.rectificationResponsibleIds = undefined;
|
|
|
+ try {
|
|
|
+ const userRes = await queryAvailableUserList({ pageNumber: 1, pageSize: 9999, queryParam: {deptName: currentDept.data.deptName||undefined} });
|
|
|
+ issueUserList.value = (userRes as any)?.records ?? [];
|
|
|
+ } catch (e:any) {
|
|
|
+ ElMessage.error(e?.message || e?.data || '加载部门或负责人列表失败');
|
|
|
+ issueUserList.value = [];
|
|
|
+ }
|
|
|
+ };
|
|
|
+ // 复查人员所属部门
|
|
|
+ const reviewDeptRef = ref<CascaderInstance | null>(null)
|
|
|
+ const onReviewDeptChange = async () => {
|
|
|
|
|
|
+ const nodes = reviewDeptRef.value?.getCheckedNodes()
|
|
|
+
|
|
|
+ if (!nodes || nodes.length === 0) return
|
|
|
+ const currentDept = nodes[0]
|
|
|
+ sandHiddenDangerFormData.reviewPersonId = undefined;
|
|
|
+ try {
|
|
|
+ const userRes = await queryAvailableUserList({ pageNumber: 1, pageSize: 9999, queryParam: {deptName: currentDept.data.deptName||undefined} });
|
|
|
+ reviewUserListDept.value = (userRes as any)?.records ?? [];
|
|
|
+ } catch (e:any) {
|
|
|
+ ElMessage.error(e?.message || e?.data || '加载部门或负责人列表失败');
|
|
|
+ reviewUserListDept.value = [];
|
|
|
+ }
|
|
|
+ };
|
|
|
const findDeptIdByName = (nodes: DeptTree[] | undefined, name: string): number | undefined => {
|
|
|
if (!nodes?.length) return undefined;
|
|
|
for (const n of nodes) {
|
|
|
@@ -529,7 +788,27 @@ import { id } from 'element-plus/es/locale';
|
|
|
}
|
|
|
return undefined;
|
|
|
};
|
|
|
-
|
|
|
+ // 隐患类别数据
|
|
|
+ const dangerTypeList = ref<any[]>([])
|
|
|
+ const dangerTypeData = async ()=> {
|
|
|
+ try {
|
|
|
+ // 将日期范围同步到查询参数
|
|
|
+ let params = {
|
|
|
+ pageNumber: 1,
|
|
|
+ pageSize: 9999,
|
|
|
+ queryParam: {
|
|
|
+ status: 1,
|
|
|
+ },
|
|
|
+ }
|
|
|
+ const res = await queryDangerTypePage(params);
|
|
|
+ if (res) {
|
|
|
+ dangerTypeList.value = res.records || [];
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.error('获取隐患类别列表失败:', e);
|
|
|
+ dangerTypeList.value = [];
|
|
|
+ }
|
|
|
+ }
|
|
|
const setDeptNameFromCascader = (refVal: any, nameKey: 'primaryResponsibleDeptName' | 'safetyEmergencyDeptName' | 'hospitalLeaderDeptName') => {
|
|
|
const nodes = refVal?.getCheckedNodes?.();
|
|
|
const label = nodes?.[0]?.label ?? '';
|
|
|
@@ -726,11 +1005,11 @@ import { id } from 'element-plus/es/locale';
|
|
|
const currentRowForUnqualified = ref<Record<string, unknown> | null>(null);
|
|
|
const unqualifiedList = ref<UnqualifiedItemNumRecord[]>([]);
|
|
|
const UNQUALIFIED_TABLE_COLUMNS: TableColumnProps[] = [
|
|
|
- { label: '编号', type: 'index', align: 'center', width: '60px' },
|
|
|
+ { label: '编号', type: 'index', align: 'center', width: '100px' },
|
|
|
{ label: '检查场所', prop: 'checkPlace', minWidth: '200px' },
|
|
|
{ label: '发现问题', prop: 'checkProblem', minWidth: '220px' },
|
|
|
{ label: '检查时间', prop: 'checkTime', minWidth: '180px' },
|
|
|
- { label: '操作', slot: 'action', align: 'center', width: '100px' },
|
|
|
+ { label: '操作', slot: 'action', align: 'center', fixed:'right', width: '100px' },
|
|
|
];
|
|
|
const UNQUALIFIED_TABLE_OPTIONS = {
|
|
|
emptyText: '暂无不合格数据',
|
|
|
@@ -832,11 +1111,25 @@ import { id } from 'element-plus/es/locale';
|
|
|
});
|
|
|
const raw = (res as { data?: { records?: Array<Record<string, unknown>>; totalRow?: number } })?.data ?? res;
|
|
|
const records = raw?.records ?? [];
|
|
|
- inspectionRecordList.value = records.map((r: Record<string, unknown>) => ({
|
|
|
- ...r,
|
|
|
- checkPerson: r.checkPerson ?? r.checkPersonName,
|
|
|
- checkedCompany: r.checkedCompany ?? r.checkedCompanyName,
|
|
|
- }));
|
|
|
+ inspectionRecordList.value = records.map((r: Record<string, unknown>) => {
|
|
|
+ let checkedPersonSign: unknown[] = [];
|
|
|
+ const signValue = r.checkedPersonSign;
|
|
|
+ // 兼容所有脏数据
|
|
|
+ if (signValue) {
|
|
|
+ try {
|
|
|
+ const parsed = JSON.parse(signValue as string);
|
|
|
+ checkedPersonSign = Array.isArray(parsed) ? parsed : [];
|
|
|
+ } catch {
|
|
|
+ checkedPersonSign = [signValue];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ ...r,
|
|
|
+ checkedPersonSign,
|
|
|
+ checkPerson: r.checkPerson ?? r.checkPersonName,
|
|
|
+ checkedCompany: r.checkedCompany ?? r.checkedCompanyName,
|
|
|
+ };
|
|
|
+ });
|
|
|
recordPagination.total = raw?.totalRow ?? 0;
|
|
|
} catch (e) {
|
|
|
console.error('查询检查记录失败:', e);
|
|
|
@@ -876,6 +1169,7 @@ import { id } from 'element-plus/es/locale';
|
|
|
|
|
|
const handleSandToHiddenDanger = (row: { id?: number } & Record<string, unknown>) => {
|
|
|
if (!row.id) return;
|
|
|
+ dangerTypeData()
|
|
|
currentRecordIdForUnqualified.value = Number(row.id);
|
|
|
// 每次打开入账弹窗都使用一份全新的隐患台账初始数据,不带入检查记录旧数据
|
|
|
Object.assign(sandHiddenDangerFormData, HIDDEN_DANGER_FORM_DATA);
|
|
|
@@ -884,7 +1178,7 @@ import { id } from 'element-plus/es/locale';
|
|
|
|
|
|
const validateSandHiddenDangerForm = async () => {
|
|
|
if (!sandHiddenDangerFormRef.value) return false;
|
|
|
- return await sandHiddenDangerFormRef.value.validateForm();
|
|
|
+ return await sandHiddenDangerFormRef.value.validate();
|
|
|
};
|
|
|
|
|
|
const confirmSandToHiddenDanger = async () => {
|
|
|
@@ -1042,6 +1336,8 @@ import { id } from 'element-plus/es/locale';
|
|
|
|
|
|
onMounted(async () => {
|
|
|
cloneRuleFormData();
|
|
|
+ onIssueDialogOpen();
|
|
|
+ loadDeptAndUserOptionsDept()
|
|
|
ruleFormData.hospitalLeaderDeptName = '院领导';
|
|
|
ruleFormData.hospitalLeaderDeptId = 1693;
|
|
|
ruleFormData.safetyEmergencyDeptId = 1698;
|