From c7afec3ad75b22bc8b96d8129956913c2b473d9b Mon Sep 17 00:00:00 2001 From: 张诺 <zhang_12370@163.com> Date: 星期四, 19 六月 2025 16:11:36 +0800 Subject: [PATCH] 优化生产管理接口及表格字段 --- src/views/archiveManagement/index.vue | 40 ++++++---------------------------------- 1 files changed, 6 insertions(+), 34 deletions(-) diff --git a/src/views/archiveManagement/index.vue b/src/views/archiveManagement/index.vue index d5951dc..7e7c65d 100644 --- a/src/views/archiveManagement/index.vue +++ b/src/views/archiveManagement/index.vue @@ -130,6 +130,8 @@ @centerDialogVisible="centerDialogVisible" :row="row" @submitForm="submitForm" + ref="archiveDialogs" + > </archiveDialog> </el-card> @@ -174,7 +176,7 @@ selectedRows.splice(0, selectedRows.length, ...selection); }; const queryParams = reactive({ - searchText: "", + searchAll: "", current: 1, pageSize: 10, // 鍥哄畾姣忛〉10鏉� treeId: null, // 褰撳墠鏍戣妭鐐笽D @@ -189,8 +191,6 @@ return data.name?.toLowerCase().includes(value.toLowerCase()); }; const submitForm = async (res) => { - console.log("鎻愪氦琛ㄥ崟鍥炶皟:", res); - if (res && res.code === 200) { ElMessage.success("鎿嶄綔鎴愬姛"); // 鍒锋柊鍒楄〃鏁版嵁 @@ -200,25 +200,24 @@ } } const centerDialogVisible = (val) => { - console.log(val); }; // 澶勭悊鑺傜偣鐐瑰嚮 const handleNodeClick = async (data) => { - console.log("鐐瑰嚮鑺傜偣:", data); // 鍒囨崲鑺傜偣鏃堕噸缃埌绗竴椤� queryParams.current = 1; queryParams.treeId = data.id; getArchiveListData(); }; +const archiveDialogs = ref(null); // 琛ㄦ牸缁勪欢寮曠敤 // add const add = () => { row.value = {}; // 娓呯┖琛屾暟鎹紝纭繚鏄柊澧炴ā寮� dialogVisible.value = true; newName.value = ""; // 娓呯┖杈撳叆妗� + archiveDialogs.value.initForm(); // 閲嶇疆琛ㄥ崟 }; // 澶勭悊鍒嗛〉鍙樺寲 const handlePageChange = ({ page }) => { - console.log("鍒嗛〉鍙樺寲:", { page }); queryParams.current = page; // pageSize 鍥哄畾涓�20锛屼笉鍐嶄粠鍙傛暟涓幏鍙� getArchiveListData(); @@ -227,12 +226,6 @@ const getArchiveListData = async () => { try { loading.value = true; - console.log("鑾峰彇褰掓。鍒楄〃鏁版嵁", { - treeId: queryParams.treeId, - current: queryParams.current, - pageSize: queryParams.pageSize, - }); - let res = await getArchiveList({ treeId: queryParams.treeId, current: queryParams.current, @@ -254,14 +247,7 @@ } // pageSize 鍥哄畾涓�20锛屼笉浠庡悗绔幏鍙� - console.log("鏁版嵁鏇存柊瀹屾垚:", { - total: total.value, - current: queryParams.current, - pageSize: queryParams.pageSize, - records: tableData.value.length, - }); } catch (error) { - console.error("鑾峰彇褰掓。鍒楄〃澶辫触:", error); ElMessage.error("鑾峰彇鏁版嵁澶辫触"); tableData.value = []; total.value = 0; @@ -276,7 +262,6 @@ } try { const ids = selectedRows.map((row) => row.id); - console.log(ids) const { code, msg } = await delArchive(ids); if (code !== 200) { ElMessage.warning("鍒犻櫎澶辫触: " + msg); @@ -286,7 +271,6 @@ await getArchiveListData(); } } catch (error) { - console.error("鍒犻櫎褰掓。澶辫触:", error); ElMessage.error("鍒犻櫎褰掓。澶辫触"); } }; @@ -325,11 +309,9 @@ comeTreeData.isEdit = false; const newValue = newName.value.trim(); if (comeTreeData.name === newValue) { - console.log("娌℃湁淇敼鍐呭"); return; } if (newValue === "") { - console.warn("杈撳叆涓嶈兘涓虹┖"); newName.value = comeTreeData.name || "鏂拌妭鐐�"; return; } @@ -345,10 +327,8 @@ parentId: parentId || null, // 濡傛灉娌℃湁鐖惰妭鐐癸紝鍒欎负 null }); } catch (error) { - console.error("瀛樺偍澶辫触", error); comeTreeData.name = comeTreeData.name || "鏂拌妭鐐�"; } - console.log("淇濆瓨鎴愬姛:", newValue); }; onMounted(async () => { @@ -361,12 +341,9 @@ }; const remove = async (node, data) => { - console.log("鍒犻櫎鑺傜偣:", data); if (!data || !data.id) { - console.warn("鏃犳硶鍒犻櫎鏈畾涔夋垨鏃犳晥鐨勮妭鐐�"); return; } - console.log("鍒犻櫎鑺傜偣 ID:", data.id); let { code, msg } = await delTree([data.id]); if (code !== 200) { ElMessage.warning("鍒犻櫎澶辫触, " + msg); @@ -379,7 +356,6 @@ const append = async (data) => { if (data === "") { // 鏂板鏍硅妭鐐� - console.log("鏂板鏍硅妭鐐�"); const newNode = { id: Date.now(), name: "鏂拌妭鐐�", @@ -401,7 +377,6 @@ const node = treeRef.value?.getNode(nodeKey); const isExpanded = node?.expanded; // 濡傛灉鏈夊瓙绾т笖鏈睍寮�锛屽厛灞曞紑鑺傜偣 if (hasChildren && !isExpanded) { - console.log(treeRef.value, "灞曞紑鑺傜偣", nodeKey); if ( treeRef.value && treeRef.value.store && @@ -410,7 +385,6 @@ treeRef.value.store.nodesMap[nodeKey].expanded = true; } } - const newNode = { id: Date.now(), name: "鏂板瓙鑺傜偣", @@ -448,7 +422,7 @@ const handleEdit = (rows) => { row.value = rows; dialogVisible.value = true; - console.log("缂栬緫鑺傜偣:", row.value); + archiveDialogs.value.editForm(rows); // 璋冪敤缂栬緫鏂规硶 }; // 绉婚櫎鎳掑姞杞斤紝鐩存帴鑾峰彇鏁版嵁 @@ -458,11 +432,9 @@ if (res.code === 200) { treeData.value = res.data?.records || res.data || []; } else { - console.error("Failed to fetch tree data:", res.message); treeData.value = []; } } catch (error) { - console.error("鑾峰彇鏍戝舰鏁版嵁澶辫触:", error); treeData.value = []; } }; -- Gitblit v1.9.3