lct
Your Name
2022-08-23 216d03fa53a38ffc6afe45756d2ae73b21bf00b5
src/views/intellectInspect/inspectIndex/index.vue
@@ -2,14 +2,20 @@
    <div class="home-container">
        <div style="height: 100%">
            <div class="homeCard topCard">
                <div class="title">
                    当前巡检任务
                </div>
                <div class="title">当前巡检任务</div>
                <div class="top-info" v-if="unchecked!=0||unusual!=0">
                    <el-icon :size="18" color="#F3001E" style="margin-right: 4px"><BellFilled /></el-icon>
                    预警消息:
                    <div v-if="unchecked!=0">当日超期未巡检任务<span @click="toOverTime(4)">{{unchecked}}</span>个</div><span v-if="unchecked!=0&&unusual!=0">,</span>
                    <div v-if="unusual!=0">存在异常任务<span @click="toUnusual(1)">{{unusual}}</span>个</div>。
                    <div v-if="unchecked != 0">
                        当日超期未巡检任务<span @click="toOverTime(4)">{{ unchecked }}</span
                        >个
                    </div>
                    <span v-if="unchecked != 0 && unusual != 0">,</span>
                    <div v-if="unusual != 0">
                        存在异常任务<span @click="toUnusual(1)">{{ unusual }}</span
                        >个
                    </div>
                    。
                </div>
            </div>
            <div class="homeCard">
@@ -20,10 +26,14 @@
                                <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>
                                <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>
                                任务状态:<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>
@@ -53,14 +63,14 @@
import { inspectRecordApi } from '/@/api/intellectInspectSystem/inspectRecord';
import { useRouter } from 'vue-router';
import inspectRecordDialog from './components/inspectRecordDialog.vue';
import {departmentApi} from "/@/api/systemManage/department";
import { departmentApi } from '/@/api/systemManage/department';
// 定义接口来定义对象的类型
interface stateType {
    tableData: Array<string>;
    unchecked: null | number,
    unusual: null | number,
    uncheckedList: [],
    abnormalList: [],
    unchecked: null | number;
    unusual: null | number;
    uncheckedList: [];
    abnormalList: [];
    pageIndex: number;
    pageSize: number;
    totalSize: number;
@@ -121,7 +131,7 @@
        onMounted(() => {
            getInspectRecord();
            getDayData();
            getDepartmentData()
            getDepartmentData();
        });
        // 分页获取工作时段列表
@@ -129,8 +139,8 @@
            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
                state.tableData = res.data.data.records;
                state.totalSize = res.data.data.total;
            } else {
                ElMessage({
                    type: 'warning',
@@ -155,11 +165,11 @@
        const getDayData = async () => {
            let res = await inspectRecordApi().getDayRecord();
            if (res.data.code === '200') {
                state.unchecked = res.data.data.noCheckTaskCount
                state.unusual = res.data.data.abnormalTaskCount
                state.uncheckedList = res.data.data.noCheckTasks
                console.log(state.uncheckedList,'555555555555555')
                state.abnormalList = JSON.parse(JSON.stringify(res.data.data.abnormalTasks))
                state.unchecked = res.data.data.noCheckTaskCount;
                state.unusual = res.data.data.abnormalTaskCount;
                state.uncheckedList = JSON.parse(JSON.stringify(res.data.data.noCheckTasks));
                console.log(state.uncheckedList, '555555555555555');
                state.abnormalList = JSON.parse(JSON.stringify(res.data.data.abnormalTasks));
            } else {
                ElMessage({
                    type: 'warning',
@@ -178,26 +188,27 @@
        };
        const toLine = (item) =>{
            let id = JSON.parse(JSON.stringify(item)).id
            let id = JSON.parse(JSON.stringify(item)).id;
            router.push({
                path: 'intelligentLine',
                query: {
                    id: id
                }
            });
        }
        };
        const toOverTime = (id) =>{
            console.log(state.uncheckedList,'list')
            console.log(state.uncheckedList, 'list');
            debugger;
            router.push({
                path: 'inspectRecord',
                query: {
                    id: id,
                    dataList: state.uncheckedList,
                    dataList: JSON.stringify(state.uncheckedList),
                    total: state.uncheckedList.length
                }
            });
        }
        };
        // const toUnusual = (status) =>{
        //     router.push({
@@ -211,7 +222,7 @@
        // }
        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,
@@ -245,16 +256,16 @@
            font-size: 16px;
            align-items: center;
            padding: 10px 15px;
            background: #FFD057;
            background: #ffd057;
            border-radius: 8px;
            border: 1px solid #F3001E;
            border: 1px solid #f3001e;
            &>div{
                vertical-align: middle;
                white-space: nowrap;
                span{
                    font-size: 22px;
                    color: #F3001E;
                    color: #f3001e;
                    margin: 0 4px;
                    cursor: pointer;
                }
@@ -404,7 +415,6 @@
                border-radius: 8px;
                .left-info{
                    .num{
                        font-weight: bolder;
                        margin-right: 10px;
@@ -423,7 +433,6 @@
                    }
                }
                .mid-info{
                    span{
                        font-weight: bolder;
                    }
@@ -442,8 +451,6 @@
                    }
                }
                .right-info{
                    .checkBtn{
                        padding: 10px 15px;
                        background: #409eff;