Browse Source

删除不必要的url

wangwei 4 years ago
parent
commit
e22fce4f54

+ 1 - 1
src/api/sys/menu.ts

@@ -2,7 +2,7 @@ import { defHttp } from '/@/utils/http/axios';
 import { getMenuListResultModel } from './model/menuModel';
 
 enum Api {
-  GetMenuList = '/menu',
+  GetMenuList = '/menu/',
 }
 
 /**

+ 12 - 14
src/api/sys/user.ts

@@ -22,12 +22,9 @@ import { ErrorMessageMode } from '/@/utils/http/axios/types';
 
 enum Api {
   LoginUrl = '/login',
-  UserById = '/',
   AdminUrl = '/',
-  GroupUrl = '/group',
-  GroupById = '/group/',
-  RuleUrl = '/rule',
-  RuleById = '/rule/',
+  GroupUrl = '/group/',
+  RuleUrl = '/rule/',
   MenuUrl = '/menu/', // 允许访问的规则 <pid>
 }
 
@@ -52,7 +49,7 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal')
  */
 export function getUserInfoById(params: GetUserInfoByUserIdParams) {
   return defHttp.request<GetUserInfoByUserIdModel>({
-    url: Api.UserById + params.id,
+    url: Api.AdminUrl + params.id,
     method: 'GET',
   });
 }
@@ -83,14 +80,14 @@ export function deleteBatchesUser(params: DeleteBatchesParams) {
 }
 export function editUser(params: EditUserParams) {
   return defHttp.request<CommonRowModel>({
-    url: Api.UserById + params.id,
+    url: Api.AdminUrl + params.id,
     method: 'POST',
     params,
   });
 }
 export function deleteUser(params: DeleteUserParams) {
   return defHttp.request<CommonRowModel>({
-    url: Api.UserById + params.id,
+    url: Api.AdminUrl + params.id,
     method: 'DELETE',
   });
 }
@@ -119,20 +116,20 @@ export function deleteBatchesGroup(params: DeleteBatchesParams) {
 }
 export function editGroup(params: EditGroupParams) {
   return defHttp.request<CommonRowModel>({
-    url: Api.GroupById + params.id,
+    url: Api.GroupUrl + params.id,
     method: 'POST',
     params,
   });
 }
 export function deleteGroup(params: GroupIdParams) {
   return defHttp.request<CommonRowModel>({
-    url: Api.GroupById + params.id,
+    url: Api.GroupUrl + params.id,
     method: 'DELETE',
   });
 }
 export function getGroupById(params: GroupIdParams) {
   return defHttp.request<CommonRowModel>({
-    url: Api.GroupById + params.id,
+    url: Api.GroupUrl + params.id,
     method: 'GET',
   });
 }
@@ -161,23 +158,24 @@ export function deleteBatchesRule(params: DeleteBatchesParams) {
 }
 export function editRule(params: EditRuleParams) {
   return defHttp.request<CommonRowModel>({
-    url: Api.RuleById + params.id,
+    url: Api.RuleUrl + params.id,
     method: 'POST',
     params,
   });
 }
 export function deleteRule(params: RuleIdParams) {
   return defHttp.request<CommonRowModel>({
-    url: Api.RuleById + params.id,
+    url: Api.RuleUrl + params.id,
     method: 'DELETE',
   });
 }
 export function getRuleById(params: RuleIdParams) {
   return defHttp.request<CommonRowModel>({
-    url: Api.RuleById + params.id,
+    url: Api.RuleUrl + params.id,
     method: 'GET',
   });
 }
+//请求允许访问的规则 params 角色组pid
 export function getAllowRule(params: RuleIdParams) {
   return defHttp.request<CommonTreeModel>({
     url: Api.MenuUrl + params.id,

+ 1 - 1
src/views/dashboard/welcome/index.vue

@@ -19,4 +19,4 @@
     justify-content: center;
     align-items: center;
   }
-</style>
+</style>

+ 2 - 1
src/views/permission/group/data.ts

@@ -10,10 +10,11 @@ export const columns: BasicColumn[] = [
   {
     title: 'ID',
     dataIndex: 'id',
+    align: 'left',
     editComponentProps: {
       prefix: '$',
     },
-    width: 80,
+    width: 150,
   },
   {
     title: '父级',

+ 22 - 32
src/views/permission/group/index.vue

@@ -25,7 +25,7 @@
   import { useModal } from '/@/components/Modal';
   //   import { getAllMenuList } from '/@/api/sys/menu';
   import { columns } from './data';
-  import { useUserStore } from '/@/store/modules/user';
+  // import { useUserStore } from '/@/store/modules/user';
   import { useMessage } from '/@/hooks/web/useMessage';
   import {
     getGroupTree,
@@ -51,20 +51,20 @@
     btn_text: string;
     btn_status: boolean;
   }
-  interface Group {
-    id: string;
-    name: boolean;
-  }
+  // interface Group {
+  //   id: string;
+  //   name: boolean;
+  // }
 
   export default defineComponent({
     components: { BasicTable, TableAction, Popup },
     setup() {
-      const userStore = useUserStore();
+      // const userStore = useUserStore();
       const { createMessage } = useMessage();
       const { success /*, error */ } = createMessage;
       const tableRef = ref<Nullable<TableActionType>>(null);
       const currentEditKeyRef = ref('');
-      const groups = userStore.getUserInfo.groups as Group[];
+      // const groups = userStore.getUserInfo.groups as Group[];
       const popupData = reactive<PopupData>({
         title: '添加',
         treeData: [{}],
@@ -209,18 +209,25 @@
       }
 
       function createActions(record: EditRecordRow): ActionItem[] {
-        if (record.pid === 0) {
+        if (record.ischeck) {
           return [
             {
-              label: '',
-              icon: '',
+              label: '编辑',
+              icon: 'ant-design:edit-outlined',
+              color: 'warning',
+              onClick: handleEdit.bind(null, record),
+            },
+            {
+              label: '删除',
+              color: 'error',
+              icon: 'ic:outline-delete-outline',
+              popConfirm: {
+                title: '是否确认删除',
+                confirm: handleDelete.bind(null, record),
+              },
             },
           ];
-        }
-
-        const permission = groups.some((item) => item.id > record.pid);
-
-        if (permission) {
+        } else {
           return [
             {
               label: '',
@@ -228,23 +235,6 @@
             },
           ];
         }
-        return [
-          {
-            label: '编辑',
-            icon: 'ant-design:edit-outlined',
-            color: 'warning',
-            onClick: handleEdit.bind(null, record),
-          },
-          {
-            label: '删除',
-            color: 'error',
-            icon: 'ic:outline-delete-outline',
-            popConfirm: {
-              title: '是否确认删除',
-              confirm: handleDelete.bind(null, record),
-            },
-          },
-        ];
       }
       return {
         popupData,

+ 1 - 3
src/views/permission/group/popup.vue

@@ -100,8 +100,6 @@
           field: 'pid',
           componentProps: {
             onChange: (e: ChangeEvent) => {
-              console.log('===========onChange1====ddd===');
-              console.log(e);
               getRuleTree(e);
             },
             treeData: popupData.treeData,
@@ -113,7 +111,7 @@
         child.map((item) => {
           item.selectable = false;
           if (item.children) {
-            formatChildren(child);
+            formatChildren(item.children);
           }
         });
       }