<template>
|
<div class="home-container">
|
<div style="height: 100%;display: flex;flex-direction: column;align-items: stretch;">
|
<el-row class="homeCard">
|
<div class="basic-line">
|
<span>任务类型:</span>
|
<el-select v-model="tableData.params.taskType" 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-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>
|
</el-select>
|
</div>
|
<div class="basic-line">
|
<span>任务状态:</span>
|
<el-select v-model="tableData.params.taskStatus" clearable filterable class="input-box" placeholder="任务状态">
|
<el-option v-for="item in taskStatusList" :key="item.id" :label="item.name" :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="任务名称">
|
<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>
|
{{ parseNumber(scope.row.taskType, '任务类型') }}
|
</span>
|
</template>
|
</el-table-column>
|
<el-table-column property="execClassgroupName" label="巡检班组"/>
|
<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 property="startTime" label="任务开始时间" />
|
<el-table-column prop="execUserName" label="执行人" show-overflow-tooltip></el-table-column>
|
<el-table-column property="taskStatus" label="任务状态" width="180">
|
<template #default="scope">
|
<el-tag :type="scope.row.resultStatus === 1 ? 'danger' : scope.row.taskStatus === 1 ? 'info' : scope.row.taskStatus === 2 ? '' : scope.row.taskStatus === 3 ? 'success' : 'danger'">
|
<span>
|
{{ scope.row.resultStatus === 1 ? '已巡检存在异常' : parseNumber(scope.row.taskStatus, '任务状态') }}
|
</span>
|
</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column property="taskClaimTime" label="认领时间">
|
<template #default="scope">
|
{{scope.row.taskClaimTime?scope.row.taskClaimTime:'--'}}
|
</template>
|
</el-table-column>
|
<el-table-column property="reportTime" label="填报时间">
|
<template #default="scope">
|
{{scope.row.reportTime?scope.row.reportTime:'--'}}
|
</template>
|
</el-table-column>
|
<el-table-column property="taskTimeConsuming" label="巡检耗时">
|
<template #default="scope">
|
{{scope.row.taskTimeConsuming?scope.row.taskTimeConsuming:'--'}}
|
</template>
|
</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">
|
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 '../../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,
|
homeCharThree: null,
|
dispose: [null, '', undefined]
|
};
|
|
interface stateType {
|
isRed: boolean;
|
hasJump: boolean;
|
date: string;
|
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;
|
resultStatus: number | null;
|
};
|
};
|
workTypeList: Array<type>;
|
taskStatusList: 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;
|
}
|
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,
|
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,
|
resultStatus: null
|
}
|
},
|
isRed: false,
|
date: '',
|
workTypeList: [
|
{ id: 1, name: '周期任务' },
|
{ id: 2, name: '单次任务' }
|
],
|
resultStatusList: [
|
{ id: 0, name: '正常' },
|
{ id: 1, name: '存在异常' },
|
{ id: 2, name: '备' }
|
],
|
taskStatusList: [
|
{ id: 1, name: '待巡检' },
|
{ id: 2, name: '巡检中' },
|
{ id: 3, name: '已巡检正常' },
|
{ id: 5, name: '已巡检存在异常' },
|
{ id: 4, name: '超时未完成巡检' }
|
],
|
quotaList: [],
|
departmentList: [],
|
classGroupList: [],
|
inspectPointAllList: [],
|
timeType: [
|
{ id: 1, name: '分' },
|
{ id: 2, name: '小时' },
|
{ id: 3, name: '日' },
|
{ id: 4, name: '月' },
|
{ id: 5, name: '年' }
|
]
|
});
|
|
//获取巡检记录数据
|
const getInspectRecord = async () => {
|
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 = JSON.parse(JSON.stringify(res.data.data.records));
|
state.tableData.total = res.data.data.total;
|
} else {
|
ElMessage({
|
type: 'warning',
|
message: res.data.msg
|
});
|
}
|
};
|
|
//获取部门
|
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 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);
|
};
|
|
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 if (type === '任务状态') {
|
return state.taskStatusList.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;
|
getInspectRecord();
|
};
|
// 分页改变
|
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,
|
pageSize: 10,
|
taskName: null,
|
taskType: null,
|
taskStatus: null,
|
execUserId: null,
|
execClassgroupId: null,
|
execDepId: null,
|
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(() => {
|
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 {
|
View,
|
Edit,
|
Delete,
|
Refresh,
|
Plus,
|
reset,
|
parseNumber,
|
changeGroup,
|
getInspectRecord,
|
onHandleSizeChange,
|
onHandleCurrentChange,
|
inspectRecordDialogRef,
|
openInspectRecordDialog,
|
...toRefs(state)
|
};
|
}
|
};
|
</script>
|
|
<style scoped lang="scss">
|
$homeNavLengh: 8;
|
.home-container {
|
height: calc(100vh - 144px);
|
box-sizing: border-box;
|
overflow: hidden;
|
position: relative;
|
.homeCard {
|
width: 100%;
|
padding: 20px;
|
box-sizing: border-box;
|
background: #fff;
|
border-radius: 4px;
|
flex: 0 auto;
|
|
.main-card {
|
width: 100%;
|
height: 100%;
|
.cardTop {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
margin-bottom: 20px;
|
.mainCardBtn {
|
margin: 0;
|
}
|
}
|
.pageBtn {
|
position: absolute;
|
width: 100%;
|
z-index: 99;
|
bottom: 0;
|
right: 0;
|
height: 60px;
|
border-radius: 0 0 4px 4px;
|
padding-right: 20px;
|
background: #fff;
|
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{
|
flex: 1;
|
}
|
}
|
.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;
|
}
|
}
|
.redTit {
|
color: red;
|
}
|
.el-input {
|
width: 100% !important;
|
}
|
:deep(.el-date-editor) {
|
width: 100%;
|
}
|
.el-select {
|
width: 100%;
|
}
|
:deep(.el-textarea.is-disabled .el-textarea__inner) {
|
background-color: var(--el-card-bg-color);
|
color: var(--el-input-text-color, var(--el-text-color-regular));
|
}
|
:deep(.el-input.is-disabled .el-input__inner) {
|
color: var(--el-input-text-color, var(--el-text-color-regular));
|
}
|
:deep(.el-input.is-disabled .el-input__wrapper) {
|
background-color: var(--el-card-bg-color);
|
}
|
</style>
|