feat:新增安全检查执行

kongyeqing
吴延福 2023-06-25 17:06:34 +08:00
parent a2b47a315e
commit 4326768a2b
6 changed files with 164 additions and 77 deletions

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

@ -54,4 +54,9 @@ export default class TaskService extends BaseService<any>{
const url = this.prefix.prevention+'/danger/trouble/list';
return this.get(url,params,true)
}
public addRecord(params: any,showLoading?:boolean):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/record';
return this.post(url,params,{},showLoading)
}
}

View File

@ -19,7 +19,7 @@
<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">
<div slot-scope="scope" v-html="item.render(scope.row)"></div>
<div slot-scope="scope" @click="" v-html="item.render(scope.row)" style="pointer-events: none;" @click="showCheckTable($event,scope.row)"></div>
</el-table-column>
<el-table-column v-else :prop="item.key" :label="item.name" :filters="item.filters"
:filter-method="item.filterMethod" :width="item.width" :key="item.key">
@ -59,7 +59,7 @@
</div>
<div class="full" style="margin: 20px 0;">
<el-table :data="currentTable.tableItems" tooltip-effect="dark" height="100%" border width="100%" style="min-height:250px;">
<el-table :data="currentTable.tableItems" tooltip-effect="dark" border width="100%" height="250">
<el-table-column label="序号" width="60">
<div slot-scope="scope">{{scope.$index+1}}</div>
</el-table-column>
@ -80,7 +80,8 @@
</el-table-column>
<el-table-column label="检查结果" width="160px">
<div slot-scope="scope">
<el-radio-group v-model="scope.row.itemResult">
<span v-if="hideActions || isPlan" :class="'color_'+scope.row.itemResult">{{['异常','正常'][scope.row.itemResult]}}</span>
<el-radio-group v-else v-model="scope.row.itemResult" :disabled="!scope.row.userIds.includes(account.userId)">
<el-radio :label="1">正常</el-radio>
<el-radio :label="0">异常</el-radio>
</el-radio-group>
@ -88,43 +89,52 @@
</el-table-column>
<el-table-column label="检查记录" width="280px">
<div slot-scope="scope">
<el-input type="textarea" v-model="scope.row.itemRecord"></el-input>
<span v-if="hideActions || isPlan">{{scope.row.itemRecord}}</span>
<el-input v-else type="textarea" v-model="scope.row.itemRecord"></el-input>
</div>
</el-table-column>
</el-table>
</div>
<div class="sub-title">隐患登记情况</div>
<div class="full" v-if="isAction">
<div class="sub-title" v-if="!hideActions">隐患登记情况</div>
<div class="full" v-if="isAction && !hideActions">
<el-button type="success" plain @click="showUpdateModel()" icon="el-icon-plus">添加</el-button>
<el-button type="danger" plain @click="callback({value:'delete'})" icon="el-icon-delete">批量删除</el-button>
</div>
<div class="full" style="margin-bottom: 20px;">
<el-table ref="multipleTable" @selection-change="handleSelectionChange" :data="troubleTableData" tooltip-effect="dark" height="100%" width="100%" style="min-height:250px;">
<el-table-column v-if="isAction" type="selection" label="全选" width="40"></el-table-column>
<div class="full" style="margin-bottom: 20px;" v-if="!hideActions">
<el-table ref="multipleTable" @selection-change="handleSelectionChange" :data="troubleTableData" border tooltip-effect="dark" width="100%" height="250">
<el-table-column v-if="isAction" type="selection" label="全选" width="60">
</el-table-column>
<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">{{$store.getters.prevention_dangrous_type_map[scope.row.classify]}}</div>
<el-input type="text" v-else v-model="scope.row.name"></el-input>
<div slot-scope="scope">{{$store.getters.prevention_dangrous_type_map[scope.row.classify]}}</div>
</el-table-column>
<el-table-column label="隐患等级" :show-overflow-tooltip="true">
<div slot-scope="scope" v-if="!scope.row.edit">{{levelMap[scope.row.level]}}</div>
<div slot-scope="scope">{{levelMap[scope.row.level]}}</div>
</el-table-column>
<el-table-column label="整改方式" :show-overflow-tooltip="true">
<div slot-scope="scope" v-if="!scope.row.edit">{{reformModeMap[scope.row.reformMode]}}</div>
<div slot-scope="scope">{{reformModeMap[scope.row.reformMode]}}</div>
</el-table-column>
<el-table-column label="隐患描述" :show-overflow-tooltip="true">
<div slot-scope="scope" v-if="!scope.row.edit">{{scope.row.description}}</div>
<div slot-scope="scope">
{{scope.row.description}}
<el-image
style="width: 60px; margin-left: 10px;"
:src="currentUrl"
:preview-src-list="srcList">
</el-image>
</div>
</el-table-column>
<el-table-column label="整改部门" :show-overflow-tooltip="true">
<div slot-scope="scope" v-if="!scope.row.edit">{{scope.row.reformDeptName}}</div>
<div slot-scope="scope">{{scope.row.reformDeptName}}</div>
</el-table-column>
<el-table-column label="责任人">
<div slot-scope="scope"> {{scope.row.reformUserName}}</div>
</el-table-column>
<el-table-column label="责任人">
<el-table-column label="操作" v-if="isAction">
<div slot-scope="scope">
<el-button type="text" @click="showUpdateModel(scope.row,true)">查看</el-button>
<el-button type="text" @click="showUpdateModel(scope.row)">编辑</el-button>
@ -132,6 +142,10 @@
</el-table-column>
</el-table>
</div>
<div class="full" style="text-align: center;" v-if="isAction">
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="doCheck" v-if="!hideActions">保存并提交</el-button>
</div>
</el-dialog>
<el-dialog :close-on-click-modal="false" :title="isReadonly?'详情':!updateParams.id?'新增':'编辑'" :visible.sync="showUpdate" width="980px"

View File

@ -49,40 +49,7 @@ export default class HiddenDangerFilesComponent extends BaseRecordComponent<any>
name:"反向选择",
value:"reverse"
}];
public formOptions:FormOption<BtnOption>[] = [{
name:"隐患等级",
key:"areaId",
type:"select",
datas:[{
name:"区域1",
value:0
},{
name:"区域2",
value:1
}]
},{
name:"隐患分类",
key:"areaId",
type:"select",
datas:[{
name:"区域1",
value:0
},{
name:"区域2",
value:1
}]
},{
name:"整改方式",
key:"areaId",
type:"select",
datas:[{
name:"区域1",
value:0
},{
name:"区域2",
value:1
}]
}];
public formOptions:FormOption<BtnOption>[] = [];
public showUpdate = false;
public currentId = -1;
@ -194,6 +161,37 @@ export default class HiddenDangerFilesComponent extends BaseRecordComponent<any>
}
public getTableCallback(){
this.formOptions = [{
name:"隐患等级",
key:"level",
type:"select",
datas:[{
name:"一般隐患",
value:1
},{
name:"重大隐患",
value:2
}]
},{
name:"隐患分类",
key:"classify",
type:"select",
datas:this.$store.state.prevention_dangrous_type
},{
name:"整改方式",
key:"reformMode",
type:"select",
datas:[{
name:"即查即改",
value:1
},{
name:"限期整改",
value:2
}]
}]
}
public buildTable(){
this.tableColumn.push({name:'隐患整改状态',key:"areaName"});
this.tableColumn.push({name:'隐患来源',key:"deptName"});

View File

@ -34,6 +34,8 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
public tableActionWidth="60px";
public statusList = ["","检查中","已检查","未检查"];
public account = JSON.parse(localStorage.getItem("account") as string);
//
public hideActions = false;
public params = {} as any;
@ -115,7 +117,18 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
this.tableColumn.push({name:'单位',render:(data)=>{
return this.$store.getters.prevention_cycle_unit_map[data.inspectCycleUnit]
}});
this.tableColumn.push({name:'状态',key:"status",render:(data)=>{
this.tableColumn.push({name:'状态',filters:[{
text:"检查中",
value:1
},{
text:"已检查",
value:2
},{
text:"未检查",
value:3
}],filterMethod:(data,row)=>{
return row.status === data
},key:"status",render:(data)=>{
return "<span class='color_"+(data.status-1)+"'>"+(this.statusList[data.status] || '')+"</span>"
}});
@ -352,7 +365,12 @@ export default class RulesManagerComponent 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()
@ -422,12 +440,18 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
return
}
if(this.showRecord){
if(this.hideActions){
this.hideActions = false;
}
this.showRecord = false;
this.recordParams = {
taskId:null,
tableId:null,
}
this.tableTabs = [];
this.currentTable = {} as any;
this.currentTableId = null
return
}
}
@ -570,9 +594,16 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
this.tableTabs.forEach(async item=>{
this.recordParams.tableId = item.id;
const datas = (await this.tableService.getRecordList(this.recordParams)).data as any;
item.tableItems = datas.map(item=>{
item.itemResult = 1;
return item
item.tableItems = datas.map(subItem=>{
subItem.userIds = subItem.itemExecuteIds?subItem.itemExecuteIds.split(",").map(id=>+id):[];
//
if(subItem.userIds.includes(this.account.userId)){
console.log(subItem.userIds)
if(!subItem.itemResult && subItem.itemResult!==0){
subItem.itemResult = 1
}
}
return subItem
})
})
this.currentTableId = this.tableTabs[0].id;
@ -610,6 +641,44 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
this.selectData = data;
}
public doCheck(){
const params = [] as any;
let total = 0;
this.tableTabs.forEach(item=>{
total+=item.tableItems.length;
item.tableItems.forEach(subItem=>{
console.log(subItem)
if(subItem.userIds.includes(this.account.userId)){
params.push({
content:subItem.itemRecord,
resultFlag:subItem.itemResult,
taskTableId:subItem.itemId,
taskId:this.recordParams.taskId,
inspectUserId:this.account.userId,
inspectUserName:this.account.nickName,
})
}
})
})
this.tableService.addRecord({
dangerInspectTaskRecords:params,
total,
}).then(res=>{
this.$message.success("检查成功");
this.handleClose();
this.getTableData()
})
}
public showCheckTable(el,data){
const isTarget = el.target.classList.contains("link");
if(isTarget){
this.hideActions = true;
this.openRecordModel(data)
}
}
}
</script>

View File

@ -51,6 +51,9 @@ export default class PlanComponent extends BaseRecordComponent<any> {
public tableActionWidth="300px"
public levelMap = ["","一般隐患","重大隐患"]
public reformModeMap = ["","即查即改","限期整改"]
public formActions = [{
name:"查询",
value:"search",
@ -112,6 +115,8 @@ export default class PlanComponent extends BaseRecordComponent<any> {
public selectData = [];
public troubleTableData = [] as any;
public planType = [{
name:"单次计划",
value:1,
@ -133,8 +138,6 @@ export default class PlanComponent extends BaseRecordComponent<any> {
public recordParams = {
taskId:null,
tableId:null,
pageNum:1,
pageSize:5
} as any;
public recordData = {} as any;
@ -526,7 +529,9 @@ export default class PlanComponent extends BaseRecordComponent<any> {
public openRecordModel(row){
this.showRecord = true;
this.recordParams.taskId = row.latestExecuteId;
this.recordParams.planId = row.id
this.getTabsData()
this.getTroubleList();
}
public getTabsData(){
@ -535,34 +540,32 @@ export default class PlanComponent extends BaseRecordComponent<any> {
return {
name:item.tableName,
id:item.tableId,
tableItems:[]
}
})
if(!this.recordParams.tableId){
this.recordParams.tableId = this.tableTabs[0].id;
this.getRecordTableData()
}
this.tableTabs.forEach(async item=>{
this.recordParams.tableId = item.id;
const datas = (await this.tableService.getRecordList(this.recordParams)).data as any;
item.tableItems = datas;
})
this.currentTableId = this.tableTabs[0].id;
this.currentTable = this.tableTabs[0]
})
}
public getRecordTableData(data?){
if(data){
this.recordParams.pageNum = data
}
this.tableService.getRecordList(this.recordParams).then((res:any)=>{
this.currentTable = res.data
public getTroubleList(){
this.tableService.getTroubleList(this.recordParams).then(res=>{
this.troubleTableData = res.data
})
}
public handleClose(){
this.tableTabs = [];
this.currentTableId = null;
this.currentTable = {tableItems:[]} as any;
if(this.showSend){
this.sendParams.tables = [];
this.currentTable = {tableItems:[]} as any;
this.tableTabs = [];
this.currentPlan = null;
this.currentTableId = null;
this.showSend = false;
return
@ -572,8 +575,6 @@ export default class PlanComponent extends BaseRecordComponent<any> {
this.recordParams = {
taskId:null,
tableId:null,
pageNum:1,
pageSize:5
}
return