快乐的昕的电脑
2025-10-18 aa096d5f3823934b71c3dd65cb376f486eb3e469
“不良数”和“良品数”会实时联动显示
已修改1个文件
16 ■■■■ 文件已修改
components/WorkOrderPrint.vue 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
components/WorkOrderPrint.vue
@@ -33,7 +33,7 @@
                                <td>{{ order.currentCjNum }}</td><!--报工时采集数-->
                                <td>{{ order.currentCjNum - order.initCjNum }}</td><!--报工数(计算)-->
                                <td>{{ calculatedDefectiveCount }}</td><!--不良数-->
                                <td>{{ order.currentCjNum - order.initCjNum - calculatedDefectiveCount }}</td><!--良品数(计算)-->
                                <td>{{ realTimeOkCount }}</td><!--良品数(计算)-->
                            </tr>
                            <!-- 历史报工记录行 -->
                            <tr v-for="(r, idx) in reportingHistory" :key="idx">
@@ -215,7 +215,19 @@
                reportingHistory: []
            }
        },
        computed: {
        computed: {
            //良品数实时计算
            realTimeDefectiveCount() {
                // 优先用输入框的值,否则用接口数据
                const val = Number(this.customAmount);
                if (!isNaN(val) && this.customAmount !== '') return val;
                return this.calculatedDefectiveCount;
            },
            realTimeOkCount() {
                // 良品数 = 报工数(计算) - 不良数
                const total = (this.order.currentCjNum || 0) - (this.order.initCjNum || 0);
                return total - this.realTimeDefectiveCount;
            },
            calculatedCurrentCount() { return (this.productionCount || 0) - (this.initialValue || 0); },
            calculatedTotalProduction() { return (this.kgQty || 0); }, // 若需恢复旧逻辑可用 (this.kgQty||0)+this.calculatedCurrentCount
            calculatedDefectiveCount() { return this.calculatedTotalProduction - (this.sQuantity || 0); },