|
@@ -11,7 +11,7 @@
|
|
|
<el-option v-for="(item, index) in unitArr" :key="index" :label="item.label" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
<template slot="latitude">
|
|
|
- <el-input v-model="formData.latitude" placeholder="请选择经纬坐标">
|
|
|
+ <el-input v-model="initDot" @change="initDotTggle" placeholder="请选择经纬坐标">
|
|
|
<i slot="suffix" class="zoniot_font zoniot-icon-dizhi" @click="QueryClick"></i>
|
|
|
</el-input>
|
|
|
</template>
|
|
@@ -26,6 +26,7 @@ export default {
|
|
|
MapPopup
|
|
|
},
|
|
|
data() {
|
|
|
+ const _this = this;
|
|
|
return {
|
|
|
formData: {
|
|
|
communityId: '',
|
|
@@ -36,13 +37,26 @@ export default {
|
|
|
latitude: '',
|
|
|
longitude: ''
|
|
|
},
|
|
|
- initDot: [],
|
|
|
+ initDot: '',
|
|
|
communityTre: [],
|
|
|
formRules: {
|
|
|
communityId: [this.$valid.selectRequired('公司')],
|
|
|
pointName: [this.$valid.inputRequired('巡更点名称')],
|
|
|
pointNo: [this.$valid.inputRequired('巡更点编号')],
|
|
|
- latitude: [this.$valid.inputRequired('经纬度坐标'), this.$valid.selectRequired('经纬度坐标')]
|
|
|
+ latitude: this.$valid.custome({
|
|
|
+ validator(rule, value, cb) {
|
|
|
+ const rl = rule;
|
|
|
+ if (!value) {
|
|
|
+ rl.message = '请输入或选择坐标';
|
|
|
+ cb(new Error());
|
|
|
+ } else if (_this.initDot.split(',').length > 2) {
|
|
|
+ rl.message = '一个巡更点只能有一个经纬度';
|
|
|
+ cb(new Error());
|
|
|
+ } else {
|
|
|
+ cb();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
formCols: [
|
|
|
[
|
|
@@ -100,8 +114,8 @@ export default {
|
|
|
title: title
|
|
|
});
|
|
|
}).then((e) => {
|
|
|
- this.initDot = [e.lat, e.lng];
|
|
|
- this.formData.latitude = `${e.lat},${e.lng}`;
|
|
|
+ this.initDot = `${e.lat},${e.lng}`;
|
|
|
+ this.formData.latitude = e.lat;
|
|
|
this.formData.longitude = e.lng;
|
|
|
});
|
|
|
},
|
|
@@ -143,8 +157,8 @@ export default {
|
|
|
pointNo: this.formData.pointNo,
|
|
|
buildingId: this.formData.buildingId,
|
|
|
unit: this.formData.unit,
|
|
|
- latitude: this.initDot[0],
|
|
|
- longitude: this.initDot[1]
|
|
|
+ latitude: this.formData.latitude,
|
|
|
+ longitude: this.formData.longitude
|
|
|
};
|
|
|
if (this.params.todo == 'edit') {
|
|
|
url = '/sc-community/patrol/point/update';
|
|
@@ -175,6 +189,9 @@ export default {
|
|
|
buildingChange(e) {
|
|
|
this.formData.unit = '';
|
|
|
this.nestedLoop(this.buildingArr, 'unit', 'unitArr', e);
|
|
|
+ },
|
|
|
+ initDotTggle() {
|
|
|
+ // console.log(this.initDot.split(','))
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -185,8 +202,7 @@ export default {
|
|
|
this.formData = newData;
|
|
|
this.nestedLoop(this.communityTre, 'building', 'buildingArr', newData.communityId);
|
|
|
this.nestedLoop(this.buildingArr, 'unit', 'unitArr', newData.buildingId);
|
|
|
- this.initDot = [newData.latitude, newData.longitude];
|
|
|
- this.formData.latitude = `${newData.latitude},${newData.longitude}`;
|
|
|
+ this.initDot = `${newData.latitude},${newData.longitude}`;
|
|
|
}
|
|
|
}
|
|
|
};
|