From f84e425bb9debb5f2af8e417bf07d2a2b0077609 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 28 四月 2026 17:00:03 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_NEW_pro' into dev_NEW_pro

---
 src/views/productionManagement/workOrderManagement/index.vue |  336 ++++---------------------------------------------------
 1 files changed, 29 insertions(+), 307 deletions(-)

diff --git a/src/views/productionManagement/workOrderManagement/index.vue b/src/views/productionManagement/workOrderManagement/index.vue
index 9ffbd3f..d60132a 100644
--- a/src/views/productionManagement/workOrderManagement/index.vue
+++ b/src/views/productionManagement/workOrderManagement/index.vue
@@ -12,6 +12,15 @@
                     prefix-icon="Search" />
         </div>
         <div class="search-item">
+          <span class="search_title">鐢熶骇璁㈠崟鍙凤細</span>
+          <el-input v-model="searchForm.productOrderNpsNo"
+                    style="width: 240px"
+                    placeholder="璇疯緭鍏�"
+                    @change="handleQuery"
+                    clearable
+                    prefix-icon="Search" />
+        </div>
+        <div class="search-item">
           <el-button type="primary"
                      @click="handleQuery">鎼滅储</el-button>
         </div>
@@ -31,7 +40,6 @@
         </template>
       </PIMTable>
     </div>
-    
     <!-- 娴佽浆鍗″脊绐� -->
     <el-dialog v-model="transferCardVisible"
                title="娴佽浆鍗�"
@@ -107,7 +115,6 @@
                    @click="printTransferCard">鎵撳嵃娴佽浆鍗�</el-button>
       </div>
     </el-dialog>
-    
     <!-- 鎶ュ伐寮圭獥 -->
     <el-dialog v-model="reportDialogVisible"
                title="鎶ュ伐"
@@ -163,148 +170,9 @@
         </span>
       </template>
     </el-dialog>
-
-    <el-dialog v-model="materialDialogVisible"
-               title="鐗╂枡"
-               width="1200px"
-               @close="handleCloseMaterialDialog">
-      <el-table v-loading="materialTableLoading"
-                :data="materialTableData"
-                border
-                row-key="id">
-        <el-table-column label="宸ュ簭鍚嶇О"
-                         prop="processName"
-                         min-width="140" />
-        <el-table-column label="鍘熸枡鍚嶇О"
-                         prop="materialName"
-                         min-width="140" />
-        <el-table-column label="鍘熸枡鍨嬪彿"
-                         prop="materialModel"
-                         min-width="140" />
-        <el-table-column label="璁¢噺鍗曚綅"
-                         prop="unit"
-                         min-width="100" />
-        <el-table-column label="棰嗙敤鏁伴噺"
-                         prop="pickQty"
-                         min-width="100" />
-        <el-table-column label="琛ユ枡鏁伴噺"
-                         prop="supplementQty"
-                         min-width="100" />
-        <el-table-column label="閫�鏂欐暟閲�"
-                         prop="returnQty"
-                         min-width="100" />
-        <el-table-column label="瀹為檯鏁伴噺"
-                         prop="actualQty"
-                         min-width="100" />
-        <el-table-column label="鎿嶄綔"
-                         align="center"
-                         fixed="right"
-                         width="220">
-          <template #default="{ row }">
-            <el-button type="primary"
-                       link
-                       @click="openSupplementDialog(row)">琛ユ枡</el-button>
-            <el-button type="warning"
-                       link
-                       @click="openReturnDialog(row)">閫�鏂�</el-button>
-            <el-button type="info"
-                       link
-                       @click="openSupplementRecordDialog(row)">琛ユ枡璁板綍</el-button>
-          </template>
-        </el-table-column>
-      </el-table>
-    </el-dialog>
-
-    <FormDialog v-model="supplementDialogVisible"
-                title="琛ユ枡"
-                width="500px"
-                @confirm="handleSubmitSupplement">
-      <el-form ref="supplementFormRef"
-               :model="supplementForm"
-               :rules="supplementRules"
-               label-width="100px">
-        <el-form-item label="琛ユ枡鏁伴噺"
-                      prop="supplementQty">
-          <el-input-number v-model="supplementForm.supplementQty"
-                           :min="0.001"
-                           :precision="3"
-                           :step="1"
-                           style="width: 100%;" />
-        </el-form-item>
-        <el-form-item label="琛ユ枡鍘熷洜"
-                      prop="supplementReason">
-          <el-input v-model="supplementForm.supplementReason"
-                    type="textarea"
-                    :rows="3"
-                    maxlength="200"
-                    show-word-limit
-                    placeholder="璇疯緭鍏ヨˉ鏂欏師鍥�" />
-        </el-form-item>
-      </el-form>
-      <template #footer>
-        <span class="dialog-footer">
-          <el-button type="primary"
-                     :loading="supplementSubmitting"
-                     @click="handleSubmitSupplement">纭畾</el-button>
-          <el-button @click="supplementDialogVisible = false">鍙栨秷</el-button>
-        </span>
-      </template>
-    </FormDialog>
-
-    <FormDialog v-model="returnDialogVisible"
-                title="閫�鏂�"
-                width="500px"
-                @confirm="handleSubmitReturn">
-      <el-form ref="returnFormRef"
-               :model="returnForm"
-               :rules="returnRules"
-               label-width="120px">
-        <el-form-item label="閫�鏂欐暟閲�"
-                      prop="returnQty">
-          <el-input-number v-model="returnForm.returnQty"
-                           :min="0.001"
-                           :precision="3"
-                           :step="1"
-                           style="width: 100%;" />
-        </el-form-item>
-      </el-form>
-      <template #footer>
-        <span class="dialog-footer">
-          <el-button type="primary"
-                     :loading="returnSubmitting"
-                     @click="handleSubmitReturn">纭畾</el-button>
-          <el-button @click="returnDialogVisible = false">鍙栨秷</el-button>
-        </span>
-      </template>
-    </FormDialog>
-
-    <el-dialog v-model="supplementRecordDialogVisible"
-               title="琛ユ枡璁板綍"
-               width="900px">
-      <el-table v-loading="supplementRecordLoading"
-                :data="supplementRecordTableData"
-                border
-                row-key="id">
-        <el-table-column label="琛ユ枡鏁伴噺"
-                         prop="supplementQty"
-                         min-width="100" />
-        <el-table-column label="琛ユ枡鍘熷洜"
-                         prop="supplementReason"
-                         min-width="200" />
-        <el-table-column label="琛ユ枡浜�"
-                         prop="supplementUserName"
-                         min-width="120" />
-        <el-table-column label="琛ユ枡鏃ユ湡"
-                         prop="supplementTime"
-                         min-width="160" />
-      </el-table>
-      <template #footer>
-        <span class="dialog-footer">
-          <el-button @click="supplementRecordDialogVisible = false">鍏抽棴</el-button>
-        </span>
-      </template>
-    </el-dialog>
-    
+    <MaterialDialog v-model="materialDialogVisible"
+                    :row-data="currentMaterialOrderRow"
+                    @refresh="getList" />
     <FilesDia ref="workOrderFilesRef" />
   </div>
 </template>
@@ -317,16 +185,12 @@
     productWorkOrderPage,
     addProductMain,
     downProductWorkOrder,
-    listWorkOrderMaterialLedger,
-    addWorkOrderMaterialSupplement,
-    addWorkOrderMaterialReturn,
-    listWorkOrderMaterialSupplementRecord,
   } from "@/api/productionManagement/workOrder.js";
   import { getUserProfile, userListNoPageByTenantId } from "@/api/system/user.js";
   import QRCode from "qrcode";
   import { getCurrentInstance, reactive, toRefs } from "vue";
   import FilesDia from "./components/filesDia.vue";
-  import FormDialog from "@/components/Dialog/FormDialog.vue";
+  import MaterialDialog from "./components/MaterialDialog.vue";
   const { proxy } = getCurrentInstance();
 
   const tableColumn = ref([
@@ -342,7 +206,7 @@
     },
     {
       label: "鐢熶骇璁㈠崟鍙�",
-      prop: "productOrderNpsNo",
+      prop: "npsNo",
       width: "140",
     },
     {
@@ -360,7 +224,8 @@
     },
     {
       label: "宸ュ簭鍚嶇О",
-      prop: "processName",
+      prop: "operationName",
+      width: "100",
     },
     {
       label: "闇�姹傛暟閲�",
@@ -418,6 +283,12 @@
             openWorkOrderFiles(row);
           },
         },
+        // {
+        //   name: "鐗╂枡",
+        //   clickFun: row => {
+        //     openMaterialDialog(row);
+        //   },
+        // },
         {
           name: "鎶ュ伐",
           clickFun: row => {
@@ -425,16 +296,10 @@
           },
           disabled: row => row.planQuantity <= 0,
         },
-        {
-          name: "鐗╂枡",
-          clickFun: row => {
-            openMaterialDialog(row);
-          },
-        },
       ],
     },
   ]);
-  
+
   const tableData = ref([]);
   const tableLoading = ref(false);
   const transferCardVisible = ref(false);
@@ -492,13 +357,6 @@
     quantity: [{ required: true, validator: validateQuantity, trigger: "blur" }],
     scrapQty: [{ validator: validateScrapQty, trigger: "blur" }],
   };
-  const supplementRules = {
-    supplementQty: [{ required: true, message: "璇疯緭鍏ヨˉ鏂欐暟閲�", trigger: "blur" }],
-    supplementReason: [{ required: true, message: "璇疯緭鍏ヨˉ鏂欏師鍥�", trigger: "blur" }],
-  };
-  const returnRules = {
-    returnQty: [{ required: true, message: "璇疯緭鍏ラ��鏂欐暟閲�", trigger: "blur" }],
-  };
 
   // 澶勭悊鏈鐢熶骇鏁伴噺杈撳叆锛岄檺鍒跺繀椤诲ぇ浜庣瓑浜�1
   const handleQuantityInput = value => {
@@ -553,29 +411,10 @@
     // 鏈夋晥鐨勯潪璐熸暣鏁帮紙鍖呮嫭0锛�
     reportForm.scrapQty = num;
   };
-  
+
   const currentReportRowData = ref(null);
   const materialDialogVisible = ref(false);
-  const materialTableLoading = ref(false);
-  const materialTableData = ref([]);
-  const currentMaterialRow = ref(null);
   const currentMaterialOrderRow = ref(null);
-  const supplementDialogVisible = ref(false);
-  const supplementSubmitting = ref(false);
-  const supplementFormRef = ref(null);
-  const supplementForm = reactive({
-    supplementQty: null,
-    supplementReason: "",
-  });
-  const returnDialogVisible = ref(false);
-  const returnSubmitting = ref(false);
-  const returnFormRef = ref(null);
-  const returnForm = reactive({
-    returnQty: null,
-  });
-  const supplementRecordDialogVisible = ref(false);
-  const supplementRecordLoading = ref(false);
-  const supplementRecordTableData = ref([]);
   const page = reactive({
     current: 1,
     size: 100,
@@ -585,6 +424,7 @@
   const data = reactive({
     searchForm: {
       workOrderNo: "",
+      productOrderNpsNo: "",
     },
   });
   const { searchForm } = toRefs(data);
@@ -609,13 +449,13 @@
     page.current = 1;
     getList();
   };
-  
+
   const pagination = obj => {
     page.current = obj.page;
     page.size = obj.limit;
     getList();
   };
-  
+
   const getList = () => {
     tableLoading.value = true;
     const params = { ...searchForm.value, ...page };
@@ -727,127 +567,9 @@
     reportDialogVisible.value = true;
   };
 
-  const openMaterialDialog = async row => {
+  const openMaterialDialog = row => {
     currentMaterialOrderRow.value = row;
     materialDialogVisible.value = true;
-    materialTableLoading.value = true;
-    materialTableData.value = [];
-    try {
-      const res = await listWorkOrderMaterialLedger({
-        workOrderId: row.id,
-        processId: row.processId,
-        productProcessRouteItemId: row.productProcessRouteItemId,
-      });
-      materialTableData.value = res.data || [];
-    } catch (e) {
-      console.error("鑾峰彇鐗╂枡鍙拌处澶辫触", e);
-      proxy.$modal.msgError("鑾峰彇鐗╂枡鍙拌处澶辫触");
-    } finally {
-      materialTableLoading.value = false;
-    }
-  };
-
-  const handleCloseMaterialDialog = () => {
-    materialTableData.value = [];
-    currentMaterialRow.value = null;
-    currentMaterialOrderRow.value = null;
-  };
-
-  const openSupplementDialog = row => {
-    currentMaterialRow.value = row;
-    supplementForm.supplementQty = null;
-    supplementForm.supplementReason = "";
-    supplementDialogVisible.value = true;
-    nextTick(() => {
-      supplementFormRef.value?.clearValidate();
-    });
-  };
-
-  const handleSubmitSupplement = () => {
-    supplementFormRef.value?.validate(async valid => {
-      if (!valid) return;
-      if (!currentMaterialRow.value?.id) {
-        proxy.$modal.msgWarning("缂哄皯鐗╂枡鏄庣粏ID");
-        return;
-      }
-      supplementSubmitting.value = true;
-      try {
-        await addWorkOrderMaterialSupplement({
-          materialLedgerId: currentMaterialRow.value.id,
-          supplementQty: Number(supplementForm.supplementQty),
-          supplementReason: supplementForm.supplementReason,
-          workOrderId: currentMaterialOrderRow.value?.id,
-        });
-        proxy.$modal.msgSuccess("琛ユ枡鎴愬姛");
-        supplementDialogVisible.value = false;
-        await openMaterialDialog(currentMaterialOrderRow.value);
-      } catch (e) {
-        console.error("琛ユ枡澶辫触", e);
-        proxy.$modal.msgError("琛ユ枡澶辫触");
-      } finally {
-        supplementSubmitting.value = false;
-      }
-    });
-  };
-
-  const openReturnDialog = row => {
-    currentMaterialRow.value = row;
-    returnForm.returnQty = null;
-    returnDialogVisible.value = true;
-    nextTick(() => {
-      returnFormRef.value?.clearValidate();
-    });
-  };
-
-  const handleSubmitReturn = () => {
-    returnFormRef.value?.validate(async valid => {
-      if (!valid) return;
-      if (!currentMaterialRow.value?.id) {
-        proxy.$modal.msgWarning("缂哄皯鐗╂枡鏄庣粏ID");
-        return;
-      }
-      const returnQty = Number(returnForm.returnQty);
-      const minQty =
-        Number(currentMaterialRow.value.pickQty || 0) +
-        Number(currentMaterialRow.value.supplementQty || 0);
-      if (returnQty < minQty) {
-        proxy.$modal.msgWarning(`閫�鏂欐暟閲忎笉鑳戒綆浜庨鐢ㄦ暟閲�+琛ユ枡鏁伴噺锛�${minQty}锛塦);
-        return;
-      }
-      returnSubmitting.value = true;
-      try {
-        await addWorkOrderMaterialReturn({
-          materialLedgerId: currentMaterialRow.value.id,
-          returnQty,
-          workOrderId: currentMaterialOrderRow.value?.id,
-        });
-        proxy.$modal.msgSuccess("閫�鏂欐垚鍔�");
-        returnDialogVisible.value = false;
-        await openMaterialDialog(currentMaterialOrderRow.value);
-      } catch (e) {
-        console.error("閫�鏂欏け璐�", e);
-        proxy.$modal.msgError("閫�鏂欏け璐�");
-      } finally {
-        returnSubmitting.value = false;
-      }
-    });
-  };
-
-  const openSupplementRecordDialog = async row => {
-    supplementRecordDialogVisible.value = true;
-    supplementRecordLoading.value = true;
-    supplementRecordTableData.value = [];
-    try {
-      const res = await listWorkOrderMaterialSupplementRecord({
-        materialLedgerId: row.id,
-      });
-      supplementRecordTableData.value = res.data || [];
-    } catch (e) {
-      console.error("鑾峰彇琛ユ枡璁板綍澶辫触", e);
-      proxy.$modal.msgError("鑾峰彇琛ユ枡璁板綍澶辫触");
-    } finally {
-      supplementRecordLoading.value = false;
-    }
   };
 
   const handleReport = () => {
@@ -1089,4 +811,4 @@
       height: 140px !important;
     }
   }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3