From 0c5b607e028bd756079cb328dd0914db2c9093f5 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 04 十二月 2025 14:59:55 +0800
Subject: [PATCH] 1.部署修改

---
 src/views/productionManagement/operationScheduling/components/formDia.vue |  107 ++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 73 insertions(+), 34 deletions(-)

diff --git a/src/views/productionManagement/operationScheduling/components/formDia.vue b/src/views/productionManagement/operationScheduling/components/formDia.vue
index baafa46..542e4f5 100644
--- a/src/views/productionManagement/operationScheduling/components/formDia.vue
+++ b/src/views/productionManagement/operationScheduling/components/formDia.vue
@@ -8,11 +8,11 @@
     >
       <el-button type="primary" @click="addRow" style="margin-bottom: 10px;">鏂板</el-button>
 			<span style="font-size: 18px;margin-left: 10px">寰呮帓浜ф暟閲忥細{{pendingNum}}</span>
-			<div style="margin-bottom: 10px; margin-left: 10px;">
-				<el-form-item label="棰嗙敤锛�" style="margin-bottom: 0;">
-					<el-input v-model="receive" placeholder="璇疯緭鍏ラ鐢�" style="width: 200px;" />
-				</el-form-item>
-			</div>
+<!--			<div style="margin-bottom: 10px; margin-left: 10px;">-->
+<!--				<el-form-item label="棰嗙敤锛�" style="margin-bottom: 0;">-->
+<!--					<el-input v-model="receive" placeholder="璇疯緭鍏ラ鐢�" style="width: 200px;" />-->
+<!--				</el-form-item>-->
+<!--			</div>-->
       <el-table :data="tableData" border style="width: 100%" :summary-method="summarizeMainTable" show-summary :row-key="row => row.id">
         <el-table-column label="搴忓彿" width="60" align="center">
           <template #default="scope">
@@ -21,7 +21,20 @@
         </el-table-column>
         <el-table-column label="宸ュ簭" prop="process" width="150">
           <template #default="scope">
-						<el-input v-model="scope.row.process" placeholder="璇疯緭鍏ュ伐搴�" />
+							<el-select
+								v-model="scope.row.process"
+								placeholder="閫夋嫨宸ュ簭"
+								style="width: 100%;"
+                filterable
+                clearable
+							>
+								<el-option
+									v-for="process in processList"
+									:key="process.id"
+									:label="process.name"
+									:value="process.name"
+								/>
+							</el-select>
           </template>
         </el-table-column>
         <el-table-column label="鍗曚綅" prop="unit" width="90">
@@ -47,12 +60,7 @@
 						/>
           </template>
         </el-table-column>
-		<el-table-column label="鎹熻��" prop="loss" width="150">
-          <template #default="scope">
-            <el-input v-model="scope.row.loss" placeholder="璇疯緭鍏ユ崯鑰�" />
-          </template>
-        </el-table-column>
-        <el-table-column label="宸ユ椂瀹氶" width="200" prop="workHours">
+        <el-table-column label="宸ヨ祫" width="200" prop="workHours">
           <template #default="scope">
 						<el-input-number
 							v-model="scope.row.workHours"
@@ -76,6 +84,9 @@
 							v-model="scope.row.schedulingUserId"
 							placeholder="閫夋嫨浜哄憳"
 							style="width: 100%;"
+              filterable
+              default-first-option
+              :reserve-keyword="false"
 						>
 							<el-option
 								v-for="user in userList"
@@ -108,23 +119,26 @@
 </template>
 
 <script setup>
-import {ref} from "vue";
+import {ref, getCurrentInstance} from "vue";
 import {userListNoPageByTenantId} from "@/api/system/user.js";
 import {processScheduling} from "@/api/productionManagement/operationScheduling.js";
+import {laborConfListPage} from "@/api/lavorissce/issue.js";
 const { proxy } = getCurrentInstance()
 const { work_step } = proxy.useDict("work_step")
 const emit = defineEmits(['close'])
 
 const dialogFormVisible = ref(false);
 const operationType = ref('')
-const tableData = ref([
-	{ process: '', schedulingDate: '', schedulingNum: null, schedulingUserId: '', workHours: null, unit: '', remark: '', loss: '', type: '' }
-]);
+const tableData = ref([]);
 const unitFromRow = ref('');
 const idFromRow = ref('');
-const pendingNum = ref('');
+const specificationModelFromRow = ref('');
+const pendingNum = ref(0);
 const userList = ref([])
+const processList = ref([])
 const receive = ref('')
+const productionLineIdFromRow = ref('');
+const productionUserIdFromRow = ref('');
 
 // 鎵撳紑寮规
 const openDialog = (type, row) => {
@@ -133,18 +147,33 @@
 	userListNoPageByTenantId().then((res) => {
 		userList.value = res.data;
 	});
-	pendingNum.value = row.pendingNum
-  if (row && row.unit !== undefined) {
-    unitFromRow.value = row.unit;
-    idFromRow.value = row.id;
-    tableData.value.forEach(item => {
-      item.unit = row.unit;
-      item.id = row.id;
-    });
-  } else {
-    unitFromRow.value = '';
-  }
+	// 鏍规嵁閫変腑鏁版嵁鐨刾roductionLineId鏌ヨ宸ュ簭鍒楄〃
+	if (row?.productionLineId) {
+		laborConfListPage({ id: row.productionLineId, current: -1, size: -1 }).then((res) => {
+			processList.value = res.data.records || [];
+		});
+	}
+	pendingNum.value = row?.pendingNum ?? 0;
+	unitFromRow.value = row?.unit ?? '';
+	idFromRow.value = row?.id ?? '';
+	specificationModelFromRow.value = row?.specificationModel ?? '';
+	productionLineIdFromRow.value = row?.productionLineId ?? '';
+	productionUserIdFromRow.value = row?.productionUserId ?? '';
+	tableData.value = [createRow()];
 }
+
+const createRow = () => ({
+	id: idFromRow.value,
+	process: '',
+	schedulingDate: '',
+	schedulingNum: null,
+	schedulingUserId: '',
+	workHours: null,
+	unit: unitFromRow.value,
+	remark: '',
+	type: specificationModelFromRow.value,
+});
+
 const submitForm = () => {
 	// 1. 妫�鏌ユ瘡涓�琛屾槸鍚﹀~鍐欏畬鏁�
 	for (let i = 0; i < tableData.value.length; i++) {
@@ -169,11 +198,16 @@
 		proxy.$modal.msgError('鎺掍骇鏁伴噺鍚堣涓嶈兘瓒呰繃寰呮帓浜ф暟閲�');
 		return;
 	}
-	// 3. 灏� receive 瀛楁娣诲姞鍒版瘡鏉℃暟鎹腑
-	const submitData = tableData.value.map(row => ({
-		...row,
-		receive: receive.value
-	}));
+	// 3. 灏� receive銆乸roductionLineId銆乸roductionUserId 瀛楁娣诲姞鍒版瘡鏉℃暟鎹腑锛屽苟绉婚櫎 loss 瀛楁
+	const submitData = tableData.value.map(row => {
+		const { loss, ...rest } = row;
+		return {
+			...rest,
+			receive: receive.value,
+			productionLineId: productionLineIdFromRow.value,
+			productionUserId: productionUserIdFromRow.value
+		};
+	});
 	processScheduling(submitData).then((res) => {
 		proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
 		closeDia();
@@ -186,6 +220,11 @@
 const closeDia = () => {
   dialogFormVisible.value = false;
   receive.value = '';
+  tableData.value = [];
+  unitFromRow.value = '';
+  idFromRow.value = '';
+  specificationModelFromRow.value = '';
+  pendingNum.value = 0;
   emit('close')
 };
 defineExpose({
@@ -193,7 +232,7 @@
 });
 
 const addRow = () => {
-  tableData.value.push({ id: idFromRow.value, process: '', unit: unitFromRow.value, schedulingNum: null, workHours: null, schedulingDate: '', schedulingUserId: '', remark: '', loss: '', type: '' });
+  tableData.value.push(createRow());
 };
 const removeRow = (index) => {
   tableData.value.splice(index, 1);

--
Gitblit v1.9.3