|
|
|
|
@ -41,14 +41,14 @@
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:siteName>
|
|
|
|
|
<template v-slot:siteName 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>检查地点:
|
|
|
|
|
</div>
|
|
|
|
|
<div class="xy-table-item-content">
|
|
|
|
|
<el-cascader filterable ref="cascader1" :show-all-levels="false" v-model="form.siteName" v-if="showCasc" clearable :options="siteList" :props="{'label':'name','value':'id'}"
|
|
|
|
|
placeholder="请选择检查地点" style="width: 290px;margin-right: 10px;" @change="changeSite"></el-cascader>
|
|
|
|
|
<el-cascader filterable ref="cascader1" :show-all-levels="false" :value="form.siteName" v-if="showCasc" clearable :options="siteList" :props="{'label':'name','value':'id'}"
|
|
|
|
|
:placeholder="sitePlaceholder" style="width: 290px;margin-right: 10px;" @change="changeSite"></el-cascader>
|
|
|
|
|
<el-input v-model="form.siteName" v-if="!showCasc" type='text' placeholder="请选择检查地点" clearable
|
|
|
|
|
style="width: 290px;margin-right: 10px;" @focus="$refs.maps.box = true"></el-input>
|
|
|
|
|
<el-button type="primary" v-if="showCasc" @click="$refs.maps.box = true;showCasc=false;form.siteName=''">选择地图</el-button>
|
|
|
|
|
@ -74,18 +74,18 @@
|
|
|
|
|
<div class="xy-table-item-label" style="font-weight: bold;">
|
|
|
|
|
<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;">
|
|
|
|
|
<div class="xy-table-item-content" style="display: flex;flex-wrap: wrap;margin-left: 10px; width: 90%;">
|
|
|
|
|
<div style="margin-bottom:10px">
|
|
|
|
|
<el-button type="primary" @click="addPatrolList">新增</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<div style="width:100%">
|
|
|
|
|
<xy-table
|
|
|
|
|
:list="patrol_list"
|
|
|
|
|
stripe
|
|
|
|
|
:isPage="false"
|
|
|
|
|
:table-item="patrol_table">
|
|
|
|
|
<template v-slot:btns>
|
|
|
|
|
<el-table-column align='center' label="操作" width="80" header-align="center">
|
|
|
|
|
<el-table-column align='center' fixed="right" label="操作" width="80" header-align="center">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div>
|
|
|
|
|
<Poptip transfer confirm title="确认要删除吗?" @on-ok="delPatrolList(scope.$index)">
|
|
|
|
|
@ -280,46 +280,43 @@
|
|
|
|
|
</el-select>)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// {
|
|
|
|
|
// label:'检查地点',
|
|
|
|
|
// prop:'siteName',
|
|
|
|
|
// width:180,
|
|
|
|
|
// customFn:(row,scope)=>{
|
|
|
|
|
// return(<div>
|
|
|
|
|
// {
|
|
|
|
|
// this.showCasc? <el-cascader filterable ref="cascader1"
|
|
|
|
|
// show-all-levels={false} v-model={this.patrol_list[scope.$index].siteName}
|
|
|
|
|
// clearable options={this.siteList} props={{
|
|
|
|
|
// 'props':{'label':'name','value':'id'}
|
|
|
|
|
// }}
|
|
|
|
|
// placeholder="请选择检查地点" style="width: 290px;margin-right: 10px;"
|
|
|
|
|
// on={{
|
|
|
|
|
// ["change"]: (e) => (this.changeSite(e)),
|
|
|
|
|
// }}></el-cascader> : <el-input v-model={this.patrol_list[scope.$index].siteName}
|
|
|
|
|
// type='text' placeholder="请选择检查地点" clearable
|
|
|
|
|
// style="width: 290px;margin-right: 10px;"
|
|
|
|
|
// on={{
|
|
|
|
|
// ["focus"]: (e) => (this.$refs.maps.box = true),
|
|
|
|
|
// }}></el-input>
|
|
|
|
|
// }
|
|
|
|
|
// <div>
|
|
|
|
|
// {
|
|
|
|
|
// this.showCasc? <el-button type="primary"
|
|
|
|
|
// on={{
|
|
|
|
|
// ["click"]: (e) => (this.$refs.maps.box = true,this.showCasc=false,this.patrol_list[scope.$index].siteName=''),
|
|
|
|
|
// }}>选择地图</el-button>
|
|
|
|
|
// :<el-button type="primary"
|
|
|
|
|
// on={{
|
|
|
|
|
// ["click"]: (e) => (this.showCasc=true,this.patrol_list[scope.$index].siteName=''),
|
|
|
|
|
// }}>选择站点</el-button>
|
|
|
|
|
// }
|
|
|
|
|
// </div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// </div>)
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
{
|
|
|
|
|
label:'检查地点',
|
|
|
|
|
prop:'siteName',
|
|
|
|
|
width:240,
|
|
|
|
|
customFn:(row,scope)=>{
|
|
|
|
|
return(<div style="display:flex"><div>
|
|
|
|
|
{
|
|
|
|
|
this.patrol_list[scope.$index].showCasc? <el-cascader filterable ref="cascader1"
|
|
|
|
|
show-all-levels={false} v-model={this.patrol_list[scope.$index].siteName}
|
|
|
|
|
clearable options={this.siteList} props={{
|
|
|
|
|
'props':{'label':'name','value':'id'}
|
|
|
|
|
}}
|
|
|
|
|
placeholder="请选择检查地点" style="width: 120px;margin-right: 10px;"
|
|
|
|
|
on={{
|
|
|
|
|
["change"]: (e) => (this.changeSite(e,'add',scope.$index)),
|
|
|
|
|
}}></el-cascader> : <el-input v-model={this.patrol_list[scope.$index].siteName}
|
|
|
|
|
type='text' placeholder="请选择地图" clearable
|
|
|
|
|
style="width: 120px;margin-right: 10px;"
|
|
|
|
|
on={{
|
|
|
|
|
["focus"]: (e) => (this.$refs.maps.box = true),
|
|
|
|
|
}}></el-input>
|
|
|
|
|
}
|
|
|
|
|
</div><div>
|
|
|
|
|
{
|
|
|
|
|
this.patrol_list[scope.$index].showCasc? <el-button type="primary"
|
|
|
|
|
on={{
|
|
|
|
|
["click"]: (e) => (this.$refs.maps.box = true,this.mapClickIndex = scope.$index,this.patrol_list[scope.$index].showCasc=false,this.patrol_list[scope.$index].siteName=''),
|
|
|
|
|
}}>选择地图</el-button>
|
|
|
|
|
:<el-button type="primary"
|
|
|
|
|
on={{
|
|
|
|
|
["click"]: (e) => (this.patrol_list[scope.$index].showCasc=true,this.patrol_list[scope.$index].siteName=''),
|
|
|
|
|
}}>选择站点</el-button>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</div>)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label:'问题图片',
|
|
|
|
|
prop:'files',
|
|
|
|
|
@ -366,7 +363,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
sitePlaceholder:'请选择站点',
|
|
|
|
|
mapClickIndex:0,
|
|
|
|
|
patrol_list:[{
|
|
|
|
|
showCasc:true,
|
|
|
|
|
ask_id:'',
|
|
|
|
|
site_id: '',
|
|
|
|
|
siteName: '',
|
|
|
|
|
@ -410,10 +410,10 @@
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请选择检查日期'
|
|
|
|
|
}],
|
|
|
|
|
siteName: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请选择检查地点'
|
|
|
|
|
}],
|
|
|
|
|
// siteName: [{
|
|
|
|
|
// required: true,
|
|
|
|
|
// message: '请选择检查地点'
|
|
|
|
|
// }],
|
|
|
|
|
// ask_id: [{
|
|
|
|
|
// required: true,
|
|
|
|
|
// message: '请选择问题类型'
|
|
|
|
|
@ -512,17 +512,30 @@
|
|
|
|
|
reject(error)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
changeSite(e) {
|
|
|
|
|
changeSite(e,type,index) {
|
|
|
|
|
if(e){
|
|
|
|
|
this.siteListArr.map(item => {
|
|
|
|
|
if (item.id == e[1]) {
|
|
|
|
|
this.form.site_id = item.id
|
|
|
|
|
this.form.address = item.address
|
|
|
|
|
this.form.lat = item.lat
|
|
|
|
|
this.form.lon = item.lon
|
|
|
|
|
// this.form.siteName = item.name
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
console.log("e",e)
|
|
|
|
|
if(type=='add'){
|
|
|
|
|
this.siteListArr.map(item => {
|
|
|
|
|
if (item.id == e[1]) {
|
|
|
|
|
this.patrol_list[index].site_id = item.id
|
|
|
|
|
this.patrol_list[index].address = item.address
|
|
|
|
|
this.patrol_list[index].lat = item.lat
|
|
|
|
|
this.patrol_list[index].lon = item.lon
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.siteListArr.map(item => {
|
|
|
|
|
if (item.id == e[1]) {
|
|
|
|
|
this.form.site_id = item.id
|
|
|
|
|
this.form.address = item.address
|
|
|
|
|
this.form.lat = item.lat
|
|
|
|
|
this.form.lon = item.lon
|
|
|
|
|
// this.form.siteName = item.name
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
@ -551,6 +564,7 @@
|
|
|
|
|
})
|
|
|
|
|
this.siteListArr = res.data.reverse()
|
|
|
|
|
let arr = this.contactSite(res.data)
|
|
|
|
|
console.log("arr",arr)
|
|
|
|
|
this.siteList = arr
|
|
|
|
|
},
|
|
|
|
|
contactSite(arr) {
|
|
|
|
|
@ -559,6 +573,7 @@
|
|
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
|
|
|
if (tempArr.indexOf(arr[i].type) === -1) {
|
|
|
|
|
newArr.push({
|
|
|
|
|
id:arr[i].type,
|
|
|
|
|
type: arr[i].type,
|
|
|
|
|
name: arr[i]['type_detail']['value'],
|
|
|
|
|
children: [arr[i]]
|
|
|
|
|
@ -580,7 +595,13 @@
|
|
|
|
|
},
|
|
|
|
|
addPatrolList(){
|
|
|
|
|
this.patrol_list.push({
|
|
|
|
|
showCasc:true,
|
|
|
|
|
ask_id:'',
|
|
|
|
|
site_id: '',
|
|
|
|
|
siteName: '',
|
|
|
|
|
address: '',
|
|
|
|
|
lat: '',
|
|
|
|
|
lon: '',
|
|
|
|
|
ask_department:'',
|
|
|
|
|
ask_introduce:'',
|
|
|
|
|
tips:'',
|
|
|
|
|
@ -610,6 +631,15 @@
|
|
|
|
|
this.showPicUrl = file.url;
|
|
|
|
|
this.showPic = true;
|
|
|
|
|
},
|
|
|
|
|
findParentElement(arr, childId) {
|
|
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
|
|
|
const element = arr[i];
|
|
|
|
|
if (element.children && element.children.some(child => child.id === childId)) {
|
|
|
|
|
return element;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null; // 如果没有找到对应的父元素,返回null
|
|
|
|
|
},
|
|
|
|
|
async getDetail() {
|
|
|
|
|
const res = await get(this.id)
|
|
|
|
|
this.form = {
|
|
|
|
|
@ -634,6 +664,23 @@
|
|
|
|
|
patrol_list:[],
|
|
|
|
|
}
|
|
|
|
|
res.mission_id?this.getGroups(res.mission_id):''
|
|
|
|
|
this.sitePlaceholder = res.site_id?res.site.name:res.address
|
|
|
|
|
// if(res.site_id){
|
|
|
|
|
// this.showCasc = false
|
|
|
|
|
// let pArr = this.findParentElement(this.siteList,res.site_id)
|
|
|
|
|
// if(pArr){
|
|
|
|
|
// this.form.siteName = []
|
|
|
|
|
// this.form.siteName.push(pArr.id)
|
|
|
|
|
// this.form.siteName.push()
|
|
|
|
|
// this.$forceUpdate()
|
|
|
|
|
// }else{
|
|
|
|
|
// this.form.siteName = [undefined,res.site_id]
|
|
|
|
|
// }
|
|
|
|
|
// console.log("this.form.siteName",this.form.siteName)
|
|
|
|
|
|
|
|
|
|
// }else{
|
|
|
|
|
// this.form.siteName = res.address
|
|
|
|
|
// }
|
|
|
|
|
this.showCasc = res.site_id?true:false
|
|
|
|
|
// this.$refs.cascader.placeholder = res.site.name
|
|
|
|
|
// this.$forceUpdate()
|
|
|
|
|
@ -685,10 +732,10 @@
|
|
|
|
|
date:this.form.date,
|
|
|
|
|
up_admin_id:this.form.up_admin_id,
|
|
|
|
|
batch:this.patrol_list,
|
|
|
|
|
site_id: this.form.site_id,
|
|
|
|
|
address: this.form.address,
|
|
|
|
|
lat: this.form.lat,
|
|
|
|
|
lon: this.form.lon,
|
|
|
|
|
// site_id: this.form.site_id,
|
|
|
|
|
// address: this.form.address,
|
|
|
|
|
// lat: this.form.lat,
|
|
|
|
|
// lon: this.form.lon,
|
|
|
|
|
}
|
|
|
|
|
console.log("baseForm",baseForm)
|
|
|
|
|
// return
|
|
|
|
|
@ -746,6 +793,7 @@
|
|
|
|
|
this.mission_id = ''
|
|
|
|
|
this.mapform = []
|
|
|
|
|
this.showCasc = true
|
|
|
|
|
this.mapClickIndex = 0
|
|
|
|
|
this.hasMissionId = false
|
|
|
|
|
this.$refs['dialog'].reset()
|
|
|
|
|
}
|
|
|
|
|
@ -758,6 +806,17 @@
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mapform(newVal, oldVal) {
|
|
|
|
|
|
|
|
|
|
console.log("点击地图了z",this.mapClickIndex)
|
|
|
|
|
if(this.showCasc && this.type==='add'){
|
|
|
|
|
console.log("点击地图了",this.mapClickIndex)
|
|
|
|
|
this.patrol_list[this.mapClickIndex].lon = newVal[0];
|
|
|
|
|
this.patrol_list[this.mapClickIndex].lat = newVal[1];
|
|
|
|
|
this.patrol_list[this.mapClickIndex].address = newVal[2];
|
|
|
|
|
this.patrol_list[this.mapClickIndex].siteName = newVal[2]
|
|
|
|
|
this.patrol_list[this.mapClickIndex].site_id = ''
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.form.lon = newVal[0];
|
|
|
|
|
this.form.lat = newVal[1];
|
|
|
|
|
this.form.address = newVal[2];
|
|
|
|
|
@ -776,6 +835,7 @@
|
|
|
|
|
// }
|
|
|
|
|
::v-deep .patrol_list {
|
|
|
|
|
flex-basis: 100%;
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::v-deep .avue-input-map {
|
|
|
|
|
|