From dc45a16c5779e249f45ff644a8c57c9c985c2c4f Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期五, 12 六月 2026 14:02:13 +0800
Subject: [PATCH] 检测页面加loading
---
src/views/qualityManagement/rawMaterialInspection/index.vue | 29 +++++++++++++++++++++--------
1 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/src/views/qualityManagement/rawMaterialInspection/index.vue b/src/views/qualityManagement/rawMaterialInspection/index.vue
index 7ed40eb..d887989 100644
--- a/src/views/qualityManagement/rawMaterialInspection/index.vue
+++ b/src/views/qualityManagement/rawMaterialInspection/index.vue
@@ -227,6 +227,7 @@
clickFun: (row) => {
submit(row.id);
},
+ loading: (row) => submitLoadingId.value === row.id,
disabled: (row) => {
// 宸叉彁浜ゅ垯绂佺敤
if (row.inspectState == 1) return true;
@@ -257,6 +258,7 @@
clickFun: (row) => {
downLoadFile(row);
},
+ loading: (row) => downloadLoadingId.value === row.id,
},
],
},
@@ -264,6 +266,8 @@
const tableData = ref([]);
const selectedRows = ref([]);
const tableLoading = ref(false);
+const submitLoadingId = ref(null);
+const downloadLoadingId = ref(null);
const userList = ref([]);
const dialogFormVisible = ref(false);
const form = ref({
@@ -369,12 +373,17 @@
});
};
-// 鎻愪环
+// 鎻愪氦
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("鎻愪氦鎴愬姛");
+ getList();
+ }
+ } finally {
+ submitLoadingId.value = null;
}
}
@@ -405,8 +414,10 @@
dialogFormVisible.value = true
}
-const downLoadFile = (row) => {
- downloadQualityInspect({ id: row.id }).then((blobData) => {
+const downLoadFile = async (row) => {
+ downloadLoadingId.value = row.id;
+ try {
+ const blobData = await downloadQualityInspect({ id: row.id });
const blob = new Blob([blobData], {
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
})
@@ -420,7 +431,9 @@
document.body.removeChild(link)
window.URL.revokeObjectURL(downloadUrl)
- })
+ } finally {
+ downloadLoadingId.value = null;
+ }
};
onMounted(() => {
--
Gitblit v1.9.3