diff --git a/src/service/measuresReport.service.ts b/src/service/measuresReport.service.ts index 0d34447..fd04635 100644 --- a/src/service/measuresReport.service.ts +++ b/src/service/measuresReport.service.ts @@ -6,11 +6,16 @@ export default class MeasuresReportService extends BaseService{ super() } public selectByPage(params: any):Promise>>{ - const url = this.prefix.system+'/user/list'; + const url = this.prefix.prevention+'/risk/control/list'; return this.get(url,params,true) } public deleteByIds(params):Promise>>{ - const url = this.prefix.system+'/user/list'; + const url = this.prefix.prevention+'/risk/control'; return this.deleteBatch(url,params,{},true) } + + public selectById(params):Promise>>{ + const url = this.prefix.prevention+'/risk/task/list'; + return this.get(url,params,true) + } } \ No newline at end of file diff --git a/src/views/risk/measuresReport/measuresReport.component.html b/src/views/risk/measuresReport/measuresReport.component.html index 4b0cb2b..cde2c28 100644 --- a/src/views/risk/measuresReport/measuresReport.component.html +++ b/src/views/risk/measuresReport/measuresReport.component.html @@ -1,7 +1,6 @@ -
-
- - +
+
+
- + @actionCallback="callback($event)" @pageNumberChange="callback($event)" + @pageSizeChange="callback($event)" :footerActions="footerActions" :actions="tableActions"> + @@ -27,17 +26,32 @@ - +
- - + + + + + + + + +
\ No newline at end of file diff --git a/src/views/risk/measuresReport/measuresReport.component.vue b/src/views/risk/measuresReport/measuresReport.component.vue index 632d1e2..ab9b35f 100644 --- a/src/views/risk/measuresReport/measuresReport.component.vue +++ b/src/views/risk/measuresReport/measuresReport.component.vue @@ -9,172 +9,268 @@ import MeasureReportService from "@/service/measuresReport.service" import FormOption from "hbt-common/models/formOptions" import BtnOption from "hbt-common/models/btnOptions" import DrawComponent from '@/components/draw.component.vue'; +import UnitService from '@/service/unit.service'; +import AreaService from '@/service/area.service'; +import ButtonListComponent from "hbt-common/components/common/buttonList.component.vue"; +import UnitTreeComponent from '@/components/tree.component.vue'; + @Component({ template, - components:{ + components: { FormComponent, TableComponent, DrawComponent, + ButtonListComponent, + UnitTreeComponent, }, }) + export default class MeasuresReportManagerComponent extends BaseRecordComponent { public tableService = new MeasureReportService(); + public unitService = new UnitService(); + public areaService = new AreaService(); public params = {} as any; - public treeData = [{ - label: '一级 1', - children: [{ - label: '二级 1-1', - children: [{ - label: '三级 1-1-1' - }] - }] - }, { - label: '一级 2', - children: [{ - label: '二级 2-1', - children: [{ - label: '三级 2-1-1' - }] - }, { - label: '二级 2-2', - children: [{ - label: '三级 2-2-1' - }] - }] - }, { - label: '一级 3', - children: [{ - label: '二级 3-1', - children: [{ - label: '三级 3-1-1' - }] - }, { - label: '二级 3-2', - children: [{ - label: '三级 3-2-1' - }] - }] - }] + public treeData = []; + + public areaList = {} as any; + public unitList = {} as any; + + //管控措施 + public measuresSelectData = {} as any; + + //排查任务 + public tasksSelectData = {} as any; + + public proTableColumn = [] as any; + + public showProtable = false; + + public currentProTableData = { datas: [] } as any; + + public subActions = [{ + name: "取消", + value: "cancel" + }]; public formActions = [{ - name:"查询", - value:"search", - icon:"el-icon-search", - type:"primary" - },{ - name:"清空", - icon:"el-icon-tickets", - value:"reset" + name: "查询", + value: "search", + icon: "el-icon-search", + type: "primary" + }, { + name: "清空", + icon: "el-icon-tickets", + value: "reset" }]; public tableActions = [{ - name:"批量删除", - value:"delete", - plain:true, - icon:"el-icon-delete", - type:"danger" - },{ - name:"发布/终止", - value:"doUpdate", - type:"primary" + name: "批量删除", + value: "delete", + plain: true, + icon: "el-icon-delete", + type: "danger" + }, { + name: "发布/终止", + value: "doUpdate", + type: "primary" }]; public footerActions = [{ - name:"选择全部", - value:"selectAll", - type:"primary" - },{ - name:"反向选择", - value:"reverse" + name: "选择全部", + value: "selectAll", + type: "primary" + }, { + name: "反向选择", + value: "reverse" }]; - public formOptions:FormOption[] = [{ - name:"区域名称", - key:"areaId", - type:"text", - },{ - name:"单元名称", - key:"unitId", - type:"text", + public formOptions: FormOption[] = [{ + name: "管控对象", + key: "controlName", + type: "text", + }, { + name: "分析对象", + key: "analName", + type: "text", }]; public showUpdate = false; - public updateParams = {} as any; + public updateParams = {} as any; public selectData = []; - created(){ - + created() { + this.$store.state.prevention_measures_sort.map((item) => { + this.measuresSelectData[item.value] = this.treeSelectData(item.children) + }) + this.$store.state.prevention_task_type.map((item) => { + this.tasksSelectData[item.value] = this.treeSelectData(item.children) + }) } // 树点击 - public handleNodeClick(data){ - console.log(data) + public handleNodeClick(data) { + this.params.unitId = ""; + this.params.areaId = ""; + if (data.areaId) { + this.params.unitId = data.id + } else { + this.params.areaId = data.id + } + this.getTableData() } - public buildTable(){ - this.tableColumn.push({name:'序号',key:"index"}); - this.tableColumn.push({name:'状态',key:"status",render:(data)=>{ - if(data.status==0){ - return "未绘制" - }else{ - return "已绘制" + public buildTable() { + this.tableColumn.push({ + name: '状态', key: "status", render: (data) => { + if (data.status == 1) { + return "未发布" + } else { + return "已发布" + } } - }}); - this.tableColumn.push({name:'区域名称',key:"deptName",width:"200px"}); - this.tableColumn.push({name:'单元名称',key:"deptName",width:"200px"}); - this.tableColumn.push({name:'管控对象',key:"deptName",width:"200px"}); - this.tableColumn.push({name:'分析对象',key:"deptName",width:"200px"}); - this.tableColumn.push({name:'风险源',key:"person",width:"200px"}); - this.tableColumn.push({name:'事故后果',key:"person",width:"250px"}); - this.tableColumn.push({name:'风险等级',key:"status",render:(data)=>{ - if(data.status==0){ - return "未绘制" - }else{ - return "已绘制" + }); + this.tableColumn.push({ + name: '区域名称', key: "areaName", width: "200px", + }); + this.tableColumn.push({ + name: '单元名称', key: "unitName", width: "200px", + }); + this.tableColumn.push({ name: '管控对象', key: "analControlName", width: "200px" }); + this.tableColumn.push({ name: '分析对象', key: "itemName", width: "200px" }); + this.tableColumn.push({ name: '风险源', key: "itemRiskSource", width: "200px" }); + this.tableColumn.push({ + name: '事故后果', key: "itemSeriousResult", width: "250px", + render: (data) => { + if (data.itemSeriousResult) { + return data.itemSeriousResult.split(";").map(item => this.$store.getters.prevention_serious_result_map[item]).join(";") + } } - }}); - this.tableColumn.push({name:'管控措施分类',key:"person"}); - this.tableColumn.push({name:'管控措施分类',key:"person"}); - this.tableColumn.push({name:'管控措施分类',key:"person"}); - this.tableColumn.push({name:'管控措施',key:"person"}); - this.tableColumn.push({name:'隐患排查任务',key:"person"}); - this.tableColumn.push({name:'隐患责任人',key:"person"}); - this.tableColumn.push({name:'岗位',key:"person"}); - this.tableColumn.push({name:'排查周期',key:"person"}); - this.tableColumn.push({name:'单位',key:"person"}); + }); + this.tableColumn.push({ + name: '风险等级', key: "itemRiskLevel", render: (data) => { + return "" + (data.itemRiskLevel ? (this.$store.getters.prevention_risk_level_map[data.itemRiskLevel]) : '') + "" + } + }); + this.tableColumn.push({ + name: '管控措施分类', key: "measureFirstType", width: "200px", render: (data) => { + if (data.measureFirstType) { + return this.$store.getters.prevention_measures_sort_map[data.measureFirstType] + } + } + }); + this.tableColumn.push({ + name: '管控措施分类', key: "measureSecondType", + render: (data) => { + if (data.measureFirstType) { + const secondTypeItem = this.measuresSelectData[data.measureFirstType] + return this.selectName(secondTypeItem, data.measureSecondType) + } + } + }); + this.tableColumn.push({ name: '管控措施分类', key: "measureThirdType" }); + this.tableColumn.push({ name: '管控措施', key: "measureDescription" }); + + this.tableColumn.push({ + name: '是否包保责任人任务', key: "insuranceDutyFlag", render: (data) => { + if (data.taskItem) { + return '是' + } else { + return '否' + } + } + }); + this.tableColumn.push({ + name: '任务类型', key: "taskType", render: (data) => { + if (data.taskType || data.taskType === 0) { + return this.$store.getters.prevention_task_type_map[data.taskType] + } + } + }); + this.tableColumn.push({ + name: '包保任务对应项', key: "taskItem", width: "200px", render: (data) => { + if (data.taskItem) { + if (!this.tasksSelectData[data.taskType] || this.tasksSelectData[data.taskType].length === 0) { + this.$store.state.prevention_task_type.map((item) => { + this.tasksSelectData[item.value] = this.treeSelectData(item.children) + }) + } + const taskItemName = {} as any; + this.tasksSelectData[data.taskType].map((item) => { + taskItemName[item.id] = item.label + }) + return taskItemName[data.taskItem] + } + } + }); + this.tableColumn.push({ name: '隐患排查任务', key: "taskName", width: "150px" }); + this.tableColumn.push({ name: '隐患责任人', key: "taskChargeUserName" }); + this.tableColumn.push({ name: '岗位', key: "taskExecutePostName" }); + this.tableColumn.push({ name: '排查周期', key: "taskReviewCycleValue" }); + this.tableColumn.push({ + name: '单位', key: "taskReviewCycleUnit", render: (data) => { + return this.$store.getters.prevention_cycle_unit_map[data.taskReviewCycleUnit] + } + }); + + //查看执行记录 + this.proTableColumn.push({ name: '序号', key: "index" }); + this.proTableColumn.push({ name: '排查时间', key: "taskChargeUserName" }); + this.proTableColumn.push({ name: '排查人', key: "taskChargeUserName" }); + this.proTableColumn.push({ name: '排查内容', key: "taskChargeUserName" }); + this.proTableColumn.push({ name: '排查结果', key: "taskChargeUserName" }); + this.proTableColumn.push({ name: '是否为隐患', key: "taskChargeUserName" }); + this.proTableColumn.push({ name: '隐患描述', key: "taskChargeUserName" }); + this.proTableColumn.push({ name: '隐患归属人', key: "taskChargeUserName" }); } - public callback(data){ + // 加载区域列表 + public loadAreaData() { + this.areaService.selectByPage({ pageSize: 1000 }).then((res: any) => { + res.data.datas.map(item => { + this.areaList[item.id] = item.name + }) + }) + } + // 加载单元列表 + public loadUnitData() { + this.unitService.selectByPage({ pageSize: 1000 }, false).then((res: any) => { + res.data.datas.map(item => { + this.unitList[item.id] = item.name + }) + }) + } + + public callback(data) { // 查询 - if(data.value==="search"){ + if (data.value === "search") { this.getTableData() - // 重置 - }else if(data.value === "reset"){ + // 重置 + } else if (data.value === "reset") { this.reset() - // 反选 - }else if(data.value === "reverse"){ + // 反选 + } else if (data.value === "reverse") { this.toggleAll() - // 全选 - }else if(data.value === "selectAll"){ + // 全选 + } else if (data.value === "selectAll") { this.selectAll() - }else if(data.value === "delete"){ - this.deleteData(this.selectData.map((item:any)=>item.id)) + } else if (data.value === "delete") { + this.deleteData(this.selectData.map((item: any) => item.id)) } } // 重置数据 - public reset(){ + public reset() { this.params = { - pageNum:1, - pageSize:20, + pageNum: 1, + pageSize: 20, } as any; } // 删除数据 - public showUpdateModel(id){ + public showUpdateModel(id) { this.showUpdate = true } - public handleClose(){ + public handleClose() { this.showUpdate = false; } @@ -182,22 +278,61 @@ export default class MeasuresReportManagerComponent extends BaseRecordComponent< public toggleAll() { (this.$refs.multipleTable as any).toggleAllSelection(); } - public selectAll(){ - if(!this.selectData.length){ + public selectAll() { + if (!this.selectData.length) { this.toggleAll() - }else{ - this.tableData.datas.forEach((item,index)=>{ - const find = this.selectData.find((data:any)=>data.userId === item.userId); - if(!find){ + } else { + this.tableData.datas.forEach((item, index) => { + const find = this.selectData.find((data: any) => data.userId === item.userId); + if (!find) { (this.$refs.multipleTable as any).toggleRowSelection(item); } }) } } - public handleSelectionChange(data){ + public handleSelectionChange(data) { this.selectData = data; } + + public treeSelectData(data) { + return data.map((item) => { + return { + label: item.dictLabel, + id: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue, + } + }) + + } + + public selectName(selectGroup, data) { + if (selectGroup && selectGroup.length > 0) { + const map = {}; + selectGroup.forEach((item: any) => { + if (item.value) { + map[item.value] = item.name + } else if (item.id) { + map[item.id] = item.label + } + + }) + return map[data] + } + } + + //查看执行记录 + public showSubModal(id) { + this.showProtable = true + this.tableService.selectById({ controlId: id }).then((res: any) => { + this.currentProTableData.datas = res.data.datas + }) + } + + //执行记录--关闭 + public subCallback() { + this.showProtable = false + } + }