@hzab/list-render 0.0.10 → 0.0.12
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 +80 -1
- package/example/app.tsx +19 -0
- package/example/components/anbao-router/index.tsx +47 -0
- package/example/index.less +3 -0
- package/example/index.tsx +8 -0
- package/example/pages/index/grid-empty.schema.json +201 -0
- package/example/pages/index/grid.schema.json +94 -0
- package/example/pages/index/index.less +5 -0
- package/example/pages/index/index.tsx +72 -0
- package/example/pages/index/test.schema.json +413 -0
- package/example/router.ts +3 -0
- package/example/typings.d.ts +16 -0
- package/lib/data-model.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +7 -3
- package/src/common/utils.js +17 -0
- package/src/data-model.js +11 -3
- package/src/form-dialog/index.jsx +0 -1
- package/src/index.js +1 -5
- package/src/list-render.jsx +3 -6
- package/src/query-render/index.jsx +3 -6
- package/CHANGELOG +0 -27
package/README.md
CHANGED
|
@@ -77,10 +77,82 @@ const listDM = useMemo(
|
|
|
77
77
|
|
|
78
78
|
## DataModel
|
|
79
79
|
|
|
80
|
+
### Tips
|
|
81
|
+
|
|
82
|
+
- 若存在 axios 相关配置失效的问题,请在选择一下任意一种方式解决;
|
|
83
|
+
- 在入口文件设置 DataModel 默认的 axios 为已配置好的 axios;
|
|
84
|
+
- 在入口文件对 DataModal 的 axios 进行配置;
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
// 设置 DataModel 默认的 axios 为已配置好的 axios;
|
|
88
|
+
import axios from "axios";
|
|
89
|
+
import { setDefaultAxios } from "@hzab/list-render";
|
|
90
|
+
|
|
91
|
+
setDefaultAxios(axios);
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
// 配置 DataModal 的 axios;
|
|
96
|
+
import axios from "axios";
|
|
97
|
+
import { axios as ax } from "@hzab/list-render";
|
|
98
|
+
|
|
99
|
+
setAxRequest(axios);
|
|
100
|
+
setAxRequest(ax);
|
|
101
|
+
|
|
102
|
+
setAxResponse(axios);
|
|
103
|
+
setAxResponse(ax);
|
|
104
|
+
|
|
105
|
+
// axios 守卫
|
|
106
|
+
export function setAxRequest(_ax) {
|
|
107
|
+
_ax.interceptors.request.use((config) => {
|
|
108
|
+
const { url = "" } = config;
|
|
109
|
+
|
|
110
|
+
if (/^\/api\/v\d+\/user\//.test(url)) {
|
|
111
|
+
} else if (url.startsWith("/api")) {
|
|
112
|
+
config.baseURL = cfg.businessApi;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return config;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// 请求到结果的拦截处理;
|
|
120
|
+
export function setAxResponse(_ax) {
|
|
121
|
+
_ax.interceptors.response.use(
|
|
122
|
+
(res) => {
|
|
123
|
+
// const navigateApi = useNavigate()
|
|
124
|
+
// const locationApi = useLocation();
|
|
125
|
+
if (res.data.code == 401) {
|
|
126
|
+
message.error(res._message || "验证信息失效,请重新登录");
|
|
127
|
+
// TODO: 页面跳转
|
|
128
|
+
return res;
|
|
129
|
+
}
|
|
130
|
+
return res;
|
|
131
|
+
},
|
|
132
|
+
(error) => {
|
|
133
|
+
console.error("Error axios response: ", error);
|
|
134
|
+
message.error(error._message || "网络异常,请稍后再试");
|
|
135
|
+
},
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function setAxToken(_ax, token) {
|
|
140
|
+
_ax.defaults.headers.Authorization = token;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function setAxiosToken(token) {
|
|
144
|
+
setAxToken(ax, token);
|
|
145
|
+
setAxToken(axios, token);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export default axios;
|
|
149
|
+
```
|
|
150
|
+
|
|
80
151
|
### 使用
|
|
81
152
|
|
|
82
153
|
```js
|
|
83
|
-
import DataModel from "@hzab/list-render
|
|
154
|
+
import { DataModel } from "@hzab/list-render";
|
|
155
|
+
|
|
84
156
|
// 生成实例
|
|
85
157
|
const dataModel = new DataModel({
|
|
86
158
|
createApi: "api",
|
|
@@ -161,6 +233,13 @@ async function test() {
|
|
|
161
233
|
- 发布目录:
|
|
162
234
|
- lib
|
|
163
235
|
- src
|
|
236
|
+
- example
|
|
237
|
+
|
|
238
|
+
### 迭代发布命令
|
|
239
|
+
|
|
240
|
+
- 0.0.x: npm run publish-patch
|
|
241
|
+
- 0.x.0: npm run publish-minor
|
|
242
|
+
- x.0.0: npm run publish-major
|
|
164
243
|
|
|
165
244
|
## 配置
|
|
166
245
|
|
package/example/app.tsx
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
import { HashRouter, useRoutes, useNavigate, useLocation } from "react-router-dom";
|
|
3
|
+
import { syncRouter } from "@/components/anbao-router";
|
|
4
|
+
|
|
5
|
+
import { Routes } from "./router";
|
|
6
|
+
|
|
7
|
+
const Main = () => useRoutes(syncRouter(Routes));
|
|
8
|
+
|
|
9
|
+
const App = () => {
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
<HashRouter>
|
|
13
|
+
<Main />
|
|
14
|
+
</HashRouter>
|
|
15
|
+
</>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default App;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Suspense, lazy } from "react";
|
|
2
|
+
import { Navigate } from "react-router-dom";
|
|
3
|
+
|
|
4
|
+
// 路由守卫方法
|
|
5
|
+
const syncRouter = (routeList: any) => {
|
|
6
|
+
let RouteTable: any = [];
|
|
7
|
+
routeList.map((item: any) => {
|
|
8
|
+
const routeObj = { ...item };
|
|
9
|
+
if (routeObj.path === undefined) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (routeObj.redirect) {
|
|
13
|
+
routeObj.element = <Navigate to={routeObj.redirect} replace={true} />;
|
|
14
|
+
}
|
|
15
|
+
if (routeObj.component) {
|
|
16
|
+
const Module = lazy(() => import("@/" + routeObj.component));
|
|
17
|
+
//TODO 页面loading
|
|
18
|
+
routeObj.element = (
|
|
19
|
+
<Suspense fallback={<></>}>
|
|
20
|
+
<Module />
|
|
21
|
+
</Suspense>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
if (routeObj.children) {
|
|
25
|
+
routeObj.children = syncRouter(item.children);
|
|
26
|
+
}
|
|
27
|
+
RouteTable.push(routeObj);
|
|
28
|
+
});
|
|
29
|
+
return RouteTable;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// 判断用户权限
|
|
33
|
+
const btnHasAuthority = (params: any) => {
|
|
34
|
+
let permission = false;
|
|
35
|
+
const userAuth = JSON.parse(window.sessionStorage.getItem("userAuthInfo") || "[]");
|
|
36
|
+
if (userAuth.indexOf(params) != -1) {
|
|
37
|
+
permission = true;
|
|
38
|
+
}
|
|
39
|
+
return permission;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// 按钮权限判断方法
|
|
43
|
+
const Access: any = (props: any) => {
|
|
44
|
+
return props.accessible ? props.children : null;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { syncRouter, btnHasAuthority, Access };
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
{
|
|
2
|
+
"form": {
|
|
3
|
+
"labelCol": 6,
|
|
4
|
+
"wrapperCol": 12,
|
|
5
|
+
"style": {
|
|
6
|
+
"backgroundColor": "rgba(255,255,255,1)",
|
|
7
|
+
"width": "inherit"
|
|
8
|
+
},
|
|
9
|
+
"wrapperWidth": "inherit",
|
|
10
|
+
"feedbackLayout": null,
|
|
11
|
+
"bordered": true
|
|
12
|
+
},
|
|
13
|
+
"schema": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"06pny7e3bsi": {
|
|
17
|
+
"type": "void",
|
|
18
|
+
"x-component": "FormGrid",
|
|
19
|
+
"x-validator": [],
|
|
20
|
+
"x-component-props": {},
|
|
21
|
+
"x-designable-id": "06pny7e3bsi",
|
|
22
|
+
"x-index": 0,
|
|
23
|
+
"properties": {
|
|
24
|
+
"hcczyqc3nth": {
|
|
25
|
+
"type": "void",
|
|
26
|
+
"x-component": "FormGrid.GridColumn",
|
|
27
|
+
"x-validator": [],
|
|
28
|
+
"x-component-props": {},
|
|
29
|
+
"x-designable-id": "hcczyqc3nth",
|
|
30
|
+
"x-index": 0,
|
|
31
|
+
"properties": {
|
|
32
|
+
"name": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"title": "部门",
|
|
35
|
+
"x-decorator": "FormItem",
|
|
36
|
+
"x-component": "Input",
|
|
37
|
+
"x-validator": [],
|
|
38
|
+
"x-component-props": {
|
|
39
|
+
"placeholder": "请输入"
|
|
40
|
+
},
|
|
41
|
+
"x-decorator-props": {
|
|
42
|
+
"labelCol": null,
|
|
43
|
+
"labelWidth": "100px",
|
|
44
|
+
"wrapperWidth": "200px"
|
|
45
|
+
},
|
|
46
|
+
"x-designable-id": "bjdoighzdby",
|
|
47
|
+
"x-index": 0,
|
|
48
|
+
"name": "name"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"xpspz1ka2tc": {
|
|
53
|
+
"type": "void",
|
|
54
|
+
"x-component": "FormGrid.GridColumn",
|
|
55
|
+
"x-validator": [],
|
|
56
|
+
"x-component-props": {},
|
|
57
|
+
"x-designable-id": "xpspz1ka2tc",
|
|
58
|
+
"x-index": 1,
|
|
59
|
+
"properties": {
|
|
60
|
+
"phone": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"title": "部门电话",
|
|
63
|
+
"x-decorator": "FormItem",
|
|
64
|
+
"x-component": "Input",
|
|
65
|
+
"x-validator": "number",
|
|
66
|
+
"x-component-props": {
|
|
67
|
+
"placeholder": "请输入"
|
|
68
|
+
},
|
|
69
|
+
"x-decorator-props": {
|
|
70
|
+
"labelCol": null,
|
|
71
|
+
"labelWidth": "100px",
|
|
72
|
+
"wrapperWidth": "200px"
|
|
73
|
+
},
|
|
74
|
+
"x-designable-id": "r1tiqra28bj",
|
|
75
|
+
"x-index": 0,
|
|
76
|
+
"name": "phone"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"zttstloy925": {
|
|
81
|
+
"type": "void",
|
|
82
|
+
"x-component": "FormGrid.GridColumn",
|
|
83
|
+
"x-validator": [],
|
|
84
|
+
"x-component-props": {},
|
|
85
|
+
"x-designable-id": "zttstloy925",
|
|
86
|
+
"x-index": 2,
|
|
87
|
+
"properties": {
|
|
88
|
+
"personCount": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"title": "部门人数",
|
|
91
|
+
"x-decorator": "FormItem",
|
|
92
|
+
"x-component": "Input",
|
|
93
|
+
"x-validator": "number",
|
|
94
|
+
"x-component-props": {
|
|
95
|
+
"placeholder": "请输入"
|
|
96
|
+
},
|
|
97
|
+
"x-decorator-props": {
|
|
98
|
+
"labelCol": null,
|
|
99
|
+
"labelWidth": "100px",
|
|
100
|
+
"wrapperWidth": "200px"
|
|
101
|
+
},
|
|
102
|
+
"x-designable-id": "kkgj015gds0",
|
|
103
|
+
"x-index": 0,
|
|
104
|
+
"name": "personCount"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"huf62mybhch": {
|
|
111
|
+
"type": "void",
|
|
112
|
+
"x-component": "FormGrid",
|
|
113
|
+
"x-validator": [],
|
|
114
|
+
"x-component-props": {},
|
|
115
|
+
"x-designable-id": "huf62mybhch",
|
|
116
|
+
"x-index": 1,
|
|
117
|
+
"properties": {
|
|
118
|
+
"y9qxn9ncxjn": {
|
|
119
|
+
"type": "void",
|
|
120
|
+
"x-component": "FormGrid.GridColumn",
|
|
121
|
+
"x-validator": [],
|
|
122
|
+
"x-component-props": {},
|
|
123
|
+
"x-designable-id": "y9qxn9ncxjn",
|
|
124
|
+
"x-index": 0,
|
|
125
|
+
"properties": {
|
|
126
|
+
"managerName": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"title": "负责人姓名",
|
|
129
|
+
"x-decorator": "FormItem",
|
|
130
|
+
"x-component": "Input",
|
|
131
|
+
"x-validator": [],
|
|
132
|
+
"x-component-props": {
|
|
133
|
+
"placeholder": "请输入"
|
|
134
|
+
},
|
|
135
|
+
"x-decorator-props": {
|
|
136
|
+
"labelCol": null,
|
|
137
|
+
"labelWidth": "100px",
|
|
138
|
+
"wrapperWidth": "200px"
|
|
139
|
+
},
|
|
140
|
+
"x-designable-id": "sipvij59cy2",
|
|
141
|
+
"x-index": 0,
|
|
142
|
+
"name": "managerName"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"4y62v6gt28k": {
|
|
147
|
+
"type": "void",
|
|
148
|
+
"x-component": "FormGrid.GridColumn",
|
|
149
|
+
"x-validator": [],
|
|
150
|
+
"x-component-props": {},
|
|
151
|
+
"x-designable-id": "4y62v6gt28k",
|
|
152
|
+
"x-index": 1,
|
|
153
|
+
"properties": {
|
|
154
|
+
"managerPhone": {
|
|
155
|
+
"type": "string",
|
|
156
|
+
"title": "联系方式",
|
|
157
|
+
"x-decorator": "FormItem",
|
|
158
|
+
"x-component": "Input",
|
|
159
|
+
"x-validator": "number",
|
|
160
|
+
"x-component-props": {
|
|
161
|
+
"placeholder": "请输入"
|
|
162
|
+
},
|
|
163
|
+
"x-decorator-props": {
|
|
164
|
+
"labelCol": null,
|
|
165
|
+
"labelWidth": "100px",
|
|
166
|
+
"wrapperWidth": "200px"
|
|
167
|
+
},
|
|
168
|
+
"x-designable-id": "plp3jrejyqe",
|
|
169
|
+
"x-index": 0,
|
|
170
|
+
"name": "managerPhone"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"1laypd415kh": {
|
|
175
|
+
"type": "void",
|
|
176
|
+
"x-component": "FormGrid.GridColumn",
|
|
177
|
+
"x-validator": [],
|
|
178
|
+
"x-component-props": {},
|
|
179
|
+
"x-designable-id": "1laypd415kh",
|
|
180
|
+
"x-index": 2
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
"remark": {
|
|
185
|
+
"type": "string",
|
|
186
|
+
"title": "备注",
|
|
187
|
+
"x-decorator": "FormItem",
|
|
188
|
+
"x-component": "Input.TextArea",
|
|
189
|
+
"x-validator": [],
|
|
190
|
+
"x-component-props": {},
|
|
191
|
+
"x-decorator-props": {
|
|
192
|
+
"labelWidth": "100px"
|
|
193
|
+
},
|
|
194
|
+
"x-designable-id": "bu40azwavly",
|
|
195
|
+
"x-index": 2,
|
|
196
|
+
"name": "remark"
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"x-designable-id": "7j5r2paneta"
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"form": {
|
|
3
|
+
"labelCol": 6,
|
|
4
|
+
"wrapperCol": 12
|
|
5
|
+
},
|
|
6
|
+
"schema": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"n021si0md2k": {
|
|
10
|
+
"type": "void",
|
|
11
|
+
"x-component": "FormGrid",
|
|
12
|
+
"x-validator": [],
|
|
13
|
+
"x-component-props": {},
|
|
14
|
+
"x-designable-id": "n021si0md2k",
|
|
15
|
+
"x-index": 0,
|
|
16
|
+
"properties": {
|
|
17
|
+
"vtc56grqoq7": {
|
|
18
|
+
"type": "void",
|
|
19
|
+
"x-component": "FormGrid.GridColumn",
|
|
20
|
+
"x-designable-id": "vtc56grqoq7",
|
|
21
|
+
"x-index": 0,
|
|
22
|
+
"properties": {
|
|
23
|
+
"a": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"title": "a",
|
|
26
|
+
"x-decorator": "FormItem",
|
|
27
|
+
"x-component": "Input",
|
|
28
|
+
"x-validator": [],
|
|
29
|
+
"x-component-props": {},
|
|
30
|
+
"x-decorator-props": {},
|
|
31
|
+
"name": "a",
|
|
32
|
+
"x-designable-id": "ku66vyflkkq",
|
|
33
|
+
"x-index": 0
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"hz6wmpqt5v9": {
|
|
38
|
+
"type": "void",
|
|
39
|
+
"x-component": "FormGrid.GridColumn",
|
|
40
|
+
"x-designable-id": "hz6wmpqt5v9",
|
|
41
|
+
"x-index": 1,
|
|
42
|
+
"properties": {
|
|
43
|
+
"b": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"title": "b",
|
|
46
|
+
"x-decorator": "FormItem",
|
|
47
|
+
"x-component": "Input",
|
|
48
|
+
"x-validator": [],
|
|
49
|
+
"x-component-props": {},
|
|
50
|
+
"x-decorator-props": {},
|
|
51
|
+
"name": "b",
|
|
52
|
+
"x-designable-id": "yxvv27p9cmm",
|
|
53
|
+
"x-index": 0
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"5pzldy9jksd": {
|
|
58
|
+
"type": "void",
|
|
59
|
+
"x-component": "FormGrid.GridColumn",
|
|
60
|
+
"x-designable-id": "5pzldy9jksd",
|
|
61
|
+
"x-index": 2,
|
|
62
|
+
"properties": {
|
|
63
|
+
"c": {
|
|
64
|
+
"type": "string",
|
|
65
|
+
"title": "c",
|
|
66
|
+
"x-decorator": "FormItem",
|
|
67
|
+
"x-component": "Input",
|
|
68
|
+
"x-validator": [],
|
|
69
|
+
"x-component-props": {},
|
|
70
|
+
"x-decorator-props": {},
|
|
71
|
+
"name": "c",
|
|
72
|
+
"x-designable-id": "621l8qog1wn",
|
|
73
|
+
"x-index": 0
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"createTime": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"title": "date",
|
|
82
|
+
"x-decorator": "FormItem",
|
|
83
|
+
"x-component": "DatePicker",
|
|
84
|
+
"x-validator": [],
|
|
85
|
+
"x-component-props": {},
|
|
86
|
+
"x-decorator-props": {},
|
|
87
|
+
"name": "createTime",
|
|
88
|
+
"x-designable-id": "iuge27ui3t7",
|
|
89
|
+
"x-index": 1
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"x-designable-id": "f0ub742w09r"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useEffect, useMemo } from "react";
|
|
2
|
+
|
|
3
|
+
import ListRender, { DataModel } from "@hzab/list-render";
|
|
4
|
+
|
|
5
|
+
import testSchema from "./test.schema.json";
|
|
6
|
+
import gridSchema from "./grid.schema.json";
|
|
7
|
+
|
|
8
|
+
import "./index.less";
|
|
9
|
+
|
|
10
|
+
const Index: any = () => {
|
|
11
|
+
const listDM = useMemo(
|
|
12
|
+
() =>
|
|
13
|
+
new DataModel({
|
|
14
|
+
getListApi: "/api/v1/userinfo",
|
|
15
|
+
getListFunc(query) {
|
|
16
|
+
console.log("query", query);
|
|
17
|
+
|
|
18
|
+
return new Promise((resolve) => {
|
|
19
|
+
resolve({
|
|
20
|
+
list: [{ id: 1, menuName: "name", parentId: "parentId", a: "a", b: "b", createTime: Date.now() }],
|
|
21
|
+
pagination: { total: 1, current: 1 },
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
createApi: "/api/v1/userinfo",
|
|
26
|
+
getApi: "/api/v1/userinfo/:id",
|
|
27
|
+
updateApi: "/api/v1/userinfo/:id",
|
|
28
|
+
deleteApi: "/api/v1/userinfo/:id",
|
|
29
|
+
}),
|
|
30
|
+
[],
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div className="index">
|
|
35
|
+
1
|
|
36
|
+
<ListRender
|
|
37
|
+
filters={["menuName"]}
|
|
38
|
+
model={listDM}
|
|
39
|
+
schema={testSchema}
|
|
40
|
+
fetchOnEdit={false}
|
|
41
|
+
schemaScope={{
|
|
42
|
+
fetchMenuTree(field) {
|
|
43
|
+
// field 目标组件的 配置参数
|
|
44
|
+
console.log("fetchMenuTree field", field);
|
|
45
|
+
// 通过 field.component[1] 可以动态配置目标组件的 props
|
|
46
|
+
console.log("fetchMenuTree field.component[1]", field.component[1]);
|
|
47
|
+
// 树选择器 数据源
|
|
48
|
+
field.component[1].treeData = [{ value: 1, label: 1 }];
|
|
49
|
+
},
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
<ListRender
|
|
53
|
+
filters={["a"]}
|
|
54
|
+
model={listDM}
|
|
55
|
+
schema={gridSchema}
|
|
56
|
+
fetchOnEdit={false}
|
|
57
|
+
schemaScope={{
|
|
58
|
+
fetchMenuTree(field) {
|
|
59
|
+
// field 目标组件的 配置参数
|
|
60
|
+
console.log("fetchMenuTree field", field);
|
|
61
|
+
// 通过 field.component[1] 可以动态配置目标组件的 props
|
|
62
|
+
console.log("fetchMenuTree field.component[1]", field.component[1]);
|
|
63
|
+
// 树选择器 数据源
|
|
64
|
+
field.component[1].treeData = [{ value: 1, label: 1 }];
|
|
65
|
+
},
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export default Index;
|