ls-pro-common 1.0.4 → 1.0.8
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.css +2276 -0
- package/dist/common.js +1 -1
- package/dist/common.less +1 -0
- package/dist/common.min.css +2276 -0
- package/dist/common.min.js +1 -1
- package/es/components/DtlLayout.d.ts +20 -0
- package/es/components/DtlLayout.js +64 -0
- package/es/components/InputTable.d.ts +18 -0
- package/es/components/InputTable.js +225 -0
- package/es/components/common.less +64 -0
- package/es/hooks/useDtl/index.d.ts +29 -0
- package/es/hooks/useDtl/index.js +654 -0
- package/es/hooks/useSingle/index.d.ts +19 -7
- package/es/hooks/useSingle/index.js +282 -85
- package/es/http/index.d.ts +1 -1
- package/es/http/index.js +7 -3
- package/es/index.d.ts +6 -3
- package/es/index.js +4 -2
- package/es/utils/index.d.ts +45 -1
- package/es/utils/index.js +90 -1
- package/lib/components/DtlLayout.d.ts +20 -0
- package/lib/components/DtlLayout.js +81 -0
- package/lib/components/InputTable.d.ts +18 -0
- package/lib/components/InputTable.js +254 -0
- package/lib/components/common.less +64 -0
- package/lib/hooks/useDtl/index.d.ts +29 -0
- package/lib/hooks/useDtl/index.js +675 -0
- package/lib/hooks/useSingle/index.d.ts +19 -7
- package/lib/hooks/useSingle/index.js +283 -86
- package/lib/http/index.d.ts +1 -1
- package/lib/http/index.js +7 -3
- package/lib/index.d.ts +6 -3
- package/lib/index.js +20 -4
- package/lib/utils/index.d.ts +45 -1
- package/lib/utils/index.js +114 -3
- package/package.json +3 -3
- package/es/components/EditModalForm.d.ts +0 -5
- package/es/components/EditModalForm.js +0 -29
- package/lib/components/EditModalForm.d.ts +0 -5
- package/lib/components/EditModalForm.js +0 -42
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "antd/es/button/style";
|
|
2
2
|
import _Button from "antd/es/button";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
4
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
7
7
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
8
8
|
var _excluded = ["current", "pageSize"];
|
|
@@ -13,15 +13,24 @@ import { showConfirm, showWarn, showSuccess } from '../../utils';
|
|
|
13
13
|
/**
|
|
14
14
|
* 单表基本增删改查 hooks
|
|
15
15
|
* @param service 单表服务
|
|
16
|
-
* @param
|
|
16
|
+
* @param toolConfig 定义基础功能按钮
|
|
17
17
|
* @param initItem 对象初始值,新增时设置默认值
|
|
18
|
-
* @param onBeforeSave 保存之前方法,开放给每个模块重写
|
|
19
18
|
* @param onBeforeRemove 删除之前方法,开放给每个模块重写
|
|
20
19
|
* @returns
|
|
21
20
|
*/
|
|
22
21
|
|
|
23
|
-
function useSingle(
|
|
22
|
+
function useSingle(inParam) {
|
|
23
|
+
var service = inParam.service,
|
|
24
|
+
toolConfig = inParam.toolConfig,
|
|
25
|
+
initItem = inParam.initItem,
|
|
26
|
+
beforeLoad = inParam.beforeLoad,
|
|
27
|
+
beforeRemove = inParam.beforeRemove,
|
|
28
|
+
beforeAdd = inParam.beforeAdd,
|
|
29
|
+
beforeEdit = inParam.beforeEdit,
|
|
30
|
+
afterRemove = inParam.afterRemove,
|
|
31
|
+
afterSave = inParam.afterSave;
|
|
24
32
|
/** @name 选中行数据 */
|
|
33
|
+
|
|
25
34
|
var _useState = useState([]),
|
|
26
35
|
_useState2 = _slicedToArray(_useState, 2),
|
|
27
36
|
selectedRows = _useState2[0],
|
|
@@ -40,31 +49,118 @@ function useSingle(service, toolConfig, initItem, beforeSave, beforeRemove) {
|
|
|
40
49
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
41
50
|
editItem = _useState6[0],
|
|
42
51
|
setEditItem = _useState6[1];
|
|
43
|
-
/** @name 表格
|
|
52
|
+
/** @name 表格Ref */
|
|
44
53
|
|
|
45
54
|
|
|
46
55
|
var tableRef = useRef();
|
|
47
|
-
/** @name 查询表单
|
|
56
|
+
/** @name 查询表单Ref */
|
|
48
57
|
|
|
49
58
|
var formRef = useRef();
|
|
59
|
+
/**@name 编辑表单Ref */
|
|
60
|
+
|
|
61
|
+
var editFormRef = useRef();
|
|
50
62
|
/** 新增按钮事件 */
|
|
51
63
|
|
|
52
|
-
var onAdd = function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
var onAdd = /*#__PURE__*/function () {
|
|
65
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
66
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
67
|
+
while (1) {
|
|
68
|
+
switch (_context.prev = _context.next) {
|
|
69
|
+
case 0:
|
|
70
|
+
_context.t0 = beforeAdd;
|
|
71
|
+
|
|
72
|
+
if (!_context.t0) {
|
|
73
|
+
_context.next = 6;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
_context.next = 4;
|
|
78
|
+
return beforeAdd(initItem);
|
|
79
|
+
|
|
80
|
+
case 4:
|
|
81
|
+
_context.t1 = _context.sent;
|
|
82
|
+
_context.t0 = _context.t1 === false;
|
|
83
|
+
|
|
84
|
+
case 6:
|
|
85
|
+
if (!_context.t0) {
|
|
86
|
+
_context.next = 8;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return _context.abrupt("return");
|
|
91
|
+
|
|
92
|
+
case 8:
|
|
93
|
+
setEditItem(initItem);
|
|
94
|
+
setShowEdit(true);
|
|
95
|
+
|
|
96
|
+
case 10:
|
|
97
|
+
case "end":
|
|
98
|
+
return _context.stop();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, _callee);
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
return function onAdd() {
|
|
105
|
+
return _ref.apply(this, arguments);
|
|
106
|
+
};
|
|
107
|
+
}();
|
|
56
108
|
/** 编辑按钮事件 */
|
|
57
109
|
|
|
58
110
|
|
|
59
|
-
var onEdit = function
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
111
|
+
var onEdit = /*#__PURE__*/function () {
|
|
112
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
113
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
114
|
+
while (1) {
|
|
115
|
+
switch (_context2.prev = _context2.next) {
|
|
116
|
+
case 0:
|
|
117
|
+
if (selectedRows.length) {
|
|
118
|
+
_context2.next = 3;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
64
121
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
122
|
+
showWarn('请先选择需要更改的数据');
|
|
123
|
+
return _context2.abrupt("return");
|
|
124
|
+
|
|
125
|
+
case 3:
|
|
126
|
+
_context2.t0 = beforeEdit;
|
|
127
|
+
|
|
128
|
+
if (!_context2.t0) {
|
|
129
|
+
_context2.next = 9;
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
_context2.next = 7;
|
|
134
|
+
return beforeEdit(selectedRows[0]);
|
|
135
|
+
|
|
136
|
+
case 7:
|
|
137
|
+
_context2.t1 = _context2.sent;
|
|
138
|
+
_context2.t0 = _context2.t1 === false;
|
|
139
|
+
|
|
140
|
+
case 9:
|
|
141
|
+
if (!_context2.t0) {
|
|
142
|
+
_context2.next = 11;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return _context2.abrupt("return");
|
|
147
|
+
|
|
148
|
+
case 11:
|
|
149
|
+
setEditItem(selectedRows[0]);
|
|
150
|
+
setShowEdit(true);
|
|
151
|
+
|
|
152
|
+
case 13:
|
|
153
|
+
case "end":
|
|
154
|
+
return _context2.stop();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}, _callee2);
|
|
158
|
+
}));
|
|
159
|
+
|
|
160
|
+
return function onEdit() {
|
|
161
|
+
return _ref2.apply(this, arguments);
|
|
162
|
+
};
|
|
163
|
+
}();
|
|
68
164
|
/** 删除按钮事件 */
|
|
69
165
|
|
|
70
166
|
|
|
@@ -74,67 +170,103 @@ function useSingle(service, toolConfig, initItem, beforeSave, beforeRemove) {
|
|
|
74
170
|
return;
|
|
75
171
|
}
|
|
76
172
|
|
|
77
|
-
showConfirm('确认要删除选择的数据?').then(function () {
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
173
|
+
showConfirm('确认要删除选择的数据?').then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
174
|
+
var _result$flag;
|
|
175
|
+
|
|
176
|
+
var ids, result;
|
|
177
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
178
|
+
while (1) {
|
|
179
|
+
switch (_context3.prev = _context3.next) {
|
|
180
|
+
case 0:
|
|
181
|
+
if (!beforeRemove) {
|
|
182
|
+
_context3.next = 6;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
83
185
|
|
|
84
|
-
|
|
85
|
-
|
|
186
|
+
_context3.next = 3;
|
|
187
|
+
return beforeRemove(selectedRows);
|
|
86
188
|
|
|
87
|
-
|
|
88
|
-
|
|
189
|
+
case 3:
|
|
190
|
+
ids = _context3.sent;
|
|
191
|
+
|
|
192
|
+
if (!(ids === false)) {
|
|
193
|
+
_context3.next = 6;
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return _context3.abrupt("return");
|
|
198
|
+
|
|
199
|
+
case 6:
|
|
200
|
+
if (!ids) {
|
|
201
|
+
ids = selectedRows.map(function (o) {
|
|
202
|
+
return o.id;
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
_context3.next = 9;
|
|
207
|
+
return service.remove(ids);
|
|
208
|
+
|
|
209
|
+
case 9:
|
|
210
|
+
result = _context3.sent;
|
|
211
|
+
|
|
212
|
+
if (!afterRemove) {
|
|
213
|
+
_context3.next = 13;
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
afterRemove(result, selectedRows);
|
|
218
|
+
return _context3.abrupt("return");
|
|
219
|
+
|
|
220
|
+
case 13:
|
|
221
|
+
if ((result === null || result === void 0 ? void 0 : (_result$flag = result.flag) === null || _result$flag === void 0 ? void 0 : _result$flag.retCode) === '0') {
|
|
222
|
+
showSuccess(result.flag.retMsg);
|
|
223
|
+
|
|
224
|
+
if (tableRef.current) {
|
|
225
|
+
tableRef.current.reload(false);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
case 14:
|
|
230
|
+
case "end":
|
|
231
|
+
return _context3.stop();
|
|
89
232
|
}
|
|
90
233
|
}
|
|
91
|
-
});
|
|
92
|
-
});
|
|
234
|
+
}, _callee3);
|
|
235
|
+
})));
|
|
93
236
|
};
|
|
94
237
|
/** 新增,更改对应的保存事件 */
|
|
95
238
|
|
|
96
239
|
|
|
97
240
|
var onSave = /*#__PURE__*/function () {
|
|
98
|
-
var
|
|
241
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(formData) {
|
|
99
242
|
var _result$flag2;
|
|
100
243
|
|
|
101
244
|
var data, result;
|
|
102
|
-
return _regeneratorRuntime.wrap(function
|
|
245
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
103
246
|
while (1) {
|
|
104
|
-
switch (
|
|
247
|
+
switch (_context4.prev = _context4.next) {
|
|
105
248
|
case 0:
|
|
106
249
|
data = _objectSpread(_objectSpread({}, editItem), formData);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (!_context.t0) {
|
|
110
|
-
_context.next = 7;
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
_context.next = 5;
|
|
115
|
-
return beforeSave(data);
|
|
250
|
+
_context4.next = 3;
|
|
251
|
+
return service.save(data);
|
|
116
252
|
|
|
117
|
-
case
|
|
118
|
-
|
|
119
|
-
_context.t0 = _context.t1 === false;
|
|
253
|
+
case 3:
|
|
254
|
+
result = _context4.sent;
|
|
120
255
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
_context.next = 9;
|
|
256
|
+
if (!afterSave) {
|
|
257
|
+
_context4.next = 8;
|
|
124
258
|
break;
|
|
125
259
|
}
|
|
126
260
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
case 9:
|
|
130
|
-
_context.next = 11;
|
|
131
|
-
return service.save(data);
|
|
261
|
+
_context4.next = 7;
|
|
262
|
+
return afterSave(result, data);
|
|
132
263
|
|
|
133
|
-
case
|
|
134
|
-
|
|
264
|
+
case 7:
|
|
265
|
+
return _context4.abrupt("return", _context4.sent);
|
|
135
266
|
|
|
267
|
+
case 8:
|
|
136
268
|
if (!((result === null || result === void 0 ? void 0 : (_result$flag2 = result.flag) === null || _result$flag2 === void 0 ? void 0 : _result$flag2.retCode) === '0')) {
|
|
137
|
-
|
|
269
|
+
_context4.next = 12;
|
|
138
270
|
break;
|
|
139
271
|
}
|
|
140
272
|
|
|
@@ -144,32 +276,32 @@ function useSingle(service, toolConfig, initItem, beforeSave, beforeRemove) {
|
|
|
144
276
|
tableRef.current.reload(false);
|
|
145
277
|
}
|
|
146
278
|
|
|
147
|
-
return
|
|
279
|
+
return _context4.abrupt("return", true);
|
|
148
280
|
|
|
149
|
-
case
|
|
150
|
-
return
|
|
281
|
+
case 12:
|
|
282
|
+
return _context4.abrupt("return", false);
|
|
151
283
|
|
|
152
|
-
case
|
|
284
|
+
case 13:
|
|
153
285
|
case "end":
|
|
154
|
-
return
|
|
286
|
+
return _context4.stop();
|
|
155
287
|
}
|
|
156
288
|
}
|
|
157
|
-
},
|
|
289
|
+
}, _callee4);
|
|
158
290
|
}));
|
|
159
291
|
|
|
160
292
|
return function onSave(_x) {
|
|
161
|
-
return
|
|
293
|
+
return _ref4.apply(this, arguments);
|
|
162
294
|
};
|
|
163
295
|
}();
|
|
164
296
|
/** 加载数据方法 */
|
|
165
297
|
|
|
166
298
|
|
|
167
299
|
var onLoad = /*#__PURE__*/function () {
|
|
168
|
-
var
|
|
169
|
-
var current, pageSize, rest, param, result;
|
|
170
|
-
return _regeneratorRuntime.wrap(function
|
|
300
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(params, sort, filter) {
|
|
301
|
+
var current, pageSize, rest, param, key, result;
|
|
302
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
171
303
|
while (1) {
|
|
172
|
-
switch (
|
|
304
|
+
switch (_context5.prev = _context5.next) {
|
|
173
305
|
case 0:
|
|
174
306
|
current = params.current, pageSize = params.pageSize, rest = _objectWithoutProperties(params, _excluded);
|
|
175
307
|
param = {};
|
|
@@ -179,37 +311,90 @@ function useSingle(service, toolConfig, initItem, beforeSave, beforeRemove) {
|
|
|
179
311
|
param.pageSize = pageSize;
|
|
180
312
|
}
|
|
181
313
|
|
|
314
|
+
for (key in rest) {
|
|
315
|
+
if (rest[key] === '') {
|
|
316
|
+
delete rest[key];
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
182
320
|
if (Object.keys(rest).length) {
|
|
183
321
|
param.where = rest;
|
|
184
322
|
}
|
|
185
323
|
|
|
186
|
-
|
|
187
|
-
|
|
324
|
+
_context5.t0 = beforeLoad;
|
|
325
|
+
|
|
326
|
+
if (!_context5.t0) {
|
|
327
|
+
_context5.next = 11;
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
_context5.next = 9;
|
|
332
|
+
return beforeLoad(param);
|
|
333
|
+
|
|
334
|
+
case 9:
|
|
335
|
+
_context5.t1 = _context5.sent;
|
|
336
|
+
_context5.t0 = _context5.t1 === false;
|
|
337
|
+
|
|
338
|
+
case 11:
|
|
339
|
+
if (!_context5.t0) {
|
|
340
|
+
_context5.next = 13;
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
return _context5.abrupt("return", {
|
|
345
|
+
data: [],
|
|
346
|
+
success: false,
|
|
347
|
+
total: 0
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
case 13:
|
|
351
|
+
_context5.next = 15;
|
|
188
352
|
return service.load(param);
|
|
189
353
|
|
|
190
|
-
case
|
|
191
|
-
result =
|
|
354
|
+
case 15:
|
|
355
|
+
result = _context5.sent;
|
|
192
356
|
result.data = result.rows;
|
|
193
357
|
result.success = true;
|
|
194
|
-
return
|
|
358
|
+
return _context5.abrupt("return", result);
|
|
195
359
|
|
|
196
|
-
case
|
|
360
|
+
case 19:
|
|
197
361
|
case "end":
|
|
198
|
-
return
|
|
362
|
+
return _context5.stop();
|
|
199
363
|
}
|
|
200
364
|
}
|
|
201
|
-
},
|
|
365
|
+
}, _callee5);
|
|
202
366
|
}));
|
|
203
367
|
|
|
204
368
|
return function onLoad(_x2, _x3, _x4) {
|
|
205
|
-
return
|
|
369
|
+
return _ref5.apply(this, arguments);
|
|
370
|
+
};
|
|
371
|
+
}();
|
|
372
|
+
|
|
373
|
+
var onExport = /*#__PURE__*/function () {
|
|
374
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(url, param) {
|
|
375
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
376
|
+
while (1) {
|
|
377
|
+
switch (_context6.prev = _context6.next) {
|
|
378
|
+
case 0:
|
|
379
|
+
return _context6.abrupt("return", true);
|
|
380
|
+
|
|
381
|
+
case 1:
|
|
382
|
+
case "end":
|
|
383
|
+
return _context6.stop();
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}, _callee6);
|
|
387
|
+
}));
|
|
388
|
+
|
|
389
|
+
return function onExport(_x5, _x6) {
|
|
390
|
+
return _ref6.apply(this, arguments);
|
|
206
391
|
};
|
|
207
392
|
}();
|
|
208
393
|
|
|
209
|
-
var
|
|
394
|
+
var tableTools = [];
|
|
210
395
|
|
|
211
396
|
if (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.add) {
|
|
212
|
-
|
|
397
|
+
tableTools.push( /*#__PURE__*/React.createElement(_Button, {
|
|
213
398
|
key: "add",
|
|
214
399
|
onClick: onAdd,
|
|
215
400
|
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
|
@@ -217,16 +402,16 @@ function useSingle(service, toolConfig, initItem, beforeSave, beforeRemove) {
|
|
|
217
402
|
}
|
|
218
403
|
|
|
219
404
|
if (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.edit) {
|
|
220
|
-
|
|
405
|
+
tableTools.push( /*#__PURE__*/React.createElement(_Button, {
|
|
221
406
|
key: "edit",
|
|
222
|
-
disabled: selectedRows.length
|
|
407
|
+
disabled: selectedRows.length !== 1,
|
|
223
408
|
onClick: onEdit,
|
|
224
409
|
icon: /*#__PURE__*/React.createElement(EditOutlined, null)
|
|
225
410
|
}, "\u7F16\u8F91"));
|
|
226
411
|
}
|
|
227
412
|
|
|
228
413
|
if (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.remove) {
|
|
229
|
-
|
|
414
|
+
tableTools.push( /*#__PURE__*/React.createElement(_Button, {
|
|
230
415
|
key: "remove",
|
|
231
416
|
onClick: onRemove,
|
|
232
417
|
danger: true,
|
|
@@ -236,26 +421,37 @@ function useSingle(service, toolConfig, initItem, beforeSave, beforeRemove) {
|
|
|
236
421
|
}
|
|
237
422
|
|
|
238
423
|
if (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.import) {
|
|
239
|
-
|
|
424
|
+
tableTools.push( /*#__PURE__*/React.createElement(_Button, {
|
|
240
425
|
key: "import",
|
|
426
|
+
onClick: function onClick() {
|
|
427
|
+
var _tableRef$current, _tableRef$current$sho;
|
|
428
|
+
|
|
429
|
+
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$sho = _tableRef$current.showImport) === null || _tableRef$current$sho === void 0 ? void 0 : _tableRef$current$sho.call(_tableRef$current);
|
|
430
|
+
},
|
|
241
431
|
icon: /*#__PURE__*/React.createElement(ImportOutlined, null)
|
|
242
432
|
}, "\u5BFC\u5165"));
|
|
243
433
|
}
|
|
244
434
|
|
|
245
435
|
if (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.export) {
|
|
246
|
-
|
|
436
|
+
tableTools.push( /*#__PURE__*/React.createElement(_Button, {
|
|
247
437
|
key: "export",
|
|
438
|
+
onClick: function onClick() {
|
|
439
|
+
var _tableRef$current2, _tableRef$current2$sh;
|
|
440
|
+
|
|
441
|
+
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);
|
|
442
|
+
},
|
|
248
443
|
icon: /*#__PURE__*/React.createElement(ExportOutlined, null)
|
|
249
444
|
}, "\u5BFC\u51FA"));
|
|
250
445
|
}
|
|
251
446
|
|
|
252
447
|
return {
|
|
253
448
|
formRef: formRef,
|
|
449
|
+
editFormRef: editFormRef,
|
|
254
450
|
tableRef: tableRef,
|
|
255
451
|
selectedRows: selectedRows,
|
|
256
452
|
showEdit: showEdit,
|
|
257
453
|
editItem: editItem,
|
|
258
|
-
|
|
454
|
+
tableTools: tableTools,
|
|
259
455
|
setSelectedRows: setSelectedRows,
|
|
260
456
|
setShowEdit: setShowEdit,
|
|
261
457
|
setEditItem: setEditItem,
|
|
@@ -263,7 +459,8 @@ function useSingle(service, toolConfig, initItem, beforeSave, beforeRemove) {
|
|
|
263
459
|
onSave: onSave,
|
|
264
460
|
onLoad: onLoad,
|
|
265
461
|
onAdd: onAdd,
|
|
266
|
-
onEdit: onEdit
|
|
462
|
+
onEdit: onEdit,
|
|
463
|
+
onExport: onExport
|
|
267
464
|
};
|
|
268
465
|
}
|
|
269
466
|
|
package/es/http/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare function httpDelete(url: string, data: any): Promise<any>;
|
|
|
33
33
|
* @param dictCode 字典编码
|
|
34
34
|
* @returns Promise<Record<string,string>>
|
|
35
35
|
*/
|
|
36
|
-
export declare function getDict(dictCode: string): Promise<any>;
|
|
36
|
+
export declare function getDict(dictCode: string, showValue?: boolean): Promise<any>;
|
|
37
37
|
/**
|
|
38
38
|
* 加载下拉框的数据源
|
|
39
39
|
* @param url 后端接口
|
package/es/http/index.js
CHANGED
|
@@ -234,11 +234,15 @@ export function getDict(_x8) {
|
|
|
234
234
|
|
|
235
235
|
function _getDict() {
|
|
236
236
|
_getDict = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(dictCode) {
|
|
237
|
-
var
|
|
237
|
+
var showValue,
|
|
238
|
+
api,
|
|
239
|
+
param,
|
|
240
|
+
_args6 = arguments;
|
|
238
241
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
239
242
|
while (1) {
|
|
240
243
|
switch (_context6.prev = _context6.next) {
|
|
241
244
|
case 0:
|
|
245
|
+
showValue = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : true;
|
|
242
246
|
api = '/lesoon-integration/sysDictDtl';
|
|
243
247
|
param = {
|
|
244
248
|
where: {
|
|
@@ -246,9 +250,9 @@ function _getDict() {
|
|
|
246
250
|
},
|
|
247
251
|
ifPage: 0
|
|
248
252
|
};
|
|
249
|
-
return _context6.abrupt("return", fetchOptions(api, param, 'dictValue', 'displayName'));
|
|
253
|
+
return _context6.abrupt("return", fetchOptions(api, param, 'dictValue', 'displayName', showValue));
|
|
250
254
|
|
|
251
|
-
case
|
|
255
|
+
case 4:
|
|
252
256
|
case "end":
|
|
253
257
|
return _context6.stop();
|
|
254
258
|
}
|
package/es/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import DtlLayout from './components/DtlLayout';
|
|
2
|
+
import InputTable from './components/InputTable';
|
|
2
3
|
import BaseService from './service/BaseService';
|
|
3
4
|
import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
|
|
4
5
|
import * as utils from './utils';
|
|
5
6
|
/** Hooks */
|
|
6
7
|
import useSingle from './hooks/useSingle';
|
|
8
|
+
import useDtl from './hooks/useDtl';
|
|
7
9
|
/** Type */
|
|
8
10
|
import type { ApiResponse, TableToolbar, BaseApiType, MethodType } from './typing';
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
+
import type { DtlLyaoutProps } from './components/DtlLayout';
|
|
12
|
+
export type { ApiResponse, TableToolbar, BaseApiType, MethodType, DtlLyaoutProps };
|
|
13
|
+
export { DtlLayout, InputTable, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl };
|
package/es/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import DtlLayout from './components/DtlLayout';
|
|
2
|
+
import InputTable from './components/InputTable';
|
|
2
3
|
import BaseService from './service/BaseService';
|
|
3
4
|
import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
|
|
4
5
|
import * as utils from './utils';
|
|
5
6
|
/** Hooks */
|
|
6
7
|
|
|
7
8
|
import useSingle from './hooks/useSingle';
|
|
8
|
-
|
|
9
|
+
import useDtl from './hooks/useDtl';
|
|
10
|
+
export { DtlLayout, InputTable, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl };
|
package/es/utils/index.d.ts
CHANGED
|
@@ -6,6 +6,13 @@ export declare const getUrlQuery: (name: string, url?: string) => string;
|
|
|
6
6
|
* @returns
|
|
7
7
|
*/
|
|
8
8
|
export declare const setUrlQuery: (url: string, keyvals?: Record<string, any>) => string;
|
|
9
|
+
/**
|
|
10
|
+
* 给 url 添加网关
|
|
11
|
+
* @param url 原url,以 / 打头
|
|
12
|
+
* @param defGateway 默认网关 /petrel
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare const toGatewayUrl: (url: string, defGateway?: string) => string;
|
|
9
16
|
/**
|
|
10
17
|
* 设置文档title
|
|
11
18
|
* @param {*} title
|
|
@@ -41,7 +48,7 @@ export declare const setCache: (key: string, data: any) => void;
|
|
|
41
48
|
* @param { String } key 关键字
|
|
42
49
|
* @returns 关键字对应的值
|
|
43
50
|
*/
|
|
44
|
-
export declare const getCache:
|
|
51
|
+
export declare const getCache: any;
|
|
45
52
|
/**
|
|
46
53
|
* 简单日期格式化
|
|
47
54
|
* @param {*} dt 传入时间参数,若不传取当前时间
|
|
@@ -78,3 +85,40 @@ export declare const yesnoList: {
|
|
|
78
85
|
text: string;
|
|
79
86
|
label: string;
|
|
80
87
|
}[];
|
|
88
|
+
/**
|
|
89
|
+
* 遍历树
|
|
90
|
+
* @param list 树对象
|
|
91
|
+
* @param fn 回调函数
|
|
92
|
+
* @param children 树属性字段
|
|
93
|
+
*/
|
|
94
|
+
export declare const treeEach: (list: any[], fn: (item: any, index: any, list: any[]) => void, children?: string) => void;
|
|
95
|
+
/**
|
|
96
|
+
* 查询数
|
|
97
|
+
* @param list 树对象
|
|
98
|
+
* @param key 查询属性
|
|
99
|
+
* @param val 查询值
|
|
100
|
+
* @param children 树属性字段
|
|
101
|
+
* @returns 返回符合条件的第一条对象
|
|
102
|
+
*/
|
|
103
|
+
export declare const treeFind: (list: any[], key: string, val: any, children?: string) => any;
|
|
104
|
+
export declare type UserType = {
|
|
105
|
+
id?: string;
|
|
106
|
+
userId?: string;
|
|
107
|
+
userName?: string;
|
|
108
|
+
loginName?: string;
|
|
109
|
+
companyId?: string;
|
|
110
|
+
email?: string;
|
|
111
|
+
employeeAttr?: string;
|
|
112
|
+
expireTime?: string;
|
|
113
|
+
icon?: string;
|
|
114
|
+
idCard?: string;
|
|
115
|
+
ifAdmin?: number | string;
|
|
116
|
+
orgId?: string;
|
|
117
|
+
orgParentIds?: string;
|
|
118
|
+
phoneNumber?: string;
|
|
119
|
+
remarks?: string;
|
|
120
|
+
};
|
|
121
|
+
export declare const getUserInfo: () => UserType | null;
|
|
122
|
+
export declare const getUserName: () => string | undefined;
|
|
123
|
+
export declare const getLoginName: () => string | undefined;
|
|
124
|
+
export declare const getCompanyId: () => string | undefined;
|