This commit is contained in:
2025-07-30 16:26:34 +08:00
parent 496adee0b4
commit 3ff2728466
24 changed files with 506 additions and 1182 deletions

View File

@ -4,19 +4,14 @@
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="检查类型" prop="checkType">
<el-select v-model="queryParams.checkType" placeholder="全部" clearable>
<el-option v-for="dict in safety_inspection_check_type" :key="dict.value" :label="dict.label" :value="dict.value" />
<el-form-item label="检查类型" prop="studyType">
<el-select v-model="queryParams.studyType" placeholder="全部" clearable>
<el-option v-for="dict in safety_inspection_check_type" :key="dict.key" :label="dict.value" :value="dict.key" />
</el-select>
</el-form-item>
<el-form-item label="违章类型" prop="violationType">
<el-select v-model="queryParams.violationType" placeholder="全部" clearable>
<el-option v-for="dict in safety_inspection_violation_type" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="处理状态" prop="status">
<el-select v-model="queryParams.status" placeholder="全部" clearable>
<el-option v-for="dict in safety_inspection_type" :key="dict.value" :label="dict.label" :value="dict.value" />
<el-option v-for="dict in safety_inspection_violation_type" :key="dict.key" :label="dict.value" :value="dict.key" />
</el-select>
</el-form-item>
<el-form-item>
@ -29,45 +24,32 @@
</transition>
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['safety:safetyInspection:add']"> 新增 </el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['safety:safetyInspection:remove']">
删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['safety:safetyInspection:export']">导出 </el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="safetyInspectionList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" type="index" width="60" align="center" />
<el-table-column label="处理状态" align="center" prop="status">
<el-table-column label="处理状态" align="center" prop="status" min-width="100px">
<template #default="scope">
<dict-tag :options="safety_inspection_type" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="检查人" align="center" prop="correctorName" />
<el-table-column label="检查时间" align="center" prop="rectificationDeadline" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.rectificationDeadline, '{y}-{m}-{d}') }}</span>
<template v-if="scope.row.isReply == 1">
<el-tag type="primary" v-if="scope.row.status && scope.row.status == 1">通知</el-tag>
<el-tag type="warning" v-if="scope.row.status && scope.row.status == 2">整改</el-tag>
<el-tag type="success" v-if="scope.row.status && scope.row.status == 3 && scope.row.reviewType == 1">通过</el-tag>
<el-tag type="danger" v-if="scope.row.status && scope.row.status == 3 && scope.row.reviewType == 2">未通过</el-tag>
</template>
<template v-if="scope.row.isReply == 2">
<el-tag type="success">通过</el-tag>
</template>
</template>
</el-table-column>
<el-table-column label="检查人" align="center" prop="fill" />
<el-table-column label="检查时间" align="center" prop="checkTime" width="180"> </el-table-column>
<el-table-column label="检查类型" align="center" prop="checkType">
<template #default="scope">
<dict-tag :options="safety_inspection_check_type" :value="scope.row.checkType" />
<span>{{ filterType(scope.row.studyType) }}</span>
</template>
</el-table-column>
<el-table-column label="违章类型" align="center" prop="violationType">
<template #default="scope">
<dict-tag :options="safety_inspection_violation_type" :value="scope.row.violationType" />
<span>{{ filterTypeS(scope.row.violationType) }}</span>
</template>
</el-table-column>
<el-table-column label="巡检结果" align="center" prop="inspectionResult">
@ -82,28 +64,22 @@
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="整改人" align="center" prop="correctorName" />
<el-table-column label="整改人" align="center" prop="abarbeitung" />
<el-table-column label="复查状态" align="center" prop="reviewType">
<template #default="scope">
<dict-tag :options="review_type" :value="scope.row.reviewType" />
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="220">
<template #default="scope">
<el-space>
<el-button link type="primary" icon="View" @click="handleShowDialog(scope.row)" v-hasPermi="['safety:safetyInspection:query']">
详情
</el-button>
<!-- <el-button link type="success" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['safety:safetyInspection:edit']">修改 </el-button> -->
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['safety:safetyInspection:remove']">
删除
</el-button>
</el-space>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
<!-- 添加或修改安全巡检工单对话框 -->
@ -177,11 +153,10 @@ import { useUserStoreHook } from '@/store/modules/user';
import SafetyInspectionDetailDialog from '@/views/safety/safetyInspection/component/SafetyInspectionDetailDialog.vue';
import { listProjectTeamForeman } from '@/api/project/projectTeam';
import { foremanQuery, ProjectTeamForemanResp } from '@/api/project/projectTeam/types';
import { getDictData } from '@/api/project/goUser/index';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { safety_inspection_violation_type, review_type, safety_inspection_type, safety_inspection_check_type } = toRefs<any>(
proxy?.useDict('safety_inspection_violation_type', 'review_type', 'safety_inspection_type', 'safety_inspection_check_type')
);
const { review_type } = toRefs<any>(proxy?.useDict('review_type', 'safety_inspection_type'));
// 获取用户 store
const userStore = useUserStoreHook();
// 从 store 中获取项目列表和当前选中的项目
@ -194,7 +169,8 @@ const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const safety_inspection_check_type = ref([]); // 检查类型
const safety_inspection_violation_type = ref([]); // 违章类型
const queryFormRef = ref<ElFormInstance>();
const safetyInspectionFormRef = ref<ElFormInstance>();
@ -206,7 +182,7 @@ const dialog = reactive<DialogOption>({
const initFormData: SafetyInspectionForm = {
id: undefined,
pid: undefined,
projectId: currentProject.value.id,
projectId: currentProject.value.goId,
checkType: undefined,
violationType: undefined,
inspectionResult: undefined,
@ -234,7 +210,7 @@ const data = reactive<PageData<SafetyInspectionForm, SafetyInspectionQuery>>({
pageSize: 10,
id: undefined,
pid: undefined,
projectId: currentProject.value.id,
projectId: currentProject.value.goId,
checkType: undefined,
violationType: undefined,
inspectionResult: undefined,
@ -270,8 +246,8 @@ const teamList = ref<ProjectTeamForemanResp[]>();
const getList = async () => {
loading.value = true;
const res = await listSafetyInspection(queryParams.value);
safetyInspectionList.value = res.rows;
total.value = res.total;
safetyInspectionList.value = res.data.list;
total.value = res.data.total;
// 获取项目班组信息
const teamRes = await listProjectTeamForeman(currentProject.value.id);
teamList.value = teamRes.data;
@ -282,7 +258,13 @@ const getList = async () => {
loading.value = false;
};
// 获取字典
const getDictDataList = async () => {
const res = await getDictData('study_type');
safety_inspection_check_type.value = res.data.values;
const res1 = await getDictData('tour_type');
safety_inspection_violation_type.value = res1.data.values;
};
const changeForeman = (value: string | number) => {
const team = teamList.value.filter((team) => team.id === value)[0];
foremanOpt.value = team.foremanList?.map((foreman: foremanQuery) => ({
@ -297,7 +279,6 @@ const currentSafetyInspectionId = ref<string | number>();
const showDetailDialog = ref<boolean>(false);
const handleShowDialog = (row?: SafetyInspectionVO) => {
currentSafetyInspectionId.value = row.id;
showDetailDialog.value = true;
};
@ -331,24 +312,6 @@ const handleSelectionChange = (selection: SafetyInspectionVO[]) => {
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
reset();
dialog.visible = true;
dialog.title = '添加安全巡检工单';
};
/** 修改按钮操作 */
const handleUpdate = async (row?: SafetyInspectionVO) => {
reset();
const _id = row?.id || ids.value[0];
const res = await getSafetyInspection(_id);
Object.assign(form.value, res.data);
dialog.visible = true;
dialog.title = '修改安全巡检工单';
};
/** 提交按钮 */
const submitForm = () => {
safetyInspectionFormRef.value?.validate(async (valid: boolean) => {
@ -367,29 +330,27 @@ const submitForm = () => {
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: SafetyInspectionVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除安全巡检工单编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delSafetyInspection(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
const filterType = (studyType) => {
let label = '';
safety_inspection_check_type.value.map((item) => {
if (item.key == studyType) {
label = item.value;
}
});
return label;
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
'safety/safetyInspection/export',
{
...queryParams.value
},
`safetyInspection_${new Date().getTime()}.xlsx`
);
const filterTypeS = (violationType) => {
let label = '';
safety_inspection_violation_type.value.map((item) => {
if (item.key == violationType) {
label = item.value;
}
});
return label;
};
//监听项目id刷新数据
const listeningProject = watch(
() => currentProject.value.id,
() => currentProject.value.goId,
(nid, oid) => {
queryParams.value.projectId = nid;
form.value.projectId = nid;
@ -402,6 +363,7 @@ onUnmounted(() => {
});
onMounted(() => {
getDictDataList();
getList();
});
</script>