ronds-metadata 1.3.60 → 1.3.62
Sign up to get free protection for your applications and to get access to all the features.
@@ -11,12 +11,13 @@ import _Select from "antd/es/select";
|
|
11
11
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
12
12
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
13
13
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
14
|
-
import { tr } from '
|
14
|
+
import { tr } from '../../../../framework/locale/index';
|
15
15
|
import { LinkOutlined, UploadOutlined, PlusOutlined } from '@ant-design/icons';
|
16
16
|
import React from 'react';
|
17
|
-
import Editable from '
|
17
|
+
import Editable from '../../../Editable/index';
|
18
18
|
var SourceConfig = function SourceConfig(props) {
|
19
|
-
var configType = props.configType
|
19
|
+
var configType = props.configType,
|
20
|
+
http = props.http;
|
20
21
|
var isTarget = configType === 'target';
|
21
22
|
var isSource = configType === 'source';
|
22
23
|
var sourceOpts = isTarget ? [{
|
@@ -148,6 +149,91 @@ var SourceConfig = function SourceConfig(props) {
|
|
148
149
|
_React$useState24 = _slicedToArray(_React$useState23, 2),
|
149
150
|
filePath = _React$useState24[0],
|
150
151
|
setFilePath = _React$useState24[1];
|
152
|
+
// http 调用接口
|
153
|
+
// const watchValueRef = React.useRef<string | any>();
|
154
|
+
// const totalRef = React.useRef<number>();
|
155
|
+
// const getEnumDataByUrl = React.useCallback(
|
156
|
+
// async (
|
157
|
+
// http: {
|
158
|
+
// isCascader: boolean;
|
159
|
+
// isGroup: boolean;
|
160
|
+
// isTreeSelect: boolean;
|
161
|
+
// url: string;
|
162
|
+
// method?: 'get' | 'post';
|
163
|
+
// body?: string;
|
164
|
+
// key: string;
|
165
|
+
// value: string;
|
166
|
+
// watch: string;
|
167
|
+
// },
|
168
|
+
// pid?: string,
|
169
|
+
// page?: string,
|
170
|
+
// ) => {
|
171
|
+
// let server = new MetadataService();
|
172
|
+
// let _url = pid || pid === '' ? http.url.replace('{pid}', pid) : http.url;
|
173
|
+
// _url = page ? http.url.replace('{page}', page) : _url;
|
174
|
+
// if (watchValueRef.current) {
|
175
|
+
// if (typeof watchValueRef.current === 'string') {
|
176
|
+
// _url = _url.replace('{watch}', watchValueRef.current);
|
177
|
+
// }
|
178
|
+
// }
|
179
|
+
// console.log('========================getEnumDataByUrl', _url, watchValueRef.current);
|
180
|
+
// const res = await server.GetEnumDataByUrl(
|
181
|
+
// _url,
|
182
|
+
// http.method,
|
183
|
+
// http?.body && JSON.parse(http?.body) ? { ...JSON.parse(http?.body), ...(watchValueRef.current || {}) } : watchValueRef.current,
|
184
|
+
// );
|
185
|
+
// console.log('====Select====res', res);
|
186
|
+
// const _res = res?.total ? res?.list : res;
|
187
|
+
// totalRef.current = res?.total;
|
188
|
+
// if (_res && _res.length > 0) {
|
189
|
+
// // 一次性加载情况
|
190
|
+
// if (http?.isCascader && http.url.indexOf('{pid}') === -1) {
|
191
|
+
// return _res;
|
192
|
+
// }
|
193
|
+
// // 选项分组展示
|
194
|
+
// if (http?.isGroup) {
|
195
|
+
// return _res;
|
196
|
+
// }
|
197
|
+
// // 树接口数据展示
|
198
|
+
// if (http?.isTreeSelect) {
|
199
|
+
// return _res;
|
200
|
+
// }
|
201
|
+
// return _res.map((it: any) => {
|
202
|
+
// if (http?.isCascader) {
|
203
|
+
// return {
|
204
|
+
// value: it[http?.key || 'id'],
|
205
|
+
// label: it[http?.value || 'name'],
|
206
|
+
// isLeaf: it['isLeaf'] ? it['isLeaf'] : false,
|
207
|
+
// };
|
208
|
+
// } else {
|
209
|
+
// return { value: it[http?.key || 'id'], label: it[http?.value || 'name'], disabled: false };
|
210
|
+
// }
|
211
|
+
// });
|
212
|
+
// } else {
|
213
|
+
// console.warn(`${_url} is not return success result`);
|
214
|
+
// return [];
|
215
|
+
// }
|
216
|
+
// },
|
217
|
+
// [],
|
218
|
+
// );
|
219
|
+
// const httpOptions = useAsyncMemo(async () => {
|
220
|
+
// if (extraInfo?.http && extraInfo?.http.url) {
|
221
|
+
// const res = await getEnumDataByUrl(deepClone(extraInfo?.http), '', extraInfo?.http?.isPagination && (pageRef.current as any));
|
222
|
+
// return res;
|
223
|
+
// } else {
|
224
|
+
// // 目前是更具那么的id判断的,暂未考虑重名问题
|
225
|
+
// if (initEnumValue[id]) {
|
226
|
+
// const _enum = deepClone(initEnumValue[id]);
|
227
|
+
// if (extraInfo?.http?.isCascader) {
|
228
|
+
// setCascaderOption([..._enum]);
|
229
|
+
// }
|
230
|
+
// if (extraInfo?.http?.isTreeSelect) {
|
231
|
+
// setTreeData([..._enum]);
|
232
|
+
// }
|
233
|
+
// }
|
234
|
+
// }
|
235
|
+
// return [];
|
236
|
+
// }, [http, watchValue, isRefreshHttp]);
|
151
237
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
152
238
|
style: {
|
153
239
|
display: 'flex'
|