| | |
| | | <div class="app-container"> |
| | | <div class="filter-container"> |
| | | <div class="basic_search"> |
| | | <span>单位名称:</span> |
| | | <el-input v-model="listQuery.filter.riskUnitName" style="width:200px"> |
| | | <span>事件名称:</span> |
| | | <el-input v-model="listQuery.filter.riskEventName" style="width:200px"> |
| | | </el-input> |
| | | </div> |
| | | <div class="basic_search"> |
| | | <span>管控方式:</span> |
| | | <el-select v-model="listQuery.filter.dataSrc" clearable style="width:200px"> |
| | | <el-option |
| | | v-for="item in DataSrcList" |
| | | :key="item.id" |
| | | :value="item.text" |
| | | :label="item.text" |
| | | ></el-option> |
| | | </el-select> |
| | | </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="showImportDialog()">导入</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 |
| | |
| | | :data="riskControlMeasureData" |
| | | border |
| | | fit |
| | | ref="table" |
| | | :row-key="getRowKey" |
| | | highlight-current-row |
| | | style="width: 100%;" |
| | | > |
| | | <!-- <el-table-column type="selection" width="55"></el-table-column> --> |
| | | <el-table-column type="selection" :reserve-selection="true" width="55"></el-table-column> |
| | | <el-table-column label="安全风险事件名称" prop="riskEventId" align="center"> |
| | | <template slot-scope="scope"> |
| | | <div v-for="item in riskEventList"> |
| | | <div v-if="item.id === scope.row.riskEventId"> |
| | | {{item.riskEventName}} |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="管控方式" prop="dataSrc" align="center"> |
| | | </el-table-column> |
| | |
| | | <el-table-column label="隐患排查内容" prop="troubleshootContent" align="center"> |
| | | </el-table-column> |
| | | <el-table-column label="检查类型" prop="hazardLiablePerson" align="center"> |
| | | </el-table-column> |
| | | <el-table-column label="周期" prop="timeEffect" align="center"> |
| | | </el-table-column> |
| | | <el-table-column label="单位" prop="timeUnit" align="center"> |
| | | </el-table-column> |
| | | <el-table-column label="创建人" prop="createBy" align="center"> |
| | | </el-table-column> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="管控方式描述" prop="riskMeasureDesc"> |
| | | <el-input v-model="riskControlMeasureForm.riskMeasureDesc" class="analyseUnit_input"></el-input> |
| | | <el-input type="textarea" :rows="4" v-model="riskControlMeasureForm.riskMeasureDesc" class="analyseUnit_input"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="管控措施分类1" prop="classify1"> |
| | | <el-select v-model="riskControlMeasureForm.classify1" class="analyseUnit_input" @change="changeClassifyTwoList(val)"> |
| | | <el-select v-model="riskControlMeasureForm.classify1" class="analyseUnit_input" @change="changeClassifyTwoList()"> |
| | | <el-option |
| | | v-for="item in classifyOneList" |
| | | :key="item.id" |
| | |
| | | <el-input v-model="riskControlMeasureForm.classify3" class="analyseUnit_input"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="隐患排查内容" prop="troubleshootContent"> |
| | | <el-input v-model="riskControlMeasureForm.troubleshootContent" class="analyseUnit_input"></el-input> |
| | | <el-input type="textarea" :rows="4" v-model="riskControlMeasureForm.troubleshootContent" class="analyseUnit_input"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="周期" prop="timeEffect"> |
| | | <el-input v-model="riskControlMeasureForm.timeEffect" type="number" class="analyseUnit_input"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="单位" prop="timeUnit"> |
| | | <el-select v-model="riskControlMeasureForm.timeUnit" class="analyseUnit_input"> |
| | | <el-option |
| | | v-for="item in timeUnitList" |
| | | :key="item.id" |
| | | :value="item.name" |
| | | :label="item.name" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div align="right"> |
| | | <el-button @click="riskControlMeasureVisible = false">取消</el-button> |
| | | <el-button type="primary" @click="submitAnalyseUnit()" v-show="ifShowSelf">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <el-dialog |
| | | :visible.sync="importDialogFormVisible" |
| | | :modal-append-to-body="false" |
| | | :close-on-click-modal="false" |
| | | title="用户导入" |
| | | width="700px" |
| | | > |
| | | <el-form |
| | | ref="importForm" |
| | | label-position="right" |
| | | label-width="120px" |
| | | style="margin-left:50px;width:500px;" |
| | | element-loading-text="导入中..." |
| | | > |
| | | <el-form-item label="导入文件:"> |
| | | <input ref="importLabInput" type="file" accept=".xls, .xlsx" > |
| | | </el-form-item> |
| | | <el-form-item label="excel参考模板:"> |
| | | <el-button type="text" @click="viewHandle">下载模板</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="importDialogFormVisible = false">取消</el-button> |
| | | <el-button type="primary" @click="importToTable()">导入</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | |
| | | import { mapGetters } from 'vuex' |
| | | import { computePageCount } from '@/utils' |
| | | import { addRiskControlMeasure, deleteRiskControlMeasure, getRiskControlMeasureList, updateRiskControlMeasure } from '@/api/riskLevelManage' |
| | | import {getClassify, getRiskEventList} from "../../../../api/riskLevelManage"; |
| | | import { |
| | | exportRiskControlMeasure, |
| | | getClassify, |
| | | getRiskEventList, importAnalyseUnit, importRiskControlMeasure |
| | | } from "../../../../api/riskLevelManage"; |
| | | import {dictionaryAllItems} from "../../../../api/dictionary"; |
| | | import {parseError} from "../../../../utils/messageDialog"; |
| | | const exampleFile = require('@/assets/example/riskControlMeasure.xlsx') |
| | | export default { |
| | | name: 'index', |
| | | filters: { |
| | | parseMain(type){ |
| | | if(type === 1){ |
| | | return "是" |
| | | }else if(type === 0){ |
| | | return "否" |
| | | } |
| | | }, |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | |
| | | DataSrcList:[], |
| | | classifyOneList:[], |
| | | classifyTwoList:[], |
| | | riskCcntrolMeasureIdList:[], |
| | | riskControlMeasureIdList:[], |
| | | timeUnitList:[{id:1,name:'小时'},{id:1,name:'天'},{id:1,name:'周'},{id:1,name:'月'},], |
| | | listLoading: false, |
| | | showCurrent:true, |
| | | showOther:false, |
| | |
| | | title:'', |
| | | company:'', |
| | | code:'', |
| | | importDialogFormVisible:false, |
| | | riskControlMeasureVisible:false, |
| | | riskControlMeasureFormRules:{ |
| | | riskEventId: [{ required: true, message: '安全风险事件名称不能为空', trigger: 'change' }], |
| | |
| | | classify2: [{ required: true, message: '管控措施分类2不能为空', trigger: 'change' }], |
| | | classify3: [{ required: true, message: '管控措施分类3不能为空', trigger: 'blur' }], |
| | | troubleshootContent: [{ required: true, message: '隐患排查内容不能为空', trigger: 'change' }], |
| | | timeEffect: [{ required: true, message: '周期不能为空', trigger: 'blur' }], |
| | | timeUnit: [{ required: true, message: '单位不能为空', trigger: 'change' }], |
| | | }, |
| | | riskControlMeasureForm:{ |
| | | id: null, |
| | |
| | | createBy: "", |
| | | updateBy: "", |
| | | riskEvent: { |
| | | } |
| | | }, |
| | | timeEffect:"", |
| | | timeUnit:"", |
| | | }, |
| | | listQuery:{ |
| | | pageIndex:1, |
| | | pageSize:10, |
| | | filter:{ |
| | | riskUnitName:'', |
| | | riskEventName:'', |
| | | } |
| | | }, |
| | | } |
| | |
| | | createBy: "", |
| | | updateBy: "", |
| | | riskEvent: { |
| | | } |
| | | }, |
| | | timeEffect:"", |
| | | timeUnit:"", |
| | | } |
| | | }else{ |
| | | this.title = '修改' |
| | |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | deleteById(val){ |
| | | this.$confirm('删除此条信息,是否继续','提示',{ |
| | |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | viewHandle() { |
| | | window.open(exampleFile, '_blank') |
| | | }, |
| | | |
| | | showImportDialog(){ |
| | | this.importDialogFormVisible = true |
| | | }, |
| | | |
| | | importToTable(){ |
| | | const formData = new FormData() |
| | | const files = this.$refs['importLabInput'].files |
| | | if (files && files.length > 0) { |
| | | formData.append('file', files[0]) |
| | | } |
| | | importRiskControlMeasure(formData).then((response) => { |
| | | const res = response.data |
| | | if (res.code == 200) { |
| | | this.importDialogFormVisible = false |
| | | this.$message({ |
| | | message: '导入成功', |
| | | type: 'success' |
| | | }) |
| | | this.getRiskControlMeasureData() |
| | | } else { |
| | | parseError({ error: res.message, vm: this }) |
| | | } |
| | | }).catch((error) => { |
| | | parseError({ error: error, vm: this }) |
| | | }) |
| | | }, |
| | | |
| | | 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() |
| | | }, |
| | |
| | | this.getRiskControlMeasureData() |
| | | }, |
| | | |
| | | ifShowButton (){ |
| | | ifShowButton (value){ |
| | | this.showCurrent = false |
| | | this.showOther = true |
| | | this.listQuery.pageSize = 1000 |
| | | this.getRiskControlMeasureData() |
| | | this.$refs.table.clearSelection() |
| | | value.forEach(row => { |
| | | this.$refs.table.toggleRowSelection(this.riskControlMeasureData.find(item => { |
| | | return row.id === item.id |
| | | }) , this.riskControlMeasureData.find(item => {return row.id === item.id}) === undefined ? false :true) |
| | | }) |
| | | |
| | | }, |
| | | |
| | | handleSelectionChange(val){ |
| | | this.riskControlMeasureIdList = val |
| | | }, |
| | | |
| | | getRowKey(value){ |
| | | return value.id |
| | | }, |
| | | |
| | | giveValue(value){ |
| | | // this.$emit('giveRiskControlId',this.riskControlMeasureIdList) |
| | | this.$emit('giveRiskControlId',value) |
| | | this.$emit('giveRiskControlId',this.riskControlMeasureIdList) |
| | | // this.$emit('giveRiskControlId',value) |
| | | }, |
| | | showMeasureDetail(value){ |
| | | this.riskControlMeasureVisible = true |
| | |
| | | this.riskControlMeasureForm = riskControlMeasureForm |
| | | this.$emit('closeDialog') |
| | | }) |
| | | |
| | | |
| | | } |
| | | } |
| | | } |