feat:新增安全计划执行

kongyeqing
吴延福 2023-06-25 09:49:34 +08:00
parent d76d951c2f
commit a2b47a315e
5 changed files with 530 additions and 110 deletions

View File

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

View File

@ -12,7 +12,7 @@ export default class TaskService extends BaseService<any>{
} }
// 批量删除 // 批量删除
public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{ public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/task'; const url = this.prefix.prevention+'/danger/trouble';
return this.deleteBatch(url,params,{},true) return this.deleteBatch(url,params,{},true)
} }
public selectById(id:any,showLoading?:boolean):Promise<AxiosResponse<ActionResult<any>>>{ public selectById(id:any,showLoading?:boolean):Promise<AxiosResponse<ActionResult<any>>>{
@ -21,13 +21,19 @@ export default class TaskService extends BaseService<any>{
} }
public getNumber():Promise<AxiosResponse<ActionResult<any>>>{ public getNumber():Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/table/number'; const url = this.prefix.prevention+'/danger/trouble/number';
return this.get(url,null) return this.get(url,null)
} }
public getFileUrls(params):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.file+'/getSysFiles';
return this.get(url,params,false)
}
// 新增或更新 // 新增或更新
public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{ public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/danger/task'; const url = this.prefix.prevention+'/danger/trouble';
if(add){ if(add){
return this.post(url,params,{},showLoading) return this.post(url,params,{},showLoading)
}else{ }else{

View File

@ -488,7 +488,6 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent<any>
inspectUserId:this.account.userId, inspectUserId:this.account.userId,
inspectUserName:this.account.nickName, inspectUserName:this.account.nickName,
number:null, number:null,
photo:1,
inspectTime:moment().format("YYYY-MM-DD HH:mm") inspectTime:moment().format("YYYY-MM-DD HH:mm")
} }
if(!row){ if(!row){
@ -520,6 +519,7 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent<any>
this.buildUpdateForm() this.buildUpdateForm()
// url // url
if(res.data.resourceId){
this.tableService.getFileUrls({ids:res.data.resourceId.split(",")}).then((photos:any)=>{ this.tableService.getFileUrls({ids:res.data.resourceId.split(",")}).then((photos:any)=>{
this.photoList = photos.data.map(item=>{ this.photoList = photos.data.map(item=>{
return { return {
@ -531,6 +531,8 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent<any>
}) })
this.buildUpdateForm() this.buildUpdateForm()
}) })
}
if(res.data.resourceOtherId){
this.tableService.getFileUrls({ids:res.data.resourceOtherId.split(",")}).then((files:any)=>{ this.tableService.getFileUrls({ids:res.data.resourceOtherId.split(",")}).then((files:any)=>{
this.fileList = files.data.map(item=>{ this.fileList = files.data.map(item=>{
return { return {
@ -542,6 +544,7 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent<any>
}) })
this.buildUpdateForm() this.buildUpdateForm()
}) })
}
this.showUpdate = true this.showUpdate = true
}) })
} }
@ -575,6 +578,7 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent<any>
type:res.data.type, type:res.data.type,
id:res.data.id id:res.data.id
}); });
this.updateParams.photo = this.photoList.length
} }
} }
public onSuccess2(res,file,fileList){ public onSuccess2(res,file,fileList){
@ -590,6 +594,7 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent<any>
public onRemove(file,fileList){ public onRemove(file,fileList){
this.photoList.splice(this.photoList.findIndex(item=>item.id === file.response.data.id),1) this.photoList.splice(this.photoList.findIndex(item=>item.id === file.response.data.id),1)
this.updateParams.photo = this.photoList.length
} }
public onRemove2(file,fileList){ public onRemove2(file,fileList){
this.fileList.splice(this.fileList.findIndex(item=>item.id === file.response.data.id),1) this.fileList.splice(this.fileList.findIndex(item=>item.id === file.response.data.id),1)

View File

@ -49,6 +49,91 @@
</div> </div>
</div> </div>
<!-- 检查表记录 -->
<el-dialog v-if="isPlan || isAction" :close-on-click-modal="false" :title="isPlan?'检查表记录':'检查表'" :visible.sync="showRecord" width="980px"
:before-close="handleClose">
<div class="full">
<el-radio-group size="medium" v-model="currentTableId" @change="sendTabChange">
<el-radio-button :label="item.id" v-for="item in tableTabs" :key="item.id">{{item.name}}</el-radio-button>
</el-radio-group>
</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-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.itemName}}</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.itemContent}}</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.itemReason}}</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">{{scope.row.itemExecuteNames}}</div>
</el-table-column>
<el-table-column label="检查结果" width="160px">
<div slot-scope="scope">
<el-radio-group v-model="scope.row.itemResult">
<el-radio :label="1">正常</el-radio>
<el-radio :label="0">异常</el-radio>
</el-radio-group>
</div>
</el-table-column>
<el-table-column label="检查记录" width="280px">
<div slot-scope="scope">
<el-input 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">
<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>
<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>
</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>
</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>
</el-table-column>
<el-table-column label="隐患描述" :show-overflow-tooltip="true">
<div slot-scope="scope" v-if="!scope.row.edit">{{scope.row.description}}</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>
</el-table-column>
<el-table-column label="责任人">
<div slot-scope="scope"> {{scope.row.reformUserName}}</div>
</el-table-column>
<el-table-column label="责任人">
<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>
</div>
</el-table-column>
</el-table>
</div>
</el-dialog>
<el-dialog :close-on-click-modal="false" :title="isReadonly?'详情':!updateParams.id?'新增':'编辑'" :visible.sync="showUpdate" width="980px" <el-dialog :close-on-click-modal="false" :title="isReadonly?'详情':!updateParams.id?'新增':'编辑'" :visible.sync="showUpdate" width="980px"
:before-close="handleClose"> :before-close="handleClose">
<FormComponent ref="form" :options="updateOptions" :isReadonly="isReadonly" labelWidth="110px" labelAlign="right" :data.sync="updateParams" <FormComponent ref="form" :options="updateOptions" :isReadonly="isReadonly" labelWidth="110px" labelAlign="right" :data.sync="updateParams"
@ -108,87 +193,6 @@
</FormComponent> </FormComponent>
</el-dialog> </el-dialog>
<!-- 检查表记录 -->
<el-dialog v-if="isPlan || isAction" :close-on-click-modal="false" :title="isPlan?'检查表记录':'检查表'" :visible.sync="showRecord" width="980px"
:before-close="handleClose">
<div class="full">
<el-radio-group size="medium" v-model="currentTableId" @change="sendTabChange">
<el-radio-button :label="item.id" v-for="item in tableTabs" :key="item.id">{{item.name}}</el-radio-button>
</el-radio-group>
</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-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.itemName}}</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.itemContent}}</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.itemReason}}</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">{{scope.row.itemExecuteNames}}</div>
</el-table-column>
<el-table-column label="检查结果" width="160px">
<div slot-scope="scope">
<el-radio-group v-model="scope.row.itemResult">
<el-radio :label="1">正常</el-radio>
<el-radio :label="0">异常</el-radio>
</el-radio-group>
</div>
</el-table-column>
<el-table-column label="检查记录" width="280px">
<div slot-scope="scope">
<el-input 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">
<el-button type="success" plain icon="el-icon-plus">添加</el-button>
<el-button type="danger" plain icon="el-icon-delete">批量删除</el-button>
</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>
</el-dialog>
<el-dialog v-if="showMap" :close-on-click-modal="false" destroy-on-close title="地图定位" :visible.sync="showMap" width="980px" <el-dialog v-if="showMap" :close-on-click-modal="false" destroy-on-close title="地图定位" :visible.sync="showMap" width="980px"
:before-close="handleClose"> :before-close="handleClose">

View File

@ -10,12 +10,16 @@ import FormOption from "hbt-common/models/formOptions"
import BtnOption from "hbt-common/models/btnOptions" import BtnOption from "hbt-common/models/btnOptions"
import DrawComponent from '@/components/draw.component.vue'; import DrawComponent from '@/components/draw.component.vue';
import TaskService from '@/service/task.service'; import TaskService from '@/service/task.service';
import MapComponent from "@/components/map.component.vue"
import mapboxgl from "mapbox-gl";
import moment from 'moment';
@Component({ @Component({
template, template,
components:{ components:{
FormComponent, FormComponent,
TableComponent, TableComponent,
DrawComponent, DrawComponent,
MapComponent
}, },
}) })
export default class RulesManagerComponent extends BaseRecordComponent<any> { export default class RulesManagerComponent extends BaseRecordComponent<any> {
@ -29,9 +33,12 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
public isFile = false; public isFile = false;
public tableActionWidth="60px"; public tableActionWidth="60px";
public statusList = ["","检查中","已检查","未检查"]; public statusList = ["","检查中","已检查","未检查"];
public account = JSON.parse(localStorage.getItem("account") as string);
public params = {} as any; public params = {} as any;
public idReadonly = false;
public formActions = [{ public formActions = [{
name:"查询", name:"查询",
value:"search", value:"search",
@ -42,6 +49,14 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
icon:"el-icon-tickets", icon:"el-icon-tickets",
value:"reset" value:"reset"
}]; }];
public updateActions = [{
name:"取消",
value:"cancel"
},{
name:"保存",
value:"save",
type:"primary"
}];
public tableActions = []; public tableActions = [];
public footerActions = []; public footerActions = [];
public formOptions:FormOption<BtnOption>[] = []; public formOptions:FormOption<BtnOption>[] = [];
@ -61,7 +76,24 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
public currentTableId:any = null; public currentTableId:any = null;
public troubleTableData = {} as any; public troubleTableData = [] as any;
public selectData = [];
public showUpdate = false;
public showMap = false;
public center = [118.751353,31.969568];
public marker:any;
public isReadonly = false;
public fileList = [] as any;
public photoList = [] as any;
public map:any;
public showFile = false;
public currentUrl = "";
public levelMap = ["","一般隐患","重大隐患"]
public reformModeMap = ["","即查即改","限期整改"]
created(){ created(){
@ -104,17 +136,20 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
name:"隐患编号", name:"隐患编号",
key:"number", key:"number",
disable:true, disable:true,
width:"100%",
require:true, require:true,
showError:false, showError:false,
type:"text" type:"text"
},{ },{
name:"隐患标题", name:"隐患标题",
key:"name", key:"title",
width:"100%",
require:true, require:true,
showError:false, showError:false,
type:"text" type:"text"
},{ },{
name:"隐患描述", name:"隐患描述",
width:"100%",
key:"description", key:"description",
require:true, require:true,
showError:false, showError:false,
@ -134,9 +169,189 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
name:"重大隐患", name:"重大隐患",
value:2 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",
name:this.isReadonly?"查看定位":"点击定位",
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:"dangerType",
format:"dangerTypeName",
type:"select",
width:"100%",
require:true,
showError:false,
datas:this.$store.state.prevention_danger_type,
},{
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)",
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:"attributeClassify",
format:"attributeClassifyName",
type:"select",
width:"calc(50% - 20px)",
showError:false,
datas:this.$store.state.prevention_safe_reason,
},{
name:"发生环节",
key:"occurNode",
format:"occurNodeName",
type:"select",
width:"calc(50% - 20px)",
showError:false,
datas:this.$store.state.prevention_occur_step,
},{
name:"违反规定条款",
key:"violateTerm",
type:"textarea",
width:"100%",
showError:false,
},{
name:"隐患整改要求",
key:"reformDemand",
type:"textarea",
width:"100%",
showError:false,
}] }]
} }
public change(data,item){
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){ public callback(data){
// //
if(data.value==="search"){ if(data.value==="search"){
@ -144,8 +359,37 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
// //
}else if(data.value === "reset"){ }else if(data.value === "reset"){
this.reset() this.reset()
//
}else if(data.value === "reverse"){
this.toggleAll()
//
}else if(data.value === "selectAll"){
this.selectAll()
}else if(data.value === "delete"){
console.log(this.selectData)
this.deleteData(this.selectData.map((item:any)=>item.id))
this.getTroubleList();
}else if(data.value ==="fixed"){
this.showMap = true
}else if(data.value.indexOf("save")>=0){
this.doSave();
}else{
this.handleClose()
} }
} }
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.getTroubleList();
})
}
// //
public reset(){ public reset(){
this.params = { this.params = {
@ -154,7 +398,29 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
} as any; } as any;
} }
public getMap(map){
this.map = map;
this.addMarker();
}
public addMarker(){
this.marker = new mapboxgl.Marker({draggable:!this.isReadonly})
.setLngLat(this.center)
.addTo(this.map);
this.map.flyTo({center:this.center})
}
public handleClose(){ public handleClose(){
if(this.showMap){
this.showMap = false;
this.marker.remove();
this.marker = null;
return
}
if(this.showUpdate){
this.showUpdate = false;
this.updateParams = {} as any;
return
}
if(this.showRecord){ if(this.showRecord){
this.showRecord = false; this.showRecord = false;
this.recordParams = { this.recordParams = {
@ -166,10 +432,129 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
} }
} }
public onDragEnd() {
const lngLat = this.marker.getLngLat();
this.updateParams.locationLng = lngLat.lng;
this.updateParams.locationLat = lngLat.lat;
this.center = [lngLat.lng,lngLat.lat]
// this.updateParams.locationName = lngLat.lng+","+lngLat.lat;
this.handleClose()
}
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
});
this.updateParams.photo = this.photoList.length || null
}
}
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)
this.updateParams.photo = this.photoList.length
}
public onRemove2(file,fileList){
this.fileList.splice(this.fileList.findIndex(item=>item.id === file.response.data.id),1)
}
public onPreview(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 showUpdateModel(row?,isRead?){
this.isReadonly = !!isRead;
this.fileList = [];
this.photoList = [];
this.updateParams = {
taskId:this.recordParams.taskId,
locationName:"",
inspectUserId:this.account.userId,
inspectUserName:this.account.nickName,
number:null,
planId:this.recordParams.planId,
inspectTime:moment().format("YYYY-MM-DD HH:mm")
}
if(!row){
this.tableService.getNumber().then(res=>{
this.updateParams.number = res.data;
this.center = [118.751353,31.969568];
this.getTableCallback();
this.showUpdate = true;
})
}else{
if(isRead){
delete this.updateParams.photo;
}
Object.assign(this.updateParams,{
classifyName:this.$store.getters.prevention_dangrous_type_map[row.classify],
dangerTypeName:this.$store.getters.prevention_danger_type_map[row.dangerType],
inspectTypeName:this.$store.getters.prevention_danger_check_type_map[row.inspectType],
levelName:this.levelMap[row.level],
attributeClassifyName:this.$store.getters.prevention_safe_reason_map[row.attributeClassify],
professionClassifyName:this.$store.getters.prevention_major_type_map[row.professionClassify],
reformModeName:this.reformModeMap[row.reformMode],
},row)
// url
if(row.resourceId){
this.tableService.getFileUrls({ids:row.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.getTableCallback()
})
}
if(row.resourceOtherId){
this.tableService.getFileUrls({ids:row.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.getTableCallback()
})
}
this.center = [row.locationLng,row.locationLat];
this.showUpdate = true
}
}
public openRecordModel(row){ public openRecordModel(row){
this.showRecord = true; this.showRecord = true;
this.recordParams.taskId = row.id; this.recordParams.taskId = row.id;
this.recordParams.planId = row.planId
this.getTabsData() this.getTabsData()
this.getTroubleList(); this.getTroubleList();
} }
@ -197,7 +582,7 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
public getTroubleList(){ public getTroubleList(){
this.tableService.getTroubleList(this.recordParams).then(res=>{ this.tableService.getTroubleList(this.recordParams).then(res=>{
console.log(res) this.troubleTableData = res.data
}) })
} }
@ -205,6 +590,26 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
this.currentTable = this.tableTabs.find(item=>item.id===data) this.currentTable = this.tableTabs.find(item=>item.id===data)
} }
public toggleAll() {
(this.$refs.multipleTable as any).toggleAllSelection();
}
public selectAll(){
if(!this.selectData.length){
this.toggleAll()
}else{
this.tableData.datas.forEach((item,index)=>{
const find = this.selectData.find((data:any)=>data.userId === item.userId);
if(!find){
(this.$refs.multipleTable as any).toggleRowSelection(item);
}
})
}
}
public handleSelectionChange(data){
this.selectData = data;
}
} }
</script> </script>