From 8254c2448862fa412a0eded276291e1c1be6ed70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= Date: Fri, 15 Aug 2025 17:41:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=8E=88=20perf:=20=E6=8E=92=E4=BA=A7?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E9=A1=B5=E9=9D=A2=E7=AE=80=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/wms/stockIo/panels/detail.vue | 10 ++-- .../views/wms/stockIo/panels/stockIoPage.vue | 9 ++-- klp-ui/src/views/wms/work/schedule/index.vue | 4 ++ .../views/wms/work/schedulePlan/detail.vue | 47 ++++++++++--------- .../src/views/wms/work/schedulePlan/index.vue | 10 +++- .../wms/work/schedulePlan/panes/batch.vue | 28 +++++------ 6 files changed, 57 insertions(+), 51 deletions(-) create mode 100644 klp-ui/src/views/wms/work/schedule/index.vue diff --git a/klp-ui/src/views/wms/stockIo/panels/detail.vue b/klp-ui/src/views/wms/stockIo/panels/detail.vue index d6cdad9c..546d143f 100644 --- a/klp-ui/src/views/wms/stockIo/panels/detail.vue +++ b/klp-ui/src/views/wms/stockIo/panels/detail.vue @@ -4,14 +4,10 @@ - - {{ getIoTypeLabel(stockIo.ioType) }} - + - - {{ getBizTypeLabel(stockIo.bizType) }} - + @@ -233,7 +229,7 @@ export default { SemiSelect, MaterialSelect }, - dicts: ['stock_item_type'], + dicts: ['stock_item_type', 'stock_biz_type'], props: { stockIo: { type: Object, diff --git a/klp-ui/src/views/wms/stockIo/panels/stockIoPage.vue b/klp-ui/src/views/wms/stockIo/panels/stockIoPage.vue index 6328aa84..635e6d8c 100644 --- a/klp-ui/src/views/wms/stockIo/panels/stockIoPage.vue +++ b/klp-ui/src/views/wms/stockIo/panels/stockIoPage.vue @@ -48,16 +48,15 @@ diff --git a/klp-ui/src/views/wms/work/schedule/index.vue b/klp-ui/src/views/wms/work/schedule/index.vue new file mode 100644 index 00000000..e62de247 --- /dev/null +++ b/klp-ui/src/views/wms/work/schedule/index.vue @@ -0,0 +1,4 @@ + + diff --git a/klp-ui/src/views/wms/work/schedulePlan/detail.vue b/klp-ui/src/views/wms/work/schedulePlan/detail.vue index a6ab0774..6f722985 100644 --- a/klp-ui/src/views/wms/work/schedulePlan/detail.vue +++ b/klp-ui/src/views/wms/work/schedulePlan/detail.vue @@ -2,39 +2,29 @@
- - + + - + + + + + + + + + - @@ -46,7 +36,7 @@ - + --> { this.planInfo = res.data || {}; diff --git a/klp-ui/src/views/wms/work/schedulePlan/index.vue b/klp-ui/src/views/wms/work/schedulePlan/index.vue index 653be4cc..ddccf8d9 100644 --- a/klp-ui/src/views/wms/work/schedulePlan/index.vue +++ b/klp-ui/src/views/wms/work/schedulePlan/index.vue @@ -97,13 +97,13 @@ 新建 - 已排产 + 待排产 生产中 - 已完成 + 已废弃 - - + + - - - {{ amountInWords }} - - - {{ debitAmount.toFixed(2) }} - - - {{ creditAmount.toFixed(2) }} - - + + + + {{ amountInWords }} + + + + {{ (debitAmount || 0).toFixed(2) }} + + + {{ (creditAmount || 0).toFixed(2) }} + + + @@ -115,27 +119,27 @@ export default { } }, computed: { - // 借方总额和贷方总额(过滤空行) + // 借方总额(修复后) debitAmount() { + // 确保reduce的初始值为0,且返回值为数字 return this.tableData.reduce((total, item) => { - // 只计算有内容的行 if (this.isRowNotEmpty(item)) { return total + (Number(item.debitAmount) || 0); } return total; - }, 0); + }, 0) || 0; // 最后确保即使结果为undefined也返回0 }, + // 贷方总额(修复后) creditAmount() { return this.tableData.reduce((total, item) => { if (this.isRowNotEmpty(item)) { return total + (Number(item.creditAmount) || 0); } return total; - }, 0); + }, 0) || 0; // 同样增加默认值0 }, - // 大写金额 + // 大写金额(保持不变) amountInWords() { - // 如果借贷相等则正常显示,不相等则显示借贷不相等 if (Math.abs(this.debitAmount - this.creditAmount) < 0.01) { return this.numberToChinese(this.debitAmount); } else { @@ -147,7 +151,16 @@ export default { initData: { type: Object, required: false, - default: () => ({}) + default: () => ({ + tableData: [{ + voucherNo: '', + accountId: undefined, + debitAmount: 0, + creditAmount: 0, + remark: '', + voucherNo: '' + }] + }) } }, watch: { @@ -155,7 +168,18 @@ export default { handler(newVal) { console.log(newVal, 'watchData'); if (newVal) { - this.tableData = newVal.detailList; + if (newVal.detailList) { + this.tableData = newVal.detailList; + } else { + this.tableData = [{ + voucherNo: '', + accountId: undefined, + debitAmount: 0, + creditAmount: 0, + remark: '', + voucherNo: '' + }] + } this.form.docNo = newVal.docNo; this.form.docDate = newVal.docDate; this.form.relatedOrderId = newVal.relatedOrderId;