ls-pro-common 1.0.23 → 1.0.26
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/InputTable.d.ts +4 -0
- package/es/components/InputTable.js +119 -42
- package/es/hooks/useDtl/index.js +18 -14
- package/es/hooks/useSingle/index.js +19 -15
- package/es/http/index.js +1 -1
- package/es/utils/index.d.ts +9 -0
- package/es/utils/index.js +22 -0
- package/lib/components/InputTable.d.ts +4 -0
- package/lib/components/InputTable.js +120 -43
- package/lib/hooks/useDtl/index.js +18 -14
- package/lib/hooks/useSingle/index.js +19 -15
- package/lib/http/index.js +1 -1
- package/lib/utils/index.d.ts +9 -0
- package/lib/utils/index.js +29 -2
- package/package.json +3 -3
|
@@ -43,7 +43,7 @@ var _icons = require("@ant-design/icons");
|
|
|
43
43
|
|
|
44
44
|
var _http = require("../http");
|
|
45
45
|
|
|
46
|
-
var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange"],
|
|
46
|
+
var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect"],
|
|
47
47
|
_excluded2 = ["current", "pageSize"];
|
|
48
48
|
|
|
49
49
|
function InputTable(prop) {
|
|
@@ -85,38 +85,70 @@ function InputTable(prop) {
|
|
|
85
85
|
labelWidth = _prop$labelWidth === void 0 ? 70 : _prop$labelWidth,
|
|
86
86
|
textField = prop.textField,
|
|
87
87
|
onSelectChange = prop.onSelectChange,
|
|
88
|
+
beforeLoad = prop.beforeLoad,
|
|
89
|
+
afterLoad = prop.afterLoad,
|
|
90
|
+
_prop$isV = prop.isV2,
|
|
91
|
+
isV2 = _prop$isV === void 0 ? false : _prop$isV,
|
|
92
|
+
_prop$allowClear = prop.allowClear,
|
|
93
|
+
allowClear = _prop$allowClear === void 0 ? true : _prop$allowClear,
|
|
94
|
+
_prop$keepSelect = prop.keepSelect,
|
|
95
|
+
keepSelect = _prop$keepSelect === void 0 ? false : _prop$keepSelect,
|
|
88
96
|
rest = (0, _objectWithoutProperties2.default)(prop, _excluded);
|
|
89
97
|
var textNameProp = textName || name + '__text';
|
|
90
98
|
|
|
91
99
|
var loadData = /*#__PURE__*/function () {
|
|
92
100
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(param) {
|
|
93
|
-
var current, pageSize, rest, data, result;
|
|
101
|
+
var current, pageSize, rest, data, _tableRef$current, _tableRef$current$cle, result, rows;
|
|
102
|
+
|
|
94
103
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
95
104
|
while (1) {
|
|
96
105
|
switch (_context.prev = _context.next) {
|
|
97
106
|
case 0:
|
|
98
107
|
current = param.current, pageSize = param.pageSize, rest = (0, _objectWithoutProperties2.default)(param, _excluded2);
|
|
99
|
-
data = {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
108
|
+
data = {};
|
|
109
|
+
|
|
110
|
+
if (isV2) {
|
|
111
|
+
data['page.pn'] = current;
|
|
112
|
+
data['page.size'] = pageSize;
|
|
113
|
+
} else {
|
|
114
|
+
data.page = current;
|
|
115
|
+
data.pageSize = pageSize;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
;
|
|
103
119
|
|
|
104
|
-
if (Object.keys(rest).length) {
|
|
120
|
+
if (Object.keys(rest).length && !isV2) {
|
|
105
121
|
data.where = rest;
|
|
106
122
|
}
|
|
107
123
|
|
|
108
|
-
|
|
124
|
+
if (!keepSelect) {
|
|
125
|
+
setSelectedRows([]);
|
|
126
|
+
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$cle = _tableRef$current.clearSelected) === null || _tableRef$current$cle === void 0 ? void 0 : _tableRef$current$cle.call(_tableRef$current);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (beforeLoad) {
|
|
130
|
+
beforeLoad(data);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
;
|
|
134
|
+
_context.next = 10;
|
|
109
135
|
return (0, _http.httpGet)(url, data);
|
|
110
136
|
|
|
111
|
-
case
|
|
137
|
+
case 10:
|
|
112
138
|
result = _context.sent;
|
|
139
|
+
rows = result.rows || [];
|
|
140
|
+
|
|
141
|
+
if (afterLoad) {
|
|
142
|
+
afterLoad(rows);
|
|
143
|
+
}
|
|
144
|
+
|
|
113
145
|
return _context.abrupt("return", {
|
|
114
|
-
data:
|
|
146
|
+
data: rows,
|
|
115
147
|
total: result.total || 0,
|
|
116
148
|
success: true
|
|
117
149
|
});
|
|
118
150
|
|
|
119
|
-
case
|
|
151
|
+
case 14:
|
|
120
152
|
case "end":
|
|
121
153
|
return _context.stop();
|
|
122
154
|
}
|
|
@@ -133,10 +165,10 @@ function InputTable(prop) {
|
|
|
133
165
|
var _formRef$current;
|
|
134
166
|
|
|
135
167
|
var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.getFieldsValue();
|
|
136
|
-
var txt = formValue[textField || valueField];
|
|
137
168
|
|
|
138
|
-
if (
|
|
139
|
-
|
|
169
|
+
if (!textName && formValue[name]) {
|
|
170
|
+
formValue[textNameProp] = formValue[name];
|
|
171
|
+
formRef === null || formRef === void 0 ? void 0 : formRef.current.setFieldsValue((0, _objectSpread2.default)({}, formValue));
|
|
140
172
|
}
|
|
141
173
|
}, []);
|
|
142
174
|
|
|
@@ -175,12 +207,9 @@ function InputTable(prop) {
|
|
|
175
207
|
|
|
176
208
|
var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.getFieldsValue();
|
|
177
209
|
formValue[name] = record[valueField];
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
formValue[textNameProp] = record[textField || valueField];
|
|
182
|
-
}
|
|
183
|
-
|
|
210
|
+
var txt = record[textField || valueField];
|
|
211
|
+
formValue[textNameProp] = txt;
|
|
212
|
+
setText(txt);
|
|
184
213
|
(_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : _formRef$current3.setFieldsValue((0, _objectSpread2.default)({}, formValue));
|
|
185
214
|
setVisible(false);
|
|
186
215
|
onSelectChange === null || onSelectChange === void 0 ? void 0 : onSelectChange(record);
|
|
@@ -190,25 +219,19 @@ function InputTable(prop) {
|
|
|
190
219
|
toolBarRender: function toolBarRender() {
|
|
191
220
|
return [/*#__PURE__*/_react.default.createElement(_button.default, {
|
|
192
221
|
onClick: function onClick() {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
formValue[textNameProp] = txt;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
(_formRef$current5 = formRef.current) === null || _formRef$current5 === void 0 ? void 0 : _formRef$current5.setFieldsValue((0, _objectSpread2.default)({}, formValue));
|
|
210
|
-
}
|
|
211
|
-
|
|
222
|
+
var _formRef$current4, _formRef$current5;
|
|
223
|
+
|
|
224
|
+
var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : _formRef$current4.getFieldsValue();
|
|
225
|
+
formValue[name] = selectedRows.map(function (o) {
|
|
226
|
+
return o[valueField];
|
|
227
|
+
}).join(',');
|
|
228
|
+
var txt = selectedRows.map(function (o) {
|
|
229
|
+
return o[textField || valueField];
|
|
230
|
+
}).join(',');
|
|
231
|
+
formValue[textNameProp] = txt;
|
|
232
|
+
setText(txt);
|
|
233
|
+
(_formRef$current5 = formRef.current) === null || _formRef$current5 === void 0 ? void 0 : _formRef$current5.setFieldsValue((0, _objectSpread2.default)({}, formValue));
|
|
234
|
+
onSelectChange === null || onSelectChange === void 0 ? void 0 : onSelectChange(selectedRows);
|
|
212
235
|
setVisible(false);
|
|
213
236
|
}
|
|
214
237
|
}, "\u786E\u8BA4")];
|
|
@@ -222,7 +245,7 @@ function InputTable(prop) {
|
|
|
222
245
|
}
|
|
223
246
|
}, /*#__PURE__*/_react.default.createElement(_lsProForm.ProFormText, {
|
|
224
247
|
name: name
|
|
225
|
-
})), /*#__PURE__*/_react.default.createElement(_lsProForm.ProFormText, (0, _extends2.default)({
|
|
248
|
+
})), rest.label ? /*#__PURE__*/_react.default.createElement(_lsProForm.ProFormText, (0, _extends2.default)({
|
|
226
249
|
name: textNameProp
|
|
227
250
|
}, rest), /*#__PURE__*/_react.default.createElement(_input.default, {
|
|
228
251
|
suffix: /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
@@ -245,12 +268,66 @@ function InputTable(prop) {
|
|
|
245
268
|
var _formRef$current6;
|
|
246
269
|
|
|
247
270
|
var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current6 = formRef.current) === null || _formRef$current6 === void 0 ? void 0 : _formRef$current6.getFieldsValue();
|
|
248
|
-
|
|
271
|
+
var val = e.target.value;
|
|
272
|
+
formValue[name] = val;
|
|
273
|
+
formValue[textNameProp] = val;
|
|
274
|
+
formRef.current.setFieldsValue((0, _objectSpread2.default)({}, formValue));
|
|
275
|
+
},
|
|
276
|
+
onChange: function onChange(e) {
|
|
277
|
+
if (!e.target.value) {
|
|
278
|
+
var _formRef$current7;
|
|
279
|
+
|
|
280
|
+
var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current7 = formRef.current) === null || _formRef$current7 === void 0 ? void 0 : _formRef$current7.getFieldsValue();
|
|
281
|
+
formValue[name] = '';
|
|
282
|
+
formValue[textNameProp] = '';
|
|
283
|
+
formRef.current.setFieldsValue((0, _objectSpread2.default)({}, formValue));
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
readOnly: readonly,
|
|
287
|
+
allowClear: allowClear
|
|
288
|
+
})) : /*#__PURE__*/_react.default.createElement(_input.default, (0, _extends2.default)({
|
|
289
|
+
suffix: /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
290
|
+
content: /*#__PURE__*/_react.default.createElement("div", {
|
|
291
|
+
style: {
|
|
292
|
+
width: tableWidth + 'px',
|
|
293
|
+
height: tableHeight + 'px',
|
|
294
|
+
maxHeight: '95vh',
|
|
295
|
+
overflow: 'auto'
|
|
296
|
+
}
|
|
297
|
+
}, tableDom),
|
|
298
|
+
trigger: "click",
|
|
299
|
+
visible: visible,
|
|
300
|
+
onVisibleChange: setVisible
|
|
301
|
+
}, /*#__PURE__*/_react.default.createElement(_icons.MoreOutlined, null)),
|
|
302
|
+
onClick: function onClick() {
|
|
303
|
+
return setVisible(true);
|
|
304
|
+
},
|
|
305
|
+
onInput: function onInput(e) {
|
|
306
|
+
var _formRef$current8;
|
|
307
|
+
|
|
308
|
+
var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current8 = formRef.current) === null || _formRef$current8 === void 0 ? void 0 : _formRef$current8.getFieldsValue();
|
|
309
|
+
var val = e.target.value;
|
|
310
|
+
formValue[name] = val;
|
|
311
|
+
formValue[textNameProp] = val;
|
|
312
|
+
setText(val);
|
|
249
313
|
formRef.current.setFieldsValue((0, _objectSpread2.default)({}, formValue));
|
|
250
314
|
},
|
|
315
|
+
onChange: function onChange(e) {
|
|
316
|
+
//用于清除当前组件值
|
|
317
|
+
if (!e.target.value) {
|
|
318
|
+
var _formRef$current9;
|
|
319
|
+
|
|
320
|
+
setText('');
|
|
321
|
+
var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current9 = formRef.current) === null || _formRef$current9 === void 0 ? void 0 : _formRef$current9.getFieldsValue();
|
|
322
|
+
formValue[name] = '';
|
|
323
|
+
formValue[textNameProp] = '';
|
|
324
|
+
formRef.current.setFieldsValue((0, _objectSpread2.default)({}, formValue));
|
|
325
|
+
}
|
|
326
|
+
},
|
|
251
327
|
readOnly: readonly,
|
|
252
|
-
value: text
|
|
253
|
-
|
|
328
|
+
value: text,
|
|
329
|
+
allowClear: allowClear
|
|
330
|
+
}, rest === null || rest === void 0 ? void 0 : rest.fieldProps)));
|
|
254
331
|
}
|
|
255
332
|
|
|
256
333
|
var _default = InputTable;
|
|
@@ -632,6 +632,8 @@ function useDtl(dtlParam) {
|
|
|
632
632
|
|
|
633
633
|
var onLoadDtl = /*#__PURE__*/function () {
|
|
634
634
|
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(params, sort, filter) {
|
|
635
|
+
var _tableRef$current, _tableRef$current$cle;
|
|
636
|
+
|
|
635
637
|
var current, pageSize, rest, param, key, result;
|
|
636
638
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
637
639
|
while (1) {
|
|
@@ -670,23 +672,25 @@ function useDtl(dtlParam) {
|
|
|
670
672
|
}
|
|
671
673
|
}
|
|
672
674
|
|
|
675
|
+
setSelectedRows([]);
|
|
676
|
+
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$cle = _tableRef$current.clearSelected) === null || _tableRef$current$cle === void 0 ? void 0 : _tableRef$current$cle.call(_tableRef$current);
|
|
673
677
|
_context7.t0 = beforeLoad;
|
|
674
678
|
|
|
675
679
|
if (!_context7.t0) {
|
|
676
|
-
_context7.next =
|
|
680
|
+
_context7.next = 17;
|
|
677
681
|
break;
|
|
678
682
|
}
|
|
679
683
|
|
|
680
|
-
_context7.next =
|
|
684
|
+
_context7.next = 15;
|
|
681
685
|
return beforeLoad(param);
|
|
682
686
|
|
|
683
|
-
case
|
|
687
|
+
case 15:
|
|
684
688
|
_context7.t1 = _context7.sent;
|
|
685
689
|
_context7.t0 = _context7.t1 === false;
|
|
686
690
|
|
|
687
|
-
case
|
|
691
|
+
case 17:
|
|
688
692
|
if (!_context7.t0) {
|
|
689
|
-
_context7.next =
|
|
693
|
+
_context7.next = 19;
|
|
690
694
|
break;
|
|
691
695
|
}
|
|
692
696
|
|
|
@@ -695,17 +699,17 @@ function useDtl(dtlParam) {
|
|
|
695
699
|
success: true
|
|
696
700
|
});
|
|
697
701
|
|
|
698
|
-
case
|
|
699
|
-
_context7.next =
|
|
702
|
+
case 19:
|
|
703
|
+
_context7.next = 21;
|
|
700
704
|
return dtlService.load(param);
|
|
701
705
|
|
|
702
|
-
case
|
|
706
|
+
case 21:
|
|
703
707
|
result = _context7.sent;
|
|
704
708
|
result.data = result.rows;
|
|
705
709
|
result.success = true;
|
|
706
710
|
return _context7.abrupt("return", result);
|
|
707
711
|
|
|
708
|
-
case
|
|
712
|
+
case 25:
|
|
709
713
|
case "end":
|
|
710
714
|
return _context7.stop();
|
|
711
715
|
}
|
|
@@ -904,25 +908,25 @@ function useDtl(dtlParam) {
|
|
|
904
908
|
};
|
|
905
909
|
|
|
906
910
|
var onExport = function onExport() {
|
|
907
|
-
var _tableRef$
|
|
911
|
+
var _tableRef$current2, _tableRef$current2$sh;
|
|
908
912
|
|
|
909
913
|
if (!masterObject[mstKeyField]) {
|
|
910
914
|
(0, _utils.showWarn)('主表没保存,无法导出数据');
|
|
911
915
|
return;
|
|
912
916
|
}
|
|
913
917
|
|
|
914
|
-
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$
|
|
918
|
+
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$sh = _tableRef$current2.showExport) === null || _tableRef$current2$sh === void 0 ? void 0 : _tableRef$current2$sh.call(_tableRef$current2);
|
|
915
919
|
};
|
|
916
920
|
|
|
917
921
|
var onImport = function onImport() {
|
|
918
|
-
var _tableRef$
|
|
922
|
+
var _tableRef$current3, _tableRef$current3$sh;
|
|
919
923
|
|
|
920
924
|
if (!masterObject[mstKeyField]) {
|
|
921
925
|
(0, _utils.showWarn)('主表没保存,无法导入数据');
|
|
922
926
|
return;
|
|
923
927
|
}
|
|
924
928
|
|
|
925
|
-
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$
|
|
929
|
+
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current3 = tableRef.current) === null || _tableRef$current3 === void 0 ? void 0 : (_tableRef$current3$sh = _tableRef$current3.showImport) === null || _tableRef$current3$sh === void 0 ? void 0 : _tableRef$current3$sh.call(_tableRef$current3);
|
|
926
930
|
};
|
|
927
931
|
|
|
928
932
|
var tableTools = (0, _react.useMemo)(function () {
|
|
@@ -953,7 +957,7 @@ function useDtl(dtlParam) {
|
|
|
953
957
|
onImport();
|
|
954
958
|
},
|
|
955
959
|
icon: /*#__PURE__*/_react.default.createElement(_icons.ImportOutlined, null)
|
|
956
|
-
}, "\u5BFC\u5165") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.
|
|
960
|
+
}, "\u5BFC\u5165") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.export) ? /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
957
961
|
key: "export",
|
|
958
962
|
onClick: function onClick() {
|
|
959
963
|
onExport();
|
|
@@ -207,7 +207,7 @@ function useSingle(inParam) {
|
|
|
207
207
|
|
|
208
208
|
|
|
209
209
|
var onRemove = function onRemove(row) {
|
|
210
|
-
if (!row
|
|
210
|
+
if (!row && !selectedRows.length) {
|
|
211
211
|
(0, _utils.showWarn)('请选择需要删除的数据');
|
|
212
212
|
return;
|
|
213
213
|
}
|
|
@@ -503,6 +503,8 @@ function useSingle(inParam) {
|
|
|
503
503
|
|
|
504
504
|
var onLoad = /*#__PURE__*/function () {
|
|
505
505
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(params, sort, filter) {
|
|
506
|
+
var _tableRef$current, _tableRef$current$cle;
|
|
507
|
+
|
|
506
508
|
var current, pageSize, rest, param, key, result;
|
|
507
509
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
508
510
|
while (1) {
|
|
@@ -526,23 +528,25 @@ function useSingle(inParam) {
|
|
|
526
528
|
param.where = rest;
|
|
527
529
|
}
|
|
528
530
|
|
|
531
|
+
setSelectedRows([]);
|
|
532
|
+
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$cle = _tableRef$current.clearSelected) === null || _tableRef$current$cle === void 0 ? void 0 : _tableRef$current$cle.call(_tableRef$current);
|
|
529
533
|
_context6.t0 = beforeLoad;
|
|
530
534
|
|
|
531
535
|
if (!_context6.t0) {
|
|
532
|
-
_context6.next =
|
|
536
|
+
_context6.next = 13;
|
|
533
537
|
break;
|
|
534
538
|
}
|
|
535
539
|
|
|
536
|
-
_context6.next =
|
|
540
|
+
_context6.next = 11;
|
|
537
541
|
return beforeLoad(param);
|
|
538
542
|
|
|
539
|
-
case
|
|
543
|
+
case 11:
|
|
540
544
|
_context6.t1 = _context6.sent;
|
|
541
545
|
_context6.t0 = _context6.t1 === false;
|
|
542
546
|
|
|
543
|
-
case
|
|
547
|
+
case 13:
|
|
544
548
|
if (!_context6.t0) {
|
|
545
|
-
_context6.next =
|
|
549
|
+
_context6.next = 15;
|
|
546
550
|
break;
|
|
547
551
|
}
|
|
548
552
|
|
|
@@ -552,17 +556,17 @@ function useSingle(inParam) {
|
|
|
552
556
|
total: 0
|
|
553
557
|
});
|
|
554
558
|
|
|
555
|
-
case
|
|
556
|
-
_context6.next =
|
|
559
|
+
case 15:
|
|
560
|
+
_context6.next = 17;
|
|
557
561
|
return service.load(param);
|
|
558
562
|
|
|
559
|
-
case
|
|
563
|
+
case 17:
|
|
560
564
|
result = _context6.sent;
|
|
561
565
|
result.data = result.rows;
|
|
562
566
|
result.success = true;
|
|
563
567
|
return _context6.abrupt("return", result);
|
|
564
568
|
|
|
565
|
-
case
|
|
569
|
+
case 21:
|
|
566
570
|
case "end":
|
|
567
571
|
return _context6.stop();
|
|
568
572
|
}
|
|
@@ -710,17 +714,17 @@ function useSingle(inParam) {
|
|
|
710
714
|
}, "\u5BA1\u6838") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.import) && checkRight(128) ? /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
711
715
|
key: "import",
|
|
712
716
|
onClick: function onClick() {
|
|
713
|
-
var _tableRef$
|
|
717
|
+
var _tableRef$current2, _tableRef$current2$sh;
|
|
714
718
|
|
|
715
|
-
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$
|
|
719
|
+
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$sh = _tableRef$current2.showImport) === null || _tableRef$current2$sh === void 0 ? void 0 : _tableRef$current2$sh.call(_tableRef$current2);
|
|
716
720
|
},
|
|
717
721
|
icon: /*#__PURE__*/_react.default.createElement(_icons.ImportOutlined, null)
|
|
718
|
-
}, "\u5BFC\u5165") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.
|
|
722
|
+
}, "\u5BFC\u5165") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.export) && checkRight(256) ? /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
719
723
|
key: "export",
|
|
720
724
|
onClick: function onClick() {
|
|
721
|
-
var _tableRef$
|
|
725
|
+
var _tableRef$current3, _tableRef$current3$sh;
|
|
722
726
|
|
|
723
|
-
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$
|
|
727
|
+
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current3 = tableRef.current) === null || _tableRef$current3 === void 0 ? void 0 : (_tableRef$current3$sh = _tableRef$current3.showExport) === null || _tableRef$current3$sh === void 0 ? void 0 : _tableRef$current3$sh.call(_tableRef$current3);
|
|
724
728
|
},
|
|
725
729
|
icon: /*#__PURE__*/_react.default.createElement(_icons.ExportOutlined, null)
|
|
726
730
|
}, "\u5BFC\u51FA") : false].filter(function (o) {
|
package/lib/http/index.js
CHANGED
|
@@ -42,7 +42,7 @@ request.interceptors.request.use(function (url, options) {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
var param = {
|
|
45
|
-
resCode: (0, _utils.getUrlQuery)('resourceId') || (0, _utils.getResourceProps)('resourceId')
|
|
45
|
+
resCode: (0, _utils.getUrlQuery)('resCode') || (0, _utils.getUrlQuery)('resourceId') || (0, _utils.getResourceProps)('resourceId')
|
|
46
46
|
};
|
|
47
47
|
return {
|
|
48
48
|
url: (0, _utils.setUrlQuery)(url, param),
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -82,12 +82,15 @@ export declare const treeEach: (list: any[], fn: (item: any, index: any, list: a
|
|
|
82
82
|
* @returns 返回符合条件的第一条对象
|
|
83
83
|
*/
|
|
84
84
|
export declare const treeFind: (list: any[], key: string, val: any, children?: string) => any;
|
|
85
|
+
export declare const isDev: boolean;
|
|
85
86
|
export declare type UserType = {
|
|
86
87
|
id?: string;
|
|
87
88
|
userId?: string;
|
|
88
89
|
userName?: string;
|
|
89
90
|
loginName?: string;
|
|
90
91
|
companyId?: string;
|
|
92
|
+
companyCode?: string;
|
|
93
|
+
companyName?: string;
|
|
91
94
|
email?: string;
|
|
92
95
|
employeeAttr?: string;
|
|
93
96
|
expireTime?: string;
|
|
@@ -99,7 +102,13 @@ export declare type UserType = {
|
|
|
99
102
|
phoneNumber?: string;
|
|
100
103
|
remarks?: string;
|
|
101
104
|
};
|
|
105
|
+
/** @name 用户信息 */
|
|
102
106
|
export declare const getUserInfo: () => UserType | null;
|
|
107
|
+
/** @name 用户名 */
|
|
103
108
|
export declare const getUserName: () => string | undefined;
|
|
109
|
+
/** @name 登录名 */
|
|
104
110
|
export declare const getLoginName: () => string | undefined;
|
|
111
|
+
/** @name 公司Id */
|
|
105
112
|
export declare const getCompanyId: () => string | undefined;
|
|
113
|
+
/** @name 微前端原生路径 */
|
|
114
|
+
export declare const appPath: (path?: string) => any;
|
package/lib/utils/index.js
CHANGED
|
@@ -5,6 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
exports.appPath = void 0;
|
|
8
9
|
Object.defineProperty(exports, "dateFormat", {
|
|
9
10
|
enumerable: true,
|
|
10
11
|
get: function get() {
|
|
@@ -24,7 +25,7 @@ Object.defineProperty(exports, "getUrlQuery", {
|
|
|
24
25
|
return _utils.getUrlQuery;
|
|
25
26
|
}
|
|
26
27
|
});
|
|
27
|
-
exports.setTitle = exports.setCookie = exports.setCache = exports.rangeToSearch = exports.isLogin = exports.getUserName = exports.getUserInfo = void 0;
|
|
28
|
+
exports.setTitle = exports.setCookie = exports.setCache = exports.rangeToSearch = exports.isLogin = exports.isDev = exports.getUserName = exports.getUserInfo = void 0;
|
|
28
29
|
Object.defineProperty(exports, "setUrlQuery", {
|
|
29
30
|
enumerable: true,
|
|
30
31
|
get: function get() {
|
|
@@ -307,10 +308,16 @@ var treeFind = function treeFind(list, key, val) {
|
|
|
307
308
|
};
|
|
308
309
|
|
|
309
310
|
exports.treeFind = treeFind;
|
|
311
|
+
var isDev = location.href.includes("//localhost");
|
|
312
|
+
/** @name 用户信息 */
|
|
313
|
+
|
|
314
|
+
exports.isDev = isDev;
|
|
310
315
|
|
|
311
316
|
var getUserInfo = function getUserInfo() {
|
|
312
317
|
return getCache('user');
|
|
313
318
|
};
|
|
319
|
+
/** @name 用户名 */
|
|
320
|
+
|
|
314
321
|
|
|
315
322
|
exports.getUserInfo = getUserInfo;
|
|
316
323
|
|
|
@@ -319,6 +326,8 @@ var getUserName = function getUserName() {
|
|
|
319
326
|
|
|
320
327
|
return (_getUserInfo = getUserInfo()) === null || _getUserInfo === void 0 ? void 0 : _getUserInfo.userName;
|
|
321
328
|
};
|
|
329
|
+
/** @name 登录名 */
|
|
330
|
+
|
|
322
331
|
|
|
323
332
|
exports.getUserName = getUserName;
|
|
324
333
|
|
|
@@ -327,6 +336,8 @@ var getLoginName = function getLoginName() {
|
|
|
327
336
|
|
|
328
337
|
return (_getUserInfo2 = getUserInfo()) === null || _getUserInfo2 === void 0 ? void 0 : _getUserInfo2.loginName;
|
|
329
338
|
};
|
|
339
|
+
/** @name 公司Id */
|
|
340
|
+
|
|
330
341
|
|
|
331
342
|
exports.getLoginName = getLoginName;
|
|
332
343
|
|
|
@@ -335,5 +346,21 @@ var getCompanyId = function getCompanyId() {
|
|
|
335
346
|
|
|
336
347
|
return (_getUserInfo3 = getUserInfo()) === null || _getUserInfo3 === void 0 ? void 0 : _getUserInfo3.companyId;
|
|
337
348
|
};
|
|
349
|
+
/** @name 微前端原生路径 */
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
exports.getCompanyId = getCompanyId;
|
|
353
|
+
|
|
354
|
+
var appPath = function appPath() {
|
|
355
|
+
var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
356
|
+
|
|
357
|
+
// @ts-ignore
|
|
358
|
+
if (window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__) {
|
|
359
|
+
// @ts-ignore
|
|
360
|
+
return window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
return path ? path : './';
|
|
364
|
+
};
|
|
338
365
|
|
|
339
|
-
exports.
|
|
366
|
+
exports.appPath = appPath;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ls-pro-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26",
|
|
4
4
|
"description": "ls-pro-common",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antd",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@ant-design/icons": "^4.3.0",
|
|
31
|
-
"ls-pro-table": "2.62.
|
|
32
|
-
"ls-pro-form": "1.52.
|
|
31
|
+
"ls-pro-table": "2.62.24",
|
|
32
|
+
"ls-pro-form": "1.52.23",
|
|
33
33
|
"@babel/runtime": "^7.16.3",
|
|
34
34
|
"classnames": "^2.2.6",
|
|
35
35
|
"moment": "^2.27.0",
|