From 64ed366b4bac03240835c5d621ec2c62149ff08e Mon Sep 17 00:00:00 2001 From: "zhonghua.li" Date: Tue, 26 May 2026 17:29:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A7=E7=89=A9=E5=90=8C=E6=AD=A5=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/lb-goods.js | 10 ++++++ .../goods-package-predict/index.vue | 32 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/api/lb-goods.js b/src/api/lb-goods.js index f979f20..5027f69 100644 --- a/src/api/lb-goods.js +++ b/src/api/lb-goods.js @@ -37,3 +37,13 @@ export function deleteLbGoods(id) { method: 'delete' }) } + +/** 从 hxrd 第三方分页同步货品,可能较慢 */ +export function syncLbGoodsFromHxr(params) { + return request({ + url: '/lbGoods/sync-from-hxr', + method: 'post', + params, + timeout: 120000 + }) +} diff --git a/src/views/lb-business/goods-package-predict/index.vue b/src/views/lb-business/goods-package-predict/index.vue index 0f8a30b..4f91152 100644 --- a/src/views/lb-business/goods-package-predict/index.vue +++ b/src/views/lb-business/goods-package-predict/index.vue @@ -56,6 +56,15 @@ 新增 + + 同步货品 + @@ -209,6 +218,7 @@ import { addLbGoods, deleteLbGoods, getLbGoodsList, + syncLbGoodsFromHxr, updateLbGoods } from '@/api/lb-goods' import { getBusinessHeaders } from '@/utils/business-headers' @@ -263,6 +273,7 @@ export default { return { loading: false, submitLoading: false, + syncLoading: false, list: [], total: 0, dialogVisible: false, @@ -296,6 +307,27 @@ export default { const value = headers && headers['X-Tenant-Id'] return value ? String(value).trim() : '' }, + handleSyncFromHxr() { + const tenantId = this.getTenantIdFromBusinessHeaders() + if (!tenantId) { + this.$message.error('未获取到租户ID,请先登录或配置业务请求头中的租户') + return + } + this.syncLoading = true + syncLbGoodsFromHxr({ tenantId }) + .then((res) => { + const isSuccess = res && (res.success === true || res.code === 200 || res.code === 20000) + if (!isSuccess) { + this.$message.error((res && res.message) || '同步货品失败') + return + } + this.$message.success((res && res.message) || '同步货品成功') + this.fetchList() + }) + .finally(() => { + this.syncLoading = false + }) + }, fetchList() { this.loading = true getLbGoodsList(this.buildListParams())