ls-pro-common 1.1.1 → 1.1.2
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 +65 -1
- package/dist/common.js +1 -1
- package/dist/common.js.LICENSE.txt +5 -3
- package/dist/common.min.css +65 -1
- package/dist/common.min.js +1 -1
- package/dist/common.min.js.LICENSE.txt +5 -3
- package/es/components/AreaCascader.js +35 -48
- package/es/components/AreaCascaderPanel.js +55 -85
- package/es/components/DescritionCard.js +14 -19
- package/es/components/DtlLayout.js +25 -38
- package/es/components/IconSelector.js +27 -50
- package/es/components/ImageSelector.js +89 -139
- package/es/components/InputMultiLine.js +33 -45
- package/es/components/InputTable.js +118 -160
- package/es/components/Loading.js +3 -6
- package/es/components/common.less +63 -0
- package/es/hooks/useDtl/index.js +676 -947
- package/es/hooks/usePermission/index.js +0 -9
- package/es/hooks/useSingle/index.js +417 -595
- package/es/http/index.js +107 -151
- package/es/index.js +0 -1
- package/es/service/BaseService.js +121 -195
- package/es/utils/index.js +12 -111
- package/lib/components/404.js +1 -6
- package/lib/components/AreaCascader.js +37 -63
- package/lib/components/AreaCascaderPanel.js +57 -105
- package/lib/components/DescritionCard.js +16 -33
- package/lib/components/DtlLayout.js +27 -49
- package/lib/components/IconSelector.js +29 -64
- package/lib/components/ImageSelector.js +91 -162
- package/lib/components/InputMultiLine.js +35 -61
- package/lib/components/InputTable.js +120 -185
- package/lib/components/Loading.js +4 -16
- package/lib/components/common.less +63 -0
- package/lib/hooks/useDtl/index.js +677 -963
- package/lib/hooks/usePermission/index.js +0 -12
- package/lib/hooks/useSingle/index.js +418 -610
- package/lib/http/index.js +105 -160
- package/lib/index.js +2 -21
- package/lib/service/BaseService.js +121 -201
- package/lib/utils/index.js +13 -209
- package/package.json +2 -2
package/es/hooks/useDtl/index.js
CHANGED
|
@@ -1,1149 +1,879 @@
|
|
|
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";
|
|
6
5
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
7
6
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
8
7
|
var _excluded = ["current", "pageSize", "sumProperties"];
|
|
8
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
9
|
import React from "react";
|
|
10
10
|
import { useState, useRef, useCallback, useMemo } from 'react';
|
|
11
11
|
import { PlusCircleOutlined, EditOutlined, DeleteOutlined, ImportOutlined, ExportOutlined } from '@ant-design/icons';
|
|
12
12
|
import { showConfirm, showWarn, showError, showSuccess } from '../../utils';
|
|
13
13
|
import { httpPost } from '../../http';
|
|
14
14
|
import usePermission from '../usePermission';
|
|
15
|
-
|
|
16
15
|
function useDtl(dtlParam) {
|
|
17
16
|
var mstService = dtlParam.service,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
17
|
+
masterObject = dtlParam.initItem,
|
|
18
|
+
_dtlParam$mstKeyField = dtlParam.mstKeyField,
|
|
19
|
+
mstKeyField = _dtlParam$mstKeyField === void 0 ? 'id' : _dtlParam$mstKeyField,
|
|
20
|
+
dtlService = dtlParam.dtlService,
|
|
21
|
+
relationField = dtlParam.relationField,
|
|
22
|
+
toolConfig = dtlParam.toolConfig,
|
|
23
|
+
dtlItem = dtlParam.dtlItem,
|
|
24
|
+
auditStatus = dtlParam.auditStatus,
|
|
25
|
+
statusField = dtlParam.statusField,
|
|
26
|
+
beforeLoad = dtlParam.beforeLoad,
|
|
27
|
+
beforeAdd = dtlParam.beforeAdd,
|
|
28
|
+
beforeEdit = dtlParam.beforeEdit,
|
|
29
|
+
beforeSave = dtlParam.beforeSave,
|
|
30
|
+
beforeRemove = dtlParam.beforeRemove,
|
|
31
|
+
afterSave = dtlParam.afterSave,
|
|
32
|
+
afterRemove = dtlParam.afterRemove,
|
|
33
|
+
btnStatus = dtlParam.btnStatus,
|
|
34
|
+
beforeAudit = dtlParam.beforeAudit,
|
|
35
|
+
afterAudit = dtlParam.afterAudit,
|
|
36
|
+
_dtlParam$ifHistoryDa = dtlParam.ifHistoryData,
|
|
37
|
+
ifHistoryData = _dtlParam$ifHistoryDa === void 0 ? 0 : _dtlParam$ifHistoryDa;
|
|
40
38
|
var _usePermission = usePermission(),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
canAdd = _usePermission.canAdd,
|
|
40
|
+
canEdit = _usePermission.canEdit,
|
|
41
|
+
canDelete = _usePermission.canDelete,
|
|
42
|
+
canImport = _usePermission.canImport,
|
|
43
|
+
canExport = _usePermission.canExport;
|
|
46
44
|
/** @name 选中行数据 */
|
|
47
|
-
|
|
48
|
-
|
|
49
45
|
var _useState = useState([]),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
selectedRows = _useState2[0],
|
|
48
|
+
setSelectedRows = _useState2[1];
|
|
53
49
|
/** @name 显示新增编辑框 */
|
|
54
|
-
|
|
55
|
-
|
|
56
50
|
var _useState3 = useState(false),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
52
|
+
showEdit = _useState4[0],
|
|
53
|
+
setShowEdit = _useState4[1];
|
|
60
54
|
/** @name 新增或编辑对象初始值 */
|
|
61
|
-
|
|
62
|
-
|
|
63
55
|
var _useState5 = useState(dtlItem),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
57
|
+
editItem = _useState6[0],
|
|
58
|
+
setEditItem = _useState6[1];
|
|
67
59
|
/** @name 从表表格Ref */
|
|
68
|
-
|
|
69
|
-
|
|
70
60
|
var tableRef = useRef();
|
|
71
61
|
/** @name 主表表单Ref */
|
|
72
|
-
|
|
73
62
|
var formRef = useRef();
|
|
74
63
|
/** @name 从表编辑表单Ref */
|
|
75
|
-
|
|
76
64
|
var dtlFormRef = useRef();
|
|
77
65
|
/**@name 判断是否已审核 */
|
|
78
|
-
|
|
79
66
|
var isAudit = useCallback(function () {
|
|
80
67
|
if (!auditStatus || !statusField) return false;
|
|
81
68
|
return Number(masterObject[statusField] || 0) >= auditStatus;
|
|
82
69
|
}, [auditStatus, statusField, masterObject]);
|
|
83
70
|
/** @name 保存主表 */
|
|
84
|
-
|
|
85
71
|
var onSaveMst = /*#__PURE__*/function () {
|
|
86
72
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values) {
|
|
87
73
|
var _result$flag;
|
|
88
|
-
|
|
89
74
|
var data, result;
|
|
90
75
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
91
|
-
while (1) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return _context.abrupt("return", false);
|
|
153
|
-
|
|
154
|
-
case 23:
|
|
155
|
-
if (!((result === null || result === void 0 ? void 0 : (_result$flag = result.flag) === null || _result$flag === void 0 ? void 0 : _result$flag.retCode) === '0')) {
|
|
156
|
-
_context.next = 28;
|
|
157
|
-
break;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
showSuccess(result.flag.retMsg || '操作成功');
|
|
161
|
-
Object.assign(masterObject, result.data);
|
|
162
|
-
setEditItem({});
|
|
163
|
-
return _context.abrupt("return", true);
|
|
164
|
-
|
|
165
|
-
case 28:
|
|
166
|
-
return _context.abrupt("return", false);
|
|
167
|
-
|
|
168
|
-
case 29:
|
|
169
|
-
case "end":
|
|
170
|
-
return _context.stop();
|
|
171
|
-
}
|
|
76
|
+
while (1) switch (_context.prev = _context.next) {
|
|
77
|
+
case 0:
|
|
78
|
+
if (!isAudit()) {
|
|
79
|
+
_context.next = 3;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
showWarn('当前单据已审核,不能保存');
|
|
83
|
+
return _context.abrupt("return", false);
|
|
84
|
+
case 3:
|
|
85
|
+
data = _objectSpread(_objectSpread({}, masterObject), values);
|
|
86
|
+
_context.t0 = beforeSave;
|
|
87
|
+
if (!_context.t0) {
|
|
88
|
+
_context.next = 10;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
_context.next = 8;
|
|
92
|
+
return beforeSave(data, false);
|
|
93
|
+
case 8:
|
|
94
|
+
_context.t1 = _context.sent;
|
|
95
|
+
_context.t0 = _context.t1 === false;
|
|
96
|
+
case 10:
|
|
97
|
+
if (!_context.t0) {
|
|
98
|
+
_context.next = 12;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
return _context.abrupt("return", false);
|
|
102
|
+
case 12:
|
|
103
|
+
_context.next = 14;
|
|
104
|
+
return mstService.save(data);
|
|
105
|
+
case 14:
|
|
106
|
+
result = _context.sent;
|
|
107
|
+
_context.t2 = afterSave;
|
|
108
|
+
if (!_context.t2) {
|
|
109
|
+
_context.next = 21;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
_context.next = 19;
|
|
113
|
+
return afterSave(result, data, false);
|
|
114
|
+
case 19:
|
|
115
|
+
_context.t3 = _context.sent;
|
|
116
|
+
_context.t2 = _context.t3 === false;
|
|
117
|
+
case 21:
|
|
118
|
+
if (!_context.t2) {
|
|
119
|
+
_context.next = 23;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
return _context.abrupt("return", false);
|
|
123
|
+
case 23:
|
|
124
|
+
if (!((result === null || result === void 0 ? void 0 : (_result$flag = result.flag) === null || _result$flag === void 0 ? void 0 : _result$flag.retCode) === '0')) {
|
|
125
|
+
_context.next = 28;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
showSuccess(result.flag.retMsg || '操作成功');
|
|
129
|
+
Object.assign(masterObject, result.data);
|
|
130
|
+
setEditItem({});
|
|
131
|
+
return _context.abrupt("return", true);
|
|
132
|
+
case 28:
|
|
133
|
+
return _context.abrupt("return", false);
|
|
134
|
+
case 29:
|
|
135
|
+
case "end":
|
|
136
|
+
return _context.stop();
|
|
172
137
|
}
|
|
173
138
|
}, _callee);
|
|
174
139
|
}));
|
|
175
|
-
|
|
176
140
|
return function onSaveMst(_x) {
|
|
177
141
|
return _ref.apply(this, arguments);
|
|
178
142
|
};
|
|
179
143
|
}();
|
|
180
144
|
/** @name 主从一起保存 */
|
|
181
|
-
|
|
182
|
-
|
|
183
145
|
var onSaveMstDtl = /*#__PURE__*/function () {
|
|
184
146
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
185
147
|
var _formRef$current, _formRef$current$getF, _tableRef$current, _tableRef$current$get, _tableRef$current2, _tableRef$current2$ge, _result$flag2;
|
|
186
|
-
|
|
187
148
|
var isDelete,
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
149
|
+
values,
|
|
150
|
+
mst,
|
|
151
|
+
dtlEditData,
|
|
152
|
+
dtlData,
|
|
153
|
+
param,
|
|
154
|
+
result,
|
|
155
|
+
_args2 = arguments;
|
|
195
156
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
196
|
-
while (1) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
157
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
158
|
+
case 0:
|
|
159
|
+
isDelete = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : false;
|
|
160
|
+
if (!isAudit()) {
|
|
161
|
+
_context2.next = 4;
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
showWarn('当前单据已审核,不能保存');
|
|
165
|
+
return _context2.abrupt("return", false);
|
|
166
|
+
case 4:
|
|
167
|
+
if (dtlParam.dtlName) {
|
|
168
|
+
_context2.next = 7;
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
showWarn('useDtl未传入dtlName参数,不能主从一起保存');
|
|
172
|
+
return _context2.abrupt("return");
|
|
173
|
+
case 7:
|
|
174
|
+
values = (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : (_formRef$current$getF = _formRef$current.getFieldsFormatValue) === null || _formRef$current$getF === void 0 ? void 0 : _formRef$current$getF.call(_formRef$current);
|
|
175
|
+
mst = _objectSpread(_objectSpread({}, masterObject), values);
|
|
176
|
+
dtlEditData = ((_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$get = _tableRef$current.getChanged) === null || _tableRef$current$get === void 0 ? void 0 : _tableRef$current$get.call(_tableRef$current)) || {
|
|
177
|
+
insertRows: [],
|
|
178
|
+
updateRows: [],
|
|
179
|
+
deleteRows: []
|
|
180
|
+
};
|
|
181
|
+
dtlData = ((_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$ge = _tableRef$current2.getDatasource) === null || _tableRef$current2$ge === void 0 ? void 0 : _tableRef$current2$ge.call(_tableRef$current2)) || [];
|
|
182
|
+
param = {
|
|
183
|
+
master: mst,
|
|
184
|
+
opType: 'inserted',
|
|
185
|
+
billType: dtlParam.billType,
|
|
186
|
+
codeRuleDynamicField: dtlParam.codeRuleDynamicField,
|
|
187
|
+
details: {}
|
|
188
|
+
};
|
|
189
|
+
if (isDelete) {
|
|
190
|
+
param.opType = 'deleted';
|
|
191
|
+
param.details[dtlParam.dtlName] = {
|
|
192
|
+
insertRows: dtlData,
|
|
223
193
|
updateRows: [],
|
|
224
194
|
deleteRows: []
|
|
225
195
|
};
|
|
226
|
-
|
|
227
|
-
param =
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
196
|
+
} else if (mst[mstKeyField] && mst.id) {
|
|
197
|
+
param.opType = 'updated';
|
|
198
|
+
param.details[dtlParam.dtlName] = _objectSpread({}, dtlEditData);
|
|
199
|
+
} else {
|
|
200
|
+
param.details[dtlParam.dtlName] = {
|
|
201
|
+
insertRows: dtlData,
|
|
202
|
+
updateRows: [],
|
|
203
|
+
deleteRows: []
|
|
233
204
|
};
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
_context2.next = 28;
|
|
289
|
-
return afterSave(result, param, false);
|
|
290
|
-
|
|
291
|
-
case 28:
|
|
292
|
-
_context2.t3 = _context2.sent;
|
|
293
|
-
_context2.t2 = _context2.t3 === false;
|
|
294
|
-
|
|
295
|
-
case 30:
|
|
296
|
-
if (!_context2.t2) {
|
|
297
|
-
_context2.next = 32;
|
|
298
|
-
break;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
return _context2.abrupt("return", false);
|
|
302
|
-
|
|
303
|
-
case 32:
|
|
304
|
-
if (!((result === null || result === void 0 ? void 0 : (_result$flag2 = result.flag) === null || _result$flag2 === void 0 ? void 0 : _result$flag2.retCode) === '0')) {
|
|
305
|
-
_context2.next = 37;
|
|
306
|
-
break;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
showSuccess(result.flag.retMsg || '操作成功');
|
|
310
|
-
Object.assign(masterObject, result.data);
|
|
311
|
-
setEditItem({});
|
|
312
|
-
return _context2.abrupt("return", true);
|
|
313
|
-
|
|
314
|
-
case 37:
|
|
315
|
-
return _context2.abrupt("return", false);
|
|
316
|
-
|
|
317
|
-
case 38:
|
|
318
|
-
case "end":
|
|
319
|
-
return _context2.stop();
|
|
320
|
-
}
|
|
205
|
+
}
|
|
206
|
+
_context2.t0 = beforeSave;
|
|
207
|
+
if (!_context2.t0) {
|
|
208
|
+
_context2.next = 19;
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
_context2.next = 17;
|
|
212
|
+
return beforeSave(param, false);
|
|
213
|
+
case 17:
|
|
214
|
+
_context2.t1 = _context2.sent;
|
|
215
|
+
_context2.t0 = _context2.t1 === false;
|
|
216
|
+
case 19:
|
|
217
|
+
if (!_context2.t0) {
|
|
218
|
+
_context2.next = 21;
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
return _context2.abrupt("return", false);
|
|
222
|
+
case 21:
|
|
223
|
+
_context2.next = 23;
|
|
224
|
+
return mstService.saveMstDtl(param);
|
|
225
|
+
case 23:
|
|
226
|
+
result = _context2.sent;
|
|
227
|
+
_context2.t2 = afterSave;
|
|
228
|
+
if (!_context2.t2) {
|
|
229
|
+
_context2.next = 30;
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
_context2.next = 28;
|
|
233
|
+
return afterSave(result, param, false);
|
|
234
|
+
case 28:
|
|
235
|
+
_context2.t3 = _context2.sent;
|
|
236
|
+
_context2.t2 = _context2.t3 === false;
|
|
237
|
+
case 30:
|
|
238
|
+
if (!_context2.t2) {
|
|
239
|
+
_context2.next = 32;
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
return _context2.abrupt("return", false);
|
|
243
|
+
case 32:
|
|
244
|
+
if (!((result === null || result === void 0 ? void 0 : (_result$flag2 = result.flag) === null || _result$flag2 === void 0 ? void 0 : _result$flag2.retCode) === '0')) {
|
|
245
|
+
_context2.next = 37;
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
showSuccess(result.flag.retMsg || '操作成功');
|
|
249
|
+
Object.assign(masterObject, result.data);
|
|
250
|
+
setEditItem({});
|
|
251
|
+
return _context2.abrupt("return", true);
|
|
252
|
+
case 37:
|
|
253
|
+
return _context2.abrupt("return", false);
|
|
254
|
+
case 38:
|
|
255
|
+
case "end":
|
|
256
|
+
return _context2.stop();
|
|
321
257
|
}
|
|
322
258
|
}, _callee2);
|
|
323
259
|
}));
|
|
324
|
-
|
|
325
260
|
return function onSaveMstDtl() {
|
|
326
261
|
return _ref2.apply(this, arguments);
|
|
327
262
|
};
|
|
328
263
|
}();
|
|
329
264
|
/** 删除按钮事件 */
|
|
330
|
-
|
|
331
|
-
|
|
332
265
|
var onRemoveMst = /*#__PURE__*/function () {
|
|
333
266
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
334
267
|
var _result$flag3;
|
|
335
|
-
|
|
336
268
|
var ids, result;
|
|
337
269
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
338
|
-
while (1) {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
ids =
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
if (!_context3.t0) {
|
|
406
|
-
_context3.next = 25;
|
|
407
|
-
break;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
return _context3.abrupt("return");
|
|
411
|
-
|
|
412
|
-
case 25:
|
|
413
|
-
if (!((result === null || result === void 0 ? void 0 : (_result$flag3 = result.flag) === null || _result$flag3 === void 0 ? void 0 : _result$flag3.retCode) === '0')) {
|
|
414
|
-
_context3.next = 28;
|
|
415
|
-
break;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
showSuccess(result.flag.retMsg || '删除成功');
|
|
419
|
-
return _context3.abrupt("return", true);
|
|
420
|
-
|
|
421
|
-
case 28:
|
|
422
|
-
return _context3.abrupt("return", false);
|
|
423
|
-
|
|
424
|
-
case 29:
|
|
425
|
-
case "end":
|
|
426
|
-
return _context3.stop();
|
|
427
|
-
}
|
|
270
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
271
|
+
case 0:
|
|
272
|
+
if (!(!masterObject || !masterObject[mstKeyField])) {
|
|
273
|
+
_context3.next = 2;
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
return _context3.abrupt("return", false);
|
|
277
|
+
case 2:
|
|
278
|
+
if (!isAudit()) {
|
|
279
|
+
_context3.next = 5;
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
showWarn('当前单据已审核,不能删除');
|
|
283
|
+
return _context3.abrupt("return", false);
|
|
284
|
+
case 5:
|
|
285
|
+
_context3.next = 7;
|
|
286
|
+
return showConfirm('确认要删除当前数据?');
|
|
287
|
+
case 7:
|
|
288
|
+
if (!beforeRemove) {
|
|
289
|
+
_context3.next = 13;
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
_context3.next = 10;
|
|
293
|
+
return beforeRemove([masterObject]);
|
|
294
|
+
case 10:
|
|
295
|
+
ids = _context3.sent;
|
|
296
|
+
if (!(ids === false)) {
|
|
297
|
+
_context3.next = 13;
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
return _context3.abrupt("return", false);
|
|
301
|
+
case 13:
|
|
302
|
+
if (!ids) {
|
|
303
|
+
ids = [masterObject[mstKeyField]];
|
|
304
|
+
}
|
|
305
|
+
_context3.next = 16;
|
|
306
|
+
return mstService.remove(ids);
|
|
307
|
+
case 16:
|
|
308
|
+
result = _context3.sent;
|
|
309
|
+
_context3.t0 = afterRemove;
|
|
310
|
+
if (!_context3.t0) {
|
|
311
|
+
_context3.next = 23;
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
_context3.next = 21;
|
|
315
|
+
return afterRemove(result, masterObject);
|
|
316
|
+
case 21:
|
|
317
|
+
_context3.t1 = _context3.sent;
|
|
318
|
+
_context3.t0 = _context3.t1 === false;
|
|
319
|
+
case 23:
|
|
320
|
+
if (!_context3.t0) {
|
|
321
|
+
_context3.next = 25;
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
return _context3.abrupt("return");
|
|
325
|
+
case 25:
|
|
326
|
+
if (!((result === null || result === void 0 ? void 0 : (_result$flag3 = result.flag) === null || _result$flag3 === void 0 ? void 0 : _result$flag3.retCode) === '0')) {
|
|
327
|
+
_context3.next = 28;
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
showSuccess(result.flag.retMsg || '删除成功');
|
|
331
|
+
return _context3.abrupt("return", true);
|
|
332
|
+
case 28:
|
|
333
|
+
return _context3.abrupt("return", false);
|
|
334
|
+
case 29:
|
|
335
|
+
case "end":
|
|
336
|
+
return _context3.stop();
|
|
428
337
|
}
|
|
429
338
|
}, _callee3);
|
|
430
339
|
}));
|
|
431
|
-
|
|
432
340
|
return function onRemoveMst() {
|
|
433
341
|
return _ref3.apply(this, arguments);
|
|
434
342
|
};
|
|
435
343
|
}();
|
|
436
344
|
/** 新增按钮事件 */
|
|
437
|
-
|
|
438
|
-
|
|
439
345
|
var onAddDtl = /*#__PURE__*/function () {
|
|
440
346
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
441
347
|
var item,
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
348
|
+
_formRef$current2,
|
|
349
|
+
mstVal,
|
|
350
|
+
mst,
|
|
351
|
+
_args4 = arguments;
|
|
447
352
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
448
|
-
while (1) {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
if (!(!masterObject[mstKeyField] && formRef.current)) {
|
|
454
|
-
_context4.next = 16;
|
|
455
|
-
break;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
_context4.prev = 2;
|
|
459
|
-
_context4.next = 5;
|
|
460
|
-
return (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.validateFields();
|
|
461
|
-
|
|
462
|
-
case 5:
|
|
463
|
-
mstVal = formRef.current.getFieldsValue();
|
|
464
|
-
_context4.next = 8;
|
|
465
|
-
return onSaveMst(mstVal);
|
|
466
|
-
|
|
467
|
-
case 8:
|
|
468
|
-
mst = _context4.sent;
|
|
469
|
-
|
|
470
|
-
if (!(mst !== true)) {
|
|
471
|
-
_context4.next = 11;
|
|
472
|
-
break;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
return _context4.abrupt("return", false);
|
|
476
|
-
|
|
477
|
-
case 11:
|
|
353
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
354
|
+
case 0:
|
|
355
|
+
item = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : _objectSpread({}, dtlItem);
|
|
356
|
+
if (!(!masterObject[mstKeyField] && formRef.current)) {
|
|
478
357
|
_context4.next = 16;
|
|
479
358
|
break;
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
359
|
+
}
|
|
360
|
+
_context4.prev = 2;
|
|
361
|
+
_context4.next = 5;
|
|
362
|
+
return (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.validateFields();
|
|
363
|
+
case 5:
|
|
364
|
+
mstVal = formRef.current.getFieldsValue();
|
|
365
|
+
_context4.next = 8;
|
|
366
|
+
return onSaveMst(mstVal);
|
|
367
|
+
case 8:
|
|
368
|
+
mst = _context4.sent;
|
|
369
|
+
if (!(mst !== true)) {
|
|
370
|
+
_context4.next = 11;
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
return _context4.abrupt("return", false);
|
|
374
|
+
case 11:
|
|
375
|
+
_context4.next = 16;
|
|
376
|
+
break;
|
|
377
|
+
case 13:
|
|
378
|
+
_context4.prev = 13;
|
|
379
|
+
_context4.t0 = _context4["catch"](2);
|
|
380
|
+
return _context4.abrupt("return", false);
|
|
381
|
+
case 16:
|
|
382
|
+
_context4.t1 = beforeAdd;
|
|
383
|
+
if (!_context4.t1) {
|
|
384
|
+
_context4.next = 22;
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
_context4.next = 20;
|
|
388
|
+
return beforeAdd(item);
|
|
389
|
+
case 20:
|
|
390
|
+
_context4.t2 = _context4.sent;
|
|
391
|
+
_context4.t1 = _context4.t2 === false;
|
|
392
|
+
case 22:
|
|
393
|
+
if (!_context4.t1) {
|
|
394
|
+
_context4.next = 24;
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
return _context4.abrupt("return", false);
|
|
398
|
+
case 24:
|
|
399
|
+
setEditItem(item);
|
|
400
|
+
setShowEdit(true);
|
|
401
|
+
return _context4.abrupt("return", true);
|
|
402
|
+
case 27:
|
|
403
|
+
case "end":
|
|
404
|
+
return _context4.stop();
|
|
518
405
|
}
|
|
519
406
|
}, _callee4, null, [[2, 13]]);
|
|
520
407
|
}));
|
|
521
|
-
|
|
522
408
|
return function onAddDtl() {
|
|
523
409
|
return _ref4.apply(this, arguments);
|
|
524
410
|
};
|
|
525
411
|
}();
|
|
526
412
|
/** 编辑按钮事件 */
|
|
527
|
-
|
|
528
|
-
|
|
529
413
|
var onEditDtl = /*#__PURE__*/function () {
|
|
530
414
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
531
415
|
var item,
|
|
532
|
-
|
|
416
|
+
_args5 = arguments;
|
|
533
417
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
534
|
-
while (1) {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
return _context5.abrupt("return", false);
|
|
569
|
-
|
|
570
|
-
case 12:
|
|
571
|
-
setEditItem(item);
|
|
572
|
-
setShowEdit(true);
|
|
573
|
-
return _context5.abrupt("return", true);
|
|
574
|
-
|
|
575
|
-
case 15:
|
|
576
|
-
case "end":
|
|
577
|
-
return _context5.stop();
|
|
578
|
-
}
|
|
418
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
419
|
+
case 0:
|
|
420
|
+
item = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : _objectSpread({}, selectedRows[0]);
|
|
421
|
+
if (selectedRows.length) {
|
|
422
|
+
_context5.next = 4;
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
showWarn('请先选择需要更改的数据');
|
|
426
|
+
return _context5.abrupt("return", false);
|
|
427
|
+
case 4:
|
|
428
|
+
_context5.t0 = beforeEdit;
|
|
429
|
+
if (!_context5.t0) {
|
|
430
|
+
_context5.next = 10;
|
|
431
|
+
break;
|
|
432
|
+
}
|
|
433
|
+
_context5.next = 8;
|
|
434
|
+
return beforeEdit(item);
|
|
435
|
+
case 8:
|
|
436
|
+
_context5.t1 = _context5.sent;
|
|
437
|
+
_context5.t0 = _context5.t1 === false;
|
|
438
|
+
case 10:
|
|
439
|
+
if (!_context5.t0) {
|
|
440
|
+
_context5.next = 12;
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
return _context5.abrupt("return", false);
|
|
444
|
+
case 12:
|
|
445
|
+
setEditItem(item);
|
|
446
|
+
setShowEdit(true);
|
|
447
|
+
return _context5.abrupt("return", true);
|
|
448
|
+
case 15:
|
|
449
|
+
case "end":
|
|
450
|
+
return _context5.stop();
|
|
579
451
|
}
|
|
580
452
|
}, _callee5);
|
|
581
453
|
}));
|
|
582
|
-
|
|
583
454
|
return function onEditDtl() {
|
|
584
455
|
return _ref5.apply(this, arguments);
|
|
585
456
|
};
|
|
586
457
|
}();
|
|
587
458
|
/** 删除按钮事件 */
|
|
588
|
-
|
|
589
|
-
|
|
590
459
|
var onRemoveDtl = function onRemoveDtl() {
|
|
591
460
|
var rows = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : selectedRows;
|
|
592
|
-
|
|
593
461
|
if (!rows || !rows.length) {
|
|
594
462
|
showWarn('请选择需要删除的数据');
|
|
595
463
|
return;
|
|
596
464
|
}
|
|
597
|
-
|
|
598
465
|
showConfirm('确认要删除选择的数据?').then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
599
466
|
var _result$flag4;
|
|
600
|
-
|
|
601
467
|
var ids, result;
|
|
602
468
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
603
|
-
while (1) {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
case 16:
|
|
651
|
-
if (!_context6.t0) {
|
|
652
|
-
_context6.next = 18;
|
|
653
|
-
break;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
return _context6.abrupt("return");
|
|
657
|
-
|
|
658
|
-
case 18:
|
|
659
|
-
if ((result === null || result === void 0 ? void 0 : (_result$flag4 = result.flag) === null || _result$flag4 === void 0 ? void 0 : _result$flag4.retCode) === '0') {
|
|
660
|
-
showSuccess(result.flag.retMsg);
|
|
661
|
-
|
|
662
|
-
if (tableRef.current) {
|
|
663
|
-
tableRef.current.reload(false);
|
|
664
|
-
}
|
|
469
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
470
|
+
case 0:
|
|
471
|
+
if (!beforeRemove) {
|
|
472
|
+
_context6.next = 6;
|
|
473
|
+
break;
|
|
474
|
+
}
|
|
475
|
+
_context6.next = 3;
|
|
476
|
+
return beforeRemove(rows);
|
|
477
|
+
case 3:
|
|
478
|
+
ids = _context6.sent;
|
|
479
|
+
if (!(ids === false)) {
|
|
480
|
+
_context6.next = 6;
|
|
481
|
+
break;
|
|
482
|
+
}
|
|
483
|
+
return _context6.abrupt("return");
|
|
484
|
+
case 6:
|
|
485
|
+
if (!ids) {
|
|
486
|
+
ids = rows.map(function (o) {
|
|
487
|
+
return o.id;
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
_context6.next = 9;
|
|
491
|
+
return dtlService.remove(ids);
|
|
492
|
+
case 9:
|
|
493
|
+
result = _context6.sent;
|
|
494
|
+
_context6.t0 = afterRemove;
|
|
495
|
+
if (!_context6.t0) {
|
|
496
|
+
_context6.next = 16;
|
|
497
|
+
break;
|
|
498
|
+
}
|
|
499
|
+
_context6.next = 14;
|
|
500
|
+
return afterRemove(result, rows);
|
|
501
|
+
case 14:
|
|
502
|
+
_context6.t1 = _context6.sent;
|
|
503
|
+
_context6.t0 = _context6.t1 === false;
|
|
504
|
+
case 16:
|
|
505
|
+
if (!_context6.t0) {
|
|
506
|
+
_context6.next = 18;
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
return _context6.abrupt("return");
|
|
510
|
+
case 18:
|
|
511
|
+
if ((result === null || result === void 0 ? void 0 : (_result$flag4 = result.flag) === null || _result$flag4 === void 0 ? void 0 : _result$flag4.retCode) === '0') {
|
|
512
|
+
showSuccess(result.flag.retMsg);
|
|
513
|
+
if (tableRef.current) {
|
|
514
|
+
tableRef.current.reload(false);
|
|
665
515
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
}
|
|
516
|
+
}
|
|
517
|
+
case 19:
|
|
518
|
+
case "end":
|
|
519
|
+
return _context6.stop();
|
|
671
520
|
}
|
|
672
521
|
}, _callee6);
|
|
673
522
|
})));
|
|
674
523
|
};
|
|
675
524
|
/** 新增,更改对应的保存事件 */
|
|
676
|
-
|
|
677
|
-
|
|
678
525
|
var onSaveDtl = /*#__PURE__*/function () {
|
|
679
526
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(formData) {
|
|
680
527
|
var _result$flag5;
|
|
681
|
-
|
|
682
528
|
var data, result;
|
|
683
529
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
684
|
-
while (1) {
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
case 21:
|
|
744
|
-
if (!((result === null || result === void 0 ? void 0 : (_result$flag5 = result.flag) === null || _result$flag5 === void 0 ? void 0 : _result$flag5.retCode) === '0')) {
|
|
745
|
-
_context7.next = 25;
|
|
746
|
-
break;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
showSuccess(result.flag.retMsg);
|
|
750
|
-
|
|
751
|
-
if (tableRef.current) {
|
|
752
|
-
tableRef.current.reload(false);
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
return _context7.abrupt("return", true);
|
|
756
|
-
|
|
757
|
-
case 25:
|
|
758
|
-
return _context7.abrupt("return", false);
|
|
759
|
-
|
|
760
|
-
case 26:
|
|
761
|
-
case "end":
|
|
762
|
-
return _context7.stop();
|
|
763
|
-
}
|
|
530
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
531
|
+
case 0:
|
|
532
|
+
data = _objectSpread(_objectSpread({}, editItem), formData);
|
|
533
|
+
if (!data.id) {
|
|
534
|
+
data[relationField] = masterObject[mstKeyField];
|
|
535
|
+
}
|
|
536
|
+
_context7.t0 = beforeSave;
|
|
537
|
+
if (!_context7.t0) {
|
|
538
|
+
_context7.next = 8;
|
|
539
|
+
break;
|
|
540
|
+
}
|
|
541
|
+
_context7.next = 6;
|
|
542
|
+
return beforeSave(data, true);
|
|
543
|
+
case 6:
|
|
544
|
+
_context7.t1 = _context7.sent;
|
|
545
|
+
_context7.t0 = _context7.t1 === false;
|
|
546
|
+
case 8:
|
|
547
|
+
if (!_context7.t0) {
|
|
548
|
+
_context7.next = 10;
|
|
549
|
+
break;
|
|
550
|
+
}
|
|
551
|
+
return _context7.abrupt("return", false);
|
|
552
|
+
case 10:
|
|
553
|
+
_context7.next = 12;
|
|
554
|
+
return dtlService.save(data);
|
|
555
|
+
case 12:
|
|
556
|
+
result = _context7.sent;
|
|
557
|
+
_context7.t2 = afterSave;
|
|
558
|
+
if (!_context7.t2) {
|
|
559
|
+
_context7.next = 19;
|
|
560
|
+
break;
|
|
561
|
+
}
|
|
562
|
+
_context7.next = 17;
|
|
563
|
+
return afterSave(result, data, true);
|
|
564
|
+
case 17:
|
|
565
|
+
_context7.t3 = _context7.sent;
|
|
566
|
+
_context7.t2 = _context7.t3 === false;
|
|
567
|
+
case 19:
|
|
568
|
+
if (!_context7.t2) {
|
|
569
|
+
_context7.next = 21;
|
|
570
|
+
break;
|
|
571
|
+
}
|
|
572
|
+
return _context7.abrupt("return", false);
|
|
573
|
+
case 21:
|
|
574
|
+
if (!((result === null || result === void 0 ? void 0 : (_result$flag5 = result.flag) === null || _result$flag5 === void 0 ? void 0 : _result$flag5.retCode) === '0')) {
|
|
575
|
+
_context7.next = 25;
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
578
|
+
showSuccess(result.flag.retMsg);
|
|
579
|
+
if (tableRef.current) {
|
|
580
|
+
tableRef.current.reload(false);
|
|
581
|
+
}
|
|
582
|
+
return _context7.abrupt("return", true);
|
|
583
|
+
case 25:
|
|
584
|
+
return _context7.abrupt("return", false);
|
|
585
|
+
case 26:
|
|
586
|
+
case "end":
|
|
587
|
+
return _context7.stop();
|
|
764
588
|
}
|
|
765
589
|
}, _callee7);
|
|
766
590
|
}));
|
|
767
|
-
|
|
768
591
|
return function onSaveDtl(_x2) {
|
|
769
592
|
return _ref7.apply(this, arguments);
|
|
770
593
|
};
|
|
771
594
|
}();
|
|
772
595
|
/** 加载数据方法 */
|
|
773
|
-
|
|
774
|
-
|
|
775
596
|
var onLoadDtl = /*#__PURE__*/function () {
|
|
776
597
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(params, sort, filter) {
|
|
777
598
|
var _tableRef$current3, _tableRef$current3$cl;
|
|
778
|
-
|
|
779
599
|
var current, pageSize, sumProperties, rest, param, key, sortArr, _key, _key2, result;
|
|
780
|
-
|
|
781
600
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
782
|
-
while (1) {
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
if (Object.keys(rest).length) {
|
|
816
|
-
Object.assign(param.where, rest);
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
if (filter && Object.keys(filter).length) {
|
|
820
|
-
for (key in filter) {
|
|
821
|
-
if (filter[key] && !param.where[key]) {
|
|
822
|
-
param.where[key] = filter[key];
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
} //处理排序
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
if (!sumProperties && sort && Object.keys(sort).length) {
|
|
829
|
-
sortArr = [];
|
|
830
|
-
|
|
831
|
-
for (_key in sort) {
|
|
832
|
-
sortArr.push(_key + ' ' + (sort[_key] === 'ascend' ? 'asc' : 'desc'));
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
param.sort = sortArr.join(',');
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
for (_key2 in param.where) {
|
|
839
|
-
if (param.where[_key2] === '') {
|
|
840
|
-
delete param.where[_key2];
|
|
601
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
602
|
+
case 0:
|
|
603
|
+
current = params.current, pageSize = params.pageSize, sumProperties = params.sumProperties, rest = _objectWithoutProperties(params, _excluded);
|
|
604
|
+
if (!(!masterObject || !masterObject[mstKeyField])) {
|
|
605
|
+
_context8.next = 3;
|
|
606
|
+
break;
|
|
607
|
+
}
|
|
608
|
+
return _context8.abrupt("return", {
|
|
609
|
+
data: [],
|
|
610
|
+
success: true
|
|
611
|
+
});
|
|
612
|
+
case 3:
|
|
613
|
+
param = {};
|
|
614
|
+
if (current) {
|
|
615
|
+
param.page = current;
|
|
616
|
+
param.pageSize = pageSize;
|
|
617
|
+
}
|
|
618
|
+
// 合计
|
|
619
|
+
if (sumProperties) {
|
|
620
|
+
param.sumProperties = sumProperties;
|
|
621
|
+
delete param.page;
|
|
622
|
+
delete param.pageSize;
|
|
623
|
+
}
|
|
624
|
+
param.where = {};
|
|
625
|
+
param.where[relationField] = masterObject[mstKeyField];
|
|
626
|
+
if (Object.keys(rest).length) {
|
|
627
|
+
Object.assign(param.where, rest);
|
|
628
|
+
}
|
|
629
|
+
if (filter && Object.keys(filter).length) {
|
|
630
|
+
for (key in filter) {
|
|
631
|
+
if (filter[key] && !param.where[key]) {
|
|
632
|
+
param.where[key] = filter[key];
|
|
841
633
|
}
|
|
842
634
|
}
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
if (
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
}
|
|
635
|
+
}
|
|
636
|
+
//处理排序
|
|
637
|
+
if (!sumProperties && sort && Object.keys(sort).length) {
|
|
638
|
+
sortArr = [];
|
|
639
|
+
for (_key in sort) {
|
|
640
|
+
sortArr.push(_key + ' ' + (sort[_key] === 'ascend' ? 'asc' : 'desc'));
|
|
641
|
+
}
|
|
642
|
+
param.sort = sortArr.join(',');
|
|
643
|
+
}
|
|
644
|
+
for (_key2 in param.where) {
|
|
645
|
+
if (param.where[_key2] === '') {
|
|
646
|
+
delete param.where[_key2];
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
setSelectedRows([]);
|
|
650
|
+
(_tableRef$current3 = tableRef.current) === null || _tableRef$current3 === void 0 ? void 0 : (_tableRef$current3$cl = _tableRef$current3.clearSelected) === null || _tableRef$current3$cl === void 0 ? void 0 : _tableRef$current3$cl.call(_tableRef$current3);
|
|
651
|
+
if (ifHistoryData === 1) {
|
|
652
|
+
param.history = 1;
|
|
653
|
+
}
|
|
654
|
+
_context8.t0 = beforeLoad;
|
|
655
|
+
if (!_context8.t0) {
|
|
656
|
+
_context8.next = 21;
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
_context8.next = 19;
|
|
660
|
+
return beforeLoad(param);
|
|
661
|
+
case 19:
|
|
662
|
+
_context8.t1 = _context8.sent;
|
|
663
|
+
_context8.t0 = _context8.t1 === false;
|
|
664
|
+
case 21:
|
|
665
|
+
if (!_context8.t0) {
|
|
666
|
+
_context8.next = 23;
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
669
|
+
return _context8.abrupt("return", {
|
|
670
|
+
data: [],
|
|
671
|
+
success: true
|
|
672
|
+
});
|
|
673
|
+
case 23:
|
|
674
|
+
if (sumProperties && param.sort) {
|
|
675
|
+
delete param.sort;
|
|
676
|
+
}
|
|
677
|
+
_context8.next = 26;
|
|
678
|
+
return dtlService.load(param);
|
|
679
|
+
case 26:
|
|
680
|
+
result = _context8.sent;
|
|
681
|
+
result.data = result.rows;
|
|
682
|
+
result.success = true;
|
|
683
|
+
if (sumProperties) {
|
|
684
|
+
result.data = result.footer;
|
|
685
|
+
}
|
|
686
|
+
return _context8.abrupt("return", result);
|
|
687
|
+
case 31:
|
|
688
|
+
case "end":
|
|
689
|
+
return _context8.stop();
|
|
899
690
|
}
|
|
900
691
|
}, _callee8);
|
|
901
692
|
}));
|
|
902
|
-
|
|
903
693
|
return function onLoadDtl(_x3, _x4, _x5) {
|
|
904
694
|
return _ref8.apply(this, arguments);
|
|
905
695
|
};
|
|
906
696
|
}();
|
|
907
|
-
|
|
908
697
|
var onExportDtl = /*#__PURE__*/function () {
|
|
909
698
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(url, param) {
|
|
910
699
|
var _param$exportColumns;
|
|
911
|
-
|
|
912
700
|
var _result$flag6, result, _result$flag7, _result$flag8;
|
|
913
|
-
|
|
914
701
|
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
915
|
-
while (1) {
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
_context9.next = 3;
|
|
920
|
-
break;
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
showWarn('请选择要导出的列');
|
|
924
|
-
return _context9.abrupt("return", false);
|
|
925
|
-
|
|
926
|
-
case 3:
|
|
927
|
-
if (param.findUrl) {
|
|
928
|
-
_context9.next = 6;
|
|
929
|
-
break;
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
showWarn('请配置业务接口 bizApi 属性');
|
|
933
|
-
return _context9.abrupt("return", false);
|
|
934
|
-
|
|
935
|
-
case 6:
|
|
936
|
-
_context9.prev = 6;
|
|
937
|
-
_context9.next = 9;
|
|
938
|
-
return httpPost(url, param);
|
|
939
|
-
|
|
940
|
-
case 9:
|
|
941
|
-
result = _context9.sent;
|
|
942
|
-
|
|
943
|
-
if (!(result.data && typeof result.data === 'string')) {
|
|
944
|
-
_context9.next = 13;
|
|
945
|
-
break;
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
window.open(result.data);
|
|
949
|
-
return _context9.abrupt("return", true);
|
|
950
|
-
|
|
951
|
-
case 13:
|
|
952
|
-
if (!(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retCode) === '0')) {
|
|
953
|
-
_context9.next = 18;
|
|
954
|
-
break;
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
showSuccess(((_result$flag7 = result.flag) === null || _result$flag7 === void 0 ? void 0 : _result$flag7.retMsg) || '导出成功');
|
|
958
|
-
return _context9.abrupt("return", true);
|
|
959
|
-
|
|
960
|
-
case 18:
|
|
961
|
-
showError(((_result$flag8 = result.flag) === null || _result$flag8 === void 0 ? void 0 : _result$flag8.retMsg) || '导出失败,请联系系统管理员');
|
|
962
|
-
return _context9.abrupt("return", false);
|
|
963
|
-
|
|
964
|
-
case 20:
|
|
965
|
-
_context9.next = 26;
|
|
702
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
703
|
+
case 0:
|
|
704
|
+
if ((_param$exportColumns = param.exportColumns) === null || _param$exportColumns === void 0 ? void 0 : _param$exportColumns.length) {
|
|
705
|
+
_context9.next = 3;
|
|
966
706
|
break;
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
707
|
+
}
|
|
708
|
+
showWarn('请选择要导出的列');
|
|
709
|
+
return _context9.abrupt("return", false);
|
|
710
|
+
case 3:
|
|
711
|
+
if (param.findUrl) {
|
|
712
|
+
_context9.next = 6;
|
|
713
|
+
break;
|
|
714
|
+
}
|
|
715
|
+
showWarn('请配置业务接口 bizApi 属性');
|
|
716
|
+
return _context9.abrupt("return", false);
|
|
717
|
+
case 6:
|
|
718
|
+
_context9.prev = 6;
|
|
719
|
+
_context9.next = 9;
|
|
720
|
+
return httpPost(url, param);
|
|
721
|
+
case 9:
|
|
722
|
+
result = _context9.sent;
|
|
723
|
+
if (!(result.data && typeof result.data === 'string')) {
|
|
724
|
+
_context9.next = 13;
|
|
725
|
+
break;
|
|
726
|
+
}
|
|
727
|
+
window.open(result.data);
|
|
728
|
+
return _context9.abrupt("return", true);
|
|
729
|
+
case 13:
|
|
730
|
+
if (!(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retCode) === '0')) {
|
|
731
|
+
_context9.next = 18;
|
|
732
|
+
break;
|
|
733
|
+
}
|
|
734
|
+
showSuccess(((_result$flag7 = result.flag) === null || _result$flag7 === void 0 ? void 0 : _result$flag7.retMsg) || '导出成功');
|
|
735
|
+
return _context9.abrupt("return", true);
|
|
736
|
+
case 18:
|
|
737
|
+
showError(((_result$flag8 = result.flag) === null || _result$flag8 === void 0 ? void 0 : _result$flag8.retMsg) || '导出失败,请联系系统管理员');
|
|
738
|
+
return _context9.abrupt("return", false);
|
|
739
|
+
case 20:
|
|
740
|
+
_context9.next = 26;
|
|
741
|
+
break;
|
|
742
|
+
case 22:
|
|
743
|
+
_context9.prev = 22;
|
|
744
|
+
_context9.t0 = _context9["catch"](6);
|
|
745
|
+
showError(_context9.t0.message);
|
|
746
|
+
return _context9.abrupt("return", false);
|
|
747
|
+
case 26:
|
|
748
|
+
case "end":
|
|
749
|
+
return _context9.stop();
|
|
978
750
|
}
|
|
979
751
|
}, _callee9, null, [[6, 22]]);
|
|
980
752
|
}));
|
|
981
|
-
|
|
982
753
|
return function onExportDtl(_x6, _x7) {
|
|
983
754
|
return _ref9.apply(this, arguments);
|
|
984
755
|
};
|
|
985
756
|
}();
|
|
986
757
|
/** 审核按钮事件 */
|
|
987
|
-
|
|
988
|
-
|
|
989
758
|
var onAudit = /*#__PURE__*/function () {
|
|
990
759
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
991
760
|
var obj, _result$flag9, result;
|
|
992
|
-
|
|
993
761
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
994
|
-
while (1) {
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
_context10.next = 3;
|
|
999
|
-
break;
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
showWarn('当前数据已审核,不能再做审核操作!');
|
|
1003
|
-
return _context10.abrupt("return");
|
|
1004
|
-
|
|
1005
|
-
case 3:
|
|
1006
|
-
obj = _objectSpread({}, masterObject);
|
|
1007
|
-
|
|
1008
|
-
if (masterObject[mstKeyField]) {
|
|
1009
|
-
_context10.next = 7;
|
|
1010
|
-
break;
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
showWarn('当前数据未保存,不能审核');
|
|
1014
|
-
return _context10.abrupt("return");
|
|
1015
|
-
|
|
1016
|
-
case 7:
|
|
1017
|
-
_context10.prev = 7;
|
|
1018
|
-
_context10.next = 10;
|
|
1019
|
-
return showConfirm('确认要审核此数据?', '审核提示');
|
|
1020
|
-
|
|
1021
|
-
case 10:
|
|
1022
|
-
_context10.next = 16;
|
|
762
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
763
|
+
case 0:
|
|
764
|
+
if (!isAudit()) {
|
|
765
|
+
_context10.next = 3;
|
|
1023
766
|
break;
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
_context10.t3 = afterAudit;
|
|
1062
|
-
|
|
1063
|
-
if (!_context10.t3) {
|
|
1064
|
-
_context10.next = 34;
|
|
1065
|
-
break;
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
_context10.next = 32;
|
|
1069
|
-
return afterAudit(result, [obj]);
|
|
1070
|
-
|
|
1071
|
-
case 32:
|
|
1072
|
-
_context10.t4 = _context10.sent;
|
|
1073
|
-
_context10.t3 = _context10.t4 === false;
|
|
1074
|
-
|
|
1075
|
-
case 34:
|
|
1076
|
-
if (!_context10.t3) {
|
|
1077
|
-
_context10.next = 36;
|
|
1078
|
-
break;
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
return _context10.abrupt("return");
|
|
1082
|
-
|
|
1083
|
-
case 36:
|
|
1084
|
-
if ((result === null || result === void 0 ? void 0 : (_result$flag9 = result.flag) === null || _result$flag9 === void 0 ? void 0 : _result$flag9.retCode) === '0') {
|
|
1085
|
-
showSuccess(result.flag.retMsg || '审核成功');
|
|
1086
|
-
Object.assign(masterObject, result.data);
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
_context10.next = 42;
|
|
767
|
+
}
|
|
768
|
+
showWarn('当前数据已审核,不能再做审核操作!');
|
|
769
|
+
return _context10.abrupt("return");
|
|
770
|
+
case 3:
|
|
771
|
+
obj = _objectSpread({}, masterObject);
|
|
772
|
+
if (masterObject[mstKeyField]) {
|
|
773
|
+
_context10.next = 7;
|
|
774
|
+
break;
|
|
775
|
+
}
|
|
776
|
+
showWarn('当前数据未保存,不能审核');
|
|
777
|
+
return _context10.abrupt("return");
|
|
778
|
+
case 7:
|
|
779
|
+
_context10.prev = 7;
|
|
780
|
+
_context10.next = 10;
|
|
781
|
+
return showConfirm('确认要审核此数据?', '审核提示');
|
|
782
|
+
case 10:
|
|
783
|
+
_context10.next = 16;
|
|
784
|
+
break;
|
|
785
|
+
case 12:
|
|
786
|
+
_context10.prev = 12;
|
|
787
|
+
_context10.t0 = _context10["catch"](7);
|
|
788
|
+
console.log('终止审核', _context10.t0);
|
|
789
|
+
return _context10.abrupt("return");
|
|
790
|
+
case 16:
|
|
791
|
+
_context10.t1 = beforeAudit;
|
|
792
|
+
if (!_context10.t1) {
|
|
793
|
+
_context10.next = 22;
|
|
794
|
+
break;
|
|
795
|
+
}
|
|
796
|
+
_context10.next = 20;
|
|
797
|
+
return beforeAudit(obj);
|
|
798
|
+
case 20:
|
|
799
|
+
_context10.t2 = _context10.sent;
|
|
800
|
+
_context10.t1 = _context10.t2 === false;
|
|
801
|
+
case 22:
|
|
802
|
+
if (!_context10.t1) {
|
|
803
|
+
_context10.next = 24;
|
|
1090
804
|
break;
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
805
|
+
}
|
|
806
|
+
return _context10.abrupt("return");
|
|
807
|
+
case 24:
|
|
808
|
+
_context10.prev = 24;
|
|
809
|
+
_context10.next = 27;
|
|
810
|
+
return mstService.audit([obj]);
|
|
811
|
+
case 27:
|
|
812
|
+
result = _context10.sent;
|
|
813
|
+
_context10.t3 = afterAudit;
|
|
814
|
+
if (!_context10.t3) {
|
|
815
|
+
_context10.next = 34;
|
|
816
|
+
break;
|
|
817
|
+
}
|
|
818
|
+
_context10.next = 32;
|
|
819
|
+
return afterAudit(result, [obj]);
|
|
820
|
+
case 32:
|
|
821
|
+
_context10.t4 = _context10.sent;
|
|
822
|
+
_context10.t3 = _context10.t4 === false;
|
|
823
|
+
case 34:
|
|
824
|
+
if (!_context10.t3) {
|
|
825
|
+
_context10.next = 36;
|
|
826
|
+
break;
|
|
827
|
+
}
|
|
828
|
+
return _context10.abrupt("return");
|
|
829
|
+
case 36:
|
|
830
|
+
if ((result === null || result === void 0 ? void 0 : (_result$flag9 = result.flag) === null || _result$flag9 === void 0 ? void 0 : _result$flag9.retCode) === '0') {
|
|
831
|
+
showSuccess(result.flag.retMsg || '审核成功');
|
|
832
|
+
Object.assign(masterObject, result.data);
|
|
833
|
+
}
|
|
834
|
+
_context10.next = 42;
|
|
835
|
+
break;
|
|
836
|
+
case 39:
|
|
837
|
+
_context10.prev = 39;
|
|
838
|
+
_context10.t5 = _context10["catch"](24);
|
|
839
|
+
console.log('审核异常', _context10.t5);
|
|
840
|
+
case 42:
|
|
841
|
+
case "end":
|
|
842
|
+
return _context10.stop();
|
|
1101
843
|
}
|
|
1102
844
|
}, _callee10, null, [[7, 12], [24, 39]]);
|
|
1103
845
|
}));
|
|
1104
|
-
|
|
1105
846
|
return function onAudit() {
|
|
1106
847
|
return _ref10.apply(this, arguments);
|
|
1107
848
|
};
|
|
1108
849
|
}();
|
|
1109
|
-
|
|
1110
850
|
var btnDisabled = function btnDisabled(key) {
|
|
1111
851
|
if (btnStatus && typeof btnStatus(key) === 'boolean') return btnStatus(key);
|
|
1112
|
-
|
|
1113
852
|
switch (key) {
|
|
1114
853
|
case 'edit':
|
|
1115
854
|
return selectedRows.length !== 1;
|
|
1116
|
-
|
|
1117
855
|
case 'remove':
|
|
1118
856
|
return selectedRows.length === 0 || isAudit();
|
|
1119
|
-
|
|
1120
857
|
default:
|
|
1121
858
|
return false;
|
|
1122
859
|
}
|
|
1123
860
|
};
|
|
1124
|
-
|
|
1125
861
|
var onExport = function onExport() {
|
|
1126
862
|
var _tableRef$current4, _tableRef$current4$sh;
|
|
1127
|
-
|
|
1128
863
|
if (!masterObject[mstKeyField]) {
|
|
1129
864
|
showWarn('主表没保存,无法导出数据');
|
|
1130
865
|
return;
|
|
1131
866
|
}
|
|
1132
|
-
|
|
1133
867
|
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current4 = tableRef.current) === null || _tableRef$current4 === void 0 ? void 0 : (_tableRef$current4$sh = _tableRef$current4.showExport) === null || _tableRef$current4$sh === void 0 ? void 0 : _tableRef$current4$sh.call(_tableRef$current4);
|
|
1134
868
|
};
|
|
1135
|
-
|
|
1136
869
|
var onImport = function onImport() {
|
|
1137
870
|
var _tableRef$current5, _tableRef$current5$sh;
|
|
1138
|
-
|
|
1139
871
|
if (!masterObject[mstKeyField]) {
|
|
1140
872
|
showWarn('主表没保存,无法导入数据');
|
|
1141
873
|
return;
|
|
1142
874
|
}
|
|
1143
|
-
|
|
1144
875
|
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current5 = tableRef.current) === null || _tableRef$current5 === void 0 ? void 0 : (_tableRef$current5$sh = _tableRef$current5.showImport) === null || _tableRef$current5$sh === void 0 ? void 0 : _tableRef$current5$sh.call(_tableRef$current5);
|
|
1145
876
|
};
|
|
1146
|
-
|
|
1147
877
|
var tableTools = useMemo(function () {
|
|
1148
878
|
return [(toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.add) && !isAudit() && canAdd ? /*#__PURE__*/React.createElement(_Button, {
|
|
1149
879
|
key: "add",
|
|
@@ -1209,6 +939,5 @@ function useDtl(dtlParam) {
|
|
|
1209
939
|
onAudit: onAudit
|
|
1210
940
|
};
|
|
1211
941
|
}
|
|
1212
|
-
|
|
1213
942
|
;
|
|
1214
943
|
export default useDtl;
|