Ver código fonte

Merge branch 'master' of http://git.ycjcjy.com/medical-plat/pc-admin into master

zlisen 4 anos atrás
pai
commit
75ae35232d

+ 6
- 20
config/routes.js Ver arquivo

@@ -37,26 +37,6 @@ export default [
37 37
                 icon: 'smile',
38 38
                 component: './Welcome',
39 39
               },
40
-              {
41
-                path: '/admin',
42
-                name: 'admin',
43
-                icon: 'crown',
44
-                component: './Admin',
45
-                routes: [
46
-                  {
47
-                    path: '/admin/sub-page',
48
-                    name: 'sub-page',
49
-                    icon: 'smile',
50
-                    component: './Welcome',
51
-                  },
52
-                ],
53
-              },
54
-              {
55
-                name: 'list.table-list',
56
-                icon: 'table',
57
-                path: '/list',
58
-                component: './TableList',
59
-              },
60 40
               {
61 41
                 path: '/cms',
62 42
                 name: 'CMS管理',
@@ -112,6 +92,12 @@ export default [
112 92
                     component: './Post/Edit',
113 93
                     hideInMenu: true,
114 94
                   },
95
+                  {
96
+                    path: '/post/post-type',
97
+                    name: '分类管理',
98
+                    menuCode: 'post.post-type',
99
+                    component: './Post/Type',
100
+                  },
115 101
                 ],
116 102
               },
117 103
               {

+ 54
- 0
src/components/ChangePassword/index.jsx Ver arquivo

@@ -0,0 +1,54 @@
1
+import React, { useState } from 'react';
2
+import {
3
+  ModalForm,
4
+  ProFormText,
5
+} from '@ant-design/pro-form';
6
+import md5 from 'md5';
7
+import { notification } from 'antd';
8
+import request from '@/utils/request';
9
+
10
+export default (props) => {
11
+  const checkSame = ({ getFieldValue }) => ({
12
+    validator(_, value) {
13
+      if (!value || getFieldValue('nw1') === value) {
14
+        return Promise.resolve();
15
+      }
16
+
17
+      return Promise.reject(new Error('两次密码输入不一致!'));
18
+    }
19
+  })
20
+
21
+  const handleSubmit = (values) => {
22
+    const data = {
23
+      originPassword: md5(values.originPassword),
24
+      newPassword: md5(values.nw1),
25
+    }
26
+
27
+    return request('/change-password', { data, method: 'put' }).then(() => {
28
+      props.onFinish()
29
+      return true
30
+    }).catch((e) => {
31
+      notification.error({ message: e.message })
32
+    })
33
+  }
34
+
35
+  return (
36
+    <ModalForm width={480} visible={props.visible} onFinish={handleSubmit} onVisibleChange={props.onVisibleChange}>
37
+      <ProFormText.Password
38
+        label="原始密码"
39
+        name="originPassword"
40
+        rules={[{ required: true, message: '原始密码不能为空' }]}
41
+      />
42
+      <ProFormText.Password
43
+        label="新密码"
44
+        name="nw1"
45
+        rules={[{ required: true, message: '新密码不能为空' }]}
46
+      />
47
+      <ProFormText.Password
48
+        label="新密码"
49
+        name="nw2"
50
+        rules={[{ required: true, message: '新密码不能为空' }, checkSame ]}
51
+      />
52
+    </ModalForm>
53
+  )
54
+}

+ 20
- 3
src/components/GlobalHeader/AvatarDropdown.jsx Ver arquivo

@@ -1,12 +1,17 @@
1
-import { LogoutOutlined } from '@ant-design/icons';
2
-import { Avatar, Menu, Spin } from 'antd';
3 1
 import React from 'react';
2
+import { Avatar, Menu, Spin } from 'antd';
3
+import { LogoutOutlined, FormOutlined } from '@ant-design/icons';
4 4
 import { history, connect } from 'umi';
5 5
 import { defaultAvatar } from '@/utils/utils';
6
+import ChangePassword from '@/components/ChangePassword'
6 7
 import HeaderDropdown from '../HeaderDropdown';
7 8
 import styles from './index.less';
8 9
 
9 10
 class AvatarDropdown extends React.Component {
11
+  state = {
12
+    showPassword: false,
13
+  }
14
+
10 15
   onMenuClick = (event) => {
11 16
     const { key } = event;
12 17
 
@@ -22,7 +27,9 @@ class AvatarDropdown extends React.Component {
22 27
       return;
23 28
     }
24 29
 
25
-    history.push(`/account/${key}`);
30
+    if (key === 'password') {
31
+      this.setState({ showPassword: true })
32
+    }
26 33
   };
27 34
 
28 35
   render() {
@@ -32,12 +39,22 @@ class AvatarDropdown extends React.Component {
32 39
         userName: '',
33 40
       },
34 41
     } = this.props;
42
+
35 43
     const menuHeaderDropdown = (
36 44
       <Menu className={styles.menu} selectedKeys={[]} onClick={this.onMenuClick}>
45
+        <Menu.Item key="password">
46
+          <FormOutlined />
47
+          修改密码
48
+        </Menu.Item>
37 49
         <Menu.Item key="logout">
38 50
           <LogoutOutlined />
39 51
           退出登录
40 52
         </Menu.Item>
53
+        <ChangePassword
54
+          visible={this.state.showPassword}
55
+          onVisibleChange={(v) => this.setState({ showPassword: v })}
56
+          onFinish={() => this.setState({ showPassword: false })}
57
+        />
41 58
       </Menu>
42 59
     );
43 60
     return currentUser && currentUser.userName ? (

+ 4
- 2
src/components/School/index.jsx Ver arquivo

@@ -7,6 +7,8 @@ export default (props) => {
7 7
   const [list, setList] = useState([])
8 8
   const [value, setValue] = useState()
9 9
 
10
+  const { autoDefault, ...selectProps } = props
11
+
10 12
   const filterFunc = (input, option) => {
11 13
     return option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
12 14
   }
@@ -31,7 +33,7 @@ export default (props) => {
31 33
       setList(records)
32 34
       setLoading(false)
33 35
 
34
-      if (props.autoDefault !== false && records.length > 0) {
36
+      if (autoDefault !== false && records.length > 0) {
35 37
         setValue(records[0].schoolId)
36 38
         props.onChange(records[0].schoolId, records[0])
37 39
       }
@@ -51,7 +53,7 @@ export default (props) => {
51 53
         showSearch
52 54
         optionFilterProp="children"
53 55
         filterOption={filterFunc}
54
-        {...props}
56
+        {...selectProps}
55 57
         value={value}
56 58
         onChange={handleChange}
57 59
       >

+ 0
- 55
src/pages/Admin.jsx Ver arquivo

@@ -1,55 +0,0 @@
1
-import React from 'react';
2
-import { HeartTwoTone, SmileTwoTone } from '@ant-design/icons';
3
-import { Card, Typography, Alert } from 'antd';
4
-import { PageHeaderWrapper } from '@ant-design/pro-layout';
5
-// import { useIntl } from 'umi';
6
-
7
-export default () => {
8
-  // const intl = useIntl();
9
-  return (
10
-    <PageHeaderWrapper
11
-      content="这个页面只有 admin 权限才能查看"
12
-      // content={intl.formatMessage({
13
-      //   id: 'pages.admin.subPage.title',
14
-      //   defaultMessage: ' 这个页面只有 admin 权限才能查看',
15
-      // })}
16
-    >
17
-      <Card>
18
-        <Alert
19
-          // message={intl.formatMessage({
20
-          //   id: 'pages.welcome.alertMessage',
21
-          //   defaultMessage: '更快更强的重型组件,已经发布。',
22
-          // })}
23
-          message="更快更强的重型组件,已经发布。"
24
-          type="success"
25
-          showIcon
26
-          banner
27
-          style={{
28
-            margin: -12,
29
-            marginBottom: 48,
30
-          }}
31
-        />
32
-        <Typography.Title
33
-          level={2}
34
-          style={{
35
-            textAlign: 'center',
36
-          }}
37
-        >
38
-          <SmileTwoTone /> Ant Design Pro <HeartTwoTone twoToneColor="#eb2f96" /> You
39
-        </Typography.Title>
40
-      </Card>
41
-      <p
42
-        style={{
43
-          textAlign: 'center',
44
-          marginTop: 24,
45
-        }}
46
-      >
47
-        Want to add more pages? Please refer to{' '}
48
-        <a href="https://pro.ant.design/docs/block-cn" target="_blank" rel="noopener noreferrer">
49
-          use block
50
-        </a>
51
-        。
52
-      </p>
53
-    </PageHeaderWrapper>
54
-  );
55
-};

+ 140
- 0
src/pages/Post/Type/index.jsx Ver arquivo

@@ -0,0 +1,140 @@
1
+import React, { useEffect, useRef, useState } from 'react';
2
+import { connect } from 'umi';
3
+import { PageContainer } from '@ant-design/pro-layout';
4
+import ProTable from '@ant-design/pro-table';
5
+import { PlusOutlined } from '@ant-design/icons';
6
+import { Button, notification } from 'antd';
7
+import {
8
+  ModalForm,
9
+  ProFormText,
10
+} from '@ant-design/pro-form';
11
+import request, { queryTable } from '@/utils/request';
12
+
13
+const PostTypeList = (props) => {
14
+  const tableRef = useRef()
15
+  const form = useRef();
16
+  const [current, setCurrent] = useState({})
17
+  const [visible, setVisible] = useState(false)
18
+
19
+  const handleEdit = (postType) => {
20
+    const data = postType || {}
21
+    setCurrent(data)
22
+    setVisible(true)
23
+    if (form.current) {
24
+      form.current.setFieldsValue(data)
25
+    }
26
+  }
27
+
28
+  const emitPublishOrNot = (postType) => {
29
+    // 1 变成 0, 0 变成 1
30
+    const status = Math.abs(postType.status - 1)
31
+    request(`/post-type/${postType.typeId}`, { method: 'put', data: { ...postType, status } }).then(() => {
32
+      notification.success({ message: '操作成功' })
33
+      tableRef.current.reload()
34
+    }).catch((e) => {
35
+      notification.warn({ message: e.message })
36
+    })
37
+  }
38
+
39
+  const handleSubmit = (postType) => {
40
+    const method = current.typeId ? 'put' : 'post'
41
+    const api = current.typeId ? `/post-type/${current.typeId}` : '/post-type'
42
+    const data = { ...current, ...postType }
43
+    return request(api, { method, data }).then(() => {
44
+      notification.success({ message: '操作成功' })
45
+      tableRef.current.reload()
46
+      setVisible(false)
47
+    }).catch((e) => {
48
+      notification.warn({ message: e.message })
49
+    })
50
+  }
51
+
52
+  const actions = [
53
+    <Button key="button" icon={<PlusOutlined />} type="primary" onClick={handleEdit}>
54
+      新建
55
+    </Button>,
56
+  ];
57
+
58
+  const columns = [
59
+    {
60
+      title: '标题',
61
+      key: 'name',
62
+      dataIndex: 'name',
63
+    },
64
+    {
65
+      title: '状态',
66
+      key: 'status',
67
+      dataIndex: 'status',
68
+      width: 240,
69
+      valueType: 'select',
70
+      valueEnum: {
71
+        0: {
72
+          text: '下架',
73
+          status: 'Processing',
74
+        },
75
+        1: {
76
+          text: '上架',
77
+          status: 'Success',
78
+        },
79
+      },
80
+    },
81
+    {
82
+      title: '创建时间',
83
+      key: 'createDate',
84
+      dataIndex: 'createDate',
85
+      valueType: 'date',
86
+      width: 240,
87
+      hideInSearch: true,
88
+    },
89
+    {
90
+      title: '操作',
91
+      key: 'option',
92
+      valueType: 'option',
93
+      width: 160,
94
+      render: (_, item) => [
95
+        <a key="edit" onClick={() => handleEdit(item)}>
96
+          编辑
97
+        </a>,
98
+        <a key="up" onClick={() => emitPublishOrNot(item)}>
99
+          {item.status === 1 ? '下架' : '上架'}
100
+        </a>,
101
+      ],
102
+    },
103
+  ];
104
+
105
+  useEffect(() => {
106
+    if (!props.typeList || !props.typeList.length) {
107
+      props.dispatch({
108
+        type: 'post/getTypeList',
109
+        payload: { pageSize: 999 },
110
+      });
111
+    }
112
+  }, [props]);
113
+
114
+  return (
115
+    <PageContainer>
116
+      <ProTable
117
+        actionRef={tableRef}
118
+        columns={columns}
119
+        request={queryTable('/post-type')}
120
+        rowKey="typeId"
121
+        headerTitle="科普列表"
122
+        search={{
123
+          labelWidth: '4em',
124
+        }}
125
+        toolBarRender={() => actions}
126
+      />
127
+      <ModalForm formRef={form} width={600} visible={visible} onVisibleChange={setVisible} onFinish={handleSubmit}>
128
+        <ProFormText
129
+          label="名称"
130
+          name="name"
131
+          rules={[{ required: true, message: '请填写名称' }]}
132
+        />
133
+      </ModalForm>
134
+    </PageContainer>
135
+  );
136
+};
137
+
138
+export default connect((s) => ({
139
+  typeList: s.post.typeList,
140
+}))(PostTypeList);

+ 1
- 1
src/pages/Statistic/StudentData.jsx Ver arquivo

@@ -4,7 +4,7 @@ import { PageContainer } from '@ant-design/pro-layout';
4 4
 import ProTable from '@ant-design/pro-table';
5 5
 import request, { queryTable } from '@/utils/request';
6 6
 
7
-const StudentData = (props) => {
7
+const StudentData = () => {
8 8
   const tableRef = useRef()
9 9
   const [schoolDict, setSchoolDict] = useState({})
10 10
 

+ 0
- 211
src/pages/TableList/components/UpdateForm.jsx Ver arquivo

@@ -1,211 +0,0 @@
1
-import React from 'react';
2
-import { Modal } from 'antd';
3
-import {
4
-  ProFormSelect,
5
-  ProFormText,
6
-  ProFormTextArea,
7
-  StepsForm,
8
-  ProFormRadio,
9
-  ProFormDateTimePicker,
10
-} from '@ant-design/pro-form';
11
-// import { useIntl, FormattedMessage } from 'umi';
12
-
13
-const UpdateForm = (props) => {
14
-  // const intl = useIntl();
15
-  return (
16
-    <StepsForm
17
-      stepsProps={{
18
-        size: 'small',
19
-      }}
20
-      stepsFormRender={(dom, submitter) => {
21
-        return (
22
-          <Modal
23
-            width={640}
24
-            bodyStyle={{
25
-              padding: '32px 40px 48px',
26
-            }}
27
-            destroyOnClose
28
-            // title={intl.formatMessage({
29
-            //   id: 'pages.searchTable.updateForm.ruleConfig',
30
-            //   defaultMessage: '规则配置',
31
-            // })}
32
-            title="规则配置"
33
-            visible={props.updateModalVisible}
34
-            footer={submitter}
35
-            onCancel={() => {
36
-              props.onCancel();
37
-            }}
38
-          >
39
-            {dom}
40
-          </Modal>
41
-        );
42
-      }}
43
-      onFinish={props.onSubmit}
44
-    >
45
-      <StepsForm.StepForm
46
-        initialValues={{
47
-          name: props.values.name,
48
-          desc: props.values.desc,
49
-        }}
50
-        // title={intl.formatMessage({
51
-        //   id: 'pages.searchTable.updateForm.basicConfig',
52
-        //   defaultMessage: '基本信息',
53
-        // })}
54
-        title="基本信息"
55
-      >
56
-        <ProFormText
57
-          name="name"
58
-          // label={intl.formatMessage({
59
-          //   id: 'pages.searchTable.updateForm.ruleName.nameLabel',
60
-          //   defaultMessage: '规则名称',
61
-          // })}
62
-          label="规则名称"
63
-          width="md"
64
-          rules={[
65
-            {
66
-              required: true,
67
-              message: '请输入规则名称!',
68
-              // message: (
69
-              //   <FormattedMessage
70
-              //     id="pages.searchTable.updateForm.ruleName.nameRules"
71
-              //     defaultMessage="请输入规则名称!"
72
-              //   />
73
-              // ),
74
-            },
75
-          ]}
76
-        />
77
-        <ProFormTextArea
78
-          name="desc"
79
-          width="md"
80
-          // label={intl.formatMessage({
81
-          //   id: 'pages.searchTable.updateForm.ruleDesc.descLabel',
82
-          //   defaultMessage: '规则描述',
83
-          // })}
84
-          label="规则描述"
85
-          // placeholder={intl.formatMessage({
86
-          //   id: 'pages.searchTable.updateForm.ruleDesc.descPlaceholder',
87
-          //   defaultMessage: '请输入至少五个字符',
88
-          // })}
89
-          placeholder="请输入至少五个字符"
90
-          rules={[
91
-            {
92
-              required: true,
93
-              message: '请输入至少五个字符的规则描述!',
94
-              // message: (
95
-              //   <FormattedMessage
96
-              //     id="pages.searchTable.updateForm.ruleDesc.descRules"
97
-              //     defaultMessage="请输入至少五个字符的规则描述!"
98
-              //   />
99
-              // ),
100
-              min: 5,
101
-            },
102
-          ]}
103
-        />
104
-      </StepsForm.StepForm>
105
-      <StepsForm.StepForm
106
-        initialValues={{
107
-          target: '0',
108
-          template: '0',
109
-        }}
110
-        // title={intl.formatMessage({
111
-        //   id: 'pages.searchTable.updateForm.ruleProps.title',
112
-        //   defaultMessage: '配置规则属性',
113
-        // })}
114
-        title="配置规则属性"
115
-      >
116
-        <ProFormSelect
117
-          name="target"
118
-          width="md"
119
-          // label={intl.formatMessage({
120
-          //   id: 'pages.searchTable.updateForm.object',
121
-          //   defaultMessage: '监控对象',
122
-          // })}
123
-          label="监控对象"
124
-          valueEnum={{
125
-            0: '表一',
126
-            1: '表二',
127
-          }}
128
-        />
129
-        <ProFormSelect
130
-          name="template"
131
-          width="md"
132
-          // label={intl.formatMessage({
133
-          //   id: 'pages.searchTable.updateForm.ruleProps.templateLabel',
134
-          //   defaultMessage: '规则模板',
135
-          // })}
136
-          label="规则模板"
137
-          valueEnum={{
138
-            0: '规则模板一',
139
-            1: '规则模板二',
140
-          }}
141
-        />
142
-        <ProFormRadio.Group
143
-          name="type"
144
-          // label={intl.formatMessage({
145
-          //   id: 'pages.searchTable.updateForm.ruleProps.typeLabel',
146
-          //   defaultMessage: '规则类型',
147
-          // })}
148
-          label="规则类型"
149
-          options={[
150
-            {
151
-              value: '0',
152
-              label: '强',
153
-            },
154
-            {
155
-              value: '1',
156
-              label: '弱',
157
-            },
158
-          ]}
159
-        />
160
-      </StepsForm.StepForm>
161
-      <StepsForm.StepForm
162
-        initialValues={{
163
-          type: '1',
164
-          frequency: 'month',
165
-        }}
166
-        // title={intl.formatMessage({
167
-        //   id: 'pages.searchTable.updateForm.schedulingPeriod.title',
168
-        //   defaultMessage: '设定调度周期',
169
-        // })}
170
-        title="设定调度周期"
171
-      >
172
-        <ProFormDateTimePicker
173
-          name="time"
174
-          width="md"
175
-          // label={intl.formatMessage({
176
-          //   id: 'pages.searchTable.updateForm.schedulingPeriod.timeLabel',
177
-          //   defaultMessage: '开始时间',
178
-          // })}
179
-          label="开始时间"
180
-          rules={[
181
-            {
182
-              required: true,
183
-              message: '请选择开始时间!',
184
-              // message: (
185
-              //   <FormattedMessage
186
-              //     id="pages.searchTable.updateForm.schedulingPeriod.timeRules"
187
-              //     defaultMessage="请选择开始时间!"
188
-              //   />
189
-              // ),
190
-            },
191
-          ]}
192
-        />
193
-        <ProFormSelect
194
-          name="frequency"
195
-          // label={intl.formatMessage({
196
-          //   id: 'pages.searchTable.updateForm.object',
197
-          //   defaultMessage: '监控对象',
198
-          // })}
199
-          label="监控对象"
200
-          width="md"
201
-          valueEnum={{
202
-            month: '月',
203
-            week: '周',
204
-          }}
205
-        />
206
-      </StepsForm.StepForm>
207
-    </StepsForm>
208
-  );
209
-};
210
-
211
-export default UpdateForm;

+ 0
- 388
src/pages/TableList/index.jsx Ver arquivo

@@ -1,388 +0,0 @@
1
-import { PlusOutlined } from '@ant-design/icons';
2
-import { Button, message, Input, Drawer } from 'antd';
3
-import React, { useState, useRef } from 'react';
4
-// import { useIntl, FormattedMessage } from 'umi';
5
-import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
6
-import ProTable from '@ant-design/pro-table';
7
-import { ModalForm, ProFormText, ProFormTextArea } from '@ant-design/pro-form';
8
-import ProDescriptions from '@ant-design/pro-descriptions';
9
-import UpdateForm from './components/UpdateForm';
10
-import { queryRule, updateRule, addRule, removeRule } from './service';
11
-/**
12
- * 添加节点
13
- *
14
- * @param fields
15
- */
16
-
17
-const handleAdd = async (fields) => {
18
-  const hide = message.loading('正在添加');
19
-
20
-  try {
21
-    await addRule({ ...fields });
22
-    hide();
23
-    message.success('添加成功');
24
-    return true;
25
-  } catch (error) {
26
-    hide();
27
-    message.error('添加失败请重试!');
28
-    return false;
29
-  }
30
-};
31
-/**
32
- * 更新节点
33
- *
34
- * @param fields
35
- */
36
-
37
-const handleUpdate = async (fields) => {
38
-  const hide = message.loading('正在配置');
39
-
40
-  try {
41
-    await updateRule({
42
-      name: fields.name,
43
-      desc: fields.desc,
44
-      key: fields.key,
45
-    });
46
-    hide();
47
-    message.success('配置成功');
48
-    return true;
49
-  } catch (error) {
50
-    hide();
51
-    message.error('配置失败请重试!');
52
-    return false;
53
-  }
54
-};
55
-/**
56
- * 删除节点
57
- *
58
- * @param selectedRows
59
- */
60
-
61
-const handleRemove = async (selectedRows) => {
62
-  const hide = message.loading('正在删除');
63
-  if (!selectedRows) return true;
64
-
65
-  try {
66
-    await removeRule({
67
-      key: selectedRows.map((row) => row.key),
68
-    });
69
-    hide();
70
-    message.success('删除成功,即将刷新');
71
-    return true;
72
-  } catch (error) {
73
-    hide();
74
-    message.error('删除失败,请重试');
75
-    return false;
76
-  }
77
-};
78
-
79
-const TableList = () => {
80
-  /** 新建窗口的弹窗 */
81
-  const [createModalVisible, handleModalVisible] = useState(false);
82
-  /** 分布更新窗口的弹窗 */
83
-
84
-  const [updateModalVisible, handleUpdateModalVisible] = useState(false);
85
-  const [showDetail, setShowDetail] = useState(false);
86
-  const actionRef = useRef();
87
-  const [currentRow, setCurrentRow] = useState();
88
-  const [selectedRowsState, setSelectedRows] = useState([]);
89
-  /** 国际化配置 */
90
-
91
-  // const intl = useIntl();
92
-  const columns = [
93
-    {
94
-      // title: (
95
-      //   <FormattedMessage
96
-      //     id="pages.searchTable.updateForm.ruleName.nameLabel"
97
-      //     defaultMessage="规则名称"
98
-      //   />
99
-      // ),
100
-      title: '规则名称',
101
-      dataIndex: 'name',
102
-      tip: '规则名称是唯一的 key',
103
-      render: (dom, entity) => {
104
-        return (
105
-          <a
106
-            onClick={() => {
107
-              setCurrentRow(entity);
108
-              setShowDetail(true);
109
-            }}
110
-          >
111
-            {dom}
112
-          </a>
113
-        );
114
-      },
115
-    },
116
-    {
117
-      // title: <FormattedMessage id="pages.searchTable.titleDesc" defaultMessage="描述" />,
118
-      title: '描述',
119
-      dataIndex: 'desc',
120
-      valueType: 'textarea',
121
-    },
122
-    {
123
-      // title: <FormattedMessage id="pages.searchTable.titleCallNo" defaultMessage="服务调用次数" />,
124
-      title: '服务调用次数',
125
-      dataIndex: 'callNo',
126
-      sorter: true,
127
-      hideInForm: true,
128
-      // renderText: (val) =>
129
-      //   `${val}${intl.formatMessage({
130
-      //     id: 'pages.searchTable.tenThousand',
131
-      //     defaultMessage: ' 万 ',
132
-      //   })}`,
133
-      renderText: (val) => `${val} 万`,
134
-    },
135
-    {
136
-      // title: <FormattedMessage id="pages.searchTable.titleStatus" defaultMessage="状态" />,
137
-      title: '状态',
138
-      dataIndex: 'status',
139
-      hideInForm: true,
140
-      valueEnum: {
141
-        0: {
142
-          // text: (
143
-          //   <FormattedMessage id="pages.searchTable.nameStatus.default" defaultMessage="关闭" />
144
-          // ),
145
-          title: '关闭',
146
-          status: 'Default',
147
-        },
148
-        1: {
149
-          // text: (
150
-          //   <FormattedMessage id="pages.searchTable.nameStatus.running" defaultMessage="运行中" />
151
-          // ),
152
-          title: '运行中',
153
-          status: 'Processing',
154
-        },
155
-        2: {
156
-          // text: (
157
-          //   <FormattedMessage id="pages.searchTable.nameStatus.online" defaultMessage="已上线" />
158
-          // ),
159
-          title: '已上线',
160
-          status: 'Success',
161
-        },
162
-        3: {
163
-          // text: (
164
-          //   <FormattedMessage id="pages.searchTable.nameStatus.abnormal" defaultMessage="异常" />
165
-          // ),
166
-          title: '异常',
167
-          status: 'Error',
168
-        },
169
-      },
170
-    },
171
-    {
172
-      // title: (
173
-      //   <FormattedMessage id="pages.searchTable.titleUpdatedAt" defaultMessage="上次调度时间" />
174
-      // ),
175
-      title: '上次调度时间',
176
-      sorter: true,
177
-      dataIndex: 'updatedAt',
178
-      valueType: 'dateTime',
179
-      renderFormItem: (item, { defaultRender, ...rest }, form) => {
180
-        const status = form.getFieldValue('status');
181
-
182
-        if (`${status}` === '0') {
183
-          return false;
184
-        }
185
-
186
-        if (`${status}` === '3') {
187
-          return (
188
-            <Input
189
-              {...rest}
190
-              // placeholder={intl.formatMessage({
191
-              //   id: 'pages.searchTable.exception',
192
-              //   defaultMessage: '请输入异常原因!',
193
-              // })}
194
-              placeholder="请输入异常原因!"
195
-            />
196
-          );
197
-        }
198
-
199
-        return defaultRender(item);
200
-      },
201
-    },
202
-    {
203
-      // title: <FormattedMessage id="pages.searchTable.titleOption" defaultMessage="操作" />,
204
-      title: '操作',
205
-      dataIndex: 'option',
206
-      valueType: 'option',
207
-      render: (_, record) => [
208
-        <a
209
-          key="config"
210
-          onClick={() => {
211
-            handleUpdateModalVisible(true);
212
-            setCurrentRow(record);
213
-          }}
214
-        >
215
-          {/* <FormattedMessage id="pages.searchTable.config" defaultMessage="配置" /> */}
216
-          配置
217
-        </a>,
218
-        <a key="subscribeAlert" href="https://procomponents.ant.design/">
219
-          {/* <FormattedMessage id="pages.searchTable.subscribeAlert" defaultMessage="订阅警报" /> */}
220
-          订阅警报
221
-        </a>,
222
-      ],
223
-    },
224
-  ];
225
-  return (
226
-    <PageContainer>
227
-      <ProTable
228
-        // headerTitle={intl.formatMessage({
229
-        //   id: 'pages.searchTable.title',
230
-        //   defaultMessage: '查询表格',
231
-        // })}
232
-        headerTitle="查询表格"
233
-        actionRef={actionRef}
234
-        rowKey="key"
235
-        search={{
236
-          labelWidth: 120,
237
-        }}
238
-        toolBarRender={() => [
239
-          <Button
240
-            type="primary"
241
-            key="primary"
242
-            onClick={() => {
243
-              handleModalVisible(true);
244
-            }}
245
-          >
246
-            <PlusOutlined /> 新建
247
-            {/* <FormattedMessage id="pages.searchTable.new" defaultMessage="新建" /> */}
248
-          </Button>,
249
-        ]}
250
-        request={(params, sorter, filter) => queryRule({ ...params, sorter, filter })}
251
-        columns={columns}
252
-        rowSelection={{
253
-          onChange: (_, selectedRows) => {
254
-            setSelectedRows(selectedRows);
255
-          },
256
-        }}
257
-      />
258
-      {selectedRowsState?.length > 0 && (
259
-        <FooterToolbar
260
-          extra={
261
-            <div>
262
-              {/* <FormattedMessage id="pages.searchTable.chosen" defaultMessage="已选择" /> */}
263
-              已选择{' '}
264
-              <a
265
-                style={{
266
-                  fontWeight: 600,
267
-                }}
268
-              >
269
-                {selectedRowsState.length}
270
-              </a>{' '}
271
-              项{/* <FormattedMessage id="pages.searchTable.item" defaultMessage="项" /> */}
272
-              &nbsp;&nbsp;
273
-              <span>
274
-                {/* <FormattedMessage
275
-                  id="pages.searchTable.totalServiceCalls"
276
-                  defaultMessage="服务调用次数总计"
277
-                /> */}
278
-                服务调用次数总计 {selectedRowsState.reduce((pre, item) => pre + item.callNo, 0)}{' '}
279
-                {/* <FormattedMessage id="pages.searchTable.tenThousand" defaultMessage="万" /> */}
280
-                万
281
-              </span>
282
-            </div>
283
-          }
284
-        >
285
-          <Button
286
-            onClick={async () => {
287
-              await handleRemove(selectedRowsState);
288
-              setSelectedRows([]);
289
-              actionRef.current?.reloadAndRest?.();
290
-            }}
291
-          >
292
-            {/* <FormattedMessage id="pages.searchTable.batchDeletion" defaultMessage="批量删除" /> */}
293
-            批量删除
294
-          </Button>
295
-          <Button type="primary">
296
-            {/* <FormattedMessage id="pages.searchTable.batchApproval" defaultMessage="批量审批" /> */}
297
-            批量审批
298
-          </Button>
299
-        </FooterToolbar>
300
-      )}
301
-      <ModalForm
302
-        // title={intl.formatMessage({
303
-        //   id: 'pages.searchTable.createForm.newRule',
304
-        //   defaultMessage: '新建规则',
305
-        // })}
306
-        title="新建规则"
307
-        width="400px"
308
-        visible={createModalVisible}
309
-        onVisibleChange={handleModalVisible}
310
-        onFinish={async (value) => {
311
-          const success = await handleAdd(value);
312
-
313
-          if (success) {
314
-            handleModalVisible(false);
315
-
316
-            if (actionRef.current) {
317
-              actionRef.current.reload();
318
-            }
319
-          }
320
-        }}
321
-      >
322
-        <ProFormText
323
-          rules={[
324
-            {
325
-              required: true,
326
-              message: '规则名称为必填项',
327
-              // message: (
328
-              //   <FormattedMessage
329
-              //     id="pages.searchTable.ruleName"
330
-              //     defaultMessage="规则名称为必填项"
331
-              //   />
332
-              // ),
333
-            },
334
-          ]}
335
-          width="md"
336
-          name="name"
337
-        />
338
-        <ProFormTextArea width="md" name="desc" />
339
-      </ModalForm>
340
-      <UpdateForm
341
-        onSubmit={async (value) => {
342
-          const success = await handleUpdate(value);
343
-
344
-          if (success) {
345
-            handleUpdateModalVisible(false);
346
-            setCurrentRow(undefined);
347
-
348
-            if (actionRef.current) {
349
-              actionRef.current.reload();
350
-            }
351
-          }
352
-        }}
353
-        onCancel={() => {
354
-          handleUpdateModalVisible(false);
355
-          setCurrentRow(undefined);
356
-        }}
357
-        updateModalVisible={updateModalVisible}
358
-        values={currentRow || {}}
359
-      />
360
-
361
-      <Drawer
362
-        width={600}
363
-        visible={showDetail}
364
-        onClose={() => {
365
-          setCurrentRow(undefined);
366
-          setShowDetail(false);
367
-        }}
368
-        closable={false}
369
-      >
370
-        {currentRow?.name && (
371
-          <ProDescriptions
372
-            column={2}
373
-            title={currentRow?.name}
374
-            request={async () => ({
375
-              data: currentRow || {},
376
-            })}
377
-            params={{
378
-              id: currentRow?.name,
379
-            }}
380
-            columns={columns}
381
-          />
382
-        )}
383
-      </Drawer>
384
-    </PageContainer>
385
-  );
386
-};
387
-
388
-export default TableList;

+ 0
- 25
src/pages/TableList/service.js Ver arquivo

@@ -1,25 +0,0 @@
1
-import request from '@/utils/request';
2
-
3
-export async function queryRule(params) {
4
-  return request('/api/rule', {
5
-    params,
6
-  });
7
-}
8
-export async function removeRule(params) {
9
-  return request('/api/rule', {
10
-    method: 'POST',
11
-    data: { ...params, method: 'delete' },
12
-  });
13
-}
14
-export async function addRule(params) {
15
-  return request('/api/rule', {
16
-    method: 'POST',
17
-    data: { ...params, method: 'post' },
18
-  });
19
-}
20
-export async function updateRule(params) {
21
-  return request('/api/rule', {
22
-    method: 'POST',
23
-    data: { ...params, method: 'update' },
24
-  });
25
-}

+ 15
- 4
src/pages/User/List/index.jsx Ver arquivo

@@ -35,6 +35,14 @@ export default () => {
35 35
     })
36 36
   }
37 37
 
38
+  const handleResetPassword = (user) => {
39
+    request(`/reset-password/${user.userId}`, { method: 'put' }).then(() => {
40
+      notification.success({ message: '操作成功' })
41
+    }).catch((e) => {
42
+      notification.error({ message: e.message })
43
+    })
44
+  }
45
+
38 46
   const columns = [
39 47
     {
40 48
       title: '编号',
@@ -77,12 +85,15 @@ export default () => {
77 85
       key: 'option',
78 86
       valueType: 'option',
79 87
       // 不能操作超级管理员
80
-      render: (_, user) => [
81
-        user.userId !== '1' && <a key="edit" onClick={() => handleEdit(user)}>修改</a>,
82
-        user.userId !== '1' && <a key="disable" onClick={() => changeStatus(user)}>{user.status === 1 ? '禁用' : '启用'}</a>,
83
-        user.userId !== '1' && <Popconfirm key="delete" title="确定删除当前人员?" onConfirm={() => handleDelete(user)}>
88
+      render: (_, user) => user.userId === '1' ? [] : [
89
+        <a key="edit" onClick={() => handleEdit(user)}>修改</a>,
90
+        <a key="disable" onClick={() => changeStatus(user)}>{user.status === 1 ? '禁用' : '启用'}</a>,
91
+        <Popconfirm key="delete" title="确定删除当前人员?" onConfirm={() => handleDelete(user)}>
84 92
           <a href="#">删除</a>
85 93
         </Popconfirm>,
94
+        <Popconfirm key="reset" title="确定重置用户密码?" onConfirm={() => handleResetPassword(user)}>
95
+          <a href="#">重置密码</a>
96
+        </Popconfirm>,
86 97
       ].filter(Boolean)
87 98
     },
88 99
   ]

+ 0
- 1
src/pages/Welcome/components/LineCard.jsx Ver arquivo

@@ -84,7 +84,6 @@ export default (props) => {
84 84
   const [params, setParams] = useState()
85 85
 
86 86
   useEffect(() => {
87
-    console.log('-------->', dtRange)
88 87
     if (dtRange) {
89 88
       setParams({
90 89
         startDate: dtRange[0].format('YYYY-MM-DD'),      

+ 2
- 2
src/pages/Welcome/index.jsx Ver arquivo

@@ -1,6 +1,6 @@
1 1
 import React from 'react';
2 2
 import { PageContainer } from '@ant-design/pro-layout';
3
-import { Card, Row, Col, Space, Button } from 'antd';
3
+import { Row, Col } from 'antd';
4 4
 import { LineChartOutlined, UserOutlined, ReadOutlined, BranchesOutlined } from '@ant-design/icons';
5 5
 // import { useIntl, FormattedMessage } from 'umi';
6 6
 import HeaderContent from './components/HeaderContent';
@@ -9,7 +9,7 @@ import NavCard from './components/NavCard';
9 9
 
10 10
 const navIconStyle = {
11 11
   fontSize: '5em',
12
-  color: 'rgba(0, 0, 0, 0.04)'
12
+  color: 'rgba(0, 0, 0, 0.06)'
13 13
 }
14 14
 
15 15
 const Text = (props) => (