@jiangood/open-admin 1.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/config/common-plugin.js +94 -0
  2. package/config/config.js +58 -0
  3. package/config/utils.js +73 -0
  4. package/package.json +42 -0
  5. package/src/.umi-production/appData.json +2365 -0
  6. package/src/.umi-production/core/EmptyRoute.tsx +9 -0
  7. package/src/.umi-production/core/defineApp.ts +16 -0
  8. package/src/.umi-production/core/helmet.ts +10 -0
  9. package/src/.umi-production/core/helmetContext.ts +4 -0
  10. package/src/.umi-production/core/history.ts +72 -0
  11. package/src/.umi-production/core/historyIntelli.ts +132 -0
  12. package/src/.umi-production/core/plugin.ts +40 -0
  13. package/src/.umi-production/core/pluginConfig.ts +324 -0
  14. package/src/.umi-production/core/pluginConfigJoi.d.ts +7 -0
  15. package/src/.umi-production/core/polyfill.ts +220 -0
  16. package/src/.umi-production/core/route.tsx +54 -0
  17. package/src/.umi-production/core/routeProps.js +5 -0
  18. package/src/.umi-production/core/routeProps.ts +6 -0
  19. package/src/.umi-production/core/terminal.ts +37 -0
  20. package/src/.umi-production/exports.ts +17 -0
  21. package/src/.umi-production/testBrowser.tsx +90 -0
  22. package/src/.umi-production/tsconfig.json +44 -0
  23. package/src/.umi-production/typings.d.ts +136 -0
  24. package/src/.umi-production/umi.ts +83 -0
  25. package/src/framework/components/DownloadFileButton/index.d.ts +11 -0
  26. package/src/framework/components/DownloadFileButton/index.jsx +33 -0
  27. package/src/framework/components/Gap/index.d.ts +23 -0
  28. package/src/framework/components/Gap/index.jsx +46 -0
  29. package/src/framework/components/LinkButton/index.d.ts +14 -0
  30. package/src/framework/components/LinkButton/index.jsx +10 -0
  31. package/src/framework/components/NamedIcon/index.d.ts +5 -0
  32. package/src/framework/components/NamedIcon/index.jsx +11 -0
  33. package/src/framework/components/OrgTree/index.d.ts +4 -0
  34. package/src/framework/components/OrgTree/index.jsx +58 -0
  35. package/src/framework/components/Page/index.d.ts +17 -0
  36. package/src/framework/components/Page/index.jsx +30 -0
  37. package/src/framework/components/Page/index.less +10 -0
  38. package/src/framework/components/PageLoading/index.d.ts +1 -0
  39. package/src/framework/components/PageLoading/index.jsx +25 -0
  40. package/src/framework/components/ProModal/index.tsx +66 -0
  41. package/src/framework/components/ProTable/components/ToolBar/index.jsx +123 -0
  42. package/src/framework/components/ProTable/components/ToolBar/index.less +53 -0
  43. package/src/framework/components/ProTable/index.d.ts +42 -0
  44. package/src/framework/components/ProTable/index.jsx +260 -0
  45. package/src/framework/components/ProTable/index.less +14 -0
  46. package/src/framework/components/ProTable/utils/index.js +43 -0
  47. package/src/framework/components/RoleTree/index.d.ts +4 -0
  48. package/src/framework/components/RoleTree/index.jsx +50 -0
  49. package/src/framework/components/ValueType/index.jsx +34 -0
  50. package/src/framework/components/ValueType/registry.jsx +26 -0
  51. package/src/framework/components/ViewRange/index.d.ts +14 -0
  52. package/src/framework/components/ViewRange/index.jsx +20 -0
  53. package/src/framework/components/index.ts +13 -0
  54. package/src/framework/components/system/ButtonList.d.ts +8 -0
  55. package/src/framework/components/system/ButtonList.jsx +42 -0
  56. package/src/framework/components/system/HasPerm.tsx +14 -0
  57. package/src/framework/components/system/index.tsx +29 -0
  58. package/src/framework/fields/FieldBoolean/index.d.ts +9 -0
  59. package/src/framework/fields/FieldBoolean/index.jsx +73 -0
  60. package/src/framework/fields/FieldDate/index.d.ts +23 -0
  61. package/src/framework/fields/FieldDate/index.jsx +116 -0
  62. package/src/framework/fields/FieldDateRange/index.d.ts +22 -0
  63. package/src/framework/fields/FieldDateRange/index.jsx +103 -0
  64. package/src/framework/fields/FieldDictSelect/index.d.ts +12 -0
  65. package/src/framework/fields/FieldDictSelect/index.jsx +16 -0
  66. package/src/framework/fields/FieldEditor/index.d.ts +14 -0
  67. package/src/framework/fields/FieldEditor/index.jsx +59 -0
  68. package/src/framework/fields/FieldNumberRange/index.d.ts +10 -0
  69. package/src/framework/fields/FieldNumberRange/index.jsx +55 -0
  70. package/src/framework/fields/FieldPercent/index.d.ts +8 -0
  71. package/src/framework/fields/FieldPercent/index.jsx +30 -0
  72. package/src/framework/fields/FieldRemoteSelect/index.d.ts +44 -0
  73. package/src/framework/fields/FieldRemoteSelect/index.jsx +125 -0
  74. package/src/framework/fields/FieldRemoteSelectMultiple/index.d.ts +20 -0
  75. package/src/framework/fields/FieldRemoteSelectMultiple/index.jsx +85 -0
  76. package/src/framework/fields/FieldRemoteSelectMultipleInline/index.d.ts +21 -0
  77. package/src/framework/fields/FieldRemoteSelectMultipleInline/index.jsx +88 -0
  78. package/src/framework/fields/FieldRemoteTree/index.d.ts +20 -0
  79. package/src/framework/fields/FieldRemoteTree/index.jsx +50 -0
  80. package/src/framework/fields/FieldRemoteTreeCascader/index.d.ts +18 -0
  81. package/src/framework/fields/FieldRemoteTreeCascader/index.jsx +59 -0
  82. package/src/framework/fields/FieldRemoteTreeSelect/index.d.ts +19 -0
  83. package/src/framework/fields/FieldRemoteTreeSelect/index.jsx +57 -0
  84. package/src/framework/fields/FieldRemoteTreeSelectMultiple/index.d.ts +20 -0
  85. package/src/framework/fields/FieldRemoteTreeSelectMultiple/index.jsx +62 -0
  86. package/src/framework/fields/FieldSysOrgTree/index.d.ts +9 -0
  87. package/src/framework/fields/FieldSysOrgTree/index.jsx +20 -0
  88. package/src/framework/fields/FieldSysOrgTreeSelect/index.d.ts +9 -0
  89. package/src/framework/fields/FieldSysOrgTreeSelect/index.jsx +22 -0
  90. package/src/framework/fields/FieldTable/index.d.ts +14 -0
  91. package/src/framework/fields/FieldTable/index.jsx +108 -0
  92. package/src/framework/fields/FieldTable/styles.less +29 -0
  93. package/src/framework/fields/FieldTableSelect/index.d.ts +19 -0
  94. package/src/framework/fields/FieldTableSelect/index.jsx +60 -0
  95. package/src/framework/fields/FieldUploadFile/index.d.ts +31 -0
  96. package/src/framework/fields/FieldUploadFile/index.jsx +139 -0
  97. package/src/framework/fields/index.ts +22 -0
  98. package/src/framework/fields/types.ts +16 -0
  99. package/src/framework/index.ts +5 -0
  100. package/src/framework/pages/LoginPage.d.ts +16 -0
  101. package/src/framework/pages/LoginPage.jsx +135 -0
  102. package/src/framework/pages/LoginPage.less +53 -0
  103. package/src/framework/pages/LoginPageUtils.ts +36 -0
  104. package/src/framework/pages/index.ts +2 -0
  105. package/src/framework/utils/ArrUtils.ts +229 -0
  106. package/src/framework/utils/ColorsUtils.ts +378 -0
  107. package/src/framework/utils/DateUtils.ts +187 -0
  108. package/src/framework/utils/DeviceUtils.ts +46 -0
  109. package/src/framework/utils/DomUtils.ts +50 -0
  110. package/src/framework/utils/EventBusUtils.ts +144 -0
  111. package/src/framework/utils/Logger.ts +40 -0
  112. package/src/framework/utils/MessageUtils.tsx +170 -0
  113. package/src/framework/utils/ObjectUtils.ts +118 -0
  114. package/src/framework/utils/StorageUtils.ts +50 -0
  115. package/src/framework/utils/StringUtils.ts +436 -0
  116. package/src/framework/utils/TreeUtils.ts +251 -0
  117. package/src/framework/utils/UrlUtils.ts +152 -0
  118. package/src/framework/utils/UuidUtils.ts +88 -0
  119. package/src/framework/utils/ValidateUtils.ts +28 -0
  120. package/src/framework/utils/index.ts +15 -0
  121. package/src/framework/utils/system/DictUtils.ts +97 -0
  122. package/src/framework/utils/system/FormRegistryUtils.ts +77 -0
  123. package/src/framework/utils/system/HttpUtils.ts +247 -0
  124. package/src/framework/utils/system/PageUtils.ts +163 -0
  125. package/src/framework/utils/system/PermUtils.ts +79 -0
  126. package/src/framework/utils/system/SysUtils.ts +97 -0
  127. package/src/framework/utils/system/ThemeUtils.ts +27 -0
  128. package/src/framework/utils/system/index.ts +7 -0
  129. package/src/framework/views/ViewApproveStatus/index.d.ts +3 -0
  130. package/src/framework/views/ViewApproveStatus/index.jsx +21 -0
  131. package/src/framework/views/ViewBoolean/index.d.ts +3 -0
  132. package/src/framework/views/ViewBoolean/index.jsx +4 -0
  133. package/src/framework/views/ViewBooleanEnableDisable/index.d.ts +5 -0
  134. package/src/framework/views/ViewBooleanEnableDisable/index.jsx +15 -0
  135. package/src/framework/views/ViewFile/index.d.ts +10 -0
  136. package/src/framework/views/ViewFile/index.jsx +49 -0
  137. package/src/framework/views/ViewFileButton/index.d.ts +10 -0
  138. package/src/framework/views/ViewFileButton/index.jsx +22 -0
  139. package/src/framework/views/ViewImage/index.d.ts +6 -0
  140. package/src/framework/views/ViewImage/index.jsx +60 -0
  141. package/src/framework/views/ViewPassword/index.d.ts +5 -0
  142. package/src/framework/views/ViewPassword/index.jsx +24 -0
  143. package/src/framework/views/ViewProcessInstanceProgress/index.d.ts +12 -0
  144. package/src/framework/views/ViewProcessInstanceProgress/index.jsx +97 -0
  145. package/src/framework/views/ViewProcessInstanceProgressButton/index.d.ts +6 -0
  146. package/src/framework/views/ViewProcessInstanceProgressButton/index.jsx +24 -0
  147. package/src/framework/views/ViewText/index.d.ts +16 -0
  148. package/src/framework/views/ViewText/index.jsx +42 -0
  149. package/src/framework/views/index.ts +12 -0
  150. package/src/framework/views/types.ts +26 -0
  151. package/src/index.ts +2 -0
  152. package/src/layouts/PageRender.d.ts +22 -0
  153. package/src/layouts/PageRender.jsx +90 -0
  154. package/src/layouts/admin/HeaderRight.jsx +104 -0
  155. package/src/layouts/admin/TabPageRender.jsx +158 -0
  156. package/src/layouts/admin/index.jsx +159 -0
  157. package/src/layouts/admin/index.less +65 -0
  158. package/src/layouts/index.jsx +187 -0
  159. package/src/layouts/index.less +24 -0
  160. package/src/loading.jsx +18 -0
  161. package/src/pages/404.jsx +13 -0
  162. package/src/pages/about.jsx +12 -0
  163. package/src/pages/index.jsx +10 -0
  164. package/src/pages/login.jsx +16 -0
  165. package/src/pages/system/api/ApiDoc.jsx +148 -0
  166. package/src/pages/system/api/index.jsx +267 -0
  167. package/src/pages/system/api/perm.jsx +69 -0
  168. package/src/pages/system/dict/Dict.jsx +67 -0
  169. package/src/pages/system/dict/DictItem.jsx +175 -0
  170. package/src/pages/system/dict/index.jsx +25 -0
  171. package/src/pages/system/file/index.jsx +147 -0
  172. package/src/pages/system/job/index.jsx +324 -0
  173. package/src/pages/system/log/index.jsx +77 -0
  174. package/src/pages/system/org/index.jsx +260 -0
  175. package/src/pages/system/role/index.jsx +302 -0
  176. package/src/pages/system/role/perm.jsx +107 -0
  177. package/src/pages/system/sysManual/index.jsx +126 -0
  178. package/src/pages/system/user/UserPerm.jsx +94 -0
  179. package/src/pages/system/user/index.jsx +253 -0
  180. package/src/pages/test/views.jsx +95 -0
  181. package/src/pages/ureport/index.jsx +16 -0
  182. package/src/pages/userCenter/ChangePassword.jsx +64 -0
  183. package/src/pages/userCenter/index.jsx +90 -0
  184. package/src/pages/userCenter/manual.jsx +57 -0
  185. package/src/pages/userCenter/message.jsx +103 -0
  186. package/src/style/global.less +51 -0
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import {Spin} from "antd";
3
+ import {ThemeUtils} from "./framework";
4
+
5
+ export default class extends React.Component {
6
+ render() {
7
+ return <div
8
+ style={{
9
+ display: 'flex',
10
+ alignItems: 'center',
11
+ justifyContent: 'center',
12
+ height: '100vh',
13
+ background: ThemeUtils.getColor("background-color")
14
+ }}>
15
+ <Spin size='large'/>
16
+ </div>
17
+ }
18
+ }
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import {Result} from "antd";
3
+
4
+ export default class extends React.Component {
5
+
6
+ render() {
7
+ return <Result
8
+ status={404}
9
+ title='页面不存在'
10
+ />
11
+
12
+ }
13
+ }
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+
3
+ export default class extends React.Component {
4
+
5
+
6
+ render() {
7
+ return <>
8
+ <h1>关于</h1>
9
+ </>
10
+
11
+ }
12
+ }
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import {Card} from "antd";
3
+
4
+
5
+ export default function () {
6
+
7
+ return <Card>
8
+ 欢迎使用本系统
9
+ </Card>
10
+ }
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+
3
+ import {LoginPage} from "../framework/pages/LoginPage";
4
+
5
+
6
+ export default class extends React.Component {
7
+
8
+
9
+ render() {
10
+ return <LoginPage/>
11
+ // 支持自定义
12
+ // return <LoginPage form={<Button type={"primary"} size='large'>xx登录</Button>} />
13
+ }
14
+
15
+
16
+ }
@@ -0,0 +1,148 @@
1
+ import React from "react";
2
+ import {FieldRemoteSelect, HttpUtils, PageUtils} from "../../../framework";
3
+ import {Button, Descriptions, message, Space, Table, Typography} from "antd";
4
+
5
+ const {Title, Paragraph, Text, Link} = Typography;
6
+
7
+ export class ApiDoc extends React.Component {
8
+
9
+ state = {
10
+ url: null,
11
+ appId: null,
12
+ apiList: [],
13
+ frameworkVersion: null,
14
+ errorList: []
15
+ }
16
+
17
+ columns = [
18
+ {dataIndex: 'name', title: '名称', width: 150},
19
+ {dataIndex: 'type', title: '类型', width: 100},
20
+ {
21
+ dataIndex: 'required', title: '必填', width: 100, render: v => {
22
+ if (v == null) {
23
+ return null;
24
+ }
25
+ return v ? '是' : '否';
26
+ }
27
+ },
28
+ {dataIndex: 'desc', title: '描述'},
29
+ ]
30
+
31
+ componentDidMount() {
32
+ const id = PageUtils.currentParams().id
33
+ this.loadData(id);
34
+
35
+ let url = window.location.protocol + '//' + window.location.host
36
+ this.setState({url})
37
+ }
38
+
39
+ async loadData(id) {
40
+ const hide = message.loading('加载中...', 0)
41
+ const rs = await HttpUtils.get('admin/apiAccount/docInfo', {id})
42
+ this.setState(rs)
43
+ hide()
44
+ }
45
+
46
+
47
+ render() {
48
+ const {apiList} = this.state
49
+ return <div>
50
+
51
+ <Space>
52
+ <FieldRemoteSelect url='admin/apiAccount/accountOptions' placeholder='请选择账号'
53
+ onChange={v => this.loadData(v)}/>
54
+ <Button type='primary'>导出PDF</Button>
55
+ </Space>
56
+ <div id='doc-content'>
57
+ <Title level={1}>接口说明文档</Title>
58
+
59
+ <Title level={2}>一、基本信息</Title>
60
+ <Paragraph>
61
+ <Descriptions column={1} bordered size='small'>
62
+ <Descriptions.Item label='请求地址'>
63
+ {this.state.url}/api/gateway/接口名称
64
+ </Descriptions.Item>
65
+ <Descriptions.Item label='appId'>
66
+ 私发
67
+ </Descriptions.Item>
68
+ <Descriptions.Item label='appSecret'>
69
+ 私发
70
+ </Descriptions.Item>
71
+ </Descriptions>
72
+
73
+ </Paragraph>
74
+
75
+
76
+ <Paragraph>
77
+ <Typography.Text>
78
+ <div>
79
+ 请求使用HTTP POST发送,请求参数也使用json格式
80
+ </div>
81
+ <div> 响应报文以JSON方式返回</div>
82
+ </Typography.Text>
83
+ </Paragraph>
84
+
85
+
86
+ <Title level={4}>请求头</Title>
87
+
88
+ <Table rowKey='name' columns={this.columns} bordered dataSource={[
89
+ {name: 'appId', type: 'String', required: true, desc: '账号标识,appId'},
90
+ {name: 'timestamp', type: 'String', required: true, desc: '时间戳,当前UNIX时间戳,13位,精确到毫秒'},
91
+ {
92
+ name: 'sign',
93
+ type: 'String',
94
+ required: true,
95
+ desc: '数据签名,appId + appSecret + timestamp拼接后,进行md5摘要,值为32位小写'
96
+ },
97
+ ]} size='small' pagination={false}>
98
+ </Table>
99
+
100
+
101
+ <Typography.Title level={4}>公共错误码</Typography.Title>
102
+ <Table columns={[
103
+ {dataIndex: 'code', title: '错误码'},
104
+ {dataIndex: 'message', title: '错误描述'}
105
+ ]} rowKey='code' bordered dataSource={this.state.errorList} size='small' pagination={false}>
106
+ </Table>
107
+
108
+ <Typography.Title level={2}>二、接口列表</Typography.Title>
109
+ {apiList.map((api, index) => {
110
+ return <div key={index}>
111
+ <Typography.Title level={3}>{api.name} </Typography.Title>
112
+ <p>接口名称: {api.action}</p>
113
+ <p>功能描述:{api.desc}</p>
114
+
115
+
116
+ <Title level={5}>请求参数</Title>
117
+ <Table rowKey='name' columns={this.columns} bordered dataSource={api.parameterList}
118
+ size='small' pagination={false}>
119
+ </Table>
120
+
121
+ <Title level={5}>响应数据</Title>
122
+ <Table columns={this.columns} bordered
123
+ rowKey={'name'}
124
+ dataSource={[
125
+ {name: 'code', type: 'int', required: true, desc: '响应码,0表示成功'},
126
+ {name: 'message', type: 'String', required: false, desc: '结果提示信息'},
127
+ {name: 'data', type: api.returnType, required: false, desc: '返回数据'}
128
+ ]} size='small' pagination={false}>
129
+ </Table>
130
+ {api.returnList != null && api.returnList.length > 0 && <>
131
+ <Title level={5}>data 对象 {api.returnType} 说明</Title>
132
+
133
+ <Table columns={this.columns}
134
+ rowKey={'name'}
135
+ bordered
136
+ dataSource={api.returnList} size='small' pagination={false}>
137
+ </Table>
138
+ </>
139
+ }
140
+
141
+ </div>
142
+ })}
143
+
144
+
145
+ </div>
146
+ </div>
147
+ }
148
+ }
@@ -0,0 +1,267 @@
1
+ import {PlusOutlined} from '@ant-design/icons'
2
+ import {Button, Form, Input, Modal, Popconfirm, Tabs} from 'antd'
3
+ import React from 'react'
4
+ import {
5
+ ButtonList,
6
+ FieldBoolean,
7
+ FieldDate,
8
+ HttpUtils,
9
+ Page,
10
+ PageUtils,
11
+ ProTable,
12
+ StringUtils,
13
+ ViewPassword
14
+ } from "../../../framework";
15
+ import {ApiDoc} from "./ApiDoc";
16
+
17
+
18
+ export default class extends React.Component {
19
+
20
+ state = {
21
+ formValues: {},
22
+ formOpen: false
23
+ }
24
+
25
+ formRef = React.createRef()
26
+ tableRef = React.createRef()
27
+
28
+ handleAdd = () => {
29
+ this.setState({formOpen: true, formValues: {}})
30
+ }
31
+
32
+ handleEdit = record => {
33
+ this.setState({formOpen: true, formValues: record})
34
+ }
35
+
36
+ onFinish = values => {
37
+ HttpUtils.post('admin/apiAccount/save', values).then(rs => {
38
+ this.setState({formOpen: false})
39
+ this.tableRef.current.reload()
40
+ })
41
+ }
42
+
43
+ handleDelete = record => {
44
+ HttpUtils.get('admin/apiAccount/delete', {id: record.id}).then(rs => {
45
+ this.tableRef.current.reload()
46
+ })
47
+ }
48
+
49
+ columns = [
50
+ {
51
+ title: '名称',
52
+ dataIndex: 'name',
53
+ },
54
+ {
55
+ title: 'appId',
56
+ dataIndex: 'appId',
57
+ },
58
+
59
+ {
60
+ title: 'appSecret',
61
+ dataIndex: 'appSecret',
62
+ render(v) {
63
+ return <ViewPassword value={v}></ViewPassword>;
64
+ }
65
+ },
66
+ {
67
+ title: '准入IP',
68
+ dataIndex: 'accessIp',
69
+ },
70
+ {
71
+ title: '有效期',
72
+ dataIndex: 'endTime',
73
+ },
74
+ {
75
+ title: '启用',
76
+ dataIndex: 'enable',
77
+ render(v) {
78
+ return v == null ? null : (v ? '是' : '否')
79
+ },
80
+ },
81
+ {
82
+ title: '操作',
83
+ dataIndex: 'option',
84
+ render: (_, record) => (
85
+ <ButtonList>
86
+ <Button size='small' perm='api'
87
+ onClick={() => PageUtils.open('/system/api/perm?accountId=' + record.id, '账户权限')}
88
+ type='primary'>权限</Button>
89
+ <Button size='small' perm='api' onClick={() => this.handleEdit(record)}>编辑</Button>
90
+ <Popconfirm perm='api' title='是否确定删除接口访客' onConfirm={() => this.handleDelete(record)}>
91
+ <Button size='small'>删除</Button>
92
+ </Popconfirm>
93
+ </ButtonList>
94
+ ),
95
+ },
96
+ ]
97
+
98
+ randomAppSecret = () => {
99
+ const appSecret = StringUtils.random(32)
100
+ this.formRef.current.setFieldsValue({appSecret})
101
+ }
102
+
103
+ render() {
104
+ return <Page padding>
105
+ <Tabs items={[
106
+
107
+ {
108
+ label: '接口列表',
109
+ key: '2',
110
+ children: <ProTable
111
+ rowKey='action'
112
+ columns={[
113
+ {dataIndex: 'name', title: '名称'},
114
+ {dataIndex: 'action', title: '动作'},
115
+ {dataIndex: 'desc', title: '描述'},
116
+
117
+ ]}
118
+ request={(params,) => HttpUtils.get('admin/api/resource/page', params)}
119
+ />
120
+ },
121
+
122
+ {
123
+ label: '账号列表',
124
+ key: '1',
125
+ children: <ProTable
126
+ actionRef={this.tableRef}
127
+ toolBarRender={() => {
128
+ return <ButtonList>
129
+ <Button perm='api' type='primary' onClick={this.handleAdd}>
130
+ <PlusOutlined/> 新增
131
+ </Button>
132
+ </ButtonList>
133
+ }}
134
+ request={(params) => HttpUtils.get('admin/apiAccount/page', params)}
135
+ columns={this.columns}
136
+ />
137
+ }, {
138
+ label: '接口文档',
139
+ key: '3',
140
+ children: <ApiDoc/>
141
+ },
142
+ {
143
+ label: '访问记录',
144
+ key: '4',
145
+ children: <ProTable
146
+ request={(params) => HttpUtils.get('admin/apiAccessLog/page', params)}
147
+ columns={[
148
+
149
+ {
150
+ title: '接口名称',
151
+ dataIndex: 'name',
152
+
153
+
154
+ },
155
+
156
+ {
157
+ title: '接口',
158
+ dataIndex: 'action',
159
+
160
+
161
+ },
162
+
163
+ {
164
+ title: 'requestId',
165
+ dataIndex: 'requestId',
166
+
167
+ },
168
+
169
+ {
170
+ title: '请求数据',
171
+ dataIndex: 'requestData',
172
+
173
+
174
+ },
175
+
176
+ {
177
+ title: '响应数据',
178
+ dataIndex: 'responseData',
179
+
180
+
181
+ },
182
+
183
+ {
184
+ title: 'ip',
185
+ dataIndex: 'ip',
186
+
187
+
188
+ },
189
+
190
+ {
191
+ title: 'ipLocation',
192
+ dataIndex: 'ipLocation',
193
+
194
+
195
+ },
196
+
197
+ {
198
+ title: '执行时间',
199
+ dataIndex: 'executionTime',
200
+
201
+
202
+ },
203
+
204
+ {
205
+ title: '接口账户',
206
+ dataIndex: 'accountName',
207
+
208
+
209
+ },
210
+
211
+
212
+ ]}
213
+ />
214
+ },
215
+
216
+ ]}>
217
+
218
+ </Tabs>
219
+
220
+
221
+ <Modal title='接口访客'
222
+ open={this.state.formOpen}
223
+ onOk={() => this.formRef.current.submit()}
224
+ onCancel={() => this.setState({formOpen: false})}
225
+ destroyOnHidden
226
+ maskClosable={false}
227
+ >
228
+
229
+ <Form ref={this.formRef} labelCol={{flex: '100px'}}
230
+ initialValues={this.state.formValues}
231
+ onFinish={this.onFinish}
232
+
233
+ >
234
+ <Form.Item name='id' noStyle></Form.Item>
235
+
236
+ <Form.Item label='名称' name='name' rules={[{required: true}]}>
237
+ <Input/>
238
+ </Form.Item>
239
+
240
+
241
+ <Form.Item label='appId' name='appId'>
242
+ <Input placeholder='多个用逗号分隔'/>
243
+ </Form.Item>
244
+ <Form.Item label='appSecret' name='appSecret' rules={[{required: true}, {len: 32}]}
245
+ help={<Button size='small' type='link' onClick={this.randomAppSecret}>随机生成</Button>}
246
+ >
247
+ <Input/>
248
+ </Form.Item>
249
+
250
+ <Form.Item label='准入IP' name='accessIp'>
251
+ <Input placeholder='多个用逗号分隔'/>
252
+ </Form.Item>
253
+ <Form.Item label='有效期' name='endTime' style={{marginTop: 32}}>
254
+ <FieldDate type='YYYY-MM-DD'/>
255
+ </Form.Item>
256
+ <Form.Item label='启用' name='enable' rules={[{required: true}]}>
257
+ <FieldBoolean/>
258
+ </Form.Item>
259
+
260
+ </Form>
261
+ </Modal>
262
+ </Page>
263
+
264
+
265
+ }
266
+ }
267
+
@@ -0,0 +1,69 @@
1
+ import {message, Switch} from 'antd'
2
+ import React from 'react'
3
+ import {ArrUtils, HttpUtils, Page, PageUtils, ProTable} from "../../../framework";
4
+
5
+
6
+ export default class extends React.Component {
7
+
8
+
9
+ state = {
10
+ perms: []
11
+ }
12
+
13
+ constructor(props) {
14
+ super(props);
15
+ this.accountId = PageUtils.currentParams().accountId
16
+ }
17
+
18
+ async componentDidMount() {
19
+ const rs = await HttpUtils.get('admin/apiAccount/get', {id: this.accountId})
20
+ this.setState({perms: rs.perms})
21
+ }
22
+
23
+ onChange = async (action, checked) => {
24
+ const hide = message.loading('保存中...', 0)
25
+ await HttpUtils.post('admin/apiAccount/grant', {accountId: this.accountId, action, checked});
26
+
27
+ const perms = this.state.perms
28
+ if (checked) {
29
+ ArrUtils.add(perms, action)
30
+ } else {
31
+ ArrUtils.remove(perms, action)
32
+ }
33
+ this.setState({perms})
34
+ hide();
35
+ }
36
+
37
+
38
+ render() {
39
+ return <Page>
40
+
41
+
42
+ <ProTable
43
+ rowKey='action'
44
+ columns={[
45
+ {dataIndex: 'name', title: '名称'},
46
+ {dataIndex: 'action', title: '动作'},
47
+ {dataIndex: 'desc', title: '描述'},
48
+ {
49
+ dataIndex: 'option', title: '操作',
50
+ render: (_, record) => {
51
+ let action = record.action;
52
+ return <Switch checked={this.state.perms.includes(action)}
53
+ onChange={(checked) => {
54
+ this.onChange(action, checked)
55
+
56
+ }}> </Switch>
57
+ }
58
+ }
59
+ ]}
60
+ request={(params,) => HttpUtils.get('admin/api/resource/page', params)}
61
+ />
62
+
63
+ </Page>
64
+
65
+
66
+ }
67
+ }
68
+
69
+
@@ -0,0 +1,67 @@
1
+ import React from 'react'
2
+ import {HttpUtils, ProTable} from "../../../framework";
3
+
4
+
5
+ export default class extends React.Component {
6
+
7
+ state = {
8
+ formValues: {},
9
+ formOpen: false,
10
+ selectedRowKeys: []
11
+ }
12
+
13
+ formRef = React.createRef()
14
+ tableRef = React.createRef()
15
+
16
+ columns = [
17
+
18
+
19
+ {
20
+ title: '编码',
21
+ dataIndex: 'code',
22
+
23
+
24
+ },
25
+ {
26
+ title: '文本',
27
+ dataIndex: 'text',
28
+ },
29
+
30
+
31
+ ]
32
+
33
+
34
+ render() {
35
+ return <>
36
+ <ProTable
37
+ actionRef={this.tableRef}
38
+
39
+ request={(params) => HttpUtils.get('admin/sysDict/page', params)}
40
+ columns={this.columns}
41
+ rowKey='id'
42
+
43
+ rowSelection={{
44
+ type: 'radio',
45
+ selectedRowKeys: this.state.selectedRowKeys,
46
+ onChange: (selectedRowKeys, selectedRows) => {
47
+ this.setState({selectedRowKeys: selectedRowKeys})
48
+ this.props.onChange(selectedRowKeys[0])
49
+ }
50
+ }}
51
+ onRow={(record) => ({
52
+ onClick: () => {
53
+ this.setState({selectedRowKeys: [record.id]})
54
+ this.props.onChange(record.id)
55
+ }
56
+ })}
57
+ />
58
+
59
+
60
+ </>
61
+
62
+
63
+ }
64
+ }
65
+
66
+
67
+