forked from xxhjsb/hbt-prevention-ui
feat:新增检查表
parent
6cb7a20083
commit
12d1d4aad2
|
@ -0,0 +1,33 @@
|
|||
import BaseService from "hbt-common/service/base.service"
|
||||
import type { AxiosResponse } from 'axios'
|
||||
import { ActionResult } from "hbt-common/models/actionResult";
|
||||
export default class RuleService extends BaseService<any>{
|
||||
constructor(){
|
||||
super()
|
||||
}
|
||||
// 查询列表
|
||||
public selectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/danger/standard/list';
|
||||
return this.get(url,params,true)
|
||||
}
|
||||
// 批量删除
|
||||
public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/danger/standard';
|
||||
return this.deleteBatch(url,params,{},true)
|
||||
}
|
||||
|
||||
public getNumber():Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/danger/standard/number';
|
||||
return this.get(url,null)
|
||||
}
|
||||
|
||||
// 新增或更新
|
||||
public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/danger/standard';
|
||||
if(add){
|
||||
return this.post(url,params,{},showLoading)
|
||||
}else{
|
||||
return this.put(url,params,{},showLoading)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
import BaseService from "hbt-common/service/base.service"
|
||||
import type { AxiosResponse } from 'axios'
|
||||
import { ActionResult } from "hbt-common/models/actionResult";
|
||||
export default class TableService extends BaseService<any>{
|
||||
constructor(){
|
||||
super()
|
||||
}
|
||||
// 查询列表
|
||||
public selectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/danger/table/list';
|
||||
return this.get(url,params,true)
|
||||
}
|
||||
// 批量删除
|
||||
public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/danger/table';
|
||||
return this.deleteBatch(url,params,{},true)
|
||||
}
|
||||
public selectById(id:any,showLoading?:boolean):Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/danger/table/'+id;
|
||||
return this.get(url,null,showLoading)
|
||||
}
|
||||
|
||||
public getNumber():Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/danger/table/number';
|
||||
return this.get(url,null)
|
||||
}
|
||||
|
||||
// 新增或更新
|
||||
public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/danger/table';
|
||||
if(add){
|
||||
return this.post(url,params,{},showLoading)
|
||||
}else{
|
||||
return this.put(url,params,{},showLoading)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,6 +9,11 @@ export default class UnitService extends BaseService<any>{
|
|||
const url = this.prefix.prevention+'/risk/unit/list';
|
||||
return this.get(url,params,showLoading)
|
||||
}
|
||||
|
||||
public getListByIds(params: any,showLoading?):Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/risk/unit/list/byareas';
|
||||
return this.get(url,params,showLoading)
|
||||
}
|
||||
public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/risk/unit';
|
||||
return this.deleteBatch(url,params,{},true)
|
||||
|
|
|
@ -17,10 +17,12 @@ export default class WorkService extends BaseService<any>{
|
|||
|
||||
// 新增或更新
|
||||
public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/job/inventory';
|
||||
|
||||
if(add){
|
||||
const url = this.prefix.prevention+'/job/inventory/add';
|
||||
return this.post(url,params,{},showLoading)
|
||||
}else{
|
||||
const url = this.prefix.prevention+'/job/inventory/update';
|
||||
return this.put(url,params,{},showLoading)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ export default new Vuex.Store({
|
|||
prevention_dangrous_level:[],
|
||||
prevention_risk_level:[],
|
||||
prevention_safe_reason:[],
|
||||
prevention_dangrous_type:[],
|
||||
},
|
||||
getters: {
|
||||
dept_map:(state)=>{
|
||||
|
@ -63,6 +64,13 @@ export default new Vuex.Store({
|
|||
map[item.value] = item.name
|
||||
})
|
||||
return map
|
||||
},
|
||||
prevention_dangrous_type_map:(state)=>{
|
||||
const map = {};
|
||||
state.prevention_dangrous_type.forEach((item:any)=>{
|
||||
map[item.value] = item.name
|
||||
})
|
||||
return map
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
|
@ -91,6 +99,9 @@ export default new Vuex.Store({
|
|||
},
|
||||
set_prevention_safe_reason(state,data){
|
||||
state.prevention_safe_reason = data;
|
||||
},
|
||||
set_prevention_dangrous_type(state,data){
|
||||
state.prevention_dangrous_type = data;
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
|
|
@ -21,7 +21,8 @@ export default class BlankComponent extends Vue {
|
|||
this.systemService.getDictData("common_yes_no"),
|
||||
this.systemService.getDictData("prevention_dangrous_level"),
|
||||
this.systemService.getDictData("prevention_risk_level"),
|
||||
this.systemService.getDictData("prevention_safe_reason")
|
||||
this.systemService.getDictData("prevention_safe_reason"),
|
||||
this.systemService.getDictData("prevention_dangrous_type")
|
||||
]).then(((results:any)=>{
|
||||
this.$store.commit("setDeptTreeList",results[0].data);
|
||||
this.$store.commit("setUserList",results[2].data.datas.map((item)=>{
|
||||
|
@ -64,6 +65,12 @@ export default class BlankComponent extends Vue {
|
|||
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue
|
||||
}
|
||||
}))
|
||||
this.$store.commit("set_prevention_dangrous_type",results[8].data.map(item=>{
|
||||
return {
|
||||
name:item.dictLabel,
|
||||
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue
|
||||
}
|
||||
}))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,29 +2,34 @@
|
|||
<div class="common-content-box dis-flex flex-col flex-1">
|
||||
<div class="search-box">
|
||||
<FormComponent :options="formOptions" :data.sync="params" @actionCallback="callback" :actions="formActions"
|
||||
:full-btn="false" @change="callback" btn-position="end"></FormComponent>
|
||||
:full-btn="false" @change="change" btn-position="end"></FormComponent>
|
||||
</div>
|
||||
<div class="table-box flex-1">
|
||||
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"
|
||||
@actionCallback="callback($event)" @pageNumberChange="callback($event)" @pageSizeChange="callback($event)"
|
||||
<TableComponent :tableData="tableData" :tableColumn="tableColumn"
|
||||
@actionCallback="callback($event)" @pageNumberChange="callback($event,'pageNum')" @pageSizeChange="callback($event,'pageSize')"
|
||||
:footerActions="footerActions" :actions="tableActions">
|
||||
|
||||
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked"
|
||||
<el-table ref="multipleTable" :data="tableData.datas" tooltip-effect="dark" height="100%" border
|
||||
@selection-change="handleSelectionChange" style="width: 100%">
|
||||
<el-table-column type="selection" label="全选" width="60">
|
||||
</el-table-column>
|
||||
<el-table-column label="序号" width="60">
|
||||
<template slot-scope="scope">
|
||||
{{scope.$index+1}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template v-for="item in tableColumn">
|
||||
<el-table-column v-if="item.render" :label="item.name" :width="item.width" :key="item.key">
|
||||
<el-table-column v-if="item.render" :show-overflow-tooltip="item.showTip" :label="item.name" :width="item.width" :key="item.key">
|
||||
<div slot-scope="scope" v-html="item.render(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 v-else :prop="item.key" :show-overflow-tooltip="item.showTip" :label="item.name" :width="item.width" :key="item.key">
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column label="操作" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="showUpdateModel(scope.row.userId)">查看</el-button>
|
||||
<el-button type="text" @click="showUpdateModel(0)">修改</el-button>
|
||||
<el-button type="text" @click="deleteData([scope.row])">删除</el-button>
|
||||
<el-button type="text" @click="showUpdateModel(scope.row,true)">查看</el-button>
|
||||
<el-button type="text" @click="showUpdateModel(scope.row)">修改</el-button>
|
||||
<el-button type="text" @click="deleteData([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -32,15 +37,73 @@
|
|||
</TableComponent>
|
||||
</div>
|
||||
</div>
|
||||
<div class="model-box" v-if="showDraw">
|
||||
<div class="mask"></div>
|
||||
<DrawComponent :model="drawModel" :show.sync="showDraw"></DrawComponent>
|
||||
</div>
|
||||
|
||||
<el-dialog :close-on-click-modal="false" :title="currentId>0?'详情':currentId===-1?'新增':'编辑'" :visible.sync="showUpdate" width="952px"
|
||||
<el-dialog :close-on-click-modal="false" :title="currentId===-1?'新增':isReadonly?'详情':'编辑'" :visible.sync="showUpdate" width="952px"
|
||||
:before-close="handleClose">
|
||||
<FormComponent :options="updateOptions" :isReadonly="currentId>0" labelWidth="110px" labelAlign="right" :data.sync="updateParams"
|
||||
@actionCallback="callback" :actions="updateActions" :full-btn="true" @change="callback"
|
||||
btn-position="center"></FormComponent>
|
||||
<FormComponent :options="updateOptions" :isReadonly="isReadonly" labelWidth="110px" labelAlign="right" :data.sync="updateParams"
|
||||
@actionCallback="callback" :actions="updateActions" :full-btn="true" @change="change"
|
||||
btn-position="center">
|
||||
<div class="sub-title" v-if="isManager">检查项目</div>
|
||||
|
||||
<TableComponent v-if="isManager" :tableData="updateTableData" :tableColumn="updateTableColumn"
|
||||
@actionCallback="subCallback($event)" actionPosition="flex-start" :actions="!isReadonly?updateTableActions:[]"
|
||||
:showFooter="false" style="margin-bottom: 20px;">
|
||||
|
||||
<el-table ref="multipleTable" :data="updateParams.tableItems" tooltip-effect="dark" height="100%" border
|
||||
@selection-change="handleSelectionChange" style="width: 100%;min-height: 200px;">
|
||||
<el-table-column type="selection" label="全选" width="60" v-if="!isReadonly">
|
||||
</el-table-column>
|
||||
<template v-for="item in updateTableColumn">
|
||||
<el-table-column v-if="item.render" :show-overflow-tooltip="item.showTip" :label="item.name" :width="item.width" :key="item.key">
|
||||
<div slot-scope="scope" v-html="item.render(scope.row)"></div>
|
||||
</el-table-column>
|
||||
<el-table-column v-else :prop="item.key" :show-overflow-tooltip="item.showTip" :label="item.name" :width="item.width" :key="item.key">
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column label="操作" width="200" v-if="!isReadonly">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="showSubUpdateModel(scope.row,true)">查看</el-button>
|
||||
<el-button type="text" @click="showSubUpdateModel(scope.row)">修改</el-button>
|
||||
<el-button type="text" @click="doSubDelete([scope.$index])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
</TableComponent>
|
||||
|
||||
</FormComponent>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<el-dialog v-if="isManager" :close-on-click-modal="false" :title="!subUpdateParams.id?'新增':subIsReadonly?'详情':'编辑'" :visible.sync="showSubUpdate"
|
||||
:before-close="handleClose">
|
||||
<FormComponent :options="subUpdateOptions" :isReadonly="subIsReadonly" labelWidth="110px" labelAlign="right" :data.sync="subUpdateParams"
|
||||
@actionCallback="subCallback" :actions="updateActions" :full-btn="true" @change="subChange"
|
||||
btn-position="center">
|
||||
</FormComponent>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-if="isManager" :close-on-click-modal="false" :title="'批量添加'" :visible.sync="showSubMutilUpdate"
|
||||
:before-close="handleClose">
|
||||
<TableComponent :tableData="updateTableData" :tableColumn="updateTableColumn" @pageNumberChange="loadRuleTable($event,'pageNum')" @pageSizeChange="loadRuleTable($event,'pageSize')"
|
||||
:showFooter="false">
|
||||
|
||||
<el-table ref="multipleTable" :data="updateTableData.datas" tooltip-effect="dark" height="100%" border
|
||||
@selection-change="handleSelectionChange" style="width: 100%;min-height: 200px;">
|
||||
<el-table-column type="selection" label="全选" width="60" v-if="!isReadonly">
|
||||
</el-table-column>
|
||||
<template v-for="item in updateTableColumn">
|
||||
<el-table-column v-if="item.render" :show-overflow-tooltip="item.showTip" :label="item.name" :width="item.width" :key="item.key">
|
||||
<div slot-scope="scope" v-html="item.render(scope.row)"></div>
|
||||
</el-table-column>
|
||||
<el-table-column v-else :prop="item.key" :show-overflow-tooltip="item.showTip" :label="item.name" :width="item.width" :key="item.key">
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table>
|
||||
<div class="dis-flex" style="justify-content: center; margin-top: 20px;">
|
||||
<el-button @click="cancelMutilAdd"> 取消</el-button>
|
||||
<el-button type="primary" @click="doMutilAdd"> 确定</el-button>
|
||||
</div>
|
||||
</TableComponent>
|
||||
</el-dialog>
|
||||
</div>
|
|
@ -5,10 +5,11 @@ import template from "./rules.component.html"
|
|||
import BaseRecordComponent from "hbt-common/components/common/baseRecord.component.vue"
|
||||
import FormComponent from "hbt-common/components/common/form.component.vue"
|
||||
import TableComponent from "hbt-common/components/common/table.component.vue"
|
||||
import AreaService from "@/service/area.service"
|
||||
import FormOption from "hbt-common/models/formOptions"
|
||||
import BtnOption from "hbt-common/models/btnOptions"
|
||||
import DrawComponent from '@/components/draw.component.vue';
|
||||
import RuleService from '@/service/rule.service';
|
||||
import { number } from 'echarts';
|
||||
@Component({
|
||||
template,
|
||||
components:{
|
||||
|
@ -18,10 +19,14 @@ import DrawComponent from '@/components/draw.component.vue';
|
|||
},
|
||||
})
|
||||
export default class RulesComponent extends BaseRecordComponent<any> {
|
||||
public tableService = new AreaService();
|
||||
public tableService = new RuleService();
|
||||
|
||||
public params = {} as any;
|
||||
|
||||
public isReadonly = false;
|
||||
|
||||
public isManager = false;
|
||||
|
||||
public formActions = [{
|
||||
name:"查询",
|
||||
value:"search",
|
||||
|
@ -54,93 +59,14 @@ export default class RulesComponent extends BaseRecordComponent<any> {
|
|||
}];
|
||||
public formOptions:FormOption<BtnOption>[] = [{
|
||||
name:"检查项目",
|
||||
key:"areaId",
|
||||
key:"name",
|
||||
type:"text",
|
||||
}];
|
||||
|
||||
public showUpdate = false;
|
||||
public currentId = -1;
|
||||
public updateParams = {} as any;
|
||||
public updateOptions:FormOption<BtnOption>[] = [{
|
||||
name:"区域编号",
|
||||
key:"no",
|
||||
type:"text",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true
|
||||
},{
|
||||
name:"区域名称",
|
||||
key:"areaName",
|
||||
type:"text",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true
|
||||
},{
|
||||
name:"责任部门",
|
||||
key:"deptId",
|
||||
type:"select",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
datas:[{
|
||||
name:"部门1",
|
||||
value:0
|
||||
},{
|
||||
name:"部门2",
|
||||
value:1
|
||||
}]
|
||||
},{
|
||||
name:"责任人",
|
||||
key:"person",
|
||||
type:"select",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
datas:[{
|
||||
name:"人员1",
|
||||
value:0
|
||||
},{
|
||||
name:"人员2",
|
||||
value:1
|
||||
}]
|
||||
},{
|
||||
name:"属于重大危险源",
|
||||
key:"isDangrous",
|
||||
type:"radio",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
datas:[{
|
||||
name:"是",
|
||||
value:0
|
||||
},{
|
||||
name:"否",
|
||||
value:1
|
||||
}]
|
||||
},{
|
||||
name:"重大危险源名称",
|
||||
key:"dangrousName",
|
||||
type:"text",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
},{
|
||||
name:"重大危险源等级",
|
||||
key:"level",
|
||||
type:"select",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
datas:[{
|
||||
name:"一级",
|
||||
value:0
|
||||
},{
|
||||
name:"二级",
|
||||
value:1
|
||||
}]
|
||||
},{
|
||||
type:"btn",
|
||||
name:"区域绘制",
|
||||
width:"calc(50% - 20px)",
|
||||
btn:[{
|
||||
name:"开始绘制",
|
||||
value:"draw",
|
||||
type:"primary"
|
||||
}]
|
||||
}];
|
||||
public updateOptions:FormOption<BtnOption>[] = [];
|
||||
|
||||
|
||||
public showDraw = false;
|
||||
|
@ -168,58 +94,141 @@ export default class RulesComponent extends BaseRecordComponent<any> {
|
|||
|
||||
}
|
||||
|
||||
public buildTable(){
|
||||
this.tableColumn.push({name:'序号',key:"areaName"});
|
||||
this.tableColumn.push({name:'检查项目',key:"areaName"});
|
||||
this.tableColumn.push({name:'检查内容',key:"deptName"});
|
||||
this.tableColumn.push({name:'检查依据',key:"person"});
|
||||
this.tableColumn.push({name:'分类',key:"isDangrous"});
|
||||
public getTableCallback(){
|
||||
this.updateOptions = [{
|
||||
name:"检查标准编号",
|
||||
key:"number",
|
||||
type:"text",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
showError:false,
|
||||
disable:true,
|
||||
},{
|
||||
name:"检查项目",
|
||||
key:"name",
|
||||
type:"text",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
showError:false,
|
||||
},{
|
||||
name:"检查内容",
|
||||
key:"content",
|
||||
type:"textarea",
|
||||
width:"100%",
|
||||
require:true,
|
||||
showError:false,
|
||||
},{
|
||||
name:"检查依据",
|
||||
key:"reason",
|
||||
type:"textarea",
|
||||
width:"100%",
|
||||
require:true,
|
||||
showError:false,
|
||||
},{
|
||||
name:"类型",
|
||||
key:"type",
|
||||
format:"typeName",
|
||||
type:"select",
|
||||
width:"100%",
|
||||
require:true,
|
||||
datas:this.$store.state.prevention_dangrous_type
|
||||
}]
|
||||
}
|
||||
|
||||
public callback(data){
|
||||
public buildTable(){
|
||||
this.tableColumn.push({name:'检查项目',key:"name"});
|
||||
this.tableColumn.push({name:'检查内容',key:"content",showTip:true});
|
||||
this.tableColumn.push({name:'检查依据',key:"reason",showTip:true});
|
||||
this.tableColumn.push({name:'分类',key:"type",render:(data)=>{
|
||||
return this.$store.getters.prevention_dangrous_type_map[data.type]
|
||||
}});
|
||||
|
||||
}
|
||||
|
||||
public change(data,item){
|
||||
//
|
||||
}
|
||||
|
||||
public callback(data,type?){
|
||||
if(type){
|
||||
this.params[type] = data;
|
||||
this.getTableData();
|
||||
return
|
||||
}
|
||||
// 查询
|
||||
if(data.value==="search"){
|
||||
if(data && data.value==="search"){
|
||||
this.getTableData()
|
||||
// 重置
|
||||
}else if(data.value === "reset"){
|
||||
}else if(data && data.value === "reset"){
|
||||
this.reset()
|
||||
// 反选
|
||||
}else if(data.value === "reverse"){
|
||||
}else if(data && data.value === "reverse"){
|
||||
this.toggleAll()
|
||||
// 全选
|
||||
}else if(data.value === "selectAll"){
|
||||
}else if(data && data.value === "selectAll"){
|
||||
this.selectAll()
|
||||
}else if(data.value === "add"){
|
||||
this.showUpdateModel(-1)
|
||||
}else if(data.value === "delete"){
|
||||
this.deleteData(this.selectData.map((item:any)=>item.id))
|
||||
}else if(data.value === "draw"){
|
||||
this.drawModel = "area";
|
||||
this.showDraw = true;
|
||||
}else if(data.value === "drawList"){
|
||||
this.drawModel = "list";
|
||||
this.showDraw = true;
|
||||
}else if(data && data.value === "add"){
|
||||
this.showUpdateModel()
|
||||
}else if(data && data.value === "delete"){
|
||||
this.deleteData(this.selectData.map((item:any)=>item.id));
|
||||
this.clearSelect()
|
||||
}else if(data && data.value.indexOf("save")>=0){
|
||||
this.doSave(data.value!=="save")
|
||||
}else{
|
||||
this.handleClose();
|
||||
}
|
||||
}
|
||||
// 重置数据
|
||||
public reset(){
|
||||
this.params = {
|
||||
name:"",
|
||||
pageNum:1,
|
||||
pageSize:20,
|
||||
} as any;
|
||||
}
|
||||
|
||||
public doSave(goOn?){
|
||||
this.tableService.addOrUpdate(this.updateParams,this.currentId===-1).then((res=>{
|
||||
this.$message.success(this.currentId===-1?"新增成功!":"编辑成功");
|
||||
this.showUpdate = !!goOn;
|
||||
this.updateParams = {number:null} as any;
|
||||
if(goOn){
|
||||
this.tableService.getNumber().then(res=>{
|
||||
this.updateParams.number = res.data
|
||||
})
|
||||
}
|
||||
this.getTableData();
|
||||
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
public showUpdateModel(id){
|
||||
if(id!==-1){
|
||||
|
||||
public showUpdateModel(row?,isRead?){
|
||||
|
||||
this.updateParams = Object.assign({number:null})
|
||||
this.isReadonly = !!isRead;
|
||||
if(!row){
|
||||
this.currentId = -1;
|
||||
this.tableService.getNumber().then(res=>{
|
||||
this.updateParams.number = res.data
|
||||
})
|
||||
}else{
|
||||
this.updateParams = Object.assign({number:null,typeName:this.$store.getters.prevention_dangrous_type_map[row.type]},row)
|
||||
this.currentId = row.id;
|
||||
}
|
||||
this.currentId = id;
|
||||
this.clearSelect();
|
||||
this.showUpdate = true
|
||||
}
|
||||
|
||||
public clearSelect(){
|
||||
(this.$refs.multipleTable as any).clearSelection();
|
||||
this.selectData = [];
|
||||
}
|
||||
|
||||
public handleClose(){
|
||||
this.showUpdate = false;
|
||||
this.clearSelect();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,10 +5,13 @@ import template from "./rules.component.html"
|
|||
import BaseRecordComponent from "hbt-common/components/common/baseRecord.component.vue"
|
||||
import FormComponent from "hbt-common/components/common/form.component.vue"
|
||||
import TableComponent from "hbt-common/components/common/table.component.vue"
|
||||
import AreaService from "@/service/area.service"
|
||||
import FormOption from "hbt-common/models/formOptions"
|
||||
import BtnOption from "hbt-common/models/btnOptions"
|
||||
import DrawComponent from '@/components/draw.component.vue';
|
||||
import TableService from '@/service/table.service';
|
||||
import UnitService from '@/service/unit.service';
|
||||
import AreaService from '@/service/area.service';
|
||||
import RuleService from '@/service/rule.service';
|
||||
@Component({
|
||||
template,
|
||||
components:{
|
||||
|
@ -18,10 +21,22 @@ import DrawComponent from '@/components/draw.component.vue';
|
|||
},
|
||||
})
|
||||
export default class RulesManagerComponent extends BaseRecordComponent<any> {
|
||||
public tableService = new AreaService();
|
||||
public tableService = new TableService();
|
||||
public unitService = new UnitService()
|
||||
public areaService = new AreaService()
|
||||
|
||||
public ruleService = new RuleService()
|
||||
|
||||
public params = {} as any;
|
||||
|
||||
public isReadonly = false;
|
||||
|
||||
public subIsReadonly = false;
|
||||
public isManager = true;
|
||||
|
||||
public areaList = [];
|
||||
public unitList = [];
|
||||
|
||||
public formActions = [{
|
||||
name:"查询",
|
||||
value:"search",
|
||||
|
@ -44,6 +59,24 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
|
|||
icon:"el-icon-delete",
|
||||
type:"danger"
|
||||
}];
|
||||
public updateTableActions = [{
|
||||
name:"添加",
|
||||
value:"subAdd",
|
||||
plain:true,
|
||||
icon:"el-icon-plus",
|
||||
type:"success"
|
||||
},{
|
||||
name:"批量删除",
|
||||
value:"subDelete",
|
||||
plain:true,
|
||||
icon:"el-icon-delete",
|
||||
type:"danger"
|
||||
},{
|
||||
name:"批量添加",
|
||||
value:"subMutilAdd",
|
||||
icon:"el-icon-plus",
|
||||
type:"primary"
|
||||
}];
|
||||
public footerActions = [{
|
||||
name:"选择全部",
|
||||
value:"selectAll",
|
||||
|
@ -61,92 +94,16 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
|
|||
public showUpdate = false;
|
||||
public currentId = -1;
|
||||
public updateParams = {} as any;
|
||||
public updateOptions:FormOption<BtnOption>[] = [{
|
||||
name:"区域编号",
|
||||
key:"no",
|
||||
type:"text",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true
|
||||
},{
|
||||
name:"区域名称",
|
||||
key:"areaName",
|
||||
type:"text",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true
|
||||
},{
|
||||
name:"责任部门",
|
||||
key:"deptId",
|
||||
type:"select",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
datas:[{
|
||||
name:"部门1",
|
||||
value:0
|
||||
},{
|
||||
name:"部门2",
|
||||
value:1
|
||||
}]
|
||||
},{
|
||||
name:"责任人",
|
||||
key:"person",
|
||||
type:"select",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
datas:[{
|
||||
name:"人员1",
|
||||
value:0
|
||||
},{
|
||||
name:"人员2",
|
||||
value:1
|
||||
}]
|
||||
},{
|
||||
name:"属于重大危险源",
|
||||
key:"isDangrous",
|
||||
type:"radio",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
datas:[{
|
||||
name:"是",
|
||||
value:0
|
||||
},{
|
||||
name:"否",
|
||||
value:1
|
||||
}]
|
||||
},{
|
||||
name:"重大危险源名称",
|
||||
key:"dangrousName",
|
||||
type:"text",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
},{
|
||||
name:"重大危险源等级",
|
||||
key:"level",
|
||||
type:"select",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
datas:[{
|
||||
name:"一级",
|
||||
value:0
|
||||
},{
|
||||
name:"二级",
|
||||
value:1
|
||||
}]
|
||||
},{
|
||||
type:"btn",
|
||||
name:"区域绘制",
|
||||
width:"calc(50% - 20px)",
|
||||
btn:[{
|
||||
name:"开始绘制",
|
||||
value:"draw",
|
||||
type:"primary"
|
||||
}]
|
||||
}];
|
||||
|
||||
|
||||
public showDraw = false;
|
||||
|
||||
public drawModel = "list";
|
||||
|
||||
public subUpdateParams = {} as any;
|
||||
public updateOptions:FormOption<BtnOption>[] = [];
|
||||
public updateTableData = {datas:[]};
|
||||
public updateTableColumn = [] as any;
|
||||
public showSubUpdate = false;
|
||||
public showSubMutilUpdate = false;
|
||||
public ruleParams = {
|
||||
pageSize:10,
|
||||
pageNum:1
|
||||
}
|
||||
|
||||
public updateActions = [{
|
||||
name:"取消",
|
||||
|
@ -161,68 +118,365 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
|
|||
type:"primary"
|
||||
}];
|
||||
|
||||
public subUpdateOptions = [{
|
||||
name:"检查项目",
|
||||
type:"text",
|
||||
require:true,
|
||||
showError:false,
|
||||
width:"100%",
|
||||
key:"name",
|
||||
},{
|
||||
name:"检查内容",
|
||||
type:"textarea",
|
||||
require:true,
|
||||
width:"100%",
|
||||
showError:false,
|
||||
key:"content",
|
||||
},{
|
||||
name:"检查依据",
|
||||
type:"textarea",
|
||||
require:true,
|
||||
width:"100%",
|
||||
showError:false,
|
||||
key:"reason",
|
||||
}]
|
||||
|
||||
public subUpdateActions = [{
|
||||
name:"取消",
|
||||
value:"cancelSub"
|
||||
},{
|
||||
name:"确定",
|
||||
value:"saveSub",
|
||||
type:"primary"
|
||||
}];
|
||||
|
||||
public selectData = [];
|
||||
|
||||
|
||||
created(){
|
||||
this.loadAreaData();
|
||||
this.loadRuleTable();
|
||||
}
|
||||
|
||||
public loadRuleTable(num?,type?){
|
||||
if(type && num){
|
||||
this.ruleParams[type] = num
|
||||
}else{
|
||||
this.ruleParams = {
|
||||
pageSize:10,
|
||||
pageNum:1
|
||||
}
|
||||
}
|
||||
this.ruleService.selectByPage(this.ruleParams).then((res:any)=>{
|
||||
this.updateTableData = res.data;
|
||||
this.updateTableData.datas.forEach((item:any,index)=>{
|
||||
item.index = index+1;
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
public buildUpdateForm(){
|
||||
this.updateOptions = [{
|
||||
name:"检查表编号",
|
||||
key:"number",
|
||||
type:"text",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
disable:true,
|
||||
},{
|
||||
name:"检查表名称",
|
||||
key:"name",
|
||||
type:"text",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
showError:false,
|
||||
},{
|
||||
name:"适用区域",
|
||||
key:"areas",
|
||||
type:"select",
|
||||
multiple:true,
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
showError:false,
|
||||
datas:this.areaList
|
||||
},{
|
||||
name:"适用单元",
|
||||
key:"units",
|
||||
type:"select",
|
||||
multiple:true,
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
showError:false,
|
||||
datas:this.unitList
|
||||
},{
|
||||
name:"适用对象",
|
||||
key:"targets",
|
||||
type:"select",
|
||||
multiple:true,
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
showError:false,
|
||||
datas:[{
|
||||
name:"是",
|
||||
value:"0-12312312312"
|
||||
},{
|
||||
name:"否",
|
||||
value:"1-12312312312"
|
||||
}]
|
||||
},{
|
||||
name:"适用部门",
|
||||
key:"depts",
|
||||
multiple:true,
|
||||
type:"select",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
showError:false,
|
||||
datas:this.$store.state.deptList
|
||||
},{
|
||||
name:"适用类型",
|
||||
key:"types",
|
||||
type:"select",
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
multiple:true,
|
||||
showError:false,
|
||||
datas:this.$store.state.prevention_dangrous_type
|
||||
}]
|
||||
}
|
||||
|
||||
// 加载区域列表
|
||||
public loadAreaData(){
|
||||
this.areaService.selectByPage({pageSize:1000}).then((res:any)=>{
|
||||
this.areaList = res.data.datas.map(item=>{
|
||||
return {
|
||||
name:item.name,
|
||||
value:item.id
|
||||
}
|
||||
});
|
||||
this.buildUpdateForm()
|
||||
})
|
||||
}
|
||||
// 加载单元列表
|
||||
public loadUnitData(ids?){
|
||||
this.unitService.getListByIds({areaIds:ids},false).then((res:any)=>{
|
||||
this.unitList = res.data.map(item=>{
|
||||
return {
|
||||
name:item.name,
|
||||
value:item.id
|
||||
}
|
||||
});
|
||||
this.buildUpdateForm()
|
||||
})
|
||||
}
|
||||
|
||||
public getNumber(){
|
||||
this.tableService.getNumber().then(res=>{
|
||||
this.updateParams.number = res.data
|
||||
})
|
||||
}
|
||||
|
||||
public buildTable(){
|
||||
this.tableColumn.push({name:'序号',key:"areaName"});
|
||||
this.tableColumn.push({name:'检查表名称',key:"areaName"});
|
||||
this.tableColumn.push({name:'区域名称',key:"deptName"});
|
||||
this.tableColumn.push({name:'单元名称',key:"person"});
|
||||
this.tableColumn.push({name:'对象名称',key:"isDangrous"});
|
||||
this.tableColumn.push({name:'编制部门',key:"isDangrous"});
|
||||
this.tableColumn.push({name:'适用类型',key:"isDangrous"});
|
||||
this.tableColumn.push({name:'编制人',key:"isDangrous"});
|
||||
this.tableColumn.push({name:'编制时间',key:"isDangrous"});
|
||||
this.tableColumn.push({name:'检查表名称',key:"name"});
|
||||
this.tableColumn.push({name:'区域名称',key:"areas"});
|
||||
this.tableColumn.push({name:'单元名称',key:"units"});
|
||||
this.tableColumn.push({name:'对象名称',key:"targets"});
|
||||
this.tableColumn.push({name:'适用部门',key:"depts"});
|
||||
this.tableColumn.push({name:'适用类型',key:"types"});
|
||||
this.tableColumn.push({name:'编制人',key:"createBy"});
|
||||
this.tableColumn.push({name:'编制时间',key:"createTime"});
|
||||
|
||||
|
||||
this.updateTableColumn.push({name:'序号',key:"index"});
|
||||
this.updateTableColumn.push({name:'检查项目',key:"name",showTip:true});
|
||||
this.updateTableColumn.push({name:'检查内容',key:"content",showTip:true});
|
||||
this.updateTableColumn.push({name:'检查依据',key:"reason",showTip:true});
|
||||
}
|
||||
|
||||
public callback(data){
|
||||
public change(data,item){
|
||||
|
||||
// 区域
|
||||
if(item && item.key==="areas"){
|
||||
if(this.updateParams.units.length){
|
||||
this.updateParams.units = [];
|
||||
}
|
||||
this.loadUnitData(data)
|
||||
}
|
||||
}
|
||||
|
||||
public callback(data,type?){
|
||||
if(type){
|
||||
this.params[type] = data;
|
||||
this.getTableData();
|
||||
return
|
||||
}
|
||||
// 查询
|
||||
if(data.value==="search"){
|
||||
if(data && data.value==="search"){
|
||||
this.getTableData()
|
||||
// 重置
|
||||
}else if(data.value === "reset"){
|
||||
}else if(data &&data.value === "reset"){
|
||||
this.reset()
|
||||
// 反选
|
||||
}else if(data.value === "reverse"){
|
||||
}else if(data &&data.value === "reverse"){
|
||||
this.toggleAll()
|
||||
// 全选
|
||||
}else if(data.value === "selectAll"){
|
||||
}else if(data && data.value === "selectAll"){
|
||||
this.selectAll()
|
||||
}else if(data.value === "add"){
|
||||
this.showUpdateModel(-1)
|
||||
}else if(data.value === "delete"){
|
||||
}else if(data && data.value === "add"){
|
||||
this.showUpdateModel()
|
||||
}else if(data && data.value === "delete"){
|
||||
this.deleteData(this.selectData.map((item:any)=>item.id))
|
||||
}else if(data.value === "draw"){
|
||||
this.drawModel = "area";
|
||||
this.showDraw = true;
|
||||
}else if(data.value === "drawList"){
|
||||
this.drawModel = "list";
|
||||
this.showDraw = true;
|
||||
}else if(data && data.value.indexOf("save")>=0){
|
||||
this.doSave(data.value!=="save")
|
||||
}
|
||||
}
|
||||
|
||||
public subChange(data,item){
|
||||
//
|
||||
}
|
||||
|
||||
public subCallback(data){
|
||||
if(data && data.value==="subAdd"){
|
||||
this.showSubUpdateModel()
|
||||
}else if(data && data.value.indexOf("save")>=0){
|
||||
this.doSubSave(data.value!=="save")
|
||||
}else if(data && data.value==="cancel"){
|
||||
this.handleClose()
|
||||
}else if(data && data.value==="subDelete"){
|
||||
this.doSubDelete(this.selectData.map((item:any)=>item.index -1))
|
||||
}else if(data && data.value==="subMutilAdd"){
|
||||
this.showSubMutilUpdate = true;
|
||||
this.clearSelect()
|
||||
}
|
||||
}
|
||||
|
||||
public doMutilAdd(){
|
||||
this.selectData.forEach((item:any)=>{
|
||||
if(!this.updateParams.tableItems.find(itm=>itm.id===item.id)){
|
||||
this.updateParams.tableItems.push(item)
|
||||
}
|
||||
})
|
||||
|
||||
this.updateParams.tableItems.forEach((item,i)=>{
|
||||
item.index = i+1
|
||||
})
|
||||
this.clearSelect()
|
||||
this.showSubMutilUpdate=false
|
||||
}
|
||||
|
||||
public cancelMutilAdd(){
|
||||
this.clearSelect()
|
||||
this.showSubMutilUpdate=false;
|
||||
|
||||
}
|
||||
|
||||
public clearSelect(){
|
||||
(this.$refs.multipleTable as any).clearSelection();
|
||||
this.selectData = [];
|
||||
}
|
||||
// 重置数据
|
||||
public reset(){
|
||||
this.params = {
|
||||
name:"",
|
||||
pageNum:1,
|
||||
pageSize:20,
|
||||
} as any;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public showUpdateModel(id){
|
||||
if(id!==-1){
|
||||
public showSubUpdateModel(row?){
|
||||
this.subUpdateParams = {} as any;
|
||||
if(!row){
|
||||
}else{
|
||||
this.subUpdateParams = JSON.parse(JSON.stringify(row))
|
||||
}
|
||||
this.currentId = id;
|
||||
this.showUpdate = true
|
||||
this.showSubUpdate = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public showUpdateModel(row?,isRead?){
|
||||
this.updateParams = {number:null,tableItems:[]} as any;
|
||||
this.isReadonly = !!isRead;
|
||||
this.clearSelect()
|
||||
if(!row){
|
||||
this.currentId = -1;
|
||||
this.getNumber();
|
||||
this.showUpdate = true;
|
||||
}else{
|
||||
this.currentId = row.id;
|
||||
this.tableService.selectById(this.currentId,true).then((res:any)=>{
|
||||
if(isRead){
|
||||
this.updateParams = Object.assign(res.data,row)
|
||||
}else{
|
||||
this.updateParams = res.data;
|
||||
this.loadUnitData(res.data.areas)
|
||||
}
|
||||
|
||||
this.updateParams.tableItems.forEach((item,i)=>{
|
||||
item.index = i+1
|
||||
})
|
||||
this.showUpdate = true;
|
||||
})
|
||||
}
|
||||
}
|
||||
public doSubSave(goOn?){
|
||||
if(!this.subUpdateParams.index){
|
||||
this.subUpdateParams.index = this.updateParams.tableItems.length+1;
|
||||
this.updateParams.tableItems.push(this.subUpdateParams);
|
||||
}else{
|
||||
this.updateParams.tableItems.splice(this.updateParams.tableItems.findIndex(item=>item.index ===this.subUpdateParams.index),1,this.subUpdateParams)
|
||||
}
|
||||
|
||||
this.updateParams.tableItems.forEach((item,i)=>{
|
||||
item.index = i+1
|
||||
})
|
||||
this.subUpdateParams = {} as any;
|
||||
this.showSubUpdate = !!goOn
|
||||
}
|
||||
|
||||
public doSubDelete(indexs){
|
||||
for(let i = this.updateParams.tableItems.length-1;i>=0;i--){
|
||||
if(indexs.includes(i)){
|
||||
this.updateParams.tableItems.splice(i,1)
|
||||
}
|
||||
}
|
||||
|
||||
this.updateParams.tableItems.forEach((item,i)=>{
|
||||
item.index = i+1
|
||||
})
|
||||
this.clearSelect()
|
||||
}
|
||||
|
||||
public doSave(goOn?){
|
||||
this.updateParams.depts = this.updateParams.depts.map(item=>{
|
||||
return {
|
||||
id:item,
|
||||
name:this.$store.getters.dept_map[item]
|
||||
}
|
||||
})
|
||||
|
||||
this.updateParams.targets = this.updateParams.targets.map(item=>{
|
||||
return {
|
||||
id:item,
|
||||
name:item
|
||||
}
|
||||
})
|
||||
this.tableService.addOrUpdate(this.updateParams,this.currentId===-1).then(res=>{
|
||||
this.$message.success(this.currentId===-1?"新增成功!":"编辑成功");
|
||||
this.getTableData();
|
||||
this.showUpdate = !!goOn;
|
||||
this.updateParams = {areas:[],depts:[],units:[],types:[],targets:[],number:null} as any;
|
||||
})
|
||||
}
|
||||
|
||||
public handleClose(){
|
||||
if(this.showSubMutilUpdate){
|
||||
this.showSubMutilUpdate = false;
|
||||
return
|
||||
}
|
||||
if(this.showSubUpdate){
|
||||
this.showSubUpdate = false;
|
||||
return
|
||||
}
|
||||
this.showUpdate = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -321,7 +321,7 @@ export default class AreaManagerComponent extends BaseRecordComponent<any> {
|
|||
})
|
||||
}
|
||||
|
||||
public callback(data,item?){
|
||||
public change(data,item?){
|
||||
// 新增编辑选择部门
|
||||
if(item && item.key === "chargeDeptId"){
|
||||
this.updateParams.chargeDeptName = this.$store.getters.dept_map[data];
|
||||
|
@ -335,6 +335,14 @@ export default class AreaManagerComponent extends BaseRecordComponent<any> {
|
|||
this.updateOptions[5].hide = !data;
|
||||
this.updateOptions[6].hide = !data;
|
||||
}
|
||||
}
|
||||
|
||||
public callback(data,type?){
|
||||
if(type){
|
||||
this.params[type] = data;
|
||||
this.getTableData();
|
||||
return
|
||||
}
|
||||
// 查询
|
||||
if(data && data.value==="search"){
|
||||
this.getTableData()
|
||||
|
|
|
@ -1,57 +1,61 @@
|
|||
<div class="common-box dis-flex " >
|
||||
<div class="common-box dis-flex ">
|
||||
<div class="common-content-box dis-flex flex-col flex-1">
|
||||
<div class="search-box">
|
||||
<FormComponent :options="formOptions" :data.sync="params" @actionCallback="callback" :actions="formActions"
|
||||
:full-btn="false" @change="callback" btn-position="end"></FormComponent>
|
||||
:full-btn="false" @change="change" btn-position="end"></FormComponent>
|
||||
</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">
|
||||
|
||||
<TableComponent :tableData="tableData" :tableColumn="tableColumn"
|
||||
@actionCallback="callback($event)" @pageNumberChange="callback($event,'pageNum')"
|
||||
@pageSizeChange="callback($event,'pageSize')" :footerActions="footerActions" :actions="tableActions">
|
||||
|
||||
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked"
|
||||
@selection-change="handleSelectionChange" style="width: 100%">
|
||||
<el-table-column type="selection" label="全选">
|
||||
</el-table-column>
|
||||
<template v-for="item in tableColumn">
|
||||
<el-table-column v-if="item.render" :label="item.name" :filters="item.filters" :filter-method="item.filterMethod" :width="item.width" :key="item.key">
|
||||
<el-table-column v-if="item.render" :label="item.name" :filters="item.filters"
|
||||
:filter-method="item.filterMethod" :width="item.width" :key="item.key">
|
||||
<div slot-scope="scope" v-html="item.render(scope.row)"></div>
|
||||
</el-table-column>
|
||||
<el-table-column v-else :prop="item.key" :filters="item.filters" :label="item.name" :filter-method="item.filterMethod" :width="item.width" :key="item.key">
|
||||
<el-table-column v-else :prop="item.key" :filters="item.filters" :label="item.name"
|
||||
:filter-method="item.filterMethod" :width="item.width" :key="item.key">
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column label="操作" width="245">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="showUpdateModel(scope.row,true)">查看</el-button>
|
||||
<el-button type="text" @click="showUpdateModel(scope.row)">修改</el-button>
|
||||
<el-button type="text" @click="showUpdateModel(scope.row)">修改</el-button>
|
||||
<el-button type="text" @click="deleteData([scope.row.id])">删除</el-button>
|
||||
<el-button type="text" @click="getQrCode(scope.row)">二维码</el-button>
|
||||
<el-button type="text" v-if="!isArea && scope.row.status===1" @click="doTurnOff(scope.row,0)">停用</el-button>
|
||||
<el-button type="text" v-if="!isArea && scope.row.status===0 " @click="doTurnOff(scope.row,1)">恢复</el-button>
|
||||
<el-button type="text" v-if="!isArea && scope.row.status===1"
|
||||
@click="doTurnOff(scope.row,0)">停用</el-button>
|
||||
<el-button type="text" v-if="!isArea && scope.row.status===0 "
|
||||
@click="doTurnOff(scope.row,1)">恢复</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
|
||||
</TableComponent>
|
||||
</div>
|
||||
</div>
|
||||
<div class="model-box" v-if="showDraw">
|
||||
<div class="mask"></div>
|
||||
<DrawComponent :model.sync="drawModel" :isReadonly="isReadonly" :data.sync="updateParams" :show.sync="showDraw" @onClose="getTableData"></DrawComponent>
|
||||
<DrawComponent :model.sync="drawModel" :isReadonly="isReadonly" :data.sync="updateParams" :show.sync="showDraw"
|
||||
@onClose="getTableData"></DrawComponent>
|
||||
</div>
|
||||
|
||||
<el-dialog :close-on-click-modal="false" :title="isReadonly?'详情':currentId===-1?'新增':'编辑'" :visible.sync="showUpdate" width="952px"
|
||||
:before-close="handleClose">
|
||||
<FormComponent :options="updateOptions" :isReadonly="isReadonly" labelWidth="110px" labelAlign="right" :data.sync="updateParams"
|
||||
@actionCallback="callback" :actions="updateActions" :full-btn="true" @change="callback"
|
||||
btn-position="center">
|
||||
<el-dialog :close-on-click-modal="false" :title="isReadonly?'详情':currentId===-1?'新增':'编辑'"
|
||||
:visible.sync="showUpdate" width="952px" :before-close="handleClose">
|
||||
<FormComponent :options="updateOptions" :isReadonly="isReadonly" labelWidth="110px" labelAlign="right"
|
||||
:data.sync="updateParams" @actionCallback="callback" :actions="updateActions" :full-btn="true"
|
||||
@change="change" btn-position="center">
|
||||
<span class="tips" v-if="currentId===-1 && isArea">*注:安全风险分析对象编码即危险化学品登记综合服务系统中的危险源编码</span>
|
||||
|
||||
|
||||
<div class="sub-title" v-if="!isArea && isReadonly">停用/检修记录</div>
|
||||
|
||||
<TableComponent v-if="!isArea && isReadonly" :tableData="repairTableData" :tableColumn="repairTableColumn"
|
||||
@actionCallback="callback($event)" :actions="subTableActions" actionPosition="flex-start"
|
||||
<TableComponent v-if="!isArea && isReadonly" :tableData="repairTableData" :tableColumn="repairTableColumn"
|
||||
:showFooter="false" style="margin-bottom: 20px;">
|
||||
</TableComponent>
|
||||
</FormComponent>
|
||||
|
@ -59,13 +63,13 @@
|
|||
</el-dialog>
|
||||
|
||||
|
||||
<el-dialog :close-on-click-modal="false" :title="'查看二维码'" :visible.sync="showQrCode" >
|
||||
<el-dialog :close-on-click-modal="false" :title="'查看二维码'" :visible.sync="showQrCode">
|
||||
<img :src="qrUrl" style="width: 100%;" alt="">
|
||||
</el-dialog>
|
||||
<el-dialog :close-on-click-modal="false" v-if="!isArea" width="500px" :title="'停用/恢复登记'" :visible.sync="showTurnOff" >
|
||||
<el-dialog :close-on-click-modal="false" v-if="!isArea" width="500px" :title="'停用/恢复登记'"
|
||||
:visible.sync="showTurnOff">
|
||||
<FormComponent :options="turnOffForm" labelWidth="110px" labelAlign="right" :data.sync="turnOffParams"
|
||||
@actionCallback="doTurnOffAction" :actions="turnOffAction"
|
||||
btn-position="center">
|
||||
@actionCallback="doTurnOffAction" :actions="turnOffAction" btn-position="center">
|
||||
</FormComponent>
|
||||
</el-dialog>
|
||||
</div>
|
|
@ -5,11 +5,11 @@
|
|||
:full-btn="false" @change="callback" btn-position="end"></FormComponent>
|
||||
</div>
|
||||
<div class="table-box flex-1">
|
||||
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"
|
||||
@actionCallback="callback($event)" @pageNumberChange="callback($event)"
|
||||
@pageSizeChange="callback($event)" :actions="tableActions">
|
||||
<TableComponent :tableData="tableData" :tableColumn="tableColumn"
|
||||
@actionCallback="callback($event)" @pageNumberChange="callback($event,'pageNum')"
|
||||
@pageSizeChange="callback($event,'pageSize')" :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
|
||||
style="width: 100%">
|
||||
<el-table-column label="序号" width="60">
|
||||
<template slot-scope="scope">
|
||||
|
|
|
@ -103,7 +103,12 @@ export default class AreaAnalComponent extends BaseRecordComponent<any> {
|
|||
}});
|
||||
}
|
||||
|
||||
public callback(data){
|
||||
public callback(data,type?){
|
||||
if(type){
|
||||
this.params[type] = data;
|
||||
this.getTableData();
|
||||
return
|
||||
}
|
||||
// 查询
|
||||
if(data.value==="search"){
|
||||
this.getTableData()
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
:full-btn="false" @change="changes" btn-position="end"></FormComponent>
|
||||
</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">
|
||||
<TableComponent :tableData="tableData" :tableColumn="tableColumn"
|
||||
@actionCallback="callback($event)" @pageNumberChange="callback($event,'pageNum')"
|
||||
@pageSizeChange="callback($event,'pageSize')" :footerActions="footerActions" :actions="tableActions">
|
||||
|
||||
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border tooltip-effect="dark"
|
||||
@selection-change="handleSelectionChange" style="width: 100%">
|
||||
|
@ -52,10 +52,10 @@
|
|||
<div class="sub-title">作业步骤</div>
|
||||
|
||||
<TableComponent :tableData="currentStepTableData" :tableColumn="subTableColumn"
|
||||
@actionCallback="callback($event)" :actions="subTableActions" actionPosition="flex-start"
|
||||
@actionCallback="callback($event)" :actions="!isReadonly?subTableActions:[]" actionPosition="flex-start"
|
||||
:showFooter="false" style="margin-bottom: 20px;">
|
||||
|
||||
<el-table ref="multipleTable" :data="currentStepTableData.datas" tooltip-effect="dark" height="250" border
|
||||
<el-table ref="multipleTable" :data="updateParams.steps" tooltip-effect="dark" height="250" border
|
||||
@selection-change="handleSelectionChange" style="width: 100%">
|
||||
<el-table-column type="selection" label="全选" width="40" v-if="!isReadonly">
|
||||
</el-table-column>
|
||||
|
@ -71,7 +71,7 @@
|
|||
<el-table-column label="操作" width="100" v-if="!isReadonly">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="showSubUpdateModel(scope.row)">修改</el-button>
|
||||
<el-button type="text" @click="doSubDelete(scope.$index)">删除</el-button>
|
||||
<el-button type="text" @click="doSubDelete(scope.row.index - 1)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
|
@ -34,7 +34,6 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
|
|||
|
||||
public subTableColumn = [] as any;
|
||||
|
||||
public currentStepRow:any;
|
||||
|
||||
public currentStepTableData = {
|
||||
datas:[]
|
||||
|
@ -378,7 +377,12 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
|
|||
}
|
||||
}
|
||||
|
||||
public callback(data,item?){
|
||||
public callback(data,type?){
|
||||
if(type){
|
||||
this.params[type] = data;
|
||||
this.getTableData();
|
||||
return
|
||||
}
|
||||
// 查询
|
||||
if(data && data.value==="search"){
|
||||
this.getTableData()
|
||||
|
@ -394,14 +398,12 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
|
|||
}else if(data && data.value === "add"){
|
||||
this.showUpdateModel();
|
||||
}else if(data && data.value === "delete"){
|
||||
this.deleteData(this.selectData.map((item:any)=>item.id))
|
||||
this.deleteData(this.selectData.map((itm:any)=>itm.id))
|
||||
}else if(data && data.value === "subAdd"){
|
||||
this.showSubUpdateModel()
|
||||
}else if(data && data.value === "subDelete"){
|
||||
// 批量删除步骤
|
||||
this.selectData.forEach((item,index)=>{
|
||||
this.doSubDelete(index)
|
||||
})
|
||||
this.doSubDelete(this.selectData.map((itm:any)=>itm.index - 1))
|
||||
}else if(data && data.value.indexOf("save")>=0){
|
||||
this.doSave(data.value!=="save")
|
||||
}else if(data && data.value === "cancel"){
|
||||
|
@ -412,15 +414,20 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
|
|||
public showSubUpdateModel(row?){
|
||||
this.stepUpdateParams = {} as any;
|
||||
if(row){
|
||||
// 暂存数据 用于取消修改
|
||||
this.currentStepRow = row;
|
||||
this.stepUpdateParams = JSON.parse(JSON.stringify(row));
|
||||
}
|
||||
this.showSubUpdate = true;
|
||||
}
|
||||
|
||||
public doSubDelete(index){
|
||||
this.updateParams.steps.splice(index,1)
|
||||
public doSubDelete(indexs){
|
||||
for(let i = this.updateParams.steps.length-1;i>=0;i--){
|
||||
if(indexs.includes(i)){
|
||||
this.updateParams.steps.splice(i,1)
|
||||
}
|
||||
}
|
||||
this.updateParams.steps.forEach((item,index)=>{
|
||||
item.index = index+1;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -429,11 +436,11 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
|
|||
// 如果是新增步骤
|
||||
if(this.showSubUpdate){
|
||||
// 新增
|
||||
if(!this.stepUpdateParams.id){
|
||||
if(!this.stepUpdateParams.index){
|
||||
this.stepUpdateParams.index = this.updateParams.steps.length+1;
|
||||
this.updateParams.steps.push(this.stepUpdateParams);
|
||||
}else{
|
||||
Object.assign(this.currentStepRow,this.stepUpdateParams)
|
||||
this.updateParams.steps.splice(this.updateParams.steps.findIndex(item=>item.index ===this.stepUpdateParams.index),1,this.stepUpdateParams)
|
||||
}
|
||||
this.stepUpdateParams = {} as any;
|
||||
this.showSubUpdate=!!goOn;
|
||||
|
@ -476,10 +483,10 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
|
|||
if(!this.updateParams.steps){
|
||||
this.updateParams.steps = [];
|
||||
}
|
||||
this.currentStepTableData.datas = this.updateParams.steps.map((item,index)=>{
|
||||
this.updateParams.steps.forEach((item,index)=>{
|
||||
item.index = index+1;
|
||||
return item
|
||||
});
|
||||
this.currentStepTableData.datas = this.updateParams.steps;
|
||||
if(!isRead){
|
||||
this.updateParams.postCode = this.updateParams.postCode.split(";").map(item=>+item);
|
||||
}else{
|
||||
|
|
|
@ -405,8 +405,7 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
public callback(data,item?){
|
||||
public change(data,item){
|
||||
// 新增编辑选择部门
|
||||
if(item && item.key === "chargeDeptId"){
|
||||
this.updateParams.chargeDeptName = this.$store.getters.dept_map[data];
|
||||
|
@ -420,6 +419,13 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
|||
this.updateParams.areaNo = this.areaNoMap[data];
|
||||
this.getCreateNumber({areaNo:this.updateParams.areaNo})
|
||||
}
|
||||
}
|
||||
public callback(data,type){
|
||||
if(type){
|
||||
this.params[type] = data;
|
||||
this.getTableData();
|
||||
return
|
||||
}
|
||||
// 查询
|
||||
if(data && data.value==="search"){
|
||||
this.getTableData()
|
||||
|
@ -473,7 +479,7 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
|||
this.updateParams = Object.assign({bottomHeight:0,topHeight:0,status:1,geoJson:"[]",number:null,statusName:["停用","启用"][data.status]},data);
|
||||
if(isRead){
|
||||
this.repairTableData.datas = this.updateParams.repairs.map((item,i)=>{
|
||||
item.index = i;
|
||||
item.index = i+1;
|
||||
return item
|
||||
}) || []
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue