|
|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<xy-dialog ref="dialog" :is-show.sync="isShow" type="form" :title="type === 'add' ? '检查问题' : '编辑问题'" :form="form"
|
|
|
|
|
:rules="rules" @submit="submit">
|
|
|
|
|
:rules="type==='add'?{}:rules" @submit="submit">
|
|
|
|
|
<!-- <template v-slot:mission_id >
|
|
|
|
|
<div class="xy-table-item">
|
|
|
|
|
<div class="xy-table-item-label">
|
|
|
|
|
@ -15,7 +15,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template> -->
|
|
|
|
|
<template v-slot:date>
|
|
|
|
|
<template v-slot:date v-if="type=='editor'">
|
|
|
|
|
<div class="xy-table-item">
|
|
|
|
|
<div class="xy-table-item-label" style="font-weight: bold;">
|
|
|
|
|
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>发现时间:
|
|
|
|
|
@ -71,8 +71,8 @@
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:patrol_list v-if="type=='add'">
|
|
|
|
|
<div class="xy-table-item">
|
|
|
|
|
<div class="xy-table-item-label" style="font-weight: bold;">
|
|
|
|
|
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>问题详情
|
|
|
|
|
<div class="xy-table-item-label" style="font-weight: bold;min-width:0">
|
|
|
|
|
<!-- <span style="color: red;font-weight: 600;padding-right: 4px;">*</span>问题详情 -->
|
|
|
|
|
</div>
|
|
|
|
|
<div class="xy-table-item-content" style="display: flex;flex-wrap: wrap;margin-left: 10px; width: 90%;">
|
|
|
|
|
<div style="margin-bottom:10px">
|
|
|
|
|
@ -87,6 +87,9 @@
|
|
|
|
|
<template v-slot:btns>
|
|
|
|
|
<el-table-column align='center' fixed="right" label="操作" width="80" header-align="center">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div>
|
|
|
|
|
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' @click="copyAsk(scope.$index)" size='small' ghost>复制</Button>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<Poptip transfer confirm title="确认要删除吗?" @on-ok="delPatrolList(scope.$index)">
|
|
|
|
|
<Button type="primary" style='margin-right:5px;margin-bottom:5px;' size='small' ghost>删除</Button>
|
|
|
|
|
@ -243,7 +246,17 @@
|
|
|
|
|
mapform: [],
|
|
|
|
|
patrol_table:[
|
|
|
|
|
{
|
|
|
|
|
label:'问题描述',
|
|
|
|
|
label:'*发现时间',
|
|
|
|
|
prop:'date',
|
|
|
|
|
width:180,
|
|
|
|
|
customFn:(row,scope)=>{
|
|
|
|
|
return( <el-date-picker style="width: 90%" v-model={this.patrol_list[scope.$index].date} format="yyyy-MM-dd"
|
|
|
|
|
value-format="yyyy-MM-dd" type="date" placeholder="选择发现时间">
|
|
|
|
|
</el-date-picker>)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label:'*问题描述',
|
|
|
|
|
prop:'ask_introduce',
|
|
|
|
|
width:180,
|
|
|
|
|
customFn:(row,scope)=>{
|
|
|
|
|
@ -252,7 +265,7 @@
|
|
|
|
|
</el-input>)
|
|
|
|
|
}
|
|
|
|
|
},{
|
|
|
|
|
label:'问题类型',
|
|
|
|
|
label:'*问题类型',
|
|
|
|
|
prop:'ask_id',
|
|
|
|
|
width:180,
|
|
|
|
|
customFn:(row,scope)=>{
|
|
|
|
|
@ -281,7 +294,7 @@
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
label:'检查地点',
|
|
|
|
|
label:'*检查地点',
|
|
|
|
|
prop:'siteName',
|
|
|
|
|
width:240,
|
|
|
|
|
customFn:(row,scope)=>{
|
|
|
|
|
@ -367,6 +380,7 @@
|
|
|
|
|
mapClickIndex:0,
|
|
|
|
|
patrol_list:[{
|
|
|
|
|
showCasc:true,
|
|
|
|
|
date:'',
|
|
|
|
|
ask_id:'',
|
|
|
|
|
site_id: '',
|
|
|
|
|
siteName: '',
|
|
|
|
|
@ -412,18 +426,18 @@
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请选择发现时间'
|
|
|
|
|
}],
|
|
|
|
|
// siteName: [{
|
|
|
|
|
// required: true,
|
|
|
|
|
// message: '请选择检查地点'
|
|
|
|
|
// }],
|
|
|
|
|
// ask_id: [{
|
|
|
|
|
// required: true,
|
|
|
|
|
// message: '请选择问题类型'
|
|
|
|
|
// }],
|
|
|
|
|
// ask_introduce: [{
|
|
|
|
|
// required: true,
|
|
|
|
|
// message: '请输入问题描述'
|
|
|
|
|
// }]
|
|
|
|
|
address: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请选择检查地点'
|
|
|
|
|
}],
|
|
|
|
|
ask_id: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请选择问题类型'
|
|
|
|
|
}],
|
|
|
|
|
ask_introduce: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请输入问题描述'
|
|
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
@ -598,6 +612,7 @@
|
|
|
|
|
addPatrolList(){
|
|
|
|
|
this.patrol_list.push({
|
|
|
|
|
showCasc:true,
|
|
|
|
|
date:'',
|
|
|
|
|
ask_id:'',
|
|
|
|
|
site_id: '',
|
|
|
|
|
siteName: '',
|
|
|
|
|
@ -702,23 +717,93 @@
|
|
|
|
|
this.$refs.cascader1.computePresentText()
|
|
|
|
|
// res.guide_upload ? this.guidePictureList.push(res.guide_upload) : ''
|
|
|
|
|
},
|
|
|
|
|
submit() {
|
|
|
|
|
console.log("this.patrol_list",this.patrol_list)
|
|
|
|
|
// return
|
|
|
|
|
let _files = []
|
|
|
|
|
if (this.pictureList.length > 0) {
|
|
|
|
|
for (var h of this.pictureList) {
|
|
|
|
|
if (h.response) {
|
|
|
|
|
_files.push(h.response.id)
|
|
|
|
|
} else {
|
|
|
|
|
_files.push(h.id)
|
|
|
|
|
deepCopy(data){
|
|
|
|
|
//string,number,bool,null,undefined,symbol
|
|
|
|
|
//object,array,date
|
|
|
|
|
if (data && typeof data === "object") {
|
|
|
|
|
//针对函数的拷贝
|
|
|
|
|
if (typeof data === "function") {
|
|
|
|
|
let tempFunc = data.bind(null);
|
|
|
|
|
tempFunc.prototype = this.deepCopy(data.prototype);
|
|
|
|
|
return tempFunc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (Object.prototype.toString.call(data)) {
|
|
|
|
|
case "[object String]":
|
|
|
|
|
return data.toString();
|
|
|
|
|
case "[object Number]":
|
|
|
|
|
return Number(data.toString());
|
|
|
|
|
case "[object Boolean]":
|
|
|
|
|
return new Boolean(data.toString());
|
|
|
|
|
case "[object Date]":
|
|
|
|
|
return new Date(data.getTime());
|
|
|
|
|
case "[object Array]":
|
|
|
|
|
let arr = [];
|
|
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
|
|
arr[i] = this.deepCopy(data[i]);
|
|
|
|
|
}
|
|
|
|
|
return arr;
|
|
|
|
|
|
|
|
|
|
//js自带对象或用户自定义类实例
|
|
|
|
|
case "[object Object]":
|
|
|
|
|
let obj = {};
|
|
|
|
|
for (let key in data) {
|
|
|
|
|
//会遍历原型链上的属性方法,可以用hasOwnProperty来控制 (obj.hasOwnProperty(prop)
|
|
|
|
|
obj[key] = this.deepCopy(data[key]);
|
|
|
|
|
}
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
this.form.file_ids = _files
|
|
|
|
|
} else {
|
|
|
|
|
this.form.file_ids = []
|
|
|
|
|
//string,number,bool,null,undefined,symbol
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
copyAsk(index){
|
|
|
|
|
console.log(index)
|
|
|
|
|
let obj = this.deepCopy(this.patrol_list[index])
|
|
|
|
|
obj.pictureList=[]
|
|
|
|
|
obj.file_ids=[]
|
|
|
|
|
this.patrol_list.push(obj)
|
|
|
|
|
},
|
|
|
|
|
submit() {
|
|
|
|
|
console.log("this.patrol_list",this.patrol_list)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.type === 'add') {
|
|
|
|
|
if(this.patrol_list.length<1){
|
|
|
|
|
Message({
|
|
|
|
|
type: 'warning',
|
|
|
|
|
message: '请填写问题'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
let nullCount = 0
|
|
|
|
|
this.patrol_list.map(item=>{
|
|
|
|
|
if(!item.date){
|
|
|
|
|
nullCount++
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if(!item.ask_introduce){
|
|
|
|
|
nullCount++
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if(!item.ask_id){
|
|
|
|
|
nullCount++
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if(!item.siteName){
|
|
|
|
|
nullCount++
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if( nullCount>0){
|
|
|
|
|
Message({
|
|
|
|
|
type: 'warning',
|
|
|
|
|
message: '请填写完整信息'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.patrol_list.map(item=>{
|
|
|
|
|
let _files = []
|
|
|
|
|
item.pictureList.map(p=>{
|
|
|
|
|
@ -732,7 +817,7 @@
|
|
|
|
|
})
|
|
|
|
|
let baseForm = {
|
|
|
|
|
mission_id:this.form.mission_id,
|
|
|
|
|
date:this.form.date,
|
|
|
|
|
// date:this.form.date,
|
|
|
|
|
up_admin_id:this.form.up_admin_id,
|
|
|
|
|
batch:this.patrol_list,
|
|
|
|
|
// site_id: this.form.site_id,
|
|
|
|
|
@ -755,6 +840,20 @@
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.type === 'editor') {
|
|
|
|
|
// return
|
|
|
|
|
let _files = []
|
|
|
|
|
if (this.pictureList.length > 0) {
|
|
|
|
|
for (var h of this.pictureList) {
|
|
|
|
|
if (h.response) {
|
|
|
|
|
_files.push(h.response.id)
|
|
|
|
|
} else {
|
|
|
|
|
_files.push(h.id)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.form.file_ids = _files
|
|
|
|
|
} else {
|
|
|
|
|
this.form.file_ids = []
|
|
|
|
|
}
|
|
|
|
|
save({
|
|
|
|
|
id: this.id,
|
|
|
|
|
...this.form
|
|
|
|
|
|