| | |
| | | |
| | | # 本地环境接口地址 |
| | | #VITE_API_URL = 'http://192.168.0.35:8008' |
| | | VITE_API_URL = 'http://192.168.0.29:8008' |
| | | #VITE_API_URL = 'http://192.168.0.29:8008' |
| | | VITE_API_URL = 'http://192.168.0.29:8008' |
| | | #VITE_API_URL = 'http://192.168.0.69:8008' |
| | | #VITE_API_URL = 'http://192.168.0.52:8011/safeplatform' |
| | | #VITE_API_URL = 'http://121.239.169.27:16006/safeplatform' |
| | |
| | | url: import.meta.env.VITE_API_URL + `/safeCheckRegion/select/listRegionName`, |
| | | method: 'get' |
| | | }); |
| | | }, |
| | | getInspectPointAll: () => { |
| | | return request({ |
| | | url: import.meta.env.VITE_API_URL + `/safeCheckPoint/select/getPointRegionRfidId`, |
| | | method: 'post' |
| | | }); |
| | | } |
| | | }; |
| | | } |
对比新文件 |
| | |
| | | import request from '/@/utils/request'; |
| | | |
| | | export function inspectRecordApi() { |
| | | return { |
| | | // v1 |
| | | getInspectRecordList: (data: object) => { |
| | | return request({ |
| | | url: import.meta.env.VITE_API_URL + `/SafeCheckTask/select/listTaskByPage`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | // v1 |
| | | getInspectRecordById: (data: object) => { |
| | | return request({ |
| | | url: import.meta.env.VITE_API_URL + `/SafeCheckTask/select/listTaskMainAndQuota`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | } |
| | | }; |
| | | } |
| | |
| | | }); |
| | | }, |
| | | // v1 |
| | | getInspectTaskById: (data: object) => { |
| | | return request({ |
| | | url: import.meta.env.VITE_API_URL + `/SafeCheckTaskUnit/select/getTaskUnitById`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | // v1 |
| | | addInspectTask: (data: object) => { |
| | | return request({ |
| | | url: import.meta.env.VITE_API_URL + `/SafeCheckTaskUnit/insert/saveTaskUnit`, |
| | |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | getQuotaList: () => { |
| | | return request({ |
| | | url: import.meta.env.VITE_API_URL + `/safeCheckQuotaType/select/listQuotaType`, |
| | | method: 'get' |
| | | }); |
| | | } |
| | | }; |
| | | } |
对比新文件 |
| | |
| | | <template> |
| | | <div class="system-add-menu-container"> |
| | | <el-dialog v-model="ifShowInspectTaskDialog" :title="title" width="60%"> |
| | | <el-form :model="inspectTaskForm" label-width="120px" ref="inspectTaskFormRef"> |
| | | <el-row> |
| | | <el-col :span="12" style="margin-bottom: 20px"> |
| | | <el-form-item label="任务名称" prop="unitName"> |
| | | <el-input v-model="inspectTaskForm.taskName" class="input-add" placeholder="请填写任务名称"> </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" style="margin-bottom: 20px"> |
| | | <el-form-item label="任务类型" prop="taskType"> |
| | | <el-select v-model="inspectTaskForm.taskType" class="input-add" placeholder="请选择任务类型"> |
| | | <el-option v-for="item in workTypeList" :key="item.id" :value="item.id" :label="item.name"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" style="margin-bottom: 20px"> |
| | | <el-form-item label="巡检部门" prop="execDepId"> |
| | | <el-cascader @change="giveClassGroup" placeholder="请选择巡检部门" :options="departmentList" :props="{ emitPath: false, checkStrictly: true, value: 'depId', label: 'depName' }" clearable filterable class="input-add" v-model="inspectTaskForm.execDepId"> </el-cascader> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" style="margin-bottom: 20px"> |
| | | <el-form-item label="巡检班组" prop="execClassgroupId"> |
| | | <el-select v-model="inspectTaskForm.execClassgroupId" placeholder="请选择巡检班组" class="input-add"> |
| | | <el-option v-for="item in classGroup" :key="item.id" :value="item.id" :label="item.groupName"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" style="margin-bottom: 20px"> |
| | | <el-form-item label="任务开始时间" prop="startTime"> |
| | | <el-date-picker v-model="inspectTaskForm.startTime" placeholder="请选择任务开始时间" type="datetime" format="YYYY/MM/DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" class="input-add" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <div class="checkUnit-point"> |
| | | <el-tabs class="active" v-model="activeName"> |
| | | <el-tab-pane label="巡检链" name="inspectChain"> |
| | | <el-table :data="inspectTaskForm.points" fit style="width: 100%"> |
| | | <el-table-column type="index" label="序号" width="60" /> |
| | | <el-table-column prop="region" label="巡检点" show-overflow-tooltip align="center"></el-table-column> |
| | | <el-table-column prop="quotaContent" label="指标作业" show-overflow-tooltip align="center"></el-table-column> |
| | | <el-table-column prop="quotaUnit" label="指标单位" show-overflow-tooltip align="center"></el-table-column> |
| | | <!-- <el-table-column label="操作" width="150" align="center">--> |
| | | <!-- <template #default="scope">--> |
| | | <!-- <el-button size="small" text type="danger" @click="onDelCheckUnit(scope.$index, scope.row)">删除</el-button>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | </el-table> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </div> |
| | | <div align="right" v-show="inspectPointConfirm"> |
| | | <el-button type="warning" @click="inspectPointDialog = false" size="default" plain>取消</el-button> |
| | | <el-button type="primary" @click="submitInspectTask()" size="default">确认</el-button> |
| | | </div> |
| | | </el-form> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { reactive, toRefs, ref } from 'vue'; |
| | | import { RFIDApi } from '/@/api/intellectInspectSystem/RFID'; |
| | | import { ElMessage } from 'element-plus/es'; |
| | | import { inspectTaskApi } from '/@/api/intellectInspectSystem/inspectTask'; |
| | | import { facilityAreaApi } from '/@/api/intellectInspectSystem/facilityAreaManage'; |
| | | import { inspectRecordApi } from '/@/api/intellectInspectSystem/inspectRecord'; |
| | | interface dataState { |
| | | title: string; |
| | | pointTitle: string; |
| | | activeName: string; |
| | | inspectPointConfirm: boolean; |
| | | inspectPointDialog: boolean; |
| | | ifShowInspectTaskDialog: boolean; |
| | | inspectPointForm: inspectPointForm; |
| | | inspectTaskForm: { |
| | | execClassgroupId: number | null; |
| | | execDepId: number | null; |
| | | id: number | null; |
| | | startTime: string | null; |
| | | taskName: string | null; |
| | | taskType: number | null; |
| | | validTime: string | null; |
| | | points: Array<inspectPointForm>; |
| | | }; |
| | | workTypeList: []; |
| | | departmentList: []; |
| | | timeList: []; |
| | | dataReportTypeList: Array<dataReport>; |
| | | firstReferenceValueList: Array<dataReport>; |
| | | secondReferenceSignList: Array<dataReport>; |
| | | thirdReferenceSignList: Array<dataReport>; |
| | | classGroupList: Array<classGroup>; |
| | | classGroup: Array<classGroup>; |
| | | quotaList: Array<quota>; |
| | | inspectPointAllList: Array<inspectPointAllState>; |
| | | } |
| | | interface inspectPointAllState { |
| | | id: number; |
| | | code: string; |
| | | regionId: number; |
| | | rfidId: number; |
| | | } |
| | | interface classGroup { |
| | | depId: number; |
| | | } |
| | | interface dataReport { |
| | | id: number; |
| | | name: string; |
| | | } |
| | | interface quota { |
| | | id: number; |
| | | type: string; |
| | | unit: string; |
| | | } |
| | | interface inspectPointForm { |
| | | id: number | null; |
| | | unitId: number | null; |
| | | unitUuid: string | null; |
| | | pointId: number | null; |
| | | pointUuid: string | null; |
| | | regionId: number | null; |
| | | regionUuid: string | null; |
| | | rfidId: number | null; |
| | | quotaId: number | null; |
| | | quotaUnit: string | null; |
| | | execSequence: number | null; |
| | | dataReportType: number | null; |
| | | firstReferenceValue: number | null; |
| | | secondReferenceSign: number | null; |
| | | secondReferenceValue: number | null; |
| | | thirdReferenceSign: number | null; |
| | | thirdReferenceValue: number | null; |
| | | } |
| | | export default { |
| | | name: 'inspectTaskDialog', |
| | | setup(props: any, context: any) { |
| | | const inspectTaskFormRef = ref(); |
| | | const data = reactive<dataState>({ |
| | | title: '', |
| | | pointTitle: '', |
| | | activeName: 'inspectChain', |
| | | inspectPointConfirm: false, |
| | | inspectPointDialog: false, |
| | | ifShowInspectTaskDialog: false, |
| | | inspectPointForm: { |
| | | id: null, |
| | | unitId: null, |
| | | unitUuid: null, |
| | | pointId: null, |
| | | pointUuid: null, |
| | | regionId: null, |
| | | regionUuid: null, |
| | | rfidId: null, |
| | | quotaId: null, |
| | | quotaUnit: null, |
| | | execSequence: null, |
| | | dataReportType: null, |
| | | firstReferenceValue: null, |
| | | secondReferenceSign: null, |
| | | secondReferenceValue: null, |
| | | thirdReferenceSign: null, |
| | | thirdReferenceValue: null |
| | | }, |
| | | inspectTaskForm: { |
| | | execClassgroupId: null, |
| | | execDepId: null, |
| | | id: null, |
| | | points: [], |
| | | startTime: null, |
| | | taskName: null, |
| | | taskType: null, |
| | | validTime: null |
| | | }, |
| | | workTypeList: [], |
| | | departmentList: [], |
| | | timeList: [], |
| | | classGroupList: [], |
| | | classGroup: [], |
| | | quotaList: [], |
| | | inspectPointAllList: [], |
| | | dataReportTypeList: [ |
| | | { id: 1, name: '选择' }, |
| | | { id: 2, name: '填空' }, |
| | | { id: 3, name: '选择并填空' } |
| | | ], |
| | | firstReferenceValueList: [ |
| | | { id: 0, name: '正常' }, |
| | | { id: 1, name: '异常' } |
| | | ], |
| | | secondReferenceSignList: [ |
| | | { id: 1, name: '>' }, |
| | | { id: 2, name: '>=' } |
| | | ], |
| | | thirdReferenceSignList: [ |
| | | { id: 3, name: '<' }, |
| | | { id: 4, name: '<=' } |
| | | ] |
| | | }); |
| | | |
| | | const openInspectPointDialog = (type: string, value: {}) => { |
| | | data.inspectPointDialog = true; |
| | | if (type === '新增') { |
| | | data.pointTitle = '新增巡检点'; |
| | | data.inspectPointForm = { |
| | | id: null, |
| | | unitId: null, |
| | | unitUuid: null, |
| | | pointId: null, |
| | | pointUuid: null, |
| | | regionId: null, |
| | | regionUuid: null, |
| | | rfidId: null, |
| | | quotaId: null, |
| | | quotaUnit: null, |
| | | execSequence: null, |
| | | dataReportType: null, |
| | | firstReferenceValue: null, |
| | | secondReferenceSign: null, |
| | | secondReferenceValue: null, |
| | | thirdReferenceSign: null, |
| | | thirdReferenceValue: null |
| | | }; |
| | | } else { |
| | | data.pointTitle = '修改巡检点'; |
| | | data.inspectPointForm = JSON.parse(JSON.stringify(value)); |
| | | } |
| | | }; |
| | | |
| | | const showInspectRecordDialog = (type: string, value: { id: number; uuid: string }, workTypeList: [], department: [], timeType: [], classGroupList: [], quotaList: [], inspectPointAllList: []) => { |
| | | data.quotaList = JSON.parse(JSON.stringify(quotaList)); |
| | | data.timeList = JSON.parse(JSON.stringify(timeType)); |
| | | data.inspectPointAllList = JSON.parse(JSON.stringify(inspectPointAllList)); |
| | | data.workTypeList = JSON.parse(JSON.stringify(workTypeList)); |
| | | data.departmentList = JSON.parse(JSON.stringify(department)); |
| | | data.classGroupList = JSON.parse(JSON.stringify(classGroupList)); |
| | | data.ifShowInspectTaskDialog = true; |
| | | data.inspectPointConfirm = false; |
| | | data.title = '查看巡检任务'; |
| | | inspectRecordApi() |
| | | .getInspectRecordById({ id: value.id, uuid: value.uuid }) |
| | | .then((res) => { |
| | | if (res.data.code === '200') { |
| | | debugger; |
| | | data.inspectTaskForm.execDepId = res.data.data.execDepId; |
| | | giveClassGroup(); |
| | | data.inspectTaskForm = JSON.parse(JSON.stringify(res.data.data)); |
| | | } else { |
| | | } |
| | | }) |
| | | .catch((error) => {}); |
| | | }; |
| | | |
| | | const submitInspectPoint = async () => { |
| | | if (data.title === '新增巡检任务' && data.pointTitle === '新增巡检点') { |
| | | if (data.inspectTaskForm.points.length === 0) { |
| | | data.inspectPointForm.execSequence = 1; |
| | | } else { |
| | | data.inspectPointForm.execSequence = (data.inspectTaskForm.points[data.inspectTaskForm.points.length - 1].execSequence as number) + 1; |
| | | } |
| | | data.inspectTaskForm.points.push(data.inspectPointForm); |
| | | data.inspectPointDialog = false; |
| | | } else if (data.title === '新增巡检任务' && data.pointTitle === '修改巡检点') { |
| | | let result = data.inspectTaskForm.points.findIndex((item) => item.id === data.inspectPointForm.id); |
| | | data.inspectTaskForm.points[result] = data.inspectPointForm; |
| | | data.inspectPointDialog = false; |
| | | } else if (data.title === '修改巡检任务' && data.pointTitle === '新增巡检点') { |
| | | data.inspectPointForm.unitId = data.inspectTaskForm.id; |
| | | if (data.inspectTaskForm.points.length === 0) { |
| | | data.inspectPointForm.execSequence = 1; |
| | | } else { |
| | | data.inspectPointForm.execSequence = (data.inspectTaskForm.points[data.inspectTaskForm.points.length - 1].execSequence as number) + 1; |
| | | } |
| | | let res = await inspectTaskApi().addChainOfInspectTask(data.inspectPointForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '巡检点新增成功', |
| | | duration: 2000 |
| | | }); |
| | | data.inspectPointDialog = false; |
| | | data.inspectTaskForm.points.push(data.inspectPointForm); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } else { |
| | | data.inspectPointForm.unitId = data.inspectTaskForm.id; |
| | | let res = await inspectTaskApi().modChainOfInspectTask(data.inspectPointForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '巡检点修改成功', |
| | | duration: 2000 |
| | | }); |
| | | let result = data.inspectTaskForm.points.findIndex((item) => item.id === data.inspectPointForm.id); |
| | | data.inspectTaskForm.points[result] = data.inspectPointForm; |
| | | data.inspectPointDialog = false; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | const deleteFlow = async (index: number, item: { id: number }) => { |
| | | if (data.pointTitle === '新增巡检点') { |
| | | data.inspectTaskForm.points.splice(index, 1); |
| | | } else { |
| | | let res = await inspectTaskApi().deleteChainOfInspectTask({ id: item.id, unitId: data.inspectTaskForm.id }); |
| | | if (res.data.code === '200') { |
| | | data.inspectTaskForm.points.splice(index, 1); |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '巡检点删除成功' |
| | | }); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | const giveRegionAndRFID = () => { |
| | | data.inspectPointForm.regionId = data.inspectPointAllList.find((item) => item.id === data.inspectPointForm.pointId)?.regionId as number; |
| | | data.inspectPointForm.rfidId = data.inspectPointAllList.find((item) => item.id === data.inspectPointForm.pointId)?.rfidId as number; |
| | | }; |
| | | |
| | | const giveClassGroup = () => { |
| | | debugger; |
| | | data.inspectTaskForm.execClassgroupId = null; |
| | | data.classGroup = data.classGroupList.filter((item) => item.depId === data.inspectTaskForm.execDepId); |
| | | }; |
| | | |
| | | const giveQuotaUnit = () => { |
| | | data.inspectPointForm.quotaUnit = data.quotaList.find((item) => item.id === data.inspectPointForm.quotaId)?.unit as string; |
| | | }; |
| | | |
| | | const submitInspectTask = () => { |
| | | inspectTaskFormRef.value.validate(async (valid: Boolean) => { |
| | | if (valid) { |
| | | if (data.title === '新增巡检任务') { |
| | | let res = await inspectTaskApi().addInspectTask(data.inspectTaskForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '巡检任务新增成功', |
| | | duration: 2000 |
| | | }); |
| | | data.ifShowInspectTaskDialog = false; |
| | | context.emit('refreshInspectTask'); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } else { |
| | | let res = await inspectTaskApi().modInspectTask(data.inspectTaskForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '巡检指标修改成功', |
| | | duration: 2000 |
| | | }); |
| | | data.ifShowInspectTaskDialog = false; |
| | | context.emit('refreshInspectTask'); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '请完善基本信息' |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | return { |
| | | ...toRefs(data), |
| | | inspectTaskFormRef, |
| | | deleteFlow, |
| | | giveQuotaUnit, |
| | | giveClassGroup, |
| | | submitInspectTask, |
| | | submitInspectPoint, |
| | | giveRegionAndRFID, |
| | | showInspectRecordDialog, |
| | | openInspectPointDialog |
| | | }; |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | $homeNavLengh: 8; |
| | | .home-container { |
| | | height: calc(100vh - 114px); |
| | | box-sizing: border-box; |
| | | overflow: hidden; |
| | | .homeCard { |
| | | width: 100%; |
| | | padding: 20px; |
| | | box-sizing: border-box; |
| | | background: #fff; |
| | | border-radius: 4px; |
| | | |
| | | .main-card { |
| | | width: 100%; |
| | | height: 100%; |
| | | .cardTop { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | margin-bottom: 20px; |
| | | .mainCardBtn { |
| | | margin: 0; |
| | | } |
| | | } |
| | | .pageBtn { |
| | | height: 60px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: right; |
| | | |
| | | .demo-pagination-block + .demo-pagination-block { |
| | | margin-top: 10px; |
| | | } |
| | | .demo-pagination-block .demonstration { |
| | | margin-bottom: 16px; |
| | | } |
| | | } |
| | | } |
| | | &:last-of-type { |
| | | height: calc(100% - 100px); |
| | | } |
| | | } |
| | | .el-row { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-bottom: 20px; |
| | | &:last-child { |
| | | margin-bottom: 0; |
| | | } |
| | | .grid-content { |
| | | align-items: center; |
| | | min-height: 36px; |
| | | } |
| | | |
| | | .topInfo { |
| | | display: flex; |
| | | align-items: center; |
| | | font-size: 16px; |
| | | font-weight: bold; |
| | | |
| | | & > div { |
| | | white-space: nowrap; |
| | | margin-right: 20px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .stepItem { |
| | | width: 100%; |
| | | display: flex; |
| | | align-items: flex-start; |
| | | margin-bottom: 30px; |
| | | margin-left: 30px; |
| | | padding-bottom: 30px; |
| | | border-left: 2px solid #ccc; |
| | | &:first-of-type { |
| | | margin-top: 30px; |
| | | } |
| | | &:last-of-type { |
| | | margin-bottom: 0; |
| | | border-left: none; |
| | | } |
| | | .stepNum { |
| | | width: 30px; |
| | | height: 30px; |
| | | border-radius: 15px; |
| | | box-sizing: border-box; |
| | | color: #333; |
| | | border: 1px solid #999; |
| | | line-height: 28px; |
| | | text-align: center; |
| | | margin-right: 10px; |
| | | margin-left: -16px; |
| | | margin-top: -30px; |
| | | } |
| | | .stepCard { |
| | | width: 100%; |
| | | margin-top: -30px; |
| | | |
| | | .box-card { |
| | | width: 100%; |
| | | &:deep(.el-card__header) { |
| | | padding: 10px 15px; |
| | | } |
| | | .card-header { |
| | | width: 100%; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | & > div:first-of-type { |
| | | margin-right: 80px; |
| | | font-size: 18px; |
| | | font-weight: bold; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | &:hover .card-header { |
| | | color: #0098f5; |
| | | } |
| | | &:hover .stepNum { |
| | | border: 2px solid #0098f5; |
| | | color: #0098f5; |
| | | } |
| | | } |
| | | :deep(.el-date-editor) { |
| | | width: 100%; |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class="home-container"> |
| | | <el-scrollbar height="100%"> |
| | | <el-row class="homeCard"> |
| | | <el-col :span="12"> |
| | | <div class="grid-content topInfo"> |
| | | <el-select v-model="searchType" @change="changeSearch" placeholder="任务名称"> |
| | | <el-option label="巡检任务类型" value="巡检任务类型" /> |
| | | <el-option label="创建人" value="创建人" /> |
| | | <el-option label="巡检人" value="巡检人" /> |
| | | <el-option label="检查频次" value="检查频次" /> |
| | | <el-option label="开始时间" value="开始时间" /> |
| | | </el-select> |
| | | <el-input v-model="searchContent" v-if="searchType == '任务名称'" placeholder="请输入任务名称"></el-input> |
| | | <el-input |
| | | v-else-if="searchType == '检查频次'" |
| | | v-model="searchContent" |
| | | placeholder="请输入检查频次" |
| | | > |
| | | <template #append> |
| | | <el-select v-model="searchUnit" placeholder="选择单位"> |
| | | <el-option label="分钟" value="分钟" /> |
| | | <el-option label="小时" value="小时" /> |
| | | <el-option label="天" value="天" /> |
| | | </el-select> |
| | | </template> |
| | | </el-input> |
| | | <el-select v-model="searchContent" v-else-if="searchType == '巡检任务类型'" placeholder="请选择任务类型"> |
| | | <el-option v-for="(item,index) in typeOptions" :label="item.name" :value="item.value" :key="index"/> |
| | | </el-select> |
| | | <el-select v-model="searchContent" v-else-if="searchType == '创建人'" placeholder="请选择创建人"> |
| | | <el-option v-for="(item,index) in createrOptions" :label="item.name" :value="item.value" :key="index"/> |
| | | </el-select> |
| | | <el-select v-model="searchContent" v-else-if="searchType == '巡检人'" placeholder="请选择巡检人"> |
| | | <el-option v-for="(item,index) in inspectorOptions" :label="item.name" :value="item.value" :key="index"/> |
| | | </el-select> |
| | | <el-date-picker |
| | | v-model="searchContent" |
| | | type="date" |
| | | v-else |
| | | :placeholder="'请选择' + searchType" |
| | | size="large" |
| | | style="margin-right: 20px" |
| | | /> |
| | | <el-button type="primary">查询</el-button> |
| | | <el-button plain>重置</el-button> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | <div class="homeCard"> |
| | | <div class="main-card"> |
| | | <el-row class="cardTop"> |
| | | <el-col :span="12" class="mainCardBtn"> |
| | | <el-button type="primary" :icon="Plus" size="default" @click="dialogAddRecord=true">新建</el-button> |
| | | <el-button type="danger" :icon="Delete" size="default" plain>删除</el-button> |
| | | </el-col> |
| | | <el-button type="primary" :icon="Refresh" size="default"/> |
| | | </el-row> |
| | | <el-table |
| | | ref="multipleTableRef" |
| | | :data="tableData" |
| | | style="width: 100%" |
| | | :header-cell-style="{background: '#fafafa'}" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column property="name" label="任务名称" width="200"/> |
| | | <el-table-column property="type" label="任务类型"/> |
| | | <el-table-column property="creater" label="创建人"/> |
| | | <el-table-column property="inspector" label="巡检人"/> |
| | | <el-table-column property="frequency" label="检查频次"/> |
| | | <el-table-column property="unit" label="频次单位"/> |
| | | <el-table-column property="startTime" label="任务开始时间" width="180"/> |
| | | <el-table-column property="validTime" label="任务有效时间" width="180"/> |
| | | <el-table-column property="createTime" label="创建时间" width="180"/> |
| | | <el-table-column property="chainLength" label="巡检链长度" width="160"/> |
| | | <el-table-column property="status" label="状态" width="60"/> |
| | | <el-table-column fixed="right" label="操作" align="center" width="300"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" :icon="View" @click="viewRecord(scope.row)">查看</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <div class="pageBtn"> |
| | | <el-pagination |
| | | v-model:currentPage="currentPage" |
| | | v-model:page-size="pageSize" |
| | | :page-sizes="[10, 15]" |
| | | small=false |
| | | background |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="100" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </el-scrollbar> |
| | | <el-dialog v-model="dialogDetails" title="巡检任务"> |
| | | <el-form :model="details" label-width="120px"> |
| | | <el-form-item label="任务名称"> |
| | | <el-input |
| | | v-model="details.name" |
| | | readonly |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="任务类型"> |
| | | <el-input |
| | | v-model="details.type" |
| | | readonly |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="执行巡检人员"> |
| | | <el-input |
| | | v-model="details.inspector" |
| | | readonly |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="检查频次"> |
| | | <el-input |
| | | v-model="details.inspector" |
| | | readonly |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="检查频次" prop="frequency"> |
| | | <el-input |
| | | v-model="details.frequency" |
| | | readonly |
| | | > |
| | | <template #append> |
| | | <el-input |
| | | v-model="details.unit" |
| | | readonly |
| | | /> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="周期开始时间"> |
| | | <el-input |
| | | v-model="details.startTime" |
| | | readonly |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="周期有效时间"> |
| | | <el-input |
| | | v-model="details.validTime" |
| | | readonly |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="巡检链"> |
| | | <div style="width: 100%;margin-left: -30px"> |
| | | <div v-for="(item,index) in details.shiftSteps" class="stepItem"> |
| | | <div class="stepNum">{{index+1}}</div> |
| | | <div class="stepCard"> |
| | | <el-card class="box-card" shadow="hover"> |
| | | <template #header> |
| | | <div class="card-header"> |
| | | <div>{{item.name}}</div> |
| | | </div> |
| | | </template> |
| | | <div> |
| | | <el-table :data="item.inspectorData" style="width: 100%" :default-sort="{ prop: 'sort', order: 'ascending'}" :header-cell-style="{background: '#fafafa',padding: '5px'}"> |
| | | <el-table-column property="sort" sortable label="排序"/> |
| | | <el-table-column property="name" label="巡检点名称"/> |
| | | <el-table-column property="section" label="所属设备区域"/> |
| | | <el-table-column property="rfid" label="关联RFID"/> |
| | | <el-table-column property="norm" label="巡检指标"/> |
| | | <el-table-column property="reference" label="数据参考值"/> |
| | | </el-table> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="dialogDetails = false" size="default">确认</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-dialog> |
| | | </div> |
| | | <div class="home-container"> |
| | | <div style="height: 100%"> |
| | | <el-row class="homeCard"> |
| | | <div class="basic-line"> |
| | | <span>任务类型:</span> |
| | | <el-select v-model="tableData.params.workType" clearable filterable class="input-box" placeholder="任务类型"> |
| | | <el-option v-for="item in workTypeList" :key="item.id" :label="item.name" :value="item.id"></el-option> |
| | | </el-select> |
| | | </div> |
| | | <div class="basic-line"> |
| | | <span>执行班组:</span> |
| | | <el-select v-model="tableData.params.execClassgroupId" clearable filterable class="input-box" placeholder="执行班组"> |
| | | <el-option v-for="item in classGroupList" :key="item.id" :label="item.groupName" :value="item.id"></el-option> |
| | | </el-select> |
| | | </div> |
| | | <div style="padding-bottom: 10px"> |
| | | <el-button type="primary" @click="getInspectRecord">查询</el-button> |
| | | <el-button plain @click="reset">重置</el-button> |
| | | </div> |
| | | </el-row> |
| | | <div class="homeCard"> |
| | | <div class="main-card"> |
| | | <el-row class="cardTop"> |
| | | <el-button type="primary" :icon="Refresh" size="default" /> |
| | | </el-row> |
| | | <el-table ref="multipleTableRef" :data="tableData.inspectRecordData" style="width: 100%" height="calc(100% - 100px)" :header-cell-style="{ background: '#fafafa' }"> |
| | | <el-table-column property="taskName" label="任务名称" /> |
| | | <el-table-column property="taskType" label="任务类型"> |
| | | <template #default="scope"> |
| | | <span> |
| | | {{ parseNumber(scope.row.taskType, '任务类型') }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column property="execClassgroupId" label="巡检班组"> |
| | | <template #default="scope"> |
| | | <span> |
| | | {{ parseNumber(scope.row.execClassgroupId, '巡检班组') }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column property="frequency" label="检查频次"> |
| | | <template #default="scope"> |
| | | <span> |
| | | {{ scope.row.checkCycle }} |
| | | </span> |
| | | <span> |
| | | {{ parseNumber(scope.row.checkCycleUnit, '检查频次') }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column prop="validTime" label="有效时间" show-overflow-tooltip>--> |
| | | <!-- <template #default="scope">--> |
| | | <!-- <span>--> |
| | | <!-- {{ scope.row.validTime }}--> |
| | | <!-- </span>--> |
| | | <!-- <span>--> |
| | | <!-- {{ parseNumber(scope.row.validTimeUnit, '检查频次') }}--> |
| | | <!-- </span>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <!-- <el-table-column prop="validTime" label="提醒时间" show-overflow-tooltip>--> |
| | | <!-- <template #default="scope">--> |
| | | <!-- <span>--> |
| | | <!-- {{ scope.row.noticeTime }}--> |
| | | <!-- </span>--> |
| | | <!-- <span>--> |
| | | <!-- {{ parseNumber(scope.row.noticeTimeUnit, '检查频次') }}--> |
| | | <!-- </span>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <el-table-column property="startTime" label="任务开始时间" /> |
| | | <el-table-column prop="execUserName" label="执行人" show-overflow-tooltip></el-table-column> |
| | | <el-table-column property="resultStatus" label="状态"> |
| | | <template #default="scope"> |
| | | <span> |
| | | {{ parseNumber(scope.row.resultStatus, '巡检状态') }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column fixed="right" label="操作" align="center" width="300"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" :icon="View" @click="openInspectRecordDialog('查看', scope.row)">查看</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div class="pageBtn"> |
| | | <el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" :pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="tableData.params.pageIndex" background v-model:page-size="tableData.params.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="tableData.total" class="page-position"> </el-pagination> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <inspect-record-dialog ref="inspectRecordDialogRef" @refreshInspectRecord="getInspectRecord"></inspect-record-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import { toRefs, reactive, ref } from 'vue'; |
| | | import { storeToRefs } from 'pinia'; |
| | | import { initBackEndControlRoutes } from '/@/router/backEnd'; |
| | | import {useUserInfo} from "/@/stores/userInfo"; |
| | | import { Session } from '/@/utils/storage'; |
| | | import { Edit, View, Plus, Delete, Refresh, Search, Download } from '@element-plus/icons-vue' |
| | | import { ElTable, ElMessage } from 'element-plus' |
| | | import { FormInstance, FormRules } from 'element-plus' |
| | | let global: any = { |
| | | homeChartOne: null, |
| | | homeChartTwo: null, |
| | | homeCharThree: null, |
| | | dispose: [null, '', undefined], |
| | | }; |
| | | <script lang="ts"> |
| | | import { toRefs, reactive, ref, onMounted, nextTick } from 'vue'; |
| | | import { Edit, View, Plus, Delete, Refresh, Search, Download } from '@element-plus/icons-vue'; |
| | | import { ElTable, ElMessage } from 'element-plus'; |
| | | import { inspectRecordApi } from '/@/api/intellectInspectSystem/inspectRecord'; |
| | | import inspectRecordDialog from './components/inspectRecordDialog.vue'; |
| | | import { departmentApi } from '/@/api/systemManage/department'; |
| | | import { teamManageApi } from '/@/api/systemManage/personShiftManage/teamManage'; |
| | | import { inspectPointApi } from '/@/api/intellectInspectSystem/inspectPointManage'; |
| | | import { inspectTaskApi } from '/@/api/intellectInspectSystem/inspectTask'; |
| | | let global: any = { |
| | | homeChartOne: null, |
| | | homeChartTwo: null, |
| | | homeCharThree: null, |
| | | dispose: [null, '', undefined] |
| | | }; |
| | | |
| | | interface stateType { |
| | | homeOne: Array <type> |
| | | } |
| | | interface type { |
| | | interface stateType { |
| | | tableData: { |
| | | inspectRecordData: []; |
| | | total: number; |
| | | loading: boolean; |
| | | params: { |
| | | pageIndex: number | null; |
| | | pageSize: number | null; |
| | | taskName: string | null; |
| | | taskType: number | null; |
| | | taskStatus: number | null; |
| | | execUserId: number | null; |
| | | execClassgroupId: number | null; |
| | | execDepId: number | null; |
| | | startTime: string | null; |
| | | validTime: string | null; |
| | | createUserId: number | null; |
| | | reportTime: string | null; |
| | | }; |
| | | }; |
| | | workTypeList: Array<type>; |
| | | quotaList: []; |
| | | departmentList: []; |
| | | classGroupList: Array<classGroup>; |
| | | inspectPointAllList: []; |
| | | timeType: Array<type>; |
| | | resultStatusList: Array<type>; |
| | | } |
| | | interface type { |
| | | id: number; |
| | | name: string; |
| | | } |
| | | interface classGroup { |
| | | id: number; |
| | | groupName: string; |
| | | } |
| | | export default { |
| | | name: 'index', |
| | | components: { inspectRecordDialog }, |
| | | setup() { |
| | | const inspectRecordDialogRef = ref(); |
| | | const state = reactive<stateType>({ |
| | | tableData: { |
| | | inspectRecordData: [], |
| | | total: 0, |
| | | loading: false, |
| | | params: { |
| | | pageIndex: 1, |
| | | pageSize: 10, |
| | | taskName: null, |
| | | taskType: null, |
| | | taskStatus: null, |
| | | execUserId: null, |
| | | execClassgroupId: null, |
| | | execDepId: null, |
| | | startTime: null, |
| | | validTime: null, |
| | | createUserId: null, |
| | | reportTime: null |
| | | } |
| | | }, |
| | | workTypeList: [ |
| | | { id: 1, name: '日常任务' }, |
| | | { id: 2, name: '周期任务' } |
| | | ], |
| | | resultStatusList: [ |
| | | { id: 0, name: '正常' }, |
| | | { id: 1, name: '异常' } |
| | | ], |
| | | quotaList: [], |
| | | departmentList: [], |
| | | classGroupList: [], |
| | | inspectPointAllList: [], |
| | | timeType: [ |
| | | { id: 1, name: '分' }, |
| | | { id: 2, name: '小时' }, |
| | | { id: 3, name: '日' }, |
| | | { id: 4, name: '月' }, |
| | | { id: 5, name: '年' } |
| | | ] |
| | | }); |
| | | |
| | | } |
| | | const userInfo = useUserInfo() |
| | | const { userInfos } = storeToRefs(userInfo); |
| | | //获取巡检记录数据 |
| | | const getInspectRecord = async () => { |
| | | let res = await inspectRecordApi().getInspectRecordList(state.tableData.params); |
| | | if (res.data.code === '200') { |
| | | state.tableData.inspectRecordData = res.data.data.records; |
| | | state.tableData.total = res.data.data.total; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // 顶部筛选搜索 |
| | | const searchType = ref('任务名称') |
| | | const typeOptions = ref([ |
| | | { |
| | | name: '日常检查', |
| | | value: '日常检查' |
| | | }, |
| | | { |
| | | name: '周期检查', |
| | | value: '周期检查' |
| | | } |
| | | ]) |
| | | const createrOptions = ref([ |
| | | { |
| | | name: '张三', |
| | | value: '张三' |
| | | }, |
| | | { |
| | | name: '李四', |
| | | value: '李四' |
| | | } |
| | | ]) |
| | | const inspectorOptions = ref([ |
| | | { |
| | | name: '李四', |
| | | value: '李四' |
| | | }, |
| | | { |
| | | name: '张三', |
| | | value: '张三' |
| | | } |
| | | ]) |
| | | const searchUnit = ref('小时') |
| | | const changeSearch =()=>{ |
| | | searchContent.value='' |
| | | } |
| | | const searchContent = ref() |
| | | //获取部门 |
| | | const getDepartmentData = async () => { |
| | | let res = await departmentApi().getDepartmentList(); |
| | | if (res.data.code === '200') { |
| | | state.departmentList = res.data.data; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | //获取部门 |
| | | const getQuotaList = async () => { |
| | | let res = await inspectTaskApi().getQuotaList(); |
| | | if (res.data.code === '200') { |
| | | state.quotaList = res.data.data; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | const currentPage = ref(1) |
| | | const pageSize = ref(10) |
| | | const chosenIndex = ref(-1) |
| | | const chosenShiftIndex = ref(-1) |
| | | const chosenInspectionIndex = ref(-1) |
| | | const handleSizeChange = (val: number) => { |
| | | console.log(`${val} items per page`) |
| | | } |
| | | const handleCurrentChange = (val: number) => { |
| | | console.log(`current page: ${val}`) |
| | | } |
| | | //获取巡检点 |
| | | const getInspectTaskPoint = async () => { |
| | | let res = await inspectPointApi().getInspectPointAll(); |
| | | if (res.data.code === '200') { |
| | | state.inspectPointAllList = res.data.data; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // 时间格式化 |
| | | const timeForm = { |
| | | hour12: false, |
| | | year: 'numeric', |
| | | month: '2-digit', |
| | | day: '2-digit', |
| | | hour: '2-digit', |
| | | minute: '2-digit', |
| | | second: '2-digit' |
| | | } |
| | | const tableData = reactive( |
| | | [ |
| | | { |
| | | name: '甲醛装置()列现场岗位巡检', |
| | | type: '周期检查', |
| | | creater: '管理员A', |
| | | inspector: '张三', |
| | | frequency: 2, |
| | | unit: '小时', |
| | | startTime: '2022-07-02 13:01:37', |
| | | validTime: '30分钟', |
| | | createTime: '2022-07-02 12:03:47', |
| | | chainLength: '20', |
| | | status: '开启', |
| | | shiftSteps:[ |
| | | { |
| | | name: '风机系统', |
| | | inspectorData:[ |
| | | { |
| | | sort: 1, |
| | | name: '73011', |
| | | section: '风机系统', |
| | | rfid: '风机系统1标签', |
| | | norm: '风机声音', |
| | | reference: '10<正常<50' |
| | | }, |
| | | { |
| | | sort: 2, |
| | | name: '73012', |
| | | section: '风机系统', |
| | | rfid: '风机系统2标签', |
| | | norm: '设备温度', |
| | | reference: '20<正常<50' |
| | | }, |
| | | { |
| | | sort: 3, |
| | | name: '73013', |
| | | section: '风机系统', |
| | | rfid: '风机系统3标签', |
| | | norm: '风机震动', |
| | | reference: '30<正常<50' |
| | | } |
| | | ] |
| | | //获取班组 |
| | | const getClassGroupData = async () => { |
| | | let res = await teamManageApi().getRecord({ depIp: null, groupName: null, containGroupMemberEnable: null }); |
| | | if (res.data.code === '200') { |
| | | state.classGroupList = res.data.data; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | }, |
| | | { |
| | | name: 'A场所', |
| | | inspectorData:[ |
| | | { |
| | | sort: 1, |
| | | name: '73021', |
| | | section: '风机系统', |
| | | rfid: '风机系统1标签', |
| | | norm: '风机声音', |
| | | reference: '10<正常<50' |
| | | }, |
| | | { |
| | | sort: 2, |
| | | name: '73022', |
| | | section: '风机系统', |
| | | rfid: '风机系统2标签', |
| | | norm: '设备温度', |
| | | reference: '20<正常<50' |
| | | }, |
| | | { |
| | | sort: 3, |
| | | name: '73023', |
| | | section: '风机系统', |
| | | rfid: '风机系统3标签', |
| | | norm: '风机震动', |
| | | reference: '30<正常<50' |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | name: 'A车间日常巡检', |
| | | type: '日常检查', |
| | | creater: '管理员B', |
| | | inspector: '李四', |
| | | frequency: 4, |
| | | unit: '小时', |
| | | startTime: '2022-07-02 12:45:37', |
| | | validTime: '30分钟', |
| | | createTime: '2022-07-02 08:15:41', |
| | | chainLength: '15', |
| | | status: '开启' |
| | | } |
| | | ] |
| | | ) |
| | | const openInspectRecordDialog = (type: string, value: {}) => { |
| | | inspectRecordDialogRef.value.showInspectRecordDialog(type, value, state.workTypeList, state.departmentList, state.timeType, state.classGroupList, state.quotaList, state.inspectPointAllList); |
| | | }; |
| | | |
| | | const dialogDetails = ref(false) |
| | | const parseNumber = (value: number, type: string) => { |
| | | if (type === '任务类型') { |
| | | return state.workTypeList.find((item) => item.id === value)?.name; |
| | | } else if (type === '检查频次') { |
| | | return state.timeType.find((item) => item.id == value)?.name; |
| | | } else if (type === '巡检状态') { |
| | | return state.resultStatusList.find((item) => item.id == value)?.name; |
| | | } else { |
| | | return state.classGroupList.find((item) => item.id == value)?.groupName; |
| | | } |
| | | }; |
| | | |
| | | const details = ref({}) |
| | | const viewRecord = (row) =>{ |
| | | details.value = JSON.parse(JSON.stringify(row)) |
| | | dialogDetails.value = true |
| | | } |
| | | // 分页改变 |
| | | const onHandleSizeChange = (val: number) => { |
| | | state.tableData.params.pageSize = val; |
| | | getInspectRecord(); |
| | | }; |
| | | // 分页改变 |
| | | const onHandleCurrentChange = (val: number) => { |
| | | state.tableData.params.pageIndex = val; |
| | | getInspectRecord(); |
| | | }; |
| | | |
| | | // 折线图 |
| | | const renderMenu = async (value: string) => { |
| | | Session.set('projectId',value) |
| | | userInfos.value.projectId = value |
| | | await initBackEndControlRoutes(); |
| | | }; |
| | | const reset = () => { |
| | | state.tableData.params = { |
| | | pageIndex: 1, |
| | | pageSize: 10, |
| | | unitName: null, |
| | | workType: null, |
| | | createUserId: null, |
| | | execClassgroupId: null, |
| | | checkCycle: null, |
| | | checkCycleUnit: null |
| | | }; |
| | | }; |
| | | |
| | | // 页面加载时 |
| | | onMounted(() => { |
| | | getInspectRecord(); |
| | | getQuotaList(); |
| | | getDepartmentData(); |
| | | getClassGroupData(); |
| | | getInspectTaskPoint(); |
| | | }); |
| | | |
| | | return { |
| | | View, |
| | | Edit, |
| | | Delete, |
| | | Refresh, |
| | | Plus, |
| | | reset, |
| | | parseNumber, |
| | | getInspectRecord, |
| | | onHandleSizeChange, |
| | | onHandleCurrentChange, |
| | | inspectRecordDialogRef, |
| | | openInspectRecordDialog, |
| | | ...toRefs(state) |
| | | }; |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | $homeNavLengh: 8; |
| | | .home-container { |
| | | height: 100%; |
| | | overflow: hidden; |
| | | padding: 20px; |
| | | .homeCard{ |
| | | width: 100%; |
| | | padding: 20px; |
| | | background: #fff; |
| | | border-radius: 4px; |
| | | } |
| | | .el-row{ |
| | | display: flex; |
| | | align-items: center; |
| | | margin-bottom: 20px; |
| | | &:last-child { |
| | | margin-bottom: 0; |
| | | } |
| | | .grid-content{ |
| | | align-items: center; |
| | | min-height: 36px; |
| | | } |
| | | $homeNavLengh: 8; |
| | | .home-container { |
| | | height: calc(100vh - 114px); |
| | | box-sizing: border-box; |
| | | overflow: hidden; |
| | | .homeCard { |
| | | width: 100%; |
| | | padding: 20px; |
| | | box-sizing: border-box; |
| | | background: #fff; |
| | | border-radius: 4px; |
| | | |
| | | .topInfo { |
| | | display: flex; |
| | | align-items: center; |
| | | font-size: 16px; |
| | | font-weight: bold; |
| | | .main-card { |
| | | width: 100%; |
| | | height: 100%; |
| | | .cardTop { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | margin-bottom: 20px; |
| | | .mainCardBtn { |
| | | margin: 0; |
| | | } |
| | | } |
| | | .pageBtn { |
| | | height: 60px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: right; |
| | | |
| | | &>div{ |
| | | white-space: nowrap; |
| | | margin-right: 20px; |
| | | } |
| | | } |
| | | } |
| | | .mainPages{ |
| | | height: 100%; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: space-between; |
| | | } |
| | | .main-card{ |
| | | width: 100%; |
| | | .cardTop{ |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | margin-bottom: 20px; |
| | | .mainCardBtn{ |
| | | margin: 0; |
| | | } |
| | | } |
| | | } |
| | | .pageBtn{ |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: right; |
| | | margin-top: 20px; |
| | | .demo-pagination-block + .demo-pagination-block { |
| | | margin-top: 10px; |
| | | } |
| | | .demo-pagination-block .demonstration { |
| | | margin-bottom: 16px; |
| | | } |
| | | } |
| | | } |
| | | &:last-of-type { |
| | | height: calc(100% - 100px); |
| | | } |
| | | } |
| | | .el-row { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-bottom: 20px; |
| | | &:last-child { |
| | | margin-bottom: 0; |
| | | } |
| | | .grid-content { |
| | | align-items: center; |
| | | min-height: 36px; |
| | | } |
| | | |
| | | .demo-pagination-block + .demo-pagination-block { |
| | | margin-top: 10px; |
| | | } |
| | | .demo-pagination-block .demonstration { |
| | | margin-bottom: 16px; |
| | | } |
| | | } |
| | | } |
| | | .stepItem{ |
| | | width: 100%; |
| | | display: flex; |
| | | align-items: flex-start; |
| | | margin-bottom: 30px; |
| | | margin-left: 30px; |
| | | padding-bottom: 30px; |
| | | border-left: 2px solid #ccc; |
| | | &:first-of-type{ |
| | | margin-top: 30px; |
| | | } |
| | | &:last-of-type{ |
| | | margin-bottom: 0; |
| | | border-left: none; |
| | | } |
| | | .stepNum { |
| | | width: 30px; |
| | | height: 30px; |
| | | border-radius: 15px; |
| | | box-sizing: border-box; |
| | | color: #333; |
| | | border: 1px solid #999; |
| | | line-height: 28px; |
| | | text-align: center; |
| | | margin-right: 10px; |
| | | margin-left: -16px; |
| | | margin-top: -30px; |
| | | } |
| | | .stepCard { |
| | | width: 100%; |
| | | margin-top: -30px; |
| | | .topInfo { |
| | | display: flex; |
| | | align-items: center; |
| | | font-size: 16px; |
| | | font-weight: bold; |
| | | |
| | | .box-card { |
| | | width: 100%; |
| | | &:deep(.el-card__header){ |
| | | padding: 10px 15px |
| | | } |
| | | .card-header { |
| | | width: 100%; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | &>div:first-of-type{ |
| | | margin-right: 80px; |
| | | font-size: 18px; |
| | | font-weight: bold; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | &:hover .card-header{ |
| | | color: #0098F5; |
| | | } |
| | | &:hover .stepNum{ |
| | | border: 2px solid #0098F5; |
| | | color: #0098F5; |
| | | } |
| | | } |
| | | .el-input{ |
| | | width: 100% !important; |
| | | } |
| | | :deep(.el-date-editor){ |
| | | width: 100%; |
| | | } |
| | | .el-select{ |
| | | width: 100%; |
| | | } |
| | | & > div { |
| | | white-space: nowrap; |
| | | margin-right: 20px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .stepItem { |
| | | width: 100%; |
| | | display: flex; |
| | | align-items: flex-start; |
| | | margin-bottom: 30px; |
| | | margin-left: 30px; |
| | | padding-bottom: 30px; |
| | | border-left: 2px solid #ccc; |
| | | &:first-of-type { |
| | | margin-top: 30px; |
| | | } |
| | | &:last-of-type { |
| | | margin-bottom: 0; |
| | | border-left: none; |
| | | } |
| | | .stepNum { |
| | | width: 30px; |
| | | height: 30px; |
| | | border-radius: 15px; |
| | | box-sizing: border-box; |
| | | color: #333; |
| | | border: 1px solid #999; |
| | | line-height: 28px; |
| | | text-align: center; |
| | | margin-right: 10px; |
| | | margin-left: -16px; |
| | | margin-top: -30px; |
| | | } |
| | | .stepCard { |
| | | width: 100%; |
| | | margin-top: -30px; |
| | | |
| | | .box-card { |
| | | width: 100%; |
| | | &:deep(.el-card__header) { |
| | | padding: 10px 15px; |
| | | } |
| | | .card-header { |
| | | width: 100%; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | & > div:first-of-type { |
| | | margin-right: 80px; |
| | | font-size: 18px; |
| | | font-weight: bold; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | &:hover .card-header { |
| | | color: #0098f5; |
| | | } |
| | | &:hover .stepNum { |
| | | border: 2px solid #0098f5; |
| | | color: #0098f5; |
| | | } |
| | | } |
| | | .el-input { |
| | | width: 100% !important; |
| | | } |
| | | :deep(.el-date-editor) { |
| | | width: 100%; |
| | | } |
| | | .el-select { |
| | | width: 100%; |
| | | } |
| | | </style> |
| | |
| | | <template></template> |
| | | <template> |
| | | <div class="system-add-menu-container"> |
| | | <el-dialog v-model="ifShowInspectTaskDialog" :title="title"> |
| | | <el-form :model="inspectTaskForm" label-width="120px" ref="inspectTaskFormRef" :rules="inspectTaskFormRules"> |
| | | <el-row> |
| | | <el-col :span="12" style="margin-bottom: 20px"> |
| | | <el-form-item label="任务名称" prop="unitName"> |
| | | <el-input v-model="inspectTaskForm.unitName" class="input-add" placeholder="请填写任务名称"> </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" style="margin-bottom: 20px"> |
| | | <el-form-item label="任务类型" prop="workType"> |
| | | <el-select v-model="inspectTaskForm.workType" class="input-add" placeholder="请选择任务类型"> |
| | | <el-option v-for="item in workTypeList" :key="item.id" :value="item.id" :label="item.name"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" style="margin-bottom: 20px"> |
| | | <el-form-item label="巡检部门" prop="execDepId"> |
| | | <el-cascader @change="giveClassGroup" placeholder="请选择巡检部门" :options="departmentList" :props="{ emitPath: false, checkStrictly: true, value: 'depId', label: 'depName' }" clearable filterable class="input-add" v-model="inspectTaskForm.execDepId"> </el-cascader> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" style="margin-bottom: 20px"> |
| | | <el-form-item label="巡检班组" prop="execClassgroupId"> |
| | | <el-select v-model="inspectTaskForm.execClassgroupId" placeholder="请选择巡检班组" class="input-add"> |
| | | <el-option v-for="item in classGroup" :key="item.id" :value="item.id" :label="item.groupName"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" style="margin-bottom: 20px"> |
| | | <el-form-item label="巡检周期" prop="checkCycle"> |
| | | <el-input v-model="inspectTaskForm.checkCycle" placeholder="请输入巡检周期" class="input-add"> |
| | | <template #append> |
| | | <el-select v-model="inspectTaskForm.checkCycleUnit" placeholder="选择单位"> |
| | | <el-option v-for="item in timeList" :key="item.id" :value="item.id" :label="item.name"></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" style="margin-bottom: 20px"> |
| | | <el-form-item label="提前通知时间" prop="noticeTime"> |
| | | <el-input v-model="inspectTaskForm.noticeTime" placeholder="请输入提前通知时间" class="input-add"> |
| | | <template #append> |
| | | <el-select v-model="inspectTaskForm.noticeTimeUnit" placeholder="选择单位"> |
| | | <el-option v-for="item in timeList" :key="item.id" :value="item.id" :label="item.name"></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" style="margin-bottom: 20px"> |
| | | <el-form-item label="有效时间" prop="validTime"> |
| | | <el-input v-model="inspectTaskForm.validTime" placeholder="请输入有效时间" class="input-add"> |
| | | <template #append> |
| | | <el-select v-model="inspectTaskForm.validTimeUnit" placeholder="选择单位"> |
| | | <el-option v-for="item in timeList" :key="item.id" :value="item.id" :label="item.name"></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" style="margin-bottom: 20px"> |
| | | <el-form-item label="周期开始时间" prop="firstStartTime"> |
| | | <el-date-picker v-model="inspectTaskForm.firstStartTime" placeholder="请选择周期开始时间" type="datetime" format="YYYY/MM/DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" class="input-add" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | <script> |
| | | <el-col :span="24"> |
| | | <el-form-item label="创建巡检链"> |
| | | <div style="width: 100%; margin-bottom: 20px" v-show="inspectPointConfirm"> |
| | | <el-button type="primary" :icon="Plus" size="default" @click="openInspectPointDialog('新增', '')">新增巡检点</el-button> |
| | | </div> |
| | | <div style="width: 100%; margin-left: -30px"> |
| | | <div v-for="(item, index) in inspectTaskForm.points" class="stepItem"> |
| | | <div class="stepNum">{{ index + 1 }}</div> |
| | | <div class="stepCard"> |
| | | <el-card class="box-card"> |
| | | <template #header> |
| | | <div class="card-header"> |
| | | <div>{{ item.pointId }}</div> |
| | | </div> |
| | | </template> |
| | | <div class="text item"> |
| | | 所属设备区域:<span>{{ item.regionId }}</span> |
| | | </div> |
| | | <div class="text item"> |
| | | 关联RFID:<span>{{ item.rfidId }}</span> |
| | | </div> |
| | | <div class="text item"> |
| | | 巡检指标:<span>{{ item.quotaId }}</span> |
| | | </div> |
| | | <div class="text item"> |
| | | 数据填报类型:<span>{{ item.dataReportType }}</span> |
| | | </div> |
| | | <div class="text item"> |
| | | 数据参考值:<span>{{ item.firstReferenceValue ? item.firstReferenceValue : item.secondReferenceValue ? item.secondReferenceValue : item.thirdReferenceValue }}</span> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | <div v-show="inspectPointConfirm"> |
| | | <!-- <el-button type="primary" size="default" @click="addFlow(index)">新增下一区域</el-button>--> |
| | | <el-button type="primary" style="margin-left: 12px" size="default" @click="openInspectPointDialog('修改', item)">修改</el-button> |
| | | <el-button type="danger" size="default" @click="deleteFlow(index, item)">删除</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <div align="right" v-show="inspectPointConfirm"> |
| | | <el-button type="warning" @click="inspectPointDialog = false" size="default" plain>取消</el-button> |
| | | <el-button type="primary" @click="submitInspectTask()" size="default">确认</el-button> |
| | | </div> |
| | | </el-form> |
| | | </el-dialog> |
| | | <el-dialog v-model="inspectPointDialog" :title="pointTitle"> |
| | | <el-form :model="inspectPointForm" label-width="150px" ref="inspectPointFormRef" :rules="inspectPointFormRules"> |
| | | <el-form-item label="选择巡检点" prop="pointId"> |
| | | <el-select v-model="inspectPointForm.pointId" @change="giveRegionAndRFID" class="input-add"> |
| | | <el-option v-for="item in inspectPointAllList" :key="item.id" :value="item.id" :label="item.code"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属设备区域" prop="regionId"> |
| | | <el-input v-model="inspectPointForm.regionId" class="input-add" readonly /> |
| | | </el-form-item> |
| | | <el-form-item label="关联RFID" prop="rfidId"> |
| | | <el-input v-model="inspectPointForm.rfidId" class="input-add" readonly /> |
| | | </el-form-item> |
| | | <el-form-item label="选择巡检指标" prop="quotaId"> |
| | | <el-select v-model="inspectPointForm.quotaId" @change="giveQuotaUnit" placeholder="请选择巡检指标" class="input-add"> |
| | | <el-option v-for="item in quotaList" :key="item.id" :value="item.id" :label="item.type"> </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="选择巡检指标单位" prop="quotaUnit"> |
| | | <el-input v-model="inspectPointForm.quotaUnit" placeholder="单位" class="input-add"> </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="数据填报类型" prop="dataReportType"> |
| | | <el-select v-model="inspectPointForm.dataReportType" class="input-add"> |
| | | <el-option v-for="item in dataReportTypeList" :key="item.id" :value="item.id" :label="item.name"> </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item v-if="inspectPointForm.dataReportType == '1' || inspectPointForm.dataReportType == '3'" label="数据参考值" prop="firstReferenceValue"> |
| | | <el-select v-model="inspectPointForm.firstReferenceValue" class="input-add"> |
| | | <el-option v-for="item in firstReferenceValueList" :key="item.id" :value="item.id" :label="item.name"> </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item v-if="inspectPointForm.dataReportType == '2' || inspectPointForm.dataReportType == '3'" label="数据参考值"> |
| | | <el-input v-model="inspectPointForm.secondReferenceValue" type="number" class="input-add" placeholder="请根据需求选择前方符号后再填写参考值,非必填"> |
| | | <template #prepend> |
| | | <el-select v-model="inspectPointForm.secondReferenceSign" placeholder="Select" style="width: 115px"> |
| | | <el-option v-for="item in secondReferenceSignList" :key="item.id" :value="item.id" :label="item.name"> </el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item v-if="inspectPointForm.dataReportType == '2' || inspectPointForm.dataReportType == '3'" label=""> |
| | | <el-input v-model="inspectPointForm.thirdReferenceValue" type="number" class="input-add" placeholder="请根据需求选择前方符号后再填写参考值,非必填"> |
| | | <template #prepend> |
| | | <el-select v-model="inspectPointForm.thirdReferenceSign" placeholder="Select" style="width: 115px"> |
| | | <el-option v-for="item in thirdReferenceSignList" :key="item.id" :value="item.id" :label="item.name"> </el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <div align="right"> |
| | | <el-button type="warning" @click="inspectPointDialog = false" size="default" plain>取消</el-button> |
| | | <el-button type="primary" @click="submitInspectPoint()" size="default">确认</el-button> |
| | | </div> |
| | | </el-form> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { reactive, toRefs, ref } from 'vue'; |
| | | import { RFIDApi } from '/@/api/intellectInspectSystem/RFID'; |
| | | import { ElMessage } from 'element-plus/es'; |
| | | import { inspectTaskApi } from '/@/api/intellectInspectSystem/inspectTask'; |
| | | import { facilityAreaApi } from '/@/api/intellectInspectSystem/facilityAreaManage'; |
| | | interface dataState { |
| | | title: string; |
| | | pointTitle: string; |
| | | inspectPointConfirm: boolean; |
| | | inspectPointDialog: boolean; |
| | | ifShowInspectTaskDialog: boolean; |
| | | inspectPointForm: inspectPointForm; |
| | | inspectTaskForm: { |
| | | id: number | null; |
| | | uuid: number | null; |
| | | unitName: number | null; |
| | | taskUnitStatus: number | null; |
| | | workType: number | null; |
| | | execClassgroupId: number | null; |
| | | execDepId: number | null; |
| | | checkCycle: number | null; |
| | | checkCycleUnit: number | null; |
| | | noticeTime: number | null; |
| | | noticeTimeUnit: number | null; |
| | | validTime: number | null; |
| | | validTimeUnit: number | null; |
| | | firstStartTime: number | null; |
| | | points: Array<inspectPointForm>; |
| | | }; |
| | | inspectTaskFormRules: {}; |
| | | inspectPointFormRules: {}; |
| | | workTypeList: []; |
| | | departmentList: []; |
| | | timeList: []; |
| | | dataReportTypeList: Array<dataReport>; |
| | | firstReferenceValueList: Array<dataReport>; |
| | | secondReferenceSignList: Array<dataReport>; |
| | | thirdReferenceSignList: Array<dataReport>; |
| | | classGroupList: Array<classGroup>; |
| | | classGroup: Array<classGroup>; |
| | | quotaList: Array<quota>; |
| | | inspectPointAllList: Array<inspectPointAllState>; |
| | | } |
| | | interface inspectPointAllState { |
| | | id: number; |
| | | code: string; |
| | | regionId: number; |
| | | rfidId: number; |
| | | } |
| | | interface classGroup { |
| | | depId: number; |
| | | } |
| | | interface dataReport { |
| | | id: number; |
| | | name: string; |
| | | } |
| | | interface quota { |
| | | id: number; |
| | | type: string; |
| | | unit: string; |
| | | } |
| | | interface inspectPointForm { |
| | | id: number | null; |
| | | unitId: number | null; |
| | | unitUuid: string | null; |
| | | pointId: number | null; |
| | | pointUuid: string | null; |
| | | regionId: number | null; |
| | | regionUuid: string | null; |
| | | rfidId: number | null; |
| | | quotaId: number | null; |
| | | quotaUnit: string | null; |
| | | execSequence: number | null; |
| | | dataReportType: number | null; |
| | | firstReferenceValue: number | null; |
| | | secondReferenceSign: number | null; |
| | | secondReferenceValue: number | null; |
| | | thirdReferenceSign: number | null; |
| | | thirdReferenceValue: number | null; |
| | | } |
| | | export default { |
| | | name: 'inspectTask' |
| | | name: 'inspectTaskDialog', |
| | | setup(props: any, context: any) { |
| | | const inspectTaskFormRef = ref(); |
| | | const data = reactive<dataState>({ |
| | | title: '', |
| | | pointTitle: '', |
| | | inspectPointConfirm: false, |
| | | inspectPointDialog: false, |
| | | ifShowInspectTaskDialog: false, |
| | | inspectPointForm: { |
| | | id: null, |
| | | unitId: null, |
| | | unitUuid: null, |
| | | pointId: null, |
| | | pointUuid: null, |
| | | regionId: null, |
| | | regionUuid: null, |
| | | rfidId: null, |
| | | quotaId: null, |
| | | quotaUnit: null, |
| | | execSequence: null, |
| | | dataReportType: null, |
| | | firstReferenceValue: null, |
| | | secondReferenceSign: null, |
| | | secondReferenceValue: null, |
| | | thirdReferenceSign: null, |
| | | thirdReferenceValue: null |
| | | }, |
| | | inspectTaskForm: { |
| | | id: null, |
| | | uuid: null, |
| | | unitName: null, |
| | | taskUnitStatus: null, |
| | | workType: null, |
| | | execClassgroupId: null, |
| | | execDepId: null, |
| | | checkCycle: null, |
| | | checkCycleUnit: null, |
| | | noticeTime: null, |
| | | noticeTimeUnit: null, |
| | | validTime: null, |
| | | validTimeUnit: null, |
| | | firstStartTime: null, |
| | | points: [] |
| | | }, |
| | | inspectTaskFormRules: { |
| | | unitName: [{ required: true, message: '请填写巡检任务单元名称', trigger: 'blur' }], |
| | | workType: [{ required: true, message: '请选择巡检任务类型', trigger: 'change' }], |
| | | execClassgroupId: [{ required: true, message: '请选择巡检班组', trigger: 'change' }], |
| | | execDepId: [{ required: true, message: '请选择巡检部门', trigger: 'blur' }], |
| | | checkCycle: [{ required: true, message: '请填写巡检周期', trigger: 'blur' }], |
| | | noticeTime: [{ required: true, message: '请填写提前通知时间', trigger: 'blur' }], |
| | | validTime: [{ required: true, message: '请填写有效时间', trigger: 'blur' }], |
| | | firstStartTime: [{ required: true, message: '请选择周期开始时间', trigger: 'change' }] |
| | | }, |
| | | inspectPointFormRules: {}, |
| | | workTypeList: [], |
| | | departmentList: [], |
| | | timeList: [], |
| | | classGroupList: [], |
| | | classGroup: [], |
| | | quotaList: [], |
| | | inspectPointAllList: [], |
| | | dataReportTypeList: [ |
| | | { id: 1, name: '选择' }, |
| | | { id: 2, name: '填空' }, |
| | | { id: 3, name: '选择并填空' } |
| | | ], |
| | | firstReferenceValueList: [ |
| | | { id: 0, name: '正常' }, |
| | | { id: 1, name: '异常' } |
| | | ], |
| | | secondReferenceSignList: [ |
| | | { id: 1, name: '>' }, |
| | | { id: 2, name: '>=' } |
| | | ], |
| | | thirdReferenceSignList: [ |
| | | { id: 3, name: '<' }, |
| | | { id: 4, name: '<=' } |
| | | ] |
| | | }); |
| | | |
| | | const openInspectPointDialog = (type: string, value: {}) => { |
| | | data.inspectPointDialog = true; |
| | | if (type === '新增') { |
| | | data.pointTitle = '新增巡检点'; |
| | | data.inspectPointForm = { |
| | | id: null, |
| | | unitId: null, |
| | | unitUuid: null, |
| | | pointId: null, |
| | | pointUuid: null, |
| | | regionId: null, |
| | | regionUuid: null, |
| | | rfidId: null, |
| | | quotaId: null, |
| | | quotaUnit: null, |
| | | execSequence: null, |
| | | dataReportType: null, |
| | | firstReferenceValue: null, |
| | | secondReferenceSign: null, |
| | | secondReferenceValue: null, |
| | | thirdReferenceSign: null, |
| | | thirdReferenceValue: null |
| | | }; |
| | | } else { |
| | | data.pointTitle = '修改巡检点'; |
| | | data.inspectPointForm = JSON.parse(JSON.stringify(value)); |
| | | } |
| | | }; |
| | | |
| | | const showInspectTaskDialog = (type: string, value: { id: number; uuid: string }, workTypeList: [], department: [], timeType: [], classGroupList: [], quotaList: [], inspectPointAllList: []) => { |
| | | data.quotaList = JSON.parse(JSON.stringify(quotaList)); |
| | | data.timeList = JSON.parse(JSON.stringify(timeType)); |
| | | data.inspectPointAllList = JSON.parse(JSON.stringify(inspectPointAllList)); |
| | | data.workTypeList = JSON.parse(JSON.stringify(workTypeList)); |
| | | data.departmentList = JSON.parse(JSON.stringify(department)); |
| | | data.classGroupList = JSON.parse(JSON.stringify(classGroupList)); |
| | | data.ifShowInspectTaskDialog = true; |
| | | if (type === '新增') { |
| | | data.inspectPointConfirm = true; |
| | | data.title = '新增巡检任务'; |
| | | data.inspectTaskForm = { |
| | | id: null, |
| | | uuid: null, |
| | | unitName: null, |
| | | taskUnitStatus: null, |
| | | workType: null, |
| | | execClassgroupId: null, |
| | | execDepId: null, |
| | | checkCycle: null, |
| | | checkCycleUnit: null, |
| | | noticeTime: null, |
| | | noticeTimeUnit: null, |
| | | validTime: null, |
| | | validTimeUnit: null, |
| | | firstStartTime: null, |
| | | points: [] |
| | | }; |
| | | } else if (type === '修改') { |
| | | data.inspectPointConfirm = true; |
| | | data.title = '修改巡检任务'; |
| | | inspectTaskApi() |
| | | .getInspectTaskById({ id: value.id, uuid: value.uuid }) |
| | | .then((res) => { |
| | | if (res.data.code === '200') { |
| | | data.inspectTaskForm.execDepId = res.data.data.execDepId; |
| | | giveClassGroup(); |
| | | data.inspectTaskForm = JSON.parse(JSON.stringify(res.data.data)); |
| | | } else { |
| | | } |
| | | }) |
| | | .catch((error) => {}); |
| | | } else { |
| | | data.inspectPointConfirm = false; |
| | | data.title = '查看巡检任务'; |
| | | inspectTaskApi() |
| | | .getInspectTaskById({ id: value.id, uuid: value.uuid }) |
| | | .then((res) => { |
| | | if (res.data.code === '200') { |
| | | data.inspectTaskForm = JSON.parse(JSON.stringify(res.data.data)); |
| | | } else { |
| | | } |
| | | }) |
| | | .catch((error) => {}); |
| | | } |
| | | }; |
| | | |
| | | const submitInspectPoint = async () => { |
| | | if (data.title === '新增巡检任务' && data.pointTitle === '新增巡检点') { |
| | | if (data.inspectTaskForm.points.length === 0) { |
| | | data.inspectPointForm.execSequence = 1; |
| | | } else { |
| | | data.inspectPointForm.execSequence = (data.inspectTaskForm.points[data.inspectTaskForm.points.length - 1].execSequence as number) + 1; |
| | | } |
| | | data.inspectTaskForm.points.push(data.inspectPointForm); |
| | | data.inspectPointDialog = false; |
| | | } else if (data.title === '新增巡检任务' && data.pointTitle === '修改巡检点') { |
| | | let result = data.inspectTaskForm.points.findIndex((item) => item.id === data.inspectPointForm.id); |
| | | data.inspectTaskForm.points[result] = data.inspectPointForm; |
| | | data.inspectPointDialog = false; |
| | | } else if (data.title === '修改巡检任务' && data.pointTitle === '新增巡检点') { |
| | | data.inspectPointForm.unitId = data.inspectTaskForm.id; |
| | | if (data.inspectTaskForm.points.length === 0) { |
| | | data.inspectPointForm.execSequence = 1; |
| | | } else { |
| | | data.inspectPointForm.execSequence = (data.inspectTaskForm.points[data.inspectTaskForm.points.length - 1].execSequence as number) + 1; |
| | | } |
| | | let res = await inspectTaskApi().addChainOfInspectTask(data.inspectPointForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '巡检点新增成功', |
| | | duration: 2000 |
| | | }); |
| | | data.inspectPointDialog = false; |
| | | data.inspectTaskForm.points.push(data.inspectPointForm); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } else { |
| | | data.inspectPointForm.unitId = data.inspectTaskForm.id; |
| | | let res = await inspectTaskApi().modChainOfInspectTask(data.inspectPointForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '巡检点修改成功', |
| | | duration: 2000 |
| | | }); |
| | | let result = data.inspectTaskForm.points.findIndex((item) => item.id === data.inspectPointForm.id); |
| | | data.inspectTaskForm.points[result] = data.inspectPointForm; |
| | | data.inspectPointDialog = false; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | const deleteFlow = async (index: number, item: { id: number }) => { |
| | | if (data.pointTitle === '新增巡检点') { |
| | | data.inspectTaskForm.points.splice(index, 1); |
| | | } else { |
| | | let res = await inspectTaskApi().deleteChainOfInspectTask({ id: item.id, unitId: data.inspectTaskForm.id }); |
| | | if (res.data.code === '200') { |
| | | data.inspectTaskForm.points.splice(index, 1); |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '巡检点删除成功' |
| | | }); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | const giveRegionAndRFID = () => { |
| | | data.inspectPointForm.regionId = data.inspectPointAllList.find((item) => item.id === data.inspectPointForm.pointId)?.regionId as number; |
| | | data.inspectPointForm.rfidId = data.inspectPointAllList.find((item) => item.id === data.inspectPointForm.pointId)?.rfidId as number; |
| | | }; |
| | | |
| | | const giveClassGroup = () => { |
| | | data.inspectTaskForm.execClassgroupId = null; |
| | | data.classGroup = data.classGroupList.filter((item) => item.depId === data.inspectTaskForm.execDepId); |
| | | }; |
| | | |
| | | const giveQuotaUnit = () => { |
| | | data.inspectPointForm.quotaUnit = data.quotaList.find((item) => item.id === data.inspectPointForm.quotaId)?.unit as string; |
| | | }; |
| | | |
| | | const submitInspectTask = () => { |
| | | inspectTaskFormRef.value.validate(async (valid: Boolean) => { |
| | | if (valid) { |
| | | if (data.title === '新增巡检任务') { |
| | | let res = await inspectTaskApi().addInspectTask(data.inspectTaskForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '巡检任务新增成功', |
| | | duration: 2000 |
| | | }); |
| | | data.ifShowInspectTaskDialog = false; |
| | | context.emit('refreshInspectTask'); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } else { |
| | | let res = await inspectTaskApi().modInspectTask(data.inspectTaskForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '巡检指标修改成功', |
| | | duration: 2000 |
| | | }); |
| | | data.ifShowInspectTaskDialog = false; |
| | | context.emit('refreshInspectTask'); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '请完善基本信息' |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | return { |
| | | ...toRefs(data), |
| | | inspectTaskFormRef, |
| | | deleteFlow, |
| | | giveQuotaUnit, |
| | | giveClassGroup, |
| | | submitInspectTask, |
| | | submitInspectPoint, |
| | | giveRegionAndRFID, |
| | | showInspectTaskDialog, |
| | | openInspectPointDialog |
| | | }; |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped></style> |
| | | <style scoped lang="scss"> |
| | | $homeNavLengh: 8; |
| | | .home-container { |
| | | height: calc(100vh - 114px); |
| | | box-sizing: border-box; |
| | | overflow: hidden; |
| | | .homeCard { |
| | | width: 100%; |
| | | padding: 20px; |
| | | box-sizing: border-box; |
| | | background: #fff; |
| | | border-radius: 4px; |
| | | |
| | | .main-card { |
| | | width: 100%; |
| | | height: 100%; |
| | | .cardTop { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | margin-bottom: 20px; |
| | | .mainCardBtn { |
| | | margin: 0; |
| | | } |
| | | } |
| | | .pageBtn { |
| | | height: 60px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: right; |
| | | |
| | | .demo-pagination-block + .demo-pagination-block { |
| | | margin-top: 10px; |
| | | } |
| | | .demo-pagination-block .demonstration { |
| | | margin-bottom: 16px; |
| | | } |
| | | } |
| | | } |
| | | &:last-of-type { |
| | | height: calc(100% - 100px); |
| | | } |
| | | } |
| | | .el-row { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-bottom: 20px; |
| | | &:last-child { |
| | | margin-bottom: 0; |
| | | } |
| | | .grid-content { |
| | | align-items: center; |
| | | min-height: 36px; |
| | | } |
| | | |
| | | .topInfo { |
| | | display: flex; |
| | | align-items: center; |
| | | font-size: 16px; |
| | | font-weight: bold; |
| | | |
| | | & > div { |
| | | white-space: nowrap; |
| | | margin-right: 20px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .stepItem { |
| | | width: 100%; |
| | | display: flex; |
| | | align-items: flex-start; |
| | | margin-bottom: 30px; |
| | | margin-left: 30px; |
| | | padding-bottom: 30px; |
| | | border-left: 2px solid #ccc; |
| | | &:first-of-type { |
| | | margin-top: 30px; |
| | | } |
| | | &:last-of-type { |
| | | margin-bottom: 0; |
| | | border-left: none; |
| | | } |
| | | .stepNum { |
| | | width: 30px; |
| | | height: 30px; |
| | | border-radius: 15px; |
| | | box-sizing: border-box; |
| | | color: #333; |
| | | border: 1px solid #999; |
| | | line-height: 28px; |
| | | text-align: center; |
| | | margin-right: 10px; |
| | | margin-left: -16px; |
| | | margin-top: -30px; |
| | | } |
| | | .stepCard { |
| | | width: 100%; |
| | | margin-top: -30px; |
| | | |
| | | .box-card { |
| | | width: 100%; |
| | | &:deep(.el-card__header) { |
| | | padding: 10px 15px; |
| | | } |
| | | .card-header { |
| | | width: 100%; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | & > div:first-of-type { |
| | | margin-right: 80px; |
| | | font-size: 18px; |
| | | font-weight: bold; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | &:hover .card-header { |
| | | color: #0098f5; |
| | | } |
| | | &:hover .stepNum { |
| | | border: 2px solid #0098f5; |
| | | color: #0098f5; |
| | | } |
| | | } |
| | | :deep(.el-date-editor) { |
| | | width: 100%; |
| | | } |
| | | </style> |
| | |
| | | <div class="home-container"> |
| | | <div style="height: 100%"> |
| | | <el-row class="homeCard"> |
| | | <el-col :span="12"> |
| | | <div class="grid-content topInfo"> |
| | | <el-select v-model="searchType" @change="changeSearch" placeholder="任务名称"> |
| | | <el-option label="巡检任务类型" value="巡检任务类型" /> |
| | | <el-option label="创建人" value="创建人" /> |
| | | <el-option label="巡检班组" value="巡检班组" /> |
| | | <el-option label="检查频次" value="检查频次" /> |
| | | <el-option label="开始时间" value="开始时间" /> |
| | | </el-select> |
| | | <el-input v-model="searchContent" v-if="searchType == '任务名称'" placeholder="请输入任务名称"></el-input> |
| | | <el-input v-else-if="searchType == '检查频次'" v-model="searchContent" placeholder="请输入检查频次"> |
| | | <template #append> |
| | | <el-select v-model="searchUnit" placeholder="选择单位"> |
| | | <el-option label="分钟" value="分钟" /> |
| | | <el-option label="小时" value="小时" /> |
| | | <el-option label="天" value="天" /> |
| | | </el-select> |
| | | </template> |
| | | </el-input> |
| | | <el-select v-model="searchContent" v-else-if="searchType == '巡检任务类型'" placeholder="请选择任务类型"> |
| | | <el-option v-for="(item, index) in typeOptions" :label="item.name" :value="item.value" :key="index" /> |
| | | </el-select> |
| | | <el-select v-model="searchContent" v-else-if="searchType == '创建人'" placeholder="请选择创建人"> |
| | | <el-option v-for="(item, index) in createrOptions" :label="item.name" :value="item.value" :key="index" /> |
| | | </el-select> |
| | | <el-select v-model="searchContent" v-else-if="searchType == '巡检班组'" placeholder="请选择巡检班组"> |
| | | <el-option v-for="(item, index) in inspectorOptions" :label="item.name" :value="item.value" :key="index" /> |
| | | </el-select> |
| | | <el-date-picker v-model="searchContent" type="date" v-else :placeholder="'请选择' + searchType" size="large" style="margin-right: 20px" /> |
| | | <el-button type="primary">查询</el-button> |
| | | <el-button plain>重置</el-button> |
| | | </div> |
| | | </el-col> |
| | | <div class="basic-line"> |
| | | <span>任务类型:</span> |
| | | <el-select v-model="tableData.params.workType" clearable filterable class="input-box" placeholder="任务类型"> |
| | | <el-option v-for="item in workTypeList" :key="item.id" :label="item.name" :value="item.id"></el-option> |
| | | </el-select> |
| | | </div> |
| | | <div class="basic-line"> |
| | | <span>执行班组:</span> |
| | | <el-select v-model="tableData.params.execClassgroupId" clearable filterable class="input-box" placeholder="执行班组"> |
| | | <el-option v-for="item in classGroupList" :key="item.id" :label="item.groupName" :value="item.id"></el-option> |
| | | </el-select> |
| | | </div> |
| | | <div style="padding-bottom: 10px"> |
| | | <el-button type="primary" @click="getInspectionTask">查询</el-button> |
| | | <el-button plain @click="reset">重置</el-button> |
| | | </div> |
| | | </el-row> |
| | | <div class="homeCard"> |
| | | <div class="main-card"> |
| | | <el-row class="cardTop"> |
| | | <el-col :span="12" class="mainCardBtn"> |
| | | <el-button type="primary" :icon="Plus" size="default" @click="openDialog('新增', {})">新建</el-button> |
| | | <el-button type="danger" :icon="Delete" size="default" plain>删除</el-button> |
| | | <el-button type="primary" :icon="Plus" size="default" @click="openInspectTaskDialog('新增', {})">新建</el-button> |
| | | <!-- <el-button type="danger" :icon="Delete" size="default" plain>删除</el-button>--> |
| | | </el-col> |
| | | <el-button type="primary" :icon="Refresh" size="default" /> |
| | | </el-row> |
| | | <el-table ref="multipleTableRef" :data="tableData.inspectTaskData" style="width: 100%" height="calc(100% - 100px)" :header-cell-style="{ background: '#fafafa' }" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column property="name" label="任务名称" width="200" /> |
| | | <el-table-column property="type" label="任务类型" /> |
| | | <el-table-column property="execClassgroup" label="巡检班组" /> |
| | | <el-table-column property="frequency" label="检查频次" /> |
| | | <el-table-column property="unit" label="频次单位" /> |
| | | <el-table-column property="chainLength" label="巡检链长度" width="160" /> |
| | | <el-table-column property="startTime" label="任务开始时间" width="180" /> |
| | | <!-- <el-table-column property="validTime" label="任务有效时间" width="180"/>--> |
| | | <el-table-column property="creater" label="创建人" /> |
| | | <el-table-column property="createTime" label="创建时间" width="180" /> |
| | | <el-table-column property="unitName" label="任务名称" /> |
| | | <el-table-column property="workType" label="任务类型"> |
| | | <template #default="scope"> |
| | | <span> |
| | | {{ parseNumber(scope.row.workType, '任务类型') }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column property="execClassgroupId" label="巡检班组"> |
| | | <template #default="scope"> |
| | | <span> |
| | | {{ parseNumber(scope.row.execClassgroupId, '巡检班组') }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column property="frequency" label="检查频次"> |
| | | <template #default="scope"> |
| | | <span> |
| | | {{ scope.row.checkCycle }} |
| | | </span> |
| | | <span> |
| | | {{ scope.row.checkCycleUnit }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column prop="validTime" label="有效时间" show-overflow-tooltip>--> |
| | | <!-- <template #default="scope">--> |
| | | <!-- <span>--> |
| | | <!-- {{ scope.row.validTime }}--> |
| | | <!-- </span>--> |
| | | <!-- <span>--> |
| | | <!-- {{ parseNumber(scope.row.validTimeUnit, '检查频次') }}--> |
| | | <!-- </span>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <!-- <el-table-column prop="validTime" label="提醒时间" show-overflow-tooltip>--> |
| | | <!-- <template #default="scope">--> |
| | | <!-- <span>--> |
| | | <!-- {{ scope.row.noticeTime }}--> |
| | | <!-- </span>--> |
| | | <!-- <span>--> |
| | | <!-- {{ parseNumber(scope.row.noticeTimeUnit, '检查频次') }}--> |
| | | <!-- </span>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <el-table-column property="firstStartTime" label="任务开始时间" /> |
| | | <el-table-column prop="createUserName" label="创建人" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="gmtCreate" label="创建时间" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="lastEditUserName" label="最后修改人" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="gmtModitify" label="最后修改时间" show-overflow-tooltip></el-table-column> |
| | | <el-table-column property="status" label="状态" width="60" /> |
| | | <el-table-column fixed="right" label="操作" align="center" width="300"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" :icon="View" @click="viewRecord(scope.row)">查看</el-button> |
| | | <el-button link type="primary" size="small" :icon="Edit" @click="openDialog('修改', scope.row)">修改</el-button> |
| | | <el-button link type="primary" size="small" :icon="View" @click="openInspectTaskDialog('查看', scope.row)">查看</el-button> |
| | | <el-button link type="primary" size="small" :icon="Edit" @click="openInspectTaskDialog('修改', scope.row)">修改</el-button> |
| | | <el-switch v-model="scope.row.status" inline-prompt active-text="开" inactive-text="关" active-value="开启" inactive-value="关闭" style="margin: 0 10px" /> |
| | | <el-button link type="danger" size="small" :icon="Delete" @click="deleteRecord(scope.$index)">删除</el-button> |
| | | <el-button link type="danger" size="small" :icon="Delete" @click="deleteInspectTask(scope.$index)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div class="pageBtn"> |
| | | <el-pagination v-model:currentPage="currentPage" v-model:page-size="pageSize" :page-sizes="[10, 15]" small="false" background layout="total, sizes, prev, pager, next, jumper" :total="100" @size-change="handleSizeChange" @current-change="handleCurrentChange" /> |
| | | <el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" :pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="tableData.params.pageIndex" background v-model:page-size="tableData.params.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="tableData.total" class="page-position"> </el-pagination> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <inspect-task-dialog ref="inspectTaskDialogRef"></inspect-task-dialog> |
| | | <inspect-task-dialog ref="inspectTaskDialogRef" @refreshInspectTask="getInspectionTask"></inspect-task-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import { ElTable, ElMessage } from 'element-plus'; |
| | | import { inspectTaskApi } from '/@/api/intellectInspectSystem/inspectTask'; |
| | | import inspectTaskDialog from './components/inspectTaskDialog.vue'; |
| | | import InspectTask from '/@/views/intellectInspect/inspectTaskManage/inspectTask/components/inspectTaskDialog.vue'; |
| | | import { departmentApi } from '/@/api/systemManage/department'; |
| | | import { teamManageApi } from '/@/api/systemManage/personShiftManage/teamManage'; |
| | | import { inspectPointApi } from '/@/api/intellectInspectSystem/inspectPointManage'; |
| | | let global: any = { |
| | | homeChartOne: null, |
| | | homeChartTwo: null, |
| | |
| | | }; |
| | | |
| | | interface stateType { |
| | | homeOne: Array<type>; |
| | | tableData: { |
| | | inspectTaskData: []; |
| | | total: number; |
| | | loading: boolean; |
| | | params: { |
| | | pageIndex: number | null; |
| | | pageSize: number | null; |
| | | unitName: string | null; |
| | | workType: number | null; |
| | | createUserId: number | null; |
| | | execClassgroupId: number | null; |
| | | checkCycle: number | null; |
| | | checkCycleUnit: number | null; |
| | | }; |
| | | }; |
| | | workTypeList: Array<type>; |
| | | quotaList: []; |
| | | departmentList: []; |
| | | classGroupList: Array<classGroup>; |
| | | inspectPointAllList: []; |
| | | timeType: Array<type>; |
| | | } |
| | | interface type {} |
| | | interface type { |
| | | id: number; |
| | | name: string; |
| | | } |
| | | interface classGroup { |
| | | id: number; |
| | | groupName: string; |
| | | } |
| | | export default { |
| | | name: 'index', |
| | | components: { inspectTaskDialog }, |
| | | setup() { |
| | | const state = reactive({ |
| | | const inspectTaskDialogRef = ref(); |
| | | const state = reactive<stateType>({ |
| | | tableData: { |
| | | inspectTaskData: [], |
| | | total: 0, |
| | |
| | | checkCycle: null, |
| | | checkCycleUnit: null |
| | | } |
| | | } |
| | | }, |
| | | workTypeList: [ |
| | | { id: 1, name: '日常任务' }, |
| | | { id: 2, name: '周期任务' } |
| | | ], |
| | | quotaList: [], |
| | | departmentList: [], |
| | | classGroupList: [], |
| | | inspectPointAllList: [], |
| | | timeType: [ |
| | | { id: 1, name: '分' }, |
| | | { id: 2, name: '小时' }, |
| | | { id: 3, name: '日' }, |
| | | { id: 4, name: '月' }, |
| | | { id: 5, name: '年' } |
| | | ] |
| | | }); |
| | | |
| | | //获取巡检任务数据 |
| | | const getInspectionTask = async () => { |
| | | let res = await inspectTaskApi().getInspectTaskList(state.tableData.params); |
| | | if (res.data.code === '200') { |
| | | state.tableData.inspectTaskData = res.data.data; |
| | | state.tableData.total = res.data.count; |
| | | state.tableData.inspectTaskData = res.data.data.records; |
| | | state.tableData.total = res.data.data.total; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | |
| | | } |
| | | }; |
| | | |
| | | const openDialog = () => {}; |
| | | //获取部门 |
| | | const getDepartmentData = async () => { |
| | | let res = await departmentApi().getDepartmentList(); |
| | | if (res.data.code === '200') { |
| | | state.departmentList = res.data.data; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | //获取部门 |
| | | const getQuotaList = async () => { |
| | | let res = await inspectTaskApi().getQuotaList(); |
| | | if (res.data.code === '200') { |
| | | state.quotaList = res.data.data; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | //获取巡检点 |
| | | const getInspectTaskPoint = async () => { |
| | | let res = await inspectPointApi().getInspectPointAll(); |
| | | if (res.data.code === '200') { |
| | | state.inspectPointAllList = res.data.data; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | //获取班组 |
| | | const getClassGroupData = async () => { |
| | | let res = await teamManageApi().getRecord({ depIp: null, groupName: null, containGroupMemberEnable: null }); |
| | | if (res.data.code === '200') { |
| | | state.classGroupList = res.data.data; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | const openInspectTaskDialog = (type: string, value: {}) => { |
| | | inspectTaskDialogRef.value.showInspectTaskDialog(type, value, state.workTypeList, state.departmentList, state.timeType, state.classGroupList, state.quotaList, state.inspectPointAllList); |
| | | }; |
| | | |
| | | const parseNumber = (value: number, type: string) => { |
| | | if (type === '任务类型') { |
| | | return state.workTypeList.find((item) => item.id === value)?.name; |
| | | } else if (type === '检查频次') { |
| | | return state.timeType.find((item) => item.id == value)?.name; |
| | | } else { |
| | | return state.classGroupList.find((item) => item.id == value)?.groupName; |
| | | } |
| | | }; |
| | | |
| | | // 分页改变 |
| | | const onHandleSizeChange = (val: number) => { |
| | | state.tableData.params.pageSize = val; |
| | | getInspectionTask(); |
| | | }; |
| | | // 分页改变 |
| | | const onHandleCurrentChange = (val: number) => { |
| | | state.tableData.params.pageIndex = val; |
| | | getInspectionTask(); |
| | | }; |
| | | |
| | | const reset = () => { |
| | | state.tableData.params = { |
| | | pageIndex: 1, |
| | | pageSize: 10, |
| | | unitName: null, |
| | | workType: null, |
| | | createUserId: null, |
| | | execClassgroupId: null, |
| | | checkCycle: null, |
| | | checkCycleUnit: null |
| | | }; |
| | | }; |
| | | |
| | | // 页面加载时 |
| | | onMounted(() => { |
| | | getInspectionTask(); |
| | | getQuotaList(); |
| | | getDepartmentData(); |
| | | getClassGroupData(); |
| | | getInspectTaskPoint(); |
| | | }); |
| | | |
| | | return { |
| | |
| | | Delete, |
| | | Refresh, |
| | | Plus, |
| | | openDialog, |
| | | reset, |
| | | parseNumber, |
| | | getInspectionTask, |
| | | onHandleSizeChange, |
| | | onHandleCurrentChange, |
| | | inspectTaskDialogRef, |
| | | openInspectTaskDialog, |
| | | ...toRefs(state) |
| | | }; |
| | | } |