From 4e27705d66a69199b336c7f7f608f06dbd1d81fa Mon Sep 17 00:00:00 2001
From: Your Name <123456>
Date: Tue, 07 Jun 2022 15:47:46 +0800
Subject: [PATCH] 'lct'
---
src/views/doublePreventAction/riskLevelManage/analyseUnit/index.vue | 73 +++++++++++++++++++++++++++---------
1 files changed, 54 insertions(+), 19 deletions(-)
diff --git a/src/views/doublePreventAction/riskLevelManage/analyseUnit/index.vue b/src/views/doublePreventAction/riskLevelManage/analyseUnit/index.vue
index b5ec3a3..476cf45 100644
--- a/src/views/doublePreventAction/riskLevelManage/analyseUnit/index.vue
+++ b/src/views/doublePreventAction/riskLevelManage/analyseUnit/index.vue
@@ -30,6 +30,8 @@
</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>
+ <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
@@ -82,23 +84,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" >
@@ -118,7 +111,7 @@
</el-form-item>
</el-form>
<div align="right">
- <el-button @click="unitFormVisible = false">取消</el-button>
+ <el-button @click="analyseUnitVisible = false">取消</el-button>
<el-button type="primary" @click="submitAnalyseUnit()">确认</el-button>
</div>
</el-dialog>
@@ -134,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: {
@@ -340,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
--
Gitblit v1.9.2