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