diff --git a/ruoyi-ui/src/api/map/index.js b/ruoyi-ui/src/api/map/index.js new file mode 100644 index 00000000..c5b02931 --- /dev/null +++ b/ruoyi-ui/src/api/map/index.js @@ -0,0 +1,12 @@ + + +import request from '@/utils/request' + +// 地图 情报板接口 +export function getEnergyBoardAPi(params){ + return request({ + url:'/iot/board/list', + method:'get', + params + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/assets/screen/xtb/xjbuttom.png b/ruoyi-ui/src/assets/screen/xtb/xjbuttom.png new file mode 100644 index 00000000..0f76beac Binary files /dev/null and b/ruoyi-ui/src/assets/screen/xtb/xjbuttom.png differ diff --git a/ruoyi-ui/src/assets/screen/xtb/xjleft.png b/ruoyi-ui/src/assets/screen/xtb/xjleft.png new file mode 100644 index 00000000..734de591 Binary files /dev/null and b/ruoyi-ui/src/assets/screen/xtb/xjleft.png differ diff --git a/ruoyi-ui/src/assets/screen/xtb/xjright.png b/ruoyi-ui/src/assets/screen/xtb/xjright.png new file mode 100644 index 00000000..cbb4559e Binary files /dev/null and b/ruoyi-ui/src/assets/screen/xtb/xjright.png differ diff --git a/ruoyi-ui/src/assets/screen/xtb/xjtop.png b/ruoyi-ui/src/assets/screen/xtb/xjtop.png new file mode 100644 index 00000000..22e1e05b Binary files /dev/null and b/ruoyi-ui/src/assets/screen/xtb/xjtop.png differ diff --git a/ruoyi-ui/src/views/boardView/editInfo.vue b/ruoyi-ui/src/views/boardView/editInfo.vue index e5481cb2..99fed844 100644 --- a/ruoyi-ui/src/views/boardView/editInfo.vue +++ b/ruoyi-ui/src/views/boardView/editInfo.vue @@ -437,13 +437,16 @@ export default { this.dialogVisible = true this.itemPropertyMap = new HashMap() this.alignmentNum = 2 + console.log('点击编辑按钮数据回显', this.boardEmitItem) this.dataForm = JSON.parse(JSON.stringify(this.boardEmitItem)) this.dataForm.formatStyle = this.formatStyle this.dataForm.COLOR = this.getColorValue(this.boardEmitItem.COLOR) console.log(this.dataForm, 'this.dataForm') // this.dataForm.FONT = this.getFont(this.boardEmitItem.FONT) this.dataForm.CONTENT = JSON.parse(JSON.stringify(this.boardEmitItem.CONTENT.replace('
', '\n').replace(/ /g, ' ').replace('', '\n'))) - this.dataForm.STAY = JSON.parse(JSON.stringify(Number(this.boardEmitItem.STAY) / 100)) + // this.dataForm.STAY = JSON.parse(JSON.stringify(Number(this.boardEmitItem.STAY) / 100)) + this.dataForm.STAY = Number(this.boardEmitItem.playbackDuration) / 10 + console.log('数据回显处理后的参数', this.dataForm) this.getFontSizeList() }, getColorValue(color) { diff --git a/ruoyi-ui/src/views/components/videoPlayer/myVideo.vue b/ruoyi-ui/src/views/components/videoPlayer/myVideo.vue new file mode 100644 index 00000000..c8bf7138 --- /dev/null +++ b/ruoyi-ui/src/views/components/videoPlayer/myVideo.vue @@ -0,0 +1,167 @@ + + + diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index a20a0098..7a71d96d 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -3,10 +3,6 @@
-
- -
-
@@ -22,7 +18,10 @@
-
+
@@ -55,31 +54,74 @@
信息模板
+
+ +
附近像机
+
- -
- - -
-
-
-
-
-
-
-
-
-
+ +
+ + +
+
+
+
+
+
+
+
+
- - - +
+
+
+
+ +
+
+
摄像机设备
+ + +
+
+
+ +
+
+
+
+
选择相机:
+
+ + + + +
+
+
+
{{ item.txt }}:
+
{{ item.val }}
+
+
+
+
+
+
+
+
+
+
- +
+
@@ -160,8 +202,7 @@
-
-
+
@@ -174,10 +215,23 @@ import editBoard from '@/views/boardView/editInfo.vue' import { invokedFunction, getDeviceRealtimeProperty } from '@/api/device/device.js' import { getAllVmsTemplate, deleteTemplate } from '@/api//board/template.js' import { getDicts } from '@/api/system/dict/data.js' +import roadView from '@/views/map/Thumbnail/index.vue' export default { name: 'indexView', data() { return { + cameraVal: '1', + cameraOptList: [ + { + value: '1', + label: '一号相机' + }, + { + value: '2', + label: '二号相机' + } + ], + editOutlineData: {}, formData: [], mapIds: '', screenDataSize: '', @@ -188,6 +242,7 @@ export default { dialogTit: '门架式可变信息标志YK16+270', dialogInfoLeft: false, dialogInfoRight: false, + dialogInfoCamera: false, mapDialogTop: '0px', mapDialogLeft: '0px', keyMonitoringList: [ @@ -247,13 +302,28 @@ export default { { id: 404, tit: '设备桩号', txt: 'K094+079', col: '#fff' }, { id: 405, tit: '设备厂商', txt: '光电比特', col: '#fff' }, { id: 406, tit: '设备状态', txt: '离线', col: '#888' } + ], + cameraDataList: [ + { id: 3001, txt: '设备名称', val: '疲劳唤醒设备1' }, + { id: 3002, txt: '设备编号', val: 'G00030497B0180001' }, + { id: 3003, txt: '设备桩号', val: 'K097+900' }, + { id: 3004, txt: '经/纬度', val: '117.071152/35.910659' }, + { id: 3005, txt: '道路名称', val: 'G35济菏高速' }, + { id: 3006, txt: '道路状况', val: '正常' }, + { id: 3007, txt: '方向', val: '菏泽' } + ], + cameraBtnList: [ + { id: 4001, dir: 'left', le: '26%', to: '33%', ro: 0 }, + { id: 4002, dir: 'up', le: '46%', to: '4%', ro: 90 }, + { id: 4003, dir: 'right', le: '65%', to: '33%', ro: 180 }, + { id: 4004, dir: 'downward', le: '46%', to: '62%', ro: 267 } ] } }, props: [], // 注册组件 - components: { GaoDeMap, carECharts, addBoard, editBoard }, + components: { GaoDeMap, carECharts, addBoard, editBoard, roadView }, // 计算属性 computed: {}, // 生命周期函数 @@ -282,9 +352,9 @@ export default { this.dialogInfoList = [] console.log('父组件地图点位', e) this.dialogInfoLeft = true - this.mapIds = e.target._opts.extData.ids - this.screenDataSize = e.target._opts.extData.screenSize - this.dialogTit = e.target._opts.extData.tit + this.mapIds = e.target._opts.extData.deviceId + this.screenDataSize = e.target._opts.extData.sceenSize + this.dialogTit = e.target._opts.extData.deviceName this.getTemplateHeaderFn() this.onSubmit(this.mapIds) // this.mapDialogTop = e.pixel.y + 'px' @@ -321,7 +391,7 @@ export default { let newArr = this.dialogInfoList.map(item => { let obj = {} - obj.STAY = item.stopTime + obj.STAY = item.STAY obj.ACTION = item.inScreenMode obj.SPEED = item.tcontents[0].fontSpacing obj.COORDINATE = item.screenSize.replace('*', '') @@ -344,33 +414,21 @@ export default { const param = { objectData: JSON.stringify(objAll) } - console.log('newArr11111', newArr) - - /* invokedFunction(65,'1B',{fileId:'1'}).then(res =>{ - debugger - console.log('发布消息,播放文件-----------------------------') - console.log(res) - }).catch(()=>{ - this.$modal.msgError("发布失败,请重试"); - })*/ invokedFunction(595, 11, { size: '65535', fileName: 'play099.lst' }) .then(res => { debugger - console.log('发布消息,校验文件名-------------------------------------') - console.log(res) + // console.log('发布消息,校验文件名-------------') if (res.data.result == '01') { invokedFunction(595, 13, { parameters: newArr }) .then(res => { debugger - console.log('发布消息,发送文件内容-----------------------------') - console.log(res) + // console.log('发布消息,发送文件内容-----') if (res.data.result == '01') { invokedFunction(595, '1B', { fileId: '99' }) .then(res => { debugger - console.log('发布消息,播放文件-----------------------------') - console.log(res) + // console.log('发布消息,播放文件-----') }) .catch(() => { this.$modal.msgError('发布失败,请重试') @@ -397,45 +455,15 @@ export default { }, // 回读 onSubmit(deviceId) { - // this.submitButton = true - // // this.loading = true - // this.contentList = [] - // // 获取情报板修改页面信息 - // const param = { - // deviceId: deviceId - // } - /* await getBoardContentData(param) - .then(res => { - console.log(res, 'onSubmit') - var contents = res.data.parameters - console.log(contents, 'onSubmit-----contents') - for (let i = 0; i < contents.length; i++) { - let item = contents[i] - item.COLOR = this.getColorStyle(item.COLOR) - item.FONT_SIZE = Number(item.FONT_SIZE.substring(0, 2)) + 'px' - item.ID = i - item.FONT = this.getFont(item.FONT) - this.contentList.push(item) - } - console.log(this.contentList, 'onSubmit-----this.contentList') - this.loading = false - this.submitButton = false - // this.rowDrop(); - }) - .catch(e => { - this.loading = false - this.submitButton = false - })*/ getDeviceRealtimeProperty(deviceId, '3A', { async: false }) .then(res => { - console.log('回读消息------------------------') var contentsA = res.data['3A'].content console.log('回读消息--1111111111---', contentsA) this.dialogInfoList = contentsA.map(item => { return { ...item, - stopTime: item.residenceTime, + STAY: item.playbackDuration, inScreenMode: item.screenEntryMethod, screenSize: item.displayAreaWidth + '*' + item.displayAreaHeight, tcontents: [ @@ -446,36 +474,13 @@ export default { fontType: item.font, fontColor: item.foregroundColor.toUpperCase(), formatStyle: item.horizontalAlignment, + STAY: item.playbackDuration / 10, content: item.textContent.replaceAll('\\,', ',').replaceAll('\\=', '=').replaceAll('\\\\n', '\n') } ] } }) - - console.log('回读处理后的数据', this.dialogInfoList) - - // for (let i = 0; i < contents.length; i++) { - // let item = contents[i] - // item.COLOR = item.foregroundColor - // item.FONT_SIZE = item.fontSize + 'px' - // item.ID = i - // item.FONT = item.font - // item.COORDINATE = this.covering(item.xCoordinate) + this.covering(item.yCoordinate) - // ;(item.screenSize = item.displayAreaWidth + '*' + item.displayAreaHeight), (item.CONTENT = item.textContent.replaceAll('\\,', ',')) - // item.CONTENT = item.CONTENT.replaceAll('\\=', '=') - // item.CONTENT = item.CONTENT.replaceAll('\\\\n', '\n') - // item.formatStyle = item.verticalAlignment - // this.contentList.push(item) - - // this.form.devicePixel = item.screenSize - // } - - // console.log(this.contentList, 'onSubmit-----this.contentList') - // this.rowDrop(); - - // this.loading = false - // this.submitButton = false }) .catch(e => { this.$modal.msgError('回读失败,请重试') @@ -522,7 +527,7 @@ export default { }, // 接收子组件新增待发模板 addInfo(form) { - console.log('待发新增', form) + // console.log('待发新增', form) this.dialogInfoList.push({ id: form.id, screenSize: form.screenSize, @@ -537,13 +542,6 @@ export default { ...this.processString(form.screenSize), ...this.processStrNum(form.COORDINATE) }) - console.log('新增模板111', this.dialogInfoList) - // this.getTemplateHeaderFn() - // console.log(this.dialogInfoList) - // form.ID = this.contentList.length - // this.contentList.push(deepClone(form)) - // this.$message.success('添加成功') - // this.$forceUpdate() }, // 打开添加信息弹窗 addMoDataInfoFn(type, mode) { @@ -556,6 +554,7 @@ export default { this.editType = type console.log('修改弹窗', item) this.boardEmitItem = { + ...item, FONT_SIZE: item.tcontents[0].fontSize + 'px', COLOR: item.tcontents[0].fontColor, CONTENT: item.tcontents[0].content, @@ -572,17 +571,7 @@ export default { tcontentsId: item.tcontents[0].id } }, - // // // 待下发 编辑 - // openQbbDrawer(item, index, type) { - // this.index_ = index - // console.log(item) - // this.boardEmitItem = item - // this.boardEmitItem.screenSize = this.form.devicePixel - // this.boardEmitItem.deviceId = this.deviceId - // this.boardEmitItem.type = type - // this.showEmit = true - // }, // 接收子组件form表单 修改 receiveForm(form) { console.log('接收子组件form表单 修改111111111', form) @@ -598,29 +587,11 @@ export default { // this.getTemplateHeaderFn() this.$forceUpdate() }, - dialogClose() { - this.showEmit = false - this.arrowRightVisible = false - // setTimeout(() => { - // this.allVmsTemplate('no') - // }, 500) - }, + delMoFn(item) { console.log(item) // deleteTemplate(item.tcontents[0].templateId) this.removeItemById(this.dialogInfoList, item.id) - - // this.$confirm('确认要删除吗?') - // .then(_ => { - // console.log(item) - // // deleteTemplate(item.tcontents[0].templateId) - // this.removeItemById(this.dialogInfoList, item.id) - // this.$message({ - // message: '删除成功!', - // type: 'success' - // }) - // }) - // .catch(_ => {}) }, putLeftFn(item) { console.log('点击事件', item) @@ -634,11 +605,27 @@ export default { this.dialogInfoRight = false }, showCeInfoFn() { + if (this.dialogInfoCamera) { + this.dialogInfoCamera = false + } this.dialogInfoRight = !this.dialogInfoRight }, + showCameraInfoFn() { + if (this.dialogInfoRight) { + this.dialogInfoRight = false + } + this.dialogInfoCamera = !this.dialogInfoCamera + }, subjectBtnFn(item) { this.subjectBtn = item.id }, + closeCameraBtnFn() { + this.dialogInfoCamera = false + }, + dialogClose() { + this.showEmit = false + this.arrowRightVisible = false + }, removeItemById(arr, id) { const index = arr.findIndex(item => item.id === id) // 找到要删除项的索引 if (index !== -1) { @@ -1091,6 +1078,7 @@ export default { background-color: #114c66; padding: 1vh 0.5vw; overflow-y: scroll; + position: relative; } .dialog_info_left_t { width: 100%; @@ -1283,6 +1271,78 @@ export default { opacity: 1; cursor: pointer; } +.info_right_camera { + width: 100%; + height: calc(100% - 4vh); + padding: 1vh 0.5vw; +} +.info_right_camera_top { + width: 100%; + height: 20vh; +} +.info_right_camera_bom { + width: 100%; + padding: 1vh 0; + height: calc(100% - 20vh); + display: flex; +} +.camera_bom_left { + width: 50%; + height: 100%; + border-right: 1px dashed #285a71; +} +.camera_bom_right { + width: 50%; + height: 100%; +} +.camera_bom_left_item { + width: 100%; + color: #fff; + display: flex; + font-size: 14px; + padding-bottom: 0.7vh; +} +.camera_bom_left_item_txt { + width: 31%; + color: #3de8ff; +} +.camera_bom_left_item_val { + color: #fff; + font-size: 13px; +} +.camera_bom_right_t { + width: 100%; + height: 60%; + position: relative; +} +.camera_bom_right_b { + width: 100%; + height: 40%; + // background-color: deeppink; +} +.camera_bom_right_t_box { + width: 2vw; + height: 4vh; + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + background-color: #005f87; + border-radius: 50%; + border: 1px solid #2191b1; +} +.camera_bom_right_t_h_po { + width: 1vw; + height: 5vh; + position: absolute; + left: 27%; + top: 33%; + cursor: pointer; + background-image: url('~@/assets/screen/xtb/xjleft.png'); + background-size: 100% 100%; + background-repeat: no-repeat; + background-position: center; +} // background-color: #104b65; // background-image: url('~@/assets/screen/xtb/qbbtit.png'); // background-size: 100% 100%; @@ -1344,4 +1404,15 @@ export default { ::v-deep .el-collapse-item { margin-bottom: 1vh; } +::v-deep .el-input--mini .el-input__icon { + line-height: 20px; + color: #fff; +} +::v-deep .el-input--mini .el-input__inner { + height: 20px; + line-height: 20px; + background-color: #086d8f; + border: none; + color: #fff; +} \ No newline at end of file diff --git a/ruoyi-ui/src/views/map/Thumbnail/data.js b/ruoyi-ui/src/views/map/Thumbnail/data.js new file mode 100644 index 00000000..d10714f0 --- /dev/null +++ b/ruoyi-ui/src/views/map/Thumbnail/data.js @@ -0,0 +1,192 @@ +export const actualLocationList = [ + { + code: "K54", + name: "殷家林枢纽", + intervalDistance: 0.0, + lng: 116.865231, + lat: 36.57973, + }, + { + code: "K59", + name: "大学城收费站", + intervalDistance: 4.895, + lng: 116.814343, + lat: 36.581052, + }, + { + code: "K72", + name: "长清收费站", + lng: 116.865231, + intervalDistance: 13.558, + lat: 36.57973, + }, + + { + code: "K79", + name: "长清服务区", + intervalDistance: 6.163, + lng: 116.697041, + lat: 36.428953, + }, + { + code: "K83", + name: "松林枢纽", + intervalDistance: 4.875, + lng: 116.496503, + lat: 36.292459, + }, + { + code: "K86", + name: "孝里收费站", + intervalDistance: 2.614, + lng: 116.638217, + lat: 36.38667, + }, + { + code: "K99", + name: "*平阴北收费站", + intervalDistance: 13.251, + lng: 116.447305, + lat: 36.32884, + }, + { + code: "K105", + name: "平阴收费站", + intervalDistance: 6.154, + lng: 116.482042, + lat: 36.276899, + }, + { + code: "K114", + name: "平阴停车区", + intervalDistance: 8.501, + lng: 116.459654, + lat: 36.204811, + }, + { + code: "K117", + name: "孔村枢纽", + intervalDistance: 3.473, + lng: 116.454379, + lat: 36.173621, + }, + { + code: "K126", + name: "平阴南收费站", + intervalDistance: 8.345, + lng: 116.445836, + lat: 36.100732, + }, + { + code: "K139", + name: "东平服务区", + intervalDistance: 13.594, + lng: 116.417716, + lat: 35.984511, + }, + { + code: "K145", + name: "东平收费站", + intervalDistance: 6.116, + lng: 116.414862, + lat: 35.930073, + }, + { + code: "K155", + name: "东平湖枢纽", + intervalDistance: 9.719, + lng: 116.381047, + lat: 35.844376, + }, + { + code: "K159", + name: "沙河停车区", + lng: 116.366287, + intervalDistance: 3.504, + lat: 35.823098, + }, + { + code: "K173", + name: "*梁山东收费站", + intervalDistance: 14.794, + lng: 116.222211, + lat: 35.684336, + }, + { + code: "K179", + name: "梁山收费站", + intervalDistance: 5.446, + lng: 116.222163, + lat: 35.684368, + }, + { + code: "K186", + name: "梁山服务区", + intervalDistance: 6.665, + lng: 116.177576, + lat: 35.638136, + }, + { + code: "K190", + name: "嘉祥西收费站", + intervalDistance: 4.434, + lng: 116.142081, + lat: 35.610556, + }, + { + code: "K208", + name: "王官屯枢纽", + intervalDistance: 18.484, + lng: 116.073032, + lat: 35.462815, + }, +]; + +export const canvasList = [ + { + name: "殷家林枢纽", + code: "K54+394", + line: "G3京台高速", + isFoot: true, + distance: 171, + }, + { name: "大学城收费站", code: "K59+289", distance: 50.563 }, + { name: "长清收费站", code: "K72+847", distance: 140.05 }, + { name: "长清服务区", code: "K79+010", distance: 63.66 }, + { + name: "松竹枢纽", + code: "K83+885", + line: "S0101济南绕城高速二环西环段", + distance: 50.358, + }, + { name: "孝里收费站", code: "K86+499", distance: 27 }, + { name: "平阴北收费站", code: "K99+750", distance: 136.88 }, + { name: "平阴收费站", code: "K105+904", distance: 63.57 }, + { name: "平阴停车区", code: "K114+405", distance: 87.815 }, + { + name: "孔村枢纽", + code: "K117+878", + line: "G22青兰高速", + distance: 35.876, + }, + { name: "平阴南收费站", code: "K126+223", distance: 86.2 }, + { name: "东平服务区", code: "K139+817", distance: 140.42 }, + { name: "东平收费站", code: "K145+933", distance: 63 }, + { + name: "东平湖枢纽", + code: "K155+652", + line: "S30董梁高速", + distance: 70, + }, + { name: "沙河停车区", code: "K159+156", distance: 70 }, + { name: "梁山东收费站", code: "K173+950", distance: 70 }, + { name: "梁山收费站", code: "K179+396", distance: 70, icon: "tag4" }, + { name: "梁山服务区", code: "K186+061", distance: 70 }, + { name: "嘉祥西收费站", code: "K190+495", distance: 70 }, + { + name: "王官屯枢纽", + code: "K208+979", + line: "G1511日兰高速", + distance: 120, + }, +]; diff --git a/ruoyi-ui/src/views/map/Thumbnail/images/bg.png b/ruoyi-ui/src/views/map/Thumbnail/images/bg.png new file mode 100644 index 00000000..4ea3b3cf Binary files /dev/null and b/ruoyi-ui/src/views/map/Thumbnail/images/bg.png differ diff --git a/ruoyi-ui/src/views/map/Thumbnail/images/tag0.png b/ruoyi-ui/src/views/map/Thumbnail/images/tag0.png new file mode 100644 index 00000000..6faa4e67 Binary files /dev/null and b/ruoyi-ui/src/views/map/Thumbnail/images/tag0.png differ diff --git a/ruoyi-ui/src/views/map/Thumbnail/images/tag1.png b/ruoyi-ui/src/views/map/Thumbnail/images/tag1.png new file mode 100644 index 00000000..b7172728 Binary files /dev/null and b/ruoyi-ui/src/views/map/Thumbnail/images/tag1.png differ diff --git a/ruoyi-ui/src/views/map/Thumbnail/images/tag2.png b/ruoyi-ui/src/views/map/Thumbnail/images/tag2.png new file mode 100644 index 00000000..c414a625 Binary files /dev/null and b/ruoyi-ui/src/views/map/Thumbnail/images/tag2.png differ diff --git a/ruoyi-ui/src/views/map/Thumbnail/images/tag3.png b/ruoyi-ui/src/views/map/Thumbnail/images/tag3.png new file mode 100644 index 00000000..b4b2c144 Binary files /dev/null and b/ruoyi-ui/src/views/map/Thumbnail/images/tag3.png differ diff --git a/ruoyi-ui/src/views/map/Thumbnail/images/tag4.png b/ruoyi-ui/src/views/map/Thumbnail/images/tag4.png new file mode 100644 index 00000000..beab68e6 Binary files /dev/null and b/ruoyi-ui/src/views/map/Thumbnail/images/tag4.png differ diff --git a/ruoyi-ui/src/views/map/Thumbnail/index.vue b/ruoyi-ui/src/views/map/Thumbnail/index.vue new file mode 100644 index 00000000..b384be68 --- /dev/null +++ b/ruoyi-ui/src/views/map/Thumbnail/index.vue @@ -0,0 +1,176 @@ + + + + + diff --git a/ruoyi-ui/src/views/map/Thumbnail/utils.js b/ruoyi-ui/src/views/map/Thumbnail/utils.js new file mode 100644 index 00000000..db5df056 --- /dev/null +++ b/ruoyi-ui/src/views/map/Thumbnail/utils.js @@ -0,0 +1,20 @@ +import { actualLocationList, canvasList } from "./data.js"; + +export function getScaleByActualData() { + const actualDis = actualLocationList.reduce( + (count, item) => count + item.intervalDistance, + 0 + ); + + const idleCanvasWidth = 1440; + + const ratio = idleCanvasWidth / actualDis; + + return canvasList.map((item, index) => { + if (index) { + item.distance = actualLocationList[index].intervalDistance * ratio; + } + + return item; + }); +} diff --git a/ruoyi-ui/src/views/map/index.vue b/ruoyi-ui/src/views/map/index.vue index 8f815035..b18391c6 100644 --- a/ruoyi-ui/src/views/map/index.vue +++ b/ruoyi-ui/src/views/map/index.vue @@ -7,6 +7,7 @@ window._AMapSecurityConfig = { } import AMapLoader from '@amap/amap-jsapi-loader' import titImgSrc from '@/assets/screen/ltit.png' +import { getEnergyBoardAPi } from '@/api/map/index.js' export default { name: 'mapView', data() { @@ -14,6 +15,7 @@ export default { map: null, infoWindow: '', addMarkDataList: [], + markBoardDataList: [], markDataList: [ { id: 2001, @@ -22,7 +24,6 @@ export default { longitude: 116.86532, latitude: 36.57979, screenSize: '768*64', - imgUrl: require('@/assets/screen/xtb/fwqdot.png') }, { @@ -46,13 +47,24 @@ export default { ] } }, + // created() { + // this.getEnergyBoardFn() + // }, mounted() { - this.initAMap() + this.getEnergyBoardFn() + // this.initAMap() }, unmounted() { this.map?.destroy() }, methods: { + getEnergyBoardFn() { + getEnergyBoardAPi().then(res => { + console.log('地图首页情报板点位', res) + this.markBoardDataList = res + this.initAMap() + }) + }, initAMap() { AMapLoader.load({ key: '03669f433d77137fe6d048b428b00dd8', // 申请好的Web端开发者Key,首次调用 load 时必填 @@ -335,17 +347,18 @@ export default { this.addMarkDataList = [] this.infoWindow = new window.AMap.InfoWindow({ offset: new AMap.Pixel(0, 0), anchor: 'middle-right' }) - this.markDataList.forEach((item, index) => { + this.markBoardDataList.forEach((item, index) => { // 创建一个 Marker 实例:创建点标记 - const marker = new AMap.Marker({ - position: new AMap.LngLat(item.longitude, item.latitude), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9] + let marker = new AMap.Marker({ + position: new AMap.LngLat(...item.lnp.split(',')), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9] offset: new AMap.Pixel(0, 0), - title: item.tit, + title: item.deviceName, map: this.map, extData: item, icon: new AMap.Icon({ size: new AMap.Size(50, 50), // 图标尺寸 - image: item.imgUrl, // Icon的图像 + // image: item.imgUrl, // Icon的图像 + image: require('@/assets/screen/xtb/fwqdot.png'), // Icon的图像 imageOffset: new AMap.Pixel(0, 0), // 图像相对展示区域的偏移量,适于雪碧图等 imageSize: new AMap.Size(50, 50) // 根据所设置的大小拉伸或压缩图片 }) @@ -381,6 +394,7 @@ export default { // }) }) }) + console.log('地图动态获取后台参数', this.addMarkDataList) // 将创建的点标记添加到已有的地图实例: this.map.add(this.addMarkDataList) })