From 1b475b840978b0b98c7cd29a00c87971513e3426 Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期五, 09 十月 2026 10:13:17 +0800
Subject: [PATCH] feat(生产排产): 新增车间、班组、排产管理模块并联动工单报工;修复空path菜单导致的路由注册报错

---
 src/views/productionManagement/workOrderManagement/index.vue |   59 +++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/src/views/productionManagement/workOrderManagement/index.vue b/src/views/productionManagement/workOrderManagement/index.vue
index 6def04c..822c2aa 100644
--- a/src/views/productionManagement/workOrderManagement/index.vue
+++ b/src/views/productionManagement/workOrderManagement/index.vue
@@ -142,17 +142,21 @@
                     @input="handleScrapQtyInput" />
         </el-form-item>
         <el-form-item label="鐝粍淇℃伅">
-          <el-select v-model="reportForm.userId"
+          <el-select v-model="reportForm.teamId"
                      style="width: 300px"
                      placeholder="璇烽�夋嫨鐝粍淇℃伅"
                      clearable
                      filterable
-                     @change="handleUserChange">
-            <el-option v-for="user in userOptions"
-                       :key="user.userId"
-                       :label="user.nickName"
-                       :value="user.userId" />
+                     @change="handleTeamChange">
+            <el-option v-for="team in teamOptions"
+                       :key="team.id"
+                       :label="team.teamName"
+                       :value="team.id" />
           </el-select>
+          <div v-if="teamScheduleText"
+               style="width: 300px; margin-top: 5px; color: #909399; font-size: 12px; line-height: 1.5;">
+            {{ teamScheduleText }}
+          </div>
         </el-form-item>
       </el-form>
       <template #footer>
@@ -172,12 +176,15 @@
   import { onMounted, ref, nextTick } from "vue";
   import { ElMessageBox } from "element-plus";
   import dayjs from "dayjs";
+  import { useDict } from "@/utils/dict.js";
   import {
     productWorkOrderPage,
     addProductMain,
     downProductWorkOrder,
   } from "@/api/productionManagement/workOrder.js";
-  import { getUserProfile, userListNoPageByTenantId } from "@/api/system/user.js";
+  import { getUserProfile } from "@/api/system/user.js";
+  import { listAll as teamListAll } from "@/api/productionScheduling/team.js";
+  import { today as getTeamToday } from "@/api/productionScheduling/scheduling.js";
   import QRCode from "qrcode";
   import { getCurrentInstance, reactive, toRefs } from "vue";
   import FilesDia from "./components/filesDia.vue";
@@ -292,7 +299,9 @@
   const reportDialogVisible = ref(false);
   const workOrderFilesRef = ref(null);
   const reportFormRef = ref(null);
-  const userOptions = ref([]);
+  const teamOptions = ref([]);
+  const teamScheduleText = ref("");
+  const { shift_type, schedule_status } = useDict("shift_type", "schedule_status");
   const reportForm = reactive({
     planQuantity: 0,
     quantity: null,
@@ -302,6 +311,7 @@
     reportWork: "",
     productProcessRouteItemId: "",
     userId: "",
+    teamId: null,
     productMainId: null,
   });
 
@@ -529,6 +539,8 @@
     reportForm.productMainId = row.productMainId;
     reportForm.scrapQty =
       row.scrapQty !== undefined && row.scrapQty !== null ? row.scrapQty : null;
+    reportForm.teamId = null;
+    teamScheduleText.value = "";
     nextTick(() => {
       reportFormRef.value?.clearValidate();
     });
@@ -629,18 +641,33 @@
     });
   };
 
-  const handleUserChange = val => {
-    const user = userOptions.value.find(item => item.userId === val);
-    reportForm.userName = user ? user.nickName : "";
+  const handleTeamChange = val => {
+    teamScheduleText.value = "";
+    if (!val) return;
+    // 閫変腑鐝粍鍚庯紝鎶ュ伐浜洪粯璁や负鐝粍闀�
+    const team = teamOptions.value.find(item => item.id === val);
+    if (team && team.leaderUserId) {
+      reportForm.userId = team.leaderUserId;
+      reportForm.userName = team.leaderName;
+    }
+    // 灞曠ず璇ョ彮缁勪粖鏃ユ帓鐝俊鎭�
+    getTeamToday(val).then(res => {
+      const schedule = res.data;
+      if (schedule && schedule.shiftType !== null && schedule.shiftType !== undefined) {
+        const shift = shift_type.value.find(item => item.value === String(schedule.shiftType));
+        const status = schedule_status.value.find(item => item.value === String(schedule.status));
+        teamScheduleText.value = `浠婃棩鎺掔彮锛�${shift ? shift.label : ""}${status ? "锛�" + status.label + "锛�" : ""}`;
+      } else {
+        teamScheduleText.value = "浠婃棩鏈帓鐝�";
+      }
+    });
   };
 
   onMounted(() => {
     getList();
-    // 鑾峰彇鐢ㄦ埛鍒楄〃
-    userListNoPageByTenantId().then(res => {
-      if (res.code === 200) {
-        userOptions.value = res.data;
-      }
+    // 鑾峰彇鐝粍鍒楄〃
+    teamListAll().then(res => {
+      teamOptions.value = res.data || [];
     });
   });
 </script>

--
Gitblit v1.9.3