<template>
|
<div class="home-container">
|
<div style="height: 100%">
|
<div class="homeCard">
|
<div class="title">
|
当前巡检任务
|
</div>
|
</div>
|
<div class="homeCard">
|
<div class="main-card">
|
<div class="list">
|
<div class="cardTop" v-for="(item,index) in tableData" :key="index">
|
<div class="left-info">
|
<span class="num">{{pageSize * (pageIndex-1) + index + 1}}、</span>
|
<span class="place">{{item.taskName}},</span>
|
<p v-if="item.execUserName==null">该任务暂无人认领</p>
|
<p v-else><span class="time">{{item.taskStatus == 2?item.startTime:item.endTime}}</span>由<span class="name">{{item.execUserName}}</span>进行的巡检任务</p>
|
</div>
|
<div class="mid-info">
|
任务状态:<span :class="item.taskStatus == 1?'grey':(item.taskStatus == 2?'green':(item.taskStatus == 3?'blue':'red'))">{{item.taskStatus == 1?'待巡检':(item.taskStatus == 2?'巡检中':(item.taskStatus == 3?'已巡检':'超期未巡检'))}}</span>
|
</div>
|
<div class="right-info">
|
<div v-if="item.taskStatus == 2" @click="toLine(item)" class="checkBtn">查看实时巡检</div>
|
<div v-else class="reviewBtn" @click="toDetails('查看',item)">[查看巡检记录]</div>
|
</div>
|
</div>
|
</div>
|
<div class="pageBtn">
|
<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" />
|
</div>
|
</div>
|
</div>
|
</div>
|
<inspect-record-dialog ref="inspectRecordDialogRef" @refreshInspectRecord="getInspectRecord"></inspect-record-dialog>
|
</div>
|
</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 './components/inspectRecordDialog.vue';
|
// 定义接口来定义对象的类型
|
interface stateType {
|
tableData: Array<string>;
|
pageIndex: number;
|
pageSize: number;
|
totalSize: number;
|
workTypeList: Array<type>;
|
departmentList: [];
|
timeType: Array<type>;
|
classGroupList: Array<classGroup>;
|
quotaList: [];
|
inspectPointAllList: [];
|
}
|
interface type {
|
id: number;
|
name: string;
|
}
|
interface classGroup {
|
id: number;
|
groupName: string;
|
}
|
export default {
|
name: 'workingHours',
|
components: { inspectRecordDialog },
|
setup() {
|
const router = useRouter();
|
const state = reactive<stateType>({
|
pageIndex: 1,
|
pageSize: 10,
|
totalSize: 0,
|
tableData: [],
|
workTypeList: [
|
{ id: 1, name: '日常任务' },
|
{ id: 2, name: '周期任务' }
|
],
|
departmentList: [],
|
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 getInspectRecord = async () => {
|
const data = { pageSize: state.pageSize, pageIndex: state.pageIndex};
|
let res = await inspectRecordApi().getInspectRecordByIndex(data);
|
if (res.data.code === '200'){
|
console.log(res.data.data)
|
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) =>{
|
let id = JSON.parse(JSON.stringify(item)).id
|
console.log(id,'id')
|
router.push({
|
path: 'intelligentLine',
|
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,
|
toLine,
|
toDetails,
|
handleSizeChange,
|
handleCurrentChange,
|
...toRefs(state)
|
};
|
}
|
};
|
</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;
|
|
.title{
|
font-size: 20px;
|
font-weight: bolder;
|
}
|
.main-card {
|
width: 100%;
|
height: 100%;
|
.cardTop {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
margin-bottom: 10px;
|
background: #daf3ff;
|
padding: 20px;
|
border-radius: 8px;
|
|
.left-info{
|
width: 50%;
|
display: flex;
|
align-items: center;
|
justify-content: left;
|
font-size: 14px;
|
color: #333;
|
overflow-x: auto;
|
|
.num{
|
font-weight: bolder;
|
margin-right: 10px;
|
}
|
|
.place{
|
font-weight: bolder;
|
}
|
.time{
|
font-weight: bolder;
|
margin-right: 5px;
|
}
|
.name{
|
font-weight: bolder;
|
margin: 0 5px;
|
font-weight: bolder;
|
}
|
}
|
.mid-info{
|
width: 35%;
|
font-size: 14px;
|
color: #333;
|
|
span{
|
font-weight: bolder;
|
}
|
|
.grey{
|
color: #999;
|
}
|
.green{
|
color: #44b100;
|
}
|
.blue{
|
color: #409eff;
|
}
|
.red{
|
color: red;
|
}
|
}
|
.right-info{
|
width: 15%;
|
display: flex;
|
justify-content: right;
|
align-items: center;
|
font-size: 14px;
|
color: #fff;
|
|
.checkBtn{
|
padding: 10px 15px;
|
background: #409eff;
|
border-radius: 4px;
|
cursor: pointer;
|
}
|
|
.reviewBtn{
|
margin: 10px 15px;
|
cursor: pointer;
|
color: #44b100;
|
}
|
}
|
}
|
.list{
|
height: calc(100% - 60px);
|
overflow-y: auto;
|
}
|
.pageBtn {
|
position: absolute;
|
bottom: 15px;
|
right: 20px;
|
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 {
|
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;
|
}
|
|
.topInfo {
|
display: flex;
|
align-items: center;
|
font-size: 16px;
|
font-weight: bold;
|
|
& > div {
|
white-space: nowrap;
|
margin-right: 20px;
|
}
|
}
|
}
|
}
|
.el-input {
|
width: 100% !important;
|
}
|
.el-date-editor::v-deep {
|
width: 100%;
|
}
|
.el-select {
|
width: 100%;
|
}
|
</style>
|