|
@@ -68,6 +68,12 @@ export default {
|
|
|
slotName: 'farmName'
|
|
|
},
|
|
|
{
|
|
|
+ prop: 'frontLocation',
|
|
|
+ label: '牧场地址',
|
|
|
+ minWidth: '100',
|
|
|
+ slotName: 'frontLocation'
|
|
|
+ },
|
|
|
+ {
|
|
|
label: '操作',
|
|
|
minWidth: '100',
|
|
|
slotName: 'handler'
|
|
@@ -84,7 +90,8 @@ export default {
|
|
|
selectedOptions: ''
|
|
|
},
|
|
|
rules: {
|
|
|
- farmName: [{ required: true, message: '请输入牧场名称', trigger: 'blur' }]
|
|
|
+ farmName: [{ required: true, message: '请输入牧场名称', trigger: 'blur' }],
|
|
|
+ selectedOptions: [{ required: true, message: '请输入牧场名称', trigger: 'change' }],
|
|
|
},
|
|
|
select: [],
|
|
|
}
|
|
@@ -99,8 +106,11 @@ export default {
|
|
|
this.showType = false;
|
|
|
},
|
|
|
edit(row) {
|
|
|
+ this.dialogVisible = true;
|
|
|
+ this.showType = true;
|
|
|
this.form.farmName = row.farmName;
|
|
|
this.form.id = row.id;
|
|
|
+ this.form.selectedOptions = row.location.split(',')
|
|
|
},
|
|
|
// 批量选择
|
|
|
selectionChange(data) {
|
|
@@ -164,7 +174,9 @@ export default {
|
|
|
if(this.showType) {
|
|
|
let params = {
|
|
|
id: this.form.id,
|
|
|
- farmName: this.form.farmName
|
|
|
+ farmName: this.form.farmName,
|
|
|
+ location: this.form.selectedOptions.join(','),
|
|
|
+ frontLocation: this.loc
|
|
|
}
|
|
|
editFarm(params).then(res => {
|
|
|
this.reset();
|
|
@@ -177,7 +189,9 @@ export default {
|
|
|
})
|
|
|
} else {
|
|
|
let params = {
|
|
|
- farmName: this.form.farmName
|
|
|
+ farmName: this.form.farmName,
|
|
|
+ location: this.form.selectedOptions.join(','),
|
|
|
+ frontLocation: this.loc
|
|
|
}
|
|
|
addFarm(params).then(res => {
|
|
|
this.reset();
|
|
@@ -201,18 +215,17 @@ export default {
|
|
|
this.showType = false;
|
|
|
this.form = {
|
|
|
farmName: '',
|
|
|
+ selectedOptions: ''
|
|
|
}
|
|
|
+ this.loc = ''
|
|
|
},
|
|
|
// 获取地址
|
|
|
getlocation () {
|
|
|
- var loc = "";
|
|
|
- this.form.location1 = ''
|
|
|
+ var loc = [];
|
|
|
for (let i = 0; i < this.form.selectedOptions.length; i++) {
|
|
|
- loc += CodeToText[this.form.selectedOptions[i]]
|
|
|
- this.form.location1 += this.form.selectedOptions[i] + ','
|
|
|
+ loc.push(CodeToText[this.form.selectedOptions[i]])
|
|
|
}
|
|
|
- this.loc = loc
|
|
|
- console.log(loc);
|
|
|
+ this.loc = loc.join(',')
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|