feat:新增 企业风险管控一张表

wuyanfu
kongyeqing 2023-06-27 17:35:11 +08:00
parent a930cbf338
commit 6ecdc5c471
3 changed files with 291 additions and 137 deletions

View File

@ -6,11 +6,16 @@ export default class MeasuresReportService extends BaseService<any>{
super() super()
} }
public selectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{ public selectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.system+'/user/list'; const url = this.prefix.prevention+'/risk/control/list';
return this.get(url,params,true) return this.get(url,params,true)
} }
public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{ public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.system+'/user/list'; const url = this.prefix.prevention+'/risk/control';
return this.deleteBatch(url,params,{},true) return this.deleteBatch(url,params,{},true)
} }
public selectById(params):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/risk/task/list';
return this.get(url,params,true)
}
} }

View File

@ -1,7 +1,6 @@
<div class="common-box dis-flex " > <div class="common-box dis-flex ">
<div class="common-tree-box" v-if="treeData"> <div class="common-tree-box">
<el-tree :data="treeData" :expand-on-click-node="false" default-expand-all highlight-current @node-click="handleNodeClick"> <UnitTreeComponent @callback="handleNodeClick"></UnitTreeComponent>
</el-tree>
</div> </div>
<div class="common-content-box dis-flex flex-col flex-1"> <div class="common-content-box dis-flex flex-col flex-1">
<div class="search-box"> <div class="search-box">
@ -10,9 +9,9 @@
</div> </div>
<div class="table-box flex-1"> <div class="table-box flex-1">
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)" <TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"
@actionCallback="callback($event)" @pageNumberChange="callback($event)" @pageSizeChange="callback($event)" @actionCallback="callback($event)" @pageNumberChange="callback($event)"
:footerActions="footerActions" :actions="tableActions"> @pageSizeChange="callback($event)" :footerActions="footerActions" :actions="tableActions">
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked" <el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked"
@selection-change="handleSelectionChange" style="width: 100%"> @selection-change="handleSelectionChange" style="width: 100%">
<el-table-column type="selection" label="全选" width="60"> <el-table-column type="selection" label="全选" width="60">
@ -27,17 +26,32 @@
<el-table-column label="操作" width="160"> <el-table-column label="操作" width="160">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="deleteData([scope.row])">删除</el-button> <el-button type="text" @click="deleteData([scope.row])">删除</el-button>
<el-button type="text" @click="deleteData([scope.row])">查看执行纪律</el-button> <el-button type="text" @click="showSubModal(scope.row.id)">查看执行纪律</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</TableComponent> </TableComponent>
</div> </div>
</div> </div>
<el-dialog :close-on-click-modal="false" :title="currentId>0?'详情':currentId===-1?'新增':'编辑'" :visible.sync="showUpdate" width="952px" <!-- 查看执行记录 -->
:before-close="handleClose"> <el-dialog :close-on-click-modal="false" :show-close="false" :visible.sync="showProtable" width="940px">
<FormComponent :options="updateOptions" :isReadonly="true" labelWidth="110px" labelAlign="right" :data.sync="updateParams"></FormComponent> <TableComponent :tableData="currentProTableData" :tableColumn="proTableColumn" :showFooter="false"
style="margin-bottom: 20px;">
<el-table ref="multipleTable" :data="currentProTableData.datas" tooltip-effect="dark" height="250" border
style="width: 100%">
<template v-for="item in proTableColumn">
<el-table-column v-if="item.render" :label="item.name" :width="item.width" :key="item.key">
<div slot-scope="scope" v-html="item.render(scope.row)" @click="showPros($event,scope.row)">
</div>
</el-table-column>
<el-table-column v-else :prop="item.key" :label="item.name" :width="item.width" :key="item.key">
</el-table-column>
</template>
</el-table>
</TableComponent>
<ButtonListComponent :actions="subActions" @callback="subCallback" btn-position="center" :full-btn="true">
</ButtonListComponent>
</el-dialog> </el-dialog>
</div> </div>

View File

@ -9,172 +9,268 @@ import MeasureReportService from "@/service/measuresReport.service"
import FormOption from "hbt-common/models/formOptions" import FormOption from "hbt-common/models/formOptions"
import BtnOption from "hbt-common/models/btnOptions" import BtnOption from "hbt-common/models/btnOptions"
import DrawComponent from '@/components/draw.component.vue'; 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({ @Component({
template, template,
components:{ components: {
FormComponent, FormComponent,
TableComponent, TableComponent,
DrawComponent, DrawComponent,
ButtonListComponent,
UnitTreeComponent,
}, },
}) })
export default class MeasuresReportManagerComponent extends BaseRecordComponent<any> { export default class MeasuresReportManagerComponent extends BaseRecordComponent<any> {
public tableService = new MeasureReportService(); public tableService = new MeasureReportService();
public unitService = new UnitService();
public areaService = new AreaService();
public params = {} as any; public params = {} as any;
public treeData = [{ public treeData = [];
label: '一级 1',
children: [{ public areaList = {} as any;
label: '二级 1-1', public unitList = {} as any;
children: [{
label: '三级 1-1-1' //
}] public measuresSelectData = {} as any;
}]
}, { //
label: '一级 2', public tasksSelectData = {} as any;
children: [{
label: '二级 2-1', public proTableColumn = [] as any;
children: [{
label: '三级 2-1-1' public showProtable = false;
}]
}, { public currentProTableData = { datas: [] } as any;
label: '二级 2-2',
children: [{ public subActions = [{
label: '三级 2-2-1' name: "取消",
}] value: "cancel"
}] }];
}, {
label: '一级 3',
children: [{
label: '二级 3-1',
children: [{
label: '三级 3-1-1'
}]
}, {
label: '二级 3-2',
children: [{
label: '三级 3-2-1'
}]
}]
}]
public formActions = [{ public formActions = [{
name:"查询", name: "查询",
value:"search", value: "search",
icon:"el-icon-search", icon: "el-icon-search",
type:"primary" type: "primary"
},{ }, {
name:"清空", name: "清空",
icon:"el-icon-tickets", icon: "el-icon-tickets",
value:"reset" value: "reset"
}]; }];
public tableActions = [{ public tableActions = [{
name:"批量删除", name: "批量删除",
value:"delete", value: "delete",
plain:true, plain: true,
icon:"el-icon-delete", icon: "el-icon-delete",
type:"danger" type: "danger"
},{ }, {
name:"发布/终止", name: "发布/终止",
value:"doUpdate", value: "doUpdate",
type:"primary" type: "primary"
}]; }];
public footerActions = [{ public footerActions = [{
name:"选择全部", name: "选择全部",
value:"selectAll", value: "selectAll",
type:"primary" type: "primary"
},{ }, {
name:"反向选择", name: "反向选择",
value:"reverse" value: "reverse"
}]; }];
public formOptions:FormOption<BtnOption>[] = [{ public formOptions: FormOption<BtnOption>[] = [{
name:"区域名称", name: "管控对象",
key:"areaId", key: "controlName",
type:"text", type: "text",
},{ }, {
name:"单元名称", name: "分析对象",
key:"unitId", key: "analName",
type:"text", type: "text",
}]; }];
public showUpdate = false; public showUpdate = false;
public updateParams = {} as any; public updateParams = {} as any;
public selectData = []; 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){ public handleNodeClick(data) {
console.log(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(){ public buildTable() {
this.tableColumn.push({name:'序号',key:"index"}); this.tableColumn.push({
this.tableColumn.push({name:'状态',key:"status",render:(data)=>{ name: '状态', key: "status", render: (data) => {
if(data.status==0){ if (data.status == 1) {
return "<span class='noDraw'>未绘制</span>" return "<span class='noDraw'>未发布</span>"
}else{ } else {
return "<span>已绘制</span>" return "<span>已发布</span>"
}
} }
}}); });
this.tableColumn.push({name:'区域名称',key:"deptName",width:"200px"}); this.tableColumn.push({
this.tableColumn.push({name:'单元名称',key:"deptName",width:"200px"}); name: '区域名称', key: "areaName", width: "200px",
this.tableColumn.push({name:'管控对象',key:"deptName",width:"200px"}); });
this.tableColumn.push({name:'分析对象',key:"deptName",width:"200px"}); this.tableColumn.push({
this.tableColumn.push({name:'风险源',key:"person",width:"200px"}); name: '单元名称', key: "unitName", width: "200px",
this.tableColumn.push({name:'事故后果',key:"person",width:"250px"}); });
this.tableColumn.push({name:'风险等级',key:"status",render:(data)=>{ this.tableColumn.push({ name: '管控对象', key: "analControlName", width: "200px" });
if(data.status==0){ this.tableColumn.push({ name: '分析对象', key: "itemName", width: "200px" });
return "<span class='noDraw'>未绘制</span>" this.tableColumn.push({ name: '风险源', key: "itemRiskSource", width: "200px" });
}else{ this.tableColumn.push({
return "<span>已绘制</span>" 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({
this.tableColumn.push({name:'管控措施分类',key:"person"}); name: '风险等级', key: "itemRiskLevel", render: (data) => {
this.tableColumn.push({name:'管控措施分类',key:"person"}); return "<span class='color_" + data.itemRiskLevel + "'>" + (data.itemRiskLevel ? (this.$store.getters.prevention_risk_level_map[data.itemRiskLevel]) : '') + "</span>"
this.tableColumn.push({name:'管控措施',key:"person"}); }
this.tableColumn.push({name:'隐患排查任务',key:"person"}); });
this.tableColumn.push({name:'隐患责任人',key:"person"}); this.tableColumn.push({
this.tableColumn.push({name:'岗位',key:"person"}); name: '管控措施分类', key: "measureFirstType", width: "200px", render: (data) => {
this.tableColumn.push({name:'排查周期',key:"person"}); if (data.measureFirstType) {
this.tableColumn.push({name:'单位',key:"person"}); 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() this.getTableData()
// //
}else if(data.value === "reset"){ } else if (data.value === "reset") {
this.reset() this.reset()
// //
}else if(data.value === "reverse"){ } else if (data.value === "reverse") {
this.toggleAll() this.toggleAll()
// //
}else if(data.value === "selectAll"){ } else if (data.value === "selectAll") {
this.selectAll() this.selectAll()
}else if(data.value === "delete"){ } else if (data.value === "delete") {
this.deleteData(this.selectData.map((item:any)=>item.id)) this.deleteData(this.selectData.map((item: any) => item.id))
} }
} }
// //
public reset(){ public reset() {
this.params = { this.params = {
pageNum:1, pageNum: 1,
pageSize:20, pageSize: 20,
} as any; } as any;
} }
// //
public showUpdateModel(id){ public showUpdateModel(id) {
this.showUpdate = true this.showUpdate = true
} }
public handleClose(){ public handleClose() {
this.showUpdate = false; this.showUpdate = false;
} }
@ -182,22 +278,61 @@ export default class MeasuresReportManagerComponent extends BaseRecordComponent<
public toggleAll() { public toggleAll() {
(this.$refs.multipleTable as any).toggleAllSelection(); (this.$refs.multipleTable as any).toggleAllSelection();
} }
public selectAll(){ public selectAll() {
if(!this.selectData.length){ if (!this.selectData.length) {
this.toggleAll() this.toggleAll()
}else{ } else {
this.tableData.datas.forEach((item,index)=>{ this.tableData.datas.forEach((item, index) => {
const find = this.selectData.find((data:any)=>data.userId === item.userId); const find = this.selectData.find((data: any) => data.userId === item.userId);
if(!find){ if (!find) {
(this.$refs.multipleTable as any).toggleRowSelection(item); (this.$refs.multipleTable as any).toggleRowSelection(item);
} }
}) })
} }
} }
public handleSelectionChange(data){ public handleSelectionChange(data) {
this.selectData = 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
}
} }
</script> </script>
<style lang="scss" scoped src="../../common.component.scss"></style> <style lang="scss" scoped src="../../common.component.scss"></style>