From 4d482d7ce36f1e779677cdaef0475b5a2030e31b Mon Sep 17 00:00:00 2001
From: lyfO_o <764716047@qq.com>
Date: 星期四, 02 六月 2022 13:13:34 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into master

---
 config/dev.env.js                                                                       |    8 +-
 src/views/doublePreventAction/hiddenDanger/inspectionTask/components/inpectionPoint.vue |    7 +-
 src/views/doublePreventAction/hiddenDanger/inspectionTask/index.vue                     |  102 +++++++++++++++++++++++++++++----
 src/api/inspectionTask.js                                                               |   13 +++
 src/views/doublePreventAction/riskLevelManage/analyseUnit/index.vue                     |   26 +++-----
 5 files changed, 117 insertions(+), 39 deletions(-)

diff --git a/config/dev.env.js b/config/dev.env.js
index 58701ac..6fd0eb6 100644
--- a/config/dev.env.js
+++ b/config/dev.env.js
@@ -17,13 +17,13 @@
   //   BASE_API: '"http://220.171.99.118:4100"',
   //   IMG_API: '"http://220.171.99.118:4100/upload/"',
       // BASE_API: '"http://192.168.0.35:8006"',
-      // // IMG_API: '"http://192.168.0.35:8006/upload/"',
-      // BASE_API: '"http://192.168.0.35:8006"',
       // IMG_API: '"http://192.168.0.35:8006/upload/"',
+      BASE_API: '"http://192.168.0.35:8006"',
+      IMG_API: '"http://192.168.0.35:8006/upload/"',
       // BASE_API: '"http://192.168.0.62:8006"',
       // IMG_API: '"http://192.168.0.62:8006/upload/"',
-    BASE_API: '"http://222.92.213.22:8006/zhongtai"',
-    IMG_API: '"http://222.92.213.22:8006/zhongtai/upload/"',
+    // BASE_API: '"http://222.92.213.22:8006/zhongtai"',
+    // IMG_API: '"http://222.92.213.22:8006/zhongtai/upload/"',
     // NANO_API: '"http://222.92.213.22:8006/nanoweb"',
     // ZT_API:'"http://123.56.127.115:8011"'
     // BASE_API: '"http://localhost:8006"',
diff --git a/src/api/inspectionTask.js b/src/api/inspectionTask.js
index 923e062..5d33e10 100644
--- a/src/api/inspectionTask.js
+++ b/src/api/inspectionTask.js
@@ -35,14 +35,23 @@
     })
 }
 
+export function closeInspectionTask(data) {
+    return request({
+        headers: {
+            'Authorization': getToken()
+        },
+        url: process.env.BASE_API + '/safecheck/work/close?workId=' + data,
+        method: 'post',
+    })
+}
+
 export function deleteInspectionTask(data) {
     return request({
         headers: {
             'Authorization': getToken()
         },
-        url: process.env.BASE_API + '/riskAnaUnit/del',
+        url: process.env.BASE_API + '/safecheck/work/delete?workId=' + data,
         method: 'post',
-        data:data
     })
 }
 
diff --git a/src/views/doublePreventAction/hiddenDanger/inspectionTask/components/inpectionPoint.vue b/src/views/doublePreventAction/hiddenDanger/inspectionTask/components/inpectionPoint.vue
index 67bd0c0..2ac04f1 100644
--- a/src/views/doublePreventAction/hiddenDanger/inspectionTask/components/inpectionPoint.vue
+++ b/src/views/doublePreventAction/hiddenDanger/inspectionTask/components/inpectionPoint.vue
@@ -20,7 +20,7 @@
                    <el-table-column label="操作" align="center" width="280" class-name="small-padding fixed-width">
                     <template slot-scope="scope">
                         <el-button type="text" @click="showMeasureDetail(scope.row)" v-show="ifEdit">详情</el-button>
-                        <el-button type="text" style="color:red;" @click="deleteById(scope.$index)">删除</el-button>
+                        <el-button type="text" style="color:red;" @click="deleteById(scope.$index,scope.row)">删除</el-button>
                     </template>
                 </el-table-column>
             </el-table>
@@ -111,7 +111,7 @@
                     }
                 }
             },
-            deleteById(value){
+            deleteById(value,scope){
                 if(this.title === '新建巡检计划设定'){
                     this.inspectionPointData.splice(value,1)
                 }else{
@@ -120,7 +120,8 @@
                     cancelButtonText:'取消',
                     type:'warning',
                     }).then(()=> {
-                        deleteInspectionControlAction({workId:value.workId,measureId:value.measureId}).then( (res)=>{
+                        debugger
+                        deleteInspectionControlAction({workId:scope.workId,measureId:scope.measureId}).then( (res)=>{
                             if(res.data.code === '200'){
                                 this.getControlActionList()
                                 this.$notify({
diff --git a/src/views/doublePreventAction/hiddenDanger/inspectionTask/index.vue b/src/views/doublePreventAction/hiddenDanger/inspectionTask/index.vue
index 5f04a4f..3bbd25f 100644
--- a/src/views/doublePreventAction/hiddenDanger/inspectionTask/index.vue
+++ b/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
+                            })
+                        }
                     })
                 })
             },
diff --git a/src/views/doublePreventAction/riskLevelManage/analyseUnit/index.vue b/src/views/doublePreventAction/riskLevelManage/analyseUnit/index.vue
index a2ddbbb..57b9f9b 100644
--- a/src/views/doublePreventAction/riskLevelManage/analyseUnit/index.vue
+++ b/src/views/doublePreventAction/riskLevelManage/analyseUnit/index.vue
@@ -30,6 +30,7 @@
             </div>
             <el-button class="filter-item" style="margin-left: 10px;margin-top: 10px" type="primary" icon="el-icon-refresh" @click="refreshHandle">搜索</el-button>
             <el-button class="filter-item" style="margin-left: 10px;margin-top: 10px" type="primary" icon="el-icon-plus" @click="showAnalyseUnitForm('','新增')">新增</el-button>
+            <el-button class="filter-item" style="margin-left: 10px;margin-top: 10px" type="primary"  @click="showDepartmentChart()">图表</el-button>
         </div>
         <div class="table_content">
             <el-table
@@ -82,23 +83,14 @@
         <el-dialog :title="title" :visible.sync="analyseUnitVisible" :modal-append-to-body="false" :close-on-click-modal="false" width="600px">
             <el-form ref="analyseUnitForm" :rules="analyseUnitFormRules" :model="analyseUnitForm" label-position="right" label-width="165px">
                 <el-form-item label="责任部门" prop="hazardDep">
-                    <el-row>
-                        <el-col :span="21">
-                            <el-select v-model="analyseUnitForm.hazardDep" value-key="item" class="analyseUnit_input" @change="departmentChange" @clear="departmentClear">
-                                <el-option
-                                    v-for="item in departmentList"
-                                    :key="item.id"
-                                    :value="item"
-                                    :label="item.department"
-                                ></el-option>
-                            </el-select>
-                        </el-col>
-                        <el-col :span="3">
-                            <img src="../../../../assets/map.png" class="image" @click="showDepartmentChart"></img>
-                        </el-col>
-                    </el-row>
-
-
+                    <el-select v-model="analyseUnitForm.hazardDep" value-key="item" class="analyseUnit_input" @change="departmentChange" @clear="departmentClear">
+                        <el-option
+                            v-for="item in departmentList"
+                            :key="item.id"
+                            :value="item"
+                            :label="item.department"
+                        ></el-option>
+                    </el-select>
                 </el-form-item>
                 <el-form-item label="责任人" prop="hazardLiablePerson">
                     <el-select v-model="analyseUnitForm.hazardLiablePerson" value-key="item" class="analyseUnit_input"@change="personChange" @clear="personClear" >

--
Gitblit v1.9.2