From f7bd94cf4a3d6ce6b06c2f90413f6798c488481d Mon Sep 17 00:00:00 2001 From: batman <978517621@qq.com> Date: 星期三, 15 三月 2023 10:21:22 +0800 Subject: [PATCH] 修改特殊作业首页 --- src/views/intellectInspect/inspectRecordManage/inspectRecord/index.vue | 129 +++++++++++++++++++++++++++++++++---------- 1 files changed, 99 insertions(+), 30 deletions(-) diff --git a/src/views/intellectInspect/inspectRecordManage/inspectRecord/index.vue b/src/views/intellectInspect/inspectRecordManage/inspectRecord/index.vue index f75b427..939361f 100644 --- a/src/views/intellectInspect/inspectRecordManage/inspectRecord/index.vue +++ b/src/views/intellectInspect/inspectRecordManage/inspectRecord/index.vue @@ -9,6 +9,13 @@ </el-select> </div> <div class="basic-line"> + <span>部门:</span> + <el-cascader class="input-box" :options="departmentList" :props="{ emitPath: false, checkStrictly: true, value: 'depId', label: 'depName' }" + placeholder="请选择部门" clearable v-model="tableData.params.execDepId" + @change="changeGroup" + > </el-cascader> + </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> @@ -31,7 +38,13 @@ <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="taskName" label="任务名称"> + <template #default="scope"> + <div :class="hasJump == true && scope.row.startTime.slice(0, 10) == date && (tableData.params.taskStatus == 4 || tableData.params.taskStatus == 5) ? 'redTit' : ''"> + {{ scope.row.taskName }} + </div> + </template> + </el-table-column> <el-table-column property="taskType" label="任务类型"> <template #default="scope"> <span> @@ -58,11 +71,11 @@ </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="taskStatus" label="任务状态"> + <el-table-column property="taskStatus" label="任务状态" width="180"> <template #default="scope"> - <el-tag :type="scope.row.taskStatus === 1 ? 'info' : scope.row.taskStatus === 2 ? '' : scope.row.taskStatus === 3 ? 'success' : 'danger'"> + <el-tag :type="scope.row.resultStatus === 1 ? 'danger' : scope.row.taskStatus === 1 ? 'info' : scope.row.taskStatus === 2 ? '' : scope.row.taskStatus === 3 ? 'success' : 'danger'"> <span> - {{ parseNumber(scope.row.taskStatus, '任务状态') }} + {{ scope.row.resultStatus === 1 ? '已巡检存在异常' : parseNumber(scope.row.taskStatus, '任务状态') }} </span> </el-tag> </template> @@ -95,11 +108,12 @@ 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 inspectRecordDialog from '../../inspectIndex/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'; +import { useRoute } from 'vue-router'; let global: any = { homeChartOne: null, homeChartTwo: null, @@ -108,6 +122,9 @@ }; interface stateType { + isRed: boolean; + hasJump: boolean; + date: string; tableData: { inspectRecordData: []; total: number; @@ -125,6 +142,7 @@ validTime: string | null; createUserId: number | null; reportTime: string | null; + resultStatus: number | null; }; }; workTypeList: Array<type>; @@ -144,12 +162,15 @@ id: number; groupName: string; } +interface timeType {} export default { name: 'index', components: { inspectRecordDialog }, setup() { const inspectRecordDialogRef = ref(); + const route = useRoute(); const state = reactive<stateType>({ + hasJump: false, tableData: { inspectRecordData: [], total: 0, @@ -166,22 +187,27 @@ startTime: null, validTime: null, createUserId: null, - reportTime: null + reportTime: null, + resultStatus: null } }, + isRed: false, + date: '', workTypeList: [ - { id: 1, name: '单次任务' }, - { id: 2, name: '周期任务' } + { id: 1, name: '周期任务' }, + { id: 2, name: '单次任务' } ], resultStatusList: [ { id: 0, name: '正常' }, - { id: 1, name: '存在异常' } + { id: 1, name: '存在异常' }, + { id: 2, name: '备' } ], taskStatusList: [ { id: 1, name: '待巡检' }, { id: 2, name: '巡检中' }, - { id: 3, name: '已巡检' }, - { id: 4, name: '超时未巡检' } + { id: 3, name: '已巡检正常' }, + { id: 5, name: '已巡检存在异常' }, + { id: 4, name: '超时未完成巡检' } ], quotaList: [], departmentList: [], @@ -198,9 +224,19 @@ //获取巡检记录数据 const getInspectRecord = async () => { - let res = await inspectRecordApi().getInspectRecordList(state.tableData.params); + const data = JSON.parse(JSON.stringify(state.tableData.params)); + if (state.tableData.params.taskStatus == 3) { + data.taskStatus = 3; + data.resultStatus = 0; + } + if (state.tableData.params.taskStatus == 5) { + data.taskStatus = 3; + data.resultStatus = 1; + } + console.log(state.tableData.params.taskStatus, data.taskStatus, 'data'); + let res = await inspectRecordApi().getInspectRecordList(data); if (res.data.code === '200') { - state.tableData.inspectRecordData = res.data.data.records; + state.tableData.inspectRecordData = JSON.parse(JSON.stringify(res.data.data.records)); state.tableData.total = res.data.data.total; } else { ElMessage({ @@ -249,18 +285,22 @@ } }; - //获取班组 - 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 changeGroup = async () => { + if(state.tableData.params.execDepId === null) { + state.classGroupList = [] + }else{ + let res = await departmentApi().getByDepId({depId:state.tableData.params.execDepId}) + if(res.data.code === '200'){ + state.classGroupList = res.data.data + }else{ + + } } }; + + // const turnRed =()=>{ + // date + // } const openInspectRecordDialog = (type: string, value: {}) => { inspectRecordDialogRef.value.showInspectRecordDialog(type, value, state.workTypeList, state.departmentList, state.timeType, state.classGroupList, state.quotaList, state.inspectPointAllList); @@ -289,8 +329,18 @@ const onHandleCurrentChange = (val: number) => { state.tableData.params.pageIndex = val; getInspectRecord(); + state.isRed = false; }; - + // 时间格式化 + const timeForm: timeType = { + hour12: false, + year: 'numeric', + month: '2-digit', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + second: '2-digit' + }; const reset = () => { state.tableData.params = { pageIndex: 1, @@ -304,17 +354,32 @@ startTime: null, validTime: null, createUserId: null, + resultStatus: null, reportTime: null }; }; - + // 当前时间 + const getDateTime = () => { + const curTime = new Date().toLocaleString('zh', timeForm).replace(/\//g, '-'); + state.date = curTime.slice(0, 10); + }; // 页面加载时 onMounted(() => { - getInspectRecord(); - getQuotaList(); - getDepartmentData(); - getClassGroupData(); - getInspectTaskPoint(); + getDateTime(); + if (route.query.id) { + state.hasJump = true; + state.tableData.params.taskStatus = Number(route.query.id); + state.isRed = true; + getInspectRecord(); + getQuotaList(); + getDepartmentData(); + getInspectTaskPoint(); + } else { + getInspectRecord(); + getQuotaList(); + getDepartmentData(); + getInspectTaskPoint(); + } }); return { @@ -325,6 +390,7 @@ Plus, reset, parseNumber, + changeGroup, getInspectRecord, onHandleSizeChange, onHandleCurrentChange, @@ -462,6 +528,9 @@ color: #0098f5; } } +.redTit { + color: red; +} .el-input { width: 100% !important; } -- Gitblit v1.9.2