<template>
|
<el-dialog v-model="inspectListDialog" title="当前巡检任务" width="80%" center>
|
<div class="main-card">
|
<el-table :data="tableData" style="width: 100%" stripe border :header-cell-style="{ background: '#fafafa' }">
|
<el-table-column label="任务信息" align="center">
|
<template #default="scope">
|
<div class="left-info">
|
<span>{{ scope.row.taskName }},</span>
|
<p v-if="scope.row.execUserName == null">该任务暂无人认领</p>
|
<p v-else>
|
<span class="time">{{ scope.row.taskStatus == 2 ? scope.row.startTime : scope.row.endTime }}</span>由<span class="name">{{ scope.row.execUserName }}</span>进行的巡检任务
|
</p>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column prop="taskStatus" label="任务状态" align="center" width="180">
|
<template #default="scope">
|
<span :style="{color: scope.row.taskStatus == 1 ? '#999' : scope.row.taskStatus == 2 ? '#44b100' : scope.row.taskStatus == 3 ? '#409eff' : 'red'}">{{ scope.row.taskStatus == 1 ? '待巡检' : scope.row.taskStatus == 2 ? '巡检中' : scope.row.taskStatus == 3 ? '已巡检' : '超期未巡检' }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" align="center" width="180">
|
<template #default="scope">
|
<el-button type="text" size="small" v-if="scope.row.taskStatus == 2" @click="toLine(scope.row)">查看实时巡检</el-button>
|
<el-button type="text" size="small" v-else @click="toDetails('查看', scope.row)">查看巡检记录</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
<template #footer>
|
<span class="dialog-footer" style="display: flex;justify-content: right">
|
<el-pagination v-model:currentPage="pageIndex" v-model:page-size="pageSize" :page-sizes="[10, 15]" small="false" background layout="total, sizes, prev, pager, next, jumper" :total="totalSize" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
</span>
|
</template>
|
<inspect-record-dialog ref="inspectRecordDialogRef" @refreshInspectRecord="getInspectRecord"></inspect-record-dialog>
|
</el-dialog>
|
</template>
|
|
<script lang="ts">
|
import { toRefs, reactive, ref, onMounted } 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 } from 'element-plus';
|
import { FormInstance, FormRules, ElMessage } from 'element-plus';
|
import { inspectRecordApi } from '/@/api/intellectInspectSystem/inspectRecord';
|
import { useRouter } from 'vue-router';
|
import inspectRecordDialog from './inspectRecordDialog.vue';
|
import { departmentApi } from '/@/api/systemManage/department';
|
// 定义接口来定义对象的类型
|
interface stateType {
|
tableData: Array<string>;
|
unchecked: null | number;
|
unusual: null | number;
|
uncheckedList: [];
|
abnormalList: [];
|
pageIndex: number;
|
pageSize: number;
|
totalSize: number;
|
workTypeList: Array<type>;
|
timeType: Array<type>;
|
classGroupList: Array<classGroup>;
|
quotaList: [];
|
departmentList: [];
|
inspectPointAllList: [];
|
inspectListDialog: boolean
|
}
|
interface type {
|
id: number;
|
name: string;
|
}
|
interface classGroup {
|
id: number;
|
groupName: string;
|
}
|
export default {
|
name: 'inspectList',
|
components: { inspectRecordDialog },
|
setup() {
|
const router = useRouter();
|
const state = reactive<stateType>({
|
inspectListDialog: false,
|
pageIndex: 1,
|
pageSize: 10,
|
totalSize: 0,
|
tableData: [],
|
unchecked: null,
|
unusual: null,
|
departmentList: [],
|
uncheckedList: [],
|
abnormalList: [],
|
workTypeList: [
|
{ id: 1, name: '日常任务' },
|
{ id: 2, name: '周期任务' }
|
],
|
timeType: [
|
{ id: 1, name: '分' },
|
{ id: 2, name: '小时' },
|
{ id: 3, name: '日' },
|
{ id: 4, name: '月' },
|
{ id: 5, name: '年' }
|
],
|
classGroupList: [],
|
quotaList: [],
|
inspectPointAllList: []
|
});
|
const inspectRecordDialogRef = ref();
|
interface User {
|
name: string;
|
startTime: string;
|
endTime: string;
|
info: string;
|
}
|
|
// 页面载入时执行方法
|
onMounted(() => {
|
getInspectRecord();
|
});
|
|
const showInspectList = ()=>{
|
state.inspectListDialog = true
|
getInspectRecord();
|
}
|
// 分页获取工作时段列表
|
const getInspectRecord = async () => {
|
const data = { pageSize: state.pageSize, pageIndex: state.pageIndex };
|
let res = await inspectRecordApi().getInspectRecordByIndex(data);
|
if (res.data.code === '200') {
|
state.tableData = res.data.data.records;
|
state.totalSize = res.data.data.total;
|
} else {
|
ElMessage({
|
type: 'warning',
|
message: res.data.msg
|
});
|
}
|
};
|
|
const handleSizeChange = (val: number) => {
|
state.pageSize = val;
|
getInspectRecord();
|
};
|
const handleCurrentChange = (val: number) => {
|
state.pageIndex = val;
|
getInspectRecord();
|
};
|
|
const toLine = (item) => {
|
console.log(item,'item')
|
let id = item.id;
|
console.log(id,'id')
|
router.push({
|
path: 'intelligentLine',
|
query: {
|
id: id
|
}
|
});
|
};
|
|
const toOverTime = (id) => {
|
console.log(state.uncheckedList, 'list');
|
router.push({
|
path: 'inspectRecord',
|
query: {
|
id: id,
|
}
|
});
|
};
|
const toDetails = (type: string, item) => {
|
inspectRecordDialogRef.value.showInspectRecordDialog(type, item, state.workTypeList, state.departmentList, state.timeType, state.classGroupList, state.quotaList, state.inspectPointAllList);
|
};
|
return {
|
View,
|
Edit,
|
Delete,
|
Refresh,
|
Plus,
|
router,
|
inspectRecordDialogRef,
|
showInspectList,
|
toLine,
|
toOverTime,
|
toDetails,
|
handleSizeChange,
|
handleCurrentChange,
|
...toRefs(state)
|
};
|
}
|
};
|
</script>
|
|
<style scoped lang="scss">
|
$homeNavLengh: 8;
|
@media screen and (min-width: 1366px) {
|
.topCard {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
font-weight: bolder;
|
|
.top-info {
|
display: flex;
|
font-size: 16px;
|
align-items: center;
|
padding: 10px 15px;
|
background: #ffeb87;
|
border-radius: 8px;
|
border: 1px solid #ffae00;
|
|
& > div {
|
vertical-align: middle;
|
white-space: nowrap;
|
span {
|
font-size: 22px;
|
color: #f3001e;
|
margin: 0 4px;
|
cursor: pointer;
|
|
&:hover{
|
text-decoration: underline;
|
}
|
}
|
}
|
}
|
}
|
.left-info {
|
width: 70%;
|
display: flex;
|
align-items: center;
|
justify-content: left;
|
font-size: 16px;
|
overflow-x: auto;
|
& > span {
|
white-space: nowrap;
|
}
|
p {
|
white-space: nowrap;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
& > span {
|
white-space: nowrap;
|
}
|
}
|
}
|
}
|
@media screen and (min-width: 1200px) and (max-width: 1366px) {
|
.topCard {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
font-weight: bolder;
|
|
.top-info {
|
display: flex;
|
font-size: 14px;
|
align-items: center;
|
padding: 6px 10px;
|
background: #ffeb87;
|
border-radius: 4px;
|
border: 1px solid #ffae00;
|
|
& > div {
|
vertical-align: middle;
|
white-space: nowrap;
|
span {
|
font-size: 18px;
|
color: #f3001e;
|
margin: 0 2px;
|
cursor: pointer;
|
|
&:hover{
|
text-decoration: underline;
|
}
|
}
|
}
|
}
|
}
|
.left-info {
|
width: 70%;
|
display: flex;
|
align-items: center;
|
justify-content: left;
|
font-size: 15px;
|
color: #333;
|
overflow-x: auto;
|
& > span {
|
white-space: nowrap;
|
}
|
p {
|
white-space: nowrap;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
& > span {
|
white-space: nowrap;
|
}
|
}
|
}
|
}
|
@media screen and (max-width: 1200px) {
|
.topCard {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
font-weight: bolder;
|
|
.top-info {
|
display: flex;
|
font-size: 14px;
|
align-items: center;
|
padding: 2px 6px;
|
background: #ffeb87;
|
border-radius: 4px;
|
border: 1px solid #ffae00;
|
|
& > div {
|
vertical-align: middle;
|
white-space: nowrap;
|
span {
|
font-size: 16px;
|
color: #f3001e;
|
margin: 0 1px;
|
cursor: pointer;
|
|
&:hover{
|
text-decoration: underline;
|
}
|
}
|
}
|
}
|
}
|
.left-info {
|
width: 70%;
|
display: flex;
|
align-items: center;
|
justify-content: left;
|
font-size: 12px;
|
color: #333;
|
overflow-x: auto;
|
& > span {
|
white-space: nowrap;
|
}
|
p {
|
white-space: nowrap;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
& > span {
|
white-space: nowrap;
|
}
|
}
|
}
|
}
|
|
.home-container {
|
height: calc(100vh - 144px);
|
box-sizing: border-box;
|
overflow: hidden;
|
.homeCard {
|
width: 100%;
|
padding: 20px;
|
box-sizing: border-box;
|
background: #fff;
|
border-radius: 4px;
|
|
.title {
|
font-size: 20px;
|
font-weight: bolder;
|
}
|
.main-card {
|
width: 100%;
|
height: 100%;
|
}
|
&:last-of-type {
|
position: relative;
|
padding-top: 0;
|
height: calc(100% - 60px);
|
}
|
}
|
.el-row {
|
display: flex;
|
align-items: center;
|
margin-bottom: 20px;
|
&:last-child {
|
margin-bottom: 0;
|
}
|
.grid-content {
|
align-items: center;
|
min-height: 36px;
|
}
|
}
|
}
|
.el-input {
|
width: 100% !important;
|
}
|
.el-date-editor::v-deep {
|
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>
|