From a7a88e6706c4cbc3fee4fffd8721d1d12470279f Mon Sep 17 00:00:00 2001 From: guanj Date: Mon, 3 Nov 2025 10:36:11 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=82=B9=E7=A6=BB?= =?UTF-8?q?=E7=BA=BF=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../select-item-bind-setting/index.vue | 2 +- .../mt-edit/composables/thumbnail.ts | 4 +- src/components/mt-preview-ypt/index.vue | 2 +- src/components/mt-preview-zl/index.ts | 3 + src/components/mt-preview-zl/index.vue | 1173 +++++++++++++++++ src/components/mt-preview/index.vue | 15 +- src/export.ts | 3 +- src/router/index.ts | 6 + src/utils/mqtt.ts | 2 +- src/utils/request.ts | 8 +- src/views/preview/index_ZL.vue | 19 + 11 files changed, 1225 insertions(+), 12 deletions(-) create mode 100644 src/components/mt-preview-zl/index.ts create mode 100644 src/components/mt-preview-zl/index.vue create mode 100644 src/views/preview/index_ZL.vue diff --git a/src/components/mt-edit/components/layout/right-aside/select-item-bind-setting/index.vue b/src/components/mt-edit/components/layout/right-aside/select-item-bind-setting/index.vue index 1e1568b..3bafe7c 100644 --- a/src/components/mt-edit/components/layout/right-aside/select-item-bind-setting/index.vue +++ b/src/components/mt-edit/components/layout/right-aside/select-item-bind-setting/index.vue @@ -5,7 +5,7 @@ label="监测点" size="small" class="mt-10px" - v-if="item_title == '绑定监测点' || item_title == '绑定指标'" + >
{ // //记录要移除的svg元素 const shouldRemoveSvgNodes = [] // 获取到所有的SVG 得到一个数组 目前只有自定义连线需要特殊处理 别的元素直接使用html2canvas就可以 - + const svgElements: NodeListOf = document.body.querySelectorAll(`#${canvas_id} .mt-line-render`) // 遍历这个数组 for (const item of svgElements) { @@ -41,7 +41,7 @@ export const useGenThumbnail = async (canvas_id: string = 'mtCanvasArea') => { const width = el.offsetWidth const height = el.offsetHeight - + const canvas = await html2canvas(el, { useCORS: true, scale: 2, diff --git a/src/components/mt-preview-ypt/index.vue b/src/components/mt-preview-ypt/index.vue index af983ef..370188d 100644 --- a/src/components/mt-preview-ypt/index.vue +++ b/src/components/mt-preview-ypt/index.vue @@ -296,7 +296,7 @@ const onMouseWheel = (e: WheelEvent) => { // 如果缩放中心是鼠标位置,计算新的平移值以保持视觉中心 if (canvasAreaRef.value) { - const rect = canvasAreaRef.value.getBoundingClientRect() + const rect = canvasAreaRef.value?.getBoundingClientRect() const mouseX = e.clientX - rect.left const mouseY = e.clientY - rect.top diff --git a/src/components/mt-preview-zl/index.ts b/src/components/mt-preview-zl/index.ts new file mode 100644 index 0000000..d66ddb0 --- /dev/null +++ b/src/components/mt-preview-zl/index.ts @@ -0,0 +1,3 @@ +import MtPreview from './index.vue' + +export default MtPreview diff --git a/src/components/mt-preview-zl/index.vue b/src/components/mt-preview-zl/index.vue new file mode 100644 index 0000000..e316092 --- /dev/null +++ b/src/components/mt-preview-zl/index.vue @@ -0,0 +1,1173 @@ + + + + + diff --git a/src/components/mt-preview/index.vue b/src/components/mt-preview/index.vue index 1930000..98ec1bc 100644 --- a/src/components/mt-preview/index.vue +++ b/src/components/mt-preview/index.vue @@ -588,6 +588,7 @@ const setImportJson = (exportJson: IExportJson) => { //报警设备闪烁 if (findTransmissionDeviceIdsByKeyList(list.value).includes(item.id)) { // item.props.fill.val = '#fcfc57' + item.props.fill.val = sendColor.value item.common_animations.val = 'flash' if (findTransmissionDeviceIdsByKeyList(listMax.value).includes(item.id)) { @@ -1027,16 +1028,26 @@ const setMqtt = async () => { await mqttClient.value.subscribe('/zl/rtData/#') // 设置消息接收回调 - mqttClient.value.onMessage((subscribe: string, message: any) => { + mqttClient.value.onMessage(async (subscribe: string, message: any) => { const msg: any = uint8ArrayToObject(message) console.log('🚀 ~ 接受消息:', msg) - setTimeout(() => { + list.value = [...new Set(msg.filter((item: any) => item.devStatus === 1).map((item: any) => item.lineId))] + sendColor.value = '#ff0000' + // await setImportJson(savedExportJson.value) + + await setTimeout(() => { done_json.value.forEach(item => { msg.forEach((msgValue: any) => { if (item.id == msgValue.id) { item.props.text.val = item.props.text.val.replace(/#{3}/g, msgValue.value) //'B相负载电流-CP95:31' } }) + list.value.forEach((listValue: any) => { + if (listValue == item.lineId && item.type == 'svg') { + item.props.fill.val = '#ff0000' + // item.common_animations.val = 'flash' + } + }) }) }, 100) }) diff --git a/src/export.ts b/src/export.ts index 3ed3e7b..8095254 100644 --- a/src/export.ts +++ b/src/export.ts @@ -8,5 +8,6 @@ import MtDzr from '@/components/mt-dzr' import MtEdit from '@/components/mt-edit' import MtPreview from '@/components/mt-preview' import MtPreviewYpt from '@/components/mt-preview-ypt' +import MtPreviewZl from '@/components/mt-preview-zl' import { leftAsideStore } from '@/components/mt-edit/store/left-aside' -export { MtDzr, MtEdit, MtPreview, leftAsideStore, MtPreviewYpt } +export { MtDzr, MtEdit, MtPreview, leftAsideStore, MtPreviewYpt,MtPreviewZl } diff --git a/src/router/index.ts b/src/router/index.ts index 6a15174..eba6dcb 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -25,6 +25,12 @@ export const constantRoutes = [ path: '/preview_YPT', component: () => import('../views/preview/index_YPT.vue') }, + { + // 云平台预览页面 + name: 'preview_ZL', + path: '/preview_ZL', + component: () => import('../views/preview/index_ZL.vue') + }, { name: 'edit-load', path: '/edit-load', diff --git a/src/utils/mqtt.ts b/src/utils/mqtt.ts index 1d5948c..9cd89b6 100644 --- a/src/utils/mqtt.ts +++ b/src/utils/mqtt.ts @@ -55,7 +55,7 @@ class MQTT { // const mqttUrl = 'ws://192.168.1.103:8083/mqtt' const mqttUrl = localStorage.getItem('MQTTZUTAI') == 'null' - ? 'ws://192.168.1.24:8085/mqtt' + ? 'ws://192.168.1.103:8083/mqtt' : localStorage.getItem('MQTTZUTAI') console.log('🚀 ~ MQTT ~ init ~ mqttUrl:', mqttUrl) this.client = mqtt.connect(mqttUrl, this.defaultOptions as IClientOptions) diff --git a/src/utils/request.ts b/src/utils/request.ts index 4016a6b..3c871c2 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -19,11 +19,11 @@ class HttpRequest { instance.interceptors.request.use( config => { // 添加全局的loading.. - // config.headers['Authorization'] = - // 'bearer ' + JSON.parse(window.localStorage.getItem('adminInfo') || '{}').access_token // 请求头带上token token要在登录的时候保存在localStorage中 - config.headers['Authorization'] = - 'bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5kZXgiOiJmYTM3YjkzY2M5MGQ0YzE3ODRjYThmNmRlYmRkZWUxYSIsInVzZXJfbmFtZSI6InJvb3QiLCJzY29wZSI6WyJhbGwiXSwibmlja25hbWUiOiLotoXnuqfnrqHnkIblkZgiLCJ1c2VyVHlwZSI6MCwiZGVwdEluZGV4IjoiNTY5OWU1OTE2YTE4YTYzODFlMWFjOTJkYTViZDI2MjgiLCJleHAiOjE4MjE4MTc2MTksImF1dGhvcml0aWVzIjpbInJvb3QiXSwianRpIjoiMmJiM2Q5ZTYtNmY3Yy00Yjg1LThiM2EtZDI2ODdmMTUzMDg5IiwiY2xpZW50X2lkIjoibmpjbnRlc3QiLCJoZWFkU2N1bHB0dXJlIjoicmVzb3VyY2VEYXRhLzMxNzRDRUFFOUQ0MjRGMjJCQjkxQTU4OURENjdCMDUxLmpwZyJ9.WjeYl1lvvJdDE1FUGIhS99rE5qKaBXOypWxmxK0svWweGqEbu1XCLjKm_YkiTwjZJ_oIcn5JOO9rvHFkkea76BUsYo5wlzuBBiy7sKqM1fFzOFQq6hdFevNTJAbYH9FiBxYxI-e9DZ5mvLGE6umOjUfn_FAsku2w6Uj5DtvpOKBWYzLEPTEifOqNI9he4zJAmVZniUUMf26SDoEdfu0TyrIS1j_qKaEb-cqR1XDhivdthEBK5m9vxJyXFZ5kofNxwQQkit_oiqJRkCZIt9TWAjCh-frzMHCvA30hkAr-VCD2JfCmmEr3hW_lmwfINaPtFVbHCdCKqdrl6VmF1HObaQ' + 'bearer ' + JSON.parse(window.localStorage.getItem('adminInfo') || '{}').access_token // 请求头带上token token要在登录的时候保存在localStorage中 + + // config.headers['Authorization'] = + // 'bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5kZXgiOiJmYTM3YjkzY2M5MGQ0YzE3ODRjYThmNmRlYmRkZWUxYSIsInVzZXJfbmFtZSI6InJvb3QiLCJzY29wZSI6WyJhbGwiXSwibmlja25hbWUiOiLotoXnuqfnrqHnkIblkZgiLCJ1c2VyVHlwZSI6MCwiZGVwdEluZGV4IjoiNTY5OWU1OTE2YTE4YTYzODFlMWFjOTJkYTViZDI2MjgiLCJleHAiOjE4MjE4MTc2MTksImF1dGhvcml0aWVzIjpbInJvb3QiXSwianRpIjoiMmJiM2Q5ZTYtNmY3Yy00Yjg1LThiM2EtZDI2ODdmMTUzMDg5IiwiY2xpZW50X2lkIjoibmpjbnRlc3QiLCJoZWFkU2N1bHB0dXJlIjoicmVzb3VyY2VEYXRhLzMxNzRDRUFFOUQ0MjRGMjJCQjkxQTU4OURENjdCMDUxLmpwZyJ9.WjeYl1lvvJdDE1FUGIhS99rE5qKaBXOypWxmxK0svWweGqEbu1XCLjKm_YkiTwjZJ_oIcn5JOO9rvHFkkea76BUsYo5wlzuBBiy7sKqM1fFzOFQq6hdFevNTJAbYH9FiBxYxI-e9DZ5mvLGE6umOjUfn_FAsku2w6Uj5DtvpOKBWYzLEPTEifOqNI9he4zJAmVZniUUMf26SDoEdfu0TyrIS1j_qKaEb-cqR1XDhivdthEBK5m9vxJyXFZ5kofNxwQQkit_oiqJRkCZIt9TWAjCh-frzMHCvA30hkAr-VCD2JfCmmEr3hW_lmwfINaPtFVbHCdCKqdrl6VmF1HObaQ' // 请求头携带token return config }, diff --git a/src/views/preview/index_ZL.vue b/src/views/preview/index_ZL.vue new file mode 100644 index 0000000..a069608 --- /dev/null +++ b/src/views/preview/index_ZL.vue @@ -0,0 +1,19 @@ + + From 3d987b4761dd86131a5f184b8481d89480c19e8e Mon Sep 17 00:00:00 2001 From: guanj Date: Wed, 5 Nov 2025 15:31:56 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/mt-preview-zl/index.vue | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/mt-preview-zl/index.vue b/src/components/mt-preview-zl/index.vue index e316092..e70b97e 100644 --- a/src/components/mt-preview-zl/index.vue +++ b/src/components/mt-preview-zl/index.vue @@ -1,6 +1,6 @@