From f68e17ea0e471a2d4c012e0f27a6b78fd5edb7a1 Mon Sep 17 00:00:00 2001 From: yf <770153798@qq.com> Date: Wed, 9 Jul 2025 23:01:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E4=B8=8B=E5=8D=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=89=8B=E6=9C=BA=E5=8F=B7=E7=A0=81?= =?UTF-8?q?=E9=9D=9E=E5=BF=85=E5=A1=AB=EF=BC=8C=20=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?=E4=B8=8B=E5=8D=95=E6=AD=A5=E9=AA=A4=E4=BA=A7=E5=93=81=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=B7=BB=E5=8A=A0=E5=85=B3=E9=94=AE=E5=AD=97=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=20=E4=BC=98=E5=8C=96=20=E5=90=8E=E5=8F=B0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=87=91=E9=A2=9D=E8=B0=83=E6=95=B4=E4=B8=BA=E4=BF=9D?= =?UTF-8?q?=E7=95=994=E4=BD=8D=E5=B0=8F=E6=95=B0=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/impl/KeywordSearchHandler.java | 34 +++++ .../DraftDesign/components/DesignPropEdit.vue | 133 ++++++++++++------ .../src/components/ProductInfoList/index.vue | 65 +++++++-- .../hangtag-ui-admin/src/locales/zh-CN.ts | 2 +- .../src/views/oms/saleorder/detail/index.vue | 2 +- .../src/api/base/keyword/index.ts | 8 +- .../DraftDesign/components/DesignPropEdit.vue | 133 ++++++++++++------ .../src/components/ProductInfoList/index.vue | 10 ++ .../hangtag-ui-front/src/locales/zh-CN.ts | 2 +- .../src/views/oms/order/createorder/index.vue | 14 +- 10 files changed, 296 insertions(+), 107 deletions(-) diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/base/controller/admin/keyword/handler/impl/KeywordSearchHandler.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/base/controller/admin/keyword/handler/impl/KeywordSearchHandler.java index 6f4a60e..f57f33c 100644 --- a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/base/controller/admin/keyword/handler/impl/KeywordSearchHandler.java +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/base/controller/admin/keyword/handler/impl/KeywordSearchHandler.java @@ -63,4 +63,38 @@ public class KeywordSearchHandler { return handler; } + + /** + * 产品信息 name 关键搜索处理 + * @return + */ + @Bean("productInfoName") + public AbsBaseKeywordSearchHandler productInfoNameHandler() { + AbsBaseKeywordSearchHandler handler = new AbsBaseKeywordSearchHandler() { + @Override + public List search(String keyword, long maxCount,String filter) { + Page page = new Page(); + page.setSize(maxCount); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.select(ProductInfoDO::getName, ProductInfoDO::getBrandId,BaseDO::getDeleted); + if(FuncUtil.isNotEmpty(keyword)){ + queryWrapper.like(ProductInfoDO::getName, keyword); + } + if(FuncUtil.isNotEmpty(filter)){ + queryWrapper.eq(ProductInfoDO::getBrandId, filter); + } + queryWrapper.eq(BaseDO::getDeleted,false); + queryWrapper.groupBy(ProductInfoDO::getName,BaseDO::getDeleted,ProductInfoDO::getBrandId); + Page page1 = productInfoMapper.selectPage(page, queryWrapper); + List records = page1.getRecords(); + List res = new ArrayList<>(); + for (ProductInfoDO record : records) { + res.add(new KeywordResultVO(record.getName(), record.getName())); + } + return res; + } + }; + return handler; + } + } diff --git a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DesignPropEdit.vue b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DesignPropEdit.vue index 0dc938f..bd55207 100644 --- a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DesignPropEdit.vue +++ b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DesignPropEdit.vue @@ -5,11 +5,11 @@
- *{{ t('designInfo.tipsInfo')}} + *{{ t('designInfo.tipsInfo') }}
- {{ t('designInfo.titleSyncUpdateDesign')}} + {{ t('designInfo.titleSyncUpdateDesign') }}
- +
-
+
// @ts-nocheck -import {ElButton, ElLoading, ElSelect, ElSelectV2} from "element-plus"; +import {ElButton, ElLoading, ElSelect, ElSelectV2} from "element-plus"; import {reactive, watch} from 'vue' import {useMessage} from "@/hooks/web/useMessage"; import {DraftDesignDataApi} from "@/api/oms/draftdesigndata"; @@ -322,7 +324,7 @@ import {useI18n} from "@/hooks/web/useI18n"; const {t} = useI18n() -const svgSize= computed(() => { +const svgSize = computed(() => { return { width: that.svgWidth * 10, height: that.svgHeight * 10, @@ -392,7 +394,7 @@ const imageSize = computed(() => { if (that.sizeInfo) { return { // @ts-ignore - width: that.sizeInfo.width, height: that.sizeInfo.height + width: that.sizeInfo.width, height: that.sizeInfo.height } } return { @@ -588,6 +590,34 @@ const washingInfoListByType = (type, index = -1) => { const getIngredientInfoListByType = (type) => { return that.ingredientInfoList.filter(item => item.type === type) } + +/** + * 等待 图片加载完成 + * @param container + */ +async function waitAllImagesLoaded(container) { + const imgs = Array.from(container.querySelectorAll('img')); + for (const img of imgs) { + await waitImageLoad(img); + console.log(`图片加载完成:${img.src} 宽度: ${img.naturalWidth}px,高度: ${img.naturalHeight}px`); + } +} + +function waitImageLoad(img) { + return new Promise((resolve, reject) => { + if (img.complete && img.naturalWidth > 0) { + resolve(); + } else { + img.onload = () => resolve(); + img.onerror = () =>{ + useMessage().notifyError(t('designInfo.tipsUploadError')) + that.pageLoading.close(); + reject( new Error('图片加载失败: ' + img.src) ); + } + } + }); +} + const uploadFile = async (fileName) => { return new Promise((resolve, reject) => { let svgElement = document.getElementById(that.svgId); @@ -596,48 +626,69 @@ const uploadFile = async (fileName) => { console.log("svgElement?.innerHTML",) // 创建一个 Blob 对象,用于保存 SVG 文件 - saveMaxSvg(svgElement,fileName); +// saveMaxSvg(svgElement,fileName); // // 创建一个链接元素来触发下载 // const link = document.createElement('a'); // link.href = URL.createObjectURL(blob); // link.download = 'graph.html'; // 指定下载文件名 // // 触发点击事件来下载文件 // link.click(); - domtoimage.toBlob(svgElement, { - width: that.svgWidth + 10, - height: that.svgHeight + 10, - type: 'image/png', - scale:4, - quality: 1 - }).then((blob) => { - const file = new File([blob], fileName, {type: 'image/png'}); - FileApi.updateFile({file: file}) - .then((res) => { - if (res.code === 0) { - resolve({ - ...res, - filename: fileName - }) - } else { - reject(res) - } - }).catch((res) => { - reject(res) + + waitAllImagesLoaded(svgElement).then(async d => { + that.pageLoading.close(); + that.pageLoading = ElLoading.service({ + lock: true, + text: t('designInfo.tipsDataTransmitting')+'90%', + background: 'rgba(0,0,0,0.5)' }) - }).catch(function (error) { - useMessage().notifyError(t('designInfo.tipsUploadError')) - console.error('转换或上传过程中出现错误:', error); - }); + domtoimage.toBlob(svgElement, { + width: that.svgWidth + 10, + height: that.svgHeight + 10, + type: 'image/png', + scale: 4, + quality: 1 + }).then((blob) => { + that.pageLoading.close(); + that.pageLoading = ElLoading.service({ + lock: true, + text: t('designInfo.tipsDataTransmitting')+'98%', + background: 'rgba(0,0,0,0.5)' + }) + const file = new File([blob], fileName, {type: 'image/png'}); + FileApi.updateFile({file: file}) + .then((res) => { + if (res.code === 0) { + resolve({ + ...res, + filename: fileName + }) + } else { + reject(res) + } + }).catch((res) => { + reject(res) + }) + }).catch(function (error) { + useMessage().notifyError(t('designInfo.tipsUploadError')) + that.pageLoading.close(); + console.error('转换或上传过程中出现错误:', error); + }); + }) + + +// 1111 + +// 22222 }); } -const saveMaxSvg = (svgElement,fileName)=>{ +const saveMaxSvg = (svgElement, fileName) => { const htmlStr = getHtml(`${svgElement?.parentElement?.innerHTML}`); - const blob = new Blob([htmlStr], { type: 'text/html' }); - const file = new File([blob], fileName+".html", {type: 'text/html'}); + const blob = new Blob([htmlStr], {type: 'text/html'}); + const file = new File([blob], fileName + ".html", {type: 'text/html'}); FileApi.updateFile({file: file}) .then((res) => { - console.log("res"+res) + console.log("res" + res) if (res.code === 0) { that.sourceFile = res.data } else { @@ -1102,10 +1153,10 @@ const checkPropInfo = (info) => { const showLabel1 = newInfo[key].dataInfo[0].showLabel for (let j = 0; j < infos.length; j++) { - console.log("newInfo[key].canInput",showLabel1,newInfo[key]) - if( newInfo[key].canInput){ + console.log("newInfo[key].canInput", showLabel1, newInfo[key]) + if (newInfo[key].canInput) { infos[j].label = showLabel1 - }else{ + } else { outerLoop: for (let i = 0; i < infoList.length; i++) { const row1 = infoList[i]; for (let k = 0; k < row1.langMapping.length; k++) { @@ -1328,7 +1379,7 @@ const changeType = () => { const getPropInfo = () => { // 预览数据 保持缩放 return new Promise((resolve) => { - if( that.changeCount > 0){ + if (that.changeCount > 0) { useMessage().warning(t('designInfo.tipsDataChange')); return; } @@ -1360,7 +1411,7 @@ const getPropInfo = () => { that.svgHeight = dom.height; that.svgWidth = dom.width; - console.log("that.svgHeight",that.svgHeight,that.svgWidth) + console.log("that.svgHeight", that.svgHeight, that.svgWidth) document.querySelector(`#${that.svgId} svg`).style.left = `${svgDom.left - dom.left}px`; document.querySelector(`#${that.svgId} svg`).style.top = `${svgDom.top - dom.top}px`; // that.pageLoading.close() diff --git a/hangtag-ui/hangtag-ui-admin/src/components/ProductInfoList/index.vue b/hangtag-ui/hangtag-ui-admin/src/components/ProductInfoList/index.vue index c4c1704..743c331 100644 --- a/hangtag-ui/hangtag-ui-admin/src/components/ProductInfoList/index.vue +++ b/hangtag-ui/hangtag-ui-admin/src/components/ProductInfoList/index.vue @@ -11,7 +11,7 @@ + + + @@ -57,6 +86,12 @@
-
+ @@ -74,10 +109,12 @@