| | |
| | | <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="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-button type="primary" @click="submitAnalyseUnit()">确认</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> |
| | | <department-chart ref="chart"></department-chart> |
| | | |
| | | </div> |
| | |
| | | import { addAnalyseUnit, deleteAnalyseUnit, getAnalyseUnitList, updateAnalyseUnit } from '@/api/riskLevelManage' |
| | | import {getAllDepartment, getDepartmentList} from "../../../../api/departmentManage"; |
| | | import {safetyInspectionItemName} from "../../../../api/safetySelfInspection"; |
| | | import {exportAnalyseUnit, getDepartmentChart} from "../../../../api/riskLevelManage"; |
| | | import {exportAnalyseUnit, getDepartmentChart, importAnalyseUnit} from "../../../../api/riskLevelManage"; |
| | | import {parseError} from "../../../../utils/messageDialog"; |
| | | const exampleFile = require('@/assets/example/riskAnaUnit.xlsx') |
| | | export default { |
| | | name: 'index', |
| | | filters: { |
| | |
| | | title:'', |
| | | company:'', |
| | | code:'', |
| | | importDialogFormVisible:false, |
| | | analyseUnitVisible:false, |
| | | analyseUnitFormRules:{ |
| | | hazardDep: [{ required: true, message: '责任部门不能为空', trigger: 'change' }], |
| | |
| | | }) |
| | | }, |
| | | |
| | | 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]) |
| | | } |
| | | importAnalyseUnit(formData).then((response) => { |
| | | const res = response.data |
| | | if (res.code == 200) { |
| | | this.importDialogFormVisible = false |
| | | this.$message({ |
| | | message: '导入成功', |
| | | type: 'success' |
| | | }) |
| | | this.getAnalyseUnitData() |
| | | } else { |
| | | parseError({ error: res.message, vm: this }) |
| | | } |
| | | }).catch((error) => { |
| | | parseError({ error: error, vm: this }) |
| | | }) |
| | | }, |
| | | |
| | | exportToExcel() { |
| | | exportAnalyseUnit(this.listQuery.filter).then(res=>{ |
| | | if (res.data.code === '200') { |