From d8f4bb523d8eb35b1e80e6ba080271cb075a0386 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期六, 13 六月 2026 09:16:50 +0800
Subject: [PATCH] fix: 增加质检提交loading,移除所有数据更新,只更新提交状态

---
 src/views/qualityManagement/rawMaterialInspection/index.vue |    5 ++++-
 src/views/qualityManagement/finalInspection/index.vue       |   20 +++++++++++++++-----
 src/views/qualityManagement/processInspection/index.vue     |   20 +++++++++++++++-----
 3 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/src/views/qualityManagement/finalInspection/index.vue b/src/views/qualityManagement/finalInspection/index.vue
index b0e222b..4055c8e 100644
--- a/src/views/qualityManagement/finalInspection/index.vue
+++ b/src/views/qualityManagement/finalInspection/index.vue
@@ -226,6 +226,7 @@
         clickFun: (row) => {
           submit(row.id);
         },
+        loading: (row) => submitLoadingId.value === row.id,
         disabled: (row) => {
           // 宸叉彁浜ゅ垯绂佺敤
           if (row.inspectState == 1) return true;
@@ -263,6 +264,7 @@
 const tableData = ref([]);
 const selectedRows = ref([]);
 const tableLoading = ref(false);
+const submitLoadingId = ref(null);
 const currentRow = ref(null)
 const page = reactive({
   current: 1,
@@ -375,12 +377,20 @@
       });
 };
 
-// 鎻愪环
+// 鎻愪氦
 const submit = async (id) => {
-  const res = await submitQualityInspect({id: id})
-  if (res.code === 200) {
-    proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
-    getList();
+  submitLoadingId.value = id;
+  try {
+    const res = await submitQualityInspect({ id });
+    if (res.code === 200) {
+      proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+      const row = tableData.value.find(item => item.id === id);
+      if (row) {
+        row.inspectState = 1;
+      }
+    }
+  } finally {
+    submitLoadingId.value = null;
   }
 }
 
diff --git a/src/views/qualityManagement/processInspection/index.vue b/src/views/qualityManagement/processInspection/index.vue
index eaa437c..347d37a 100644
--- a/src/views/qualityManagement/processInspection/index.vue
+++ b/src/views/qualityManagement/processInspection/index.vue
@@ -225,6 +225,7 @@
 				clickFun: (row) => {
 					submit(row.id);
 				},
+				loading: (row) => submitLoadingId.value === row.id,
 				disabled: (row) => {
 					// 宸叉彁浜ゅ垯绂佺敤
 					if (row.inspectState == 1) return true;
@@ -264,6 +265,7 @@
 const tableData = ref([]);
 const selectedRows = ref([]);
 const tableLoading = ref(false);
+const submitLoadingId = ref(null);
 const dialogFormVisible = ref(false);
 const form = ref({
 	checkName: ""
@@ -333,12 +335,20 @@
     filesDia.value?.openDialog(type, row)
   })
 };
-// 鎻愪环
+// 鎻愪氦
 const submit = async (id) => {
-	const res = await submitQualityInspect({id: id})
-	if (res.code === 200) {
-		proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
-		getList();
+	submitLoadingId.value = id;
+	try {
+		const res = await submitQualityInspect({ id });
+		if (res.code === 200) {
+			proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+			const row = tableData.value.find(item => item.id === id);
+			if (row) {
+				row.inspectState = 1;
+			}
+		}
+	} finally {
+		submitLoadingId.value = null;
 	}
 }
 const open = async (row) => {
diff --git a/src/views/qualityManagement/rawMaterialInspection/index.vue b/src/views/qualityManagement/rawMaterialInspection/index.vue
index d887989..a4c054e 100644
--- a/src/views/qualityManagement/rawMaterialInspection/index.vue
+++ b/src/views/qualityManagement/rawMaterialInspection/index.vue
@@ -380,7 +380,10 @@
     const res = await submitQualityInspect({ id });
     if (res.code === 200) {
       proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
-      getList();
+      const row = tableData.value.find(item => item.id === id);
+      if (row) {
+        row.inspectState = 1;
+      }
     }
   } finally {
     submitLoadingId.value = null;

--
Gitblit v1.9.3