Your Name
2022-06-02 3eb4a715c02d3b9676af22fdd09669d253dcbf22
src/views/doublePreventAction/hiddenDanger/inspectionTask/index.vue
@@ -22,7 +22,7 @@
            </div>
            <div class="basic_search">
                <span>巡检任务状态:</span>
                <el-select v-model="listQuery.status">
                <el-select v-model="listQuery.status" clearable>
                    <el-option
                        v-for="item in statusList"
                        :key="item.id"
@@ -104,10 +104,21 @@
                </el-table-column>
                <el-table-column label="创建时间" prop="createTime" align="center">
                </el-table-column>
                <el-table-column label="状态" prop="createTime" align="center">
                    <template slot-scope="scope">
                        <div v-for="item in statusList">
                            <div v-show="scope.row.status === item.id">
                                <el-tag :type="scope.row.status === 1 ? 'primary' : (scope.row.status === 2 ? 'warning' : (scope.row.status === 3 ? 'danger' : 'info'))">{{item.name}}</el-tag>
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="操作" align="center" width="280" class-name="small-padding fixed-width">
                    <template slot-scope="scope">
                        <el-button type="text" @click="showAnalyseUnitForm(scope.row,'编辑')">编辑</el-button>
                        <el-button type="text" style="color: red" @click="deleteById(scope.row)">删除</el-button>
                        <el-button type="text" @click="openTask(scope.row,'编辑')">开启</el-button>
                        <el-button type="text" style="color: red" @click="closeTask(scope.row)">关闭</el-button>
                    </template>
                </el-table-column>
            </el-table>
@@ -281,7 +292,12 @@
    import { mapGetters } from 'vuex'
    import { computePageCount } from '@/utils'
    import inspectionPoint from './components/inpectionPoint'
    import { getInspectionTask , addInspectionTask, updateInspectionTask} from "../../../../api/inspectionTask";
    import {
        getInspectionTask,
        addInspectionTask,
        updateInspectionTask,
        deleteInspectionTask, closeInspectionTask
    } from "../../../../api/inspectionTask";
    import {getAllDepartment, getDepartmentList} from "../../../../api/departmentManage";
    import {safetyInspectionItemName} from "../../../../api/safetySelfInspection";
    export default {
@@ -326,7 +342,7 @@
                userList:[],
                // noticeUidList:[],
                execUidList:[],
                statusList:[{name:'任务开启',id:1},{id:2,name:'任务关闭'}],
                statusList:[{name:'任务开启',id:1},{id:2,name:'任务关闭'},{id:3,name:'删除'},{id:4,name:'过期'}],
                intervalSecondsList:[{id:3600,name:'1小时'},{id:7200,name:'2小时'},{id:21600,name:'6小时'},{id:28800,name:'8小时'},{id:43200,name:'12小时'},{id:86400,name:'1天'},{id:17280,name:'2天'},{id:604800,name:'每周'},{id:2592000,name:'每月'},{id:7862400,name:'每季度'}],
                noticeSecondsList:[{id:600,name:'10分'},{id:3600,name:'1小时'},{id:7200,name:'2小时'},{id:21600,name:'6小时'},{id:43200,name:'12小时'},{id:86400,name:'1天'}],
                effectSecondsList:[{id:1800,name:'30分'},{id:3600,name:'1小时'},{id:7200,name:'2小时'},{id:21600,name:'6小时'},{id:43200,name:'12小时'},{id:86400,name:'1天'}],
@@ -472,7 +488,7 @@
                    this.execDepartment = this.handleDepartment(JSON.parse(JSON.stringify(value)).execUid)
                    this.changeExec()
                    this.inspectionTaskForm = JSON.parse(JSON.stringify(value))
                    this.inspectionTaskForm.execUid = value.execUname
                    this.inspectionTaskForm.execUid = value.execUid
                    // this.inspectionTaskForm.noticeUid = value.noticeUname
                     setTimeout(() => {
                        this.$refs.inspectionPoint.inspectionPointData =  this.inspectionTaskForm.checkContents
@@ -536,7 +552,8 @@
                                    // noticeUid: this.inspectionTaskForm.noticeUid,
                                    startTime: this.inspectionTaskForm.startTime,
                                    status: this.inspectionTaskForm.status,
                                    workId: this.inspectionTaskForm.workId
                                    workId: this.inspectionTaskForm.workId,
                                    title: this.inspectionTaskForm.title
                                    }).then((res)=>{
                                    if(res.data.code === '200'){
                                        this.inspectionTaskVisible = false
@@ -577,20 +594,79 @@
                    return true
                }
            },
            openTask(val,type){
                if(val.status !== 2){
                    this.$message({
                        type:'warning',
                        message:'当前状态不可开启'
                    })
                    return
                }
                this.showAnalyseUnitForm(val,type)
                this.inspectionTaskForm.status = 1
            },
            closeTask(val){
                if(val.status !== 1){
                    this.$message({
                        type:'warning',
                        message:'当前状态不可关闭'
                    })
                    return
                }
                this.$confirm('关闭此条任务,是否继续','提示',{
                    confirmButtonText:'确定',
                    cancelButtonText:'取消',
                    type:'warning',
                }).then(()=> {
                    closeInspectionTask(val.workId).then( (res)=>{
                        if(res.data.code === '200'){
                            this.getInspectionTaskData()
                            this.$notify({
                                title:'成功',
                                message:'关闭成功',
                                type:'success',
                                duration:2000,
                            })
                        }else{
                            this.$message({
                                type:'warning',
                                message:res.data.message
                            })
                        }
                    })
                })
            },
            deleteById(val){
                if(val.status !== 2){
                    this.$message({
                        type:'warning',
                        message:'当前状态不可删除'
                    })
                    return
                }
                this.$confirm('删除此条信息,是否继续','提示',{
                    confirmButtonText:'确定',
                    cancelButtonText:'取消',
                    type:'warning',
                }).then(()=> {
                    deleteAnalyseUnit({id:val.id}).then( ()=>{
                        this.getInspectionTaskData()
                        this.$notify({
                            title:'成功',
                            message:'删除成功',
                            type:'success',
                            duration:2000,
                        })
                    deleteInspectionTask(val.workId).then( (res)=>{
                        if(res.data.code === '200'){
                            this.getInspectionTaskData()
                            this.$notify({
                                title:'成功',
                                message:'删除成功',
                                type:'success',
                                duration:2000,
                            })
                        }else{
                            this.$message({
                                type:'warning',
                                message:res.data.message
                            })
                        }
                    })
                })
            },