Ver código fonte

获取菜单

ZaiZai 2 anos atrás
pai
commit
97f856cce6
2 arquivos alterados com 25 adições e 9 exclusões
  1. 2 2
      src/api/modules/system/menu.js
  2. 23 7
      src/views/system/menu.vue

+ 2 - 2
src/api/modules/system/menu.js

@@ -24,11 +24,11 @@ export default {
         }, false);
     },
     //提交
-    async submit(form, msg = false) {
+    async submit(form) {
         return httpApi({
             url: '/api/blade-system/menu/submit',
             method: 'post',
             data: form
-        }, msg);
+        }, false);
     },
 }

+ 23 - 7
src/views/system/menu.vue

@@ -35,6 +35,7 @@
             <template #action="{row, index}">
                 <el-button size="small" type="primary" @click="eidtMenu(row)">编辑</el-button>
                 <el-button size="small" type="success" @click="addChildren(row)">新增子项</el-button>
+                <el-button size="small" type="warning" @click="copyChildren(row)">复制</el-button>
             </template>
         </HcTable>
 
@@ -100,13 +101,13 @@ onActivated(() => {
 //菜单数据
 const searchForm = ref({name: '', parentId: ''})
 const tableColumn = [
-    {key: 'name', name: '菜单名称'},
+    {key: 'name', name: '菜单名称', minWidth: 200},
     {key: 'code', name: '菜单编号', width: 180},
-    {key: 'path', name: '路由地址'},
+    {key: 'path', name: '路由地址', minWidth: 200},
     {key: 'category', name: '菜单类型', width: 90, align: 'center'},
     {key: 'sort', name: '排序', width: 80, align: 'center' },
-    {key: 'remark', name: '菜单备注' },
-    {key: 'action', name: '操作', width: 165}
+    {key: 'remark', name: '菜单备注', minWidth: 200},
+    {key: 'action', name: '操作', width: 240, fixed: 'right', align: 'center'}
 ]
 const tableData = ref([])
 const getTableData = async () => {
@@ -169,14 +170,18 @@ const addMenu = () => {
         isOpen: 1,
         isLayout: 1,
         category: 1,
-        parentId: 0
+        parentId: 0,
+        sort: 1
     }
     menuDataModal.value = true
 }
 
 //编辑菜单
 const eidtMenu = (row) => {
-    formModel.value = row
+    formModel.value = {
+        ...row,
+        children: null
+    }
     menuDataModal.value = true
 }
 
@@ -187,7 +192,18 @@ const addChildren = (row) => {
         isOpen: 1,
         isLayout: 1,
         category: 1,
-        parentId: row.id
+        parentId: row.id,
+        sort: 1
+    }
+    menuDataModal.value = true
+}
+
+//复制菜单
+const copyChildren = (row) => {
+    formModel.value = {
+        ...row,
+        children: null,
+        id: ''
     }
     menuDataModal.value = true
 }