Преглед на файлове

feat: update api methods

jiangmaniu преди 4 месеца
родител
ревизия
f7afd73b3b

+ 15 - 4
config/config.ts

@@ -1,9 +1,10 @@
 // https://umijs.org/config/
 import { defineConfig } from '@umijs/max';
-import { join } from 'path';
 import defaultSettings from './defaultSettings';
 import proxy from './proxy';
 import routes from './routes';
+import { toHump } from './util';
+
 
 const { REACT_APP_ENV = 'dev' } = process.env;
 
@@ -167,9 +168,19 @@ export default defineConfig({
       namespace: 'SectApi',
       projectName: 'swagger',
       hook: {
-        // customFunctionName: (...arg) => {
-        //   console.log('sect customFunctionName:', ...arg)
-        // },
+        customFunctionName: (...arg: any[]) => {
+          const [data] = arg
+
+          const names = data.path.replace(/\/apis\/clients/g, '').replace(/\/apis\/admin/g, '').split('/')
+          const rawName = names.reduce((acc: string, name: string) => {
+            if(!name || ['apis', 'admin', 'clients'].includes(name)) return acc
+            return acc + '_' +name
+          }, data.method) + 'Api'
+
+          const name = toHump(rawName)
+
+          return name
+        },
         // customClassName: (...arg) => {
         //   console.log('sect customClassName:', ...arg)
         // }

+ 1 - 1
config/proxy.ts

@@ -5,7 +5,7 @@
 export default {
   dev: {
     '/apis/': {
-      target: 'http://127.0.0.1:8010',
+      target: 'https://sect.nosum.cn',
       changeOrigin: true,
     },
   },

+ 0 - 1
config/routes.ts

@@ -48,7 +48,6 @@ export default [
     path: '/settings',
     name: 'settings',
     icon: 'crown',
-    //  access: 'canAdmin',
     routes: [
       {
         path: '/settings',

+ 5 - 0
config/util.ts

@@ -0,0 +1,5 @@
+export function toHump(name: string) {
+  return name.replace(/_(\w)/g, function(_, letter){
+      return letter.toUpperCase();
+  });
+}

+ 0 - 176
mock/listTableList.ts

@@ -1,176 +0,0 @@
-import { Request, Response } from 'express';
-import moment from 'moment';
-import { parse } from 'url';
-
-// mock tableListDataSource
-const genList = (current: number, pageSize: number) => {
-  const tableListDataSource: API.RuleListItem[] = [];
-
-  for (let i = 0; i < pageSize; i += 1) {
-    const index = (current - 1) * 10 + i;
-    tableListDataSource.push({
-      key: index,
-      disabled: i % 6 === 0,
-      href: 'https://ant.design',
-      avatar: [
-        'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-      ][i % 2],
-      name: `TradeCode ${index}`,
-      owner: '曲丽丽',
-      desc: '这是一段描述',
-      callNo: Math.floor(Math.random() * 1000),
-      status: Math.floor(Math.random() * 10) % 4,
-      updatedAt: moment().format('YYYY-MM-DD'),
-      createdAt: moment().format('YYYY-MM-DD'),
-      progress: Math.ceil(Math.random() * 100),
-    });
-  }
-  tableListDataSource.reverse();
-  return tableListDataSource;
-};
-
-let tableListDataSource = genList(1, 100);
-
-function getRule(req: Request, res: Response, u: string) {
-  let realUrl = u;
-  if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
-    realUrl = req.url;
-  }
-  const { current = 1, pageSize = 10 } = req.query;
-  const params = parse(realUrl, true).query as unknown as API.PageParams &
-    API.RuleListItem & {
-      sorter: any;
-      filter: any;
-    };
-
-  let dataSource = [...tableListDataSource].slice(
-    ((current as number) - 1) * (pageSize as number),
-    (current as number) * (pageSize as number),
-  );
-  if (params.sorter) {
-    const sorter = JSON.parse(params.sorter);
-    dataSource = dataSource.sort((prev, next) => {
-      let sortNumber = 0;
-      (Object.keys(sorter) as Array<keyof API.RuleListItem>).forEach((key) => {
-        let nextSort = next?.[key] as number;
-        let preSort = prev?.[key] as number;
-        if (sorter[key] === 'descend') {
-          if (preSort - nextSort > 0) {
-            sortNumber += -1;
-          } else {
-            sortNumber += 1;
-          }
-          return;
-        }
-        if (preSort - nextSort > 0) {
-          sortNumber += 1;
-        } else {
-          sortNumber += -1;
-        }
-      });
-      return sortNumber;
-    });
-  }
-  if (params.filter) {
-    const filter = JSON.parse(params.filter as any) as {
-      [key: string]: string[];
-    };
-    if (Object.keys(filter).length > 0) {
-      dataSource = dataSource.filter((item) => {
-        return (Object.keys(filter) as Array<keyof API.RuleListItem>).some((key) => {
-          if (!filter[key]) {
-            return true;
-          }
-          if (filter[key].includes(`${item[key]}`)) {
-            return true;
-          }
-          return false;
-        });
-      });
-    }
-  }
-
-  if (params.name) {
-    dataSource = dataSource.filter((data) => data?.name?.includes(params.name || ''));
-  }
-  const result = {
-    data: dataSource,
-    total: tableListDataSource.length,
-    success: true,
-    pageSize,
-    current: parseInt(`${params.current}`, 10) || 1,
-  };
-
-  return res.json(result);
-}
-
-function postRule(req: Request, res: Response, u: string, b: Request) {
-  let realUrl = u;
-  if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
-    realUrl = req.url;
-  }
-
-  const body = (b && b.body) || req.body;
-  const { method, name, desc, key } = body;
-
-  switch (method) {
-    /* eslint no-case-declarations:0 */
-    case 'delete':
-      tableListDataSource = tableListDataSource.filter((item) => key.indexOf(item.key) === -1);
-      break;
-    case 'post':
-      (() => {
-        const i = Math.ceil(Math.random() * 10000);
-        const newRule: API.RuleListItem = {
-          key: tableListDataSource.length,
-          href: 'https://ant.design',
-          avatar: [
-            'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-            'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-          ][i % 2],
-          name,
-          owner: '曲丽丽',
-          desc,
-          callNo: Math.floor(Math.random() * 1000),
-          status: Math.floor(Math.random() * 10) % 2,
-          updatedAt: moment().format('YYYY-MM-DD'),
-          createdAt: moment().format('YYYY-MM-DD'),
-          progress: Math.ceil(Math.random() * 100),
-        };
-        tableListDataSource.unshift(newRule);
-        return res.json(newRule);
-      })();
-      return;
-
-    case 'update':
-      (() => {
-        let newRule = {};
-        tableListDataSource = tableListDataSource.map((item) => {
-          if (item.key === key) {
-            newRule = { ...item, desc, name };
-            return { ...item, desc, name };
-          }
-          return item;
-        });
-        return res.json(newRule);
-      })();
-      return;
-    default:
-      break;
-  }
-
-  const result = {
-    list: tableListDataSource,
-    pagination: {
-      total: tableListDataSource.length,
-    },
-  };
-
-  res.json(result);
-}
-
-export default {
-  'GET /api/rule': getRule,
-  'POST /api/rule': postRule,
-};

+ 0 - 31
mock/login.ts

@@ -1,31 +0,0 @@
-import { defineMock } from 'umi';
-
-export default defineMock({
-  'POST /apis/admin/staff/login': (req, res) => {
-    res.status(200).send({
-      code: 0,
-      msg: 'OK',
-      data: {
-        token: '',
-      },
-    });
-
-    return;
-  },
-  'GET /apis/admin/image/token': (req, res) => {
-    res.status(200).send({
-      code: 0,
-      msg: 'OK',
-      data: {
-        accessId: 'LTAI5tM57HQzYUmZEBTTgvua',
-        policy:
-          'eyJleHBpcmF0aW9uIjoiMjAyNC0wNi0wM1QwMjowNToyNy42OTBaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMTA0ODU3NjAwMF0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCIiXV19',
-        signature: '8LDgLM5ZkWW9IlcQn69W40E2XIU=',
-        dir: '',
-        host: 'https://oss-cn-shenzhen.aliyuncs.com',
-        expire: 1717380327,
-        callbackUrl: 'https://dev.century-info.com/apis/admin/oss/callback',
-      },
-    });
-  },
-});

+ 0 - 115
mock/notices.ts

@@ -1,115 +0,0 @@
-import { Request, Response } from 'express';
-
-const getNotices = (req: Request, res: Response) => {
-  res.json({
-    data: [
-      {
-        id: '000000001',
-        avatar:
-          'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/MSbDR4FR2MUAAAAAAAAAAAAAFl94AQBr',
-        title: '你收到了 14 份新周报',
-        datetime: '2017-08-09',
-        type: 'notification',
-      },
-      {
-        id: '000000002',
-        avatar:
-          'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/hX-PTavYIq4AAAAAAAAAAAAAFl94AQBr',
-        title: '你推荐的 曲妮妮 已通过第三轮面试',
-        datetime: '2017-08-08',
-        type: 'notification',
-      },
-      {
-        id: '000000003',
-        avatar:
-          'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/jHX5R5l3QjQAAAAAAAAAAAAAFl94AQBr',
-        title: '这种模板可以区分多种通知类型',
-        datetime: '2017-08-07',
-        read: true,
-        type: 'notification',
-      },
-      {
-        id: '000000004',
-        avatar:
-          'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/Wr4mQqx6jfwAAAAAAAAAAAAAFl94AQBr',
-        title: '左侧图标用于区分不同的类型',
-        datetime: '2017-08-07',
-        type: 'notification',
-      },
-      {
-        id: '000000005',
-        avatar:
-          'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/Mzj_TbcWUj4AAAAAAAAAAAAAFl94AQBr',
-        title: '内容不要超过两行字,超出时自动截断',
-        datetime: '2017-08-07',
-        type: 'notification',
-      },
-      {
-        id: '000000006',
-        avatar:
-          'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/eXLzRbPqQE4AAAAAAAAAAAAAFl94AQBr',
-        title: '曲丽丽 评论了你',
-        description: '描述信息描述信息描述信息',
-        datetime: '2017-08-07',
-        type: 'message',
-        clickClose: true,
-      },
-      {
-        id: '000000007',
-        avatar:
-          'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/w5mRQY2AmEEAAAAAAAAAAAAAFl94AQBr',
-        title: '朱偏右 回复了你',
-        description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
-        datetime: '2017-08-07',
-        type: 'message',
-        clickClose: true,
-      },
-      {
-        id: '000000008',
-        avatar:
-          'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/wPadR5M9918AAAAAAAAAAAAAFl94AQBr',
-        title: '标题',
-        description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
-        datetime: '2017-08-07',
-        type: 'message',
-        clickClose: true,
-      },
-      {
-        id: '000000009',
-        title: '任务名称',
-        description: '任务需要在 2017-01-12 20:00 前启动',
-        extra: '未开始',
-        status: 'todo',
-        type: 'event',
-      },
-      {
-        id: '000000010',
-        title: '第三方紧急代码变更',
-        description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
-        extra: '马上到期',
-        status: 'urgent',
-        type: 'event',
-      },
-      {
-        id: '000000011',
-        title: '信息安全考试',
-        description: '指派竹尔于 2017-01-09 前完成更新并发布',
-        extra: '已耗时 8 天',
-        status: 'doing',
-        type: 'event',
-      },
-      {
-        id: '000000012',
-        title: 'ABCD 版本发布',
-        description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
-        extra: '进行中',
-        status: 'processing',
-        type: 'event',
-      },
-    ],
-  });
-};
-
-export default {
-  'GET /api/notices': getNotices,
-};

+ 0 - 324
mock/requestRecord.mock.js

@@ -1,324 +0,0 @@
-module.exports = {
-  'GET /api/currentUser': {
-    data: {
-      name: 'Serati Ma',
-      avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png',
-      userid: '00000001',
-      email: 'antdesign@alipay.com',
-      signature: '海纳百川,有容乃大',
-      title: '交互专家',
-      group: '蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED',
-      tags: [
-        { key: '0', label: '很有想法的' },
-        { key: '1', label: '专注设计' },
-        { key: '2', label: '辣~' },
-        { key: '3', label: '大长腿' },
-        { key: '4', label: '川妹子' },
-        { key: '5', label: '海纳百川' },
-      ],
-      notifyCount: 12,
-      unreadCount: 11,
-      country: 'China',
-      geographic: {
-        province: { label: '浙江省', key: '330000' },
-        city: { label: '杭州市', key: '330100' },
-      },
-      address: '西湖区工专路 77 号',
-      phone: '0752-268888888',
-    },
-  },
-  'GET /api/rule': {
-    data: [
-      {
-        key: 99,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 99',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 503,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 81,
-      },
-      {
-        key: 98,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 98',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 164,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 12,
-      },
-      {
-        key: 97,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 97',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 174,
-        status: '1',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 81,
-      },
-      {
-        key: 96,
-        disabled: true,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 96',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 914,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 7,
-      },
-      {
-        key: 95,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 95',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 698,
-        status: '2',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 82,
-      },
-      {
-        key: 94,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 94',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 488,
-        status: '1',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 14,
-      },
-      {
-        key: 93,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 93',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 580,
-        status: '2',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 77,
-      },
-      {
-        key: 92,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 92',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 244,
-        status: '3',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 58,
-      },
-      {
-        key: 91,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 91',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 959,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 66,
-      },
-      {
-        key: 90,
-        disabled: true,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 90',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 958,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 72,
-      },
-      {
-        key: 89,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 89',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 301,
-        status: '2',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 2,
-      },
-      {
-        key: 88,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 88',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 277,
-        status: '1',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 12,
-      },
-      {
-        key: 87,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 87',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 810,
-        status: '1',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 82,
-      },
-      {
-        key: 86,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 86',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 780,
-        status: '3',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 22,
-      },
-      {
-        key: 85,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 85',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 705,
-        status: '3',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 12,
-      },
-      {
-        key: 84,
-        disabled: true,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 84',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 203,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 79,
-      },
-      {
-        key: 83,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 83',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 491,
-        status: '2',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 59,
-      },
-      {
-        key: 82,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 82',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 73,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 100,
-      },
-      {
-        key: 81,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 81',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 406,
-        status: '3',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 61,
-      },
-      {
-        key: 80,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 80',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 112,
-        status: '2',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 20,
-      },
-    ],
-    total: 100,
-    success: true,
-    pageSize: 20,
-    current: 1,
-  },
-  'POST /api/login/outLogin': { data: {}, success: true },
-  'POST /api/login/account': {
-    status: 'ok',
-    type: 'account',
-    currentAuthority: 'admin',
-  },
-};

+ 0 - 5
mock/route.ts

@@ -1,5 +0,0 @@
-export default {
-  '/api/auth_routes': {
-    '/form/advanced-form': { authority: ['admin', 'user'] },
-  },
-};

+ 0 - 203
mock/user.ts

@@ -1,203 +0,0 @@
-import { Request, Response } from 'express';
-
-const waitTime = (time: number = 100) => {
-  return new Promise((resolve) => {
-    setTimeout(() => {
-      resolve(true);
-    }, time);
-  });
-};
-
-async function getFakeCaptcha(req: Request, res: Response) {
-  await waitTime(2000);
-  return res.json('captcha-xxx');
-}
-
-const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION } = process.env;
-
-/**
- * 当前用户的权限,如果为空代表没登录
- * current user access, if is '', user need login
- * 如果是 pro 的预览,默认是有权限的
- */
-let access = ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site' ? 'admin' : '';
-
-const getAccess = () => {
-  return access;
-};
-
-// 代码中会兼容本地 service mock 以及部署站点的静态数据
-export default {
-  // 支持值为 Object 和 Array
-  'GET /api/currentUser': (req: Request, res: Response) => {
-    if (!getAccess()) {
-      res.status(401).send({
-        data: {
-          isLogin: false,
-        },
-        errorCode: '401',
-        errorMessage: '请先登录!',
-        success: true,
-      });
-      return;
-    }
-    res.send({
-      success: true,
-      data: {
-        name: 'Serati Ma',
-        avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
-        userid: '00000001',
-        email: 'antdesign@alipay.com',
-        signature: '海纳百川,有容乃大',
-        title: '交互专家',
-        group: '蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED',
-        tags: [
-          {
-            key: '0',
-            label: '很有想法的',
-          },
-          {
-            key: '1',
-            label: '专注设计',
-          },
-          {
-            key: '2',
-            label: '辣~',
-          },
-          {
-            key: '3',
-            label: '大长腿',
-          },
-          {
-            key: '4',
-            label: '川妹子',
-          },
-          {
-            key: '5',
-            label: '海纳百川',
-          },
-        ],
-        notifyCount: 12,
-        unreadCount: 11,
-        country: 'China',
-        access: getAccess(),
-        geographic: {
-          province: {
-            label: '浙江省',
-            key: '330000',
-          },
-          city: {
-            label: '杭州市',
-            key: '330100',
-          },
-        },
-        address: '西湖区工专路 77 号',
-        phone: '0752-268888888',
-      },
-    });
-  },
-  // GET POST 可省略
-  'GET /api/users': [
-    {
-      key: '1',
-      name: 'John Brown',
-      age: 32,
-      address: 'New York No. 1 Lake Park',
-    },
-    {
-      key: '2',
-      name: 'Jim Green',
-      age: 42,
-      address: 'London No. 1 Lake Park',
-    },
-    {
-      key: '3',
-      name: 'Joe Black',
-      age: 32,
-      address: 'Sidney No. 1 Lake Park',
-    },
-  ],
-  'POST /api/login/account': async (req: Request, res: Response) => {
-    const { password, username, type } = req.body;
-    await waitTime(2000);
-    if (password === 'ant.design' && username === 'admin') {
-      res.send({
-        status: 'ok',
-        type,
-        currentAuthority: 'admin',
-      });
-      access = 'admin';
-      return;
-    }
-    if (password === 'ant.design' && username === 'user') {
-      res.send({
-        status: 'ok',
-        type,
-        currentAuthority: 'user',
-      });
-      access = 'user';
-      return;
-    }
-    if (type === 'mobile') {
-      res.send({
-        status: 'ok',
-        type,
-        currentAuthority: 'admin',
-      });
-      access = 'admin';
-      return;
-    }
-
-    res.send({
-      status: 'error',
-      type,
-      currentAuthority: 'guest',
-    });
-    access = 'guest';
-  },
-  'POST /api/login/outLogin': (req: Request, res: Response) => {
-    access = '';
-    res.send({ data: {}, success: true });
-  },
-  'POST /api/register': (req: Request, res: Response) => {
-    res.send({ status: 'ok', currentAuthority: 'user', success: true });
-  },
-  'GET /api/500': (req: Request, res: Response) => {
-    res.status(500).send({
-      timestamp: 1513932555104,
-      status: 500,
-      error: 'error',
-      message: 'error',
-      path: '/base/category/list',
-    });
-  },
-  'GET /api/404': (req: Request, res: Response) => {
-    res.status(404).send({
-      timestamp: 1513932643431,
-      status: 404,
-      error: 'Not Found',
-      message: 'No message available',
-      path: '/base/category/list/2121212',
-    });
-  },
-  'GET /api/403': (req: Request, res: Response) => {
-    res.status(403).send({
-      timestamp: 1513932555104,
-      status: 403,
-      error: 'Forbidden',
-      message: 'Forbidden',
-      path: '/base/category/list',
-    });
-  },
-  'GET /api/401': (req: Request, res: Response) => {
-    res.status(401).send({
-      timestamp: 1513932555104,
-      status: 401,
-      error: 'Unauthorized',
-      message: 'Unauthorized',
-      path: '/base/category/list',
-    });
-  },
-
-  'GET  /api/login/captcha': getFakeCaptcha,
-};

+ 1 - 3
src/access.ts

@@ -1,9 +1,7 @@
 /**
  * @see https://umijs.org/docs/max/access#access
  * */
-export default function access(initialState: { currentUser?: API.CurrentUser } | undefined) {
-  const { currentUser } = initialState ?? {};
+export default function access() {
   return {
-    canAdmin: currentUser && currentUser.access === 'admin',
   };
 }

+ 36 - 22
src/app.tsx

@@ -4,11 +4,11 @@ import type { Settings as LayoutSettings } from '@ant-design/pro-components';
 import { SettingDrawer } from '@ant-design/pro-components';
 import { history, Link, RequestConfig, RunTimeLayoutConfig } from '@umijs/max';
 import defaultSettings from '../config/defaultSettings';
-import React from 'react';
 import { AxiosResponse } from 'axios';
-import { Service } from '@/pages/User/Login/service';
 import { message } from 'antd';
 import { Response } from '@/core/network';
+import { treeFormatBySymmetry } from './utils/tree';
+import { getStaffMeApi } from './services/swagger/staffAdmin';
 
 const isDev = process.env.NODE_ENV === 'development';
 const loginPath = '/user/login';
@@ -18,33 +18,23 @@ const loginPath = '/user/login';
  * */
 export async function getInitialState(): Promise<{
   settings?: Partial<LayoutSettings>;
-  currentUser?: API.CurrentUser;
+  currentUser?: SectApi.StaffVO;
   loading?: boolean;
-  fetchUserInfo?: () => Promise<API.CurrentUser | undefined>;
+  fetchUserInfo?: (...arg: any[]) => Promise<SectApi.StaffVO | undefined>;
 }> {
   const fetchUserInfo = async () => {
     try {
-      const msg = await Service.me();
+      const rs = await getStaffMeApi({
+        skipErrorHandler: true
+      });
 
-      if (!msg.success) {
-        message.warning(msg.errorMessage);
+      if (!rs.success) {
+        message.warning(rs.errorMessage);
         history.push(loginPath);
         return undefined;
       }
 
-      /**
-       * name: 'Serati Ma',
-       *         avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
-       *         userid: '00000001',
-       *         email: 'antdesign@alipay.com',
-       *         signature: '海纳百川,有容乃大',
-       *         title: '交互专家',
-       */
-      return {
-        name: msg.data.nickname,
-        avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
-        userid: msg.data.id,
-      };
+      return rs.data
     } catch (error) {
       history.push(loginPath);
     }
@@ -71,12 +61,34 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
   return {
     actionsRender: () => [<Question key="doc" />, <SelectLang key="SelectLang" />],
     avatarProps: {
-      src: initialState?.currentUser?.avatar,
+      src: initialState?.currentUser?.thumbAvatar,
       title: <AvatarName />,
       render: (_, avatarChildren) => {
         return <AvatarDropdown>{avatarChildren}</AvatarDropdown>;
       },
     },
+        menu: {
+      params:{
+      },
+      request: async (params, defaultMenuData) => {
+        const authMenus = initialState?.currentUser?.menus ?? []
+
+
+        const routes = treeFormatBySymmetry(defaultMenuData,authMenus, (treeNode, referTreeNode) => {
+          const treeNodePath = treeNode.path?.toLocaleLowerCase()
+          const referTreeNodePath = (referTreeNode?.url || '').toLocaleLowerCase()
+          const isHasAuth = treeNodePath && referTreeNodePath &&  treeNodePath === referTreeNodePath
+
+          if(isHasAuth) {
+            return {
+              ...treeNode,
+            }
+          }
+        } )
+
+        return  routes
+      },
+    },
     // waterMarkProps: {
     //   content: initialState?.currentUser?.name,
     // },
@@ -154,6 +166,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
  */
 export const request: RequestConfig = {
   errorConfig: {},
+
   requestInterceptors: [
     (url, options) => {
       const token = localStorage.getItem('token');
@@ -171,7 +184,8 @@ export const request: RequestConfig = {
     },
   ],
   responseInterceptors: [
-    <T,>(response: AxiosResponse<Response<T>>) => {
+    // @ts-ignore
+    <T extends any>(response: AxiosResponse<Response<T>>) => {
       console.log('response', response);
 
       console.log('res', response.status);

+ 2 - 2
src/components/RightContent/AvatarDropdown.tsx

@@ -16,7 +16,7 @@ export type GlobalHeaderRightProps = {
 export const AvatarName = () => {
   const { initialState } = useModel('@@initialState');
   const { currentUser } = initialState || {};
-  return <span className="anticon">{currentUser?.name}</span>;
+  return <span className="anticon">{currentUser?.nickname}</span>;
 };
 
 const useStyles = createStyles(({ token }) => {
@@ -94,7 +94,7 @@ export const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu, childre
 
   const { currentUser } = initialState;
 
-  if (!currentUser || !currentUser.name) {
+  if (!currentUser?.username) {
     return loading;
   }
 

+ 13 - 61
src/pages/Settings/Menu.tsx

@@ -12,58 +12,12 @@ import {Button, Card, Modal} from 'antd';
 import React, {useRef} from 'react';
 import {AddOutline} from 'antd-mobile-icons';
 import {EditBundle, useEdit} from '@/core/hooks/useEdit';
-import {invoke} from '@/core/network';
-
-type MenuVO = {
-  id?: number;
-  name: string;
-  sortNum: number;
-  status: number;
-  type: number;
-  parentId?: number;
-  url?: string;
-  target?: string;
-  hasRefresh?: number;
-  perms?: string;
-  icon?: string;
-  children?: MenuVO[];
-};
-
-type MenuList = MenuVO[];
-
-class Service {
-
-  public static async listTree(query: { keyword?: string; status?: number }) {
-    return invoke<MenuList>('/apis/admin/menu/tree/list', {
-      method: 'POST',
-      data: query,
-    });
-  }
-
-  public static async remove(id: number) {
-    return invoke<void>(`/apis/admin/menu/remove?id=${id}`, {
-      method: 'DELETE',
-    });
-  }
-
-  public static async save(menu: Partial<MenuVO>) {
-    return invoke<MenuVO>('/apis/admin/menu/save', {
-      method: 'POST',
-      data: menu,
-    });
-  }
-
-  public static async get(id: number) {
-    return invoke<MenuVO>(`/apis/admin/menu/details?id=${id}`, {
-      method: 'GET',
-    });
-  }
-}
+import { deleteMenuRemoveApi, getMenuDetailsApi, postMenuSaveApi, postMenuTreeListApi } from '@/services/swagger/menuAdmin';
 
 const Edit: React.FC<{ bundle: EditBundle;  onSuccess?: () => void }> = (props) => {
   let {bundle} = props;
 
-  const [form] = ProForm.useForm<MenuVO>();
+  const [form] = ProForm.useForm<SectApi.MenuVO>();
   const [loading, setLoading] = React.useState(false);
   return (
     <Modal
@@ -76,7 +30,7 @@ const Edit: React.FC<{ bundle: EditBundle;  onSuccess?: () => void }> = (props)
         try {
           setLoading(true);
 
-          await Service.save({
+          await postMenuSaveApi({
             id: bundle.id,
             ...form.getFieldsValue(),
           });
@@ -105,7 +59,7 @@ const Edit: React.FC<{ bundle: EditBundle;  onSuccess?: () => void }> = (props)
         request={async () => {
           if (bundle.id !== undefined) {
             console.log(bundle.id, 'bundle');
-            const res = await Service.get(bundle.id);
+            const res = await getMenuDetailsApi({id: bundle.id});
 
             return res.data;
           }
@@ -146,18 +100,15 @@ const Edit: React.FC<{ bundle: EditBundle;  onSuccess?: () => void }> = (props)
           placeholder="请选择父菜单ID"
           allowClear
           request={async () => {
-            const transformToTreeData = (data: MenuVO[]): any[] =>
+            const transformToTreeData = (data: SectApi.MenuVO[]): any[] =>
               data.map((item) => ({
                 title: item.name,
                 value: item.id,
                 key: item.id,
                 children: item.children ? transformToTreeData(item.children) : [],
               }));
-            const res = await Service.listTree({});
-            if (res.success) {
+            const res = await postMenuTreeListApi({})
               return transformToTreeData(res.data);
-            }
-            return Promise.resolve({});
           }}
         >
         </ProFormTreeSelect>
@@ -182,11 +133,10 @@ const MenuExp: React.FC = () => {
       <PageContainer content={''}>
         {bundle.open && <Edit bundle={bundle} onSuccess={() => ref.current?.reload()}></Edit>}
         <Card>
-          <ProTable<MenuVO>
+          <ProTable<SectApi.MenuVO>
             rowKey={'id'}
-            request={async (params) => {
-              const res = await Service.listTree({});
-
+            request={async () => {
+              const res = await postMenuTreeListApi({})
               return {
                 success: res.success,
                 data: res.data,
@@ -244,8 +194,10 @@ const MenuExp: React.FC = () => {
                   <a
                     key={'delete'}
                     onClick={async () => {
-                      await Service.remove(record.id as number);
-                      ref.current?.reload();
+                      if(record.id) {
+                        await deleteMenuRemoveApi({id:record.id});
+                        ref.current?.reload();
+                      }
                     }}
                   >
                     删除

+ 73 - 80
src/pages/Settings/Role.tsx

@@ -4,28 +4,16 @@ import {
   ProForm,
   ProFormText, ProFormTreeSelect,
   ProTable,
+  RequestOptionsType,
 } from '@ant-design/pro-components';
 import {Button, Card, Modal} from 'antd';
 import React, {useRef} from 'react';
 import {AddOutline} from 'antd-mobile-icons';
 import {EditBundle, useEdit} from '@/core/hooks/useEdit';
-import {invoke} from '@/core/network';
+import { deleteRoleRemoveApi, getRoleDetailsApi, postRolePageApi, postRoleSaveApi } from '@/services/swagger/roleAdmin';
+import { postMenuTreeListApi } from '@/services/swagger/menuAdmin';
 
-type Role = {
-  id?: number;
-  name: string;
-  sortNum: number;
-  status: number;
-};
-
-type RoleList = {
-  records: Role[];
-  total: number;
-  size: number;
-  current: number;
-};
-
-type MenuVO = {
+export type MenuVO = {
   id?: number;
   name: string;
   sortNum: number;
@@ -40,49 +28,10 @@ type MenuVO = {
   children?: MenuVO[];
 };
 
-type MenuList = MenuVO[];
-
-class Service {
-  public static async list(current: number, size: number) {
-    return invoke<RoleList>('/apis/admin/role/page', {
-      method: 'POST',
-      data: {
-        current,
-        size,
-      },
-    });
-  }
-
-  public static async remove(id: number) {
-    return invoke<void>(`/apis/admin/role/remove?id=${id}`, {
-      method: 'DELETE',
-    });
-  }
-
-  public static async save(member: Partial<Role>) {
-    return invoke<Role>('/apis/admin/role/save', {
-      method: 'POST',
-      data: member,
-    });
-  }
-
-  public static async get(id: number) {
-    return invoke<Role>(`/apis/admin/role/details?id=${id}`, {
-      method: 'GET',
-    });
-  }
-
-  public static async listTree(query: { keyword?: string; status?: number }) {
-    return invoke<MenuList>('/apis/admin/menu/tree/list', {
-      method: 'POST',
-      data: query,
-    });
-  }
-}
 
 const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) => {
   const {bundle} = props;
-  const [form] = ProForm.useForm<Role>();
+  const [form] = ProForm.useForm<SectApi.RoleSaveQuery>();
   const [loading, setLoading] = React.useState(false);
 
   return (
@@ -95,11 +44,11 @@ const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) =
 
         try {
           setLoading(true);
-
-          await Service.save({
+          await postRoleSaveApi({
             id: bundle.id,
             ...form.getFieldsValue(),
-          });
+          })
+
         } finally {
           setLoading(false);
         }
@@ -107,10 +56,6 @@ const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) =
         props.onSuccess?.();
         bundle.close();
       }}
-      onClose={() => {
-        form.resetFields();
-        bundle.close();
-      }}
       onCancel={() => {
         form.resetFields();
         bundle.close();
@@ -125,9 +70,30 @@ const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) =
         request={async () => {
           if (bundle.id !== undefined) {
             console.log(bundle.id, 'bundle');
-            const res = await Service.get(bundle.id);
 
-            return res.data;
+            const res = await getRoleDetailsApi({ id: bundle.id})
+
+
+            const menuIds: number[] = []
+            function getMenuIds (menus?:SectApi.MenuVO[]) {
+              menus?.forEach((menu) => {
+                if(menu.id) {
+                  menuIds.push(menu.id)
+                }
+
+                if(menu.children) {
+                  getMenuIds(menu.children)
+
+                }
+              })
+            }
+
+            getMenuIds(res.data.menus)
+
+            return {
+              ...res.data,
+              menuIds:menuIds
+            };
           }
 
           return Promise.resolve({});
@@ -152,25 +118,47 @@ const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) =
 
         <ProFormTreeSelect
           fieldProps={{
-            'multiple': 'true',
+            'multiple': true,
           }}
-          label='父菜单' name='menuIds'
+          label='父菜单'
+          name='menuIds'
           style={{width: '100%'}}
           placeholder="请选择菜单"
           allowClear
           request={async () => {
-            const transformToTreeData = (data: MenuVO[]): any[] =>
-              data.map((item) => ({
-                title: item.name,
+            const transformToTreeData = (data: SectApi.MenuVO[]): RequestOptionsType[] =>
+              data.map<RequestOptionsType>((item) => ({
+                label: item.name,
                 value: item.id,
-                key: item.id,
                 children: item.children ? transformToTreeData(item.children) : [],
               }));
-            const res = await Service.listTree({});
-            if (res.success) {
-              return transformToTreeData(res.data);
-            }
-            return Promise.resolve({});
+            const rs = await postMenuTreeListApi({});
+            const treeData = transformToTreeData(rs.data);
+            console.log(treeData)
+              return treeData
+
+
+
+          //   export type RequestOptionsType = {
+          //     /**
+          //      * 选项的文本内容,可以是一个 React 组件。
+          //      */
+          //     label?: React.ReactNode;
+          //     /**
+          //      * 选项的值,可以是一个字符串或数字类型。
+          //      */
+          //     value?: string | number | boolean;
+          //     /** 渲染的节点类型 */
+          //     optionType?: 'optGroup' | 'option';
+          //     /**
+          //      * 当节点类型为 optGroup 时,可以使用该属性来定义其包含的子选项,每个子选项也可以使用 RequestOptionsType 类型来定义。
+          //      */
+          //     options?: Omit<RequestOptionsType, 'children' | 'optionType'>[];
+          //     /** 其他自定义属性。 */
+          //     [key: string]: any;
+          // };
+
+
           }}
         >
         </ProFormTreeSelect>
@@ -187,10 +175,13 @@ const RoleExp: React.FC = () => {
     <PageContainer content={''}>
       {bundle.open && <Edit bundle={bundle} onSuccess={() => ref.current?.reload()}></Edit>}
       <Card>
-        <ProTable<Role>
+        <ProTable<SectApi.RoleVO>
           rowKey={'id'}
           request={async (params) => {
-            const res = await Service.list(params.current || 1, params.pageSize || 10);
+            const res = await postRolePageApi({
+              current: params.current || 1,
+              size:params.pageSize || 10,
+            })
 
             return {
               success: res.success,
@@ -217,8 +208,10 @@ const RoleExp: React.FC = () => {
                 <a
                   key={'delete'}
                   onClick={async () => {
-                    await Service.remove(record.id as number);
-                    ref.current?.reload();
+                    if(record.id) {
+                      await deleteRoleRemoveApi({id: record.id })
+                      ref.current?.reload();
+                    }
                   }}
                 >
                   删除

+ 22 - 61
src/pages/Settings/Settings.tsx

@@ -12,11 +12,11 @@ import {
   ProTable,
 } from '@ant-design/pro-components';
 import { Button, Card, Modal } from 'antd';
-import { invoke } from '@/core/network';
 import { AddOutline } from 'antd-mobile-icons';
 import { EditBundle, useEdit } from '@/core/hooks/useEdit';
 import dayjs from 'dayjs';
 import ReactJson from 'react-json-view';
+import { getConfigGetApi, postConfigPageApi, postConfigSaveApi } from '@/services/swagger/zidianpeizhiguanlihoutaiApi';
 
 enum ConfigPermission {
   /**
@@ -35,51 +35,6 @@ enum ConfigPermission {
 
 type ConfigType = 'int' | 'long' | 'str' | 'bool' | 'date' | 'dateTime' | 'json' | 'array';
 
-export interface Config {
-  id: number;
-  type: ConfigType;
-  code: string;
-  remark: string;
-  content: string;
-  permission: ConfigPermission;
-}
-
-export interface ConfigList {
-  records: Config[];
-  total: number;
-  size: number;
-  current: number;
-}
-
-class Service {
-  public static async page(current: number, size: number) {
-    return invoke<ConfigList>('/apis/admin/config/page', {
-      method: 'POST',
-      data: {
-        current,
-        size,
-      },
-    });
-  }
-
-  //save
-  public static async save(config: Partial<Config>) {
-    return invoke<Config>('/apis/admin/config/save', {
-      method: 'POST',
-      data: config,
-    });
-  }
-
-  //get
-  public static async get(code: string) {
-    return invoke<Config>(`/apis/admin/config/get`, {
-      method: 'GET',
-      params: {
-        code,
-      },
-    });
-  }
-}
 
 const Edit: React.FC<{ bundle: EditBundle<string>; onSuccess?: () => void }> = (props) => {
   const { bundle } = props;
@@ -94,7 +49,7 @@ const Edit: React.FC<{ bundle: EditBundle<string>; onSuccess?: () => void }> = (
 
         console.log(values);
 
-        const res = await Service.save({
+        const res = await postConfigSaveApi({
           ...values,
         });
 
@@ -108,24 +63,21 @@ const Edit: React.FC<{ bundle: EditBundle<string>; onSuccess?: () => void }> = (
       onCancel={() => {
         bundle.close();
       }}
-      onClose={() => {
-        bundle.close();
-      }}
     >
-      <ProForm<Partial<Config>>
+      <ProForm<Partial<SectApi.ConfigVO>>
         className={'mt-5'}
         validateTrigger={false}
         form={form}
         submitter={false}
         layout={'horizontal'}
         labelCol={{ span: 4 }}
-        request={async (): Promise<Partial<Config>> => {
+        request={async (): Promise<Partial<SectApi.ConfigVO>> => {
           if (bundle.id) {
-            const res = await Service.get(bundle.id);
+            const res = await getConfigGetApi({code: bundle.id})
 
             return {
               code: res.data.code,
-              type: res.data.type,
+              type: res.data.type as ConfigType,
               remark: res.data.remark,
               content: res.data.content,
             };
@@ -398,7 +350,6 @@ const JSONView: React.FC<{ value: string }> = (props) => {
         <Modal
           title={'JSON'}
           open={open}
-          onClose={() => setOpen(false)}
           footer={false}
           onCancel={() => setOpen(false)}
         >
@@ -431,7 +382,7 @@ const Settings: React.FC = () => {
         />
       )}
       <Card>
-        <ProTable<Config>
+        <ProTable<SectApi.ConfigVO>
           actionRef={ref}
           search={false}
           columns={[
@@ -477,7 +428,7 @@ const Settings: React.FC = () => {
                 switch (record.type) {
                   case 'json':
                   case 'array':
-                    return <JSONView value={record.content}></JSONView>;
+                    return record.content &&  <JSONView value={record.content}></JSONView>;
                   case 'date':
                     return dayjs(record.content).format('YYYY-MM-DD');
                   case 'dateTime':
@@ -507,6 +458,10 @@ const Settings: React.FC = () => {
               title: '操作',
               valueType: 'option',
               render: (_, record) => {
+                if(!record.code) {
+                  return null
+                }
+
                 const opts = [];
 
                 if (record.permission !== ConfigPermission.SYSTEM) {
@@ -514,7 +469,10 @@ const Settings: React.FC = () => {
                     <a
                       key={'edit'}
                       onClick={() => {
-                        edit.update(record.code);
+                        if(record.code)
+                        {
+                          edit.update(record.code);
+                        }
                       }}
                     >
                       编辑
@@ -541,13 +499,16 @@ const Settings: React.FC = () => {
             ],
             settings: [],
           }}
-          request={async (params, sort, filter) => {
-            const res = await Service.page(params.current || 1, params.pageSize || 20);
+          request={async (params) => {
+            const res = await postConfigPageApi({
+              current:params.current || 1,
+              size:params.pageSize || 20
+            });
 
             return {
               data: res.data.records,
               total: res.data.current,
-              success: true,
+              success: res.success,
             };
           }}
         ></ProTable>

+ 26 - 85
src/pages/Settings/Staff.tsx

@@ -3,84 +3,12 @@ import {Button, Card, Modal} from 'antd';
 import React, {useRef} from 'react';
 import {AddOutline} from 'antd-mobile-icons';
 import {EditBundle, useEdit} from '@/core/hooks/useEdit';
-import {invoke} from '@/core/network';
-
-type Member = {
-  id?: number;
-  username: string;
-  password: string;
-  nickname: string;
-  thumbAvatar?: string;
-  level: number;
-  roles: Role[];
-};
-
-type MemberList = {
-  records: Member[];
-  total: number;
-  size: number;
-  current: number;
-};
-
-
-type Role = {
-  id?: number;
-  name: string;
-  sortNum: number;
-  status: number;
-};
-
-type RoleList = {
-  records: Role[];
-  total: number;
-  size: number;
-  current: number;
-};
-
-class Service {
-  public static async list(current: number, size: number) {
-    return invoke<MemberList>('/apis/admin/staff/page', {
-      method: 'POST',
-      data: {
-        current,
-        size,
-      },
-    });
-  }
-
-  public static async listRole() {
-    return invoke<RoleList>('/apis/admin/role/page', {
-      method: 'POST',
-      data: {
-        current: 1,
-        size: 1000,
-      },
-    });
-  }
-
-  public static async remove(id: number) {
-    return invoke<void>(`/apis/admin/staff/remove?id=${id}`, {
-      method: 'DELETE',
-    });
-  }
-
-  public static async save(member: Partial<Member>) {
-    return invoke<Member>('/apis/admin/staff/save', {
-      method: 'POST',
-      data: member,
-    });
-  }
-
-  public static async get(id: number) {
-    return invoke<Member>(`/apis/admin/staff/details?id=${id}`, {
-      method: 'GET',
-    });
-  }
-}
+import { deleteStaffRemoveApi, getStaffDetailsApi, postStaffPageApi, postStaffSaveApi } from '@/services/swagger/staffAdmin';
+import { postRolePageApi } from '@/services/swagger/roleAdmin';
 
 const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) => {
   const {bundle} = props;
-  const [form] = ProForm.useForm<Member>();
+  const [form] = ProForm.useForm<SectApi.StaffSaveQuery>();
   const [loading, setLoading] = React.useState(false);
 
   return (
@@ -94,7 +22,7 @@ const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) =
         try {
           setLoading(true);
 
-          await Service.save({
+          await postStaffSaveApi({
             id: bundle.id,
             ...form.getFieldsValue(),
             thumbAvatar: '',
@@ -121,11 +49,11 @@ const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) =
         request={async () => {
           if (bundle.id !== undefined) {
             console.log(bundle.id, 'bundle');
-            const res = await Service.get(bundle.id);
+            const res = await getStaffDetailsApi({id: bundle.id});
 
             return {
               ...res.data,
-              roleIds: res.data.roles.map((rule) => {
+              roleIds: res.data.roles?.map((rule) => {
                 return rule.id
               })
             }
@@ -189,8 +117,10 @@ const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) =
           name="roleIds"
           label="角色"
           request={async () => {
-            const res = await Service.listRole();
-              return res.data.records.map(record => ({
+            const res = await postRolePageApi({        current: 1,
+              size: 1000});
+              const records = res.data.records ?? []
+              return records.map(record => ({
                 label: record.name,
                 value: record.id,
               }))
@@ -213,13 +143,19 @@ const Staff: React.FC = () => {
     <PageContainer content={''}>
       {bundle.open && <Edit bundle={bundle} onSuccess={() => ref.current?.reload()}></Edit>}
       <Card>
-        <ProTable<Member>
+        <ProTable<SectApi.StaffVO>
           rowKey={'id'}
 
           request={async (params, ...rest) => {
             console.log(params, ...rest)
 
-            const res = await Service.list(params.current || 1, params.pageSize || 10);
+            const res = await postStaffPageApi(
+
+              {
+                current: params.current || 1,
+                size: params.pageSize || 10,
+              }
+              );
 
             return {
               success: res.success,
@@ -246,7 +182,10 @@ const Staff: React.FC = () => {
             {
               title: '角色列表',
               dataIndex: 'roles',
-              render: (roles: Role[]) => roles.map(role => role.name).join(', '),
+              // @ts-ignore
+              render: (roles: SectApi.RoleVO[]) => {
+                return roles.map(role => role.name).join(', ')
+              },
             },
             {
               title: '操作',
@@ -258,8 +197,10 @@ const Staff: React.FC = () => {
                 <a
                   key={'delete'}
                   onClick={async () => {
-                    await Service.remove(record.id as number);
-                    ref.current?.reload();
+                    if(record.id) {
+                      await deleteStaffRemoveApi({id: record.id})
+                      ref.current?.reload();
+                    }
                   }}
                 >
                   删除

+ 17 - 46
src/pages/Settings/Users.tsx

@@ -1,54 +1,16 @@
 import React, { useRef } from 'react';
 import { ActionType, PageContainer, ProTable } from '@ant-design/pro-components';
 import { Card, Image, Popconfirm } from 'antd';
-import { invoke } from '@/core/network';
+import { deleteUserRemoveApi, getUserDetailsApi, postUserPageApi } from '@/services/swagger/userAdmin';
 
-type User = {
-  id: number;
-  mobile: string;
-  nickname: string;
-  avatarThumbnail: string;
-  avatarOriginal: string;
-};
-
-type UserList = {
-  records: User[];
-  total: number;
-  size: number;
-  current: number;
-};
-
-class Service {
-  public static async page(current: number, size: number) {
-    return invoke<UserList>('/apis/admin/user/page', {
-      method: 'POST',
-      data: {
-        current,
-        size,
-      },
-    });
-  }
 
-  public static async remove(id: number) {
-    return invoke<void>(`/apis/admin/user/remove?id=${id}`, {
-      method: 'DELETE',
-    });
-  }
-
-  public static async get(id: number) {
-    return invoke<User>(`/apis/admin/user/details?id=${id}`, {
-      method: 'GET',
-    });
-  }
-}
-
-const Users: React.FC<{}> = (props) => {
+const Users = () => {
   const ref = useRef<ActionType>();
 
   return (
     <PageContainer>
       <Card>
-        <ProTable<User>
+        <ProTable<SectApi.UserVO>
           actionRef={ref}
           rowKey="id"
           search={false}
@@ -58,7 +20,11 @@ const Users: React.FC<{}> = (props) => {
           }}
           request={async (params) => {
             const { current, pageSize } = params;
-            const result = await Service.page(current || 1, pageSize || 20);
+            const result = await postUserPageApi({
+              current:current || 1,
+              size:pageSize || 20,
+
+            });
             return {
               data: result.data.records,
               total: result.data.total,
@@ -92,8 +58,10 @@ const Users: React.FC<{}> = (props) => {
                 <a
                   key={'edit'}
                   onClick={async () => {
-                    const user = await Service.get(record.id);
-                    console.log(user);
+                    if(record.id) {
+                      const user = await getUserDetailsApi({id: record.id});
+                      console.log(user);
+                    }
                   }}
                 >
                   编辑
@@ -102,8 +70,11 @@ const Users: React.FC<{}> = (props) => {
                   key={'delete'}
                   title={'确认删除吗?'}
                   onConfirm={async () => {
-                    await Service.remove(record.id);
-                    ref.current?.reload();
+                    if(record.id) {
+                      await deleteUserRemoveApi({id: record.id});
+                      ref.current?.reload();
+                    }
+
                   }}
                 >
                   <a key={'delete'}>删除</a>

+ 2 - 2
src/pages/TableList/components/UpdateForm.tsx

@@ -16,13 +16,13 @@ export type FormValueType = {
   type?: string;
   time?: string;
   frequency?: string;
-} & Partial<API.RuleListItem>;
+} & Partial<SectApi.RuleListItem>;
 
 export type UpdateFormProps = {
   onCancel: (flag?: boolean, formVals?: FormValueType) => void;
   onSubmit: (values: FormValueType) => Promise<void>;
   updateModalOpen: boolean;
-  values: Partial<API.RuleListItem>;
+  values: Partial<SectApi.RuleListItem>;
 };
 
 const UpdateForm: React.FC<UpdateFormProps> = (props) => {

+ 9 - 9
src/pages/TableList/index.tsx

@@ -21,7 +21,7 @@ import UpdateForm from './components/UpdateForm';
  * @zh-CN 添加节点
  * @param fields
  */
-const handleAdd = async (fields: API.RuleListItem) => {
+const handleAdd = async (fields: SectApi.RuleListItem) => {
   const hide = message.loading('正在添加');
   try {
     await addRule({ ...fields });
@@ -66,7 +66,7 @@ const handleUpdate = async (fields: FormValueType) => {
  *
  * @param selectedRows
  */
-const handleRemove = async (selectedRows: API.RuleListItem[]) => {
+const handleRemove = async (selectedRows: SectApi.RuleListItem[]) => {
   const hide = message.loading('正在删除');
   if (!selectedRows) return true;
   try {
@@ -98,8 +98,8 @@ const TableList: React.FC = () => {
   const [showDetail, setShowDetail] = useState<boolean>(false);
 
   const actionRef = useRef<ActionType>();
-  const [currentRow, setCurrentRow] = useState<API.RuleListItem>();
-  const [selectedRowsState, setSelectedRows] = useState<API.RuleListItem[]>([]);
+  const [currentRow, setCurrentRow] = useState<SectApi.RuleListItem>();
+  const [selectedRowsState, setSelectedRows] = useState<SectApi.RuleListItem[]>([]);
 
   /**
    * @en-US International configuration
@@ -107,7 +107,7 @@ const TableList: React.FC = () => {
    * */
   const intl = useIntl();
 
-  const columns: ProColumns<API.RuleListItem>[] = [
+  const columns: ProColumns<SectApi.RuleListItem>[] = [
     {
       title: (
         <FormattedMessage
@@ -243,7 +243,7 @@ const TableList: React.FC = () => {
 
   return (
     <PageContainer>
-      <ProTable<API.RuleListItem, API.PageParams>
+      <ProTable<SectApi.RuleListItem, SectApi.PageParams>
         headerTitle={intl.formatMessage({
           id: 'pages.searchTable.title',
           defaultMessage: 'Enquiry form',
@@ -320,7 +320,7 @@ const TableList: React.FC = () => {
         open={createModalOpen}
         onOpenChange={handleModalOpen}
         onFinish={async (value) => {
-          const success = await handleAdd(value as API.RuleListItem);
+          const success = await handleAdd(value as SectApi.RuleListItem);
           if (success) {
             handleModalOpen(false);
             if (actionRef.current) {
@@ -377,7 +377,7 @@ const TableList: React.FC = () => {
         closable={false}
       >
         {currentRow?.name && (
-          <ProDescriptions<API.RuleListItem>
+          <ProDescriptions<SectApi.RuleListItem>
             column={2}
             title={currentRow?.name}
             request={async () => ({
@@ -386,7 +386,7 @@ const TableList: React.FC = () => {
             params={{
               id: currentRow?.name,
             }}
-            columns={columns as ProDescriptionsItemProps<API.RuleListItem>[]}
+            columns={columns as ProDescriptionsItemProps<SectApi.RuleListItem>[]}
           />
         )}
       </Drawer>

+ 6 - 6
src/pages/User/Login/index.tsx

@@ -6,7 +6,7 @@ import Settings from '../../../../config/defaultSettings';
 import React, { useState } from 'react';
 import { flushSync } from 'react-dom';
 import { createStyles } from 'antd-style';
-import { LoginParams, Service } from '@/pages/User/Login/service';
+import { postStaffLoginApi } from '@/services/swagger/staffAdmin';
 
 const useStyles = createStyles(({ token }) => {
   return {
@@ -60,7 +60,7 @@ const LoginMessage: React.FC<{
 };
 
 const Login: React.FC = () => {
-  const [userLoginState, setUserLoginState] = useState<API.LoginResult>({});
+  const [userLoginState, setUserLoginState] = useState<{type: string, status: string}>();
   const [type, setType] = useState<string>('account');
   const { initialState, setInitialState } = useModel('@@initialState');
   const { styles } = useStyles();
@@ -78,10 +78,10 @@ const Login: React.FC = () => {
     }
   };
 
-  const handleSubmit = async (values: LoginParams) => {
+  const handleSubmit = async (values: SectApi.StaffLoginQuery) => {
     try {
       // 登录
-      const msg = await Service.login({ ...values });
+      const msg = await postStaffLoginApi({ ...values });
 
       console.log('msg', msg);
 
@@ -109,7 +109,7 @@ const Login: React.FC = () => {
       message.error(defaultLoginFailureMessage);
     }
   };
-  const { status, type: loginType } = userLoginState;
+  const { status, type: loginType } = userLoginState || {};
 
   return (
     <div className={styles.container}>
@@ -141,7 +141,7 @@ const Login: React.FC = () => {
           }}
           actions={[]}
           onFinish={async (values) => {
-            await handleSubmit(values as LoginParams);
+            await handleSubmit(values as SectApi.StaffLoginQuery);
           }}
         >
           <Tabs

+ 0 - 27
src/pages/User/Login/service.ts

@@ -1,27 +0,0 @@
-import { invoke } from '@/core/network';
-
-export interface LoginParams {
-  username: string;
-  password: string;
-}
-
-export interface Me {
-  id: number;
-  name: string;
-  nickname: string;
-}
-
-export class Service {
-  public static async login(params: LoginParams) {
-    return invoke<string>('/apis/admin/staff/login', {
-      method: 'POST',
-      data: params,
-    });
-  }
-
-  public static async me() {
-    return invoke<Me>('/apis/admin/staff/me', {
-      skipErrorHandler: true,
-    });
-  }
-}

+ 6 - 3
src/services/swagger/clientsAuth.ts

@@ -3,7 +3,7 @@
 import { invoke as request } from '@/core/network';
 
 /** 获取 Ticket POST /apis/clients/auth/getTicket */
-export async function getTicket(
+export async function postAuthGetTicketApi(
   body: SectApi.AuthTicketQuery | SectApi.Mobile | SectApi.Qq | SectApi.WeiBo,
   options?: { [key: string]: any },
 ) {
@@ -18,7 +18,10 @@ export async function getTicket(
 }
 
 /** 获取 Token POST /apis/clients/auth/getToken */
-export async function getToken(body: SectApi.AuthTokenQuery, options?: { [key: string]: any }) {
+export async function postAuthGetTokenApi(
+  body: SectApi.AuthTokenQuery,
+  options?: { [key: string]: any },
+) {
   return request<SectApi.AuthTokenInfoVO>('/apis/clients/auth/getToken', {
     method: 'POST',
     headers: {
@@ -30,7 +33,7 @@ export async function getToken(body: SectApi.AuthTokenQuery, options?: { [key: s
 }
 
 /** 登出 GET /apis/clients/auth/logout */
-export async function logout(options?: { [key: string]: any }) {
+export async function getAuthLogoutApi(options?: { [key: string]: any }) {
   return request<boolean>('/apis/clients/auth/logout', {
     method: 'GET',
     ...(options || {}),

+ 12 - 6
src/services/swagger/menuAdmin.ts

@@ -3,9 +3,9 @@
 import { invoke as request } from '@/core/network';
 
 /** 菜单详情 GET /apis/admin/menu/details */
-export async function details3(
+export async function getMenuDetailsApi(
   // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
-  params: SectApi.details3Params,
+  params: SectApi.getMenuDetailsApiParams,
   options?: { [key: string]: any },
 ) {
   return request<SectApi.MenuVO>('/apis/admin/menu/details', {
@@ -18,9 +18,9 @@ export async function details3(
 }
 
 /** 删除菜单 DELETE /apis/admin/menu/remove */
-export async function remove3(
+export async function deleteMenuRemoveApi(
   // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
-  params: SectApi.remove3Params,
+  params: SectApi.deleteMenuRemoveApiParams,
   options?: { [key: string]: any },
 ) {
   return request<boolean>('/apis/admin/menu/remove', {
@@ -33,7 +33,10 @@ export async function remove3(
 }
 
 /** 保存菜单 POST /apis/admin/menu/save */
-export async function save2(body: SectApi.MenuSaveQuery, options?: { [key: string]: any }) {
+export async function postMenuSaveApi(
+  body: SectApi.MenuSaveQuery,
+  options?: { [key: string]: any },
+) {
   return request<boolean>('/apis/admin/menu/save', {
     method: 'POST',
     headers: {
@@ -45,7 +48,10 @@ export async function save2(body: SectApi.MenuSaveQuery, options?: { [key: strin
 }
 
 /** 查询菜单树 POST /apis/admin/menu/tree/list */
-export async function listTree(body: SectApi.MenuTreeQuery, options?: { [key: string]: any }) {
+export async function postMenuTreeListApi(
+  body: SectApi.MenuTreeQuery,
+  options?: { [key: string]: any },
+) {
   return request<SectApi.MenuVO[]>('/apis/admin/menu/tree/list', {
     method: 'POST',
     headers: {

+ 13 - 7
src/services/swagger/roleAdmin.ts

@@ -3,9 +3,9 @@
 import { invoke as request } from '@/core/network';
 
 /** 角色详情 GET /apis/admin/role/details */
-export async function details2(
+export async function getRoleDetailsApi(
   // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
-  params: SectApi.details2Params,
+  params: SectApi.getRoleDetailsApiParams,
   options?: { [key: string]: any },
 ) {
   return request<SectApi.RoleVO>('/apis/admin/role/details', {
@@ -18,7 +18,7 @@ export async function details2(
 }
 
 /** 此处后端没有提供注释 POST /apis/admin/role/list */
-export async function list(options?: { [key: string]: any }) {
+export async function postRoleListApi(options?: { [key: string]: any }) {
   return request<SectApi.RoleVO[]>('/apis/admin/role/list', {
     method: 'POST',
     ...(options || {}),
@@ -26,7 +26,10 @@ export async function list(options?: { [key: string]: any }) {
 }
 
 /** 分页查询角色 POST /apis/admin/role/page */
-export async function page2(body: SectApi.RolePageQuery, options?: { [key: string]: any }) {
+export async function postRolePageApi(
+  body: SectApi.RolePageQuery,
+  options?: { [key: string]: any },
+) {
   return request<SectApi.IPageRoleVO>('/apis/admin/role/page', {
     method: 'POST',
     headers: {
@@ -38,9 +41,9 @@ export async function page2(body: SectApi.RolePageQuery, options?: { [key: strin
 }
 
 /** 删除角色 DELETE /apis/admin/role/remove */
-export async function remove2(
+export async function deleteRoleRemoveApi(
   // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
-  params: SectApi.remove2Params,
+  params: SectApi.deleteRoleRemoveApiParams,
   options?: { [key: string]: any },
 ) {
   return request<boolean>('/apis/admin/role/remove', {
@@ -53,7 +56,10 @@ export async function remove2(
 }
 
 /** 保存角色 POST /apis/admin/role/save */
-export async function save1(body: SectApi.RoleSaveQuery, options?: { [key: string]: any }) {
+export async function postRoleSaveApi(
+  body: SectApi.RoleSaveQuery,
+  options?: { [key: string]: any },
+) {
   return request<boolean>('/apis/admin/role/save', {
     method: 'POST',
     headers: {

+ 17 - 8
src/services/swagger/staffAdmin.ts

@@ -3,9 +3,9 @@
 import { invoke as request } from '@/core/network';
 
 /** 管理员详情 GET /apis/admin/staff/details */
-export async function details1(
+export async function getStaffDetailsApi(
   // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
-  params: SectApi.details1Params,
+  params: SectApi.getStaffDetailsApiParams,
   options?: { [key: string]: any },
 ) {
   return request<SectApi.StaffVO>('/apis/admin/staff/details', {
@@ -18,7 +18,10 @@ export async function details1(
 }
 
 /** 登录 POST /apis/admin/staff/login */
-export async function login(body: SectApi.StaffLoginQuery, options?: { [key: string]: any }) {
+export async function postStaffLoginApi(
+  body: SectApi.StaffLoginQuery,
+  options?: { [key: string]: any },
+) {
   return request<string>('/apis/admin/staff/login', {
     method: 'POST',
     headers: {
@@ -30,7 +33,7 @@ export async function login(body: SectApi.StaffLoginQuery, options?: { [key: str
 }
 
 /** 当前登录管理员信息 GET /apis/admin/staff/me */
-export async function me(options?: { [key: string]: any }) {
+export async function getStaffMeApi(options?: { [key: string]: any }) {
   return request<SectApi.StaffVO>('/apis/admin/staff/me', {
     method: 'GET',
     ...(options || {}),
@@ -38,7 +41,10 @@ export async function me(options?: { [key: string]: any }) {
 }
 
 /** 分页查询管理员 POST /apis/admin/staff/page */
-export async function page1(body: SectApi.StaffPageQuery, options?: { [key: string]: any }) {
+export async function postStaffPageApi(
+  body: SectApi.StaffPageQuery,
+  options?: { [key: string]: any },
+) {
   return request<SectApi.IPageStaffVO>('/apis/admin/staff/page', {
     method: 'POST',
     headers: {
@@ -50,9 +56,9 @@ export async function page1(body: SectApi.StaffPageQuery, options?: { [key: stri
 }
 
 /** 删除管理员 DELETE /apis/admin/staff/remove */
-export async function remove1(
+export async function deleteStaffRemoveApi(
   // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
-  params: SectApi.remove1Params,
+  params: SectApi.deleteStaffRemoveApiParams,
   options?: { [key: string]: any },
 ) {
   return request<boolean>('/apis/admin/staff/remove', {
@@ -65,7 +71,10 @@ export async function remove1(
 }
 
 /** 保存管理员 POST /apis/admin/staff/save */
-export async function save(body: SectApi.StaffSaveQuery, options?: { [key: string]: any }) {
+export async function postStaffSaveApi(
+  body: SectApi.StaffSaveQuery,
+  options?: { [key: string]: any },
+) {
   return request<boolean>('/apis/admin/staff/save', {
     method: 'POST',
     headers: {

+ 36 - 34
src/services/swagger/typings.d.ts

@@ -80,64 +80,72 @@ declare namespace SectApi {
     permission?: number;
   };
 
-  type details1Params = {
+  type deleteMenuRemoveApiParams = {
     id: number;
   };
 
-  type details2Params = {
+  type deleteRoleRemoveApiParams = {
     id: number;
   };
 
-  type details3Params = {
+  type deleteStaffRemoveApiParams = {
     id: number;
   };
 
-  type detailsParams = {
+  type deleteUserRemoveApiParams = {
     id: number;
   };
 
-  type getByCodeParams = {
+  type getConfigGetApiParams = {
     code: string;
   };
 
+  type getMenuDetailsApiParams = {
+    id: number;
+  };
+
+  type getRoleDetailsApiParams = {
+    id: number;
+  };
+
+  type getStaffDetailsApiParams = {
+    id: number;
+  };
+
+  type getUserDetailsApiParams = {
+    id: number;
+  };
+
   type IPageConfigVO = {
     size?: number;
     records?: ConfigVO[];
     current?: number;
-    pages?: number;
     total?: number;
+    pages?: number;
   };
 
   type IPageRoleVO = {
     size?: number;
     records?: RoleVO[];
     current?: number;
-    pages?: number;
     total?: number;
+    pages?: number;
   };
 
   type IPageStaffVO = {
     size?: number;
     records?: StaffVO[];
     current?: number;
-    pages?: number;
     total?: number;
+    pages?: number;
   };
 
   type IPageUserVO = {
     size?: number;
     records?: UserVO[];
     current?: number;
-    pages?: number;
     total?: number;
-  };
-
-  type listByCodePrefix1Params = {
-    prefix: string;
-  };
-
-  type listByCodePrefixParams = {
-    prefix: string;
+    pages?: number;
   };
 
   type MenuSaveQuery = {
@@ -222,6 +230,14 @@ declare namespace SectApi {
       socialTicket?: string;
     };
 
+  type postConfigListPrefixApiParams = {
+    prefix: string;
+  };
+
+  type postUserConfigListPrefixApiParams = {
+    prefix: string;
+  };
+
   type Qq =
     // #/components/schemas/AuthTicketQuery
     AuthTicketQuery & {
@@ -229,22 +245,6 @@ declare namespace SectApi {
       accessToken?: string;
     };
 
-  type remove1Params = {
-    id: number;
-  };
-
-  type remove2Params = {
-    id: number;
-  };
-
-  type remove3Params = {
-    id: number;
-  };
-
-  type removeParams = {
-    id: number;
-  };
-
   type RolePageQuery = {
     cursor?: string;
     direction?: string;
@@ -264,7 +264,7 @@ declare namespace SectApi {
     /** 显示顺序 */
     sortNum?: number;
     /** 角色状态(1:正常 2:停用) */
-    status: 1 | 2;
+    status?: 1 | 2;
     /** 菜单ID列表 */
     menuIds: number[];
   };
@@ -282,6 +282,8 @@ declare namespace SectApi {
     sortNum?: number;
     /** 角色状态(1:正常 2:停用) */
     status?: 1 | 2;
+    /** 具备权限的菜单列表 */
+    menus?: MenuVO[];
   };
 
   type StaffLoginQuery = {

+ 8 - 5
src/services/swagger/userAdmin.ts

@@ -3,9 +3,9 @@
 import { invoke as request } from '@/core/network';
 
 /** 用户详情 GET /apis/admin/user/details */
-export async function details(
+export async function getUserDetailsApi(
   // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
-  params: SectApi.detailsParams,
+  params: SectApi.getUserDetailsApiParams,
   options?: { [key: string]: any },
 ) {
   return request<SectApi.UserVO>('/apis/admin/user/details', {
@@ -18,7 +18,10 @@ export async function details(
 }
 
 /** 分页查询用户 POST /apis/admin/user/page */
-export async function page(body: SectApi.UserPageQuery, options?: { [key: string]: any }) {
+export async function postUserPageApi(
+  body: SectApi.UserPageQuery,
+  options?: { [key: string]: any },
+) {
   return request<SectApi.IPageUserVO>('/apis/admin/user/page', {
     method: 'POST',
     headers: {
@@ -30,9 +33,9 @@ export async function page(body: SectApi.UserPageQuery, options?: { [key: string
 }
 
 /** 删除用户 DELETE /apis/admin/user/remove */
-export async function remove(
+export async function deleteUserRemoveApi(
   // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
-  params: SectApi.removeParams,
+  params: SectApi.deleteUserRemoveApiParams,
   options?: { [key: string]: any },
 ) {
   return request<boolean>('/apis/admin/user/remove', {

+ 7 - 4
src/services/swagger/userConfigClients.ts

@@ -3,7 +3,7 @@
 import { invoke as request } from '@/core/network';
 
 /** 根据配置编码查询用户配置 POST /apis/clients/user_config/list */
-export async function listByCode(body: string[], options?: { [key: string]: any }) {
+export async function postUserConfigListApi(body: string[], options?: { [key: string]: any }) {
   return request<SectApi.ConfigVO[]>('/apis/clients/user_config/list', {
     method: 'POST',
     headers: {
@@ -15,9 +15,9 @@ export async function listByCode(body: string[], options?: { [key: string]: any
 }
 
 /** 根据配置编码前缀查询用户配置 POST /apis/clients/user_config/list_prefix */
-export async function listByCodePrefix(
+export async function postUserConfigListPrefixApi(
   // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
-  params: SectApi.listByCodePrefixParams,
+  params: SectApi.postUserConfigListPrefixApiParams,
   options?: { [key: string]: any },
 ) {
   return request<SectApi.ConfigVO[]>('/apis/clients/user_config/list_prefix', {
@@ -30,7 +30,10 @@ export async function listByCodePrefix(
 }
 
 /** 批量保存用户配置 POST /apis/clients/user_config/save_batch */
-export async function saveBatch(body: SectApi.UserConfig[], options?: { [key: string]: any }) {
+export async function postUserConfigSaveBatchApi(
+  body: SectApi.UserConfig[],
+  options?: { [key: string]: any },
+) {
   return request<boolean>('/apis/clients/user_config/save_batch', {
     method: 'POST',
     headers: {

+ 3 - 3
src/services/swagger/yonghuqiandaokehuduanApi.ts

@@ -3,7 +3,7 @@
 import { invoke as request } from '@/core/network';
 
 /** 获取用户签到次数 GET /apis/clients/user_sign/cnt */
-export async function cnt(options?: { [key: string]: any }) {
+export async function getUserSignCntApi(options?: { [key: string]: any }) {
   return request<number>('/apis/clients/user_sign/cnt', {
     method: 'GET',
     ...(options || {}),
@@ -11,7 +11,7 @@ export async function cnt(options?: { [key: string]: any }) {
 }
 
 /** 获取用户签到列表 GET /apis/clients/user_sign/list */
-export async function list1(options?: { [key: string]: any }) {
+export async function getUserSignListApi(options?: { [key: string]: any }) {
   return request<number[]>('/apis/clients/user_sign/list', {
     method: 'GET',
     ...(options || {}),
@@ -19,7 +19,7 @@ export async function list1(options?: { [key: string]: any }) {
 }
 
 /** 用户签到 GET /apis/clients/user_sign/sign */
-export async function sign(options?: { [key: string]: any }) {
+export async function getUserSignSignApi(options?: { [key: string]: any }) {
   return request<boolean>('/apis/clients/user_sign/sign', {
     method: 'GET',
     ...(options || {}),

+ 14 - 8
src/services/swagger/zidianpeizhiguanlihoutaiApi.ts

@@ -3,9 +3,9 @@
 import { invoke as request } from '@/core/network';
 
 /** 根据ID获取字典配置 GET /apis/admin/config/get */
-export async function getByCode(
+export async function getConfigGetApi(
   // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
-  params: SectApi.getByCodeParams,
+  params: SectApi.getConfigGetApiParams,
   options?: { [key: string]: any },
 ) {
   return request<SectApi.ConfigVO>('/apis/admin/config/get', {
@@ -18,7 +18,7 @@ export async function getByCode(
 }
 
 /** 根据ID获取字典配置 POST /apis/admin/config/list */
-export async function listByCode1(body: string[], options?: { [key: string]: any }) {
+export async function postConfigListApi(body: string[], options?: { [key: string]: any }) {
   return request<SectApi.ConfigVO[]>('/apis/admin/config/list', {
     method: 'POST',
     headers: {
@@ -30,9 +30,9 @@ export async function listByCode1(body: string[], options?: { [key: string]: any
 }
 
 /** 根据前缀获取字典配置 POST /apis/admin/config/list_prefix */
-export async function listByCodePrefix1(
+export async function postConfigListPrefixApi(
   // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
-  params: SectApi.listByCodePrefix1Params,
+  params: SectApi.postConfigListPrefixApiParams,
   options?: { [key: string]: any },
 ) {
   return request<SectApi.ConfigVO[]>('/apis/admin/config/list_prefix', {
@@ -45,7 +45,10 @@ export async function listByCodePrefix1(
 }
 
 /** 分页查询字典配置 POST /apis/admin/config/page */
-export async function page3(body: SectApi.ConfigPageQuery, options?: { [key: string]: any }) {
+export async function postConfigPageApi(
+  body: SectApi.ConfigPageQuery,
+  options?: { [key: string]: any },
+) {
   return request<SectApi.IPageConfigVO>('/apis/admin/config/page', {
     method: 'POST',
     headers: {
@@ -57,7 +60,7 @@ export async function page3(body: SectApi.ConfigPageQuery, options?: { [key: str
 }
 
 /** 保存字典配置 POST /apis/admin/config/save */
-export async function save3(body: SectApi.Config, options?: { [key: string]: any }) {
+export async function postConfigSaveApi(body: SectApi.Config, options?: { [key: string]: any }) {
   return request<boolean>('/apis/admin/config/save', {
     method: 'POST',
     headers: {
@@ -69,7 +72,10 @@ export async function save3(body: SectApi.Config, options?: { [key: string]: any
 }
 
 /** 批量保存字典配置 POST /apis/admin/config/save_batch */
-export async function saveBatch1(body: SectApi.Config[], options?: { [key: string]: any }) {
+export async function postConfigSaveBatchApi(
+  body: SectApi.Config[],
+  options?: { [key: string]: any },
+) {
   return request<boolean>('/apis/admin/config/save_batch', {
     method: 'POST',
     headers: {

+ 85 - 0
src/utils/tree.ts

@@ -0,0 +1,85 @@
+import { isArray, isUndefined } from "lodash"
+
+interface TreeHelperConfig {
+  id: string
+  children: string
+  pid: string
+}
+
+type TreeHelperConfigParams = Partial<TreeHelperConfig>
+
+// 默认配置
+const DEFAULT_CONFIG: TreeHelperConfig = {
+  id: 'id',
+  children: 'children',
+  pid: 'pid',
+}
+
+// 获取配置。  Object.assign 从一个或多个源对象复制到目标对象
+const getConfig = (config: TreeHelperConfigParams) => Object.assign({}, DEFAULT_CONFIG, config)
+
+/**
+ * @description 对称格式化树
+ * @param {T[]} tree
+ * @param {R[]} referTree
+ * @param {(n: T, r?: R) => Undefinable<T>} formatFunc
+ * @param {Partial<DefaultConfig>} config
+ * @return {T[]}
+ */
+export function treeFormatBySymmetry<T = Recordable, R = Recordable>(
+  tree: T[],
+  referTree: R[],
+  formatFunc: (n: T, r?: R) => T | undefined = n => n,
+  config: {
+    treeConfig?: TreeHelperConfigParams
+    referConfig?: TreeHelperConfigParams
+  } = {},
+): T[] {
+  const {
+    treeConfig: customTreeConfig = {},
+    referConfig: customReferConfig = {},
+  } = config
+
+  const treeConfig = getConfig(customTreeConfig)
+  const treeChildren = treeConfig.children
+
+  const referConfig = getConfig(customReferConfig)
+  const referConfigChildren = referConfig.children
+
+  function treeFormat(tree: T[], referTree?: R[]) {
+    const outputTree: T[] = []
+    for (let i = 0; i < tree.length; i++) {
+      const node: T = tree[i]
+      let formatedNode: T | undefined
+      let referNode: R | undefined
+
+      if (isArray(referTree) && referTree.length > 0) {
+        for (let k = 0; k < referTree.length; k++) {
+          const refer = referTree[k]
+          formatedNode = formatFunc(node, refer)
+          referNode = refer
+          if (formatedNode)
+            break
+        }
+      }
+      else {
+        formatedNode = formatFunc(node)
+      }
+
+      if (!isUndefined(formatedNode)) {
+        if (isArray((node as Recordable)?.[treeChildren])) {
+          (formatedNode as Recordable)[treeChildren] = treeFormat(
+            (node as Recordable)[treeChildren],
+            (referNode as Recordable)?.[referConfigChildren],
+          )
+        }
+
+        outputTree.push(formatedNode)
+      }
+    }
+
+    return outputTree
+  }
+
+  return treeFormat(tree, referTree)
+}

+ 5 - 0
src/utils/util.ts

@@ -0,0 +1,5 @@
+export function toHump(name: string) {
+  return name.replace(/_(\w)/g, function(_, letter){
+      return letter.toUpperCase();
+  });
+}

+ 0 - 324
types/cache/mock/login.mock.cache.js

@@ -1,324 +0,0 @@
-module.exports = {
-  'GET /api/currentUser': {
-    data: {
-      name: 'Serati Ma',
-      avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png',
-      userid: '00000001',
-      email: 'antdesign@alipay.com',
-      signature: '海纳百川,有容乃大',
-      title: '交互专家',
-      group: '蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED',
-      tags: [
-        { key: '0', label: '很有想法的' },
-        { key: '1', label: '专注设计' },
-        { key: '2', label: '辣~' },
-        { key: '3', label: '大长腿' },
-        { key: '4', label: '川妹子' },
-        { key: '5', label: '海纳百川' },
-      ],
-      notifyCount: 12,
-      unreadCount: 11,
-      country: 'China',
-      geographic: {
-        province: { label: '浙江省', key: '330000' },
-        city: { label: '杭州市', key: '330100' },
-      },
-      address: '西湖区工专路 77 号',
-      phone: '0752-268888888',
-    },
-  },
-  'GET /api/rule': {
-    data: [
-      {
-        key: 99,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 99',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 503,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 81,
-      },
-      {
-        key: 98,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 98',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 164,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 12,
-      },
-      {
-        key: 97,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 97',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 174,
-        status: '1',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 81,
-      },
-      {
-        key: 96,
-        disabled: true,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 96',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 914,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 7,
-      },
-      {
-        key: 95,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 95',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 698,
-        status: '2',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 82,
-      },
-      {
-        key: 94,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 94',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 488,
-        status: '1',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 14,
-      },
-      {
-        key: 93,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 93',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 580,
-        status: '2',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 77,
-      },
-      {
-        key: 92,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 92',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 244,
-        status: '3',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 58,
-      },
-      {
-        key: 91,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 91',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 959,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 66,
-      },
-      {
-        key: 90,
-        disabled: true,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 90',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 958,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 72,
-      },
-      {
-        key: 89,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 89',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 301,
-        status: '2',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 2,
-      },
-      {
-        key: 88,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 88',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 277,
-        status: '1',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 12,
-      },
-      {
-        key: 87,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 87',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 810,
-        status: '1',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 82,
-      },
-      {
-        key: 86,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 86',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 780,
-        status: '3',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 22,
-      },
-      {
-        key: 85,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 85',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 705,
-        status: '3',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 12,
-      },
-      {
-        key: 84,
-        disabled: true,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 84',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 203,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 79,
-      },
-      {
-        key: 83,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 83',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 491,
-        status: '2',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 59,
-      },
-      {
-        key: 82,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 82',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 73,
-        status: '0',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 100,
-      },
-      {
-        key: 81,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
-        name: 'TradeCode 81',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 406,
-        status: '3',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 61,
-      },
-      {
-        key: 80,
-        disabled: false,
-        href: 'https://ant.design',
-        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
-        name: 'TradeCode 80',
-        owner: '曲丽丽',
-        desc: '这是一段描述',
-        callNo: 112,
-        status: '2',
-        updatedAt: '2022-12-06T05:00:57.040Z',
-        createdAt: '2022-12-06T05:00:57.040Z',
-        progress: 20,
-      },
-    ],
-    total: 100,
-    success: true,
-    pageSize: 20,
-    current: 1,
-  },
-  'POST /api/login/outLogin': { data: {}, success: true },
-  'POST /api/login/account': {
-    status: 'ok',
-    type: 'account',
-    currentAuthority: 'admin',
-  },
-};

+ 0 - 0
types/cache/mock/mock.cache.js


+ 6 - 0
types/index.d.ts

@@ -118,3 +118,9 @@ export namespace API {
     currentAuthority: string;
   };
 }
+
+declare global {
+  type Recordable<T = any> = Record<string, T>
+  type ObjectEnum<T = string | number, K = string | number> = Record<K, T>
+  type NonNullableRecord<T> = { [P in keyof T]-?: NonNullableRecord<NonNullable<T[P]>> };
+}