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

---
 src/api/riskLevelManage.js                                            |   30 ++++++++++
 src/views/doublePreventAction/riskLevelManage/controlAction/index.vue |   56 ++++++++++++++++++
 config/dev.env.js                                                     |    8 ++
 src/views/doublePreventAction/riskLevelManage/event/index.vue         |   41 +++++++++++++
 src/views/doublePreventAction/riskLevelManage/analyseUnit/index.vue   |   45 ++++++++++++++
 5 files changed, 175 insertions(+), 5 deletions(-)

diff --git a/config/dev.env.js b/config/dev.env.js
index 6fd0eb6..613dfcc 100644
--- a/config/dev.env.js
+++ b/config/dev.env.js
@@ -18,8 +18,12 @@
   //   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.8:8006"',
+    IMG_API: '"http://192.168.0.8: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"',
diff --git a/src/api/riskLevelManage.js b/src/api/riskLevelManage.js
index 0bd178c..dc0cb0a 100644
--- a/src/api/riskLevelManage.js
+++ b/src/api/riskLevelManage.js
@@ -46,6 +46,16 @@
 }
 
 
+export function exportAnalyseUnit() {
+    return request({
+        headers: {
+            'Authorization': getToken()
+        },
+        url: process.env.BASE_API + '/riskAnaUnit/export',
+        method: 'post',
+    })
+}
+
 
 export function getRiskEventList(data) {
     return request({
@@ -91,6 +101,15 @@
     })
 }
 
+export function exportRiskEvent() {
+    return request({
+        headers: {
+            'Authorization': getToken()
+        },
+        url: process.env.BASE_API + '/riskEvent/export',
+        method: 'post',
+    })
+}
 
 
 
@@ -139,6 +158,16 @@
     })
 }
 
+export function exportRiskControlMeasure() {
+    return request({
+        headers: {
+            'Authorization': getToken()
+        },
+        url: process.env.BASE_API + '/riskControlMeasure/export',
+        method: 'post',
+    })
+}
+
 
 export function getClassify() {
     return request({
@@ -160,3 +189,4 @@
         method: 'post',
     })
 }
+
diff --git a/src/views/doublePreventAction/riskLevelManage/analyseUnit/index.vue b/src/views/doublePreventAction/riskLevelManage/analyseUnit/index.vue
index 57b9f9b..476cf45 100644
--- a/src/views/doublePreventAction/riskLevelManage/analyseUnit/index.vue
+++ b/src/views/doublePreventAction/riskLevelManage/analyseUnit/index.vue
@@ -31,6 +31,7 @@
             <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>
+            <el-button class="filter-item" style="margin-left: 10px;margin-top: 10px" type="primary"  @click="exportToExcel()">导出</el-button>
         </div>
         <div class="table_content">
             <el-table
@@ -126,7 +127,7 @@
     import { addAnalyseUnit, deleteAnalyseUnit, getAnalyseUnitList, updateAnalyseUnit } from '@/api/riskLevelManage'
     import {getAllDepartment, getDepartmentList} from "../../../../api/departmentManage";
     import {safetyInspectionItemName} from "../../../../api/safetySelfInspection";
-    import {getDepartmentChart} from "../../../../api/riskLevelManage";
+    import {exportAnalyseUnit, getDepartmentChart} from "../../../../api/riskLevelManage";
     export default {
         name: 'index',
         filters: {
@@ -332,6 +333,48 @@
                     })
                 })
             },
+
+            exportToExcel() {
+                exportAnalyseUnit(this.listQuery.filter).then(res=>{
+                    if (res.data.code === '200') {
+                        if(res.data.result === null ||res.data.result === [] || res.data.result.length === 0){
+                            this.$message({
+                                type:'warning',
+                                message:'无数据可导出'
+                            })
+                        }
+                        else{
+                            let allData = res.data.result
+                            import('@/vendor/Export2Excel').then((excel) => {
+                                const tHeader = [
+                                    '安全风险分析对象编码',
+                                    '安全风险分析单元名称',
+                                    '责任部门',
+                                    '责任人',
+                                ]
+                                const filterVal = [
+                                    'hazardCode',
+                                    'riskUnitName',
+                                    'hazardDep',
+                                    'hazardLiablePerson',
+                                ]
+                                const data = this.formatJson(filterVal, allData)
+                                excel.export_json_to_excel({
+                                    header: tHeader,
+                                    data,
+                                    filename: '安全风险分析单元数据'
+                                })
+                            })
+
+                        }
+                    }
+                })
+            },
+
+            formatJson(filterVal, jsonData) {
+                return jsonData.map(v => filterVal.map(j => v[j]))
+            },
+
             personChange(val){
                 this.analyseUnitForm.hazardLiablePerson = val.realname
                 this.analyseUnitForm.hazardLiablePersonId = val.id
diff --git a/src/views/doublePreventAction/riskLevelManage/controlAction/index.vue b/src/views/doublePreventAction/riskLevelManage/controlAction/index.vue
index 5ab5ee9..df85034 100644
--- a/src/views/doublePreventAction/riskLevelManage/controlAction/index.vue
+++ b/src/views/doublePreventAction/riskLevelManage/controlAction/index.vue
@@ -19,6 +19,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="showRiskControlMeasureForm('','新增')" v-show="showCurrent">新增</el-button>
+            <el-button class="filter-item" style="margin-left: 10px;margin-top: 10px" type="primary" @click="exportToExcel">导出</el-button>
         </div>
         <div class="table_content">
             <el-table
@@ -152,7 +153,12 @@
     import { mapGetters } from 'vuex'
     import { computePageCount } from '@/utils'
     import { addRiskControlMeasure, deleteRiskControlMeasure, getRiskControlMeasureList, updateRiskControlMeasure } from '@/api/riskLevelManage'
-    import {getClassify, getRiskEventList} from "../../../../api/riskLevelManage";
+    import {
+        exportRiskControlMeasure,
+        exportRiskEvent,
+        getClassify,
+        getRiskEventList
+    } from "../../../../api/riskLevelManage";
     import {dictionaryAllItems} from "../../../../api/dictionary";
     export default {
         name: 'index',
@@ -391,6 +397,54 @@
                     })
                 })
             },
+
+            exportToExcel() {
+                exportRiskControlMeasure(this.listQuery.filter).then(res=>{
+                    if (res.data.code === '200') {
+                        if(res.data.result === null ||res.data.result === [] || res.data.result.length === 0){
+                            this.$message({
+                                type:'warning',
+                                message:'无数据可导出'
+                            })
+                        }
+                        else{
+                            let allData = res.data.result
+                            import('@/vendor/Export2Excel').then((excel) => {
+                                const tHeader = [
+                                    '安全风险事件名称',
+                                    '管控方式',
+                                    '管控方式描述',
+                                    '管控措施分类1',
+                                    '管控措施分类2',
+                                    '管控措施分类3',
+                                    '隐患排查内容',
+                                ]
+                                const filterVal = [
+                                    'riskEventName',
+                                    'dataSrc',
+                                    'riskMeasureDesc',
+                                    'classify1',
+                                    'classify2',
+                                    'classify3',
+                                    'troubleshootContent',
+                                ]
+                                const data = this.formatJson(filterVal, allData)
+                                excel.export_json_to_excel({
+                                    header: tHeader,
+                                    data,
+                                    filename: '安全风险管控措施数据'
+                                })
+                            })
+
+                        }
+                    }
+                })
+            },
+
+            formatJson(filterVal, jsonData) {
+                return jsonData.map(v => filterVal.map(j => v[j]))
+            },
+
             refreshHandle(){
                 this.getRiskControlMeasureData()
             },
diff --git a/src/views/doublePreventAction/riskLevelManage/event/index.vue b/src/views/doublePreventAction/riskLevelManage/event/index.vue
index 93f1019..f032f45 100644
--- a/src/views/doublePreventAction/riskLevelManage/event/index.vue
+++ b/src/views/doublePreventAction/riskLevelManage/event/index.vue
@@ -13,6 +13,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="showRiskEvent('','新增')">新增</el-button>
+            <el-button class="filter-item" style="margin-left: 10px;margin-top: 10px" type="primary" @click="exportToExcel">导出</el-button>
         </div>
         <div class="table_content">
             <el-table
@@ -89,7 +90,7 @@
     import { mapGetters } from 'vuex'
     import { computePageCount } from '@/utils'
     import { addRiskEvent, deleteRiskEvent, getRiskEventList, updateRiskEvent } from '@/api/riskLevelManage'
-    import {getAnalyseUnitList} from "../../../../api/riskLevelManage";
+    import {exportAnalyseUnit, exportRiskEvent, getAnalyseUnitList} from "../../../../api/riskLevelManage";
     export default {
         name: 'index',
         filters: {
@@ -269,6 +270,44 @@
                     })
                 })
             },
+
+            exportToExcel() {
+                exportRiskEvent(this.listQuery.filter).then(res=>{
+                    if (res.data.code === '200') {
+                        if(res.data.result === null ||res.data.result === [] || res.data.result.length === 0){
+                            this.$message({
+                                type:'warning',
+                                message:'无数据可导出'
+                            })
+                        }
+                        else{
+                            let allData = res.data.result
+                            import('@/vendor/Export2Excel').then((excel) => {
+                                const tHeader = [
+                                    '安全风险分析单元名称',
+                                    '安全风险事件名称',
+                                ]
+                                const filterVal = [
+                                    'riskUnitName',
+                                    'riskEventName',
+                                ]
+                                const data = this.formatJson(filterVal, allData)
+                                excel.export_json_to_excel({
+                                    header: tHeader,
+                                    data,
+                                    filename: '安全风险事件数据'
+                                })
+                            })
+
+                        }
+                    }
+                })
+            },
+
+            formatJson(filterVal, jsonData) {
+                return jsonData.map(v => filterVal.map(j => v[j]))
+            },
+
             refreshHandle(){
                 this.getRiskEventData()
             },

--
Gitblit v1.9.2