From a0e11b42195190c55b6591db5f52db27b49ca578 Mon Sep 17 00:00:00 2001 From: h7ml Date: Thu, 23 Jun 2022 17:31:11 +0800 Subject: [PATCH] =?UTF-8?q?feat(components):=20=E7=99=BE=E5=BA=A6=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复压测界面全屏问题 --- CHANGELOG.EN.md | 1 + CHANGELOG.ZH.md | 1 + CHANGELOG.md | 1 + src/config/net.config.js | 2 +- src/dgiot/components/DgiotAmis/render.vue | 11 +- src/i18n/zh.js | 1 + src/views/CloudFunction/lowcode/index.vue | 3 + src/views/DeviceCloud/manage/devicelist.vue | 4 +- src/views/DeviceCloud/manage/home_index.vue | 4 +- src/views/DeviceCloud/manage/js/proddetail.js | 105 ++++++++++++++- src/views/DeviceCloud/manage/proddetail.vue | 127 ++++++++++++++++++ src/views/DeviceCloud/manage/product.vue | 2 +- 12 files changed, 255 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.EN.md b/CHANGELOG.EN.md index b24c4bc988..25bf1de539 100644 --- a/CHANGELOG.EN.md +++ b/CHANGELOG.EN.md @@ -12,6 +12,7 @@ ### Features * **components:** 设备管理 ([0a9756c](https://github.com/dgiot/dgiot-dashboard/commit/0a9756cadaa45a0796f345fa064c1f1f239af7ee)) +* **components:** 云压测 ([ed99eee](https://github.com/dgiot/dgiot-dashboard/commit/ed99eee177a5947609cfa35998bdd1f8b3d3a9ab)) * **projects:** 云压测 ([97a7f62](https://github.com/dgiot/dgiot-dashboard/commit/97a7f62e0b32949dc2bc4d1297a30befa76fe583)) * **projects:** scripts ([d4566d9](https://github.com/dgiot/dgiot-dashboard/commit/d4566d90c7ca08ef84107f2a7ff3b8b8cf0da6e8)) diff --git a/CHANGELOG.ZH.md b/CHANGELOG.ZH.md index b24c4bc988..25bf1de539 100644 --- a/CHANGELOG.ZH.md +++ b/CHANGELOG.ZH.md @@ -12,6 +12,7 @@ ### Features * **components:** 设备管理 ([0a9756c](https://github.com/dgiot/dgiot-dashboard/commit/0a9756cadaa45a0796f345fa064c1f1f239af7ee)) +* **components:** 云压测 ([ed99eee](https://github.com/dgiot/dgiot-dashboard/commit/ed99eee177a5947609cfa35998bdd1f8b3d3a9ab)) * **projects:** 云压测 ([97a7f62](https://github.com/dgiot/dgiot-dashboard/commit/97a7f62e0b32949dc2bc4d1297a30befa76fe583)) * **projects:** scripts ([d4566d9](https://github.com/dgiot/dgiot-dashboard/commit/d4566d90c7ca08ef84107f2a7ff3b8b8cf0da6e8)) diff --git a/CHANGELOG.md b/CHANGELOG.md index b24c4bc988..25bf1de539 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ ### Features * **components:** 设备管理 ([0a9756c](https://github.com/dgiot/dgiot-dashboard/commit/0a9756cadaa45a0796f345fa064c1f1f239af7ee)) +* **components:** 云压测 ([ed99eee](https://github.com/dgiot/dgiot-dashboard/commit/ed99eee177a5947609cfa35998bdd1f8b3d3a9ab)) * **projects:** 云压测 ([97a7f62](https://github.com/dgiot/dgiot-dashboard/commit/97a7f62e0b32949dc2bc4d1297a30befa76fe583)) * **projects:** scripts ([d4566d9](https://github.com/dgiot/dgiot-dashboard/commit/d4566d90c7ca08ef84107f2a7ff3b8b8cf0da6e8)) diff --git a/src/config/net.config.js b/src/config/net.config.js index bb714fcb71..4ce72f880e 100644 --- a/src/config/net.config.js +++ b/src/config/net.config.js @@ -3,7 +3,7 @@ module.exports = { proxy, baseURL: proxy[0].path, contentType: 'application/json', - requestTimeout: 1000 * 1 * 30, + requestTimeout: 1000 * 60 * 3, successCode: [ 200, 0, diff --git a/src/dgiot/components/DgiotAmis/render.vue b/src/dgiot/components/DgiotAmis/render.vue index 35de9c14df..1d897e6155 100644 --- a/src/dgiot/components/DgiotAmis/render.vue +++ b/src/dgiot/components/DgiotAmis/render.vue @@ -118,10 +118,11 @@ config.headers = headers || {} config.method = method _.merge(config.headers, { - author: 'iotn2n', platform: 'amis', departmentToken: store.getters['user/departmentToken'], sessionToken: store.getters['user/token'], + author: 'h7ml', + email: 'h7ml@qq.com', }) if (method === 'get' && data) { config.params = data @@ -197,6 +198,12 @@ console.log('replaceArr', replaceArr) console.info('请求url', url) console.groupEnd() + if (url.indexOf('null') == -1 || url.indexOf('undefined') == -1) { + throw new Error(`url请求参数不正确${url}`) + console.log(url) + // topo 以下处理了 请求参数替换不正确时页面报错的情况 + url = url.replace('/null', '/').replace('/undefined', '/') + } // return axios(url, config) // topo: fix https://gitee.com/dgiiot/dgiot/issues/I4RRY3 // 处理静态资源部署在在二级下页面下,但是页面 @@ -218,8 +225,8 @@ // 当前页面路由router const { path } = this.$route // 解决设计界面弹出提示问题 - // if (!path.indexOf('design')) { console.log(path.indexOf('design'), path) + // if (!path.indexOf('design')) { this.$message({ type: type, message: msg, diff --git a/src/i18n/zh.js b/src/i18n/zh.js index 331b5c23b7..eb72677f21 100644 --- a/src/i18n/zh.js +++ b/src/i18n/zh.js @@ -131,6 +131,7 @@ export default { lists: '列表', info: '信息', address: '安装位置', + 'Longitude and latitude': '经纬度', Department: '所属部门', 'Equipment Overview': '设备概况', 'device status': '设备状态', diff --git a/src/views/CloudFunction/lowcode/index.vue b/src/views/CloudFunction/lowcode/index.vue index d5bff8c90b..181f7d55a7 100644 --- a/src/views/CloudFunction/lowcode/index.vue +++ b/src/views/CloudFunction/lowcode/index.vue @@ -514,6 +514,9 @@ setTreeFlag: 'settings/setTreeFlag', }), async switchlanguage(v) { + if (!v.language) { + return false + } await putView(v.objectId, { language: v.language }) this.$message({ type: 'success', diff --git a/src/views/DeviceCloud/manage/devicelist.vue b/src/views/DeviceCloud/manage/devicelist.vue index 3bd7b2c206..3486c4d37c 100644 --- a/src/views/DeviceCloud/manage/devicelist.vue +++ b/src/views/DeviceCloud/manage/devicelist.vue @@ -1105,7 +1105,9 @@ _this.list.forEach((t) => { topicsKeys.forEach((j) => { if (t.objectId == j) { - const mergeInfo = _.merge(t, parseString[j]) + const mergeInfo = _.merge(t, parseString[j], { + detail: { address: parseString[j].address }, + }) console.log(`更新设备${t.name}`) args.name = t.name console.log(mergeInfo, parseString[j]) diff --git a/src/views/DeviceCloud/manage/home_index.vue b/src/views/DeviceCloud/manage/home_index.vue index cbce04cab8..4397ad36ba 100644 --- a/src/views/DeviceCloud/manage/home_index.vue +++ b/src/views/DeviceCloud/manage/home_index.vue @@ -1236,7 +1236,9 @@ _this.list.forEach((t) => { topicsKeys.forEach((j) => { if (t.objectId == j) { - const mergeInfo = _.merge(t, parseString[j]) + const mergeInfo = _.merge(t, parseString[j], { + detail: { address: parseString[j].address }, + }) console.log(`更新设备${t.name}`) args.name = t.name console.log(mergeInfo, parseString[j]) diff --git a/src/views/DeviceCloud/manage/js/proddetail.js b/src/views/DeviceCloud/manage/js/proddetail.js index 9f08855152..a456f4c9ec 100644 --- a/src/views/DeviceCloud/manage/js/proddetail.js +++ b/src/views/DeviceCloud/manage/js/proddetail.js @@ -38,7 +38,24 @@ var isallchannel = false var isupdatetrue = '' import dgiotViews from '@/views/CloudFunction/lowcode' import { getProtocol } from '@/api/Protocol' - +import { + BaiduMap, + BmCityList, + BmControl, + BmGeolocation, + BmInfoWindow, + BmlMarkerClusterer, + BmMapType, + BmMarker, + BmNavigation, + BmOverviewMap, + BmPanorama, + BmScale, + BmLabel, + BmView, + BmLocalSearch, + BmPointCollection, +} from 'vue-baidu-map' export default { components: { mqttLog, @@ -46,6 +63,22 @@ export default { 'dgiot-wmx': wmxdetail, 'dgiot-profile': profile, 'thing-form': thingForm, + BmLocalSearch, + BmPointCollection, + BmInfoWindow, + BmScale, + BmMapType, + BmView, + BmOverviewMap, + BmPanorama, + BmControl, + BmLabel, + BaiduMap, + BmNavigation, + BmGeolocation, + BmCityList, + BmMarker, + BmlMarkerClusterer, }, data() { const validCode = (rule, value, callback) => { @@ -631,9 +664,18 @@ export default { }, ProductSecret: '', dynamicReg: false, + dialog_address: false, productId: '', productName: '', productdetail: { + config: { + address: '余杭区良渚平高创业城c1座', + location: { + latitude: '120.161324', + longitude: '30.262441', + __type: 'GeoPoint', + }, + }, thing: { properties: [], events: [], services: [], tags: [] }, }, topicData: [], @@ -862,6 +904,61 @@ export default { this.subdialogtimer = null }, methods: { + async handleAddressClose() { + this.dialog_address = !this.dialog_address + await putProduct(this.productObj.objectId, { + config: this.productdetail.config, + }) + this.$message({ + type: 'success', + message: '安装位置更新成功', + showClose: true, + duration: 2000, + }) + }, + inputAddress() { + const address = this.productdetail.config.addres + console.log(1111111111111111,addres) + // https://lbsyun.baidu.com/jsdemo.htm#wAddressParseSingle 根据位置解析 + var map = new BMapGL.Map('container') + map.centerAndZoom(new BMapGL.Point(116.331398, 39.897445), 12) + //创建地址解析器实例 + var myGeo = new BMapGL.Geocoder() + // 将地址解析结果显示在地图上,并调整地图视野 + myGeo.getPoint( + address, + function (point) { + if (point) { + map.centerAndZoom(point, 16) + map.addOverlay( + new BMapGL.Marker(point, { title: address }) + ) + } else { + alert('您选择的地址没有解析到结果!') + } + }, + '北京市' + ) + console.log(address) + }, + mapClick(e) { + this.productdetail.config.location = { + __type: 'GeoPoint', + latitude: e.point.lat, + longitude: e.point.lng, + } + console.log(e,this.productdetail.config) + // this.center.lng = e.point.lng + // this.center.lat = e.point.lat + // this.addresspointer = + // e.point.lng.toFixed(6) + ',' + e.point.lat.toFixed(6) + const geocoder = new BMap.Geocoder() // 创建地址解析器的实例 + // let Marker = new BMap.Marker() + geocoder.getLocation(e.point, (rs) => { + console.log(rs) + this.productdetail.config.address = rs.address + }) + }, toggleSwitch(row) { row.isshow = !row.isshow this.preserve('isshow') @@ -3156,6 +3253,12 @@ export default { parser: [], profile: [], basedate: { params: [] }, + address: '余杭区良渚平高创业城c1座', + location: { + latitude: '120.161324', + longitude: '30.262441', + __type: 'GeoPoint', + }, }, }) this.productName = response.name diff --git a/src/views/DeviceCloud/manage/proddetail.vue b/src/views/DeviceCloud/manage/proddetail.vue index 6e37e73439..bf09dd2b47 100644 --- a/src/views/DeviceCloud/manage/proddetail.vue +++ b/src/views/DeviceCloud/manage/proddetail.vue @@ -1,6 +1,115 @@