ls-pro-common 1.0.19 → 1.0.22
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/DtlLayout.d.ts +15 -0
- package/es/components/DtlLayout.js +29 -18
- package/es/components/InputTable.d.ts +1 -0
- package/es/components/InputTable.js +6 -3
- package/es/hooks/useDtl/index.d.ts +6 -4
- package/es/hooks/useDtl/index.js +310 -119
- package/es/hooks/usePermission/index.d.ts +7 -0
- package/es/hooks/usePermission/index.js +38 -0
- package/es/hooks/useSingle/index.d.ts +16 -6
- package/es/hooks/useSingle/index.js +357 -159
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/service/BaseService.d.ts +1 -0
- package/es/service/BaseService.js +45 -2
- package/es/typing.d.ts +4 -0
- package/es/utils/index.js +1 -1
- package/lib/components/DtlLayout.d.ts +15 -0
- package/lib/components/DtlLayout.js +28 -17
- package/lib/components/InputTable.d.ts +1 -0
- package/lib/components/InputTable.js +6 -3
- package/lib/hooks/useDtl/index.d.ts +6 -4
- package/lib/hooks/useDtl/index.js +309 -118
- package/lib/hooks/usePermission/index.d.ts +7 -0
- package/lib/hooks/usePermission/index.js +47 -0
- package/lib/hooks/useSingle/index.d.ts +16 -6
- package/lib/hooks/useSingle/index.js +356 -158
- package/lib/index.d.ts +2 -1
- package/lib/index.js +9 -1
- package/lib/service/BaseService.d.ts +1 -0
- package/lib/service/BaseService.js +45 -2
- package/lib/typing.d.ts +4 -0
- package/lib/utils/index.js +1 -1
- package/package.json +3 -3
package/es/hooks/useDtl/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
7
7
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
8
8
|
var _excluded = ["current", "pageSize"];
|
|
9
9
|
import React from "react";
|
|
10
|
-
import { useState, useRef } from 'react';
|
|
10
|
+
import { useState, useRef, useCallback, useMemo } from 'react';
|
|
11
11
|
import { PlusOutlined, EditOutlined, DeleteOutlined, ImportOutlined, ExportOutlined } from '@ant-design/icons';
|
|
12
12
|
import { showConfirm, showWarn, showError, showSuccess } from '../../utils';
|
|
13
13
|
import { httpPost } from '../../http';
|
|
@@ -21,12 +21,18 @@ function useDtl(dtlParam) {
|
|
|
21
21
|
relationField = dtlParam.relationField,
|
|
22
22
|
toolConfig = dtlParam.toolConfig,
|
|
23
23
|
dtlItem = dtlParam.dtlItem,
|
|
24
|
+
auditStatus = dtlParam.auditStatus,
|
|
25
|
+
statusField = dtlParam.statusField,
|
|
24
26
|
beforeLoad = dtlParam.beforeLoad,
|
|
25
27
|
beforeAdd = dtlParam.beforeAdd,
|
|
26
28
|
beforeEdit = dtlParam.beforeEdit,
|
|
29
|
+
beforeSave = dtlParam.beforeSave,
|
|
27
30
|
beforeRemove = dtlParam.beforeRemove,
|
|
28
31
|
afterSave = dtlParam.afterSave,
|
|
29
|
-
afterRemove = dtlParam.afterRemove
|
|
32
|
+
afterRemove = dtlParam.afterRemove,
|
|
33
|
+
btnStatus = dtlParam.btnStatus,
|
|
34
|
+
beforeAudit = dtlParam.beforeAudit,
|
|
35
|
+
afterAudit = dtlParam.afterAudit;
|
|
30
36
|
/** @name 选中行数据 */
|
|
31
37
|
|
|
32
38
|
var _useState = useState([]),
|
|
@@ -57,6 +63,10 @@ function useDtl(dtlParam) {
|
|
|
57
63
|
/** @name 从表编辑表单Ref */
|
|
58
64
|
|
|
59
65
|
var dtlFormRef = useRef();
|
|
66
|
+
var isAudit = useCallback(function () {
|
|
67
|
+
if (!auditStatus || !statusField) return false;
|
|
68
|
+
return Number(masterObject[statusField] || 0) >= auditStatus;
|
|
69
|
+
}, [auditStatus, statusField, masterObject]);
|
|
60
70
|
|
|
61
71
|
var onSaveMst = /*#__PURE__*/function () {
|
|
62
72
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values) {
|
|
@@ -67,13 +77,17 @@ function useDtl(dtlParam) {
|
|
|
67
77
|
while (1) {
|
|
68
78
|
switch (_context.prev = _context.next) {
|
|
69
79
|
case 0:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
80
|
+
if (!isAudit()) {
|
|
81
|
+
_context.next = 3;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
showWarn('当前单据已审核,不能保存');
|
|
86
|
+
return _context.abrupt("return", false);
|
|
73
87
|
|
|
74
88
|
case 3:
|
|
75
|
-
|
|
76
|
-
_context.t0 =
|
|
89
|
+
data = _objectSpread(_objectSpread({}, masterObject), values);
|
|
90
|
+
_context.t0 = beforeSave;
|
|
77
91
|
|
|
78
92
|
if (!_context.t0) {
|
|
79
93
|
_context.next = 10;
|
|
@@ -81,7 +95,7 @@ function useDtl(dtlParam) {
|
|
|
81
95
|
}
|
|
82
96
|
|
|
83
97
|
_context.next = 8;
|
|
84
|
-
return
|
|
98
|
+
return beforeSave(data, false);
|
|
85
99
|
|
|
86
100
|
case 8:
|
|
87
101
|
_context.t1 = _context.sent;
|
|
@@ -96,8 +110,36 @@ function useDtl(dtlParam) {
|
|
|
96
110
|
return _context.abrupt("return", false);
|
|
97
111
|
|
|
98
112
|
case 12:
|
|
113
|
+
_context.next = 14;
|
|
114
|
+
return mstService.save(data);
|
|
115
|
+
|
|
116
|
+
case 14:
|
|
117
|
+
result = _context.sent;
|
|
118
|
+
_context.t2 = afterSave;
|
|
119
|
+
|
|
120
|
+
if (!_context.t2) {
|
|
121
|
+
_context.next = 21;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
_context.next = 19;
|
|
126
|
+
return afterSave(result, data, false);
|
|
127
|
+
|
|
128
|
+
case 19:
|
|
129
|
+
_context.t3 = _context.sent;
|
|
130
|
+
_context.t2 = _context.t3 === false;
|
|
131
|
+
|
|
132
|
+
case 21:
|
|
133
|
+
if (!_context.t2) {
|
|
134
|
+
_context.next = 23;
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return _context.abrupt("return", false);
|
|
139
|
+
|
|
140
|
+
case 23:
|
|
99
141
|
if (!((result === null || result === void 0 ? void 0 : (_result$flag = result.flag) === null || _result$flag === void 0 ? void 0 : _result$flag.retCode) === '0')) {
|
|
100
|
-
_context.next =
|
|
142
|
+
_context.next = 28;
|
|
101
143
|
break;
|
|
102
144
|
}
|
|
103
145
|
|
|
@@ -106,10 +148,10 @@ function useDtl(dtlParam) {
|
|
|
106
148
|
setEditItem({});
|
|
107
149
|
return _context.abrupt("return", true);
|
|
108
150
|
|
|
109
|
-
case
|
|
151
|
+
case 28:
|
|
110
152
|
return _context.abrupt("return", false);
|
|
111
153
|
|
|
112
|
-
case
|
|
154
|
+
case 29:
|
|
113
155
|
case "end":
|
|
114
156
|
return _context.stop();
|
|
115
157
|
}
|
|
@@ -138,76 +180,85 @@ function useDtl(dtlParam) {
|
|
|
138
180
|
break;
|
|
139
181
|
}
|
|
140
182
|
|
|
141
|
-
return _context2.abrupt("return");
|
|
183
|
+
return _context2.abrupt("return", false);
|
|
142
184
|
|
|
143
185
|
case 2:
|
|
144
|
-
|
|
186
|
+
if (!isAudit()) {
|
|
187
|
+
_context2.next = 5;
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
showWarn('当前单据已审核,不能删除');
|
|
192
|
+
return _context2.abrupt("return", false);
|
|
193
|
+
|
|
194
|
+
case 5:
|
|
195
|
+
_context2.next = 7;
|
|
145
196
|
return showConfirm('确认要删除当前数据?');
|
|
146
197
|
|
|
147
|
-
case
|
|
198
|
+
case 7:
|
|
148
199
|
if (!beforeRemove) {
|
|
149
|
-
_context2.next =
|
|
200
|
+
_context2.next = 13;
|
|
150
201
|
break;
|
|
151
202
|
}
|
|
152
203
|
|
|
153
|
-
_context2.next =
|
|
204
|
+
_context2.next = 10;
|
|
154
205
|
return beforeRemove([masterObject]);
|
|
155
206
|
|
|
156
|
-
case
|
|
207
|
+
case 10:
|
|
157
208
|
ids = _context2.sent;
|
|
158
209
|
|
|
159
210
|
if (!(ids === false)) {
|
|
160
|
-
_context2.next =
|
|
211
|
+
_context2.next = 13;
|
|
161
212
|
break;
|
|
162
213
|
}
|
|
163
214
|
|
|
164
|
-
return _context2.abrupt("return");
|
|
215
|
+
return _context2.abrupt("return", false);
|
|
165
216
|
|
|
166
|
-
case
|
|
217
|
+
case 13:
|
|
167
218
|
if (!ids) {
|
|
168
219
|
ids = [masterObject[mstKeyField]];
|
|
169
220
|
}
|
|
170
221
|
|
|
171
|
-
_context2.next =
|
|
222
|
+
_context2.next = 16;
|
|
172
223
|
return mstService.remove(ids);
|
|
173
224
|
|
|
174
|
-
case
|
|
225
|
+
case 16:
|
|
175
226
|
result = _context2.sent;
|
|
176
227
|
_context2.t0 = afterRemove;
|
|
177
228
|
|
|
178
229
|
if (!_context2.t0) {
|
|
179
|
-
_context2.next =
|
|
230
|
+
_context2.next = 23;
|
|
180
231
|
break;
|
|
181
232
|
}
|
|
182
233
|
|
|
183
|
-
_context2.next =
|
|
184
|
-
return afterRemove(result, masterObject
|
|
234
|
+
_context2.next = 21;
|
|
235
|
+
return afterRemove(result, masterObject);
|
|
185
236
|
|
|
186
|
-
case
|
|
237
|
+
case 21:
|
|
187
238
|
_context2.t1 = _context2.sent;
|
|
188
239
|
_context2.t0 = _context2.t1 === false;
|
|
189
240
|
|
|
190
|
-
case
|
|
241
|
+
case 23:
|
|
191
242
|
if (!_context2.t0) {
|
|
192
|
-
_context2.next =
|
|
243
|
+
_context2.next = 25;
|
|
193
244
|
break;
|
|
194
245
|
}
|
|
195
246
|
|
|
196
247
|
return _context2.abrupt("return");
|
|
197
248
|
|
|
198
|
-
case
|
|
249
|
+
case 25:
|
|
199
250
|
if (!((result === null || result === void 0 ? void 0 : (_result$flag2 = result.flag) === null || _result$flag2 === void 0 ? void 0 : _result$flag2.retCode) === '0')) {
|
|
200
|
-
_context2.next =
|
|
251
|
+
_context2.next = 28;
|
|
201
252
|
break;
|
|
202
253
|
}
|
|
203
254
|
|
|
204
255
|
showSuccess(result.flag.retMsg);
|
|
205
256
|
return _context2.abrupt("return", true);
|
|
206
257
|
|
|
207
|
-
case
|
|
258
|
+
case 28:
|
|
208
259
|
return _context2.abrupt("return", false);
|
|
209
260
|
|
|
210
|
-
case
|
|
261
|
+
case 29:
|
|
211
262
|
case "end":
|
|
212
263
|
return _context2.stop();
|
|
213
264
|
}
|
|
@@ -224,79 +275,85 @@ function useDtl(dtlParam) {
|
|
|
224
275
|
|
|
225
276
|
var onAddDtl = /*#__PURE__*/function () {
|
|
226
277
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
227
|
-
var
|
|
278
|
+
var item,
|
|
279
|
+
_formRef$current,
|
|
280
|
+
mstVal,
|
|
281
|
+
mst,
|
|
282
|
+
_args3 = arguments;
|
|
228
283
|
|
|
229
284
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
230
285
|
while (1) {
|
|
231
286
|
switch (_context3.prev = _context3.next) {
|
|
232
287
|
case 0:
|
|
288
|
+
item = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : _objectSpread({}, dtlItem);
|
|
289
|
+
|
|
233
290
|
if (!(!masterObject[mstKeyField] && formRef.current)) {
|
|
234
|
-
_context3.next =
|
|
291
|
+
_context3.next = 16;
|
|
235
292
|
break;
|
|
236
293
|
}
|
|
237
294
|
|
|
238
|
-
_context3.prev =
|
|
239
|
-
_context3.next =
|
|
295
|
+
_context3.prev = 2;
|
|
296
|
+
_context3.next = 5;
|
|
240
297
|
return (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.validateFields();
|
|
241
298
|
|
|
242
|
-
case
|
|
299
|
+
case 5:
|
|
243
300
|
mstVal = formRef.current.getFieldsValue();
|
|
244
|
-
_context3.next =
|
|
301
|
+
_context3.next = 8;
|
|
245
302
|
return onSaveMst(mstVal);
|
|
246
303
|
|
|
247
|
-
case
|
|
304
|
+
case 8:
|
|
248
305
|
mst = _context3.sent;
|
|
249
306
|
|
|
250
307
|
if (!(mst !== true)) {
|
|
251
|
-
_context3.next =
|
|
308
|
+
_context3.next = 11;
|
|
252
309
|
break;
|
|
253
310
|
}
|
|
254
311
|
|
|
255
312
|
return _context3.abrupt("return", false);
|
|
256
313
|
|
|
257
|
-
case
|
|
258
|
-
_context3.next =
|
|
314
|
+
case 11:
|
|
315
|
+
_context3.next = 16;
|
|
259
316
|
break;
|
|
260
317
|
|
|
261
|
-
case
|
|
262
|
-
_context3.prev =
|
|
263
|
-
_context3.t0 = _context3["catch"](
|
|
318
|
+
case 13:
|
|
319
|
+
_context3.prev = 13;
|
|
320
|
+
_context3.t0 = _context3["catch"](2);
|
|
264
321
|
return _context3.abrupt("return", false);
|
|
265
322
|
|
|
266
|
-
case
|
|
323
|
+
case 16:
|
|
267
324
|
_context3.t1 = beforeAdd;
|
|
268
325
|
|
|
269
326
|
if (!_context3.t1) {
|
|
270
|
-
_context3.next =
|
|
327
|
+
_context3.next = 22;
|
|
271
328
|
break;
|
|
272
329
|
}
|
|
273
330
|
|
|
274
|
-
_context3.next =
|
|
275
|
-
return beforeAdd(
|
|
331
|
+
_context3.next = 20;
|
|
332
|
+
return beforeAdd(item);
|
|
276
333
|
|
|
277
|
-
case
|
|
334
|
+
case 20:
|
|
278
335
|
_context3.t2 = _context3.sent;
|
|
279
336
|
_context3.t1 = _context3.t2 === false;
|
|
280
337
|
|
|
281
|
-
case
|
|
338
|
+
case 22:
|
|
282
339
|
if (!_context3.t1) {
|
|
283
|
-
_context3.next =
|
|
340
|
+
_context3.next = 24;
|
|
284
341
|
break;
|
|
285
342
|
}
|
|
286
343
|
|
|
287
344
|
return _context3.abrupt("return", false);
|
|
288
345
|
|
|
289
|
-
case
|
|
290
|
-
setEditItem(
|
|
346
|
+
case 24:
|
|
347
|
+
setEditItem(item);
|
|
291
348
|
setShowEdit(true);
|
|
292
349
|
return _context3.abrupt("return", true);
|
|
293
350
|
|
|
294
|
-
case
|
|
351
|
+
case 27:
|
|
295
352
|
case "end":
|
|
296
353
|
return _context3.stop();
|
|
297
354
|
}
|
|
298
355
|
}
|
|
299
|
-
}, _callee3, null, [[
|
|
356
|
+
}, _callee3, null, [[2, 13]]);
|
|
300
357
|
}));
|
|
301
358
|
|
|
302
359
|
return function onAddDtl() {
|
|
@@ -308,47 +365,51 @@ function useDtl(dtlParam) {
|
|
|
308
365
|
|
|
309
366
|
var onEditDtl = /*#__PURE__*/function () {
|
|
310
367
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
368
|
+
var item,
|
|
369
|
+
_args4 = arguments;
|
|
311
370
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
312
371
|
while (1) {
|
|
313
372
|
switch (_context4.prev = _context4.next) {
|
|
314
373
|
case 0:
|
|
374
|
+
item = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : _objectSpread({}, selectedRows[0]);
|
|
375
|
+
|
|
315
376
|
if (selectedRows.length) {
|
|
316
|
-
_context4.next =
|
|
377
|
+
_context4.next = 4;
|
|
317
378
|
break;
|
|
318
379
|
}
|
|
319
380
|
|
|
320
381
|
showWarn('请先选择需要更改的数据');
|
|
321
382
|
return _context4.abrupt("return", false);
|
|
322
383
|
|
|
323
|
-
case
|
|
384
|
+
case 4:
|
|
324
385
|
_context4.t0 = beforeEdit;
|
|
325
386
|
|
|
326
387
|
if (!_context4.t0) {
|
|
327
|
-
_context4.next =
|
|
388
|
+
_context4.next = 10;
|
|
328
389
|
break;
|
|
329
390
|
}
|
|
330
391
|
|
|
331
|
-
_context4.next =
|
|
332
|
-
return beforeEdit(
|
|
392
|
+
_context4.next = 8;
|
|
393
|
+
return beforeEdit(item);
|
|
333
394
|
|
|
334
|
-
case
|
|
395
|
+
case 8:
|
|
335
396
|
_context4.t1 = _context4.sent;
|
|
336
397
|
_context4.t0 = _context4.t1 === false;
|
|
337
398
|
|
|
338
|
-
case
|
|
399
|
+
case 10:
|
|
339
400
|
if (!_context4.t0) {
|
|
340
|
-
_context4.next =
|
|
401
|
+
_context4.next = 12;
|
|
341
402
|
break;
|
|
342
403
|
}
|
|
343
404
|
|
|
344
405
|
return _context4.abrupt("return", false);
|
|
345
406
|
|
|
346
|
-
case
|
|
347
|
-
setEditItem(
|
|
407
|
+
case 12:
|
|
408
|
+
setEditItem(item);
|
|
348
409
|
setShowEdit(true);
|
|
349
410
|
return _context4.abrupt("return", true);
|
|
350
411
|
|
|
351
|
-
case
|
|
412
|
+
case 15:
|
|
352
413
|
case "end":
|
|
353
414
|
return _context4.stop();
|
|
354
415
|
}
|
|
@@ -364,7 +425,9 @@ function useDtl(dtlParam) {
|
|
|
364
425
|
|
|
365
426
|
|
|
366
427
|
var onRemoveDtl = function onRemoveDtl() {
|
|
367
|
-
|
|
428
|
+
var rows = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : selectedRows;
|
|
429
|
+
|
|
430
|
+
if (!rows || !rows.length) {
|
|
368
431
|
showWarn('请选择需要删除的数据');
|
|
369
432
|
return;
|
|
370
433
|
}
|
|
@@ -383,7 +446,7 @@ function useDtl(dtlParam) {
|
|
|
383
446
|
}
|
|
384
447
|
|
|
385
448
|
_context5.next = 3;
|
|
386
|
-
return beforeRemove(
|
|
449
|
+
return beforeRemove(rows);
|
|
387
450
|
|
|
388
451
|
case 3:
|
|
389
452
|
ids = _context5.sent;
|
|
@@ -397,7 +460,7 @@ function useDtl(dtlParam) {
|
|
|
397
460
|
|
|
398
461
|
case 6:
|
|
399
462
|
if (!ids) {
|
|
400
|
-
ids =
|
|
463
|
+
ids = rows.map(function (o) {
|
|
401
464
|
return o.id;
|
|
402
465
|
});
|
|
403
466
|
}
|
|
@@ -415,7 +478,7 @@ function useDtl(dtlParam) {
|
|
|
415
478
|
}
|
|
416
479
|
|
|
417
480
|
_context5.next = 14;
|
|
418
|
-
return afterRemove(result,
|
|
481
|
+
return afterRemove(result, rows);
|
|
419
482
|
|
|
420
483
|
case 14:
|
|
421
484
|
_context5.t1 = _context5.sent;
|
|
@@ -464,36 +527,59 @@ function useDtl(dtlParam) {
|
|
|
464
527
|
data[relationField] = masterObject[mstKeyField];
|
|
465
528
|
}
|
|
466
529
|
|
|
467
|
-
_context6.
|
|
468
|
-
return dtlService.save(data);
|
|
469
|
-
|
|
470
|
-
case 4:
|
|
471
|
-
result = _context6.sent;
|
|
472
|
-
_context6.t0 = afterSave;
|
|
530
|
+
_context6.t0 = beforeSave;
|
|
473
531
|
|
|
474
532
|
if (!_context6.t0) {
|
|
475
|
-
_context6.next =
|
|
533
|
+
_context6.next = 8;
|
|
476
534
|
break;
|
|
477
535
|
}
|
|
478
536
|
|
|
479
|
-
_context6.next =
|
|
480
|
-
return
|
|
537
|
+
_context6.next = 6;
|
|
538
|
+
return beforeSave(data, true);
|
|
481
539
|
|
|
482
|
-
case
|
|
540
|
+
case 6:
|
|
483
541
|
_context6.t1 = _context6.sent;
|
|
484
542
|
_context6.t0 = _context6.t1 === false;
|
|
485
543
|
|
|
486
|
-
case
|
|
544
|
+
case 8:
|
|
487
545
|
if (!_context6.t0) {
|
|
488
|
-
_context6.next =
|
|
546
|
+
_context6.next = 10;
|
|
489
547
|
break;
|
|
490
548
|
}
|
|
491
549
|
|
|
492
550
|
return _context6.abrupt("return", false);
|
|
493
551
|
|
|
494
|
-
case
|
|
552
|
+
case 10:
|
|
553
|
+
_context6.next = 12;
|
|
554
|
+
return dtlService.save(data);
|
|
555
|
+
|
|
556
|
+
case 12:
|
|
557
|
+
result = _context6.sent;
|
|
558
|
+
_context6.t2 = afterSave;
|
|
559
|
+
|
|
560
|
+
if (!_context6.t2) {
|
|
561
|
+
_context6.next = 19;
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
_context6.next = 17;
|
|
566
|
+
return afterSave(result, data, true);
|
|
567
|
+
|
|
568
|
+
case 17:
|
|
569
|
+
_context6.t3 = _context6.sent;
|
|
570
|
+
_context6.t2 = _context6.t3 === false;
|
|
571
|
+
|
|
572
|
+
case 19:
|
|
573
|
+
if (!_context6.t2) {
|
|
574
|
+
_context6.next = 21;
|
|
575
|
+
break;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
return _context6.abrupt("return", false);
|
|
579
|
+
|
|
580
|
+
case 21:
|
|
495
581
|
if (!((result === null || result === void 0 ? void 0 : (_result$flag4 = result.flag) === null || _result$flag4 === void 0 ? void 0 : _result$flag4.retCode) === '0')) {
|
|
496
|
-
_context6.next =
|
|
582
|
+
_context6.next = 25;
|
|
497
583
|
break;
|
|
498
584
|
}
|
|
499
585
|
|
|
@@ -505,10 +591,10 @@ function useDtl(dtlParam) {
|
|
|
505
591
|
|
|
506
592
|
return _context6.abrupt("return", true);
|
|
507
593
|
|
|
508
|
-
case
|
|
594
|
+
case 25:
|
|
509
595
|
return _context6.abrupt("return", false);
|
|
510
596
|
|
|
511
|
-
case
|
|
597
|
+
case 26:
|
|
512
598
|
case "end":
|
|
513
599
|
return _context6.stop();
|
|
514
600
|
}
|
|
@@ -681,38 +767,144 @@ function useDtl(dtlParam) {
|
|
|
681
767
|
return _ref8.apply(this, arguments);
|
|
682
768
|
};
|
|
683
769
|
}();
|
|
770
|
+
/** 审核按钮事件 */
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
var onAudit = /*#__PURE__*/function () {
|
|
774
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
775
|
+
var obj, _result$flag8, result;
|
|
776
|
+
|
|
777
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
778
|
+
while (1) {
|
|
779
|
+
switch (_context9.prev = _context9.next) {
|
|
780
|
+
case 0:
|
|
781
|
+
if (!isAudit()) {
|
|
782
|
+
_context9.next = 3;
|
|
783
|
+
break;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
showWarn('当前数据已审核,不能再做审核操作!');
|
|
787
|
+
return _context9.abrupt("return");
|
|
684
788
|
|
|
685
|
-
|
|
789
|
+
case 3:
|
|
790
|
+
obj = _objectSpread({}, masterObject); // beforeAudit 强式终止
|
|
791
|
+
|
|
792
|
+
_context9.t0 = beforeAudit;
|
|
686
793
|
|
|
687
|
-
|
|
688
|
-
|
|
794
|
+
if (!_context9.t0) {
|
|
795
|
+
_context9.next = 10;
|
|
796
|
+
break;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
_context9.next = 8;
|
|
800
|
+
return beforeAudit(obj);
|
|
801
|
+
|
|
802
|
+
case 8:
|
|
803
|
+
_context9.t1 = _context9.sent;
|
|
804
|
+
_context9.t0 = _context9.t1 === false;
|
|
805
|
+
|
|
806
|
+
case 10:
|
|
807
|
+
if (!_context9.t0) {
|
|
808
|
+
_context9.next = 12;
|
|
809
|
+
break;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
return _context9.abrupt("return");
|
|
813
|
+
|
|
814
|
+
case 12:
|
|
815
|
+
_context9.prev = 12;
|
|
816
|
+
_context9.next = 15;
|
|
817
|
+
return mstService.audit([obj]);
|
|
818
|
+
|
|
819
|
+
case 15:
|
|
820
|
+
result = _context9.sent;
|
|
821
|
+
_context9.t2 = afterAudit;
|
|
822
|
+
|
|
823
|
+
if (!_context9.t2) {
|
|
824
|
+
_context9.next = 22;
|
|
825
|
+
break;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
_context9.next = 20;
|
|
829
|
+
return afterAudit(result, [obj]);
|
|
830
|
+
|
|
831
|
+
case 20:
|
|
832
|
+
_context9.t3 = _context9.sent;
|
|
833
|
+
_context9.t2 = _context9.t3 === false;
|
|
834
|
+
|
|
835
|
+
case 22:
|
|
836
|
+
if (!_context9.t2) {
|
|
837
|
+
_context9.next = 24;
|
|
838
|
+
break;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
return _context9.abrupt("return");
|
|
842
|
+
|
|
843
|
+
case 24:
|
|
844
|
+
if ((result === null || result === void 0 ? void 0 : (_result$flag8 = result.flag) === null || _result$flag8 === void 0 ? void 0 : _result$flag8.retCode) === '0') {
|
|
845
|
+
showSuccess(result.flag.retMsg);
|
|
846
|
+
Object.assign(masterObject, result.data);
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
_context9.next = 30;
|
|
850
|
+
break;
|
|
851
|
+
|
|
852
|
+
case 27:
|
|
853
|
+
_context9.prev = 27;
|
|
854
|
+
_context9.t4 = _context9["catch"](12);
|
|
855
|
+
console.log(_context9.t4);
|
|
856
|
+
|
|
857
|
+
case 30:
|
|
858
|
+
case "end":
|
|
859
|
+
return _context9.stop();
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
}, _callee9, null, [[12, 27]]);
|
|
863
|
+
}));
|
|
864
|
+
|
|
865
|
+
return function onAudit() {
|
|
866
|
+
return _ref9.apply(this, arguments);
|
|
867
|
+
};
|
|
868
|
+
}();
|
|
869
|
+
|
|
870
|
+
var btnDisabled = function btnDisabled(key) {
|
|
871
|
+
if (btnStatus && typeof btnStatus(key) === 'boolean') return btnStatus(key);
|
|
872
|
+
|
|
873
|
+
switch (key) {
|
|
874
|
+
case 'edit':
|
|
875
|
+
return selectedRows.length !== 1;
|
|
876
|
+
|
|
877
|
+
case 'remove':
|
|
878
|
+
return selectedRows.length === 0 || isAudit();
|
|
879
|
+
|
|
880
|
+
default:
|
|
881
|
+
return false;
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
var tableTools = useMemo(function () {
|
|
886
|
+
return [(toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.add) && !isAudit() ? /*#__PURE__*/React.createElement(_Button, {
|
|
689
887
|
key: "add",
|
|
690
|
-
onClick:
|
|
888
|
+
onClick: function onClick() {
|
|
889
|
+
return onAddDtl();
|
|
890
|
+
},
|
|
691
891
|
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
|
692
|
-
}, "\u65B0\u589E"))
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
if (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.edit) {
|
|
696
|
-
tableTools.push( /*#__PURE__*/React.createElement(_Button, {
|
|
892
|
+
}, "\u65B0\u589E") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.edit) && !isAudit() ? /*#__PURE__*/React.createElement(_Button, {
|
|
697
893
|
key: "edit",
|
|
698
|
-
disabled:
|
|
699
|
-
onClick:
|
|
894
|
+
disabled: btnDisabled('edit'),
|
|
895
|
+
onClick: function onClick() {
|
|
896
|
+
return onEditDtl();
|
|
897
|
+
},
|
|
700
898
|
icon: /*#__PURE__*/React.createElement(EditOutlined, null)
|
|
701
|
-
}, "\u7F16\u8F91"))
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
if (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.remove) {
|
|
705
|
-
tableTools.push( /*#__PURE__*/React.createElement(_Button, {
|
|
899
|
+
}, "\u7F16\u8F91") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.remove) && !isAudit() ? /*#__PURE__*/React.createElement(_Button, {
|
|
706
900
|
key: "remove",
|
|
707
|
-
onClick:
|
|
901
|
+
onClick: function onClick() {
|
|
902
|
+
return onRemoveDtl();
|
|
903
|
+
},
|
|
708
904
|
danger: true,
|
|
709
|
-
disabled:
|
|
905
|
+
disabled: btnDisabled('remove'),
|
|
710
906
|
icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
|
|
711
|
-
}, "\u5220\u9664"))
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
if (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.import) {
|
|
715
|
-
tableTools.push( /*#__PURE__*/React.createElement(_Button, {
|
|
907
|
+
}, "\u5220\u9664") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.import) ? /*#__PURE__*/React.createElement(_Button, {
|
|
716
908
|
key: "import",
|
|
717
909
|
onClick: function onClick() {
|
|
718
910
|
var _tableRef$current, _tableRef$current$sho;
|
|
@@ -720,11 +912,7 @@ function useDtl(dtlParam) {
|
|
|
720
912
|
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);
|
|
721
913
|
},
|
|
722
914
|
icon: /*#__PURE__*/React.createElement(ImportOutlined, null)
|
|
723
|
-
}, "\u5BFC\u5165"))
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
if (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.export) {
|
|
727
|
-
tableTools.push( /*#__PURE__*/React.createElement(_Button, {
|
|
915
|
+
}, "\u5BFC\u5165") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.import) ? /*#__PURE__*/React.createElement(_Button, {
|
|
728
916
|
key: "export",
|
|
729
917
|
onClick: function onClick() {
|
|
730
918
|
var _tableRef$current2, _tableRef$current2$sh;
|
|
@@ -732,9 +920,10 @@ function useDtl(dtlParam) {
|
|
|
732
920
|
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);
|
|
733
921
|
},
|
|
734
922
|
icon: /*#__PURE__*/React.createElement(ExportOutlined, null)
|
|
735
|
-
}, "\u5BFC\u51FA"))
|
|
736
|
-
|
|
737
|
-
|
|
923
|
+
}, "\u5BFC\u51FA") : false].filter(function (o) {
|
|
924
|
+
return o !== false;
|
|
925
|
+
});
|
|
926
|
+
}, [selectedRows]);
|
|
738
927
|
return {
|
|
739
928
|
formRef: formRef,
|
|
740
929
|
tableRef: tableRef,
|
|
@@ -753,7 +942,9 @@ function useDtl(dtlParam) {
|
|
|
753
942
|
onEditDtl: onEditDtl,
|
|
754
943
|
onSaveMst: onSaveMst,
|
|
755
944
|
onRemoveMst: onRemoveMst,
|
|
756
|
-
onExportDtl: onExportDtl
|
|
945
|
+
onExportDtl: onExportDtl,
|
|
946
|
+
isAudit: isAudit,
|
|
947
|
+
onAudit: onAudit
|
|
757
948
|
};
|
|
758
949
|
}
|
|
759
950
|
|