forked from xxhjsb/hbt-prevention-ui
feat:新增 企业风险管控一张表
parent
a930cbf338
commit
6ecdc5c471
|
@ -6,11 +6,16 @@ export default class MeasuresReportService extends BaseService<any>{
|
|||
super()
|
||||
}
|
||||
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)
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
public selectById(params):Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/risk/task/list';
|
||||
return this.get(url,params,true)
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
<div class="common-box dis-flex " >
|
||||
<div class="common-tree-box" v-if="treeData">
|
||||
<el-tree :data="treeData" :expand-on-click-node="false" default-expand-all highlight-current @node-click="handleNodeClick">
|
||||
</el-tree>
|
||||
<div class="common-box dis-flex ">
|
||||
<div class="common-tree-box">
|
||||
<UnitTreeComponent @callback="handleNodeClick"></UnitTreeComponent>
|
||||
</div>
|
||||
<div class="common-content-box dis-flex flex-col flex-1">
|
||||
<div class="search-box">
|
||||
|
@ -10,8 +9,8 @@
|
|||
</div>
|
||||
<div class="table-box flex-1">
|
||||
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"
|
||||
@actionCallback="callback($event)" @pageNumberChange="callback($event)" @pageSizeChange="callback($event)"
|
||||
:footerActions="footerActions" :actions="tableActions">
|
||||
@actionCallback="callback($event)" @pageNumberChange="callback($event)"
|
||||
@pageSizeChange="callback($event)" :footerActions="footerActions" :actions="tableActions">
|
||||
|
||||
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked"
|
||||
@selection-change="handleSelectionChange" style="width: 100%">
|
||||
|
@ -27,7 +26,7 @@
|
|||
<el-table-column label="操作" width="160">
|
||||
<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="showSubModal(scope.row.id)">查看执行纪律</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -36,8 +35,23 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog :close-on-click-modal="false" :title="currentId>0?'详情':currentId===-1?'新增':'编辑'" :visible.sync="showUpdate" width="952px"
|
||||
:before-close="handleClose">
|
||||
<FormComponent :options="updateOptions" :isReadonly="true" labelWidth="110px" labelAlign="right" :data.sync="updateParams"></FormComponent>
|
||||
<!-- 查看执行记录 -->
|
||||
<el-dialog :close-on-click-modal="false" :show-close="false" :visible.sync="showProtable" width="940px">
|
||||
<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>
|
||||
</div>
|
|
@ -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<any> {
|
||||
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<BtnOption>[] = [{
|
||||
name:"区域名称",
|
||||
key:"areaId",
|
||||
type:"text",
|
||||
},{
|
||||
name:"单元名称",
|
||||
key:"unitId",
|
||||
type:"text",
|
||||
public formOptions: FormOption<BtnOption>[] = [{
|
||||
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 "<span class='noDraw'>未绘制</span>"
|
||||
}else{
|
||||
return "<span>已绘制</span>"
|
||||
public buildTable() {
|
||||
this.tableColumn.push({
|
||||
name: '状态', key: "status", render: (data) => {
|
||||
if (data.status == 1) {
|
||||
return "<span class='noDraw'>未发布</span>"
|
||||
} else {
|
||||
return "<span>已发布</span>"
|
||||
}
|
||||
}
|
||||
}});
|
||||
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 "<span class='noDraw'>未绘制</span>"
|
||||
}else{
|
||||
return "<span>已绘制</span>"
|
||||
});
|
||||
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 "<span class='color_" + data.itemRiskLevel + "'>" + (data.itemRiskLevel ? (this.$store.getters.prevention_risk_level_map[data.itemRiskLevel]) : '') + "</span>"
|
||||
}
|
||||
});
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped src="../../common.component.scss"></style>
|
||||
|
|
Loading…
Reference in New Issue