问题图片:
@@ -244,154 +208,8 @@
},
userdata:[],
mapform: [],
- patrol_table:[
- {
- label:'*发现时间',
- prop:'date',
- width:180,
- customFn:(row,scope)=>{
- return(
- )
- }
- },
- {
- label:'*问题描述',
- prop:'ask_introduce',
- width:180,
- customFn:(row,scope)=>{
- return(
- )
- }
- },{
- label:'*问题类型',
- prop:'ask_id',
- width:180,
- customFn:(row,scope)=>{
- return(
- {
- this.askList.map(item=>{
- return(
-
-
- )
- })
- }
- )
- }
- },
-
- {
- label:'整改建议',
- prop:'tips',
- width:180,
- customFn:(row,scope)=>{
- return(
- )
- }
- },
-
- {
- label:'*检查地点',
- prop:'siteName',
- width:240,
- customFn:(row,scope)=>{
- return(
- {
- this.patrol_list[scope.$index].showCasc? (this.changeSite(e,'add',scope.$index)),
- }}> : (this.$refs.maps.box = true),
- }}>
- }
-
- {
- this.patrol_list[scope.$index].showCasc? (this.$refs.maps.box = true,this.mapClickIndex = scope.$index,this.patrol_list[scope.$index].showCasc=false,this.patrol_list[scope.$index].siteName=''),
- }}>选择地图
- : (this.patrol_list[scope.$index].showCasc=true,this.patrol_list[scope.$index].siteName=''),
- }}>选择站点
- }
-
-
)
- }
- },
- {
- label:'问题图片',
- prop:'files',
- minWidth:220,
- customFn:(row,scope)=>{
- let _this = this
- return(
this.handlesuccess(response, file, fileList,scope.$index),
- ["on-preview"]: (file) => this.handlePictureCardPreview(file),
- ["on-remove"]: (file, fileList) => this.handleRemove(file, fileList,scope.$index),
- }
-
- }>
-
- )
- }
- },
- {
- label:'建议整改科室',
- prop:'ask_department',
- width:180,
- customFn:(row,scope)=>{
- return(
(this.changeDepartment(e,scope.$index)),
- }}
- v-model={this.patrol_list[scope.$index].ask_department} filterable allow-create clearable placeholder="请选择或输入建议整改科室">
- {
- this.depList.map(item=>{
- return(
-
-
- )
- })
- }
- )
- }
- },
-
-
-
- ],
sitePlaceholder:'请选择站点',
mapClickIndex:0,
- patrol_list:[{
- showCasc:true,
- date:'',
- ask_id:'',
- site_id: '',
- siteName: '',
- address: '',
- lat: '',
- lon: '',
- ask_department:'',
- ask_introduce:'',
- tips:'',
- pictureList:[]
- }],
form: {
date: '',
@@ -399,7 +217,6 @@
siteName: '',
groups:'',
showgroups:"",
- patrol_list:[],
ask_introduce: '',
ask_id: '',
site_id: '',
@@ -413,7 +230,7 @@
tips: '',
file_ids: [],
- mission_id: '',
+mission_id: '',
up_admin_id:"",
},
@@ -531,16 +348,6 @@
changeSite(e,type,index) {
if(e){
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
@@ -550,7 +357,7 @@
// this.form.siteName = item.name
}
})
- }
+
}
@@ -565,11 +372,9 @@
arr.push(item.id)
}
})
- if(this.type==='add'){
- this.patrol_list[index].accept_department_ids = arr
- }else{
+
this.form.accept_department_ids = arr
- }
+
}
},
@@ -609,40 +414,15 @@
const res = await getparameteritem('askList')
this.askList = res.detail
},
- addPatrolList(){
- this.patrol_list.push({
- showCasc:true,
- date:'',
- ask_id:'',
- site_id: '',
- siteName: '',
- address: '',
- lat: '',
- lon: '',
- ask_department:'',
- ask_introduce:'',
- tips:'',
- pictureList:[]
- })
- },
- delPatrolList(index){
- this.patrol_list.splice(index,1)
- },
handleRemove(file, fileList,index) {
- if(this.type=='add'){
- this.patrol_list[index].pictureList = fileList
- }else{
+
this.pictureList = fileList
- }
+
},
handlesuccess(response, file, fileList,index) {
- console.log(response, file, fileList,index)
- if(this.type=='add'){
- this.patrol_list[index].pictureList = fileList
- console.log("this.patrol_list",this.patrol_list)
- }else{
+
this.pictureList = fileList
- }
+
},
handlePictureCardPreview(file) {
this.showPicUrl = file.url;
@@ -670,43 +450,18 @@
lat: res?.lat,
lon: res?.lon,
ask_id: res?.ask_id,
-
-
ask_department: res?.ask_department,
ask_introduce: res?.ask_introduce,
tips: res?.tips,
accept_department_ids:res.accept_department_ids?res.accept_department_ids:[],
file_ids: res?.file_ids,
- patrol_list:[],
mission_id: res?.mission_id,
up_admin_id:res?.up_admin_id,
}
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()
- // if(this.showCasc){
- // console.log("this.form.siteName",this.form.siteName)
- // // this.$refs['cascader'].checkedValue = this.form.siteName
- // }
- this.mapform = [res.lon, res.lat, res.address]
+ this.mapform = res.site_id?[]:[res.lon, res.lat, res.address]
for (var f of res.files) {
this.pictureList.push({
id: f.id,
@@ -714,133 +469,17 @@
name: f.original_name
})
}
+ console.log("address",this.form)
this.$refs.cascader1.computePresentText()
// res.guide_upload ? this.guidePictureList.push(res.guide_upload) : ''
},
- 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;
- }
- } else {
- //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
+ if(this.type=='editor'){
+ this.form.id = this.id
+ }else{
+ this.form.id = ''
}
- this.patrol_list.map(item=>{
- let _files = []
- item.pictureList.map(p=>{
- if (p.response) {
- _files.push(p.response.id)
- } else {
- _files.push(p.id)
- }
- })
- item.file_ids = _files
- })
- let baseForm = {
- mission_id:this.form.mission_id,
- // 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,
- }
- console.log("baseForm",baseForm)
- // return
- batchSave({
- ...baseForm
- }).then(res => {
- Message({
- type: 'success',
- message: '新增检查成功'
- })
- this.isShow = false
- this.$emit('refresh')
- })
- return
- }
- if (this.type === 'editor') {
- // return
let _files = []
if (this.pictureList.length > 0) {
for (var h of this.pictureList) {
@@ -854,18 +493,24 @@
} else {
this.form.file_ids = []
}
+ // if(this.form.site_id){
+ // this.form.address = ''
+ // this.form.lat = ''
+ // this.form.lon = ''
+ // }
+ console.log("form",this.form)
+ // return
save({
- id: this.id,
...this.form
}).then(res => {
Message({
type: 'success',
- message: '编辑检查成功'
+ message: '更改成功'
})
this.isShow = false
this.$emit('refresh')
})
- }
+
},
},
watch: {
@@ -891,11 +536,10 @@
this.groupObj = {}
this.showgroups = false
this.pictureList = []
- this.patrol_list = []
this.mission_id = ''
this.mapform = []
this.showCasc = true
- this.mapClickIndex = 0
+ this.mapClickIndex = 0
this.hasMissionId = false
this.$refs['dialog'].reset()
}
@@ -914,20 +558,14 @@
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
+ if(!this.showCasc){
+ this.form.lon = newVal[0];
+ this.form.lat = newVal[1];
+ this.form.address = newVal[2];
+ this.form.siteName = newVal[2]
+ this.form.site_id = ''
}
- this.form.lon = newVal[0];
- this.form.lat = newVal[1];
- this.form.address = newVal[2];
- this.form.siteName = newVal[2]
- this.form.site_id = ''
+
}
}
diff --git a/src/views/task/list/patrol.vue b/src/views/task/list/patrol.vue
index d905a9c..e43b540 100644
--- a/src/views/task/list/patrol.vue
+++ b/src/views/task/list/patrol.vue
@@ -9,9 +9,9 @@
-