|
@@ -2,7 +2,12 @@ import { lbsAmapRegion } from '@/api/common.js'
|
|
|
import geographicalPosi from '@/components/geographicalPosi/index.vue'
|
|
|
export default {
|
|
|
data() {
|
|
|
- return { provinceList: [], cityList: [], areaList: [], streetList: [], centerDialogVisible: false, selListData: [] }
|
|
|
+ return {
|
|
|
+ provinceList: [],
|
|
|
+ cityList: [],
|
|
|
+ areaList: [],
|
|
|
+ streetList: [],
|
|
|
+ }
|
|
|
},
|
|
|
computed: {
|
|
|
// 基本信息数据模型
|
|
@@ -62,15 +67,15 @@ export default {
|
|
|
rules: this.formOptions.gpsAddress.isRules,
|
|
|
errLabel: '省'
|
|
|
},
|
|
|
- options: this.provinceList.map((v, i) => ({ value: v.lbsId, label: v.name })),
|
|
|
+ options: this.provinceList.map((v, i) => ({ value: v.id, label: v.name })),
|
|
|
attributes: { disabled: true, clearable: true, filterable: true, placeholder: '请选择' },
|
|
|
events: {
|
|
|
change: () => {
|
|
|
// 获取省名称
|
|
|
- this.orderInfo.province = this.provinceList.find(item => item.lbsId === val).name
|
|
|
+ this.orderInfo.province = this.provinceList.find(item => item.id === val)?.name || ''
|
|
|
// 清除市区街道以及详细地址数据
|
|
|
this.delDataK(1)
|
|
|
- lbsAmapRegion({ parentLbsId: val }).then(res => {
|
|
|
+ lbsAmapRegion({ pid: val }).then(res => {
|
|
|
this.cityList = res.data
|
|
|
})
|
|
|
}
|
|
@@ -87,15 +92,15 @@ export default {
|
|
|
rules: this.formOptions.gpsAddress.isRules,
|
|
|
errLabel: '市'
|
|
|
},
|
|
|
- options: this.cityList.map((v, i) => ({ value: v.lbsId, label: v.name })),
|
|
|
+ options: this.cityList.map((v, i) => ({ value: v.id, label: v.name })),
|
|
|
attributes: { disabled: true, clearable: true, filterable: true, placeholder: '请选择' },
|
|
|
events: {
|
|
|
change: () => {
|
|
|
// 获取市名称
|
|
|
- this.orderInfo.city = this.cityList.find(item => item.lbsId === val).name
|
|
|
+ this.orderInfo.city = this.cityList.find(item => item.id === val).name
|
|
|
// 清除区街道以及详细地址数据
|
|
|
this.delDataK(2)
|
|
|
- lbsAmapRegion({ parentLbsId: val }).then(res => {
|
|
|
+ lbsAmapRegion({ pid: val }).then(res => {
|
|
|
this.areaList = res.data
|
|
|
})
|
|
|
}
|
|
@@ -112,15 +117,15 @@ export default {
|
|
|
rules: this.formOptions.gpsAddress.isRules,
|
|
|
errLabel: '区'
|
|
|
},
|
|
|
- options: this.areaList.map((v, i) => ({ value: v.lbsId, label: v.name })),
|
|
|
+ options: this.areaList.map((v, i) => ({ value: v.id, label: v.name })),
|
|
|
attributes: { disabled: true, clearable: true, filterable: true, placeholder: '请选择' },
|
|
|
events: {
|
|
|
change: () => {
|
|
|
// 获取区名称
|
|
|
- this.orderInfo.area = this.areaList.find(item => item.lbsId === val).name
|
|
|
+ this.orderInfo.area = this.areaList.find(item => item.id === val).name
|
|
|
// 清除街道以及详细地址数据
|
|
|
this.delDataK(3)
|
|
|
- lbsAmapRegion({ parentLbsId: val }).then(res => {
|
|
|
+ lbsAmapRegion({ pid: val }).then(res => {
|
|
|
this.streetList = res.data
|
|
|
})
|
|
|
}
|
|
@@ -137,12 +142,12 @@ export default {
|
|
|
rules: this.formOptions.gpsAddress.isRules,
|
|
|
errLabel: '街道'
|
|
|
},
|
|
|
- options: this.streetList.map((v, i) => ({ value: v.lbsId, label: v.name })),
|
|
|
+ options: this.streetList.map((v, i) => ({ value: v.id, label: v.name })),
|
|
|
attributes: { disabled: true, clearable: true, filterable: true, placeholder: '请选择' },
|
|
|
events: {
|
|
|
change: () => {
|
|
|
// 获取街道名称
|
|
|
- this.orderInfo.street = this.streetList.find(item => item.lbsId === val).name
|
|
|
+ this.orderInfo.street = this.streetList.find(item => item.id === val).name
|
|
|
// 清除详细地址数据
|
|
|
this.delDataK(4)
|
|
|
}
|
|
@@ -167,33 +172,34 @@ export default {
|
|
|
formData.lat = data.center[1]
|
|
|
// 获取定位的省市区街道
|
|
|
var { province, city, district, township } = data.data.addressComponent
|
|
|
+ console.log(province, city, district, township)
|
|
|
// 获取选中省名称id
|
|
|
- var { lbsId, name } = this.provinceList.find(item => item.name === province)
|
|
|
- formData.provinceId = lbsId
|
|
|
+ var { id, name } = this.provinceList.find(item => item.name === province)
|
|
|
+ formData.provinceId = id
|
|
|
formData.province = name
|
|
|
// 请求市选项
|
|
|
- lbsAmapRegion({ parentLbsId: formData.provinceId }).then(res => {
|
|
|
+ lbsAmapRegion({ pid: formData.provinceId }).then(res => {
|
|
|
// 赋值市选项
|
|
|
this.cityList = res.data
|
|
|
// 获取选中市名称id
|
|
|
- var { lbsId, name } = res.data.find(item => item.name === city)
|
|
|
- formData.cityId = lbsId
|
|
|
+ var { id, name } = res.data.find(item => item.name === city)
|
|
|
+ formData.cityId = id
|
|
|
formData.city = name
|
|
|
// 请求区选项
|
|
|
- lbsAmapRegion({ parentLbsId: formData.cityId }).then(res => {
|
|
|
+ lbsAmapRegion({ pid: formData.cityId }).then(res => {
|
|
|
// 赋值区选项
|
|
|
this.areaList = res.data
|
|
|
// 获取选中区名称id
|
|
|
- var { lbsId, name } = res.data.find(item => item.name === district)
|
|
|
- formData.areaId = lbsId
|
|
|
+ var { id, name } = res.data.find(item => item.name === district)
|
|
|
+ formData.areaId = id
|
|
|
formData.area = name
|
|
|
// 请求街道选项
|
|
|
- lbsAmapRegion({ parentLbsId: formData.areaId }).then(res => {
|
|
|
+ lbsAmapRegion({ pid: formData.areaId }).then(res => {
|
|
|
// 赋值街道选项
|
|
|
this.streetList = res.data
|
|
|
// 获取选中街道名称id
|
|
|
- var { lbsId, name } = res.data.find(item => item.name === township)
|
|
|
- formData.streetId = lbsId
|
|
|
+ var { id, name } = res.data.find(item => item.name === township)
|
|
|
+ formData.streetId = id
|
|
|
formData.street = name
|
|
|
// 赋值GPS详细地址
|
|
|
formData.gpsAddress = data.name
|
|
@@ -217,57 +223,53 @@ export default {
|
|
|
attributes: { disabled: true, placeholder: 'GPS地址' }
|
|
|
},
|
|
|
{
|
|
|
- isShow:this.formOptions.address.isShow,
|
|
|
+ isShow: this.formOptions.address.isShow,
|
|
|
name: 'el-input',
|
|
|
md: 11,
|
|
|
- formItemAttributes: { label: '', prop: 'address', 'label-width': '0px', rules:this.formOptions.address.isRules },
|
|
|
- attributes: { disabled: !this.formOptions.address.isEdit , placeholder: '详细地址' }
|
|
|
+ formItemAttributes: { label: '', prop: 'address', 'label-width': '0px', rules: this.formOptions.address.isRules },
|
|
|
+ attributes: { disabled: !this.formOptions.address.isEdit, placeholder: '详细地址' }
|
|
|
},
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
- watch: {
|
|
|
- initBool(newVal) {
|
|
|
- if (newVal) {
|
|
|
- // 初始化请求省市区街道下拉选项数据
|
|
|
- lbsAmapRegion().then(res => {
|
|
|
- this.provinceList = res.data
|
|
|
- // 创建工单时获取ip地址定位赋值
|
|
|
- if (!this.id && this.$IpAdd.province) {
|
|
|
- var item = this.provinceList.find(item => item.name === this.$IpAdd.province)
|
|
|
- if (item) {
|
|
|
- this.orderInfo.provinceId = item.lbsId
|
|
|
- this.orderInfo.province = item.name
|
|
|
- }
|
|
|
+ methods: {
|
|
|
+ getinitlbslist() {
|
|
|
+ // 初始化请求省市区街道下拉选项数据
|
|
|
+ lbsAmapRegion({ pid: 0 }).then(res => {
|
|
|
+ this.provinceList = res.data
|
|
|
+ // 创建工单时获取ip地址定位赋值
|
|
|
+ if (!this.id && this.$IpAdd.province) {
|
|
|
+ var item = this.provinceList.find(item => item.name === this.$IpAdd.province)
|
|
|
+ if (item) {
|
|
|
+ this.orderInfo.provinceId = item.id
|
|
|
+ this.orderInfo.province = item.name
|
|
|
}
|
|
|
- if (this.orderInfo.provinceId) {
|
|
|
- lbsAmapRegion({ parentLbsId: this.orderInfo.provinceId }).then(res => {
|
|
|
- this.cityList = res.data
|
|
|
- // 创建工单时获取ip地址定位赋值
|
|
|
- if (!this.id && this.$IpAdd.city) {
|
|
|
- var item2 = this.cityList.find(item => item.name === this.$IpAdd.city)
|
|
|
- if (item2) {
|
|
|
- this.orderInfo.cityId = item2.lbsId
|
|
|
- this.orderInfo.city = item2.name
|
|
|
- }
|
|
|
- }
|
|
|
- if (this.orderInfo.cityId) {
|
|
|
- lbsAmapRegion({ parentLbsId: this.orderInfo.cityId }).then(res => {
|
|
|
- this.areaList = res.data
|
|
|
- })
|
|
|
- }
|
|
|
- if (this.orderInfo.areaId) {
|
|
|
- lbsAmapRegion({ parentLbsId: this.orderInfo.areaId }).then(res => {
|
|
|
- this.streetList = res.data
|
|
|
- })
|
|
|
+ }
|
|
|
+ if (this.orderInfo.provinceId) {
|
|
|
+ lbsAmapRegion({ pid: this.orderInfo.provinceId }).then(res => {
|
|
|
+ this.cityList = res.data
|
|
|
+ // 创建工单时获取ip地址定位赋值
|
|
|
+ if (!this.id && this.$IpAdd.city) {
|
|
|
+ var item2 = this.cityList.find(item => item.name === this.$IpAdd.city)
|
|
|
+ if (item2) {
|
|
|
+ this.orderInfo.cityId = item2.id
|
|
|
+ this.orderInfo.city = item2.name
|
|
|
}
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
+ }
|
|
|
+ if (this.orderInfo.cityId) {
|
|
|
+ lbsAmapRegion({ pid: this.orderInfo.cityId }).then(res => {
|
|
|
+ this.areaList = res.data
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (this.orderInfo.areaId) {
|
|
|
+ lbsAmapRegion({ pid: this.orderInfo.areaId }).then(res => {
|
|
|
+ this.streetList = res.data
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
delDataK(num) {
|
|
|
if (num <= 1) {
|
|
|
// 删除市
|