From b2305598a740049cf31683ac263db2fd2476a06e Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 23 十二月 2025 16:42:38 +0800
Subject: [PATCH] 1.海川开心-生产排产生产报工的排产和报工数量赋默认值
---
src/views/productionManagement/operationScheduling/components/formDia.vue | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/src/views/productionManagement/operationScheduling/components/formDia.vue b/src/views/productionManagement/operationScheduling/components/formDia.vue
index 06b46ac..4733a6e 100644
--- a/src/views/productionManagement/operationScheduling/components/formDia.vue
+++ b/src/views/productionManagement/operationScheduling/components/formDia.vue
@@ -127,6 +127,7 @@
import {userListNoPageByTenantId} from "@/api/system/user.js";
import {processScheduling} from "@/api/productionManagement/operationScheduling.js";
const { proxy } = getCurrentInstance()
+import dayjs from "dayjs";
const { work_step } = proxy.useDict("work_step")
const emit = defineEmits(['close'])
@@ -165,15 +166,22 @@
sunqianUserId.value = sunqianUser.userId;
}
// 鍦ㄧ敤鎴峰垪琛ㄥ姞杞藉畬鎴愬悗鍒涘缓琛屾暟鎹紝骞跺皢浜х嚎鏁版嵁甯﹀叆
- tableData.value = [createRow(row)];
+ tableData.value = [createRow(row, { defaultNum: pendingNum.value })];
});
}
-const createRow = (row) => ({
+const getToday = () => dayjs().format("YYYY-MM-DD");
+const getRemaining = () => {
+ const used = tableData.value.reduce((sum, row) => sum + Number(row.schedulingNum || 0), 0);
+ const remain = Number(pendingNum.value || 0) - used;
+ return remain > 0 ? remain : 0;
+};
+
+const createRow = (row, options = {}) => ({
id: idFromRow.value,
process: '鍖呰',
- schedulingDate: '',
- schedulingNum: null,
+ schedulingDate: getToday(), // 榛樿褰撳ぉ
+ schedulingNum: options.defaultNum ?? null, // 榛樿鐢ㄥ墿浣欐暟閲忓~婊�
schedulingUserId: sunqianUserId.value, // 榛樿璁剧疆涓哄瓩鍊╃殑鐢ㄦ埛ID
workHours: null,
unit: unitFromRow.value,
@@ -239,7 +247,12 @@
});
const addRow = () => {
- tableData.value.push(createRow());
+ const remaining = getRemaining();
+ if (remaining <= 0) {
+ proxy.$modal.msgWarning('宸叉帓婊★紝鏃犲墿浣欐暟閲�');
+ return;
+ }
+ tableData.value.push(createRow({}, { defaultNum: remaining }));
};
const removeRow = (index) => {
tableData.value.splice(index, 1);
--
Gitblit v1.9.3