From d090edfef3884837b55263cc11e1c9462f724cbc Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期三, 10 十二月 2025 17:01:27 +0800
Subject: [PATCH] 系统管理模块测试调整

---
 UI-Project/src/views/User/permissions.vue |  111 +++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 86 insertions(+), 25 deletions(-)

diff --git a/UI-Project/src/views/User/permissions.vue b/UI-Project/src/views/User/permissions.vue
index 9dc0572..4d40bda 100644
--- a/UI-Project/src/views/User/permissions.vue
+++ b/UI-Project/src/views/User/permissions.vue
@@ -20,18 +20,27 @@
 const currentRow = reactive({}); // 褰撳墠琛岀殑鏁版嵁 
 const tableData = ref([])
 const slot = ref('')
- request.get("/loadGlass/sys/menu/nav").then((res) => {
- if (res.code == 200) {
- console.log(res.data);
- tableData.value = res.data.tree
- } else {
- ElMessage.warning(res.msg)
- }
- });
+  const fetchList = async () => {  
+  try {  
+      const response = await request.get('/loadGlass/sys/menu/getMenuTree', {
+      params: {
+        key: -1
+      }
+    });
+    if (response.code === 200) {  
+    tableData.value = response.data
+    } else {  
+      ElMessage.warning(response.data);  
+    }  
+  } catch (error) {  
+    console.error('Error fetching options:', error);  
+  }  
+}; 
 const titleSelectJsona = ref({
   processType: [],
 })
 onMounted(() => {
+  fetchList()
   fetchOptionsa('');  
 }); 
   // 瑙掕壊涓嬫媺閫�  
@@ -80,17 +89,30 @@
 }
 // 娣诲姞涓�绾ц彍鍗�
 const getTableRow = async () => {
+   if (!menuName.value) {
+    ElMessage.error(t('customer.inmenu'))
+    return
+  }
+   if (!url.value) {
+    ElMessage.error(t('customer.inlink'))
+    return
+  }
+   if (!listSort.value) {
+    ElMessage.error(t('customer.insort'))
+    return
+  }
   try {
     const response = await request.post('/loadGlass/sys/menu/save', {
       menuName: menuName.value,
       listSort: listSort.value,
       url: url.value,
+      parentId: 0
     }); 
  
     if (response.code === 200) {
       ElMessage.success(response.message);
       add.value = false;
-      tableData.value = response.data;
+      fetchList()
       menuName.value = '';
       listSort.value = '';
       url.value = '';
@@ -103,6 +125,18 @@
 };
 // 娣诲姞浜岀骇鑿滃崟
 const getTableRowb = async () => {
+   if (!menuName.value) {
+    ElMessage.error(t('customer.inmenu'))
+    return
+  }
+   if (!url.value) {
+    ElMessage.error(t('customer.inlink'))
+    return
+  }
+   if (!listSort.value) {
+    ElMessage.error(t('customer.insort'))
+    return
+  }
   try {
     const dataToSend = {  
       parentId: currentRow.id,
@@ -114,7 +148,7 @@
     if (response.code === 200) {
       ElMessage.success(response.message);
       addb.value = false;
-     tableData.value = response.data;
+      fetchList()
        menuName.value = '';
        listSort.value = '';
        url.value = '';
@@ -141,6 +175,18 @@
 }  
 // 缂栬緫
 const getTableRowa = async () => {
+   if (!menuName.value) {
+    ElMessage.error(t('customer.inmenu'))
+    return
+  }
+   if (!url.value) {
+    ElMessage.error(t('customer.inlink'))
+    return
+  }
+   if (!listSort.value) {
+    ElMessage.error(t('customer.insort'))
+    return
+  }
   try {
     const response = await request.post('/loadGlass/sys/menu/updateMenu', {
       parentId: currentRow.id,
@@ -151,7 +197,7 @@
     if (response.code === 200) {
       ElMessage.success(response.message);
       adda.value = false;
-      tableData.value = response.data;
+      fetchList()
       menuName.value = '';
       listSort.value = '';
       url.value = '';
@@ -164,6 +210,18 @@
 }; 
 // 缂栬緫浜岀骇鑿滃崟
 const getTableRowac = async () => {
+   if (!menuName.value) {
+    ElMessage.error(t('customer.inmenu'))
+    return
+  }
+   if (!url.value) {
+    ElMessage.error(t('customer.inlink'))
+    return
+  }
+   if (!listSort.value) {
+    ElMessage.error(t('customer.insort'))
+    return
+  }
   try {
     const response = await request.post('/loadGlass/sys/menu/updateMenu', {
       menuName: menuName.value,
@@ -173,7 +231,7 @@
     if (response.code === 200) {
       ElMessage.success(response.message);
       addc.value = false;
-      tableData.value = response.data;
+      fetchList()
       menuName.value = '';
       listSort.value = '';
       url.value = '';
@@ -197,11 +255,14 @@
       } 
     );
     if (confirmResult === 'confirm') {
-      const response = await request.post("/loadGlass/sys/menu/deleteMenu", {
-        menuId: row.id,
-    })
+      const url = "/loadGlass/sys/menu/deleteMenu?menuId=" + row.id;
+      const response = await request.post(url);
+    //   const response = await request.post("/loadGlass/sys/menu/deleteMenu", {
+    //     menuId: row.id,
+    // })
     if (response.code === 200) {
       ElMessage.success(response.message);
+      fetchList()
       } else {
       ElMessage.error(response.msg);
       }  
@@ -213,7 +274,7 @@
 </script>
 <template>
   <div style="height: 600px;">
-     <el-button type="primary" style="margin-top: 10px;margin-left: 10px;"  size="mini" id="searchButton" @click="add = true">{{ $t('customer.addmenu') }}</el-button>
+     <el-button type="primary" style="margin-top: 10px;margin-left: 10px;"  id="searchButton" @click="add = true">{{ $t('customer.addmenu') }}</el-button>
     <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;">
       <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 750px;">
         <el-table  
@@ -238,8 +299,8 @@
           <el-table-column prop="listSort" align="center" :label="$t('customer.sort')" min-width="140"/>
           <el-table-column fixed="right" :label="$t('customer.operate')" align="center">
             <template #default="scope">
-              <el-button size="mini" type="text" plain @click="handleEditc(scope.row)">{{ $t('customer.exit') }}</el-button>
-              <el-button size="mini" type="text" plain @click="opena(scope.row)">{{ $t('customer.delete') }}</el-button>
+              <el-button type="text" plain @click="handleEditc(scope.row)">{{ $t('customer.exit') }}</el-button>
+              <el-button type="text" plain @click="opena(scope.row)">{{ $t('customer.delete') }}</el-button>
             </template>
         </el-table-column>
       </el-table>  
@@ -251,9 +312,9 @@
           <el-table-column prop="listSort" align="center" :label="$t('customer.sort')" min-width="180" />
           <el-table-column fixed="right" :label="$t('customer.operate')" align="center" width="200">
             <template #default="scope">
-              <el-button size="mini" type="text" plain @click="handleBindRack(scope.row)">{{ $t('customer.addmenua') }}</el-button>
-              <el-button size="mini" type="text" plain @click="handleEdit(scope.row)">{{ $t('customer.exit') }}</el-button>
-              <el-button size="mini" type="text" plain @click="opena(scope.row)">{{ $t('customer.delete') }}</el-button>
+              <el-button type="text" plain @click="handleBindRack(scope.row)">{{ $t('customer.addmenua') }}</el-button>
+              <el-button type="text" plain @click="handleEdit(scope.row)">{{ $t('customer.exit') }}</el-button>
+              <el-button type="text" plain @click="opena(scope.row)">{{ $t('customer.delete') }}</el-button>
             </template>
         </el-table-column>
         </el-table>
@@ -262,7 +323,7 @@
   </div>
   <el-dialog v-model="add" top="23vh" width="37%" :title="$t('customer.addmenu')">
     <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;">
-            <el-form  size="mini" label-width="150px">
+            <el-form  label-width="150px">
       <el-form label-width="150px" label-position="right">
         <el-row style="margin-top: -15px;margin-bottom: -2px;">
           <el-col :span="6">
@@ -318,7 +379,7 @@
       </el-form>
     </div>
     <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;">
-            <el-form  size="mini" label-width="150px">
+            <el-form  label-width="150px">
       <el-form label-width="150px" label-position="right">
         <el-row style="margin-top: -15px;margin-bottom: -2px;">
           <el-col :span="6">
@@ -361,7 +422,7 @@
   </el-dialog> 
   <el-dialog v-model="adda" top="23vh" width="37%" :title="$t('customer.exmene')">
     <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;">
-     <el-form ref="formRef" size="mini" label-width="150px">
+     <el-form ref="formRef" label-width="150px">
       <el-form label-width="100px" label-position="right">
         <el-row style="margin-top: -15px;margin-bottom: -2px;">
           <el-col :span="6">
@@ -404,7 +465,7 @@
   </el-dialog> 
   <el-dialog v-model="addc" top="23vh" width="37%" :title="$t('customer.exmenea')">
     <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;">
-     <el-form ref="formRef" size="mini" label-width="150px">
+     <el-form ref="formRef" label-width="150px">
       <el-form label-width="100px" label-position="right">
         <el-row style="margin-top: -15px;margin-bottom: -2px;">
           <el-col :span="6">

--
Gitblit v1.8.0