Blame view

src/pages/User/index.tsx 1.29 KB
calmound authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { useModel } from '@umijs/max';
import { Table } from 'antd';
import { useEffect } from 'react';

export default function Page() {
  const { list, getList } = useModel('user');
  useEffect(() => {
    getList();
  }, []);

  const columns = [
    {
      title: '名称',
      dataIndex: 'Nickname',
      tip: '名称是唯一的 key',
      formItemProps: {
        rules: [
          {
            required: true,
            message: '名称为必填项',
          },
        ],
      },
    },
    {
      title: '昵称',
      dataIndex: 'nickName',
      valueType: 'text',
    },
    {
      title: '性别',
      dataIndex: 'gender',
      hideInForm: true,
      valueEnum: {
        0: { text: '男', status: 'MALE' },
        1: { text: '女', status: 'FEMALE' },
      },
    },
    {
      title: '操作',
      dataIndex: 'option',
      valueType: 'option',
calmound authored
43
      render: () => (
calmound authored
44
        <>
calmound authored
45
          <a className="mt-16">配置</a>
calmound authored
46
47
48
49
50
51
52
          <a href="">订阅警报</a>
        </>
      ),
    },
  ];
  return (
    <div style={{ height: '100vh' }}>
calmound authored
53
      <div className="text-body-4">我是</div>
calmound authored
54
55
56
57
58
59
60
61
62
63
64
      <Table
        rowKey="id"
        columns={columns}
        // request={() => {
        //   return { data: list };
        // }}
        dataSource={list}
      />
    </div>
  );
}