From 9d8a63a6e8207ccbe7848b93263457f14723cc3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A3=B7=E5=8F=B6?= <14103883+leaf-phos@user.noreply.gitee.com> Date: Wed, 5 Mar 2025 18:03:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Business/Price/PriceSelect.vue | 16 +- src/components/TableFormCol/index.vue | 14 +- src/utils/filter.js | 6 + src/utils/index.js | 11 +- src/views/yh/prodOrder/index.vue | 1 + .../edit-v2/components/ReportProductList.vue | 50 +- .../components/ReportProductUserList.vue | 6 +- .../edit-v2/components/UserProdPreview.vue | 488 +++++++++++------- src/views/yh/report/index.vue | 10 +- src/views/yh/reportProd/index.vue | 10 +- src/views/yh/reportUserProd/index.vue | 5 +- 11 files changed, 387 insertions(+), 230 deletions(-) diff --git a/src/components/Business/Price/PriceSelect.vue b/src/components/Business/Price/PriceSelect.vue index 19103a9..c3c5ef5 100644 --- a/src/components/Business/Price/PriceSelect.vue +++ b/src/components/Business/Price/PriceSelect.vue @@ -2,11 +2,7 @@ {{ item.code | dv}} -
共{{ total }}条数据
@@ -116,9 +111,9 @@ export default { }, methods: { handleFocus() { - if (this.options == null || this.options.length == 0) { - this.getOptions(); - } + // if (this.options == null || this.options.length == 0) { + // this.getOptions(); + // } }, handleChange(val) { let obj = this.options.find(item => item.priceId == val); @@ -165,6 +160,9 @@ export default { .empty-select.el-select { .el-input__inner { color: red !important; + &::placeholder { + color: red !important; + } } } diff --git a/src/components/TableFormCol/index.vue b/src/components/TableFormCol/index.vue index 545917d..7d911a0 100644 --- a/src/components/TableFormCol/index.vue +++ b/src/components/TableFormCol/index.vue @@ -77,6 +77,14 @@ export default { headerIcon: { type: String, default: null, + }, + pageNum: { + type: Number, + default: null + }, + pageSize: { + type: Number, + default: null } }, computed: { @@ -85,7 +93,11 @@ export default { if (isEmpty(this.propPrefix) || isEmpty(this.prop)) { return null; } - return `${this.propPrefix}[${index}].${this.prop}`; + let rowIndex = index; + if (this.pageNum != null && this.pageSize != null) { + rowIndex = (this.pageNum - 1) * this.pageSize + index; + } + return `${this.propPrefix}[${rowIndex}].${this.prop}`; } } }, diff --git a/src/utils/filter.js b/src/utils/filter.js index d6863b7..eb019b5 100644 --- a/src/utils/filter.js +++ b/src/utils/filter.js @@ -7,6 +7,12 @@ const filters = { defaultValue(data) { return data == null || data.length == 0 ? '--' : data; }, + fix1(num) { + if (num == null) { + return num; + } + return num.toFixed(1); + }, fix2(num) { if (num == null) { return num; diff --git a/src/utils/index.js b/src/utils/index.js index e4b4a9b..91ecb38 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,5 +1,5 @@ -import { parseTime } from './ruoyi' import Decimal from "decimal.js"; +import { parseTime } from './ruoyi'; /** * 表格时间格式化 @@ -523,3 +523,12 @@ export function formatFraction(numerator, denominator) { } return `${numerator}/${denominator}`; } + +// 保留小数 +export function toFixed(num, precision = 2) { + if (num == null) { + return num; + } + return num.toFixed(precision); +} + diff --git a/src/views/yh/prodOrder/index.vue b/src/views/yh/prodOrder/index.vue index 4a5e849..08545b8 100644 --- a/src/views/yh/prodOrder/index.vue +++ b/src/views/yh/prodOrder/index.vue @@ -229,6 +229,7 @@ export default { {key: 'erpDocumentStatus', visible: false, label: '单据', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"}, {key: 'erpDescription', visible: false, label: '主备注', minWidth: null, sortable: true, overflow: false, align: 'center', width: null}, {key: 'materialNumber', visible: true, label: '物料', minWidth: null, sortable: false, overflow: false, align: 'center', width: null}, + {key: 'fauxPropId', visible: true, label: '辅助属性', minWidth: null, sortable: true, overflow: true, align: 'center', width: null}, {key: 'workShopName', visible: true, label: '车间', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"}, {key: 'erpIsRework', visible: true, label: '返工', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"}, {key: 'percentage', visible: true, label: '进度', minWidth: null, sortable: false, overflow: false, align: 'left', width: "120"}, diff --git a/src/views/yh/report/edit-v2/components/ReportProductList.vue b/src/views/yh/report/edit-v2/components/ReportProductList.vue index 1cfeb97..8cf8d40 100644 --- a/src/views/yh/report/edit-v2/components/ReportProductList.vue +++ b/src/views/yh/report/edit-v2/components/ReportProductList.vue @@ -41,42 +41,42 @@ {{d.$index + (pageNum - 1) * pageSize + 1}} - + - + - + - + - + - + - + - + - + - + - {{totalAmount(d.row) | fix2 | dv}} + {{totalAmount(d.row) | fix1 | dv}}
@@ -234,6 +234,7 @@ export default { priceSize: '大小', pricePattern: '图案', priceName: '工序', + remark: '备注', }, autoSumNum: true, // 自动汇总良品 showPattern: true, // 显示图案 @@ -262,16 +263,14 @@ export default { eqCategory: row.priceCategory, eqSize: row.priceSize, eqPattern: row.pricePattern, - name: row.priceName, + eqName: row.priceName, + needAllMatch: true } } }, totalAmount() { return (row) => { - let totalAmount = Decimal(0); - row.userProdList.forEach(item => { - totalAmount = totalAmount.plus(notNullDecimal(item.num).mul(notNullDecimal(row.pricePrice))); - }) + let totalAmount = notNullDecimal(row.pricePrice).mul(notNullDecimal(row.num)); return totalAmount.toNumber(); } } @@ -394,10 +393,10 @@ export default { row.priceQuantityDenominator = val.quantityDenominator || null; row.priceCode = val.code || null; row.priceStatus = val.status || null; - row.priceCategory = val.category; - row.priceSize = val.size; - row.priceName = val.name; - row.pricePattern = val.pattern; + // row.priceCategory = val.category; + // row.priceSize = val.size; + // row.priceName = val.name; + // row.pricePattern = val.pattern; } }, checkPriceChange(ov, nv) { @@ -512,12 +511,12 @@ export default { inputPlaceholder: `请输入【${fieldName}】`, }).then(({ value }) => { let isEditPrice = ['priceCategory', 'priceSize', 'pricePattern', 'priceName'].includes(prop); - for (let i = 0; i < this.rows.length; i++) { - let row = this.rows[i]; - row[prop] = value; - } this.$nextTick(() => { - if (isEditPrice) { + for (let i = 0; i < this.rows.length; i++) { + let row = this.rows[i]; + row[prop] = value; + } + if (isEditPrice) { for (let i = 0; i < this.rows.length; i++) { let index = this.form.productList.indexOf(this.rows[i]); if (index != -1) { @@ -614,6 +613,7 @@ export default { defectNum: null, surface: null, color: null, + remark: null, sort: this.getNewSort(), // vo priceName: null, diff --git a/src/views/yh/report/edit-v2/components/ReportProductUserList.vue b/src/views/yh/report/edit-v2/components/ReportProductUserList.vue index f9277f1..c0f0db9 100644 --- a/src/views/yh/report/edit-v2/components/ReportProductUserList.vue +++ b/src/views/yh/report/edit-v2/components/ReportProductUserList.vue @@ -24,7 +24,7 @@ - {{totalAmount(d.row) | fix2 | dv}} + {{totalAmount(d.row) | fix1 | dv}}