feat:新增隐患页面

kongyeqing
吴延福 2023-06-20 16:17:42 +08:00
parent 12d1d4aad2
commit b715d9e86d
20 changed files with 1452 additions and 318 deletions

View File

@ -5,7 +5,7 @@ VUE_APP_TITLE = 汉邦唐全真数字服务平台
# 网关地址
VUE_APP_GATEWAY_URL="/dev-api"
# 服务地址
VUE_APP_BASE_API_URL="http://192.168.1.19:8081/"
VUE_APP_BASE_API_URL="http://192.168.2.187:8081"
# 服务前-- 请严格遵守格式 不允许换行
VUE_APP_SERVICE_PREFIX= '{"system":"/system","file":"/file-zy","prevention":"/prevention-yx"}'
# 是否显示全部菜单

View File

@ -24,6 +24,10 @@ body{
height: 100%;
}
}
.mapboxgl-map{
min-height: 400px;
}
.v-modal{
z-index: 98 !important;
}

View File

@ -12,9 +12,9 @@ import Mock from "mockjs"
// import { MockData } from './mock';
Vue.config.productionTip = false;
// Vue.config.warnHandler = ()=>{
Vue.config.warnHandler = ()=>{
// }
}
document.title = process.env.VUE_APP_TITLE || '汉邦唐全真数字服务平台';
// if(process.env.NODE_ENV==="development"){

View File

@ -34,7 +34,7 @@
</div>
</div>
<div class="map-box" ref="draw">
<MapComponent :center="center" @onLoad="getMap"></MapComponent>
<MapComponent @onLoad="getMap"></MapComponent>
</div>
</div>
</div>
@ -80,7 +80,6 @@ export default class DrawComponent extends Vue {
}
public map:any;
public center = [-91.874, 42.76];
public updateParams = {} as any;

View File

@ -2,7 +2,7 @@
<div class="map" :id="id"></div>
</template>
<script lang="ts">
import { Component, Emit, Prop, Vue } from 'vue-property-decorator';
import { Component, Emit, Prop, PropSync, Vue } from 'vue-property-decorator';
import mapboxgl from "mapbox-gl";
import "mapbox-gl/dist/mapbox-gl.css"
@Component
@ -15,7 +15,7 @@ export default class MapComponent extends Vue {
})
id:string;
@Prop({
@PropSync("position",{
required:false,
default:()=>{
return [118.751353,31.969568]
@ -39,7 +39,7 @@ export default class MapComponent extends Vue {
// accessToken :"pk.eyJ1IjoiMTgzODI0ZHl0IiwiYSI6ImNqbHExNDVjZzI0ZmUza2wxMDhocnlyem4ifQ.FZoJzmqTtli8hAvvAc1OPA",
container: this.id,
style: 'mapbox://styles/mapbox/streets-v9',
center: [118.751353,31.969568],
center: this.center,
zoom: 16,
});
this.map.on("load",()=>{

View File

@ -0,0 +1,42 @@
import BaseService from "hbt-common/service/base.service"
import type { AxiosResponse } from 'axios'
import { ActionResult } from "hbt-common/models/actionResult";
export default class ManagerService extends BaseService<any>{
constructor(){
super()
}
// 查询列表
public selectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/manage/list';
return this.get(url,params,true)
}
// 批量删除
public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/manage';
return this.deleteBatch(url,params,{},true)
}
public selectById(id:any,showLoading?:boolean):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/manage/'+id;
return this.get(url,null,showLoading)
}
public getNumber():Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/manage/number';
return this.get(url,null)
}
// 新增或更新
public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/manage';
if(add){
return this.post(url,params,{},showLoading)
}else{
return this.put(url,params,{},showLoading)
}
}
public getFileUrls(params):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.file+'/getSysFiles';
return this.get(url,params,false)
}
}

View File

@ -0,0 +1,42 @@
import BaseService from "hbt-common/service/base.service"
import type { AxiosResponse } from 'axios'
import { ActionResult } from "hbt-common/models/actionResult";
export default class NoteService extends BaseService<any>{
constructor(){
super()
}
// 查询列表
public selectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/note/list';
return this.get(url,params,true)
}
// 批量删除
public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/note';
return this.deleteBatch(url,params,{},true)
}
public selectById(id:any,showLoading?:boolean):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/note/'+id;
return this.get(url,null,showLoading)
}
public getNumber():Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/note/number';
return this.get(url,null)
}
// 新增或更新
public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/note';
if(add){
return this.post(url,params,{},showLoading)
}else{
return this.put(url,params,{},showLoading)
}
}
public getFileUrls(params):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.file+'/getSysFiles';
return this.get(url,params,false)
}
}

View File

@ -0,0 +1,44 @@
import BaseService from "hbt-common/service/base.service"
import type { AxiosResponse } from 'axios'
import { ActionResult } from "hbt-common/models/actionResult";
export default class PlanService extends BaseService<any>{
constructor(){
super()
}
// 查询列表
public selectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/plan/list';
return this.get(url,params,true)
}
// 批量删除
public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/plan';
return this.deleteBatch(url,params,{},true)
}
// 详情
public selectById(id:any,showLoading?:boolean):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/plan/'+id;
return this.get(url,null,showLoading)
}
public deliver(params:any,showLoading?:boolean):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/plan/deliver';
return this.post(url,params,{},showLoading)
}
// 新增或更新
public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/plan';
if(add){
return this.post(url,params,{},showLoading)
}else{
return this.put(url,params,{},showLoading)
}
}
public getRecordList(params: any):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/record/list';
return this.get(url,params,true)
}
}

View File

@ -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 TaskService extends BaseService<any>{
constructor(){
super()
}
// 查询列表
public selectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/task/list';
return this.get(url,params,true)
}
// 批量删除
public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/task';
return this.deleteBatch(url,params,{},true)
}
public selectById(id:any,showLoading?:boolean):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/task/'+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/task';
if(add){
return this.post(url,params,{},showLoading)
}else{
return this.put(url,params,{},showLoading)
}
}
}

View File

@ -14,6 +14,12 @@ export default new Vuex.Store({
prevention_risk_level:[],
prevention_safe_reason:[],
prevention_dangrous_type:[],
prevention_cycle_unit:[],
prevention_danger_check_type:[],
prevention_danger_resource:[],
prevention_danger_type:[],
prevention_occur_step:[],
prevention_major_type:[]
},
getters: {
dept_map:(state)=>{
@ -65,12 +71,54 @@ export default new Vuex.Store({
})
return map
},
prevention_cycle_unit_map:(state)=>{
const map = {};
state.prevention_cycle_unit.forEach((item:any)=>{
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
},
prevention_danger_check_type_map:(state)=>{
const map = {};
state.prevention_danger_check_type.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
prevention_danger_type_map:(state)=>{
const map = {};
state.prevention_danger_type.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
prevention_danger_resource_map:(state)=>{
const map = {};
state.prevention_danger_resource.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
prevention_major_type_map:(state)=>{
const map = {};
state.prevention_major_type.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
prevention_occur_step_map:(state)=>{
const map = {};
state.prevention_occur_step.forEach((item:any)=>{
map[item.value] = item.name
})
return map
}
},
mutations: {
@ -102,7 +150,25 @@ export default new Vuex.Store({
},
set_prevention_dangrous_type(state,data){
state.prevention_dangrous_type = data;
}
},
set_prevention_cycle_unit(state,data){
state.prevention_cycle_unit = data;
},
set_prevention_danger_check_type(state,data){
state.prevention_danger_check_type = data;
},
set_prevention_danger_type(state,data){
state.prevention_danger_type = data;
},
set_prevention_danger_resource(state,data){
state.prevention_danger_resource = data;
},
set_prevention_major_type(state,data){
state.prevention_major_type = data;
},
set_prevention_occur_step(state,data){
state.prevention_occur_step = data;
},
},
actions: {
},

View File

@ -22,7 +22,13 @@ export default class BlankComponent extends Vue {
this.systemService.getDictData("prevention_dangrous_level"),
this.systemService.getDictData("prevention_risk_level"),
this.systemService.getDictData("prevention_safe_reason"),
this.systemService.getDictData("prevention_dangrous_type")
this.systemService.getDictData("prevention_dangrous_type"),
this.systemService.getDictData("prevention_cycle_unit"),
this.systemService.getDictData("prevention_danger_check_type"),
this.systemService.getDictData("prevention_danger_resource"),
this.systemService.getDictData("prevention_danger_type"),
this.systemService.getDictData("prevention_major_type"),
this.systemService.getDictData("prevention_occur_step"),
]).then(((results:any)=>{
this.$store.commit("setDeptTreeList",results[0].data);
this.$store.commit("setUserList",results[2].data.datas.map((item)=>{
@ -71,6 +77,42 @@ export default class BlankComponent extends Vue {
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue
}
}))
this.$store.commit("set_prevention_cycle_unit",results[9].data.map(item=>{
return {
name:item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue
}
}))
this.$store.commit("set_prevention_danger_check_type",results[10].data.map(item=>{
return {
name:item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue
}
}))
this.$store.commit("set_prevention_danger_resource",results[11].data.map(item=>{
return {
name:item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue
}
}))
this.$store.commit("set_prevention_danger_type",results[12].data.map(item=>{
return {
name:item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue
}
}))
this.$store.commit("set_prevention_major_type",results[13].data.map(item=>{
return {
name:item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue
}
}))
this.$store.commit("set_prevention_occur_step",results[14].data.map(item=>{
return {
name:item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue
}
}))

View File

@ -1,4 +1,7 @@
::v-deep {
.color_0 {
color: #F56C6C
}
.color_1 {
color: #68C23A
}

View File

@ -9,21 +9,48 @@ 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 NoteService from '@/service/note.service';
import UnitService from '@/service/unit.service';
import MapComponent from "@/components/map.component.vue"
import mapboxgl from "mapbox-gl";
@Component({
template,
components:{
FormComponent,
TableComponent,
DrawComponent,
MapComponent
},
})
export default class HiddenDangerClapComponent extends BaseRecordComponent<any> {
public tableService = new AreaService();
public tableService = new NoteService();
public areaService = new AreaService();
public unitService = new UnitService();
public areaList = [];
public unitList = [];
public params = {} as any;
//
public isBase = true;
public isAction = false;
public isPlan = false;
public tableActionWidth = "150px";
public isReadonly = false;
public showMap = false;
public center = [118.751353,31.969568];
public marker:any;
public map:any;
public formActions = [{
name:"查询",
value:"search",
@ -55,106 +82,28 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent<any>
value:"reverse"
}];
public formOptions:FormOption<BtnOption>[] = [{
name:"检查标题",
key:"areaId",
name:"整改编号",
key:"number",
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 photoList = [] as any;
public fileList = [] as any;
public showDraw = false;
public currentUrl:any;
public showFile = false;
public drawModel = "list";
public updateActions = [{
name:"取消",
value:"cancel"
},{
name:"保存并继续添加",
name:"保存并下发",
value:"saveAndContinue",
type:"primary"
},{
@ -164,18 +113,336 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent<any>
}];
public selectData = [];
public levelMap = ["","一般隐患","重大隐患"]
public reformModeMap = ["","即查即改","限期整改"]
created(){
this.loadAreaData()
this.loadUnitData();
}
//
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(id?){
this.unitService.selectByPage({pageSize:1000,areaId:id},false).then((res:any)=>{
this.unitList = res.data.datas.map(item=>{
return {
name:item.name,
value:item.id
}
});
this.buildUpdateForm()
})
}
public buildUpdateForm(){
this.updateOptions = [{
name:"隐患编号",
key:"number",
type:"text",
width:"100%",
require:true,
showError:false,
disable:true
},{
name:"隐患来源",
key:"type",
type:"text",
width:"100%",
require:true,
showError:false,
disable:true,
},{
name:"检查区域",
key:"areaId",
format:"areaName",
type:"select",
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:this.areaList
},{
name:"检查单元",
key:"unitId",
format:"unitName",
type:"select",
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:this.unitList
},{
name:"整改标题",
key:"title",
type:"text",
width:"100%",
require:true,
showError:false,
},{
name:"检查类型",
key:"inspectType",
format:"inspectTypeName",
type:"select",
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:this.$store.state.prevention_danger_check_type,
},{
name:"隐患类别",
key:"dangerType",
format:"dangerTypeName",
type:"select",
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:this.$store.state.prevention_danger_type,
},{
name:"检查人员",
key:"inspectUserId",
format:"inspectUserName",
type:"select",
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:this.$store.state.userList,
},{
name:"检查时间",
key:"inspectTime",
type:"date",
subType:"datetime",
format:"yyyy-MM-dd HH:mm",
width:"calc(50% - 20px)",
require:true,
showError:false,
},{
name:"隐患级别",
key:"level",
format:"levelName",
type:"select",
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:[{
name:"一般隐患",
value:1
},{
name:"重大隐患",
value:2
}]
},{
name:"整改方式",
key:"reformMode",
format:"reformModeName",
type:"select",
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:[{
name:"即查即改",
value:1
},{
name:"限期整改",
value:2
}]
},{
name:"隐患位置",
key:"locationName",
type:"text",
width:"calc(50% - 20px)",
require:true,
showError:false,
unit:{
type:"btn",
hide:this.isReadonly,
name:"点击定位",
value:"fixed",
btnType:"primary"
}
},{
name:"隐患分类",
key:"classify",
format:"classifyName",
type:"select",
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:this.$store.state.prevention_dangrous_type
},{
name:"整改部门",
key:"reformDeptId",
format:"reformDeptName",
type:"treeSelect",
width:"calc(50% - 20px)",
require:true,
expandLevel:Infinity,
showError:false,
datas:this.$store.state.deptTreeList
},{
name:"整改人员",
key:"reformUserId",
format:"reformUserName",
type:"select",
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:this.$store.state.userList,
},{
name:"验证人员",
key:"verifyUserId",
format:"verifyUserName",
type:"select",
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:this.$store.state.userList,
},{
name:"要求整改日期",
key:"reformDeadline",
type:"date",
subType:"datetime",
format:"yyyy-MM-dd HH",
width:"calc(50% - 20px)",
require:true,
showError:false,
},{
name:"问题描述",
key:"description",
type:"textarea",
width:"100%",
require:true,
showError:false,
},{
name:"隐患照片",
key:"photo",
ref:"photo",
type:"upload",
width:"calc(50% - 20px)",
require:true,
onSucess:this.onSuccess,
onMove:this.onRemove,
showError:false,
autoUpload:true,
onPreview:this.onPreview,
accept:"image/png, image/jpeg",
listType:"picture-card",
fileList:this.photoList,
icon:"el-icon-plus",
},{
name:"相关附件",
key:"file",
ref:"file",
type:"upload",
width:"calc(50% - 20px)",
showError:false,
onSucess:this.onSuccess2,
onMove:this.onRemove2,
onPreview:this.onPreview,
autoUpload:true,
accept:"image/png, image/jpeg,.doc,.docx,.xls,.xlsx,.pdf",
listType:"text",
tip:this.isReadonly?"":"请上传.pdf,.png,.jpg,.doc.docx,.xls,.xlsx格式文件",
fileList:this.fileList,
btn:[{
name:"上传",
value:"upload",
hide:this.isReadonly,
size:"small",
type:"primary"
}]
},{
name:"违章人数",
key:"violateNumber",
type:"number",
width:"calc(50% - 20px)",
require:true,
showError:false,
},{
name:"专业分类",
key:"professionClassify",
format:"professionClassifyName",
type:"select",
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:this.$store.state.prevention_major_type,
},{
name:"发生环节",
key:"occurNode",
format:"occurNodeName",
type:"select",
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:this.$store.state.prevention_occur_step,
},{
name:"违反规定条款",
key:"violateTerm",
type:"textarea",
width:"100%",
require:true,
showError:false,
},{
name:"隐患整改要求",
key:"reformDemand",
type:"textarea",
width:"100%",
require:true,
showError:false,
}]
}
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:"number"});
this.tableColumn.push({name:'整改部门',key:"reformDeptName"});
this.tableColumn.push({name:'隐患级别',render:(data)=>{
return this.levelMap[data.level]
}});
this.tableColumn.push({name:'隐患状态',key:"person"});
this.tableColumn.push({name:'检查人员',key:"isDangrous"});
this.tableColumn.push({name:'检查人员',key:"inspectUserName"});
}
public getMap(map){
this.map = map;
this.addMarker();
}
public addMarker(){
this.marker = new mapboxgl.Marker({draggable:true})
.setLngLat(this.center)
.addTo(this.map);
}
public change(data,item){
if(item && item.key === "areaId"){
this.loadUnitData(data)
}
if(item && item.key === "inspectUserId"){
this.updateParams.inspectUserName = this.$store.getters.user_map[data]
}
if(item && item.key === "reformDeptId"){
this.updateParams.reformDeptName = this.$store.getters.dept_map[data]
}
if(item && item.key === "reformUserId"){
this.updateParams.reformUserName = this.$store.getters.user_map[data]
}
if(item && item.key === "verifyUserId"){
this.updateParams.verifyUserName = this.$store.getters.user_map[data]
}
//
}
public callback(data){
@ -192,15 +459,16 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent<any>
}else if(data.value === "selectAll"){
this.selectAll()
}else if(data.value === "add"){
this.showUpdateModel(-1)
this.showUpdateModel()
}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.value ==="fixed"){
this.showMap = true
}else if(data.value.indexOf("save")>=0){
this.doSave();
}else{
this.handleClose()
}
}
//
@ -213,15 +481,132 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent<any>
public showUpdateModel(id){
if(id!==-1){
public showUpdateModel(row?,isRead?){
this.isReadonly = !!isRead;
this.fileList = [];
this.photoList = [];
this.updateParams = {type:"随手拍",locationName:"",number:null,photo:1}
if(!row){
this.tableService.getNumber().then(res=>{
this.updateParams.number = res.data;
this.center = [118.751353,31.969568];
this.buildUpdateForm()
this.showUpdate = true;
})
}else{
if(isRead){
delete this.updateParams.photo;
}
this.tableService.selectById(row.id).then((res:any)=>{
Object.assign(this.updateParams,{
classifyName:this.$store.getters.prevention_dangrous_type_map[res.data.classify],
dangerTypeName:this.$store.getters.prevention_danger_type_map[res.data.dangerType],
inspectTypeName:this.$store.getters.prevention_danger_check_type_map[res.data.inspectType],
levelName:this.levelMap[res.data.level],
occurNodeName:this.$store.getters.prevention_occur_step_map[res.data.occurNode],
professionClassifyName:this.$store.getters.prevention_major_type_map[res.data.professionClassify],
reformModeName:this.reformModeMap[res.data.reformMode],
unitName:(this.unitList.find((item:any)=>item.value===res.data.unitId) as any).name,
areaName:(this.areaList.find((item:any)=>item.value===res.data.areaId) as any).name,
},res.data)
//
this.center = [res.data.locationLng,res.data.locationLat];
// url
this.tableService.getFileUrls({ids:res.data.resourceId.split(",")}).then((photos:any)=>{
this.photoList = photos.data.map(item=>{
return {
name:item.originalName,
url:item.url,
type:item.type,
id:item.id
}
})
this.buildUpdateForm()
})
this.tableService.getFileUrls({ids:res.data.resourceOtherId.split(",")}).then((files:any)=>{
this.fileList = files.data.map(item=>{
return {
name:item.originalName,
url:item.url,
type:item.type,
id:item.id
}
})
this.buildUpdateForm()
})
this.showUpdate = true
})
}
this.currentId = id;
this.showUpdate = true
}
public onDragEnd() {
const lngLat = this.marker.getLngLat();
this.updateParams.locationLng = lngLat.lng;
this.updateParams.locationLat = lngLat.lat;
this.updateParams.locationName = lngLat.lng+","+lngLat.lat;
this.handleClose()
}
public handleClose(){
if(this.showMap){
this.showMap = false;
this.marker.remove();
this.marker = null;
return
}
this.showUpdate = false;
this.updateParams = {} as any;
}
public onSuccess(res,file,fileList){
if(res.code===200){
this.photoList.push({
name:res.data.originalName,
url:res.data.url,
type:res.data.type,
id:res.data.id
});
}
}
public onSuccess2(res,file,fileList){
if(res.code===200){
this.fileList.push({
name:res.data.originalName,
url:res.data.url,
type:res.data.type,
id:res.data.id
})
}
}
public onRemove(file,fileList){
this.photoList.splice(this.photoList.findIndex(item=>item.id === file.response.data.id),1)
}
public onRemove2(file,fileList){
this.fileList.splice(this.fileList.findIndex(item=>item.id === file.response.data.id),1)
}
public onPreview(file){
console.log(file)
if(file.type.indexOf("png")>=0 || file.type.indexOf("jp")>=0){
this.currentUrl = file.url;
this.showFile = true;
}else{
window.open(file.url,"_blank")
}
}
public doSave(){
this.updateParams.resourceId = this.photoList.map(item=>item.id).join(",")
this.updateParams.resourceName = this.photoList.map(item=>item.name).join(",")
this.updateParams.resourceOtherId = this.fileList.map(item=>item.id).join(",")
this.updateParams.resourceOtherName = this.fileList.map(item=>item.name).join(",")
this.tableService.addOrUpdate(this.updateParams,!this.updateParams.id).then(res=>{
this.$message.success(!this.updateParams.id?"新增成功!":"编辑成功");
this.handleClose();
this.getTableData();
})
}
@ -246,4 +631,5 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent<any>
}
}
</script>
<style lang="scss" scoped src="../common.component.scss"></style>
<style lang="scss" scoped src="../common.component.scss">
</style>

View File

@ -2,33 +2,40 @@
<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"
@selection-change="handleSelectionChange" style="width: 100%">
<el-table-column type="selection" label="全选" width="40">
<el-table-column v-if="!isAction" type="selection" label="全选" width="40">
</el-table-column>
<el-table-column label="序号" width="60">
<div slot-scope="scope">{{scope.$index+1}}</div>
</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" :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" :label="item.name" :width="item.width" :key="item.key">
<el-table-column v-else :prop="item.key" :label="item.name" :filters="item.filters"
:filter-method="item.filterMethod" :width="item.width" :key="item.key">
</el-table-column>
</template>
<el-table-column label="操作" :width="rowActionWidth">
<el-table-column label="操作" :width="tableActionWidth">
<template slot-scope="scope">
<el-button type="text" v-if="isFile" @click="showUpdateModel(scope.row.userId)">查看</el-button>
<el-button type="text" v-if="isBase" @click="showUpdateModel(scope.row.userId)">查看</el-button>
<el-button type="text" v-if="isBase" @click="showUpdateModel(0)">修改</el-button>
<el-button type="text" v-if="isBase" @click="deleteData([scope.row])">删除</el-button>
<el-button type="text" v-if="isPlan" @click="showUpdateModel(0)">下发</el-button>
<el-button type="text" v-if="isPlan" @click="showUpdateModel(0)">检查情况</el-button>
<el-button type="text" v-if="isAction" @click="showUpdateModel(0)">检查</el-button>
<el-button type="text" v-if="isBase" @click="showUpdateModel(scope.row,true)">查看</el-button>
<el-button type="text" v-if="isBase" @click="showUpdateModel(scope.row)">修改</el-button>
<el-button type="text" v-if="isBase" @click="deleteData([scope.row.id])">删除</el-button>
<el-button type="text" v-if="isPlan && !scope.row.status" @click="openSendModel(scope.row)">下发</el-button>
<el-button type="text" v-if="isPlan && scope.row.planType && !scope.row.state" @click="openSendModel(scope.row)">启用</el-button>
<el-button type="text" v-if="isPlan && scope.row.planType && scope.row.state" @click="openSendModel(scope.row)">停用</el-button>
<el-button type="text" v-if="isPlan" @click="openRecordModel(scope.row)">检查情况</el-button>
<el-button type="text" v-if="isAction && scope.row.status!==2" @click="showUpdateModel(0)">检查</el-button>
<el-button type="text" v-if="isManager" @click="showUpdateModel(0)">抄送</el-button>
<el-button type="text" v-if="isManager" @click="showUpdateModel(0)">移交</el-button>
<el-button type="text" v-if="isManager" @click="showUpdateModel(0)">中断</el-button>
@ -41,15 +48,169 @@
</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="isReadonly?'详情':!updateParams.id?'新增':'编辑'" :visible.sync="showUpdate" width="980px"
: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"
<FormComponent ref="form" :options="updateOptions" :isReadonly="isReadonly" labelWidth="110px" labelAlign="right" :data.sync="updateParams"
@actionCallback="callback" :actions="updateActions" :full-btn="true" @change="change"
btn-position="center"></FormComponent>
</el-dialog>
<!-- 下发 -->
<el-dialog v-if="isPlan" :close-on-click-modal="false" title="下发" :visible.sync="showSend" width="980px"
:before-close="handleClose">
<FormComponent :options="sendOptions" labelAlign="right" :data.sync="sendParams" @change="change" :fullBtn="true" btn-position="center" @actionCallback="sendCallback" :actions="updateActions">
<div class="full">
<el-radio-group size="medium" v-model="currentTableId" @change="tabChange">
<el-radio-button :label="item.id" v-for="item in sendTables" :key="item.id">{{item.name}}</el-radio-button>
</el-radio-group>
</div>
<div class="full" style="margin-bottom: 20px;">
<el-table :data="currentTable.tableItems" tooltip-effect="dark" height="100%" width="100%" style="min-height:400px;">
<el-table-column label="序号" width="60">
<div slot-scope="scope">{{scope.$index+1}}</div>
</el-table-column>
<el-table-column label="检查项目" :show-overflow-tooltip="true">
<div slot-scope="scope" v-if="!scope.row.edit">{{scope.row.name}}</div>
<el-input type="text" v-else v-model="scope.row.name"></el-input>
</el-table-column>
<el-table-column label="检查内容" :show-overflow-tooltip="true">
<div slot-scope="scope" v-if="!scope.row.edit">{{scope.row.content}}</div>
<el-input type="textarea" v-else v-model="scope.row.content"></el-input>
</el-table-column>
<el-table-column label="检查依据" :show-overflow-tooltip="true">
<div slot-scope="scope" v-if="!scope.row.edit">{{scope.row.reason}}</div>
<el-input type="textarea" v-else v-model="scope.row.reason"></el-input>
</el-table-column>
<el-table-column label="选择执行人">
<div slot-scope="scope">
<el-select v-model="scope.row.scopeId" filterable placeholder="请选择">
<el-option
v-for="item in $store.state.userList"
:key="item.value"
:label="item.name"
:value="item.value">
</el-option>
</el-select>
</div>
</el-table-column>
<el-table-column label="操作">
<div slot-scope="scope">
<el-button type="text" v-if="!scope.row.edit" @click="scope.row.edit = true">编辑</el-button>
<el-button type="text" v-else @click="scope.row.edit = false">确定</el-button>
<el-button type="text">删除</el-button>
</div>
</el-table-column>
</el-table>
</div>
</FormComponent>
</el-dialog>
<!-- 检查表记录 -->
<el-dialog v-if="isPlan" :close-on-click-modal="false" title="检查表记录" :visible.sync="showRecord" width="980px"
:before-close="handleClose">
<div class="full">
<el-radio-group size="medium" v-model="currentTableId" @change="tabChange">
<el-radio-button :label="item.id" v-for="item in sendTables" :key="item.id">{{item.name}}</el-radio-button>
</el-radio-group>
</div>
<div class="full" style="margin-bottom: 20px;">
<el-table :data="currentTable.tableItems" tooltip-effect="dark" height="100%" width="100%" style="min-height:250px;">
<el-table-column label="序号" width="60">
<div slot-scope="scope">{{scope.$index+1}}</div>
</el-table-column>
<el-table-column label="检查项目" :show-overflow-tooltip="true">
<div slot-scope="scope" v-if="!scope.row.edit">{{scope.row.name}}</div>
<el-input type="text" v-else v-model="scope.row.name"></el-input>
</el-table-column>
<el-table-column label="检查内容" :show-overflow-tooltip="true">
<div slot-scope="scope" v-if="!scope.row.edit">{{scope.row.content}}</div>
<el-input type="textarea" v-else v-model="scope.row.content"></el-input>
</el-table-column>
<el-table-column label="检查依据" :show-overflow-tooltip="true">
<div slot-scope="scope" v-if="!scope.row.edit">{{scope.row.reason}}</div>
<el-input type="textarea" v-else v-model="scope.row.reason"></el-input>
</el-table-column>
<el-table-column label="检查人">
<div slot-scope="scope"></div>
</el-table-column>
<el-table-column label="检查结果">
<div slot-scope="scope"></div>
</el-table-column>
<el-table-column label="检查记录">
<div slot-scope="scope"></div>
</el-table-column>
</el-table>
</div>
<div class="full" style="text-align: right;">
<el-pagination
background
:current-page.sync="recordParams.pageNum"
@current-change="getRecordData"
layout="prev, pager, next"
:total="tableData.totalRecords">
</el-pagination>
</div>
<div class="sub-title">隐患登记情况</div>
<div class="full" style="margin-bottom: 20px;">
<el-table :data="currentTable.tableItems" tooltip-effect="dark" height="100%" width="100%" style="min-height:250px;">
<el-table-column label="序号" width="60">
<div slot-scope="scope">{{scope.$index+1}}</div>
</el-table-column>
<el-table-column label="隐患类型" :show-overflow-tooltip="true">
<div slot-scope="scope" v-if="!scope.row.edit">{{scope.row.name}}</div>
<el-input type="text" v-else v-model="scope.row.name"></el-input>
</el-table-column>
<el-table-column label="隐患等级" :show-overflow-tooltip="true">
<div slot-scope="scope" v-if="!scope.row.edit">{{scope.row.name}}</div>
<el-input type="text" v-else v-model="scope.row.name"></el-input>
</el-table-column>
<el-table-column label="整改方式" :show-overflow-tooltip="true">
<div slot-scope="scope" v-if="!scope.row.edit">{{scope.row.name}}</div>
<el-input type="text" v-else v-model="scope.row.name"></el-input>
</el-table-column>
<el-table-column label="隐患描述" :show-overflow-tooltip="true">
<div slot-scope="scope" v-if="!scope.row.edit">{{scope.row.content}}</div>
<el-input type="textarea" v-else v-model="scope.row.content"></el-input>
</el-table-column>
<el-table-column label="整改部门" :show-overflow-tooltip="true">
<div slot-scope="scope" v-if="!scope.row.edit">{{scope.row.reason}}</div>
<el-input type="textarea" v-else v-model="scope.row.reason"></el-input>
</el-table-column>
<el-table-column label="责任人">
<div slot-scope="scope"> </div>
</el-table-column>
</el-table>
</div>
<div class="full" style="text-align: right;">
<el-pagination
background
:page-size.sync="tableData.pageSize"
:current-page.sync="tableData.pageNum"
@size-change="pageSizeChange"
@current-change="pageNumberChange"
layout="prev, pager, next"
:total="tableData.totalRecords">
</el-pagination>
</div>
</el-dialog>
<el-dialog v-if="showMap" :close-on-click-modal="false" destroy-on-close title="地图定位" :visible.sync="showMap" width="980px"
:before-close="handleClose">
<MapComponent @onLoad="getMap"></MapComponent>
<div class="full" style="margin-top: 20px; text-align: center;">
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="onDragEnd">确定</el-button>
</div>
</el-dialog>
<el-dialog v-if="showFile" :close-on-click-modal="false" title="查看图片" :visible.sync="showFile" destroy-on-close width="680px">
<img :src="currentUrl" style="width: 100%;" alt="">
</el-dialog>
</div>

View File

@ -5,7 +5,7 @@ import template from "./common.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 ManagerService from "@/service/manager.service"
import FormOption from "hbt-common/models/formOptions"
import BtnOption from "hbt-common/models/btnOptions"
import DrawComponent from '@/components/draw.component.vue';
@ -18,7 +18,7 @@ import DrawComponent from '@/components/draw.component.vue';
},
})
export default class HiddenDangerFilesComponent extends BaseRecordComponent<any> {
public tableService = new AreaService();
public tableService = new ManagerService();
public params = {} as any;
@ -35,11 +35,6 @@ export default class HiddenDangerFilesComponent extends BaseRecordComponent<any>
value:"reset"
}];
public tableActions = [{
name:"添加",
value:"add",
icon:"el-icon-plus",
type:"primary"
},{
name:"批量删除",
value:"delete",
plain:true,
@ -200,7 +195,6 @@ export default class HiddenDangerFilesComponent 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"});

View File

@ -19,10 +19,12 @@
</template>
</el-table-column>
<template v-for="item in tableColumn">
<el-table-column v-if="item.render" :show-overflow-tooltip="item.showTip" :label="item.name" :width="item.width" :key="item.key">
<el-table-column v-if="item.render" :show-overflow-tooltip="item.showTip" :filters="item.filters"
:filter-method="item.filterMethod" :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 v-else :prop="item.key" :filters="item.filters"
:filter-method="item.filterMethod" :show-overflow-tooltip="item.showTip" :label="item.name" :width="item.width" :key="item.key">
</el-table-column>
</template>
<el-table-column label="操作" width="200">
@ -54,10 +56,12 @@
<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">
<el-table-column v-if="item.render" :filters="item.filters"
:filter-method="item.filterMethod" :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 v-else :prop="item.key" :filters="item.filters"
:filter-method="item.filterMethod" :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">
@ -90,7 +94,7 @@
<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 type="selection" label="全选" width="60" >
</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">

View File

@ -253,7 +253,8 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
value:item.id
}
});
this.buildUpdateForm()
this.buildUpdateForm();
this.buildTable()
})
}
//
@ -276,12 +277,20 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
}
public buildTable(){
this.tableColumn = [];
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:"types",filters:this.$store.state.prevention_dangrous_type.map(item=>{
item.text = item.name;
item.value = item.name;
delete item.name;
return item
}),filterMethod:(data,row)=>{
return row.types.indexOf(data)>=0;
}});
this.tableColumn.push({name:'编制人',key:"createBy"});
this.tableColumn.push({name:'编制时间',key:"createTime"});
@ -382,10 +391,10 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
} as any;
}
public showSubUpdateModel(row?){
public showSubUpdateModel(row?,isRead?){
this.subUpdateParams = {} as any;
if(!row){
}else{
this.subIsReadonly = !!isRead;
if(row){
this.subUpdateParams = JSON.parse(JSON.stringify(row))
}
this.showSubUpdate = true;

View File

@ -9,6 +9,7 @@ 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 TaskService from '@/service/task.service';
@Component({
template,
components:{
@ -18,9 +19,16 @@ import DrawComponent from '@/components/draw.component.vue';
},
})
export default class RulesManagerComponent extends BaseRecordComponent<any> {
public tableService = new AreaService();
public tableService = new TaskService();
public isAction = true;
//
public isPlan = false;
//
public isBase = false;
public isFile = false;
public tableActionWidth="60px";
public statusList = ["","检查中","已检查","未检查"];
public params = {} as any;
@ -34,38 +42,9 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
icon:"el-icon-tickets",
value:"reset"
}];
public tableActions = [{
name:"添加",
value:"add",
icon:"el-icon-plus",
type:"primary"
},{
name:"批量删除",
value:"delete",
plain:true,
icon:"el-icon-delete",
type:"danger"
}];
public footerActions = [{
name:"选择全部",
value:"selectAll",
type:"primary"
},{
name:"反向选择",
value:"reverse"
}];
public formOptions:FormOption<BtnOption>[] = [{
name:"检查项目",
key:"areaId",
type:"select",
datas:[{
name:"区域1",
value:0
},{
name:"区域2",
value:1
}]
}];
public tableActions = [];
public footerActions = [];
public formOptions:FormOption<BtnOption>[] = [];
public showUpdate = false;
public currentId = -1;
@ -152,10 +131,6 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
}];
public showDraw = false;
public drawModel = "list";
public updateActions = [{
name:"取消",
@ -178,15 +153,38 @@ export default class RulesManagerComponent 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"});
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:"planName"});
this.tableColumn.push({name:'检查类型',render:(data)=>{
return this.$store.getters.prevention_danger_check_type_map[data.inspectType]
}});
this.tableColumn.push({name:'检查对象',key:"analControlNames"});
this.tableColumn.push({name:'检查时间',key:"checkTime"});
this.tableColumn.push({name:'检查负责人',key:"chargeUserName"});
this.tableColumn.push({name:'检查表',key:"tableNum",render:(data)=>{
return "<span class='link'>"+(data.tableNum || 0)+"</span>"
}});
this.tableColumn.push({name:'数据生成时间',key:"createTime"});
this.tableColumn.push({name:'检查周期',key:"inspectCycleValue"});
this.tableColumn.push({name:'单位',render:(data)=>{
return this.$store.getters.prevention_cycle_unit_map[data.inspectCycleUnit]
}});
this.tableColumn.push({name:'状态',key:"status",render:(data)=>{
return "<span class='color_"+(data.status-1)+"'>"+(this.statusList[data.status] || '')+"</span>"
}});
}
public getTableCallback(){
this.formOptions = [{
name:"检查名称",
key:"planName",
type:"text",
},{
name:"检查项目",
key:"inspectType",
type:"select",
datas:this.$store.state.prevention_danger_check_type
}]
}
public callback(data){
@ -206,12 +204,6 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
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;
}
}
//

View File

@ -9,6 +9,10 @@ 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 PlanService from '@/service/plan.service';
import SystemService from 'hbt-common/service/system.service';
import UnitService from '@/service/unit.service';
import TableService from '@/service/table.service';
@Component({
template,
components:{
@ -18,7 +22,15 @@ import DrawComponent from '@/components/draw.component.vue';
},
})
export default class PlanComponent extends BaseRecordComponent<any> {
public tableService = new AreaService();
public tableService = new PlanService();
public systemService = new SystemService();
public areaService = new AreaService();
public unitService = new UnitService();
public checkTableService = new TableService();
public params = {} as any;
//
@ -26,6 +38,19 @@ export default class PlanComponent extends BaseRecordComponent<any> {
//
public isPlan = true;
public isFile = false;
public isAction = false;
public isReadonly = false;
public isManager = false;
public showSend = false;
public showRecord = false;
public tableActionWidth="300px"
public formActions = [{
name:"查询",
value:"search",
@ -58,107 +83,27 @@ export default class PlanComponent extends BaseRecordComponent<any> {
}];
public formOptions:FormOption<BtnOption>[] = [{
name:"检查标题",
key:"areaId",
key:"name",
type:"text",
}];
public sendOptions = [] as 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 updateOptions:FormOption<BtnOption>[] = [];
public showDraw = false;
public drawModel = "list";
public areaList = [] as any;
public areaMap = {} as any;
public unitList = [] as any;
public unitMap = {} as any;
public updateActions = [{
name:"取消",
value:"cancel"
},{
name:"保存并继续添加",
value:"saveAndContinue",
type:"primary"
},{
name:"保存",
value:"save",
@ -166,67 +111,431 @@ export default class PlanComponent extends BaseRecordComponent<any> {
}];
public selectData = [];
public planType = [{
name:"单次计划",
value:0,
},{
name:"长期计划",
value:1,
}];
public planTypeMap = {
0:"单次计划",
1:"长期计划"
}
public stateMap = ["停用","启用"];
public sendParams = {
tables:[]
} as any;
public recordParams = {
pageNum:1,
pageSize:5
} as any;
public recordData = {} as any;
public sendTables = [] as any;
public currentTable = {} as any;
public currentTableId:any = null;
public currentSendRow:any;
public currentPlan:any;
created(){
this.loadAreaData();
this.loadUnitData();
this.getCheckList();
}
public buildUpdateForm(){
this.updateOptions = [{
name:"计划类型",
key:"planType",
type:"radio",
width:"100%",
format:"planTypeName",
require:true,
showError:false,
datas:this.planType
},{
name:"检查标题",
key:"name",
type:"text",
width:"calc(50% - 20px)",
require:true,
showError:false,
},{
name:"类型",
key:"inspectType",
type:"select",
width:"calc(50% - 20px)",
require:true,
format:"inspectTypeName",
showError:false,
datas:this.$store.state.prevention_danger_check_type
},{
name:"巡检周期",
key:"inspectCycleValue",
type:"number",
hide:this.updateParams.planType===0,
controls:false,
width:"calc(50% - 20px)",
require:true,
showError:false,
},{
name:"巡检周期单位",
key:"inspectCycleUnit",
format:"inspectCycleUnitName",
type:"select",
hide:this.updateParams.planType===0,
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:this.$store.state.prevention_cycle_unit
},{
name:"检查区域",
key:"areaIds",
format:"areaNames",
type:"select",
multiple:true,
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:this.areaList
},{
name:"检查单元",
key:"unitIds",
format:"unitNames",
type:"select",
width:"calc(50% - 20px)",
require:true,
multiple:true,
showError:false,
datas:this.unitList
},{
name:"检查对象",
key:"analControlIds",
format:"analControlNames",
type:"select",
width:"calc(50% - 20px)",
require:true,
multiple:true,
showError:false,
datas:[{
name:"是",
value:"1-123123123"
},{
name:"否",
value:"0-1231221312"
}]
},{
name:"计划检查时间",
key:"startTime",
type:"date",
subType:"datetime",
hide:this.updateParams.planType===0,
format:"yyyy-MM-dd HH:mm",
width:"calc(50% - 20px)",
require:true,
showError:false,
},{
name:"检查时间",
key:"time",
type:"date",
hide:this.updateParams.planType===1,
subType:"datetimerange",
format:"yyyy-MM-dd HH:mm",
width:"calc(50% - 20px)",
require:true,
showError:false,
},{
name:"检查负责人",
key:"chargeUserId",
format:"chargeUserName",
type:"select",
width:"calc(50% - 20px)",
require:true,
showError:false,
filterable:true,
datas:this.$store.state.userList
},{
name:"检查范围",
type:"textarea",
width:"100%",
key:"scope",
require:true,
showError:false,
placeholder:"请输入检查范围"
},{
name:"检查目的",
type:"textarea",
width:"100%",
key:"purpose",
require:true,
showError:false,
placeholder:"请输入检查目的"
}]
}
public getCheckList(){
this.checkTableService.selectByPage({pageSize:1000}).then((res:any)=>{
this.sendOptions = [{
name:"选择检查表",
key:"tables",
type:"select",
require:true,
width:"600px",
multiple:true,
showError:false,
datas:res.data.datas.map(item=>{
return{
name:item.name,
value:item.id
}
})
}]
})
}
//
public loadAreaData(){
this.areaService.selectByPage({pageSize:1000}).then((res:any)=>{
this.areaList = res.data.datas.map(item=>{
this.areaMap[item.id]=item.name;
return {
name:item.name,
value:item.id
}
});
})
}
//
public loadUnitData(ids?){
this.unitService.getListByIds({areaIds:ids},false).then((res:any)=>{
this.unitList = res.data.map(item=>{
this.unitMap[item.id]=item.name;
return {
name:item.name,
value:item.id
}
});
this.buildUpdateForm()
})
}
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:"name"});
this.tableColumn.push({name:'检查类型',width:"270px",render:(data)=>{
return this.$store.getters.prevention_danger_check_type_map[data.inspectType]
}});
this.tableColumn.push({name:'检查时间',width:"100px",render:(data)=>{
return data.startTime + (data.endTime?'~'+data.endTime:"")
}});
this.tableColumn.push({name:'检查负责人',key:"chargeUserName"});
this.tableColumn.push({name:'检查范围',width:"270px",key:"scope"});
this.tableColumn.push({name:'发现隐患数量',key:"dangerCount"});
this.tableColumn.push({name:'检查类型',render:(data)=>{
return this.planTypeMap[data.planType]
}});
this.tableColumn.push({name:'状态',render:(data)=>{
return data.state==undefined?"--":`<span class="color_${data.state}">${this.stateMap[data.state]}</span>`
}});
}
//
public buildSendTable(datas){
datas.forEach(async (item)=>{
if(this.sendTables.find(items=>items.id === item)){
return
}
const data = (await this.checkTableService.selectById(item)).data as any;
data.tableItems = data.tableItems.map(itm=>{
return Object.assign({
edit:false,
tableId:data.id,
tableItemId:itm.id,
tableName:data.name,
scopeId:this.currentPlan.chargeUserId,
},itm)
})
if(!this.currentTableId){
this.currentTableId = data.id;
this.currentTable = data;
}
this.sendTables.push(data)
});
}
public callback(data){
public tabChange(data){
this.currentTable = this.sendTables.find(item=>item.id===data)
}
public change(data,item){
if(item && item.key === "tables"){
this.buildSendTable(data);
}
if(item && item.key === "planType"){
this.buildUpdateForm();
}
if(item && item.key === "areaIds"){
this.loadUnitData(data)
}
if(item && item.key === "chargeUserId"){
this.updateParams.chargeUserName = this.$store.getters.user_map[data]
}
if(item && item.key==="analControlIds"){
this.updateParams.analControls = data.map((itm)=>{
return {
id:itm,
name:itm
}
})
}
if(item && item.key === "time"){
if(data && data.length){
this.updateParams.startTime = data[0]
this.updateParams.endTime = data[1]
}else{
this.updateParams.startTime = null
this.updateParams.endTime = null
}
}
}
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 === "save"){
this.doSave()
}else if(data && data.value === "cancel"){
this.handleClose()
}
}
public sendCallback(data){
if(data && data.value === "save"){
this.tableService.deliver({
deliverContents:this.sendTables.map(item=>item.tableItems).flat(1),
planReq:this.currentPlan,
}).then(()=>{
this.$message.success("下发成功!")
this.currentPlan=null;
this.showSend = false;
this.sendTables = [];
this.sendParams.tables = [];
this.getTableData()
})
}else if(data && data.value === "cancel"){
this.handleClose()
}
}
//
public reset(){
this.params = {
name:"",
pageNum:1,
pageSize:20,
} as any;
}
public showUpdateModel(id){
if(id!==-1){
//
public showUpdateModel(row?,isRead?){
this.isReadonly = !!isRead;
if(row){
this.updateParams = Object.assign({
analControls:row.analControlIds,
planTypeName:this.planTypeMap[row.planType],
time:row.startTime+"~"+row.endTime,
areaNames:row.areaIds.map(item=>this.areaMap[item]).join(";"),
unitNames:row.unitIds.map(item=>this.unitMap[item]).join(";"),
inspectTypeName:this.$store.getters.prevention_danger_check_type_map[row.inspectType],
inspectCycleUnitName:this.$store.getters.prevention_cycle_unit_map[row.inspectCycleUnit]
},row);
}else{
this.updateParams = {planType:0} as any;
}
this.currentId = id;
this.buildUpdateForm();
this.showUpdate = true
}
//
public openSendModel(row){
this.currentPlan = row;
this.showSend = true
}
public openRecordModel(row){
this.showRecord = true;
this.recordParams.planTableId = row.id;
this.getRecordData()
}
public getRecordData(data?){
if(data){
this.recordParams.pageNum = data
}
this.tableService.getRecordList(this.recordParams).then(res=>{
this.recordData = res.data
})
}
public handleClose(){
if(this.showSend){
this.sendParams.tables = [];
this.currentTable = {} as any;
this.sendTables = [];
this.currentPlan = null;
this.currentTableId = null;
this.showSend = false;
return
}
if(this.showRecord){
this.showRecord = false;
return
}
this.showUpdate = false;
}
public doSave(){
this.tableService.addOrUpdate(this.updateParams,!this.updateParams.id).then(res=>{
this.$message.success(!this.updateParams.id?"新增成功!":"编辑成功!")
this.getTableData();
this.handleClose();
})
}
public toggleAll() {
(this.$refs.multipleTable as any).toggleAllSelection();

View File

@ -9,7 +9,7 @@
@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" height="100%" border
@selection-change="handleSelectionChange" style="width: 100%">
<el-table-column type="selection" label="全选">
</el-table-column>