Procházet zdrojové kódy

完善按钮权限和列表权限

yanglzh před 3 roky
rodič
revize
987a48b8d0

+ 2 - 2
src/api/model/system/menu.ts

@@ -1,7 +1,7 @@
 export interface MenuBtnRow {
   id?: number; // ID
   parentId: number; // 父ID
-  menuId?: number | undefined; // 菜单ID
+  menuId: number | undefined; // 菜单ID
   name: string;// 名称
   types: string | 'add' | 'edit' | 'del'; // 自定义 add添加 edit编辑 del 删除
   description?: string; // 描述
@@ -11,7 +11,7 @@ export interface MenuBtnRow {
 export interface MenuListRow {
   id?: number; // ID
   parentId: number; // 父ID
-  menuId?: number | undefined; // 菜单ID
+  menuId: number | undefined; // 菜单ID
   name: string;// 名称
   code: string; // 列表 key
   description?: string; // 描述

+ 3 - 0
src/api/system/index.ts

@@ -7,6 +7,9 @@ export default {
     add: (data: object) => post('/system/menu/add', data),
     del: (id: number) => del('/system/menu/del', { id }),
     edit: (data: object) => put('/system/menu/edit', data),
+    api: {
+      getList: (params: object) => get('/system/menu/api/list', params),
+    },
     btn: {
       getList: (params: object) => get('/system/menu/button/tree', params),
       detail: (id: number) => get('/system/menu/button/detail', { id }),

+ 2 - 1
src/views/system/menu/component/btn-form.vue

@@ -44,6 +44,7 @@ const formRef = ref();
 
 const baseForm: MenuBtnRow = {
 	parentId: -1,
+	menuId: 0,
 	name: '',
 	types: '',
 	description: '',
@@ -83,8 +84,8 @@ const resetForm = async () => {
 
 const open = async (row: any) => {
 	resetForm();
-	showDialog.value = true;
 	Object.assign(formData, { ...row });
+	showDialog.value = true;
 	// console.log(row);
 };
 

+ 2 - 1
src/views/system/menu/component/list-form.vue

@@ -44,6 +44,7 @@ const formRef = ref();
 
 const baseForm: MenuListRow = {
 	parentId: -1,
+	menuId: 0,
 	name: '',
 	code: '',
 	description: '',
@@ -83,8 +84,8 @@ const resetForm = async () => {
 
 const open = async (row: any) => {
 	resetForm();
-	showDialog.value = true;
 	Object.assign(formData, { ...row });
+	showDialog.value = true;
 	// console.log(row);
 };
 

+ 2 - 2
src/views/system/menu/component/list.vue

@@ -73,8 +73,8 @@ const handleStatusChange = (row: MenuListRow) => {
 		type: 'warning',
 	})
 		.then(async function () {
-			// await api.user.setStatus(row.id as number, row.status);
-			// ElMessage.success('操作成功');
+			await api.menu.list.setStatus(row.id as number, row.menuId as number, row.status);
+			ElMessage.success('操作成功');
 		})
 		.catch(function () {
 			row.status = row.status === 0 ? 1 : 0;

+ 1 - 1
src/views/system/menu/index.vue

@@ -60,7 +60,6 @@
                 <el-dropdown-menu>
                   <el-dropdown-item @click.native="authOpen(scope.row,'buttonAuthorizeList')">按钮权限</el-dropdown-item>
                   <el-dropdown-item @click.native="authOpen(scope.row,'listAuthorizeList')">列表权限</el-dropdown-item>
-                  <el-dropdown-item>数据权限</el-dropdown-item>
                 </el-dropdown-menu>
               </template>
             </el-dropdown>
@@ -71,6 +70,7 @@
     <EditMenu ref="editMenuRef" @menuList="menuList" :menu="state.menuTableData" :visibleOptions="sys_show_hide" :acType="acType" />
     <ButtonAuthorizeListDrawer ref="buttonAuthorizeList" />
     <ListAuthorizeListDrawer ref="listAuthorizeList" />
+    <ApiAuthorizeListDrawer ref="apiAuthorizeList" />
   </div>
 </template>