From 524f8f3333d199260a5b3bd13a0279b7758c383c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= <2178503051@qq.com> Date: Tue, 30 Jun 2026 14:38:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(crm):=20=E6=96=B0=E5=A2=9E=E9=85=8D?= =?UTF-8?q?=E5=8D=B7=E7=9B=B8=E5=85=B3API=E5=B9=B6=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E5=90=88=E5=90=8C=E3=80=81=E9=94=80=E5=94=AE=E5=91=98=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E9=85=8D=E5=8D=B7=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 新增crm/coil.js封装配卷相关接口,包括列表查询和统计汇总 2. 重构合同页面:移除冗余的coilList状态,改用分页API加载生产成果和发货配卷数据,新增分页和统计展示 3. 重构销售员页面:改用独立分页API获取生产成果和计划发货数据,新增分页、加载状态和全局统计 4. 升级CoilTable组件:支持分页功能和双维度统计(本页/全部) --- klp-ui/src/api/crm/coil.js | 83 ++++++++++ klp-ui/src/views/crm/components/CoilTable.vue | 78 ++++++++- .../crm/contract/components/ContractTabs.vue | 128 +++++++++++---- klp-ui/src/views/crm/contract/index.vue | 27 +-- klp-ui/src/views/crm/saleman/index.vue | 154 ++++++++++++------ 5 files changed, 362 insertions(+), 108 deletions(-) create mode 100644 klp-ui/src/api/crm/coil.js diff --git a/klp-ui/src/api/crm/coil.js b/klp-ui/src/api/crm/coil.js new file mode 100644 index 000000000..2763424c6 --- /dev/null +++ b/klp-ui/src/api/crm/coil.js @@ -0,0 +1,83 @@ +import request from '@/utils/request' + +// ==================== 配卷列表查询 ==================== + +// 指定客户的发货配卷列表 +export function listDeliveryCoilsByCustomer(customerId) { + return request({ + url: '/crm/orderItem/coils/customer/' + customerId, + method: 'get' + }) +} + +// 指定合同的发货配卷列表(分页) +export function listDeliveryCoilsByOrder(orderId, query) { + return request({ + url: `/crm/orderItem/coils/order/${orderId}`, + method: 'get', + params: query + }) +} + +// 指定销售员的发货配卷列表(分页) +export function listDeliveryCoilsByPrincipal(query) { + return request({ + url: '/wms/deliveryWaybillDetail/coilListByPrincipal', + method: 'get', + params: query + }) +} + +// 指定销售员的生产成果列表(分页) +export function listProductCoilsBySalesman(query) { + return request({ + url: '/crm/orderItem/coils/bySalesman', + method: 'get', + params: query + }) +} + +// 指定合同的生产成果列表(分页) +export function listProductCoilsByContract(contractId, query) { + return request({ + url: `/crm/orderItem/coils/byContract/${contractId}`, + method: 'get', + params: query + }) +} + +// ==================== 配卷统计汇总 ==================== + +// 根据订单ID统计发货配卷汇总 +export function getDeliveryCoilsStatisticsByOrder(orderId) { + return request({ + url: `/crm/orderItem/coils/order/${orderId}/statistics`, + method: 'get' + }) +} + +// 根据销售员统计生产成果汇总 +export function getProductCoilsStatisticsBySalesman(salesman) { + return request({ + url: '/crm/orderItem/coils/bySalesman/statistics', + method: 'get', + params: { salesman } + }) +} + +// 根据合同ID统计生产成果汇总 +export function getProductCoilsStatisticsByContract(contractId) { + return request({ + url: `/crm/orderItem/coils/byContract/${contractId}/statistics`, + method: 'get' + }) +} + +// 根据负责人统计发货配卷汇总 +export function getDeliveryCoilsStatisticsByPrincipal(principal) { + return request({ + url: '/wms/deliveryWaybillDetail/coilListByPrincipal/statistics', + method: 'get', + params: { principal } + }) +} diff --git a/klp-ui/src/views/crm/components/CoilTable.vue b/klp-ui/src/views/crm/components/CoilTable.vue index 495ad9619..3739463ab 100644 --- a/klp-ui/src/views/crm/components/CoilTable.vue +++ b/klp-ui/src/views/crm/components/CoilTable.vue @@ -2,9 +2,25 @@
+
+
+ 上一页 + + / {{ totalPages }} 页 + 下一页 +
- 总卷数:{{ totalCoils }} - 总净重:{{ totalNetWeight }} kg + + +
@@ -100,6 +116,16 @@ export default { showSelection: { type: Boolean, default: false + }, + // 分页配置 { total, currentPage, pageSize },不为 null 时启用分页 + pagination: { + type: Object, + default: null + }, + // 全部统计数据 { totalCoils, totalNetWeight },由外部传入 + totalStatistics: { + type: Object, + default: null } }, components: { @@ -110,20 +136,26 @@ export default { CoilNo }, computed: { - // 计算总卷数 - totalCoils() { + // 计算本页卷数 + currentPageCoils() { return this.data.length; }, - // 计算总净重 - totalNetWeight() { + // 计算本页净重 + currentPageNetWeight() { return this.data.reduce((sum, item) => { return sum + (Number(item.netWeight) || 0); }, 0).toFixed(2); + }, + // 总页数 + totalPages() { + if (!this.pagination) return 1; + return Math.max(1, Math.ceil(this.pagination.total / this.pagination.pageSize)); } }, data() { return { selectedRows: [], + inputPage: 1, floatLayerConfig: { columns: [ { label: '入场卷号', prop: 'enterCoilNo' }, @@ -161,6 +193,17 @@ export default { } } }, + watch: { + pagination: { + handler(val) { + if (val) { + this.inputPage = val.currentPage; + } + }, + immediate: true, + deep: true + } + }, methods: { handleSelectionChange(selection) { this.selectedRows = selection; @@ -214,6 +257,29 @@ export default { this.trace.loading = false; }); }, + /** 跳转到指定页 */ + goPage(page) { + const p = Math.max(1, Math.min(page, this.totalPages)); + if (p === this.pagination.currentPage) return; + this.inputPage = p; + const newPagination = { ...this.pagination, currentPage: p }; + this.$emit('update:pagination', newPagination); + this.$emit('page-change', { currentPage: p, pageSize: this.pagination.pageSize }); + }, + /** 输入框页码变更 */ + handlePageInputChange() { + const page = Number(this.inputPage); + if (!page || page < 1) { + this.inputPage = this.pagination.currentPage; + return; + } + const p = Math.min(page, this.totalPages); + if (p === this.pagination.currentPage) { + this.inputPage = p; + return; + } + this.goPage(p); + }, } } \ No newline at end of file diff --git a/klp-ui/src/views/crm/contract/components/ContractTabs.vue b/klp-ui/src/views/crm/contract/components/ContractTabs.vue index 05fd8ee43..973c9d71b 100644 --- a/klp-ui/src/views/crm/contract/components/ContractTabs.vue +++ b/klp-ui/src/views/crm/contract/components/ContractTabs.vue @@ -2,12 +2,6 @@
-
@@ -22,10 +16,12 @@
-
+
- + \ No newline at end of file diff --git a/klp-ui/src/views/crm/contract/index.vue b/klp-ui/src/views/crm/contract/index.vue index 82ee8078b..4981333c6 100644 --- a/klp-ui/src/views/crm/contract/index.vue +++ b/klp-ui/src/views/crm/contract/index.vue @@ -26,9 +26,9 @@
- +
@@ -229,7 +229,7 @@