马宇豪
2025-03-04 1b9fea7d4af68d8f933b2dc42bf6084b9646f64c
src/views/intellectInspect/inspectRecordManage/inspectRecord/index.vue
@@ -1,12 +1,19 @@
<template>
    <div class="home-container">
        <div style="height: 100%">
        <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>
@@ -16,7 +23,7 @@
                </div>
                <div class="basic-line">
                    <span>任务状态:</span>
                    <el-select v-model="tableData.params.taskStatus" clearable filterable class="input-box" placeholder="执行班组">
                    <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>
@@ -33,8 +40,8 @@
                    <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 :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>
@@ -45,13 +52,7 @@
                                </span>
                            </template>
                        </el-table-column>
                        <el-table-column property="execClassgroupId" label="巡检班组">
                            <template #default="scope">
                                <span>
                                    {{ parseNumber(scope.row.execClassgroupId, '巡检班组') }}
                                </span>
                            </template>
                        </el-table-column>
                        <el-table-column property="execClassgroupName" label="巡检班组"/>
                        <el-table-column property="frequency" label="检查频次">
                            <template #default="scope">
                                <span>
@@ -66,13 +67,28 @@
                        <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'">
                                <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, '任务状态') }}
                                        {{ 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>
@@ -115,7 +131,7 @@
};
interface stateType {
    isRed:boolean;
    isRed: boolean;
    hasJump: boolean;
    date: string;
    tableData: {
@@ -135,7 +151,7 @@
            validTime: string | null;
            createUserId: number | null;
            reportTime: string | null;
            resultStatus: number | null
            resultStatus: number | null;
        };
    };
    workTypeList: Array<type>;
@@ -155,6 +171,7 @@
    id: number;
    groupName: string;
}
interface timeType {}
export default {
    name: 'index',
    components: { inspectRecordDialog },
@@ -172,7 +189,7 @@
                    pageSize: 10,
                    taskName: null,
                    taskType: null,
                    taskStatus: 2,
                    taskStatus: null,
                    execUserId: null,
                    execClassgroupId: null,
                    execDepId: null,
@@ -191,12 +208,13 @@
            ],
            resultStatusList: [
                { id: 0, name: '正常' },
                { id: 1, name: '存在异常' }
                { id: 1, name: '存在异常' },
                { id: 2, name: '备' }
            ],
            taskStatusList: [
                { id: 1, name: '待巡检' },
                { id: 2, name: '巡检中' },
                { id: 3, name: '已巡检正常'},
                { id: 3, name: '已巡检正常' },
                { id: 5, name: '已巡检存在异常' },
                { id: 4, name: '超时未完成巡检' }
            ],
@@ -215,16 +233,16 @@
        //获取巡检记录数据
        const getInspectRecord = async () => {
            const data = JSON.parse(JSON.stringify(state.tableData.params))
            if(state.tableData.params.taskStatus == 3){
                data.taskStatus = 3
                data.resultStatus = 0
            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
            if (state.tableData.params.taskStatus == 5) {
                data.taskStatus = 3;
                data.resultStatus = 1;
            }
            console.log(state.tableData.params.taskStatus,data.taskStatus,'data')
            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));
@@ -276,16 +294,16 @@
            }
        };
        //获取班组
        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{
                }
            }
        };
@@ -320,10 +338,10 @@
        const onHandleCurrentChange = (val: number) => {
            state.tableData.params.pageIndex = val;
            getInspectRecord();
            state.isRed = false
            state.isRed = false;
        };
        // 时间格式化
        const timeForm = {
        const timeForm: timeType = {
            hour12: false,
            year: 'numeric',
            month: '2-digit',
@@ -345,6 +363,7 @@
                startTime: null,
                validTime: null,
                createUserId: null,
                resultStatus: null,
                reportTime: null
            };
        };
@@ -355,24 +374,21 @@
        };
        // 页面加载时
        onMounted(() => {
            getDateTime()
            getDateTime();
            if (route.query.id) {
                state.hasJump = true
                state.hasJump = true;
                state.tableData.params.taskStatus = Number(route.query.id);
                state.isRed = true
                state.isRed = true;
                getInspectRecord();
                getQuotaList();
                getDepartmentData();
                getClassGroupData();
                getInspectTaskPoint();
            }else{
            } else {
                getInspectRecord();
                getQuotaList();
                getDepartmentData();
                getClassGroupData();
                getInspectTaskPoint();
            }
        });
        return {
@@ -383,6 +399,7 @@
            Plus,
            reset,
            parseNumber,
            changeGroup,
            getInspectRecord,
            onHandleSizeChange,
            onHandleCurrentChange,
@@ -400,12 +417,14 @@
    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%;
@@ -420,7 +439,15 @@
                }
            }
            .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;
@@ -433,8 +460,8 @@
                }
            }
        }
        &:last-of-type {
            height: calc(100% - 100px);
        &:last-of-type{
          flex: 1;
        }
    }
    .el-row {
@@ -520,7 +547,7 @@
        color: #0098f5;
    }
}
.redTit{
.redTit {
    color: red;
}
.el-input {