From e10b451e687070c369f52a700b87c56bd782467e Mon Sep 17 00:00:00 2001 From: guanj Date: Wed, 22 Oct 2025 08:50:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=88=AA=E5=9B=BE=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=B8=8D=E5=85=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../select-item-bind-setting/index.vue | 9 +- .../mt-edit/composables/thumbnail.ts | 8 +- src/components/mt-edit/index.vue | 101 ++++++++++++------ src/utils/mqtt.ts | 4 +- 4 files changed, 85 insertions(+), 37 deletions(-) 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 240ab92..1e1568b 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 @@ -289,7 +289,13 @@ const fetchData_wx = async () => { // 指标数据 const indexList = async () => { try { - const lineId = deptIds.value[deptIds.value.length - 1] + let lineId = '' + if (typeof deptIds.value === 'string') { + lineId = deptIds.value + } else { + lineId = deptIds.value[deptIds.value.length - 1] + } + { const response = await targetList({ lineId: lineId }) if (response.data) { @@ -304,6 +310,7 @@ const indexList = async () => { const handleDeptChange = (deptId: []) => { // labelString.value = fileRef.value.getCheckedNodes().pathLabels.join(" / "); item_uid.value = [] + indexString.value = '' nextTick(() => { //fileRef.value.getCheckedNodes()[0]?.label 最后一层的值 let name = [] diff --git a/src/components/mt-edit/composables/thumbnail.ts b/src/components/mt-edit/composables/thumbnail.ts index 4aea344..c5a5746 100644 --- a/src/components/mt-edit/composables/thumbnail.ts +++ b/src/components/mt-edit/composables/thumbnail.ts @@ -10,6 +10,7 @@ export const useGenThumbnail = async (canvas_id: string = 'mtCanvasArea') => { // //记录要移除的svg元素 const shouldRemoveSvgNodes = [] // 获取到所有的SVG 得到一个数组 目前只有自定义连线需要特殊处理 别的元素直接使用html2canvas就可以 + const svgElements: NodeListOf = document.body.querySelectorAll(`#${canvas_id} .mt-line-render`) // 遍历这个数组 for (const item of svgElements) { @@ -40,13 +41,14 @@ 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, - width, - height, + // width, + // height, allowTaint: true, - windowHeight: height, + // windowHeight: height, logging: false, ignoreElements: element => { if (element.classList.contains('mt-line-render')) { diff --git a/src/components/mt-edit/index.vue b/src/components/mt-edit/index.vue index 8c2f4b7..2c385ef 100644 --- a/src/components/mt-edit/index.vue +++ b/src/components/mt-edit/index.vue @@ -1,40 +1,66 @@