Bladeren bron

feta 增加宗门登记

Young 4 maanden geleden
bovenliggende
commit
2d0f14eca8

+ 5 - 0
config/routes.ts

@@ -54,6 +54,11 @@ export default [
         name: 'peaks',
         component: './Peak/Peak',
       },
+      {
+        path: '/peak/peakLevel',
+        name: 'peakLevel',
+        component: './Peak/PeakLevel',
+      },
     ],
   },
   {

+ 2 - 2
src/locales/zh-CN/menu.ts

@@ -4,6 +4,7 @@ export default {
   'menu.home': '首页',
   'menu.content': '内容管理',
   'menu.content.headlines': '头条管理',
+
   'menu.settings': '系统设置',
   'menu.settings.users': '用户管理',
   'menu.settings.settings': '字典设置',
@@ -11,10 +12,9 @@ export default {
   'menu.settings.role': '角色管理',
   'menu.settings.menu': '菜单管理',
 
-
-
   'menu.peak': '峰管理',
   'menu.peak.peaks': '峰管理',
+  'menu.peak.peakLevel': '峰等级管理',
 
   'menu.user': '用户管理',
   'menu.user.users': '用户管理',

+ 1 - 1
src/pages/Peak/Peak.tsx

@@ -34,7 +34,7 @@ const Peak: React.FC = () => {
             },
             {
               title: '人数',
-              dataIndex: 'mobile',
+              dataIndex: 'userCnt',
             },
             {
               title: '经验值',

+ 179 - 0
src/pages/Peak/PeakLevel.tsx

@@ -0,0 +1,179 @@
+import {
+  ActionType,
+  PageContainer,
+  ProForm,
+  ProFormText,
+  ProFormTreeSelect,
+  ProTable,
+} 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 { deletePeakLevelRemoveApi, getPeakLevelDetailsApi, postPeakLevelSaveApi, getPeakLevelListTreeApi } from '@/services/swagger/peakLevelAdmin';
+
+const Edit: React.FC<{ bundle: EditBundle;  onSuccess?: () => void }> = (props) => {
+  let {bundle} = props;
+
+  const [form] = ProForm.useForm<SectApi.PeakLevelSaveQuery>();
+  const [loading, setLoading] = React.useState(false);
+  return (
+    <Modal
+      confirmLoading={loading}
+      title={bundle.id ? '编辑峰等级' : '添加峰等级'}
+      open={bundle.open}
+      onOk={async () => {
+        await form.validateFields();
+
+        try {
+          setLoading(true);
+
+          await postPeakLevelSaveApi({
+            id: bundle.id,
+            ...form.getFieldsValue(),
+          });
+        } finally {
+          setLoading(false);
+        }
+
+        props.onSuccess?.();
+        bundle.close();
+      }}
+      onClose={() => {
+        form.resetFields();
+        bundle.close();
+      }}
+      onCancel={() => {
+        form.resetFields();
+        bundle.close();
+      }}
+    >
+      <ProForm
+        className={'mt-5'}
+        form={form}
+        labelCol={{span: 4}}
+        layout={'horizontal'}
+        submitter={false}
+        request={async () => {
+          if (bundle.id !== undefined) {
+            console.log(bundle.id, 'bundle');
+            const res = await getPeakLevelDetailsApi({id: bundle.id});
+
+            return res.data;
+          }
+
+          return Promise.resolve({});
+        }}
+
+        initialValues={{
+          type: 1 ,
+          status: 2,
+          target: 1,
+          hasRefresh: 0
+        } }
+
+      >
+
+        <ProFormTreeSelect
+          label='父等级' name='parentId'
+          style={{width: '100%'}}
+          placeholder="请选择父等级ID"
+          allowClear
+          request={async () => {
+            const transformToTreeData = (data: SectApi.PeakLevelVO[]): any[] =>
+              data.map((item) => ({
+                title: item.name,
+                value: item.id,
+                key: item.id,
+                children: item.children ? transformToTreeData(item.children) : [],
+              }));
+            const res = await getPeakLevelListTreeApi()
+              return transformToTreeData(res.data);
+          }}
+        >
+        </ProFormTreeSelect>
+
+        <ProFormText name='name' label={'名称'} placeholder={'请输入名称'}></ProFormText>
+        <ProFormText name='level' label={'等级'} placeholder={'请输入等级'}></ProFormText>
+        <ProFormText name='exp' label={'经验值'} placeholder={'请输入经验值'}></ProFormText>
+      </ProForm>
+    </Modal>
+  );
+};
+
+
+const MenuExp: React.FC = () => {
+  const bundle = useEdit();
+  const ref = useRef<ActionType>();
+
+  return (
+    <>
+      <PageContainer content={''}>
+        {bundle.open && <Edit bundle={bundle} onSuccess={() => ref.current?.reload()}></Edit>}
+        <Card>
+          <ProTable<SectApi.PeakLevelVO>
+            rowKey={'id'}
+            request={async () => {
+              const res = await getPeakLevelListTreeApi()
+              return {
+                success: res.success,
+                data: res.data,
+              };
+            }}
+
+            columns={[
+              {
+                title: '等级',
+                dataIndex: 'level',
+              },
+              {
+                title: '名称',
+                dataIndex: 'name',
+              },
+              {
+                title: '经验值',
+                dataIndex: 'exp',
+              },
+              {
+                title: '操作',
+                valueType: 'option',
+                render: (_, record) => [
+                  <a key={'edit'} onClick={() => bundle.update(record.id as number)}>
+                    编辑
+                  </a>,
+                  <a
+                    key={'delete'}
+                    onClick={async () => {
+                      if(record.id) {
+                        await deletePeakLevelRemoveApi({id:record.id});
+                        ref.current?.reload();
+                      }
+                    }}
+                  >
+                    删除
+                  </a>,
+                ],
+              },
+            ]}
+
+
+
+            pagination={false}
+            actionRef={ref}
+            toolbar={{
+              actions: [
+                <Button icon={<AddOutline/>} key={'add'} type={'primary'} onClick={bundle.create}>
+                  添加
+                </Button>,
+              ],
+              settings: [],
+            }}
+            search={false}
+          ></ProTable>
+        </Card>
+      </PageContainer>
+    </>
+  );
+};
+
+export default MenuExp;

+ 0 - 4
src/services/swagger/index.ts

@@ -5,7 +5,6 @@
 import * as userConfigClients from './userConfigClients';
 import * as userLevelClients from './userLevelClients';
 import * as userClients from './userClients';
-import * as peakStageClients from './peakStageClients';
 import * as peakLevelClients from './peakLevelClients';
 import * as peakClients from './peakClients';
 import * as factionLevelClients from './factionLevelClients';
@@ -14,7 +13,6 @@ import * as userLevelAdmin from './userLevelAdmin';
 import * as userAdmin from './userAdmin';
 import * as staffAdmin from './staffAdmin';
 import * as roleAdmin from './roleAdmin';
-import * as peakStageAdmin from './peakStageAdmin';
 import * as peakLevelAdmin from './peakLevelAdmin';
 import * as peakAdmin from './peakAdmin';
 import * as menuAdmin from './menuAdmin';
@@ -25,7 +23,6 @@ export default {
   userConfigClients,
   userLevelClients,
   userClients,
-  peakStageClients,
   peakLevelClients,
   peakClients,
   factionLevelClients,
@@ -34,7 +31,6 @@ export default {
   userAdmin,
   staffAdmin,
   roleAdmin,
-  peakStageAdmin,
   peakLevelAdmin,
   peakAdmin,
   menuAdmin,

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

@@ -17,9 +17,9 @@ export async function getPeakLevelDetailsApi(
   });
 }
 
-/** /峰等级列表 GET /apis/admin/peakLevel/list */
-export async function getPeakLevelListApi(options?: { [key: string]: any }) {
-  return request<SectApi.PeakLevelVO[]>('/apis/admin/peakLevel/list', {
+/** /峰等级树 GET /apis/admin/peakLevel/listTree */
+export async function getPeakLevelListTreeApi(options?: { [key: string]: any }) {
+  return request<SectApi.PeakLevelVO[]>('/apis/admin/peakLevel/listTree', {
     method: 'GET',
     ...(options || {}),
   });

+ 0 - 71
src/services/swagger/peakStageAdmin.ts

@@ -1,71 +0,0 @@
-// @ts-ignore
-/* eslint-disable */
-import { invoke as request } from '@/core/network';
-
-/** 峰等级阶段详情 GET /apis/admin/peakStage/details */
-export async function getPeakStageDetailsApi(
-  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
-  params: SectApi.getPeakStageDetailsApiParams,
-  options?: { [key: string]: any },
-) {
-  return request<SectApi.PeakStageVO>('/apis/admin/peakStage/details', {
-    method: 'GET',
-    params: {
-      ...params,
-    },
-    ...(options || {}),
-  });
-}
-
-/** /峰等级阶段列表 GET /apis/admin/peakStage/list */
-export async function getPeakStageListApi(options?: { [key: string]: any }) {
-  return request<SectApi.PeakStageVO[]>('/apis/admin/peakStage/list', {
-    method: 'GET',
-    ...(options || {}),
-  });
-}
-
-/** 分页查询峰等级阶段 POST /apis/admin/peakStage/page */
-export async function postPeakStagePageApi(
-  body: SectApi.PeakStagePageQuery,
-  options?: { [key: string]: any },
-) {
-  return request<SectApi.IPagePeakStageVO>('/apis/admin/peakStage/page', {
-    method: 'POST',
-    headers: {
-      'Content-Type': 'application/json',
-    },
-    data: body,
-    ...(options || {}),
-  });
-}
-
-/** 删除峰等级阶段 DELETE /apis/admin/peakStage/remove */
-export async function deletePeakStageRemoveApi(
-  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
-  params: SectApi.deletePeakStageRemoveApiParams,
-  options?: { [key: string]: any },
-) {
-  return request<boolean>('/apis/admin/peakStage/remove', {
-    method: 'DELETE',
-    params: {
-      ...params,
-    },
-    ...(options || {}),
-  });
-}
-
-/** 保存峰等级阶段 POST /apis/admin/peakStage/save */
-export async function postPeakStageSaveApi(
-  body: SectApi.PeakStageSaveQuery,
-  options?: { [key: string]: any },
-) {
-  return request<boolean>('/apis/admin/peakStage/save', {
-    method: 'POST',
-    headers: {
-      'Content-Type': 'application/json',
-    },
-    data: body,
-    ...(options || {}),
-  });
-}

+ 0 - 33
src/services/swagger/peakStageClients.ts

@@ -1,33 +0,0 @@
-// @ts-ignore
-/* eslint-disable */
-import { invoke as request } from '@/core/network';
-
-/** 峰等级阶段详情 GET /apis/clients/peakStage/details */
-export async function getPeakStageDetailsApi(
-  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
-  params: SectApi.getPeakStageDetailsApiParams,
-  options?: { [key: string]: any },
-) {
-  return request<SectApi.PeakStageVO>('/apis/clients/peakStage/details', {
-    method: 'GET',
-    params: {
-      ...params,
-    },
-    ...(options || {}),
-  });
-}
-
-/** 分页查询峰等级阶段 POST /apis/clients/peakStage/page */
-export async function postPeakStagePageApi(
-  body: SectApi.PeakStagePageQuery,
-  options?: { [key: string]: any },
-) {
-  return request<SectApi.IPagePeakStageVO>('/apis/clients/peakStage/page', {
-    method: 'POST',
-    headers: {
-      'Content-Type': 'application/json',
-    },
-    data: body,
-    ...(options || {}),
-  });
-}

+ 19 - 72
src/services/swagger/typings.d.ts

@@ -65,10 +65,6 @@ declare namespace SectApi {
     id: number;
   };
 
-  type deletePeakStageRemoveApiParams = {
-    id: number;
-  };
-
   type deleteRoleRemoveApiParams = {
     id: number;
   };
@@ -154,14 +150,6 @@ declare namespace SectApi {
     id: number;
   };
 
-  type getPeakStageDetailsApiParams = {
-    id: number;
-  };
-
-  type getPeakStageDetailsApiParams = {
-    id: number;
-  };
-
   type getRoleDetailsApiParams = {
     id: number;
   };
@@ -194,72 +182,64 @@ declare namespace SectApi {
     size?: number;
     records?: ConfigVO[];
     current?: number;
-    pages?: number;
     total?: number;
+    pages?: number;
   };
 
   type IPageFactionLevelVO = {
     size?: number;
     records?: FactionLevelVO[];
     current?: number;
-    pages?: number;
     total?: number;
+    pages?: number;
   };
 
   type IPagePeakLevelVO = {
     size?: number;
     records?: PeakLevelVO[];
     current?: number;
-    pages?: number;
     total?: number;
-  };
-
-  type IPagePeakStageVO = {
-    size?: number;
-    records?: PeakStageVO[];
-    current?: number;
     pages?: number;
-    total?: number;
   };
 
   type IPagePeakVO = {
     size?: number;
     records?: PeakVO[];
     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 IPageUserLevelVO = {
     size?: number;
     records?: UserLevelVO[];
     current?: number;
-    pages?: number;
     total?: number;
+    pages?: number;
   };
 
   type IPageUserVO = {
     size?: number;
     records?: UserVO[];
     current?: number;
-    pages?: number;
     total?: number;
+    pages?: number;
   };
 
   type MenuSaveQuery = {
@@ -351,10 +331,16 @@ declare namespace SectApi {
   type PeakLevelSaveQuery = {
     /** 自增 ID */
     id?: number;
+    /** 父节点 */
+    parentId?: number;
     /** 名称 */
     name?: string;
     /** 等级 */
     level?: number;
+    /** 经验值 */
+    exp?: number;
+    /** 子节点 */
+    children?: PeakLevelVO[];
   };
 
   type PeakLevelVO = {
@@ -364,10 +350,16 @@ declare namespace SectApi {
     updateTime?: string;
     /** 自增 ID */
     id?: number;
+    /** 父节点 */
+    parentId?: number;
     /** 名称 */
     name?: string;
     /** 等级 */
     level?: number;
+    /** 经验值 */
+    exp?: number;
+    /** 子节点 */
+    children?: PeakLevelVO[];
   };
 
   type PeakPageQuery = {
@@ -390,51 +382,6 @@ declare namespace SectApi {
     name?: string;
   };
 
-  type PeakStagePageQuery = {
-    cursor?: string;
-    direction?: string;
-    current?: number;
-    size?: number;
-    sorted?: string;
-    sortColumn?: string;
-    /** 名称 */
-    name?: string;
-    /** 等级 */
-    level?: number;
-    /** 经验值-最小 */
-    expMin?: number;
-    /** 经验值-最大 */
-    expMax?: number;
-    asc?: boolean;
-    desc?: boolean;
-  };
-
-  type PeakStageSaveQuery = {
-    /** 自增 ID */
-    id?: number;
-    /** 名称 */
-    name?: string;
-    /** 等级 */
-    level?: number;
-    /** 经验值 */
-    exp?: number;
-  };
-
-  type PeakStageVO = {
-    /** 创建时间 */
-    createTime?: string;
-    /** 更新时间 */
-    updateTime?: string;
-    /** 自增 ID */
-    id?: number;
-    /** 名称 */
-    name?: string;
-    /** 等级 */
-    level?: number;
-    /** 经验值 */
-    exp?: number;
-  };
-
   type PeakVO = {
     /** 创建时间 */
     createTime?: string;