ls-pro-common 3.0.87 → 3.0.89
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/dist/common.js +1 -1
- package/dist/common.min.js +1 -1
- package/es/components/AreaCascader.js +9 -6
- package/es/components/AreaCascaderPanel.js +9 -6
- package/es/components/InputTable.d.ts +6 -0
- package/es/components/InputTable.js +18 -14
- package/es/hooks/useDict.d.ts +26 -0
- package/es/hooks/useDict.js +60 -0
- package/es/http/index.js +4 -1
- package/es/index.d.ts +4 -2
- package/es/index.js +2 -1
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +3 -0
- package/lib/components/AreaCascader.js +9 -6
- package/lib/components/AreaCascaderPanel.js +9 -6
- package/lib/components/InputTable.d.ts +6 -0
- package/lib/components/InputTable.js +18 -14
- package/lib/hooks/useDict.d.ts +26 -0
- package/lib/hooks/useDict.js +60 -0
- package/lib/http/index.js +4 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +2 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +3 -0
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
6
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
7
|
import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
8
8
|
import { httpGet } from '../http';
|
|
9
|
-
import { getCache, setCache, treeEach } from '../utils';
|
|
9
|
+
import { getCache, setCache, treeEach, isSaasVersion } from '../utils';
|
|
10
10
|
var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
11
11
|
var _useState = useState([]),
|
|
12
12
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -25,7 +25,7 @@ var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
25
25
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
26
26
|
while (1) switch (_context.prev = _context.next) {
|
|
27
27
|
case 0:
|
|
28
|
-
cacheItems = getCache(
|
|
28
|
+
cacheItems = getCache('areaOptions', true);
|
|
29
29
|
if (!(cacheItems && Array.isArray(cacheItems))) {
|
|
30
30
|
_context.next = 4;
|
|
31
31
|
break;
|
|
@@ -34,11 +34,14 @@ var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
34
34
|
return _context.abrupt("return");
|
|
35
35
|
case 4:
|
|
36
36
|
api = '/petrel/petrel-location-center-api/sysAdministrativeDivision/allByTree';
|
|
37
|
-
|
|
37
|
+
if (isSaasVersion()) {
|
|
38
|
+
api = '/lesoon/tenant-lesoon-mdm-center-api/sysAdministrativeDivision/allByTree';
|
|
39
|
+
}
|
|
40
|
+
_context.next = 8;
|
|
38
41
|
return httpGet(api, {}, false);
|
|
39
|
-
case
|
|
42
|
+
case 8:
|
|
40
43
|
result = _context.sent;
|
|
41
|
-
opts = result.rows || [];
|
|
44
|
+
opts = (isSaasVersion() ? result.data : result.rows) || [];
|
|
42
45
|
treeEach(opts, function (item) {
|
|
43
46
|
item.label = item.name;
|
|
44
47
|
item.value = item.id;
|
|
@@ -52,7 +55,7 @@ var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
52
55
|
});
|
|
53
56
|
setCache('areaOptions', opts, true);
|
|
54
57
|
setOptions(opts);
|
|
55
|
-
case
|
|
58
|
+
case 13:
|
|
56
59
|
case "end":
|
|
57
60
|
return _context.stop();
|
|
58
61
|
}
|
|
@@ -9,7 +9,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
10
|
import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
11
11
|
import { httpGet } from '../http';
|
|
12
|
-
import { getCache, setCache, treeEach } from '../utils';
|
|
12
|
+
import { getCache, setCache, treeEach, isSaasVersion } from '../utils';
|
|
13
13
|
import './common.less';
|
|
14
14
|
var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
15
15
|
var propsConfig = _objectSpread({
|
|
@@ -17,7 +17,7 @@ var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
17
17
|
var _document;
|
|
18
18
|
return (_document = document) === null || _document === void 0 ? void 0 : _document.body;
|
|
19
19
|
},
|
|
20
|
-
placeholder:
|
|
20
|
+
placeholder: '请选择'
|
|
21
21
|
}, props);
|
|
22
22
|
var _useState = useState(getCache('areaOptionsPanel', true) || []),
|
|
23
23
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -93,11 +93,14 @@ var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
93
93
|
return _context.abrupt("return");
|
|
94
94
|
case 3:
|
|
95
95
|
api = '/petrel/petrel-location-center-api/sysAdministrativeDivision/allByTree';
|
|
96
|
-
|
|
96
|
+
if (isSaasVersion()) {
|
|
97
|
+
api = '/lesoon/tenant-lesoon-mdm-center-api/sysAdministrativeDivision/allByTree';
|
|
98
|
+
}
|
|
99
|
+
_context.next = 7;
|
|
97
100
|
return httpGet(api, {}, false);
|
|
98
|
-
case
|
|
101
|
+
case 7:
|
|
99
102
|
result = _context.sent;
|
|
100
|
-
opts = result.rows || [];
|
|
103
|
+
opts = (isSaasVersion() ? result.data : result.rows) || [];
|
|
101
104
|
treeEach(opts, function (item) {
|
|
102
105
|
item.label = item.name;
|
|
103
106
|
item.value = item.id;
|
|
@@ -111,7 +114,7 @@ var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
111
114
|
setCache('areaOptionsPanel', opts, true);
|
|
112
115
|
setOptions(opts);
|
|
113
116
|
setShowData(opts);
|
|
114
|
-
case
|
|
117
|
+
case 13:
|
|
115
118
|
case "end":
|
|
116
119
|
return _context.stop();
|
|
117
120
|
}
|
|
@@ -41,7 +41,10 @@ export declare type InputTableProps = ProFormItemProps<InputProps> & {
|
|
|
41
41
|
arrowPointAtCenter?: boolean;
|
|
42
42
|
method?: 'GET' | 'POST';
|
|
43
43
|
rowKey?: any;
|
|
44
|
+
record?: any;
|
|
44
45
|
changeOnSelect?: boolean;
|
|
46
|
+
value?: string;
|
|
47
|
+
onChange?: (value?: string) => void;
|
|
45
48
|
/** @name 选择行事件 */
|
|
46
49
|
onSelectChange?: (item: any, formRef?: any) => void;
|
|
47
50
|
/** @name 加载之前事件,param为查询条件对象,可以通过此方法调整 */
|
|
@@ -98,7 +101,10 @@ declare const InputTable: React.ForwardRefExoticComponent<{
|
|
|
98
101
|
arrowPointAtCenter?: boolean | undefined;
|
|
99
102
|
method?: "POST" | "GET" | undefined;
|
|
100
103
|
rowKey?: any;
|
|
104
|
+
record?: any;
|
|
101
105
|
changeOnSelect?: boolean | undefined;
|
|
106
|
+
value?: string | undefined;
|
|
107
|
+
onChange?: ((value?: string | undefined) => void) | undefined;
|
|
102
108
|
/** @name 选择行事件 */
|
|
103
109
|
onSelectChange?: ((item: any, formRef?: any) => void) | undefined;
|
|
104
110
|
/** @name 加载之前事件,param为查询条件对象,可以通过此方法调整 */
|
|
@@ -11,7 +11,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
11
11
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
12
12
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
13
13
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
14
|
-
var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps", "searchField", "fillMap", "loadOnShow", "triggerCheck", "getPopupContainer", "placement", "arrowPointAtCenter", "rowKey", "method", "changeOnSelect"],
|
|
14
|
+
var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps", "searchField", "fillMap", "loadOnShow", "triggerCheck", "getPopupContainer", "placement", "arrowPointAtCenter", "rowKey", "method", "changeOnSelect", "record"],
|
|
15
15
|
_excluded2 = ["current", "pageSize"];
|
|
16
16
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
17
17
|
import React, { useRef, useState, useEffect, useContext, useMemo, useImperativeHandle } from 'react';
|
|
@@ -34,7 +34,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
34
34
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
35
35
|
visible = _useState4[0],
|
|
36
36
|
setVisible = _useState4[1];
|
|
37
|
-
var _useState5 = useState(''),
|
|
37
|
+
var _useState5 = useState(prop.value || ''),
|
|
38
38
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
39
39
|
text = _useState6[0],
|
|
40
40
|
setText = _useState6[1];
|
|
@@ -87,6 +87,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
87
87
|
method = _prop$method === void 0 ? 'GET' : _prop$method,
|
|
88
88
|
_prop$changeOnSelect = prop.changeOnSelect,
|
|
89
89
|
changeOnSelect = _prop$changeOnSelect === void 0 ? true : _prop$changeOnSelect,
|
|
90
|
+
record = prop.record,
|
|
90
91
|
rest = _objectWithoutProperties(prop, _excluded);
|
|
91
92
|
if (!valueField && isDev) {
|
|
92
93
|
console.error('valueField 属性必须设置');
|
|
@@ -123,7 +124,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
123
124
|
}, [columns, searchField, valueField, textField]);
|
|
124
125
|
var loadData = /*#__PURE__*/function () {
|
|
125
126
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
|
|
126
|
-
var current, pageSize, rest, data, _tableRef$current, _tableRef$current$cle, result, rows, _formRef$current, _formRef$current$getF, val, _selectRowRef$current, arr, pageSelectedRows;
|
|
127
|
+
var current, pageSize, rest, data, _tableRef$current, _tableRef$current$cle, result, rows, _formRef$current, _formRef$current$getF, formValue, val, _selectRowRef$current, arr, pageSelectedRows;
|
|
127
128
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
128
129
|
while (1) switch (_context.prev = _context.next) {
|
|
129
130
|
case 0:
|
|
@@ -170,7 +171,11 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
170
171
|
}
|
|
171
172
|
// 多选时,找出当前页的默认选中项
|
|
172
173
|
if (multiple) {
|
|
173
|
-
|
|
174
|
+
formValue = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : (_formRef$current$getF = _formRef$current.getFieldsValue) === null || _formRef$current$getF === void 0 ? void 0 : _formRef$current$getF.call(_formRef$current)) || {};
|
|
175
|
+
if (rowKey) {
|
|
176
|
+
formValue = formValue[rowKey] || {};
|
|
177
|
+
}
|
|
178
|
+
val = formValue[name] || (record === null || record === void 0 ? void 0 : record[name]);
|
|
174
179
|
if (val) {
|
|
175
180
|
arr = val.split(',');
|
|
176
181
|
pageSelectedRows = rows.filter(function (row) {
|
|
@@ -206,6 +211,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
206
211
|
// 初始化数据
|
|
207
212
|
useEffect(function () {
|
|
208
213
|
setTimeout(function () {
|
|
214
|
+
var _rest$onChange;
|
|
209
215
|
var txt = '',
|
|
210
216
|
val = '';
|
|
211
217
|
var row;
|
|
@@ -213,7 +219,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
213
219
|
try {
|
|
214
220
|
var _formRef$current2, _formRef$current2$get, _formRef$current2$get2, _row, _row2;
|
|
215
221
|
row = formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : (_formRef$current2$get = _formRef$current2.getFieldsValue) === null || _formRef$current2$get === void 0 ? void 0 : (_formRef$current2$get2 = _formRef$current2$get.call(_formRef$current2)) === null || _formRef$current2$get2 === void 0 ? void 0 : _formRef$current2$get2[rowKey];
|
|
216
|
-
txt = (_row = row) === null || _row === void 0 ? void 0 : _row[textNameProp];
|
|
222
|
+
txt = ((_row = row) === null || _row === void 0 ? void 0 : _row[textNameProp]) || (record === null || record === void 0 ? void 0 : record[textNameProp]);
|
|
217
223
|
val = (_row2 = row) === null || _row2 === void 0 ? void 0 : _row2[name];
|
|
218
224
|
} catch (_unused) {}
|
|
219
225
|
} else {
|
|
@@ -233,11 +239,12 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
233
239
|
formRef === null || formRef === void 0 ? void 0 : (_formRef$current6 = formRef.current) === null || _formRef$current6 === void 0 ? void 0 : (_formRef$current6$set = _formRef$current6.setFieldsValue) === null || _formRef$current6$set === void 0 ? void 0 : _formRef$current6$set.call(_formRef$current6, _defineProperty({}, textNameProp, val));
|
|
234
240
|
}
|
|
235
241
|
}
|
|
242
|
+
(_rest$onChange = rest.onChange) === null || _rest$onChange === void 0 ? void 0 : _rest$onChange.call(rest, text || val);
|
|
236
243
|
}, 0);
|
|
237
244
|
}, [rowKey]);
|
|
238
245
|
// 处理返回数据
|
|
239
246
|
var handleValue = function handleValue(row) {
|
|
240
|
-
var _formRef$current7, _formRef$current7$get;
|
|
247
|
+
var _formRef$current7, _formRef$current7$get, _rest$onChange2;
|
|
241
248
|
var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
242
249
|
var formValue = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current7 = formRef.current) === null || _formRef$current7 === void 0 ? void 0 : (_formRef$current7$get = _formRef$current7.getFieldsValue) === null || _formRef$current7$get === void 0 ? void 0 : _formRef$current7$get.call(_formRef$current7)) || {};
|
|
243
250
|
if (rowKey) {
|
|
@@ -277,6 +284,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
277
284
|
}
|
|
278
285
|
formValue[textNameProp] = txt;
|
|
279
286
|
setText(txt);
|
|
287
|
+
(_rest$onChange2 = rest.onChange) === null || _rest$onChange2 === void 0 ? void 0 : _rest$onChange2.call(rest, txt);
|
|
280
288
|
if (close) {
|
|
281
289
|
setVisible(false);
|
|
282
290
|
}
|
|
@@ -321,7 +329,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
321
329
|
};
|
|
322
330
|
//直接输入不回车,value 和 text 为同一个值
|
|
323
331
|
var onInput = function onInput(e) {
|
|
324
|
-
var _formRef$current10, _formRef$current10$ge;
|
|
332
|
+
var _formRef$current10, _formRef$current10$ge, _rest$onChange3;
|
|
325
333
|
var formValue = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current10 = formRef.current) === null || _formRef$current10 === void 0 ? void 0 : (_formRef$current10$ge = _formRef$current10.getFieldsValue) === null || _formRef$current10$ge === void 0 ? void 0 : _formRef$current10$ge.call(_formRef$current10)) || {};
|
|
326
334
|
if (rowKey) {
|
|
327
335
|
formValue = formValue[rowKey] || {};
|
|
@@ -330,6 +338,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
330
338
|
formValue[name] = val;
|
|
331
339
|
formValue[textNameProp] = val;
|
|
332
340
|
setText(val);
|
|
341
|
+
(_rest$onChange3 = rest.onChange) === null || _rest$onChange3 === void 0 ? void 0 : _rest$onChange3.call(rest, val);
|
|
333
342
|
if (rowKey) {
|
|
334
343
|
var _formRef$current11, _formRef$current11$se;
|
|
335
344
|
formRef === null || formRef === void 0 ? void 0 : (_formRef$current11 = formRef.current) === null || _formRef$current11 === void 0 ? void 0 : (_formRef$current11$se = _formRef$current11.setFieldsValue) === null || _formRef$current11$se === void 0 ? void 0 : _formRef$current11$se.call(_formRef$current11, _defineProperty({}, rowKey, formValue));
|
|
@@ -341,8 +350,9 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
341
350
|
// 当表单重置或点clear时,处理值
|
|
342
351
|
var clearValue = function clearValue(e) {
|
|
343
352
|
if (!e.target.value) {
|
|
344
|
-
var _formRef$current13, _formRef$current13$ge;
|
|
353
|
+
var _rest$onChange4, _formRef$current13, _formRef$current13$ge;
|
|
345
354
|
setText('');
|
|
355
|
+
(_rest$onChange4 = rest.onChange) === null || _rest$onChange4 === void 0 ? void 0 : _rest$onChange4.call(rest, '');
|
|
346
356
|
var formValue = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current13 = formRef.current) === null || _formRef$current13 === void 0 ? void 0 : (_formRef$current13$ge = _formRef$current13.getFieldsValue) === null || _formRef$current13$ge === void 0 ? void 0 : _formRef$current13$ge.call(_formRef$current13)) || {};
|
|
347
357
|
if (rowKey) {
|
|
348
358
|
formValue = formValue[rowKey] || {};
|
|
@@ -376,12 +386,6 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
376
386
|
(_tableRef$current4 = tableRef.current) === null || _tableRef$current4 === void 0 ? void 0 : (_tableRef$current4$re = _tableRef$current4.reload) === null || _tableRef$current4$re === void 0 ? void 0 : _tableRef$current4$re.call(_tableRef$current4);
|
|
377
387
|
}
|
|
378
388
|
}, [visible, loadOnShow]);
|
|
379
|
-
useEffect(function () {
|
|
380
|
-
// if (!visible || !multiple || !text) return;
|
|
381
|
-
// const list = tableRef.current?.getDatasource();
|
|
382
|
-
// if (list?.length > 0 && selectRowRef.current.length === 0) {
|
|
383
|
-
// }
|
|
384
|
-
}, [visible, text]);
|
|
385
389
|
var tableDom = /*#__PURE__*/React.createElement(ProTable, _extends({
|
|
386
390
|
className: "ls-input-table",
|
|
387
391
|
columns: columns,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare type TOption = {
|
|
2
|
+
label: string;
|
|
3
|
+
value: any;
|
|
4
|
+
text?: string;
|
|
5
|
+
status?: number;
|
|
6
|
+
};
|
|
7
|
+
declare type TDictItem = {
|
|
8
|
+
dict: string;
|
|
9
|
+
showValue?: boolean;
|
|
10
|
+
/** 是否转换数字 */
|
|
11
|
+
isValNum?: boolean;
|
|
12
|
+
transform?: (data: TOption[]) => TOption[];
|
|
13
|
+
};
|
|
14
|
+
declare type TDictParams = Record<string, string | (() => Promise<TOption[]>) | TDictItem>;
|
|
15
|
+
/** 字典类型 */
|
|
16
|
+
export declare type TDict<T extends TDictParams> = {
|
|
17
|
+
[key in keyof T]?: TOption[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* 获取字典
|
|
21
|
+
*
|
|
22
|
+
* @param dicts 字典列表
|
|
23
|
+
* @param type 字典类型 默认 tenant
|
|
24
|
+
*/
|
|
25
|
+
export declare function useDict<T extends TDictParams>(dicts: T): { [key in keyof T]?: TOption[] | undefined; };
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import { getDict } from '../http';
|
|
4
|
+
import { useEffect, useState } from 'react';
|
|
5
|
+
/** Value转换数字 */
|
|
6
|
+
var transformNum = function transformNum(options) {
|
|
7
|
+
return options.map(function (v) {
|
|
8
|
+
return _objectSpread(_objectSpread({}, v), {}, {
|
|
9
|
+
value: Number(v.value)
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* 获取字典
|
|
15
|
+
*
|
|
16
|
+
* @param dicts 字典列表
|
|
17
|
+
* @param type 字典类型 默认 tenant
|
|
18
|
+
*/
|
|
19
|
+
export function useDict(dicts) {
|
|
20
|
+
var _useState = useState({}),
|
|
21
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
+
dictList = _useState2[0],
|
|
23
|
+
setDictList = _useState2[1];
|
|
24
|
+
useEffect(function () {
|
|
25
|
+
var keys = Object.keys(dicts);
|
|
26
|
+
var pList = [];
|
|
27
|
+
var result = {};
|
|
28
|
+
keys.forEach(function (k) {
|
|
29
|
+
if (typeof dicts[k] === 'string') {
|
|
30
|
+
pList.push(getDict(dicts[k]));
|
|
31
|
+
} else if (typeof dicts[k] === 'function') {
|
|
32
|
+
var fn = dicts[k];
|
|
33
|
+
pList.push(fn());
|
|
34
|
+
} else {
|
|
35
|
+
var _dicts$k = dicts[k],
|
|
36
|
+
dict = _dicts$k.dict,
|
|
37
|
+
showValue = _dicts$k.showValue,
|
|
38
|
+
isValNum = _dicts$k.isValNum,
|
|
39
|
+
_dicts$k$transform = _dicts$k.transform,
|
|
40
|
+
transform = _dicts$k$transform === void 0 ? function (d) {
|
|
41
|
+
return d;
|
|
42
|
+
} : _dicts$k$transform;
|
|
43
|
+
var _transform = transform;
|
|
44
|
+
if (isValNum) _transform = transformNum;
|
|
45
|
+
pList.push(getDict(dict, showValue).then(_transform));
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Promise.allSettled(pList).then(function (res) {
|
|
49
|
+
res.forEach(function (v, i) {
|
|
50
|
+
if (v.status === 'fulfilled') {
|
|
51
|
+
result[keys[i]] = v.value;
|
|
52
|
+
} else {
|
|
53
|
+
result[keys[i]] = [];
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
setDictList(result);
|
|
57
|
+
});
|
|
58
|
+
}, []);
|
|
59
|
+
return dictList;
|
|
60
|
+
}
|
package/es/http/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { extend } from 'umi-request';
|
|
4
|
-
import { getCache, getUrlQuery, setUrlQuery, getCookie, getResourceProps, showError, httpError, toGatewayUrl, reLogin, showLoading, exitLoading } from '../utils';
|
|
4
|
+
import { getCache, getUrlQuery, setUrlQuery, getCookie, getResourceProps, showError, httpError, toGatewayUrl, reLogin, showLoading, exitLoading, isSaasVersion } from '../utils';
|
|
5
5
|
//默认超时时间为1分钟
|
|
6
6
|
var request = extend({
|
|
7
7
|
timeout: 60000
|
|
@@ -277,6 +277,9 @@ export function getDict(dictCode) {
|
|
|
277
277
|
var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
278
278
|
var timeout = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 60000;
|
|
279
279
|
var api = '/lesoon-integration/sysDictDtl/listByProperties';
|
|
280
|
+
if (isSaasVersion()) {
|
|
281
|
+
api = '/tenant-lesoon-integration-api/sysDictDtl/listByProperties';
|
|
282
|
+
}
|
|
280
283
|
var param = {
|
|
281
284
|
dictCode: dictCode
|
|
282
285
|
};
|
package/es/index.d.ts
CHANGED
|
@@ -31,10 +31,12 @@ import useBaseDict from './hooks/useBaseDict';
|
|
|
31
31
|
import useSelectOptions from './hooks/useSelectOptions';
|
|
32
32
|
import showConfirmFun from './hooks/useShowConfirm';
|
|
33
33
|
import useQueue from './hooks/useQueue';
|
|
34
|
+
import { useDict } from './hooks/useDict';
|
|
34
35
|
/** Type */
|
|
35
36
|
import type { ApiResponse, TableToolbar, BaseApiType, MethodType } from './typing';
|
|
36
37
|
import type { DtlLyaoutProps } from './components/DtlLayout';
|
|
37
38
|
import type { DescritionCardProps } from './components/DescritionCard';
|
|
38
39
|
import type { PermissionProps } from './components/Permission';
|
|
39
|
-
|
|
40
|
-
export {
|
|
40
|
+
import type { TDict } from './hooks/useDict';
|
|
41
|
+
export type { ApiResponse, TableToolbar, BaseApiType, MethodType, DtlLyaoutProps, DescritionCardProps, PermissionProps, TDict, };
|
|
42
|
+
export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, ViewOffice, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState, useFilterLocal, useQueue, useBaseDict, useSelectOptions, useDict, showConfirmFun, exportProcess, };
|
package/es/index.js
CHANGED
|
@@ -31,4 +31,5 @@ import useBaseDict from './hooks/useBaseDict';
|
|
|
31
31
|
import useSelectOptions from './hooks/useSelectOptions';
|
|
32
32
|
import showConfirmFun from './hooks/useShowConfirm';
|
|
33
33
|
import useQueue from './hooks/useQueue';
|
|
34
|
-
|
|
34
|
+
import { useDict } from './hooks/useDict';
|
|
35
|
+
export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, ViewOffice, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState, useFilterLocal, useQueue, useBaseDict, useSelectOptions, useDict, showConfirmFun, exportProcess };
|
package/es/utils/index.d.ts
CHANGED
|
@@ -316,3 +316,4 @@ export declare const exitLoading: () => void;
|
|
|
316
316
|
export declare const handleTheme: () => void;
|
|
317
317
|
export declare const sleep: (secord: number) => Promise<unknown>;
|
|
318
318
|
export declare const downloadFile: (url: string, fileName?: string | undefined) => void;
|
|
319
|
+
export declare const isSaasVersion: () => boolean;
|
package/es/utils/index.js
CHANGED
|
@@ -915,4 +915,7 @@ export var downloadFile = function downloadFile(url, fileName) {
|
|
|
915
915
|
document.body.appendChild(a);
|
|
916
916
|
a.click();
|
|
917
917
|
document.body.removeChild(a);
|
|
918
|
+
};
|
|
919
|
+
export var isSaasVersion = function isSaasVersion() {
|
|
920
|
+
return (getCache('poi-center-api') || '').includes('/tenant-lesoon-basic-api/');
|
|
918
921
|
};
|
|
@@ -6,7 +6,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
6
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
7
|
import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
8
8
|
import { httpGet } from '../http';
|
|
9
|
-
import { getCache, setCache, treeEach } from '../utils';
|
|
9
|
+
import { getCache, setCache, treeEach, isSaasVersion } from '../utils';
|
|
10
10
|
var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
11
11
|
var _useState = useState([]),
|
|
12
12
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -25,7 +25,7 @@ var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
25
25
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
26
26
|
while (1) switch (_context.prev = _context.next) {
|
|
27
27
|
case 0:
|
|
28
|
-
cacheItems = getCache(
|
|
28
|
+
cacheItems = getCache('areaOptions', true);
|
|
29
29
|
if (!(cacheItems && Array.isArray(cacheItems))) {
|
|
30
30
|
_context.next = 4;
|
|
31
31
|
break;
|
|
@@ -34,11 +34,14 @@ var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
34
34
|
return _context.abrupt("return");
|
|
35
35
|
case 4:
|
|
36
36
|
api = '/petrel/petrel-location-center-api/sysAdministrativeDivision/allByTree';
|
|
37
|
-
|
|
37
|
+
if (isSaasVersion()) {
|
|
38
|
+
api = '/lesoon/tenant-lesoon-mdm-center-api/sysAdministrativeDivision/allByTree';
|
|
39
|
+
}
|
|
40
|
+
_context.next = 8;
|
|
38
41
|
return httpGet(api, {}, false);
|
|
39
|
-
case
|
|
42
|
+
case 8:
|
|
40
43
|
result = _context.sent;
|
|
41
|
-
opts = result.rows || [];
|
|
44
|
+
opts = (isSaasVersion() ? result.data : result.rows) || [];
|
|
42
45
|
treeEach(opts, function (item) {
|
|
43
46
|
item.label = item.name;
|
|
44
47
|
item.value = item.id;
|
|
@@ -52,7 +55,7 @@ var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
52
55
|
});
|
|
53
56
|
setCache('areaOptions', opts, true);
|
|
54
57
|
setOptions(opts);
|
|
55
|
-
case
|
|
58
|
+
case 13:
|
|
56
59
|
case "end":
|
|
57
60
|
return _context.stop();
|
|
58
61
|
}
|
|
@@ -9,7 +9,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
10
|
import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
11
11
|
import { httpGet } from '../http';
|
|
12
|
-
import { getCache, setCache, treeEach } from '../utils';
|
|
12
|
+
import { getCache, setCache, treeEach, isSaasVersion } from '../utils';
|
|
13
13
|
import './common.less';
|
|
14
14
|
var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
15
15
|
var propsConfig = _objectSpread({
|
|
@@ -17,7 +17,7 @@ var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
17
17
|
var _document;
|
|
18
18
|
return (_document = document) === null || _document === void 0 ? void 0 : _document.body;
|
|
19
19
|
},
|
|
20
|
-
placeholder:
|
|
20
|
+
placeholder: '请选择'
|
|
21
21
|
}, props);
|
|
22
22
|
var _useState = useState(getCache('areaOptionsPanel', true) || []),
|
|
23
23
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -93,11 +93,14 @@ var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
93
93
|
return _context.abrupt("return");
|
|
94
94
|
case 3:
|
|
95
95
|
api = '/petrel/petrel-location-center-api/sysAdministrativeDivision/allByTree';
|
|
96
|
-
|
|
96
|
+
if (isSaasVersion()) {
|
|
97
|
+
api = '/lesoon/tenant-lesoon-mdm-center-api/sysAdministrativeDivision/allByTree';
|
|
98
|
+
}
|
|
99
|
+
_context.next = 7;
|
|
97
100
|
return httpGet(api, {}, false);
|
|
98
|
-
case
|
|
101
|
+
case 7:
|
|
99
102
|
result = _context.sent;
|
|
100
|
-
opts = result.rows || [];
|
|
103
|
+
opts = (isSaasVersion() ? result.data : result.rows) || [];
|
|
101
104
|
treeEach(opts, function (item) {
|
|
102
105
|
item.label = item.name;
|
|
103
106
|
item.value = item.id;
|
|
@@ -111,7 +114,7 @@ var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
111
114
|
setCache('areaOptionsPanel', opts, true);
|
|
112
115
|
setOptions(opts);
|
|
113
116
|
setShowData(opts);
|
|
114
|
-
case
|
|
117
|
+
case 13:
|
|
115
118
|
case "end":
|
|
116
119
|
return _context.stop();
|
|
117
120
|
}
|
|
@@ -41,7 +41,10 @@ export declare type InputTableProps = ProFormItemProps<InputProps> & {
|
|
|
41
41
|
arrowPointAtCenter?: boolean;
|
|
42
42
|
method?: 'GET' | 'POST';
|
|
43
43
|
rowKey?: any;
|
|
44
|
+
record?: any;
|
|
44
45
|
changeOnSelect?: boolean;
|
|
46
|
+
value?: string;
|
|
47
|
+
onChange?: (value?: string) => void;
|
|
45
48
|
/** @name 选择行事件 */
|
|
46
49
|
onSelectChange?: (item: any, formRef?: any) => void;
|
|
47
50
|
/** @name 加载之前事件,param为查询条件对象,可以通过此方法调整 */
|
|
@@ -98,7 +101,10 @@ declare const InputTable: React.ForwardRefExoticComponent<{
|
|
|
98
101
|
arrowPointAtCenter?: boolean | undefined;
|
|
99
102
|
method?: "POST" | "GET" | undefined;
|
|
100
103
|
rowKey?: any;
|
|
104
|
+
record?: any;
|
|
101
105
|
changeOnSelect?: boolean | undefined;
|
|
106
|
+
value?: string | undefined;
|
|
107
|
+
onChange?: ((value?: string | undefined) => void) | undefined;
|
|
102
108
|
/** @name 选择行事件 */
|
|
103
109
|
onSelectChange?: ((item: any, formRef?: any) => void) | undefined;
|
|
104
110
|
/** @name 加载之前事件,param为查询条件对象,可以通过此方法调整 */
|
|
@@ -11,7 +11,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
11
11
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
12
12
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
13
13
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
14
|
-
var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps", "searchField", "fillMap", "loadOnShow", "triggerCheck", "getPopupContainer", "placement", "arrowPointAtCenter", "rowKey", "method", "changeOnSelect"],
|
|
14
|
+
var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps", "searchField", "fillMap", "loadOnShow", "triggerCheck", "getPopupContainer", "placement", "arrowPointAtCenter", "rowKey", "method", "changeOnSelect", "record"],
|
|
15
15
|
_excluded2 = ["current", "pageSize"];
|
|
16
16
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
17
17
|
import React, { useRef, useState, useEffect, useContext, useMemo, useImperativeHandle } from 'react';
|
|
@@ -34,7 +34,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
34
34
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
35
35
|
visible = _useState4[0],
|
|
36
36
|
setVisible = _useState4[1];
|
|
37
|
-
var _useState5 = useState(''),
|
|
37
|
+
var _useState5 = useState(prop.value || ''),
|
|
38
38
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
39
39
|
text = _useState6[0],
|
|
40
40
|
setText = _useState6[1];
|
|
@@ -87,6 +87,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
87
87
|
method = _prop$method === void 0 ? 'GET' : _prop$method,
|
|
88
88
|
_prop$changeOnSelect = prop.changeOnSelect,
|
|
89
89
|
changeOnSelect = _prop$changeOnSelect === void 0 ? true : _prop$changeOnSelect,
|
|
90
|
+
record = prop.record,
|
|
90
91
|
rest = _objectWithoutProperties(prop, _excluded);
|
|
91
92
|
if (!valueField && isDev) {
|
|
92
93
|
console.error('valueField 属性必须设置');
|
|
@@ -123,7 +124,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
123
124
|
}, [columns, searchField, valueField, textField]);
|
|
124
125
|
var loadData = /*#__PURE__*/function () {
|
|
125
126
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
|
|
126
|
-
var current, pageSize, rest, data, _tableRef$current, _tableRef$current$cle, result, rows, _formRef$current, _formRef$current$getF, val, _selectRowRef$current, arr, pageSelectedRows;
|
|
127
|
+
var current, pageSize, rest, data, _tableRef$current, _tableRef$current$cle, result, rows, _formRef$current, _formRef$current$getF, formValue, val, _selectRowRef$current, arr, pageSelectedRows;
|
|
127
128
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
128
129
|
while (1) switch (_context.prev = _context.next) {
|
|
129
130
|
case 0:
|
|
@@ -170,7 +171,11 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
170
171
|
}
|
|
171
172
|
// 多选时,找出当前页的默认选中项
|
|
172
173
|
if (multiple) {
|
|
173
|
-
|
|
174
|
+
formValue = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : (_formRef$current$getF = _formRef$current.getFieldsValue) === null || _formRef$current$getF === void 0 ? void 0 : _formRef$current$getF.call(_formRef$current)) || {};
|
|
175
|
+
if (rowKey) {
|
|
176
|
+
formValue = formValue[rowKey] || {};
|
|
177
|
+
}
|
|
178
|
+
val = formValue[name] || (record === null || record === void 0 ? void 0 : record[name]);
|
|
174
179
|
if (val) {
|
|
175
180
|
arr = val.split(',');
|
|
176
181
|
pageSelectedRows = rows.filter(function (row) {
|
|
@@ -206,6 +211,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
206
211
|
// 初始化数据
|
|
207
212
|
useEffect(function () {
|
|
208
213
|
setTimeout(function () {
|
|
214
|
+
var _rest$onChange;
|
|
209
215
|
var txt = '',
|
|
210
216
|
val = '';
|
|
211
217
|
var row;
|
|
@@ -213,7 +219,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
213
219
|
try {
|
|
214
220
|
var _formRef$current2, _formRef$current2$get, _formRef$current2$get2, _row, _row2;
|
|
215
221
|
row = formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : (_formRef$current2$get = _formRef$current2.getFieldsValue) === null || _formRef$current2$get === void 0 ? void 0 : (_formRef$current2$get2 = _formRef$current2$get.call(_formRef$current2)) === null || _formRef$current2$get2 === void 0 ? void 0 : _formRef$current2$get2[rowKey];
|
|
216
|
-
txt = (_row = row) === null || _row === void 0 ? void 0 : _row[textNameProp];
|
|
222
|
+
txt = ((_row = row) === null || _row === void 0 ? void 0 : _row[textNameProp]) || (record === null || record === void 0 ? void 0 : record[textNameProp]);
|
|
217
223
|
val = (_row2 = row) === null || _row2 === void 0 ? void 0 : _row2[name];
|
|
218
224
|
} catch (_unused) {}
|
|
219
225
|
} else {
|
|
@@ -233,11 +239,12 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
233
239
|
formRef === null || formRef === void 0 ? void 0 : (_formRef$current6 = formRef.current) === null || _formRef$current6 === void 0 ? void 0 : (_formRef$current6$set = _formRef$current6.setFieldsValue) === null || _formRef$current6$set === void 0 ? void 0 : _formRef$current6$set.call(_formRef$current6, _defineProperty({}, textNameProp, val));
|
|
234
240
|
}
|
|
235
241
|
}
|
|
242
|
+
(_rest$onChange = rest.onChange) === null || _rest$onChange === void 0 ? void 0 : _rest$onChange.call(rest, text || val);
|
|
236
243
|
}, 0);
|
|
237
244
|
}, [rowKey]);
|
|
238
245
|
// 处理返回数据
|
|
239
246
|
var handleValue = function handleValue(row) {
|
|
240
|
-
var _formRef$current7, _formRef$current7$get;
|
|
247
|
+
var _formRef$current7, _formRef$current7$get, _rest$onChange2;
|
|
241
248
|
var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
242
249
|
var formValue = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current7 = formRef.current) === null || _formRef$current7 === void 0 ? void 0 : (_formRef$current7$get = _formRef$current7.getFieldsValue) === null || _formRef$current7$get === void 0 ? void 0 : _formRef$current7$get.call(_formRef$current7)) || {};
|
|
243
250
|
if (rowKey) {
|
|
@@ -277,6 +284,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
277
284
|
}
|
|
278
285
|
formValue[textNameProp] = txt;
|
|
279
286
|
setText(txt);
|
|
287
|
+
(_rest$onChange2 = rest.onChange) === null || _rest$onChange2 === void 0 ? void 0 : _rest$onChange2.call(rest, txt);
|
|
280
288
|
if (close) {
|
|
281
289
|
setVisible(false);
|
|
282
290
|
}
|
|
@@ -321,7 +329,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
321
329
|
};
|
|
322
330
|
//直接输入不回车,value 和 text 为同一个值
|
|
323
331
|
var onInput = function onInput(e) {
|
|
324
|
-
var _formRef$current10, _formRef$current10$ge;
|
|
332
|
+
var _formRef$current10, _formRef$current10$ge, _rest$onChange3;
|
|
325
333
|
var formValue = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current10 = formRef.current) === null || _formRef$current10 === void 0 ? void 0 : (_formRef$current10$ge = _formRef$current10.getFieldsValue) === null || _formRef$current10$ge === void 0 ? void 0 : _formRef$current10$ge.call(_formRef$current10)) || {};
|
|
326
334
|
if (rowKey) {
|
|
327
335
|
formValue = formValue[rowKey] || {};
|
|
@@ -330,6 +338,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
330
338
|
formValue[name] = val;
|
|
331
339
|
formValue[textNameProp] = val;
|
|
332
340
|
setText(val);
|
|
341
|
+
(_rest$onChange3 = rest.onChange) === null || _rest$onChange3 === void 0 ? void 0 : _rest$onChange3.call(rest, val);
|
|
333
342
|
if (rowKey) {
|
|
334
343
|
var _formRef$current11, _formRef$current11$se;
|
|
335
344
|
formRef === null || formRef === void 0 ? void 0 : (_formRef$current11 = formRef.current) === null || _formRef$current11 === void 0 ? void 0 : (_formRef$current11$se = _formRef$current11.setFieldsValue) === null || _formRef$current11$se === void 0 ? void 0 : _formRef$current11$se.call(_formRef$current11, _defineProperty({}, rowKey, formValue));
|
|
@@ -341,8 +350,9 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
341
350
|
// 当表单重置或点clear时,处理值
|
|
342
351
|
var clearValue = function clearValue(e) {
|
|
343
352
|
if (!e.target.value) {
|
|
344
|
-
var _formRef$current13, _formRef$current13$ge;
|
|
353
|
+
var _rest$onChange4, _formRef$current13, _formRef$current13$ge;
|
|
345
354
|
setText('');
|
|
355
|
+
(_rest$onChange4 = rest.onChange) === null || _rest$onChange4 === void 0 ? void 0 : _rest$onChange4.call(rest, '');
|
|
346
356
|
var formValue = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current13 = formRef.current) === null || _formRef$current13 === void 0 ? void 0 : (_formRef$current13$ge = _formRef$current13.getFieldsValue) === null || _formRef$current13$ge === void 0 ? void 0 : _formRef$current13$ge.call(_formRef$current13)) || {};
|
|
347
357
|
if (rowKey) {
|
|
348
358
|
formValue = formValue[rowKey] || {};
|
|
@@ -376,12 +386,6 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
376
386
|
(_tableRef$current4 = tableRef.current) === null || _tableRef$current4 === void 0 ? void 0 : (_tableRef$current4$re = _tableRef$current4.reload) === null || _tableRef$current4$re === void 0 ? void 0 : _tableRef$current4$re.call(_tableRef$current4);
|
|
377
387
|
}
|
|
378
388
|
}, [visible, loadOnShow]);
|
|
379
|
-
useEffect(function () {
|
|
380
|
-
// if (!visible || !multiple || !text) return;
|
|
381
|
-
// const list = tableRef.current?.getDatasource();
|
|
382
|
-
// if (list?.length > 0 && selectRowRef.current.length === 0) {
|
|
383
|
-
// }
|
|
384
|
-
}, [visible, text]);
|
|
385
389
|
var tableDom = /*#__PURE__*/React.createElement(ProTable, _extends({
|
|
386
390
|
className: "ls-input-table",
|
|
387
391
|
columns: columns,
|