|
@@ -10,6 +10,8 @@ import { list as functionList } from '@/api/device/function'
|
|
|
|
|
|
import { options as blogClass } from '@/api/music/blogclass'
|
|
import { options as blogClass } from '@/api/music/blogclass'
|
|
|
|
|
|
|
|
+import { options as mapList } from '@/api/operation/map'
|
|
|
|
+
|
|
// 设备列表
|
|
// 设备列表
|
|
const devMixin = {
|
|
const devMixin = {
|
|
data() {
|
|
data() {
|
|
@@ -615,6 +617,42 @@ const systemMixin = {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 省市区
|
|
|
|
+const mapMixin = {
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ mapOptions: []
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ async mounted() {
|
|
|
|
+ await this.getMapOptions()
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ // 省市区
|
|
|
|
+ getMapOptions() {
|
|
|
|
+ return new Promise((reslove, reject) => {
|
|
|
|
+ mapList().then(res => {
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ reslove(this.mapOptions = res.data)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ areaFormatter(row) {
|
|
|
|
+ if (this.mapOptions.length > 0) {
|
|
|
|
+ let province = this.mapOptions.find(i => i.id == row.province)
|
|
|
|
+ let provinceName = province.name
|
|
|
|
+ let city = province.childList.length > 0 ? province.childList.find(i => i.id == row.city) : ''
|
|
|
|
+ let cityName = city ? `-${city.name}` : ''
|
|
|
|
+ let area = city && city.childList.length > 0 ? city.childList.find(i => i.id == row.area) : ''
|
|
|
|
+ let areaName = area ? `-${area.name}` : ''
|
|
|
|
+ return `${provinceName}${cityName}${areaName}`
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
export {
|
|
export {
|
|
devMixin,
|
|
devMixin,
|
|
devModeMixin,
|
|
devModeMixin,
|
|
@@ -640,5 +678,6 @@ export {
|
|
coverMixin,
|
|
coverMixin,
|
|
channelMixin,
|
|
channelMixin,
|
|
systemMixin,
|
|
systemMixin,
|
|
- blogClassMixin
|
|
|
|
|
|
+ blogClassMixin,
|
|
|
|
+ mapMixin
|
|
}
|
|
}
|