| | |
| | | }, |
| | | computed: { |
| | | // 计算核磅重量总和 |
| | | totalVerificationWeight() { |
| | | return this.list.reduce((sum, item) => { |
| | | const weight = parseFloat(item.verificationWeight) || 0; |
| | | return sum + weight; |
| | | }, 0); |
| | | }, |
| | | totalVerificationWeight() { |
| | | const processedBatches = new Set(); // 用于记录已经处理过的batchNo |
| | | |
| | | return this.list.reduce((sum, item) => { |
| | | // 如果这个batchNo已经处理过,直接返回当前总和(跳过) |
| | | if (processedBatches.has(item.batchNo)) { |
| | | return sum; |
| | | } |
| | | |
| | | // 标记这个batchNo为已处理 |
| | | processedBatches.add(item.batchNo); |
| | | |
| | | // 计算权重并累加 |
| | | const weight = parseFloat(item.verificationWeight) || 0; |
| | | return sum + weight; |
| | | }, 0); |
| | | } |
| | | }, |
| | | onLoad(options) { |
| | | this.verificationNo = JSON.parse( |