Prechádzať zdrojové kódy

feat 修改搜索框

Young 4 mesiacov pred
rodič
commit
88af09947d
1 zmenil súbory, kde vykonal 76 pridanie a 34 odobranie
  1. 76 34
      src/pages/User/Users.tsx

+ 76 - 34
src/pages/User/Users.tsx

@@ -1,9 +1,9 @@
 import {ActionType, PageContainer, ProForm, ProFormSelect, ProFormText, ProTable,} from '@ant-design/pro-components';
-import {Button, Card, Modal} from 'antd';
+import {Button, Card, Modal, Dropdown, Input, Space, Tag} from 'antd';
 import React, {useRef} from 'react';
 import {AddOutline} from 'antd-mobile-icons';
 import {EditBundle, useEdit} from '@/core/hooks/useEdit';
-import { deleteUserRemoveApi, getUserDetailsApi, postUserPageApi, postUserSaveApi } from '@/services/swagger/userAdmin';
+import {deleteUserRemoveApi, getUserDetailsApi, postUserPageApi, postUserSaveApi} from '@/services/swagger/userAdmin';
 import {getPeakListApi} from "@/services/swagger/peakAdmin";
 import {getUserLevelListApi} from "@/services/swagger/userLevelAdmin";
 import {getFactionLevelListApi} from "@/services/swagger/factionLevelAdmin";
@@ -59,16 +59,18 @@ const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) =
           return Promise.resolve({});
         }}
       >
-        <ProFormText name="name" label={'用户名称'} rules={[{required: true, message: '请输入用户名称',}]} placeholder={'请输入用户名'}></ProFormText>
-        <ProFormText name="mobile" label={'手机号'} rules={[{required: true, message: '请输入手机号',}]} placeholder={'请输入手机号'}></ProFormText>
-        <ProFormText name="nickname" label={'昵称'} rules={[{required: true, message: '请输入昵称',}]} placeholder={'请输入昵称'}></ProFormText>
-        <ProFormText name="purpleCoin" label={'紫币'} rules={[{required: true, message: '请输入紫币',}]} placeholder={'请输入紫币'}></ProFormText>
-        <ProFormText name="purpleSpar" label={'紫晶'} rules={[{required: true, message: '请输入紫晶',}]} placeholder={'请输入紫晶'}></ProFormText>
+        <ProFormText name="name" label={'用户名称'} rules={[{required: true, message: '请输入用户名称',}]}
+                     placeholder={'请输入用户名'}></ProFormText>
+        <ProFormText name="mobile" label={'手机号'} rules={[{required: true, message: '请输入手机号',}]}
+                     placeholder={'请输入手机号'}></ProFormText>
+        <ProFormText name="nickname" label={'昵称'} rules={[{required: true, message: '请输入昵称',}]}
+                     placeholder={'请输入昵称'}></ProFormText>
+        <ProFormText name="purpleCoin" label={'紫币'} rules={[{required: true, message: '请输入紫币',}]}
+                     placeholder={'请输入紫币'}></ProFormText>
+        <ProFormText name="purpleSpar" label={'紫晶'} rules={[{required: true, message: '请输入紫晶',}]}
+                     placeholder={'请输入紫晶'}></ProFormText>
 
         <ProFormSelect
-          fieldProps={{
-            'mode': 'multiple',
-          }}
           name="peakId"
           label="所属峰"
           request={async () => {
@@ -83,9 +85,6 @@ const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) =
           rules={[{required: true, message: '请选择所属峰'}]}
         />
         <ProFormSelect
-          fieldProps={{
-            'mode': 'multiple',
-          }}
           name="userLevel"
           label="会员等级"
           request={async () => {
@@ -100,9 +99,6 @@ const Edit: React.FC<{ bundle: EditBundle; onSuccess?: () => void }> = (props) =
           rules={[{required: true, message: '请选择会员等级'}]}
         />
         <ProFormSelect
-          fieldProps={{
-            'mode': 'multiple',
-          }}
           name="factionLevel"
           label="宗门等级"
           request={async () => {
@@ -143,7 +139,6 @@ const Staff: React.FC = () => {
   const ref = useRef<ActionType>();
 
 
-
   return (
     <PageContainer content={''}>
       {bundle.open && <Edit bundle={bundle} onSuccess={() => ref.current?.reload()}></Edit>}
@@ -155,12 +150,12 @@ const Staff: React.FC = () => {
             console.log(params, ...rest)
 
             const res = await postUserPageApi(
-
               {
                 current: params.current || 1,
                 size: params.pageSize || 10,
+                ...params
               }
-              );
+            );
 
             return {
               success: res.success,
@@ -170,24 +165,20 @@ const Staff: React.FC = () => {
           }}
           columns={[
             {
-              title: 'ID',
-              dataIndex: 'id',
+              title: '手机号码',
+              dataIndex: 'mobile',
             },
             {
-              title: '所属峰',
-              dataIndex: 'peakName',
+              title: '昵称',
+              dataIndex: 'nickname',
             },
             {
-              title: '名',
+              title: '名',
               dataIndex: 'name',
             },
             {
-              title: '手机号码',
-              dataIndex: 'mobile',
-            },
-            {
-              title: '昵称',
-              dataIndex: 'nickname',
+              title: '所属峰',
+              dataIndex: 'peakName',
             },
             {
               title: '会员等级',
@@ -198,21 +189,73 @@ const Staff: React.FC = () => {
               dataIndex: 'factionLevelName',
             },
             {
+              title: '创建时间',
+              dataIndex: 'createTime',
+              search: false
+            },
+            {
               title: '紫币',
               dataIndex: 'purpleCoin',
+              search: false
             },
             {
               title: '紫晶',
               dataIndex: 'purpleSpar',
+              search: false
             },
             {
               title: '状态',
               dataIndex: 'status',
-              render: (text, _) => {
-                return text === 1 ? "启用" : "禁用"
+              valueType: 'select',
+              valueEnum: {
+                1: '启用',
+                0: '禁用'
+              }
+            },
+            {
+              title: '创建时间',
+              dataIndex: 'createTime',
+              valueType: 'dateTimeRange',
+              hideInTable: true,
+              search: {
+                transform: (value) => {
+                  return {
+                    startTime: value[0],
+                    endTime: value[1],
+                  };
+                },
+              }
+            },
+            {
+              title: '紫币',
+              dataIndex: 'purpleCoin',
+              hideInTable: true,
+              valueType: 'digitRange',
+              search: {
+                transform: (value) => {
+                  return {
+                    purpleCoinMin: value[0],
+                    purpleCoinMax: value[1],
+                  };
+                },
               }
             },
             {
+              title: '紫晶',
+              dataIndex: 'purpleSpar',
+              hideInTable: true,
+              valueType: 'digitRange',
+              search: {
+                transform: (value) => {
+                  return {
+                    purpleSparMin: value[0],
+                    purpleSparMax: value[1],
+                  };
+                },
+              }
+            },
+
+            {
               title: '操作',
               valueType: 'option',
               render: (_, record) => [
@@ -222,7 +265,7 @@ const Staff: React.FC = () => {
                 <a
                   key={'delete'}
                   onClick={async () => {
-                    if(record.id) {
+                    if (record.id) {
                       await deleteUserRemoveApi({id: record.id})
                       ref.current?.reload();
                     }
@@ -251,7 +294,6 @@ const Staff: React.FC = () => {
             ],
             settings: [],
           }}
-
         ></ProTable>
       </Card>
     </PageContainer>