Yansen 2 vuotta sitten
vanhempi
commit
3551b08fb1

+ 0
- 352
src/pages/sample/form/index.jsx Näytä tiedosto

@@ -1,352 +0,0 @@
1
-import {
2
-  AutoComplete,
3
-  Button,
4
-  Cascader,
5
-  Checkbox,
6
-  Col,
7
-  Form,
8
-  Input,
9
-  InputNumber,
10
-  Row,
11
-  Select,
12
-  Card,
13
-} from 'antd';
14
-import React, { useState } from 'react';
15
-
16
-const { Option } = Select;
17
-const residences = [
18
-  {
19
-    value: 'zhejiang',
20
-    label: 'Zhejiang',
21
-    children: [
22
-      {
23
-        value: 'hangzhou',
24
-        label: 'Hangzhou',
25
-        children: [
26
-          {
27
-            value: 'xihu',
28
-            label: 'West Lake',
29
-          },
30
-        ],
31
-      },
32
-    ],
33
-  },
34
-  {
35
-    value: 'jiangsu',
36
-    label: 'Jiangsu',
37
-    children: [
38
-      {
39
-        value: 'nanjing',
40
-        label: 'Nanjing',
41
-        children: [
42
-          {
43
-            value: 'zhonghuamen',
44
-            label: 'Zhong Hua Men',
45
-          },
46
-        ],
47
-      },
48
-    ],
49
-  },
50
-];
51
-const formItemLayout = {
52
-  labelCol: {
53
-    xs: {
54
-      span: 24,
55
-    },
56
-    sm: {
57
-      span: 8,
58
-    },
59
-  },
60
-  wrapperCol: {
61
-    xs: {
62
-      span: 24,
63
-    },
64
-    sm: {
65
-      span: 16,
66
-    },
67
-  },
68
-};
69
-const tailFormItemLayout = {
70
-  wrapperCol: {
71
-    xs: {
72
-      span: 24,
73
-      offset: 0,
74
-    },
75
-    sm: {
76
-      span: 16,
77
-      offset: 8,
78
-    },
79
-  },
80
-};
81
-
82
-
83
-const BasicForm = () => {
84
-  const [form] = Form.useForm();
85
-
86
-  const onFinish = (values) => {
87
-    console.log('Received values of form: ', values);
88
-  };
89
-
90
-  const prefixSelector = (
91
-    <Form.Item name="prefix" noStyle>
92
-      <Select
93
-        style={{
94
-          width: 70,
95
-        }}
96
-      >
97
-        <Option value="86">+86</Option>
98
-        <Option value="87">+87</Option>
99
-      </Select>
100
-    </Form.Item>
101
-  );
102
-  const suffixSelector = (
103
-    <Form.Item name="suffix" noStyle>
104
-      <Select
105
-        style={{
106
-          width: 70,
107
-        }}
108
-      >
109
-        <Option value="USD">$</Option>
110
-        <Option value="CNY">¥</Option>
111
-      </Select>
112
-    </Form.Item>
113
-  );
114
-  const [autoCompleteResult, setAutoCompleteResult] = useState([]);
115
-
116
-  const onWebsiteChange = (value) => {
117
-    if (!value) {
118
-      setAutoCompleteResult([]);
119
-    } else {
120
-      setAutoCompleteResult(['.com', '.org', '.net'].map((domain) => `${value}${domain}`));
121
-    }
122
-  };
123
-
124
-  const websiteOptions = autoCompleteResult.map((website) => ({
125
-    label: website,
126
-    value: website,
127
-  }));
128
-  return (
129
-    <Form
130
-      {...formItemLayout}
131
-      form={form}
132
-      name="register"
133
-      onFinish={onFinish}
134
-      initialValues={{
135
-        residence: ['zhejiang', 'hangzhou', 'xihu'],
136
-        prefix: '86',
137
-      }}
138
-      scrollToFirstError
139
-      style={{ background: '#fff', boxSizing: 'border-box', padding: '24px' }}
140
-    >
141
-      <Form.Item
142
-        name="email"
143
-        label="E-mail"
144
-        rules={[
145
-          {
146
-            type: 'email',
147
-            message: 'The input is not valid E-mail!',
148
-          },
149
-          {
150
-            required: true,
151
-            message: 'Please input your E-mail!',
152
-          },
153
-        ]}
154
-      >
155
-        <Input />
156
-      </Form.Item>
157
-
158
-      <Form.Item
159
-        name="password"
160
-        label="Password"
161
-        rules={[
162
-          {
163
-            required: true,
164
-            message: 'Please input your password!',
165
-          },
166
-        ]}
167
-        hasFeedback
168
-      >
169
-        <Input.Password />
170
-      </Form.Item>
171
-
172
-      <Form.Item
173
-        name="confirm"
174
-        label="Confirm Password"
175
-        dependencies={['password']}
176
-        hasFeedback
177
-        rules={[
178
-          {
179
-            required: true,
180
-            message: 'Please confirm your password!',
181
-          },
182
-          ({ getFieldValue }) => ({
183
-            validator(_, value) {
184
-              if (!value || getFieldValue('password') === value) {
185
-                return Promise.resolve();
186
-              }
187
-
188
-              return Promise.reject(new Error('The two passwords that you entered do not match!'));
189
-            },
190
-          }),
191
-        ]}
192
-      >
193
-        <Input.Password />
194
-      </Form.Item>
195
-
196
-      <Form.Item
197
-        name="nickname"
198
-        label="Nickname"
199
-        tooltip="What do you want others to call you?"
200
-        rules={[
201
-          {
202
-            required: true,
203
-            message: 'Please input your nickname!',
204
-            whitespace: true,
205
-          },
206
-        ]}
207
-      >
208
-        <Input />
209
-      </Form.Item>
210
-
211
-      <Form.Item
212
-        name="residence"
213
-        label="Habitual Residence"
214
-        rules={[
215
-          {
216
-            type: 'array',
217
-            required: true,
218
-            message: 'Please select your habitual residence!',
219
-          },
220
-        ]}
221
-      >
222
-        <Cascader options={residences} />
223
-      </Form.Item>
224
-
225
-      <Form.Item
226
-        name="phone"
227
-        label="Phone Number"
228
-        rules={[
229
-          {
230
-            required: true,
231
-            message: 'Please input your phone number!',
232
-          },
233
-        ]}
234
-      >
235
-        <Input
236
-          addonBefore={prefixSelector}
237
-          style={{
238
-            width: '100%',
239
-          }}
240
-        />
241
-      </Form.Item>
242
-
243
-      <Form.Item
244
-        name="donation"
245
-        label="Donation"
246
-        rules={[
247
-          {
248
-            required: true,
249
-            message: 'Please input donation amount!',
250
-          },
251
-        ]}
252
-      >
253
-        <InputNumber
254
-          addonAfter={suffixSelector}
255
-          style={{
256
-            width: '100%',
257
-          }}
258
-        />
259
-      </Form.Item>
260
-
261
-      <Form.Item
262
-        name="website"
263
-        label="Website"
264
-        rules={[
265
-          {
266
-            required: true,
267
-            message: 'Please input website!',
268
-          },
269
-        ]}
270
-      >
271
-        <AutoComplete options={websiteOptions} onChange={onWebsiteChange} placeholder="website">
272
-          <Input />
273
-        </AutoComplete>
274
-      </Form.Item>
275
-
276
-      <Form.Item
277
-        name="intro"
278
-        label="Intro"
279
-        rules={[
280
-          {
281
-            required: true,
282
-            message: 'Please input Intro',
283
-          },
284
-        ]}
285
-      >
286
-        <Input.TextArea showCount maxLength={100} />
287
-      </Form.Item>
288
-
289
-      <Form.Item
290
-        name="gender"
291
-        label="Gender"
292
-        rules={[
293
-          {
294
-            required: true,
295
-            message: 'Please select gender!',
296
-          },
297
-        ]}
298
-      >
299
-        <Select placeholder="select your gender">
300
-          <Option value="male">Male</Option>
301
-          <Option value="female">Female</Option>
302
-          <Option value="other">Other</Option>
303
-        </Select>
304
-      </Form.Item>
305
-
306
-      <Form.Item label="Captcha" extra="We must make sure that your are a human.">
307
-        <Row gutter={8}>
308
-          <Col span={12}>
309
-            <Form.Item
310
-              name="captcha"
311
-              noStyle
312
-              rules={[
313
-                {
314
-                  required: true,
315
-                  message: 'Please input the captcha you got!',
316
-                },
317
-              ]}
318
-            >
319
-              <Input />
320
-            </Form.Item>
321
-          </Col>
322
-          <Col span={12}>
323
-            <Button>Get captcha</Button>
324
-          </Col>
325
-        </Row>
326
-      </Form.Item>
327
-
328
-      <Form.Item
329
-        name="agreement"
330
-        valuePropName="checked"
331
-        rules={[
332
-          {
333
-            validator: (_, value) =>
334
-              value ? Promise.resolve() : Promise.reject(new Error('Should accept agreement')),
335
-          },
336
-        ]}
337
-        {...tailFormItemLayout}
338
-      >
339
-        <Checkbox>
340
-          I have read the <a href="">agreement</a>
341
-        </Checkbox>
342
-      </Form.Item>
343
-      <Form.Item {...tailFormItemLayout}>
344
-        <Button type="primary" htmlType="submit">
345
-          Register
346
-        </Button>
347
-      </Form.Item>
348
-    </Form>
349
-  );
350
-};
351
-
352
-export default () => <Card><BasicForm /></Card>;

+ 0
- 191
src/pages/sample/home/components/AreaChart.jsx Näytä tiedosto

@@ -1,191 +0,0 @@
1
-import React from 'react';
2
-import { Card } from 'antd';
3
-import * as echarts from 'echarts/core';
4
-import Chart from '@/components/chart';
5
-
6
-export default (props) => {
7
-  const option = {
8
-    color: ['#80FFA5', '#00DDFF', '#37A2FF', '#FF0087', '#FFBF00'],
9
-    // title: {
10
-    //   text: 'Gradient Stacked Area Chart'
11
-    // },
12
-    tooltip: {
13
-      trigger: 'axis',
14
-      axisPointer: {
15
-        type: 'cross',
16
-        label: {
17
-          backgroundColor: '#6a7985'
18
-        }
19
-      }
20
-    },
21
-    legend: {
22
-      data: ['Line 1', 'Line 2', 'Line 3', 'Line 4', 'Line 5']
23
-    },
24
-    grid: {
25
-      left: '3%',
26
-      right: '4%',
27
-      bottom: '3%',
28
-      containLabel: true
29
-    },
30
-    xAxis: [
31
-      {
32
-        type: 'category',
33
-        boundaryGap: false,
34
-        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
35
-      }
36
-    ],
37
-    yAxis: [
38
-      {
39
-        type: 'value'
40
-      }
41
-    ],
42
-    series: [
43
-      {
44
-        name: 'Line 1',
45
-        type: 'line',
46
-        stack: 'Total',
47
-        smooth: true,
48
-        lineStyle: {
49
-          width: 0
50
-        },
51
-        showSymbol: false,
52
-        areaStyle: {
53
-          opacity: 0.8,
54
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
55
-            {
56
-              offset: 0,
57
-              color: 'rgb(128, 255, 165)'
58
-            },
59
-            {
60
-              offset: 1,
61
-              color: 'rgb(1, 191, 236)'
62
-            }
63
-          ])
64
-        },
65
-        emphasis: {
66
-          focus: 'series'
67
-        },
68
-        data: [140, 232, 101, 264, 90, 340, 250]
69
-      },
70
-      {
71
-        name: 'Line 2',
72
-        type: 'line',
73
-        stack: 'Total',
74
-        smooth: true,
75
-        lineStyle: {
76
-          width: 0
77
-        },
78
-        showSymbol: false,
79
-        areaStyle: {
80
-          opacity: 0.8,
81
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
82
-            {
83
-              offset: 0,
84
-              color: 'rgb(0, 221, 255)'
85
-            },
86
-            {
87
-              offset: 1,
88
-              color: 'rgb(77, 119, 255)'
89
-            }
90
-          ])
91
-        },
92
-        emphasis: {
93
-          focus: 'series'
94
-        },
95
-        data: [120, 282, 111, 234, 220, 340, 310]
96
-      },
97
-      {
98
-        name: 'Line 3',
99
-        type: 'line',
100
-        stack: 'Total',
101
-        smooth: true,
102
-        lineStyle: {
103
-          width: 0
104
-        },
105
-        showSymbol: false,
106
-        areaStyle: {
107
-          opacity: 0.8,
108
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
109
-            {
110
-              offset: 0,
111
-              color: 'rgb(55, 162, 255)'
112
-            },
113
-            {
114
-              offset: 1,
115
-              color: 'rgb(116, 21, 219)'
116
-            }
117
-          ])
118
-        },
119
-        emphasis: {
120
-          focus: 'series'
121
-        },
122
-        data: [320, 132, 201, 334, 190, 130, 220]
123
-      },
124
-      {
125
-        name: 'Line 4',
126
-        type: 'line',
127
-        stack: 'Total',
128
-        smooth: true,
129
-        lineStyle: {
130
-          width: 0
131
-        },
132
-        showSymbol: false,
133
-        areaStyle: {
134
-          opacity: 0.8,
135
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
136
-            {
137
-              offset: 0,
138
-              color: 'rgb(255, 0, 135)'
139
-            },
140
-            {
141
-              offset: 1,
142
-              color: 'rgb(135, 0, 157)'
143
-            }
144
-          ])
145
-        },
146
-        emphasis: {
147
-          focus: 'series'
148
-        },
149
-        data: [220, 402, 231, 134, 190, 230, 120]
150
-      },
151
-      {
152
-        name: 'Line 5',
153
-        type: 'line',
154
-        stack: 'Total',
155
-        smooth: true,
156
-        lineStyle: {
157
-          width: 0
158
-        },
159
-        showSymbol: false,
160
-        label: {
161
-          show: true,
162
-          position: 'top'
163
-        },
164
-        areaStyle: {
165
-          opacity: 0.8,
166
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
167
-            {
168
-              offset: 0,
169
-              color: 'rgb(255, 191, 0)'
170
-            },
171
-            {
172
-              offset: 1,
173
-              color: 'rgb(224, 62, 76)'
174
-            }
175
-          ])
176
-        },
177
-        emphasis: {
178
-          focus: 'series'
179
-        },
180
-        data: [220, 302, 181, 234, 210, 290, 150]
181
-      }
182
-    ]
183
-  };
184
-  
185
-
186
-  return (
187
-    <Card title='Gradient Stacked Area Chart'>
188
-      <Chart option={option} style={props.style}></Chart>
189
-    </Card>
190
-  )
191
-}

+ 0
- 44
src/pages/sample/home/components/Banner.jsx Näytä tiedosto

@@ -1,44 +0,0 @@
1
-import React from 'react';
2
-import { Row, Col, Card, Statistic } from 'antd';
3
-import { ArrowDownOutlined, ArrowUpOutlined, LikeOutlined } from '@ant-design/icons';
4
-
5
-export default (props) => {
6
-  return (
7
-    <Row gutter={24}>
8
-      <Col span={6}>
9
-        <Card>
10
-          <Statistic title="Feedback" value={1128} prefix={<LikeOutlined />} />
11
-        </Card>
12
-      </Col>
13
-      <Col span={6}>
14
-        <Card>
15
-          <Statistic title="Unmerged" value={93} suffix="/ 100" />
16
-        </Card>
17
-      </Col>
18
-      <Col span={6}>
19
-        <Card>
20
-          <Statistic
21
-            title="Active"
22
-            value={11.28}
23
-            precision={2}
24
-            valueStyle={{ color: '#3f8600' }}
25
-            prefix={<ArrowUpOutlined />}
26
-            suffix="%"
27
-          />
28
-        </Card>
29
-      </Col>
30
-      <Col span={6}>
31
-        <Card>
32
-          <Statistic
33
-            title="Idle"
34
-            value={9.3}
35
-            precision={2}
36
-            valueStyle={{ color: '#cf1322' }}
37
-            prefix={<ArrowDownOutlined />}
38
-            suffix="%"
39
-          />
40
-        </Card>
41
-      </Col>
42
-    </Row>
43
-  )
44
-}

+ 0
- 37
src/pages/sample/home/components/BarChart.jsx Näytä tiedosto

@@ -1,37 +0,0 @@
1
-import React from 'react';
2
-import { Card } from 'antd';
3
-import Chart from '@/components/chart';
4
-
5
-export default (props) => {
6
-
7
-  const option = {
8
-    legend: {},
9
-    tooltip: {},
10
-    dataset: {
11
-      source: [
12
-        ['product', '2015', '2016', '2017'],
13
-        ['Matcha Latte', 43.3, 85.8, 93.7],
14
-        ['Milk Tea', 83.1, 73.4, 55.1],
15
-        ['Cheese Cocoa', 86.4, 65.2, 82.5],
16
-        ['Walnut Brownie', 72.4, 53.9, 39.1]
17
-      ]
18
-    },
19
-    xAxis: { type: 'category' },
20
-    yAxis: {},
21
-    grid: {
22
-      left: '3%',
23
-      right: '4%',
24
-      bottom: '3%',
25
-      containLabel: true
26
-    },
27
-    // Declare several bar series, each will be mapped
28
-    // to a column of dataset.source by default.
29
-    series: [{ type: 'bar' }, { type: 'bar' }, { type: 'bar' }]
30
-  };
31
-
32
-  return (
33
-    <Card title='Bar Chart'>
34
-      <Chart option={option} style={props.style}></Chart>
35
-    </Card>
36
-  )
37
-}

+ 0
- 112
src/pages/sample/home/components/PictorialBar.jsx Näytä tiedosto

@@ -1,112 +0,0 @@
1
-import React from 'react';
2
-import { Card } from 'antd';
3
-import * as echarts from 'echarts/core';
4
-import Chart from '@/components/chart';
5
-
6
-
7
-export default (props) => {
8
-  let category = [];
9
-  let dottedBase = +new Date();
10
-  let lineData = [];
11
-  let barData = [];
12
-  for (let i = 0; i < 20; i++) {
13
-    let date = new Date((dottedBase += 3600 * 24 * 1000));
14
-    category.push(
15
-      [date.getFullYear(), date.getMonth() + 1, date.getDate()].join('-')
16
-    );
17
-    let b = Math.random() * 200;
18
-    let d = Math.random() * 200;
19
-    barData.push(b);
20
-    lineData.push(d + b);
21
-  }
22
-
23
-  const option = {
24
-    backgroundColor: '#0f375f',
25
-    tooltip: {
26
-      trigger: 'axis',
27
-      axisPointer: {
28
-        type: 'shadow'
29
-      }
30
-    },
31
-    legend: {
32
-      data: ['line', 'bar'],
33
-      textStyle: {
34
-        color: '#ccc'
35
-      }
36
-    },
37
-    xAxis: {
38
-      data: category,
39
-      axisLine: {
40
-        lineStyle: {
41
-          color: '#ccc'
42
-        }
43
-      }
44
-    },
45
-    yAxis: {
46
-      splitLine: { show: false },
47
-      axisLine: {
48
-        lineStyle: {
49
-          color: '#ccc'
50
-        }
51
-      }
52
-    },
53
-    series: [
54
-      {
55
-        name: 'line',
56
-        type: 'line',
57
-        smooth: true,
58
-        showAllSymbol: true,
59
-        symbol: 'emptyCircle',
60
-        symbolSize: 15,
61
-        data: lineData
62
-      },
63
-      {
64
-        name: 'bar',
65
-        type: 'bar',
66
-        barWidth: 10,
67
-        itemStyle: {
68
-          borderRadius: 5,
69
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
70
-            { offset: 0, color: '#14c8d4' },
71
-            { offset: 1, color: '#43eec6' }
72
-          ])
73
-        },
74
-        data: barData
75
-      },
76
-      {
77
-        name: 'line',
78
-        type: 'bar',
79
-        barGap: '-100%',
80
-        barWidth: 10,
81
-        itemStyle: {
82
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
83
-            { offset: 0, color: 'rgba(20,200,212,0.5)' },
84
-            { offset: 0.2, color: 'rgba(20,200,212,0.2)' },
85
-            { offset: 1, color: 'rgba(20,200,212,0)' }
86
-          ])
87
-        },
88
-        z: -12,
89
-        data: lineData
90
-      },
91
-      {
92
-        name: 'dotted',
93
-        type: 'pictorialBar',
94
-        symbol: 'rect',
95
-        itemStyle: {
96
-          color: '#0f375f'
97
-        },
98
-        symbolRepeat: true,
99
-        symbolSize: [12, 4],
100
-        symbolMargin: 1,
101
-        z: -10,
102
-        data: lineData
103
-      }
104
-    ]
105
-  };
106
-
107
-  return (
108
-    <Card title='Pictorial Chart'>
109
-      <Chart option={option} style={props.style}></Chart>
110
-    </Card>
111
-  )
112
-}

+ 0
- 48
src/pages/sample/home/components/PieChart.jsx Näytä tiedosto

@@ -1,48 +0,0 @@
1
-import React from 'react';
2
-import { Card } from 'antd';
3
-import Chart from '@/components/chart';
4
-
5
-export default (props) => {
6
-
7
-  const option = {
8
-    // title: {
9
-    //   text: 'Referer of a Website',
10
-    //   subtext: 'Fake Data',
11
-    //   left: 'center'
12
-    // },
13
-    tooltip: {
14
-      trigger: 'item'
15
-    },
16
-    legend: {
17
-      orient: 'vertical',
18
-      left: 'left'
19
-    },
20
-    series: [
21
-      {
22
-        name: 'Access From',
23
-        type: 'pie',
24
-        radius: '50%',
25
-        data: [
26
-          { value: 1048, name: 'Search Engine' },
27
-          { value: 735, name: 'Direct' },
28
-          { value: 580, name: 'Email' },
29
-          { value: 484, name: 'Union Ads' },
30
-          { value: 300, name: 'Video Ads' }
31
-        ],
32
-        emphasis: {
33
-          itemStyle: {
34
-            shadowBlur: 10,
35
-            shadowOffsetX: 0,
36
-            shadowColor: 'rgba(0, 0, 0, 0.5)'
37
-          }
38
-        }
39
-      }
40
-    ]
41
-  };
42
-
43
-  return (
44
-    <Card title='Basic Pie Chart'>
45
-      <Chart option={option} style={props.style}></Chart>
46
-    </Card>
47
-  )
48
-}

+ 0
- 48
src/pages/sample/home/components/RadarChart.jsx Näytä tiedosto

@@ -1,48 +0,0 @@
1
-import React from 'react';
2
-import { Card } from 'antd';
3
-import Chart from '@/components/chart';
4
-
5
-export default (props) => {
6
-
7
-  const option = {
8
-    // title: {
9
-    //   text: 'Basic Radar Chart'
10
-    // },
11
-    legend: {
12
-      data: ['Allocated Budget', 'Actual Spending']
13
-    },
14
-    radar: {
15
-      // shape: 'circle',
16
-      indicator: [
17
-        { name: 'Sales', max: 6500 },
18
-        { name: 'Administration', max: 16000 },
19
-        { name: 'Information Technology', max: 30000 },
20
-        { name: 'Customer Support', max: 38000 },
21
-        { name: 'Development', max: 52000 },
22
-        { name: 'Marketing', max: 25000 }
23
-      ]
24
-    },
25
-    series: [
26
-      {
27
-        name: 'Budget vs spending',
28
-        type: 'radar',
29
-        data: [
30
-          {
31
-            value: [4200, 3000, 20000, 35000, 50000, 18000],
32
-            name: 'Allocated Budget'
33
-          },
34
-          {
35
-            value: [5000, 14000, 28000, 26000, 42000, 21000],
36
-            name: 'Actual Spending'
37
-          }
38
-        ]
39
-      }
40
-    ]
41
-  };
42
-
43
-  return (
44
-    <Card title='Basic Radar Chart'>
45
-      <Chart option={option} style={props.style}></Chart>
46
-    </Card>
47
-  )
48
-}

+ 0
- 40
src/pages/sample/home/index.jsx Näytä tiedosto

@@ -1,40 +0,0 @@
1
-import React from 'react';
2
-import { Row, Col, Card, Space, Statistic } from 'antd';
3
-import Banner from './components/Banner';
4
-import AreaChart from './components/AreaChart';
5
-import BarChart from './components/BarChart';
6
-import PictorialBar from './components/PictorialBar';
7
-import RadarChart from './components/RadarChart';
8
-import PieChart from './components/PieChart';
9
-
10
-export default (props) => {
11
-
12
-  const chartStyle = {
13
-    height: '360px',
14
-    width: '100%',
15
-  }
16
-
17
-  return (
18
-    <div>
19
-      <Banner />
20
-
21
-      <Row gutter={24} style={{ marginTop: '24px' }}>
22
-        <Col span={16}>
23
-          <AreaChart style={chartStyle}/>
24
-        </Col>
25
-        <Col span={8}>
26
-          <RadarChart style={chartStyle}/>
27
-        </Col>
28
-      </Row>
29
-
30
-      <Row gutter={24} style={{ marginTop: '24px' }}>
31
-        <Col span={8}>
32
-          <PieChart style={chartStyle}/>
33
-        </Col>
34
-        <Col span={16}>
35
-          <BarChart style={chartStyle}/>
36
-        </Col>
37
-      </Row>
38
-    </div>
39
-  )
40
-}

+ 0
- 170
src/pages/sample/table/index.jsx Näytä tiedosto

@@ -1,170 +0,0 @@
1
-import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons';
2
-import { ProTable, TableDropdown } from '@ant-design/pro-components';
3
-import { Button, Dropdown, Menu, Space, Tag } from 'antd';
4
-import { useRef, useEffect } from 'react';
5
-import { useModel } from '@/store';
6
-
7
-// import request from 'umi-request';
8
-const columns = [
9
-    {
10
-        dataIndex: 'index',
11
-        valueType: 'indexBorder',
12
-        width: 48,
13
-    },
14
-    {
15
-        title: '标题',
16
-        dataIndex: 'title',
17
-        copyable: true,
18
-        ellipsis: true,
19
-        tip: '标题过长会自动收缩',
20
-        formItemProps: {
21
-            rules: [
22
-                {
23
-                    required: true,
24
-                    message: '此项为必填项',
25
-                },
26
-            ],
27
-        },
28
-    },
29
-    {
30
-        disable: true,
31
-        title: '状态',
32
-        dataIndex: 'state',
33
-        filters: true,
34
-        onFilter: true,
35
-        ellipsis: true,
36
-        valueType: 'select',
37
-        valueEnum: {
38
-            all: { text: '超长'.repeat(50) },
39
-            open: {
40
-                text: '未解决',
41
-                status: 'Error',
42
-            },
43
-            closed: {
44
-                text: '已解决',
45
-                status: 'Success',
46
-                disabled: true,
47
-            },
48
-            processing: {
49
-                text: '解决中',
50
-                status: 'Processing',
51
-            },
52
-        },
53
-    },
54
-    {
55
-        disable: true,
56
-        title: '标签',
57
-        dataIndex: 'labels',
58
-        search: false,
59
-        renderFormItem: (_, { defaultRender }) => {
60
-            return defaultRender(_);
61
-        },
62
-        render: (_, record) => (<Space>
63
-        {record.labels.map(({ name, color }) => (<Tag color={color} key={name}>
64
-            {name}
65
-          </Tag>))}
66
-      </Space>),
67
-    },
68
-    {
69
-        title: '创建时间',
70
-        key: 'showTime',
71
-        dataIndex: 'created_at',
72
-        valueType: 'date',
73
-        sorter: true,
74
-        hideInSearch: true,
75
-    },
76
-    {
77
-        title: '创建时间',
78
-        dataIndex: 'created_at',
79
-        valueType: 'dateRange',
80
-        hideInTable: true,
81
-        search: {
82
-            transform: (value) => {
83
-                return {
84
-                    startTime: value[0],
85
-                    endTime: value[1],
86
-                };
87
-            },
88
-        },
89
-    },
90
-    {
91
-        title: '操作',
92
-        valueType: 'option',
93
-        key: 'option',
94
-        render: (text, record, _, action) => [
95
-            <a key="editable" onClick={() => {
96
-                    var _a;
97
-                    (_a = action === null || action === void 0 ? void 0 : action.startEditable) === null || _a === void 0 ? void 0 : _a.call(action, record.id);
98
-                }}>
99
-        编辑
100
-      </a>,
101
-            <a href={record.url} target="_blank" rel="noopener noreferrer" key="view">
102
-        查看
103
-      </a>,
104
-            <TableDropdown key="actionGroup" onSelect={() => action === null || action === void 0 ? void 0 : action.reload()} menus={[
105
-                    { key: 'copy', name: '复制' },
106
-                    { key: 'delete', name: '删除' },
107
-                ]}/>,
108
-        ],
109
-    },
110
-];
111
-const menu = (<Menu items={[
112
-        {
113
-            label: '1st item',
114
-            key: '1',
115
-        },
116
-        {
117
-            label: '2nd item',
118
-            key: '1',
119
-        },
120
-        {
121
-            label: '3rd item',
122
-            key: '1',
123
-        },
124
-    ]}/>);
125
-export default () => {
126
-
127
-    const actionRef = useRef();
128
-    return (
129
-        <ProTable columns={columns} actionRef={actionRef} cardBordered request={async (params = {}, sort, filter) => {
130
-            console.log(sort, filter);
131
-            // return request('https://proapi.azurewebsites.net/github/issues', {
132
-            //     params,
133
-            // });
134
-        }} editable={{
135
-            type: 'multiple',
136
-        }} columnsState={{
137
-            persistenceKey: 'pro-table-singe-demos',
138
-            persistenceType: 'localStorage',
139
-            onChange(value) {
140
-                console.log('value: ', value);
141
-            },
142
-        }} rowKey="id" search={{
143
-            labelWidth: 'auto',
144
-        }} options={{
145
-            setting: {
146
-                listsHeight: 400,
147
-            },
148
-        }} form={{
149
-            // 由于配置了 transform,提交的参与与定义的不同这里需要转化一下
150
-            syncToUrl: (values, type) => {
151
-                if (type === 'get') {
152
-                    return Object.assign(Object.assign({}, values), { created_at: [values.startTime, values.endTime] });
153
-                }
154
-                return values;
155
-            },
156
-        }} pagination={{
157
-            pageSize: 5,
158
-            onChange: (page) => console.log(page),
159
-        }} dateFormatter="string" headerTitle="高级表格" toolBarRender={() => [
160
-            <Button key="button" icon={<PlusOutlined />} type="primary">
161
-          新建
162
-        </Button>,
163
-            <Dropdown key="menu" overlay={menu}>
164
-          <Button>
165
-            <EllipsisOutlined />
166
-          </Button>
167
-        </Dropdown>,
168
-        ]}/>
169
-    );
170
-};

+ 18
- 0
src/pages/user/Edit.jsx Näytä tiedosto

@@ -63,6 +63,7 @@ export default (props) => {
63 63
         form.setFieldsValue({
64 64
           ...res,
65 65
           rolesList: (res.rolesList || []).map(x => x.roleId),
66
+          dutyList: (res.dutyList || [])
66 67
         });
67 68
         cancelLoading();
68 69
       }).catch(() => {
@@ -140,6 +141,23 @@ export default (props) => {
140 141
               }
141 142
             </Select>
142 143
           </Form.Item>
144
+          <Form.Item
145
+            name="dutyList"
146
+            label="身份"
147
+          >
148
+            <Select
149
+              mode="multiple"
150
+              allowClear
151
+              style={{ width: '100%' }}
152
+              placeholder="请选择身份"
153
+            >
154
+              <Option value="inspector">督察员</Option>
155
+              <Option value="manager">管理员</Option>
156
+              <Option value="query_person">查询员</Option>
157
+              <Option value="org_user">单位人员</Option>
158
+              <Option value="org_manager">单位管理员</Option>
159
+            </Select>
160
+          </Form.Item>
143 161
           <Form.Item {...tailFormItemLayout}>
144 162
             <Button loading={submiting} type="primary" htmlType="submit">
145 163
               保存

+ 1
- 1
src/routes/Router.jsx Näytä tiedosto

@@ -5,7 +5,7 @@ import { defaultRoutes } from './routes';
5 5
 
6 6
 export default (props) => {
7 7
   const { routes } = useModel('user');
8
-
8
+  
9 9
   const router = React.useMemo(() => {
10 10
     if (!routes || routes.length < 1) {
11 11
       return createHashRouter(defaultRoutes);

+ 1
- 2
src/routes/routes.jsx Näytä tiedosto

@@ -24,7 +24,6 @@ import CheckEdit from '@/pages/check/Edit';
24 24
 import OrgList from "@/pages/org/index";
25 25
 
26 26
 import Index from '@/pages/index';
27
-import Home from "@/pages/sample/home";
28 27
 
29 28
 import PositionList from "@/pages/position/list";
30 29
 import PositionEdit from "@/pages/position/edit";
@@ -242,7 +241,7 @@ export const defaultRoutes = [
242 241
     children: [
243 242
       {
244 243
         index: true,
245
-        element: <Home />,
244
+        element: <Index />,
246 245
       },
247 246
       {
248 247
         path: '*',