违规记录
This commit is contained in:
		| @ -23,10 +23,30 @@ | ||||
|               </el-select> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="24" :offset="0" prop="dept"> | ||||
|             <el-form-item label="部门"> | ||||
|               <el-cascader | ||||
|                 :options="postListAll" | ||||
|                 v-model="formData.dept" | ||||
|                 clearable | ||||
|                 filterable | ||||
|                 :show-all-levels="false" | ||||
|                 placeholder="请选择部门" | ||||
|                 :props="{ expandTrigger: 'hover', checkStrictly: true, value: 'id', emitPath: false, multiple: true }" | ||||
|                 @change="changeDept" | ||||
|               > | ||||
|               </el-cascader> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="24"> | ||||
|             <el-form-item label="岗位" prop="postIdList"> | ||||
|               <el-select v-model="formData.postIdList" placeholder="请选择岗位" multiple> | ||||
|                 <el-option v-for="dict in postListAll" :key="dict.postId" :label="dict.postName" :value="dict.postId" /> | ||||
|               <el-select v-model="formData.postIdList" placeholder="请选择岗位" multiple :disabled="!formData.dept"> | ||||
|                 <el-option | ||||
|                   v-for="dict in formData.postWorkList" | ||||
|                   :key="dict.postId" | ||||
|                   :label="dict.deptName + '/' + dict.postName" | ||||
|                   :value="dict.postId" | ||||
|                 /> | ||||
|               </el-select> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
| @ -60,7 +80,7 @@ const userStore = useUserStoreHook(); | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
|  | ||||
| // Props | ||||
| defineProps<{ | ||||
| const props = defineProps<{ | ||||
|   tourTypeOptions: any[]; | ||||
|   risxList: any[]; | ||||
|   postListAll: any[]; | ||||
| @ -78,6 +98,7 @@ const loading = ref(false); | ||||
| const formData = reactive({ | ||||
|   id: undefined, | ||||
|   violationLevel: undefined, | ||||
|   dept: undefined, | ||||
|   color: undefined, | ||||
|   violationType: undefined as any, | ||||
|   wxOrPc: undefined, | ||||
| @ -88,6 +109,7 @@ const formData = reactive({ | ||||
|   deletedAt: undefined, | ||||
|   projectId: currentProject.value?.id, | ||||
|   riskType: '', | ||||
|   postWorkList: [] as any[], | ||||
|   postIdList: [] as any[] | ||||
| }); | ||||
|  | ||||
| @ -127,6 +149,7 @@ const resetForm = () => { | ||||
|     violationLevel: undefined, | ||||
|     color: undefined, | ||||
|     violationType: undefined, | ||||
|     dept: undefined, | ||||
|     wxOrPc: undefined, | ||||
|     createBy: undefined, | ||||
|     updateBy: undefined, | ||||
| @ -135,6 +158,7 @@ const resetForm = () => { | ||||
|     deletedAt: undefined, | ||||
|     projectId: currentProject.value?.id, | ||||
|     riskType: '', | ||||
|     postWorkList: [] as any[], | ||||
|     postIdList: [] | ||||
|   }); | ||||
| }; | ||||
| @ -165,6 +189,32 @@ const onSubmit = () => { | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| const changeDept = (val: any) => { | ||||
|   formData.postWorkList = getPostVoListByIds(props.postListAll, val); | ||||
|   formData.postIdList = []; | ||||
|   console.log(formData.postWorkList, val); | ||||
| }; | ||||
|  | ||||
| function getPostVoListByIds(tree: any[], idList: (string | number)[]): any[] { | ||||
|   const idSet = new Set(idList.map(String)); // 用于快速匹配 ID(统一为字符串比较) | ||||
|   const result: any[] = []; | ||||
|  | ||||
|   function dfs(nodes: any[]) { | ||||
|     for (const node of nodes) { | ||||
|       if (idSet.has(String(node.id))) { | ||||
|         result.push(...(node.postVoList || [])); | ||||
|       } | ||||
|  | ||||
|       if (node.children && node.children.length > 0) { | ||||
|         dfs(node.children); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   dfs(tree); | ||||
|   return result; | ||||
| } | ||||
|  | ||||
| defineExpose({ | ||||
|   openDialog, | ||||
|   closeDialog | ||||
|  | ||||
| @ -25,10 +25,30 @@ | ||||
|               </el-select> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="24" :offset="0" prop="dept"> | ||||
|             <el-form-item label="部门"> | ||||
|               <el-cascader | ||||
|                 :options="postListAll" | ||||
|                 v-model="formData.dept" | ||||
|                 clearable | ||||
|                 filterable | ||||
|                 :show-all-levels="false" | ||||
|                 placeholder="请选择部门" | ||||
|                 :props="{ expandTrigger: 'hover', checkStrictly: true, value: 'id', emitPath: false, multiple: true }" | ||||
|                 @change="changeDept" | ||||
|               > | ||||
|               </el-cascader> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="24"> | ||||
|             <el-form-item label="岗位" prop="postIdList"> | ||||
|               <el-select v-model="formData.postIdList" placeholder="请选择岗位" multiple> | ||||
|                 <el-option v-for="dict in postListAll" :key="dict.postId" :label="dict.postName" :value="dict.postId" /> | ||||
|               <el-select v-model="formData.postIdList" placeholder="请选择岗位" multiple :disabled="!formData.dept"> | ||||
|                 <el-option | ||||
|                   v-for="dict in formData.postWorkList" | ||||
|                   :key="dict.postId" | ||||
|                   :label="dict.deptName + '/' + dict.postName" | ||||
|                   :value="dict.postId" | ||||
|                 /> | ||||
|               </el-select> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
| @ -57,7 +77,7 @@ import { ElMessage, ElLoading } from 'element-plus'; | ||||
| import { getViolationLevel, addViolationLevel, updateViolationLevel } from '@/api/safety/violationLevel'; | ||||
| import { ViolationLevelForm, ViolationLevelVO } from '@/api/safety/violationLevel/types'; | ||||
|  | ||||
| defineProps<{ | ||||
| const props = defineProps<{ | ||||
|   tourTypeOptions: any[]; | ||||
|   risxList: any[]; | ||||
|   postListAll: any[]; | ||||
| @ -75,11 +95,16 @@ const formData = reactive< | ||||
|     risx?: string[] | string; | ||||
|     tourType?: string[] | string; | ||||
|     postIdList: number[]; | ||||
|     dept: any; | ||||
|     postWorkList: any[]; | ||||
|   } | ||||
| >({ | ||||
|   id: undefined, | ||||
|   violationLevel: undefined, | ||||
|   color: undefined, | ||||
|   dept: undefined, | ||||
|   postWorkList: [] as any[], | ||||
|  | ||||
|   riskType: undefined, | ||||
|   createBy: undefined, | ||||
|   updateBy: undefined, | ||||
| @ -115,6 +140,8 @@ const openDialog = (row?: ViolationLevelVO) => { | ||||
|         const data = res.data; | ||||
|         data.postIdList = (data.postList || []).map((item: any) => item.postId); | ||||
|         data.violationType = data.violationType ? (data.violationType as string).split(',') : []; | ||||
|         formData.dept = (data.postList || []).map((item: any) => item.deptId); | ||||
|         formData.postWorkList = getPostVoListByIds(props.postListAll, formData.dept); | ||||
|         Object.assign(formData, data); | ||||
|       }); | ||||
|     }); | ||||
| @ -174,11 +201,41 @@ const resetForm = () => { | ||||
|     createdAt: undefined, | ||||
|     updatedAt: undefined, | ||||
|     deletedAt: undefined, | ||||
|     dept: undefined, | ||||
|     postWorkList: [], | ||||
|     postIdList: [], | ||||
|  | ||||
|     risx: '', | ||||
|     posts: [] | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| const changeDept = (val: any) => { | ||||
|   formData.postWorkList = getPostVoListByIds(props.postListAll, val); | ||||
|   formData.postIdList = []; | ||||
|   console.log(formData.postWorkList, val); | ||||
| }; | ||||
|  | ||||
| function getPostVoListByIds(tree: any[], idList: (string | number)[]): any[] { | ||||
|   const idSet = new Set(idList.map(String)); // 用于快速匹配 ID(统一为字符串比较) | ||||
|   const result: any[] = []; | ||||
|  | ||||
|   function dfs(nodes: any[]) { | ||||
|     for (const node of nodes) { | ||||
|       if (idSet.has(String(node.id))) { | ||||
|         result.push(...(node.postVoList || [])); | ||||
|       } | ||||
|  | ||||
|       if (node.children && node.children.length > 0) { | ||||
|         dfs(node.children); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   dfs(tree); | ||||
|   return result; | ||||
| } | ||||
|  | ||||
| defineExpose({ | ||||
|   openDialog, | ||||
|   closeDialog | ||||
|  | ||||
| @ -106,7 +106,7 @@ import { ViolationLevelForm, ViolationLevelVO } from '@/api/safety/violationLeve | ||||
| import apiV1SystemBusViolationLevelAdd from '@/views/safety/violationLevel/component/add.vue'; | ||||
| import apiV1SystemBusViolationLevelEdit from '@/views/safety/violationLevel/component/edit.vue'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| import { listPost, optionselect } from '@/api/system/post'; | ||||
| import { listPost, listTreeByProject, optionselect } from '@/api/system/post'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| @ -145,8 +145,9 @@ const state = reactive<any>({ | ||||
| }); | ||||
|  | ||||
| const postList = () => { | ||||
|   listPost({ pageNum: 1, pageSize: 100 }).then((res) => { | ||||
|     state.postListAll = res.rows ?? []; | ||||
|   listTreeByProject(currentProject.value?.id).then((res) => { | ||||
|     console.log('🚀 ~ listTreeByProject ~ res:', res); | ||||
|     state.postListAll = res.data ?? []; | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| @ -157,8 +158,6 @@ const initTableData = () => { | ||||
| const resetQuery = (formEl?: FormInstance) => { | ||||
|   if (!formEl) return; | ||||
|   formEl.resetFields(); | ||||
|   console.log(useUserStoreHook().selectedProject, currentProject.value?.id); | ||||
|  | ||||
|   busViolationLevelList(); | ||||
| }; | ||||
|  | ||||
|  | ||||
| @ -0,0 +1,214 @@ | ||||
| <template> | ||||
|   <!-- <el-card v-loading="loading" body-class="printMe"> --> | ||||
|   <div class="w75% m-a"> | ||||
|     <div id="printMe" class="pos-relative"> | ||||
|       <div class="resultIcon"><img :src="'../../../../../src/assets/icons/svg/' + inspectionType + '.png'" alt="" /></div> | ||||
|       <!-- <h2 style="text-align: center; margin-top: 5px; font-weight: bold">安全生产监督检查通知书</h2> --> | ||||
|       <el-row> | ||||
|         <el-col :span="12" style="text-align: left">填报人:{{ safetyInspectionDetail?.createByName }}</el-col> | ||||
|         <el-col :span="12" style="text-align: right">填报时间:{{ safetyInspectionDetail?.createTime }}</el-col> | ||||
|       </el-row> | ||||
|       <el-descriptions :column="2" border style="margin-top: 8px" label-width="160px" size="large"> | ||||
|         <el-descriptions-item label-align="center" label="检查项目" :span="2" class-name="zebra">{{ currentProject?.name }} </el-descriptions-item> | ||||
|  | ||||
|         <el-descriptions-item label-align="center" label="违章类型" label-class-name="white" width="300px"> | ||||
|           <dict-tag :options="violation_level_type" :value="safetyInspectionDetail?.violationType" /> | ||||
|         </el-descriptions-item> | ||||
|         <el-descriptions-item label-align="center" label="违章等级" label-class-name="white"> | ||||
|           <div class="flex"> | ||||
|             {{ safetyInspectionDetail?.levelVo.violationLevel }}:<dict-tag | ||||
|               :options="risk_level_type" | ||||
|               :value="safetyInspectionDetail?.levelVo.riskType" | ||||
|             /> | ||||
|           </div> | ||||
|         </el-descriptions-item> | ||||
|         <el-descriptions-item label-align="center" label="检查时间" class-name="zebra" | ||||
|           >{{ safetyInspectionDetail?.violationTime }} | ||||
|         </el-descriptions-item> | ||||
|         <el-descriptions-item label-align="center" label="检查人" class-name="zebra" | ||||
|           >{{ safetyInspectionDetail?.createByName }} | ||||
|         </el-descriptions-item> | ||||
|         <el-descriptions-item label-align="center" label="整改人" label-class-name="white" | ||||
|           >{{ safetyInspectionDetail?.handlerName }} | ||||
|         </el-descriptions-item> | ||||
|         <el-descriptions-item label-align="center" label="要求整改期限" label-class-name="white"> | ||||
|           {{ safetyInspectionDetail?.disposeDeadline ? dayjs(safetyInspectionDetail?.disposeDeadline).format('YYYY - MM - DD ') : '' }} | ||||
|         </el-descriptions-item> | ||||
|       </el-descriptions> | ||||
|       <el-descriptions border direction="vertical" size="large"> | ||||
|         <el-descriptions-item label-align="center" label="巡检结果" class-name="none"></el-descriptions-item> | ||||
|       </el-descriptions> | ||||
|       <el-descriptions :column="2" border label-width="160px" size="large"> | ||||
|         <el-descriptions-item label-align="center" label="内容" :span="2" label-class-name="white" | ||||
|           >{{ safetyInspectionDetail?.recognizeVo.description }} | ||||
|         </el-descriptions-item> | ||||
|         <el-descriptions-item label-align="center" label="检查附件" :span="2" label-class-name="white"> | ||||
|           <el-space wrap> | ||||
|             <!-- <div v-for="item in checkFileList" :key="item.ossId"> | ||||
|               <span v-if="['.png', '.jpg', '.jpeg'].includes(item.fileSuffix)"> | ||||
|                 <image-preview :src="item.url" width="200px" /> | ||||
|               </span> | ||||
|               <span v-else> | ||||
|                 <el-link :href="`${item.url}`" type="primary" :underline="false" target="_blank"> | ||||
|                   <span> {{ item.originalName }} </span> | ||||
|                 </el-link> | ||||
|               </span> | ||||
|             </div> --> | ||||
|             <span> | ||||
|               <image-preview :src="safetyInspectionDetail?.recognizeVo.picture" width="200px" /> | ||||
|             </span> | ||||
|           </el-space> | ||||
|         </el-descriptions-item> | ||||
|         <el-descriptions-item label-align="center" label="检查状态" :span="2" label-class-name="white"> | ||||
|           <el-steps style="max-width: 200px" :active="Number(safetyInspectionDetail?.status)" finish-status="finish"> | ||||
|             <el-step v-for="item in safety_inspection_type" :key="item.value" :title="item.label" /> | ||||
|           </el-steps> | ||||
|         </el-descriptions-item> | ||||
|       </el-descriptions> | ||||
|     </div> | ||||
|   </div> | ||||
|  | ||||
|   <!-- </el-card> --> | ||||
|   <!-- <div class="dialog-footer"> | ||||
|     <div class="btn-item" @click="handleExport"> | ||||
|       <img src="../../../../assets/icons/svg/derived.png" /> | ||||
|       <span>导出</span> | ||||
|     </div> | ||||
|     <div class="btn-item" v-print="'#printMe'"> | ||||
|       <img src="../../../../assets/icons/svg/print.png" /> | ||||
|       <span>打印</span> | ||||
|     </div> | ||||
|   </div> --> | ||||
| </template> | ||||
|  | ||||
| <script setup lang="ts"> | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| import { downLoadOss, listByIds } from '@/api/system/oss'; | ||||
| import { OssVO } from '@/api/system/oss/types'; | ||||
| import { dayjs } from 'element-plus'; | ||||
| import { getViolationRecord } from '@/api/safety/violationRecord'; | ||||
| import { ViolationRecordVO } from '@/api/safety/violationRecord/types'; | ||||
|  | ||||
| interface Props { | ||||
|   violationRecordId?: string | number; | ||||
| } | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { violation_level_type, safety_inspection_type, risk_level_type } = toRefs<any>( | ||||
|   proxy?.useDict('violation_level_type', 'review_type', 'reply_type', 'safety_inspection_type', 'risk_level_type') | ||||
| ); | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const props = defineProps<Props>(); | ||||
| const loading = ref<boolean>(false); | ||||
| const safetyInspectionDetail = ref<any>(); | ||||
| const checkFileList = ref<OssVO[]>(); | ||||
| const rectificationFileList = ref<OssVO[]>(); | ||||
| //检查状态图片 | ||||
| const inspectionType = computed(() => { | ||||
|   let imgName = 'successLogo'; | ||||
|   if (safetyInspectionDetail.value?.status == '2') imgName = 'rectification'; | ||||
|   if (safetyInspectionDetail.value?.reviewType == '1') imgName = 'successful'; | ||||
|   if (safetyInspectionDetail.value?.reviewType == '2') imgName = 'failure'; | ||||
|   console.log('🚀 ~ inspectionType ~ imgName:', imgName); | ||||
|  | ||||
|   return imgName; | ||||
| }); | ||||
|  | ||||
| const get = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await getViolationRecord(props.violationRecordId); | ||||
|   if (res.data && res.code === 200) { | ||||
|     safetyInspectionDetail.value = res.data; | ||||
|     if (res.data.checkFile) { | ||||
|       const checkFileRes = await listByIds(res.data.checkFile.split(',')); | ||||
|       checkFileList.value = checkFileRes.data; | ||||
|     } | ||||
|     if (res.data.rectificationFile) { | ||||
|       const rectificationFileRes = await listByIds(res.data.rectificationFile.split(',')); | ||||
|       rectificationFileList.value = rectificationFileRes.data; | ||||
|     } | ||||
|   } | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| const handleExport = async () => { | ||||
|   await downLoadOss({ id: safetyInspectionDetail.value.id }, '/safety/safetyInspection/export/word', '安全生产监督检查通知书.zip'); | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   console.log('🚀 ~ onMounted ~ props.safetyInspectionId:', props.violationRecordId); | ||||
|   get(); | ||||
| }); | ||||
|  | ||||
| watch( | ||||
|   () => props.violationRecordId, | ||||
|   (newId, oldId) => { | ||||
|     if (newId !== oldId) { | ||||
|       checkFileList.value = undefined; | ||||
|       rectificationFileList.value = undefined; | ||||
|       get(); | ||||
|     } | ||||
|   } | ||||
| ); | ||||
| </script> | ||||
|  | ||||
| <style scoped lang="scss"> | ||||
| #printMe { | ||||
|   padding: 15px 20px 20px 20px !important; | ||||
|   box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12); | ||||
| } | ||||
|  | ||||
| :deep(.white) { | ||||
|   background: #fff !important; | ||||
| } | ||||
|  | ||||
| :deep(.none) { | ||||
|   display: none !important; | ||||
| } | ||||
|  | ||||
| :deep(.zebra) { | ||||
|   background: #f5f7fa; | ||||
| } | ||||
|  | ||||
| @page { | ||||
|   size: auto; | ||||
|   margin: 0mm; | ||||
| } | ||||
|  | ||||
| .dialog-footer { | ||||
|   height: 200px; | ||||
|   display: flex; | ||||
|  | ||||
|   flex-direction: column; | ||||
|   justify-content: space-between; | ||||
|   position: absolute; | ||||
|   top: 14%; | ||||
|   right: 6%; | ||||
|   background: #fff; | ||||
|   box-shadow: 0 0 10px #ddd; | ||||
|   text-align: center; | ||||
|   padding: 20px 10px; | ||||
|  | ||||
|   .btn-item { | ||||
|     display: flex; | ||||
|     flex-direction: column; | ||||
|     justify-content: center; | ||||
|     cursor: pointer; | ||||
|   } | ||||
| } | ||||
|  | ||||
| .resultIcon { | ||||
|   position: absolute; | ||||
|   top: 100px; | ||||
|   right: 50px; | ||||
|   z-index: 10; | ||||
|   width: 105px; | ||||
|   height: 105px; | ||||
|   img { | ||||
|     width: 105px; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										307
									
								
								src/views/safety/violationRecord/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										307
									
								
								src/views/safety/violationRecord/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,307 @@ | ||||
| <template> | ||||
|   <div class="p-2"> | ||||
|     <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave"> | ||||
|       <div v-show="showSearch" class="mb-[10px]"> | ||||
|         <el-card shadow="hover"> | ||||
|           <el-form ref="queryFormRef" :model="queryParams" :inline="true"> | ||||
|             <el-form-item label="工单号" prop="id"> | ||||
|               <el-input v-model="queryParams.id" placeholder="请输入工单号" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="违章时间" prop="violationTime"> | ||||
|               <el-date-picker clearable v-model="queryParams.violationTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择违章时间" /> | ||||
|             </el-form-item> | ||||
|  | ||||
|             <el-form-item> | ||||
|               <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> | ||||
|               <el-button icon="Refresh" @click="resetQuery">重置</el-button> | ||||
|             </el-form-item> | ||||
|           </el-form> | ||||
|         </el-card> | ||||
|       </div> | ||||
|     </transition> | ||||
|  | ||||
|     <el-card shadow="never"> | ||||
|       <template #header> | ||||
|         <el-row :gutter="10" class="mb8"> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['safety:violationRecord:remove']" | ||||
|               >删除</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="violationRecordList" @selection-change="handleSelectionChange"> | ||||
|         <el-table-column type="selection" width="55" align="center" /> | ||||
|         <el-table-column label="工单号" align="center" prop="id" v-if="true" /> | ||||
|         <el-table-column label="违章等级" align="center" prop="levelVo" width="180"> | ||||
|           <template #default="scope"> | ||||
|             <div class="flex justify-center"> | ||||
|               {{ scope.row.levelVo.violationLevel }}:<dict-tag :options="risk_level_type" :value="scope.row.levelVo.riskType" /> | ||||
|             </div> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="违章类型" align="center" prop="violationType"> | ||||
|           <template #default="scope"> | ||||
|             <dict-tag :options="violation_level_type" :value="scope.row.violationType" /> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="违章时间" align="center" prop="violationTime" width="180"> | ||||
|           <template #default="scope"> | ||||
|             <span>{{ parseTime(scope.row.violationTime, '{y}-{m}-{d}') }}</span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="处理人" align="center" prop="handlerName" /> | ||||
|         <el-table-column label="整改措施" align="center" prop="measure" /> | ||||
|         <el-table-column label="整改时间" align="center" prop="rectificationTime" width="180"> | ||||
|           <template #default="scope"> | ||||
|             <span>{{ parseTime(scope.row.rectificationTime, '{y}-{m}-{d}') }}</span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="复查情况" align="center" prop="review" /> | ||||
|         <el-table-column label="复查状态" align="center" prop="reviewType"> | ||||
|           <template #default="scope"> | ||||
|             {{ scope.row.reviewType ? (scope.row.reviewType == 1 ? '已通过' : '未通过') : '' }} | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="复查时间" align="center" prop="reviewTime" width="180"> | ||||
|           <template #default="scope"> | ||||
|             <span>{{ parseTime(scope.row.reviewTime, '{y}-{m}-{d}') }}</span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <!-- <el-table-column label="处理流程类型(0仅通知 1通知整改复查)" align="center" prop="processType" /> --> | ||||
|         <el-table-column label="工单状态" align="center" prop="status"> | ||||
|           <template #default="scope"> | ||||
|             <dict-tag :options="safety_inspection_type" :value="scope.row.status" /> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="备注" align="center" prop="remark" /> | ||||
|         <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||||
|           <template #default="scope"> | ||||
|             <el-tooltip content="详情" placement="top"> | ||||
|               <el-button | ||||
|                 link | ||||
|                 type="primary" | ||||
|                 icon="View" | ||||
|                 @click="handleShowDialog(scope.row)" | ||||
|                 v-hasPermi="['safety:violationRecord:view']" | ||||
|               ></el-button> | ||||
|             </el-tooltip> | ||||
|             <el-tooltip content="违章处理人" placement="top"> | ||||
|               <el-button link type="primary" icon="User" @click="handleUpdate(scope.row)" v-hasPermi="['safety:violationRecord:edit']"></el-button> | ||||
|             </el-tooltip> | ||||
|             <el-tooltip content="删除" placement="top"> | ||||
|               <el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['safety:violationRecord:remove']"></el-button> | ||||
|             </el-tooltip> | ||||
|           </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> | ||||
|     <!-- 添加或修改违规记录对话框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> | ||||
|       <el-form ref="violationRecordFormRef" :model="form" :rules="rules" label-width="90px"> | ||||
|         <el-form-item label="违章处理人" prop="handlerId"> | ||||
|           <el-input v-model="form.handlerId" placeholder="请输入违章处理人" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="处理期限" prop="disposeDeadline"> | ||||
|           <el-date-picker clearable v-model="form.disposeDeadline" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择处理期限"> | ||||
|           </el-date-picker> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="备注" prop="remark"> | ||||
|           <el-input v-model="form.remark" placeholder="请输入备注" /> | ||||
|         </el-form-item> | ||||
|       </el-form> | ||||
|       <template #footer> | ||||
|         <div class="dialog-footer"> | ||||
|           <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button> | ||||
|           <el-button @click="cancel">取 消</el-button> | ||||
|         </div> | ||||
|       </template> | ||||
|     </el-dialog> | ||||
|     <el-dialog title="违规记录详情" v-model="showDetailDialog" width="60vw"> | ||||
|       <ViolationRecordDetailDialog :violation-record-id="currentViolationRecordId" /> | ||||
|     </el-dialog> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="ViolationRecord" lang="ts"> | ||||
| import { listViolationRecord, getViolationRecord, delViolationRecord, addViolationRecord, updateViolationRecord } from '@/api/safety/violationRecord'; | ||||
| import { ViolationRecordVO, ViolationRecordQuery, ViolationRecordForm } from '@/api/safety/violationRecord/types'; | ||||
| import ViolationRecordDetailDialog from './component/violationRecordDetailDialog.vue'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { violation_level_type, risk_level_type, safety_inspection_type } = toRefs<any>( | ||||
|   proxy?.useDict('violation_level_type', 'risk_level_type', 'safety_inspection_type') | ||||
| ); | ||||
|  | ||||
| const violationRecordList = ref<ViolationRecordVO[]>([]); | ||||
| const buttonLoading = ref(false); | ||||
| const loading = ref(true); | ||||
| const showSearch = ref(true); | ||||
| const ids = ref<Array<string | number>>([]); | ||||
| const single = ref(true); | ||||
| const multiple = ref(true); | ||||
| const total = ref(0); | ||||
| const currentViolationRecordId = ref<string | number>(undefined); | ||||
| const showDetailDialog = ref(false); | ||||
|  | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const violationRecordFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: ViolationRecordForm = { | ||||
|   id: undefined, | ||||
|   projectId: undefined, | ||||
|   levelId: undefined, | ||||
|   recognizeId: undefined, | ||||
|   violationType: undefined, | ||||
|   violationTime: undefined, | ||||
|   handlerId: undefined, | ||||
|   disposeDeadline: undefined, | ||||
|   disposeTime: undefined, | ||||
|   measure: undefined, | ||||
|   rectificationTime: undefined, | ||||
|   review: undefined, | ||||
|   reviewType: undefined, | ||||
|   reviewTime: undefined, | ||||
|   processType: undefined, | ||||
|   status: undefined, | ||||
|   remark: undefined | ||||
| }; | ||||
| const data = reactive<PageData<ViolationRecordForm, ViolationRecordQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     id: undefined, | ||||
|     projectId: undefined, | ||||
|     violationType: undefined, | ||||
|     violationTime: undefined, | ||||
|     handlerId: undefined, | ||||
|     disposeDeadline: undefined, | ||||
|     disposeTime: undefined, | ||||
|     measure: undefined, | ||||
|     rectificationTime: undefined, | ||||
|     review: undefined, | ||||
|     reviewType: undefined, | ||||
|     reviewTime: undefined, | ||||
|     processType: undefined, | ||||
|     status: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }], | ||||
|     projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }], | ||||
|     levelId: [{ required: true, message: '违章等级id不能为空', trigger: 'blur' }], | ||||
|     recognizeId: [{ required: true, message: '识别记录id不能为空', trigger: 'blur' }], | ||||
|     processType: [{ required: true, message: '处理流程类型(0仅通知 1通知整改复查)不能为空', trigger: 'change' }], | ||||
|     status: [{ required: true, message: '工单状态不能为空', trigger: 'change' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询违规记录列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listViolationRecord(queryParams.value); | ||||
|   violationRecordList.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   violationRecordFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: ViolationRecordVO[]) => { | ||||
|   ids.value = selection.map((item) => item.id); | ||||
|   single.value = selection.length != 1; | ||||
|   multiple.value = !selection.length; | ||||
| }; | ||||
|  | ||||
| /** 新增按钮操作 */ | ||||
| const handleAdd = () => { | ||||
|   reset(); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '添加违规记录'; | ||||
| }; | ||||
|  | ||||
| /** 修改按钮操作 */ | ||||
| const handleUpdate = async (row?: ViolationRecordVO) => { | ||||
|   reset(); | ||||
|   form.value.id = row.id; | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '选择违章处理人'; | ||||
| }; | ||||
|  | ||||
| const handleShowDialog = (row?: ViolationRecordVO) => { | ||||
|   currentViolationRecordId.value = row.id; | ||||
|   showDetailDialog.value = true; | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   violationRecordFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       await addViolationRecord(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       await getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: ViolationRecordVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除违规记录编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delViolationRecord(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'safety/violationRecord/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `violationRecord_${new Date().getTime()}.xlsx` | ||||
|   ); | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   getList(); | ||||
| }); | ||||
| </script> | ||||
		Reference in New Issue
	
	Block a user