@jiangood/open-admin 1.2.8 → 1.3.0
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.
- package/config/config.js +8 -1
- package/package.json +1 -1
- package/src/.umi-production/appData.json +294 -304
- package/src/.umi-production/core/helmet.ts +1 -1
- package/src/.umi-production/core/history.ts +1 -1
- package/src/.umi-production/core/historyIntelli.ts +1 -1
- package/src/.umi-production/core/route.tsx +1 -3
- package/src/.umi-production/exports.ts +3 -3
- package/src/.umi-production/testBrowser.tsx +1 -1
- package/src/.umi-production/tsconfig.json +1 -1
- package/src/.umi-production/umi.ts +2 -2
- package/src/pages/system/api/index.jsx +93 -81
- package/src/pages/system/api/ApiDoc.jsx +0 -148
- package/src/pages/system/api/perm.jsx +0 -69
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// This file is generated by Umi automatically
|
|
3
3
|
// DO NOT CHANGE IT MANUALLY!
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { HelmetProvider } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.
|
|
5
|
+
import { HelmetProvider } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@umijs/renderer-react';
|
|
6
6
|
import { context } from './helmetContext';
|
|
7
7
|
|
|
8
8
|
export const innerProvider = (container) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// This file is generated by Umi automatically
|
|
3
3
|
// DO NOT CHANGE IT MANUALLY!
|
|
4
|
-
import { createHashHistory, createMemoryHistory, createBrowserHistory } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.
|
|
4
|
+
import { createHashHistory, createMemoryHistory, createBrowserHistory } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@umijs/renderer-react';
|
|
5
5
|
import type { UmiHistory } from './historyIntelli';
|
|
6
6
|
|
|
7
7
|
let history: UmiHistory;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// This file is generated by Umi automatically
|
|
3
3
|
// DO NOT CHANGE IT MANUALLY!
|
|
4
4
|
import { getRoutes } from './route'
|
|
5
|
-
import type { History } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.
|
|
5
|
+
import type { History } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@umijs/renderer-react'
|
|
6
6
|
|
|
7
7
|
type Routes = Awaited<ReturnType<typeof getRoutes>>['routes']
|
|
8
8
|
type AllRoute = Routes[keyof Routes]
|
|
@@ -19,7 +19,7 @@ if (process.env.NODE_ENV === 'development') {
|
|
|
19
19
|
import React from 'react';
|
|
20
20
|
|
|
21
21
|
export async function getRoutes() {
|
|
22
|
-
const routes = {"404":{"path":"*","id":"404","parentId":"@@/global-layout"},"userCenter/ChangePassword":{"path":"userCenter/ChangePassword","id":"userCenter/ChangePassword","parentId":"@@/global-layout"},"system/sysManual/index":{"path":"system/sysManual","id":"system/sysManual/index","parentId":"@@/global-layout"},"system/user/UserPerm":{"path":"system/user/UserPerm","id":"system/user/UserPerm","parentId":"@@/global-layout"},"userCenter/message":{"path":"userCenter/message","id":"userCenter/message","parentId":"@@/global-layout"},"system/
|
|
22
|
+
const routes = {"404":{"path":"*","id":"404","parentId":"@@/global-layout"},"userCenter/ChangePassword":{"path":"userCenter/ChangePassword","id":"userCenter/ChangePassword","parentId":"@@/global-layout"},"system/sysManual/index":{"path":"system/sysManual","id":"system/sysManual/index","parentId":"@@/global-layout"},"system/user/UserPerm":{"path":"system/user/UserPerm","id":"system/user/UserPerm","parentId":"@@/global-layout"},"userCenter/message":{"path":"userCenter/message","id":"userCenter/message","parentId":"@@/global-layout"},"system/dict/index":{"path":"system/dict","id":"system/dict/index","parentId":"@@/global-layout"},"system/file/index":{"path":"system/file","id":"system/file/index","parentId":"@@/global-layout"},"system/role/index":{"path":"system/role","id":"system/role/index","parentId":"@@/global-layout"},"system/user/index":{"path":"system/user","id":"system/user/index","parentId":"@@/global-layout"},"userCenter/manual":{"path":"userCenter/manual","id":"userCenter/manual","parentId":"@@/global-layout"},"system/api/index":{"path":"system/api","id":"system/api/index","parentId":"@@/global-layout"},"system/job/index":{"path":"system/job","id":"system/job/index","parentId":"@@/global-layout"},"system/log/index":{"path":"system/log","id":"system/log/index","parentId":"@@/global-layout"},"system/org/index":{"path":"system/org","id":"system/org/index","parentId":"@@/global-layout"},"system/role/perm":{"path":"system/role/perm","id":"system/role/perm","parentId":"@@/global-layout"},"userCenter/index":{"path":"userCenter","id":"userCenter/index","parentId":"@@/global-layout"},"test/views":{"path":"test/views","id":"test/views","parentId":"@@/global-layout"},"about":{"path":"about","id":"about","parentId":"@@/global-layout"},"index":{"path":"/","id":"index","parentId":"@@/global-layout"},"login":{"path":"login","id":"login","parentId":"@@/global-layout"},"@@/global-layout":{"id":"@@/global-layout","path":"/","isLayout":true}} as const;
|
|
23
23
|
return {
|
|
24
24
|
routes,
|
|
25
25
|
routeComponents: {
|
|
@@ -28,7 +28,6 @@ export async function getRoutes() {
|
|
|
28
28
|
'system/sysManual/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__sysManual__index" */'../../../src/pages/system/sysManual/index.jsx')),
|
|
29
29
|
'system/user/UserPerm': React.lazy(() => import(/* webpackChunkName: "src__pages__system__user__UserPerm" */'../../../src/pages/system/user/UserPerm.jsx')),
|
|
30
30
|
'userCenter/message': React.lazy(() => import(/* webpackChunkName: "src__pages__userCenter__message" */'../../../src/pages/userCenter/message.jsx')),
|
|
31
|
-
'system/api/ApiDoc': React.lazy(() => import(/* webpackChunkName: "src__pages__system__api__ApiDoc" */'../../../src/pages/system/api/ApiDoc.jsx')),
|
|
32
31
|
'system/dict/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__dict__index" */'../../../src/pages/system/dict/index.jsx')),
|
|
33
32
|
'system/file/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__file__index" */'../../../src/pages/system/file/index.jsx')),
|
|
34
33
|
'system/role/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__role__index" */'../../../src/pages/system/role/index.jsx')),
|
|
@@ -40,7 +39,6 @@ export async function getRoutes() {
|
|
|
40
39
|
'system/org/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__org__index" */'../../../src/pages/system/org/index.jsx')),
|
|
41
40
|
'system/role/perm': React.lazy(() => import(/* webpackChunkName: "src__pages__system__role__perm" */'../../../src/pages/system/role/perm.jsx')),
|
|
42
41
|
'userCenter/index': React.lazy(() => import(/* webpackChunkName: "src__pages__userCenter__index" */'../../../src/pages/userCenter/index.jsx')),
|
|
43
|
-
'system/api/perm': React.lazy(() => import(/* webpackChunkName: "src__pages__system__api__perm" */'../../../src/pages/system/api/perm.jsx')),
|
|
44
42
|
'test/views': React.lazy(() => import(/* webpackChunkName: "src__pages__test__views" */'../../../src/pages/test/views.jsx')),
|
|
45
43
|
'about': React.lazy(() => import(/* webpackChunkName: "src__pages__about" */'../../../src/pages/about.jsx')),
|
|
46
44
|
'index': React.lazy(() => import(/* webpackChunkName: "src__pages__index" */'../../../src/pages/index.jsx')),
|
|
@@ -7,10 +7,10 @@ export type { RuntimeConfig } from './core/defineApp'
|
|
|
7
7
|
// plugins
|
|
8
8
|
// plugins types.d.ts
|
|
9
9
|
// @umijs/renderer-*
|
|
10
|
-
export { createBrowserHistory, createHashHistory, createMemoryHistory, Helmet, HelmetProvider, createSearchParams, generatePath, matchPath, matchRoutes, Navigate, NavLink, Outlet, resolvePath, useLocation, useMatch, useNavigate, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes, useSearchParams, useAppData, useClientLoaderData, useLoaderData, useRouteProps, useSelectedRoutes, useServerLoaderData, renderClient, __getRoot, Link, useRouteData, __useFetcher, withRouter } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.
|
|
11
|
-
export type { History, ClientLoader } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.
|
|
10
|
+
export { createBrowserHistory, createHashHistory, createMemoryHistory, Helmet, HelmetProvider, createSearchParams, generatePath, matchPath, matchRoutes, Navigate, NavLink, Outlet, resolvePath, useLocation, useMatch, useNavigate, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes, useSearchParams, useAppData, useClientLoaderData, useLoaderData, useRouteProps, useSelectedRoutes, useServerLoaderData, renderClient, __getRoot, Link, useRouteData, __useFetcher, withRouter } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@umijs/renderer-react';
|
|
11
|
+
export type { History, ClientLoader } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@umijs/renderer-react'
|
|
12
12
|
// umi/client/client/plugin
|
|
13
|
-
export { ApplyPluginsType, PluginManager } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/umi@4.6.
|
|
13
|
+
export { ApplyPluginsType, PluginManager } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/umi@4.6.35_@babel+core@7.29.0_@types+node@25.5.0_@types+react@19.2.14_eslint@8.57.1_lig_324092494c2d17912f737a45cfe92a9d/node_modules/umi/client/client/plugin.js';
|
|
14
14
|
export { history, createHistory } from './core/history';
|
|
15
15
|
export { terminal } from './core/terminal';
|
|
16
16
|
// react ssr
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// DO NOT CHANGE IT MANUALLY!
|
|
4
4
|
import React, { useEffect, useState } from 'react';
|
|
5
5
|
import { ApplyPluginsType } from 'umi';
|
|
6
|
-
import { renderClient, RenderClientOpts } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.
|
|
6
|
+
import { renderClient, RenderClientOpts } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@umijs/renderer-react';
|
|
7
7
|
import { createHistory } from './core/history';
|
|
8
8
|
import { createPluginManager } from './core/plugin';
|
|
9
9
|
import { getRoutes } from './core/route';
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"src/.umi/*"
|
|
28
28
|
],
|
|
29
29
|
"umi": [
|
|
30
|
-
"../../node_modules/.pnpm/umi@4.6.
|
|
30
|
+
"../../node_modules/.pnpm/umi@4.6.35_@babel+core@7.29.0_@types+node@25.5.0_@types+react@19.2.14_eslint@8.57.1_lig_324092494c2d17912f737a45cfe92a9d/node_modules/umi"
|
|
31
31
|
],
|
|
32
32
|
"umi/typings": [
|
|
33
33
|
"src/.umi/typings"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// DO NOT CHANGE IT MANUALLY!
|
|
4
4
|
import './core/polyfill';
|
|
5
5
|
|
|
6
|
-
import { renderClient } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.
|
|
6
|
+
import { renderClient } from '/home/runner/work/open-admin/open-admin/web/node_modules/.pnpm/@umijs+renderer-react@4.6.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@umijs/renderer-react';
|
|
7
7
|
import { getRoutes } from './core/route';
|
|
8
8
|
import { createPluginManager } from './core/plugin';
|
|
9
9
|
import { createHistory } from './core/history';
|
|
@@ -78,6 +78,6 @@ render();
|
|
|
78
78
|
|
|
79
79
|
if (typeof window !== 'undefined') {
|
|
80
80
|
window.g_umi = {
|
|
81
|
-
version: '4.6.
|
|
81
|
+
version: '4.6.35',
|
|
82
82
|
};
|
|
83
83
|
}
|
|
@@ -1,30 +1,38 @@
|
|
|
1
1
|
import {PlusOutlined} from '@ant-design/icons'
|
|
2
|
-
import {Button, Form, Input, Modal, Popconfirm, Tabs} from 'antd'
|
|
2
|
+
import {Button, Form, Input, message, Modal, Popconfirm, Switch, Table, Tabs} from 'antd'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import {
|
|
5
|
+
ArrUtils,
|
|
5
6
|
ButtonList,
|
|
6
7
|
FieldBoolean,
|
|
7
8
|
FieldDate,
|
|
8
|
-
HttpUtils,
|
|
9
|
+
HttpUtils, ObjectUtils,
|
|
9
10
|
Page,
|
|
10
|
-
PageUtils,
|
|
11
11
|
ProTable,
|
|
12
12
|
StringUtils,
|
|
13
13
|
ViewPassword
|
|
14
14
|
} from "../../../framework";
|
|
15
|
-
import {ApiDoc} from "./ApiDoc";
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
export default class extends React.Component {
|
|
19
18
|
|
|
20
19
|
state = {
|
|
21
20
|
formValues: {},
|
|
22
|
-
formOpen: false
|
|
21
|
+
formOpen: false,
|
|
22
|
+
|
|
23
|
+
list: [],
|
|
24
|
+
grantFormOpen: false
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
formRef = React.createRef()
|
|
26
28
|
tableRef = React.createRef()
|
|
27
29
|
|
|
30
|
+
componentDidMount() {
|
|
31
|
+
HttpUtils.get("/admin/apiAccount/permList").then(rs => {
|
|
32
|
+
this.setState({list: rs})
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
|
|
28
36
|
handleAdd = () => {
|
|
29
37
|
this.setState({formOpen: true, formValues: {}})
|
|
30
38
|
}
|
|
@@ -48,14 +56,9 @@ export default class extends React.Component {
|
|
|
48
56
|
|
|
49
57
|
columns = [
|
|
50
58
|
{
|
|
51
|
-
title: '
|
|
59
|
+
title: '账户名称',
|
|
52
60
|
dataIndex: 'name',
|
|
53
61
|
},
|
|
54
|
-
{
|
|
55
|
-
title: 'appId',
|
|
56
|
-
dataIndex: 'appId',
|
|
57
|
-
},
|
|
58
|
-
|
|
59
62
|
{
|
|
60
63
|
title: 'appSecret',
|
|
61
64
|
dataIndex: 'appSecret',
|
|
@@ -78,49 +81,75 @@ export default class extends React.Component {
|
|
|
78
81
|
return v == null ? null : (v ? '是' : '否')
|
|
79
82
|
},
|
|
80
83
|
},
|
|
84
|
+
{
|
|
85
|
+
title: '权限',
|
|
86
|
+
dataIndex: 'perms',
|
|
87
|
+
render(perms) {
|
|
88
|
+
if (!perms) {
|
|
89
|
+
return
|
|
90
|
+
}
|
|
91
|
+
return perms.join(', ')
|
|
92
|
+
}
|
|
93
|
+
},
|
|
81
94
|
{
|
|
82
95
|
title: '操作',
|
|
83
96
|
dataIndex: 'option',
|
|
84
97
|
render: (_, record) => (
|
|
85
98
|
<ButtonList>
|
|
86
99
|
<Button size='small' perm='api'
|
|
87
|
-
onClick={() =>
|
|
88
|
-
|
|
100
|
+
onClick={() => {
|
|
101
|
+
this.handlePreGrant(record);
|
|
102
|
+
}}
|
|
103
|
+
type='primary'>授权</Button>
|
|
89
104
|
<Button size='small' perm='api' onClick={() => this.handleEdit(record)}>编辑</Button>
|
|
90
105
|
<Popconfirm perm='api' title='是否确定删除接口访客' onConfirm={() => this.handleDelete(record)}>
|
|
91
106
|
<Button size='small'>删除</Button>
|
|
92
107
|
</Popconfirm>
|
|
108
|
+
<Button size='small' perm='api' href={'/admin/apiAccount/export/' + record.id} target={'_blank'}>下载文档</Button>
|
|
93
109
|
</ButtonList>
|
|
94
110
|
),
|
|
95
111
|
},
|
|
96
112
|
]
|
|
97
113
|
|
|
114
|
+
handlePreGrant(record) {
|
|
115
|
+
this.setState({grantFormOpen: true, formValues: ObjectUtils.clone(record)})
|
|
116
|
+
}
|
|
117
|
+
|
|
98
118
|
randomAppSecret = () => {
|
|
99
119
|
const appSecret = StringUtils.random(32)
|
|
100
120
|
this.formRef.current.setFieldsValue({appSecret})
|
|
101
121
|
}
|
|
102
122
|
|
|
123
|
+
onGrantItemChange = (id, checked) => {
|
|
124
|
+
const perms = this.state.formValues.perms
|
|
125
|
+
if (checked) {
|
|
126
|
+
ArrUtils.add(perms, id)
|
|
127
|
+
} else {
|
|
128
|
+
ArrUtils.remove(perms, id)
|
|
129
|
+
}
|
|
130
|
+
this.setState({formValues: this.state.formValues})
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
onGrant = () => {
|
|
134
|
+
const hide = message.loading('授权中...', 0)
|
|
135
|
+
let accountId = this.state.formValues.id;
|
|
136
|
+
HttpUtils.post('admin/apiAccount/grant/'+accountId, this.state.formValues.perms).then(rs => {
|
|
137
|
+
this.setState({grantFormOpen: false})
|
|
138
|
+
this.tableRef.current.reload()
|
|
139
|
+
}).finally(hide)
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
|
|
103
143
|
render() {
|
|
104
144
|
return <Page padding>
|
|
105
145
|
<Tabs items={[
|
|
106
|
-
|
|
107
146
|
{
|
|
108
|
-
label: '
|
|
109
|
-
key: '
|
|
110
|
-
children: <
|
|
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
|
-
/>
|
|
147
|
+
label: '接口文档',
|
|
148
|
+
key: 'doc',
|
|
149
|
+
children: <iframe src={'/admin/swagger-ui/index.html'} width="100%" height="1000px"></iframe>
|
|
120
150
|
},
|
|
121
|
-
|
|
122
151
|
{
|
|
123
|
-
label: '
|
|
152
|
+
label: '账号管理',
|
|
124
153
|
key: '1',
|
|
125
154
|
children: <ProTable
|
|
126
155
|
actionRef={this.tableRef}
|
|
@@ -134,81 +163,33 @@ export default class extends React.Component {
|
|
|
134
163
|
request={(params) => HttpUtils.get('admin/apiAccount/page', params)}
|
|
135
164
|
columns={this.columns}
|
|
136
165
|
/>
|
|
137
|
-
}, {
|
|
138
|
-
label: '接口文档',
|
|
139
|
-
key: '3',
|
|
140
|
-
children: <ApiDoc/>
|
|
141
166
|
},
|
|
142
167
|
{
|
|
143
168
|
label: '访问记录',
|
|
144
|
-
key: '
|
|
169
|
+
key: 'log',
|
|
145
170
|
children: <ProTable
|
|
146
|
-
request={(params) => HttpUtils.get('admin/
|
|
171
|
+
request={(params) => HttpUtils.get('admin/apiLog/page', params)}
|
|
147
172
|
columns={[
|
|
148
|
-
|
|
149
|
-
{
|
|
150
|
-
title: '接口名称',
|
|
151
|
-
dataIndex: 'name',
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
},
|
|
155
|
-
|
|
156
173
|
{
|
|
157
174
|
title: '接口',
|
|
158
|
-
dataIndex: '
|
|
159
|
-
|
|
160
|
-
|
|
175
|
+
dataIndex: 'url',
|
|
161
176
|
},
|
|
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
177
|
{
|
|
184
178
|
title: 'ip',
|
|
185
179
|
dataIndex: 'ip',
|
|
186
|
-
|
|
187
|
-
|
|
188
180
|
},
|
|
189
|
-
|
|
190
181
|
{
|
|
191
182
|
title: 'ipLocation',
|
|
192
183
|
dataIndex: 'ipLocation',
|
|
193
|
-
|
|
194
|
-
|
|
195
184
|
},
|
|
196
|
-
|
|
197
185
|
{
|
|
198
186
|
title: '执行时间',
|
|
199
187
|
dataIndex: 'executionTime',
|
|
200
|
-
|
|
201
|
-
|
|
202
188
|
},
|
|
203
|
-
|
|
204
189
|
{
|
|
205
190
|
title: '接口账户',
|
|
206
191
|
dataIndex: 'accountName',
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
},
|
|
210
|
-
|
|
211
|
-
|
|
192
|
+
}
|
|
212
193
|
]}
|
|
213
194
|
/>
|
|
214
195
|
},
|
|
@@ -223,7 +204,7 @@ export default class extends React.Component {
|
|
|
223
204
|
onOk={() => this.formRef.current.submit()}
|
|
224
205
|
onCancel={() => this.setState({formOpen: false})}
|
|
225
206
|
destroyOnHidden
|
|
226
|
-
|
|
207
|
+
mask={{closable:false}}
|
|
227
208
|
>
|
|
228
209
|
|
|
229
210
|
<Form ref={this.formRef} labelCol={{flex: '100px'}}
|
|
@@ -259,6 +240,37 @@ export default class extends React.Component {
|
|
|
259
240
|
|
|
260
241
|
</Form>
|
|
261
242
|
</Modal>
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
<Modal title='权限列表' destroyOnHidden={true} width={800}
|
|
246
|
+
open={this.state.grantFormOpen}
|
|
247
|
+
onCancel={() => this.setState({grantFormOpen: false, formValues: null})}
|
|
248
|
+
onOk={this.onGrant}
|
|
249
|
+
>
|
|
250
|
+
<Table
|
|
251
|
+
dataSource={this.state.list}
|
|
252
|
+
pagination={false}
|
|
253
|
+
rowKey='id'
|
|
254
|
+
size={'small'}
|
|
255
|
+
columns={[
|
|
256
|
+
{dataIndex: 'id', title: '标识'},
|
|
257
|
+
{dataIndex: 'name', title: '名称'},
|
|
258
|
+
{dataIndex: 'description', title: '描述'},
|
|
259
|
+
{dataIndex: 'path', title: '路径'},
|
|
260
|
+
{
|
|
261
|
+
dataIndex: 'option', title: '操作',
|
|
262
|
+
render: (_, record) => {
|
|
263
|
+
let id = record.id;
|
|
264
|
+
return <Switch checked={this.state.formValues.perms.includes(id)}
|
|
265
|
+
onChange={(checked) => {
|
|
266
|
+
this.onGrantItemChange(id, checked)
|
|
267
|
+
}} />
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
]}
|
|
271
|
+
|
|
272
|
+
/>
|
|
273
|
+
</Modal>
|
|
262
274
|
</Page>
|
|
263
275
|
|
|
264
276
|
|
|
@@ -1,148 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
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
|
-
|