xydata-tools 1.0.30 → 1.0.32
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/README.md +206 -213
- package/dist/components/aaa/auth/index.js +9 -1
- package/dist/components/aaa/index.js +4 -1
- package/dist/components/aaa/security-layout/index.js +80 -1
- package/dist/components/aaa/setting/index.js +11 -1
- package/dist/components/aaa/setting/permission/components/UpdateForm.js +120 -1
- package/dist/components/aaa/setting/permission/index.js +577 -1
- package/dist/components/aaa/setting/permission/service.js +141 -1
- package/dist/components/aaa/setting/requesturl/components/UpdateForm.js +101 -1
- package/dist/components/aaa/setting/requesturl/index.js +369 -1
- package/dist/components/aaa/setting/requesturl/service.js +73 -1
- package/dist/components/aaa/setting/role/components/UpdateForm.js +101 -1
- package/dist/components/aaa/setting/role/index.js +558 -1
- package/dist/components/aaa/setting/role/service.js +124 -1
- package/dist/components/aaa/setting/user/components/UpdateForm.js +149 -1
- package/dist/components/aaa/setting/user/index.js +835 -1
- package/dist/components/aaa/setting/user/service.js +226 -1
- package/dist/components/both/index.js +2 -1
- package/dist/components/both/security-layout/index.js +148 -1
- package/dist/components/dictionary/components/UpdateForm.js +132 -1
- package/dist/components/dictionary/index.js +390 -1
- package/dist/components/dictionary/service.js +78 -1
- package/dist/components/downloadFile/index.js +79 -16
- package/dist/components/index.js +9 -1
- package/dist/components/materialCard/index.js +142 -1
- package/dist/components/organization/components/CreatePeopleForm.js +304 -1
- package/dist/components/organization/components/CreateSubStoreForm.js +349 -1
- package/dist/components/organization/components/OrgTree.js +217 -1
- package/dist/components/organization/index.js +647 -1
- package/dist/components/organization/service.js +393 -1
- package/dist/components/sso/index.js +4 -1
- package/dist/components/sso/security-layout/index.js +147 -1
- package/dist/components/sso/setting/index.js +11 -1
- package/dist/components/sso/setting/permRole/index.js +173 -1
- package/dist/components/sso/setting/permission/components/UpdateForm.js +83 -1
- package/dist/components/sso/setting/permission/index.js +253 -1
- package/dist/components/sso/setting/role/components/UpdateForm.js +72 -1
- package/dist/components/sso/setting/role/index.js +274 -1
- package/dist/components/sso/setting/service.js +226 -1
- package/dist/components/sso/setting/user/components/RoleUpdateForm.js +69 -1
- package/dist/components/sso/setting/user/index.js +238 -1
- package/dist/components/tools/version.js +25 -1
- package/dist/components/uploadFile/index.js +204 -26
- package/dist/index.js +3 -1
- package/dist/services/service.js +43 -1
- package/dist/utils/downloadFile.js +170 -1
- package/dist/utils/request.js +88 -1
- package/dist/utils/serviceSet.js +36 -1
- package/dist/utils/token.js +26 -1
- package/dist/utils/utils.js +211 -1
- package/package.json +2 -2
- package/dist/components/outExcel/index.js +0 -1
package/README.md
CHANGED
|
@@ -1,316 +1,309 @@
|
|
|
1
1
|
# 鑫义科技前端开发者工具包
|
|
2
2
|
|
|
3
|
-
内网文档:http://172.16.1.254:8090/display/UX/xydata-tools
|
|
3
|
+
## 内网文档:[http://172.16.1.254:8090/display/UX/xydata-tools](http://172.16.1.254:8090/display/UX/xydata-tools)
|
|
4
4
|
|
|
5
5
|
## 功能
|
|
6
6
|
|
|
7
|
+
- `aaa` 模版(有独立的登录页面,不支持统一登陆):SecurityLayout、系统管理
|
|
8
|
+
- `sso` 模版(没有独立的登录页面,支持统一登陆):SecurityLayout、系统管理
|
|
9
|
+
- `both` 模版(有独立的登录页面,支持统一登陆): SecurityLayout、一般配合 `sso` 模板的系统管理使用
|
|
7
10
|
- 数据字典页面
|
|
8
11
|
- 组织机构页面
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
- 附件上传组件
|
|
13
|
+
- 附件下载组件
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 使用说明
|
|
14
18
|
|
|
15
19
|
### 全局注册 Service
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
//注册请求服务,可放到global.jsx或者app.js中
|
|
19
|
-
import { registerService } from 'xydata-tools';
|
|
21
|
+
在项目中注册请求服务,可放置在 `global.jsx` 或 `app.js` 中:
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
```javascript
|
|
24
|
+
import { registerService } from "xydata-tools";
|
|
25
|
+
|
|
26
|
+
registerService("替换你的项目服务");
|
|
22
27
|
```
|
|
23
28
|
|
|
29
|
+
---
|
|
30
|
+
|
|
24
31
|
### 数据字典使用方法
|
|
25
32
|
|
|
26
|
-
```
|
|
27
|
-
import React from
|
|
28
|
-
import { DictionaryFront } from
|
|
33
|
+
```javascript
|
|
34
|
+
import React from "react";
|
|
35
|
+
import { DictionaryFront } from "xydata-tools";
|
|
29
36
|
|
|
30
37
|
const Demo = () => {
|
|
31
|
-
|
|
38
|
+
return <DictionaryFront />;
|
|
32
39
|
};
|
|
33
40
|
|
|
34
41
|
export default Demo;
|
|
35
42
|
```
|
|
36
43
|
|
|
44
|
+
---
|
|
45
|
+
|
|
37
46
|
### 组织机构模块
|
|
38
47
|
|
|
39
|
-
```
|
|
40
|
-
import React from
|
|
41
|
-
import { OrganizationFront } from
|
|
48
|
+
```javascript
|
|
49
|
+
import React from "react";
|
|
50
|
+
import { OrganizationFront } from "xydata-tools";
|
|
42
51
|
|
|
43
52
|
const Demo = () => {
|
|
44
|
-
|
|
53
|
+
return <OrganizationFront />;
|
|
45
54
|
};
|
|
46
55
|
|
|
47
56
|
export default Demo;
|
|
48
57
|
```
|
|
49
58
|
|
|
59
|
+
---
|
|
60
|
+
|
|
50
61
|
### 附件上传组件
|
|
51
62
|
|
|
52
|
-
基于ProformUploadButton
|
|
53
|
-
1. 支持单独使用或在表单内使用
|
|
54
|
-
2. 支持上传图片、文件,可根据listType进行多种上传风格切换
|
|
55
|
-
3. 内置文件大小、格式校验
|
|
56
|
-
4. 内置常用请求头参数
|
|
57
|
-
5. 内置图片预览功能,listType为"picture", "picture-card"时可用(未传入form时,只能预览当前点击图片,不可切换)
|
|
58
|
-
6. 兼容所有原生组件功能
|
|
63
|
+
基于 `ProformUploadButton` 二次封装的上传组件,支持以下功能:
|
|
59
64
|
|
|
65
|
+
1. 支持单独使用或在表单内使用。
|
|
66
|
+
2. 支持上传图片、文件,可根据 `listType` 进行多种上传风格切换。
|
|
67
|
+
3. 内置文件大小、格式校验。
|
|
68
|
+
4. 内置常用请求头参数。
|
|
69
|
+
5. 内置图片预览功能(`listType` 为 `"picture"` 或 `"picture-card"` 时可用)。
|
|
70
|
+
6. 兼容所有原生组件功能。
|
|
60
71
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
72
|
+
#### 示例代码
|
|
73
|
+
|
|
74
|
+
```javascript
|
|
75
|
+
import React from "react";
|
|
76
|
+
import { UploadFile } from "xydata-tools";
|
|
64
77
|
import { Form } from "antd";
|
|
65
78
|
|
|
66
79
|
const Demo = () => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
const [form] = Form.useForm();
|
|
81
|
+
|
|
82
|
+
// 单独使用
|
|
83
|
+
<UploadFile
|
|
84
|
+
title="导入模板"
|
|
85
|
+
listType="text"
|
|
86
|
+
accept=".xlsx,.xls"
|
|
87
|
+
icon={<ImportOutlined />}
|
|
88
|
+
buttonOptions={{ type: "primary" }}
|
|
89
|
+
showUploadList={false}
|
|
90
|
+
onChange={({ fileList }) => {
|
|
91
|
+
// 通过监听状态为done获取最终的上传结果
|
|
92
|
+
if (fileList.every((item) => item.status === "done")) {
|
|
93
|
+
console.log(fileList );
|
|
94
|
+
}
|
|
95
|
+
}}
|
|
96
|
+
checkFile={{
|
|
97
|
+
suffixs: ["xlsx", "xls"],
|
|
98
|
+
maxSize: 1024,
|
|
99
|
+
}}
|
|
100
|
+
multiple={true}
|
|
101
|
+
/>;
|
|
102
|
+
|
|
103
|
+
// 在表单内使用
|
|
104
|
+
<Form form={form}>
|
|
105
|
+
<UploadFile form={form} name="file" label="图片上传" listType="picture-card" />
|
|
106
|
+
</Form>
|
|
107
|
+
|
|
108
|
+
// 在 FormList 内使用
|
|
109
|
+
<ProFormList {...yourProps}>
|
|
110
|
+
{(field) => {
|
|
111
|
+
return <UploadFile key={field.key} name={[field.name, "cover"]} />;
|
|
112
|
+
}}
|
|
113
|
+
</ProFormList>;
|
|
81
114
|
};
|
|
82
115
|
|
|
83
116
|
export default Demo;
|
|
84
117
|
```
|
|
85
118
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
-
|
|
|
99
|
-
|
|
|
100
|
-
|
|
|
101
|
-
|
|
|
102
|
-
|
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
110
|
-
|
|
119
|
+
#### 参数说明
|
|
120
|
+
|
|
121
|
+
| 参数名 | 类型 | 描述 | 默认值 |
|
|
122
|
+
| ----------------- | -------------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------- |
|
|
123
|
+
| `form` | `Antd.Form.Instance` | 表单实例 | 无 |
|
|
124
|
+
| `label` | `string` | 表单标签 | 无 |
|
|
125
|
+
| `name` | `string` | 表单字段 | 无 |
|
|
126
|
+
| `rules` | `Array[Object]` | 表单校验规则 | 无 |
|
|
127
|
+
| `accept` | `string` | 接受上传的文件类型 | 无 |
|
|
128
|
+
| `action` | `string` | 上传的地址 | `/api/${注册的服务}/file/upload/v3?type=openFile` |
|
|
129
|
+
| `max` | `string` | 最大上传数量,超过最大数量就会隐藏上传按钮 | 无 |
|
|
130
|
+
| `multiple` | `boolean` | 是否支持多选文件,开启后按住 `Ctrl` 可选择多个文件 | `false` |
|
|
131
|
+
| `icon` | `ReactNode` | `Button` 或 `Dragger` 的图标 | 无 |
|
|
132
|
+
| `title` | `ReactNode` | `Button` 或 `Dragger` 的标题 | 无 |
|
|
133
|
+
| `description` | `ReactNode` | 当 `listType` 为 `dragger` 时的描述 | 无 |
|
|
134
|
+
| `listType` | `string` | 上传列表的内建样式,支持 `text`、`picture`、`picture-card`、`dragger` | `text` |
|
|
135
|
+
| `showUploadList` | `Boolean/Object` | 是否展示文件列表,可设为对象,用于单独设定 `showPreviewIcon` 等配置 | `true` |
|
|
136
|
+
| `readonly` | `boolean` | 是否只读 | `false` |
|
|
137
|
+
| `disabled` | `boolean` | 是否禁用 | `false` |
|
|
138
|
+
| `checkFile` | `Object` | 文件校验配置,包括 `suffixs`(限制的文件格式)和 `maxSize`(文件大小限制,单位 KB) | 无 |
|
|
139
|
+
| `onChange` | `Function` | 上传文件改变时的回调,上传中、完成、失败都会调用 | 无 |
|
|
140
|
+
| `formItemOptions` | `Object` | 表单项配置,覆盖以上设置 | 无 |
|
|
141
|
+
| `uploadOptions` | `Object` | 上传配置,覆盖以上设置 | 无 |
|
|
142
|
+
| `buttonOptions` | `Object` | 上传按钮的配置,`listType` 为 `dragger` 时无效 | 默认配置了 `loading` |
|
|
143
|
+
|
|
144
|
+
---
|
|
111
145
|
|
|
112
146
|
### 附件下载组件
|
|
113
147
|
|
|
114
|
-
|
|
115
|
-
1. 支持格式为链接或流的文件下载
|
|
116
|
-
2. 兼容原生组件功能
|
|
148
|
+
内置了下载功能的按钮组件,支持以下功能:
|
|
117
149
|
|
|
150
|
+
1. 支持格式为链接或流的文件下载。
|
|
151
|
+
2. 兼容原生组件功能。
|
|
118
152
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
153
|
+
#### 示例代码
|
|
154
|
+
|
|
155
|
+
```javascript
|
|
156
|
+
import React from "react";
|
|
157
|
+
import { DownloadFile } from "xydata-tools";
|
|
122
158
|
|
|
123
|
-
// 文件名一定需要加上后缀
|
|
124
159
|
const Demo = () => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
160
|
+
return (
|
|
161
|
+
<DownloadFile
|
|
162
|
+
shape="round"
|
|
163
|
+
type="link"
|
|
164
|
+
queryOption={{
|
|
165
|
+
url: "/api/tb/exportTbExcel",
|
|
166
|
+
params: { peopleType: 0 },
|
|
167
|
+
customField: {
|
|
168
|
+
url: "exportFileUrl",
|
|
169
|
+
fileName: "exportFileName",
|
|
170
|
+
},
|
|
171
|
+
}}
|
|
172
|
+
/>
|
|
173
|
+
);
|
|
139
174
|
};
|
|
140
175
|
|
|
141
176
|
export default Demo;
|
|
142
177
|
```
|
|
143
178
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
|
147
|
-
|
|
|
148
|
-
|
|
|
149
|
-
| queryOption
|
|
150
|
-
| queryOption.
|
|
151
|
-
| queryOption.
|
|
152
|
-
| queryOption.
|
|
153
|
-
| queryOption.
|
|
154
|
-
| queryOption.
|
|
155
|
-
| queryOption.
|
|
156
|
-
| queryOption.
|
|
157
|
-
|
|
|
179
|
+
#### 参数说明
|
|
180
|
+
|
|
181
|
+
| 参数名 | 类型 | 描述 | 默认值 |
|
|
182
|
+
| -------------------------- | -------------------- | ----------------------------------------------------------------- | -------- |
|
|
183
|
+
| `text` | `String / ReactNode` | 按钮内容 | 下载按钮 |
|
|
184
|
+
| `queryOption` | `Object` | 下载设置 | 无 |
|
|
185
|
+
| `queryOption.url` | `String` | 接口地址 | 无 |
|
|
186
|
+
| `queryOption.headers` | `Object` | 请求头 | 无 |
|
|
187
|
+
| `queryOption.method` | `String` | 请求方法,支持 `GET` 或 `POST` | 无 |
|
|
188
|
+
| `queryOption.fileName` | `String` | 文件名称 | 无 |
|
|
189
|
+
| `queryOption.params` | `Object` | 请求参数 | 无 |
|
|
190
|
+
| `queryOption.customField` | `Object` | 自定义返回接口返回的文件名和地址(适用于返回 JSON 的接口) | 无 |
|
|
191
|
+
| `queryOption.onError` | `Function` | 接口异常回调 | 无 |
|
|
192
|
+
| `queryOption.downloadType` | `String` | 下载类型,`pure` 表示传入的是下载地址(OSS 链接),而不是下载接口 | 无 |
|
|
193
|
+
| 其他 | `-` | 兼容 Antd.Button 所有原生参数 | 无 |
|
|
158
194
|
|
|
159
|
-
|
|
160
195
|
|
|
161
|
-
|
|
196
|
+
#### 配套的 提交/回显 方法
|
|
162
197
|
|
|
163
|
-
|
|
198
|
+
```javascript
|
|
164
199
|
|
|
200
|
+
import { getUploadFileData, setUploadFileData } from "xydata-tools";
|
|
201
|
+
|
|
202
|
+
// 获取表单数据
|
|
203
|
+
const getFieldsValue= async () => {
|
|
204
|
+
const fieldsValue = await form.validateFields();
|
|
205
|
+
const { cover } = fieldsValue;
|
|
206
|
+
const data = await getUploadFileData(cover);
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
// 回显表单数据
|
|
210
|
+
const renderFieldsValue = async () => {
|
|
211
|
+
const cover = [
|
|
212
|
+
{
|
|
213
|
+
name: "image.png",
|
|
214
|
+
url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png",
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png",
|
|
218
|
+
},
|
|
219
|
+
];
|
|
220
|
+
const data = setUploadFileData(cover);
|
|
221
|
+
form.setFieldsValue({
|
|
222
|
+
cover: data,
|
|
223
|
+
});
|
|
224
|
+
};
|
|
165
225
|
```
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
### `sso` 模版的系统管理模块
|
|
229
|
+
|
|
230
|
+
#### 用户管理
|
|
231
|
+
|
|
232
|
+
```javascript
|
|
166
233
|
import React from "react";
|
|
167
234
|
import { Sso } from "xydata-tools";
|
|
168
|
-
import { connect } from
|
|
235
|
+
import { connect } from "umi";
|
|
169
236
|
|
|
170
237
|
const UserPage = (props) => {
|
|
171
|
-
const { currentUser } = props
|
|
172
|
-
return <Sso.User currentUser={currentUser}
|
|
238
|
+
const { currentUser } = props;
|
|
239
|
+
return <Sso.User currentUser={currentUser} />;
|
|
173
240
|
};
|
|
174
241
|
|
|
175
242
|
export default connect(({ user }) => ({
|
|
176
243
|
currentUser: user.currentUser,
|
|
177
244
|
}))(UserPage);
|
|
178
|
-
|
|
179
245
|
```
|
|
180
246
|
|
|
181
|
-
|
|
247
|
+
#### 权限管理
|
|
182
248
|
|
|
183
|
-
```
|
|
249
|
+
```javascript
|
|
184
250
|
import React from "react";
|
|
185
251
|
import { Sso } from "xydata-tools";
|
|
186
252
|
|
|
187
253
|
const PermPage = () => {
|
|
188
|
-
return <Sso.Permission
|
|
254
|
+
return <Sso.Permission />;
|
|
189
255
|
};
|
|
190
256
|
|
|
191
257
|
export default PermPage;
|
|
192
|
-
|
|
193
258
|
```
|
|
194
259
|
|
|
195
|
-
|
|
260
|
+
#### 角色管理
|
|
196
261
|
|
|
197
|
-
```
|
|
198
|
-
代码和用户管理相同
|
|
262
|
+
```javascript
|
|
199
263
|
<Sso.Role currentUser={currentUser} />
|
|
200
264
|
```
|
|
201
265
|
|
|
202
|
-
|
|
266
|
+
#### 设置权限
|
|
203
267
|
|
|
204
|
-
```
|
|
205
|
-
代码和用户管理相同
|
|
268
|
+
```javascript
|
|
206
269
|
<Sso.PermRole currentUser={currentUser} />
|
|
207
270
|
```
|
|
208
271
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
1、 全局保存 ENV_DATA
|
|
212
|
-
|
|
213
|
-
```
|
|
214
|
-
// 和全局注册Service的放置位置一样,也可以直接放在config.js
|
|
215
|
-
import { saveEnvData } from 'xydata-tools';
|
|
216
|
-
saveEnvData(envData)
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
2、 使用方法
|
|
220
|
-
getUserOk 方法中替换,具体项目中/api/currentUser 成功调用后的逻辑代码。
|
|
221
|
-
|
|
222
|
-
```
|
|
223
|
-
import React from "react";
|
|
224
|
-
import { Sso } from "xydata-tools";
|
|
225
|
-
|
|
226
|
-
const SecurityLayoutPage = (props) => {
|
|
227
|
-
|
|
228
|
-
const getUserOk = data => {
|
|
229
|
-
console.log("/api/currentUser", data);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return <Sso.SecurityLayout getUserOk={getUserOk}>{props.children}</Sso.SecurityLayout>
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
export default SecurityLayoutPage;
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
### aaa 模版的系统管理模块
|
|
239
|
-
|
|
240
|
-
tips: 以下页面,也需要全局注册 Service
|
|
241
|
-
|
|
242
|
-
1、 用户管理
|
|
243
|
-
|
|
244
|
-
```
|
|
245
|
-
import React from 'react';
|
|
246
|
-
import { Aaa } from 'xydata-tools';
|
|
247
|
-
import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
|
248
|
-
|
|
249
|
-
const UserPage = () => {
|
|
250
|
-
return (
|
|
251
|
-
<PageHeaderWrapper>
|
|
252
|
-
<Aaa.User />
|
|
253
|
-
</PageHeaderWrapper>
|
|
254
|
-
);
|
|
255
|
-
};
|
|
256
|
-
export default UserPage;
|
|
257
|
-
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
2、 角色管理
|
|
261
|
-
|
|
262
|
-
```
|
|
263
|
-
<Aaa.Role />
|
|
264
|
-
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
3、 权限管理
|
|
268
|
-
|
|
269
|
-
```
|
|
270
|
-
<Aaa.Permission />
|
|
271
|
-
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
4、 URL 管理
|
|
275
|
-
|
|
276
|
-
```
|
|
277
|
-
<Aaa.Url />
|
|
278
|
-
|
|
279
|
-
```
|
|
272
|
+
---
|
|
280
273
|
|
|
281
274
|
### 本地开发
|
|
282
275
|
|
|
283
|
-
|
|
276
|
+
1. 在项目根目录执行:
|
|
284
277
|
|
|
285
|
-
|
|
278
|
+
```bash
|
|
279
|
+
yarn dev
|
|
280
|
+
```
|
|
286
281
|
|
|
287
|
-
|
|
288
|
-
yarn dev
|
|
289
|
-
```
|
|
282
|
+
2. 在 example 目录下执行:
|
|
290
283
|
|
|
291
|
-
|
|
284
|
+
```bash
|
|
285
|
+
yarn start
|
|
286
|
+
```
|
|
292
287
|
|
|
293
|
-
|
|
294
|
-
yarn start
|
|
295
|
-
```
|
|
288
|
+
3. example 是一个由 `umi` 搭建的后台项目,可直接引用 `xydata-tools` 内的组件进行预览。
|
|
296
289
|
|
|
297
|
-
|
|
290
|
+
4. 新组件可在 `/xydata-tools/src/components` 下进行开发更新。
|
|
298
291
|
|
|
299
|
-
|
|
292
|
+
5. 在 src 内的修改操作将会被实时编译到 dist 文件夹中。
|
|
300
293
|
|
|
301
|
-
|
|
294
|
+
6. 打包发布:
|
|
302
295
|
|
|
303
|
-
|
|
296
|
+
```bash
|
|
297
|
+
npm run build
|
|
298
|
+
npm config set registry https://registry.npmjs.org
|
|
299
|
+
npm config set proxy false
|
|
300
|
+
npm publish -d
|
|
301
|
+
```
|
|
304
302
|
|
|
305
|
-
|
|
306
|
-
npm run build
|
|
307
|
-
npm config set registry https://registry.npmjs.org
|
|
308
|
-
npm config set proxy false
|
|
309
|
-
npm publish -d
|
|
310
|
-
```
|
|
303
|
+
7. 发布完成后,还原 npm 源(淘宝源):
|
|
311
304
|
|
|
312
|
-
|
|
305
|
+
```bash
|
|
306
|
+
npm config set registry https://registry.npmmirror.com
|
|
307
|
+
```
|
|
313
308
|
|
|
314
|
-
|
|
315
|
-
npm config set registry https://registry.npmmirror.com
|
|
316
|
-
```
|
|
309
|
+
---
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
function Auth(props) {
|
|
3
|
+
var authorityStr = localStorage.getItem('antd-pro-authority');
|
|
4
|
+
var authoritys = JSON.parse(authorityStr);
|
|
5
|
+
var children = props.children,
|
|
6
|
+
code = props.code;
|
|
7
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, authoritys.includes(code) ? children : null);
|
|
8
|
+
}
|
|
9
|
+
export default Auth;
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
import Aaa from"./setting/index";
|
|
1
|
+
import Aaa from "./setting/index";
|
|
2
|
+
import AaaSecurityLayout from "./security-layout/index";
|
|
3
|
+
Aaa.SecurityLayout = AaaSecurityLayout;
|
|
4
|
+
export default Aaa;
|