From bc79e1fae76dffb3cbc3ddfa9ba23e66e150d098 Mon Sep 17 00:00:00 2001
From: zhang_nuo <zhang_12370@163.com>
Date: 星期五, 28 八月 2026 23:18:27 +0800
Subject: [PATCH] fix: 调整多个业务模块的页面展示与字段

---
 src/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue |  113 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 104 insertions(+), 9 deletions(-)

diff --git a/src/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue b/src/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue
index 467a0d3..d767cb2 100644
--- a/src/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue
+++ b/src/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue
@@ -82,15 +82,35 @@
           <el-col :span="12">
             <el-form-item label="澶勭悊缁撴灉锛�" prop="dealResult">
               <el-select v-model="form.dealResult" placeholder="璇烽�夋嫨" clearable>
-                <el-option :label="item.label" :value="item.value" v-for="item in rejection_handling" :key="item.value" />
+                <el-option :label="item.label" :value="item.value" v-for="item in autoDealResultOptions" :key="item.value" />
               </el-select>
             </el-form-item>
           </el-col>
         </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
+            <el-form-item label="涓嶅悎鏍肩被鍨嬶細" prop="dealType">
+              <el-input :model-value="dealTypeLabel(form.dealType)" disabled />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="淇悊宸ユ椂锛�" prop="repairWorkHour">
+              <el-input-number
+                  v-model="form.repairWorkHour"
+                  :min="0"
+                  :precision="2"
+                  style="width: 100%"
+                  :disabled="Number(form.dealType) !== 0"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12">
             <el-form-item label="澶勭悊浜猴細" prop="dealName">
-              <el-input v-model="form.dealName" placeholder="璇疯緭鍏�" clearable/>
+              <el-select v-model="form.dealName" placeholder="璇烽�夋嫨" clearable style="width: 100%">
+                <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/>
+              </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -119,16 +139,16 @@
 </template>
 
 <script setup>
-import {ref} from "vue";
+import { ref, reactive, toRefs, computed, getCurrentInstance } from "vue";
 import {productTreeList} from "@/api/basicData/product.js";
 import {
   getQualityUnqualifiedInfo,
   qualityUnqualifiedDeal
 } from "@/api/qualityManagement/nonconformingManagement.js";
+import {userListNoPage} from "@/api/system/user.js";
 const { proxy } = getCurrentInstance()
 const emit = defineEmits(['close'])
 
-const { rejection_handling } = proxy.useDict("rejection_handling")
 const dialogFormVisible = ref(false);
 const operationType = ref('')
 const data = reactive({
@@ -146,8 +166,12 @@
     inspectType: '',
     defectivePhenomena: '',
     dealResult: '',
+    dealType: null,
+    repairWorkHour: 0,
+    regenerateNewOrder: 0,
     dealName: '',
     dealTime: '',
+    method: undefined
   },
   rules: {
     checkTime: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" },],
@@ -161,23 +185,85 @@
     checkResult: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
     defectivePhenomena: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
     dealResult: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-    dealName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+    repairWorkHour: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+    dealName: [{ required: true, message: "璇烽�夋嫨澶勭悊浜�", trigger: "change" }],
     dealTime: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
   },
 });
 const { form, rules } = toRefs(data);
 const productOptions = ref([]);
+const userList = ref([]); // 澶勭悊浜轰笅鎷夊垪琛�
+
+const autoDealResultOptions = computed(() => {
+  if (Number(form.value.dealType) === 2) {
+    return [{ label: "鎶ュ簾", value: "鎶ュ簾" }];
+  }
+  if (Number(form.value.dealType) === 0 || Number(form.value.dealType) === 1) {
+    return [{ label: "鎶ュ伐", value: "鎶ュ伐" }];
+  }
+  return [];
+})
+
+const dealTypeLabel = (val) => {
+  const type = Number(val);
+  if (type === 0) {
+    return "杞诲井杩斿伐";
+  }
+  if (type === 1) {
+    return "涓ラ噸杩斿伐";
+  }
+  if (type === 2) {
+    return "鎶ュ簾";
+  }
+  return "-";
+};
+
 
 // 鎵撳紑寮规
-const openDialog = (type, row) => {
+const openDialog = async (type, row) => {
   operationType.value = type;
+  // 澶勭悊浜轰笅鎷夊垪琛�
+  try {
+    const userRes = await userListNoPage();
+    userList.value = userRes.data || [];
+  } catch (e) {
+    console.error("鍔犺浇鐢ㄦ埛鍒楄〃澶辫触", e);
+    userList.value = [];
+  }
   dialogFormVisible.value = true;
-  form.value = {}
+  form.value = {
+    checkTime: "",
+    process: "",
+    checkName: "",
+    productName: "",
+    productId: "",
+    model: "",
+    unit: "",
+    quantity: "",
+    checkCompany: "",
+    checkResult: "",
+    inspectType: '',
+    defectivePhenomena: '',
+    dealResult: '',
+    dealType: null,
+    repairWorkHour: 0,
+    regenerateNewOrder: 0,
+    dealName: '',
+    dealTime: '',
+    method: undefined
+  };
   getProductOptions();
   if (operationType.value === 'edit') {
     getQualityUnqualifiedInfo(row.id).then(res => {
       const { inspectState, ...rest } = (res.data || {})
-      form.value = { ...rest }
+      const dealType = rest.dealType === '' || rest.dealType === undefined || rest.dealType === null
+        ? null
+        : Number(rest.dealType);
+      // 鐢ㄥ悗绔繑鍥炲�煎洖濉紝閬垮厤鎶婁笉鍚堟牸绫诲瀷灞曠ず鎴愮┖
+      form.value = { ...form.value, ...rest, dealType }
+      if (!form.value.dealResult) {
+        form.value.dealResult = dealType === 2 ? "鎶ュ簾" : "鎶ュ伐";
+      }
     })
   }
 }
@@ -223,6 +309,15 @@
     if (valid) {
       // 鐘舵�佸瓧娈典笉鍦ㄨ〃鍗曞~鍐欙紝涔熶笉浼犵粰鍚庣锛涘鐞嗙粺涓�璧� /deal 鎺ュ彛
       const { inspectState, ...payload } = (form.value || {})
+      if (Number(payload.dealType) === 2) {
+        payload.dealResult = "鎶ュ簾";
+      } else {
+        payload.dealResult = "鎶ュ伐";
+      }
+      if (payload.dealType === 0 && (!payload.repairWorkHour || payload.repairWorkHour <= 0)) {
+        proxy.$modal.msgError("杞诲井杩斿伐蹇呴』濉啓澶т簬0鐨勪慨鐞嗗伐鏃�");
+        return;
+      }
       qualityUnqualifiedDeal(payload).then(() => {
         proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
         closeDia();
@@ -243,4 +338,4 @@
 
 <style scoped>
 
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3