diff --git a/.env.development b/.env.development index fe20139..9b09d50 100644 --- a/.env.development +++ b/.env.development @@ -1,10 +1,10 @@ # ============================================================================= -# 本地开发默认 → 测试环境(Vite 代理到 api.nanafa.com,无浏览器 CORS) -# 切生产:pnpm dev:ideship +# 本地开发默认 → 生产环境(Vite 代理到 api.ideship.com,无浏览器 CORS) +# 切测试:pnpm 用 .env.nanafa 构建,或临时改回 api.nanafa.com # ============================================================================= -VITE_DEPLOY_TARGET=nanafa -VITE_OMS_ADMIN_URL=http://api.nanafa.com/admin -VITE_API_ORIGIN=http://api.nanafa.com +VITE_DEPLOY_TARGET=ideship +VITE_OMS_ADMIN_URL=https://api.ideship.com/admin +VITE_API_ORIGIN=https://api.ideship.com VITE_WECOM_KF_URL=https://work.weixin.qq.com/kfid/kfcae09c206f6c7045a diff --git a/package.json b/package.json index 96eb2e8..2e90eea 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,9 @@ "vue-codemirror6": "^1.4.3", "vue-echarts": "^6.2.3", "vue-hooks-plus": "^2.4.0", + "pdfjs-dist": "^6.3.289", "vue-i18n": "^9.2.2", + "vue-pdf-embed": "^2.1.6", "vue-router": "^4.0.14", "vxe-table": "4.6.18", "xe-utils": "3.7.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 88e68fc..1fa8cbf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -93,6 +93,9 @@ importers: nprogress: specifier: ^0.2.0 version: 0.2.0 + pdfjs-dist: + specifier: ^6.3.289 + version: 6.3.289 pinia: specifier: ^2.0.23 version: 2.3.1(typescript@4.9.5)(vue@3.5.18(typescript@4.9.5)) @@ -126,6 +129,9 @@ importers: vue-i18n: specifier: ^9.2.2 version: 9.14.5(vue@3.5.18(typescript@4.9.5)) + vue-pdf-embed: + specifier: ^2.1.6 + version: 2.1.6(vue@3.5.18(typescript@4.9.5)) vue-router: specifier: ^4.0.14 version: 4.5.1(vue@3.5.18(typescript@4.9.5)) @@ -1031,6 +1037,76 @@ packages: resolution: {integrity: sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==} engines: {node: '>=4'} + '@napi-rs/canvas-android-arm64@1.0.9': + resolution: {integrity: sha512-4LGXk2/0HVzE29K8SzML5WubgCp++B1FH3qgl35XmSZE+lLdr6P9VRQEnZ0MCLZMTSuJP41yyhtoiVNEuvrTIA==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [android] + + '@napi-rs/canvas-darwin-arm64@1.0.9': + resolution: {integrity: sha512-YNdfLBzY0W/Pep9fo2L6RmoNlNksnn05LRnX66W63R3ij58S25QOTcjdtEt2v8+PnCESzqZsYzUo+QPeIR44NA==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [darwin] + + '@napi-rs/canvas-darwin-x64@1.0.9': + resolution: {integrity: sha512-ceZQSknTEcy3dOXoekv59LTCkXjvnLsq+VW5PeNNDHEPQbRS5Ervkm1EaDa7WLAjiYWMLuSQTRTHao1dEX4prg==} + engines: {node: '>= 10'} + cpu: [x64] + os: [darwin] + + '@napi-rs/canvas-linux-arm-gnueabihf@1.0.9': + resolution: {integrity: sha512-XhfI0Wwv4llhd6nnWDtY3kQKjq0r+y1i91PlJlJI24ag2U9WrnwbG1qS3+fDLEyouwEVFchiKkTEHozK+5iUNA==} + engines: {node: '>= 10'} + cpu: [arm] + os: [linux] + + '@napi-rs/canvas-linux-arm64-gnu@1.0.9': + resolution: {integrity: sha512-012oiYtKaE7i9oxc8q7nraT7kDOpLcaCmFLzVe9Ty34RHDdoDzbWLrVh827CNxYh/EADX1eSikA3ymLjo/nNuw==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + + '@napi-rs/canvas-linux-arm64-musl@1.0.9': + resolution: {integrity: sha512-Ls5UWYFFn63casTZEczbeyEg3vRDRkv9lscuGwfchtY5yLLQhgOB8SN4YGxmfJ5vTaBwZ2YUxBS3NtmjJmFXdA==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + + '@napi-rs/canvas-linux-riscv64-gnu@1.0.9': + resolution: {integrity: sha512-hLKEGxV7ZiRHqndePTokgDMdBlo/rDfzg7P4p4QIv9pUhuYobnu3R2NIFLCRghG0nwfo+s2sw+c1xZFeCmEAsw==} + engines: {node: '>= 10'} + cpu: [riscv64] + os: [linux] + + '@napi-rs/canvas-linux-x64-gnu@1.0.9': + resolution: {integrity: sha512-6kaz3w0QMy77PDWk6rJ1ksIihdad3qzEyX2o2oGT8GwCaypfT5mhjr8buOO5hstyLxcWXDScuz56RsINLtBPIQ==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + + '@napi-rs/canvas-linux-x64-musl@1.0.9': + resolution: {integrity: sha512-xrGvmS3v55hmZ86ls/kBLVNMUTYio3f6Ik0DireemG994VfPAwiA3ZXA0Uf1bByctkB3NQ1Sfb+H5bkdUnnzfQ==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + + '@napi-rs/canvas-win32-arm64-msvc@1.0.9': + resolution: {integrity: sha512-yjmVS3ArZeRVCP7jqbPq4rpZa/BhTeI7ELE2XqJg3snICQBDevLZyArxswHkiTnT34KRic33/4fLirrHI+SY8A==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [win32] + + '@napi-rs/canvas-win32-x64-msvc@1.0.9': + resolution: {integrity: sha512-QlSYQdMQslB81nlABo9wNfQ6npFhE7/O+saCZdqVGueGanyRk4jCogD5EwQenfP3kIq9e+mm6GreQBjX5MrA8g==} + engines: {node: '>= 10'} + cpu: [x64] + os: [win32] + + '@napi-rs/canvas@1.0.9': + resolution: {integrity: sha512-QviPdJImDi/jMAvBfqaw+19BndMd/sizXVW3NnpMd3VJGz++QXkOHcP9kWR/smHG0hNjHeyuHFyrx/5lD0oNcQ==} + engines: {node: '>= 10'} + '@napi-rs/wasm-runtime@0.2.12': resolution: {integrity: sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ==} @@ -5329,6 +5405,10 @@ packages: pathe@2.0.3: resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + pdfjs-dist@6.3.289: + resolution: {integrity: sha512-ZHjSVpDa3D6izMq8/04lvkhkATUmL9px6ChPaXc1k6nU2Mrhlg1/7F0bdUqCwUjw3NsPTfPZsMDUU6ZIcRaeQw==} + engines: {node: '>=22.13.0 || >=24'} + pend@1.2.0: resolution: {integrity: sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==} @@ -7025,6 +7105,11 @@ packages: resolution: {integrity: sha512-aEQvaFzIH6A0u0in4ghsxiqMgXNxf2+mtgOW8BaiLM6f3gTfvJMjZBjSrycDgdde7P5VfXOqLFGk4+Tf0Mre6Q==} engines: {node: '>=6.11.5'} + vue-pdf-embed@2.1.6: + resolution: {integrity: sha512-cNmclL9jGuRIqgm13fx/3ZZd1nW/Nn0zXfQUo/yd8AQU9GTFLLYRgFc5HM41v1+bMoj1wW59mZoB/cNQx8Y2Rw==} + peerDependencies: + vue: ^3.3.0 + vue-plugin-hiprint@0.0.60: resolution: {integrity: sha512-a5uOMn6Nr4qlYYaVNbQKwRZJa8UcNMTflfi6J430/NDtySJB+5ArE8I8+NLjgVV56x3/qdUBs/GWuZCX5Umv1w==} engines: {node: '>=16'} @@ -8001,6 +8086,54 @@ snapshots: call-me-maybe: 1.0.2 glob-to-regexp: 0.3.0 + '@napi-rs/canvas-android-arm64@1.0.9': + optional: true + + '@napi-rs/canvas-darwin-arm64@1.0.9': + optional: true + + '@napi-rs/canvas-darwin-x64@1.0.9': + optional: true + + '@napi-rs/canvas-linux-arm-gnueabihf@1.0.9': + optional: true + + '@napi-rs/canvas-linux-arm64-gnu@1.0.9': + optional: true + + '@napi-rs/canvas-linux-arm64-musl@1.0.9': + optional: true + + '@napi-rs/canvas-linux-riscv64-gnu@1.0.9': + optional: true + + '@napi-rs/canvas-linux-x64-gnu@1.0.9': + optional: true + + '@napi-rs/canvas-linux-x64-musl@1.0.9': + optional: true + + '@napi-rs/canvas-win32-arm64-msvc@1.0.9': + optional: true + + '@napi-rs/canvas-win32-x64-msvc@1.0.9': + optional: true + + '@napi-rs/canvas@1.0.9': + optionalDependencies: + '@napi-rs/canvas-android-arm64': 1.0.9 + '@napi-rs/canvas-darwin-arm64': 1.0.9 + '@napi-rs/canvas-darwin-x64': 1.0.9 + '@napi-rs/canvas-linux-arm-gnueabihf': 1.0.9 + '@napi-rs/canvas-linux-arm64-gnu': 1.0.9 + '@napi-rs/canvas-linux-arm64-musl': 1.0.9 + '@napi-rs/canvas-linux-riscv64-gnu': 1.0.9 + '@napi-rs/canvas-linux-x64-gnu': 1.0.9 + '@napi-rs/canvas-linux-x64-musl': 1.0.9 + '@napi-rs/canvas-win32-arm64-msvc': 1.0.9 + '@napi-rs/canvas-win32-x64-msvc': 1.0.9 + optional: true + '@napi-rs/wasm-runtime@0.2.12': dependencies: '@emnapi/core': 1.4.5 @@ -12751,6 +12884,10 @@ snapshots: pathe@2.0.3: {} + pdfjs-dist@6.3.289: + optionalDependencies: + '@napi-rs/canvas': 1.0.9 + pend@1.2.0: {} perfect-debounce@1.0.0: {} @@ -12820,11 +12957,11 @@ snapshots: possible-typed-array-names@1.1.0: {} - postcss-html@0.36.0(postcss-syntax@0.36.2)(postcss@7.0.39): + postcss-html@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39): dependencies: htmlparser2: 3.10.1 postcss: 7.0.39 - postcss-syntax: 0.36.2(postcss-html@1.8.0)(postcss@8.5.6) + postcss-syntax: 0.36.2(postcss-html@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-jsx@0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-less@3.1.4)(postcss-markdown@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-scss@2.1.1)(postcss@7.0.39) postcss-html@1.8.0: dependencies: @@ -12833,11 +12970,11 @@ snapshots: postcss: 8.5.6 postcss-safe-parser: 6.0.0(postcss@8.5.6) - postcss-jsx@0.36.4(postcss-syntax@0.36.2)(postcss@7.0.39): + postcss-jsx@0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39): dependencies: '@babel/core': 7.28.0 postcss: 7.0.39 - postcss-syntax: 0.36.2(postcss-html@1.8.0)(postcss@8.5.6) + postcss-syntax: 0.36.2(postcss-html@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-jsx@0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-less@3.1.4)(postcss-markdown@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-scss@2.1.1)(postcss@7.0.39) transitivePeerDependencies: - supports-color @@ -12849,10 +12986,10 @@ snapshots: dependencies: postcss: 8.5.6 - postcss-markdown@0.36.0(postcss-syntax@0.36.2)(postcss@7.0.39): + postcss-markdown@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39): dependencies: postcss: 7.0.39 - postcss-syntax: 0.36.2(postcss-html@1.8.0)(postcss@8.5.6) + postcss-syntax: 0.36.2(postcss-html@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-jsx@0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-less@3.1.4)(postcss-markdown@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-scss@2.1.1)(postcss@7.0.39) remark: 10.0.1 unist-util-find-all-after: 1.0.5 @@ -12904,11 +13041,15 @@ snapshots: dependencies: postcss: 8.5.6 - postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6): + postcss-syntax@0.36.2(postcss-html@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-jsx@0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-less@3.1.4)(postcss-markdown@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-scss@2.1.1)(postcss@7.0.39): dependencies: - postcss: 8.5.6 + postcss: 7.0.39 optionalDependencies: - postcss-html: 1.8.0 + postcss-html: 0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39) + postcss-jsx: 0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39) + postcss-less: 3.1.4 + postcss-markdown: 0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39) + postcss-scss: 2.1.1 postcss-value-parser@3.3.1: {} @@ -13951,10 +14092,10 @@ snapshots: normalize-selector: 0.2.0 pify: 4.0.1 postcss: 7.0.39 - postcss-html: 0.36.0(postcss-syntax@0.36.2)(postcss@7.0.39) - postcss-jsx: 0.36.4(postcss-syntax@0.36.2)(postcss@7.0.39) + postcss-html: 0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39) + postcss-jsx: 0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39) postcss-less: 3.1.4 - postcss-markdown: 0.36.0(postcss-syntax@0.36.2)(postcss@7.0.39) + postcss-markdown: 0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39) postcss-media-query-parser: 0.2.3 postcss-reporter: 6.0.1 postcss-resolve-nested-selector: 0.1.6 @@ -13962,7 +14103,7 @@ snapshots: postcss-sass: 0.3.5 postcss-scss: 2.1.1 postcss-selector-parser: 3.1.2 - postcss-syntax: 0.36.2(postcss-html@1.8.0)(postcss@8.5.6) + postcss-syntax: 0.36.2(postcss-html@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-jsx@0.36.4(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-less@3.1.4)(postcss-markdown@0.36.0(postcss-syntax@0.36.2(postcss-html@1.8.0)(postcss@8.5.6))(postcss@7.0.39))(postcss-scss@2.1.1)(postcss@7.0.39) postcss-value-parser: 3.3.1 resolve-from: 4.0.0 signal-exit: 3.0.7 @@ -14685,6 +14826,11 @@ snapshots: dependencies: opencollective-postinstall: 2.0.3 + vue-pdf-embed@2.1.6(vue@3.5.18(typescript@4.9.5)): + dependencies: + pdfjs-dist: 6.3.289 + vue: 3.5.18(typescript@4.9.5) + vue-plugin-hiprint@0.0.60: dependencies: '@claviska/jquery-minicolors': 2.3.6(jquery@3.7.1) diff --git a/public/login-assets/hero-logistics.jpg b/public/login-assets/hero-logistics.jpg new file mode 100644 index 0000000..f735b4c Binary files /dev/null and b/public/login-assets/hero-logistics.jpg differ diff --git a/public/login-assets/hero-logistics.png b/public/login-assets/hero-logistics.png new file mode 100644 index 0000000..97a7118 Binary files /dev/null and b/public/login-assets/hero-logistics.png differ diff --git a/src/api/fileStorage.ts b/src/api/fileStorage.ts index f9a6539..5143d84 100644 --- a/src/api/fileStorage.ts +++ b/src/api/fileStorage.ts @@ -101,11 +101,23 @@ export async function getFileAccessUrl(key: string): Promise { export async function streamFileBlob(keyOrUrl: string): Promise { const res = await axiosInstance.get(omsUrl('/file-storage/stream'), { params: { key: keyOrUrl }, - responseType: 'blob', + responseType: 'arraybuffer', timeout: 120000, }) - if (res.data instanceof Blob) return res.data - return new Blob([res.data]) + const type = String(res.headers['content-type'] || '') + const bytes = new Uint8Array(res.data as ArrayBuffer) + const sample = new TextDecoder('utf-8', { fatal: false }).decode(bytes.slice(0, 256)).trim() + if (type.toLowerCase().includes('json') || sample.startsWith('{') || sample.startsWith('[')) { + try { + const body = JSON.parse(new TextDecoder().decode(bytes)) + const msg = body?.msg ?? body?.message ?? body?.Message + throw new Error(msg ? String(msg) : '文件流读取失败') + } catch (e) { + if (e instanceof Error && e.message !== '文件流读取失败') throw e + throw new Error(sample || '文件流读取失败') + } + } + return new Blob([bytes], { type: type || 'application/octet-stream' }) } /** POST /file-storage/normalize-key */ diff --git a/src/api/order/index.ts b/src/api/order/index.ts index 71f556b..17eec67 100644 --- a/src/api/order/index.ts +++ b/src/api/order/index.ts @@ -1198,7 +1198,7 @@ export async function postOrderExceptionEventProcess(body: { id: number | string export async function postOrderPrint(body: OrderIdRequest): Promise { const res = await axiosInstance.post(orderUrl('/order/print'), { id: body.id }) assertBusinessOk(res.data) - const d = res.data?.data ?? res.data?.Data ?? {} + const d = res.data?.data ?? res.data?.Data ?? res.data ?? {} return { printUrl: d.printUrl ?? d.PrintUrl ?? '', } @@ -1218,7 +1218,7 @@ export async function postOrderExport(params: OrderExportRequest): Promise) => // Parcel export const getWarehouseParcelList = (body: Record) => postList('/warehouse/parcel/list', body) +export const getWarehouseParcelSummary = (params?: Record) => + getData('/warehouse/parcel/summary', params) export const saveWarehouseParcel = (body: Record) => postOk('/warehouse/parcel/save', body) export const deleteWarehouseParcel = (id: number) => postOk('/warehouse/parcel/delete', { id }) export const putawayWarehouseParcel = (body: Record) => postOk('/warehouse/parcel/putaway', body) diff --git a/src/components.d.ts b/src/components.d.ts index e1125d1..18f2267 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -43,6 +43,9 @@ declare module 'vue' { NanaBatchJobsDrawer: typeof import('./components/NanaAssistant/NanaBatchJobsDrawer.vue')['default'] OrderPrintModal: typeof import('./components/PrintTemplate/OrderPrintModal.vue')['default'] PaginationPro: typeof import('./components/PaginationPro/index.vue')['default'] + PrintOptionsForm: typeof import('./components/PrintTemplate/PrintOptionsForm.vue')['default'] + PrintPdfPreview: typeof import('./components/PrintTemplate/PrintPdfPreview.vue')['default'] + PrintPreviewPane: typeof import('./components/PrintTemplate/PrintPreviewPane.vue')['default'] QuantityInput: typeof import('./components/QuantityInput/index.vue')['default'] RbacDetailShell: typeof import('./components/RbacSplit/RbacDetailShell.vue')['default'] RightTopMessage: typeof import('./components/top-nav/RightTopMessage.vue')['default'] diff --git a/src/components/HandsontablePro/index.vue b/src/components/HandsontablePro/index.vue index aed723a..eeb7b32 100644 --- a/src/components/HandsontablePro/index.vue +++ b/src/components/HandsontablePro/index.vue @@ -219,6 +219,32 @@ /** 编辑写回源数据时跳过 data watch,避免打断输入 */ let ignoreDataWatch = false; + /** 表头初始化/销毁期间不向业务页 emit search,避免首屏重复拉接口 */ + let headerSearchEmitReady = false; + let headerSearchReadyTimer: ReturnType | null = null; + + function pauseHeaderSearchEmit() { + headerSearchEmitReady = false; + if (headerSearchReadyTimer) { + clearTimeout(headerSearchReadyTimer); + headerSearchReadyTimer = null; + } + } + + function scheduleHeaderSearchEmitReady() { + if (headerSearchReadyTimer) { + clearTimeout(headerSearchReadyTimer); + } + headerSearchReadyTimer = setTimeout(() => { + headerSearchEmitReady = true; + headerSearchReadyTimer = null; + }, 450); + } + + function emitSearch() { + if (!headerSearchEmitReady) return; + emit('search'); + } const hotContainer = ref(null); const containerRef = ref(null); @@ -700,7 +726,7 @@ const serverFilter = col.serverFilter !== false; emit('filter-apply', { field, value, serverFilter }); if (serverFilter) { - emit('search'); + emitSearch(); } // 仅当前页过滤列做本地匹配;serverFilter 列交给接口(含高级运算) if (hotInstance && col.serverFilter === false) { @@ -720,7 +746,7 @@ const serverFilter = col.serverFilter !== false; emit('filter-apply', { field, value: '', serverFilter }); if (serverFilter) { - emit('search'); + emitSearch(); } else if (hotInstance) { hotInstance.loadData(syncDisplayRows()); hotInstance.render(); @@ -744,7 +770,7 @@ } (props.searchParams as any)[key] = ''; emit('filter-apply', { field: key, value: '', serverFilter: true }); - emit('search'); + emitSearch(); syncHybridHeaders(); } @@ -758,7 +784,7 @@ localSortOrder.value = null; } emit('clear-filters'); - emit('search'); + emitSearch(); if (hotInstance) { hotInstance.loadData(syncDisplayRows()); hotInstance.render(); @@ -842,7 +868,7 @@ } function notifySearch() { - emit('search'); + emitSearch(); // 无服务端接线的页面也能靠本地过滤立即生效 if (hotInstance) { hotInstance.loadData(syncDisplayRows()); @@ -1209,6 +1235,8 @@ return; } + pauseHeaderSearchEmit(); + if (hotInstance) { hotInstance.destroy(); hotInstance = null; @@ -1852,8 +1880,10 @@ hotInstance = new Handsontable(hotContainer.value, hotConfig as any); // 首次创建后立即校准横向滚动条,避免首屏样式竞争导致横条被隐藏 ensureHorizontalScrollbarVisible(); + scheduleHeaderSearchEmitReady(); } catch (error) { console.error('初始化 Handsontable 失败:', error); + scheduleHeaderSearchEmitReady(); } }; @@ -2424,6 +2454,7 @@ }); onUnmounted(() => { + pauseHeaderSearchEmit(); if (resizeObserver && containerRef.value) { try { resizeObserver.unobserve(containerRef.value); diff --git a/src/components/PrintTemplate/OrderPrintModal.vue b/src/components/PrintTemplate/OrderPrintModal.vue index 2a6da5d..6017d58 100644 --- a/src/components/PrintTemplate/OrderPrintModal.vue +++ b/src/components/PrintTemplate/OrderPrintModal.vue @@ -1,138 +1,108 @@