ls-pro-common 1.1.0 → 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 +138 -1
- package/dist/common.js +1 -1
- package/dist/common.js.LICENSE.txt +5 -3
- package/dist/common.min.css +138 -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.d.ts +5 -0
- package/es/components/AreaCascaderPanel.js +230 -0
- 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.d.ts +2 -0
- package/es/components/InputTable.js +118 -160
- package/es/components/Loading.js +3 -6
- package/es/components/common.less +158 -1
- package/es/hooks/useDtl/index.d.ts +2 -0
- package/es/hooks/useDtl/index.js +676 -941
- package/es/hooks/usePermission/index.js +0 -9
- package/es/hooks/useSingle/index.d.ts +2 -0
- package/es/hooks/useSingle/index.js +440 -599
- package/es/http/index.js +113 -149
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -2
- 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.d.ts +5 -0
- package/lib/components/AreaCascaderPanel.js +239 -0
- 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.d.ts +2 -0
- package/lib/components/InputTable.js +120 -185
- package/lib/components/Loading.js +4 -16
- package/lib/components/common.less +158 -1
- package/lib/hooks/useDtl/index.d.ts +2 -0
- package/lib/hooks/useDtl/index.js +677 -957
- package/lib/hooks/usePermission/index.js +0 -12
- package/lib/hooks/useSingle/index.d.ts +2 -0
- package/lib/hooks/useSingle/index.js +441 -614
- package/lib/http/index.js +111 -158
- package/lib/index.d.ts +2 -1
- package/lib/index.js +9 -20
- 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,1143 +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
|
-
|
|
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;
|
|
38
38
|
var _usePermission = usePermission(),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
canAdd = _usePermission.canAdd,
|
|
40
|
+
canEdit = _usePermission.canEdit,
|
|
41
|
+
canDelete = _usePermission.canDelete,
|
|
42
|
+
canImport = _usePermission.canImport,
|
|
43
|
+
canExport = _usePermission.canExport;
|
|
44
44
|
/** @name 选中行数据 */
|
|
45
|
-
|
|
46
|
-
|
|
47
45
|
var _useState = useState([]),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
selectedRows = _useState2[0],
|
|
48
|
+
setSelectedRows = _useState2[1];
|
|
51
49
|
/** @name 显示新增编辑框 */
|
|
52
|
-
|
|
53
|
-
|
|
54
50
|
var _useState3 = useState(false),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
52
|
+
showEdit = _useState4[0],
|
|
53
|
+
setShowEdit = _useState4[1];
|
|
58
54
|
/** @name 新增或编辑对象初始值 */
|
|
59
|
-
|
|
60
|
-
|
|
61
55
|
var _useState5 = useState(dtlItem),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
57
|
+
editItem = _useState6[0],
|
|
58
|
+
setEditItem = _useState6[1];
|
|
65
59
|
/** @name 从表表格Ref */
|
|
66
|
-
|
|
67
|
-
|
|
68
60
|
var tableRef = useRef();
|
|
69
61
|
/** @name 主表表单Ref */
|
|
70
|
-
|
|
71
62
|
var formRef = useRef();
|
|
72
63
|
/** @name 从表编辑表单Ref */
|
|
73
|
-
|
|
74
64
|
var dtlFormRef = useRef();
|
|
75
65
|
/**@name 判断是否已审核 */
|
|
76
|
-
|
|
77
66
|
var isAudit = useCallback(function () {
|
|
78
67
|
if (!auditStatus || !statusField) return false;
|
|
79
68
|
return Number(masterObject[statusField] || 0) >= auditStatus;
|
|
80
69
|
}, [auditStatus, statusField, masterObject]);
|
|
81
70
|
/** @name 保存主表 */
|
|
82
|
-
|
|
83
71
|
var onSaveMst = /*#__PURE__*/function () {
|
|
84
72
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values) {
|
|
85
73
|
var _result$flag;
|
|
86
|
-
|
|
87
74
|
var data, result;
|
|
88
75
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
89
|
-
while (1) {
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
return _context.abrupt("return", false);
|
|
151
|
-
|
|
152
|
-
case 23:
|
|
153
|
-
if (!((result === null || result === void 0 ? void 0 : (_result$flag = result.flag) === null || _result$flag === void 0 ? void 0 : _result$flag.retCode) === '0')) {
|
|
154
|
-
_context.next = 28;
|
|
155
|
-
break;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
showSuccess(result.flag.retMsg || '操作成功');
|
|
159
|
-
Object.assign(masterObject, result.data);
|
|
160
|
-
setEditItem({});
|
|
161
|
-
return _context.abrupt("return", true);
|
|
162
|
-
|
|
163
|
-
case 28:
|
|
164
|
-
return _context.abrupt("return", false);
|
|
165
|
-
|
|
166
|
-
case 29:
|
|
167
|
-
case "end":
|
|
168
|
-
return _context.stop();
|
|
169
|
-
}
|
|
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();
|
|
170
137
|
}
|
|
171
138
|
}, _callee);
|
|
172
139
|
}));
|
|
173
|
-
|
|
174
140
|
return function onSaveMst(_x) {
|
|
175
141
|
return _ref.apply(this, arguments);
|
|
176
142
|
};
|
|
177
143
|
}();
|
|
178
144
|
/** @name 主从一起保存 */
|
|
179
|
-
|
|
180
|
-
|
|
181
145
|
var onSaveMstDtl = /*#__PURE__*/function () {
|
|
182
146
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
183
147
|
var _formRef$current, _formRef$current$getF, _tableRef$current, _tableRef$current$get, _tableRef$current2, _tableRef$current2$ge, _result$flag2;
|
|
184
|
-
|
|
185
148
|
var isDelete,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
149
|
+
values,
|
|
150
|
+
mst,
|
|
151
|
+
dtlEditData,
|
|
152
|
+
dtlData,
|
|
153
|
+
param,
|
|
154
|
+
result,
|
|
155
|
+
_args2 = arguments;
|
|
193
156
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
194
|
-
while (1) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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,
|
|
221
193
|
updateRows: [],
|
|
222
194
|
deleteRows: []
|
|
223
195
|
};
|
|
224
|
-
|
|
225
|
-
param =
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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: []
|
|
231
204
|
};
|
|
232
|
-
|
|
233
|
-
|
|
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
|
-
_context2.next = 28;
|
|
287
|
-
return afterSave(result, param, false);
|
|
288
|
-
|
|
289
|
-
case 28:
|
|
290
|
-
_context2.t3 = _context2.sent;
|
|
291
|
-
_context2.t2 = _context2.t3 === false;
|
|
292
|
-
|
|
293
|
-
case 30:
|
|
294
|
-
if (!_context2.t2) {
|
|
295
|
-
_context2.next = 32;
|
|
296
|
-
break;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
return _context2.abrupt("return", false);
|
|
300
|
-
|
|
301
|
-
case 32:
|
|
302
|
-
if (!((result === null || result === void 0 ? void 0 : (_result$flag2 = result.flag) === null || _result$flag2 === void 0 ? void 0 : _result$flag2.retCode) === '0')) {
|
|
303
|
-
_context2.next = 37;
|
|
304
|
-
break;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
showSuccess(result.flag.retMsg || '操作成功');
|
|
308
|
-
Object.assign(masterObject, result.data);
|
|
309
|
-
setEditItem({});
|
|
310
|
-
return _context2.abrupt("return", true);
|
|
311
|
-
|
|
312
|
-
case 37:
|
|
313
|
-
return _context2.abrupt("return", false);
|
|
314
|
-
|
|
315
|
-
case 38:
|
|
316
|
-
case "end":
|
|
317
|
-
return _context2.stop();
|
|
318
|
-
}
|
|
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();
|
|
319
257
|
}
|
|
320
258
|
}, _callee2);
|
|
321
259
|
}));
|
|
322
|
-
|
|
323
260
|
return function onSaveMstDtl() {
|
|
324
261
|
return _ref2.apply(this, arguments);
|
|
325
262
|
};
|
|
326
263
|
}();
|
|
327
264
|
/** 删除按钮事件 */
|
|
328
|
-
|
|
329
|
-
|
|
330
265
|
var onRemoveMst = /*#__PURE__*/function () {
|
|
331
266
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
332
267
|
var _result$flag3;
|
|
333
|
-
|
|
334
268
|
var ids, result;
|
|
335
269
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
336
|
-
while (1) {
|
|
337
|
-
|
|
338
|
-
|
|
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
|
-
ids =
|
|
370
|
-
|
|
371
|
-
|
|
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
|
-
if (!_context3.t0) {
|
|
404
|
-
_context3.next = 25;
|
|
405
|
-
break;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
return _context3.abrupt("return");
|
|
409
|
-
|
|
410
|
-
case 25:
|
|
411
|
-
if (!((result === null || result === void 0 ? void 0 : (_result$flag3 = result.flag) === null || _result$flag3 === void 0 ? void 0 : _result$flag3.retCode) === '0')) {
|
|
412
|
-
_context3.next = 28;
|
|
413
|
-
break;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
showSuccess(result.flag.retMsg || '删除成功');
|
|
417
|
-
return _context3.abrupt("return", true);
|
|
418
|
-
|
|
419
|
-
case 28:
|
|
420
|
-
return _context3.abrupt("return", false);
|
|
421
|
-
|
|
422
|
-
case 29:
|
|
423
|
-
case "end":
|
|
424
|
-
return _context3.stop();
|
|
425
|
-
}
|
|
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();
|
|
426
337
|
}
|
|
427
338
|
}, _callee3);
|
|
428
339
|
}));
|
|
429
|
-
|
|
430
340
|
return function onRemoveMst() {
|
|
431
341
|
return _ref3.apply(this, arguments);
|
|
432
342
|
};
|
|
433
343
|
}();
|
|
434
344
|
/** 新增按钮事件 */
|
|
435
|
-
|
|
436
|
-
|
|
437
345
|
var onAddDtl = /*#__PURE__*/function () {
|
|
438
346
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
439
347
|
var item,
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
348
|
+
_formRef$current2,
|
|
349
|
+
mstVal,
|
|
350
|
+
mst,
|
|
351
|
+
_args4 = arguments;
|
|
445
352
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
446
|
-
while (1) {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
if (!(!masterObject[mstKeyField] && formRef.current)) {
|
|
452
|
-
_context4.next = 16;
|
|
453
|
-
break;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
_context4.prev = 2;
|
|
457
|
-
_context4.next = 5;
|
|
458
|
-
return (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.validateFields();
|
|
459
|
-
|
|
460
|
-
case 5:
|
|
461
|
-
mstVal = formRef.current.getFieldsValue();
|
|
462
|
-
_context4.next = 8;
|
|
463
|
-
return onSaveMst(mstVal);
|
|
464
|
-
|
|
465
|
-
case 8:
|
|
466
|
-
mst = _context4.sent;
|
|
467
|
-
|
|
468
|
-
if (!(mst !== true)) {
|
|
469
|
-
_context4.next = 11;
|
|
470
|
-
break;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
return _context4.abrupt("return", false);
|
|
474
|
-
|
|
475
|
-
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)) {
|
|
476
357
|
_context4.next = 16;
|
|
477
358
|
break;
|
|
478
|
-
|
|
479
|
-
|
|
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
|
-
|
|
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();
|
|
516
405
|
}
|
|
517
406
|
}, _callee4, null, [[2, 13]]);
|
|
518
407
|
}));
|
|
519
|
-
|
|
520
408
|
return function onAddDtl() {
|
|
521
409
|
return _ref4.apply(this, arguments);
|
|
522
410
|
};
|
|
523
411
|
}();
|
|
524
412
|
/** 编辑按钮事件 */
|
|
525
|
-
|
|
526
|
-
|
|
527
413
|
var onEditDtl = /*#__PURE__*/function () {
|
|
528
414
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
529
415
|
var item,
|
|
530
|
-
|
|
416
|
+
_args5 = arguments;
|
|
531
417
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
532
|
-
while (1) {
|
|
533
|
-
|
|
534
|
-
|
|
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
|
-
return _context5.abrupt("return", false);
|
|
567
|
-
|
|
568
|
-
case 12:
|
|
569
|
-
setEditItem(item);
|
|
570
|
-
setShowEdit(true);
|
|
571
|
-
return _context5.abrupt("return", true);
|
|
572
|
-
|
|
573
|
-
case 15:
|
|
574
|
-
case "end":
|
|
575
|
-
return _context5.stop();
|
|
576
|
-
}
|
|
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();
|
|
577
451
|
}
|
|
578
452
|
}, _callee5);
|
|
579
453
|
}));
|
|
580
|
-
|
|
581
454
|
return function onEditDtl() {
|
|
582
455
|
return _ref5.apply(this, arguments);
|
|
583
456
|
};
|
|
584
457
|
}();
|
|
585
458
|
/** 删除按钮事件 */
|
|
586
|
-
|
|
587
|
-
|
|
588
459
|
var onRemoveDtl = function onRemoveDtl() {
|
|
589
460
|
var rows = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : selectedRows;
|
|
590
|
-
|
|
591
461
|
if (!rows || !rows.length) {
|
|
592
462
|
showWarn('请选择需要删除的数据');
|
|
593
463
|
return;
|
|
594
464
|
}
|
|
595
|
-
|
|
596
465
|
showConfirm('确认要删除选择的数据?').then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
597
466
|
var _result$flag4;
|
|
598
|
-
|
|
599
467
|
var ids, result;
|
|
600
468
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
601
|
-
while (1) {
|
|
602
|
-
|
|
603
|
-
|
|
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
|
-
case 16:
|
|
649
|
-
if (!_context6.t0) {
|
|
650
|
-
_context6.next = 18;
|
|
651
|
-
break;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
return _context6.abrupt("return");
|
|
655
|
-
|
|
656
|
-
case 18:
|
|
657
|
-
if ((result === null || result === void 0 ? void 0 : (_result$flag4 = result.flag) === null || _result$flag4 === void 0 ? void 0 : _result$flag4.retCode) === '0') {
|
|
658
|
-
showSuccess(result.flag.retMsg);
|
|
659
|
-
|
|
660
|
-
if (tableRef.current) {
|
|
661
|
-
tableRef.current.reload(false);
|
|
662
|
-
}
|
|
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);
|
|
663
515
|
}
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
}
|
|
516
|
+
}
|
|
517
|
+
case 19:
|
|
518
|
+
case "end":
|
|
519
|
+
return _context6.stop();
|
|
669
520
|
}
|
|
670
521
|
}, _callee6);
|
|
671
522
|
})));
|
|
672
523
|
};
|
|
673
524
|
/** 新增,更改对应的保存事件 */
|
|
674
|
-
|
|
675
|
-
|
|
676
525
|
var onSaveDtl = /*#__PURE__*/function () {
|
|
677
526
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(formData) {
|
|
678
527
|
var _result$flag5;
|
|
679
|
-
|
|
680
528
|
var data, result;
|
|
681
529
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
682
|
-
while (1) {
|
|
683
|
-
|
|
684
|
-
|
|
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
|
-
case 21:
|
|
742
|
-
if (!((result === null || result === void 0 ? void 0 : (_result$flag5 = result.flag) === null || _result$flag5 === void 0 ? void 0 : _result$flag5.retCode) === '0')) {
|
|
743
|
-
_context7.next = 25;
|
|
744
|
-
break;
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
showSuccess(result.flag.retMsg);
|
|
748
|
-
|
|
749
|
-
if (tableRef.current) {
|
|
750
|
-
tableRef.current.reload(false);
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
return _context7.abrupt("return", true);
|
|
754
|
-
|
|
755
|
-
case 25:
|
|
756
|
-
return _context7.abrupt("return", false);
|
|
757
|
-
|
|
758
|
-
case 26:
|
|
759
|
-
case "end":
|
|
760
|
-
return _context7.stop();
|
|
761
|
-
}
|
|
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();
|
|
762
588
|
}
|
|
763
589
|
}, _callee7);
|
|
764
590
|
}));
|
|
765
|
-
|
|
766
591
|
return function onSaveDtl(_x2) {
|
|
767
592
|
return _ref7.apply(this, arguments);
|
|
768
593
|
};
|
|
769
594
|
}();
|
|
770
595
|
/** 加载数据方法 */
|
|
771
|
-
|
|
772
|
-
|
|
773
596
|
var onLoadDtl = /*#__PURE__*/function () {
|
|
774
597
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(params, sort, filter) {
|
|
775
598
|
var _tableRef$current3, _tableRef$current3$cl;
|
|
776
|
-
|
|
777
599
|
var current, pageSize, sumProperties, rest, param, key, sortArr, _key, _key2, result;
|
|
778
|
-
|
|
779
600
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
780
|
-
while (1) {
|
|
781
|
-
|
|
782
|
-
|
|
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
|
-
if (Object.keys(rest).length) {
|
|
814
|
-
Object.assign(param.where, rest);
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
if (filter && Object.keys(filter).length) {
|
|
818
|
-
for (key in filter) {
|
|
819
|
-
if (filter[key] && !param.where[key]) {
|
|
820
|
-
param.where[key] = filter[key];
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
} //处理排序
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
if (!sumProperties && sort && Object.keys(sort).length) {
|
|
827
|
-
sortArr = [];
|
|
828
|
-
|
|
829
|
-
for (_key in sort) {
|
|
830
|
-
sortArr.push(_key + ' ' + (sort[_key] === 'ascend' ? 'asc' : 'desc'));
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
param.sort = sortArr.join(',');
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
for (_key2 in param.where) {
|
|
837
|
-
if (param.where[_key2] === '') {
|
|
838
|
-
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];
|
|
839
633
|
}
|
|
840
634
|
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
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
|
-
|
|
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();
|
|
892
690
|
}
|
|
893
691
|
}, _callee8);
|
|
894
692
|
}));
|
|
895
|
-
|
|
896
693
|
return function onLoadDtl(_x3, _x4, _x5) {
|
|
897
694
|
return _ref8.apply(this, arguments);
|
|
898
695
|
};
|
|
899
696
|
}();
|
|
900
|
-
|
|
901
697
|
var onExportDtl = /*#__PURE__*/function () {
|
|
902
698
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(url, param) {
|
|
903
699
|
var _param$exportColumns;
|
|
904
|
-
|
|
905
700
|
var _result$flag6, result, _result$flag7, _result$flag8;
|
|
906
|
-
|
|
907
701
|
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
908
|
-
while (1) {
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
_context9.next = 3;
|
|
913
|
-
break;
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
showWarn('请选择要导出的列');
|
|
917
|
-
return _context9.abrupt("return", false);
|
|
918
|
-
|
|
919
|
-
case 3:
|
|
920
|
-
if (param.findUrl) {
|
|
921
|
-
_context9.next = 6;
|
|
922
|
-
break;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
showWarn('请配置业务接口 bizApi 属性');
|
|
926
|
-
return _context9.abrupt("return", false);
|
|
927
|
-
|
|
928
|
-
case 6:
|
|
929
|
-
_context9.prev = 6;
|
|
930
|
-
_context9.next = 9;
|
|
931
|
-
return httpPost(url, param);
|
|
932
|
-
|
|
933
|
-
case 9:
|
|
934
|
-
result = _context9.sent;
|
|
935
|
-
|
|
936
|
-
if (!(result.data && typeof result.data === 'string')) {
|
|
937
|
-
_context9.next = 13;
|
|
938
|
-
break;
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
window.open(result.data);
|
|
942
|
-
return _context9.abrupt("return", true);
|
|
943
|
-
|
|
944
|
-
case 13:
|
|
945
|
-
if (!(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retCode) === '0')) {
|
|
946
|
-
_context9.next = 18;
|
|
947
|
-
break;
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
showSuccess(((_result$flag7 = result.flag) === null || _result$flag7 === void 0 ? void 0 : _result$flag7.retMsg) || '导出成功');
|
|
951
|
-
return _context9.abrupt("return", true);
|
|
952
|
-
|
|
953
|
-
case 18:
|
|
954
|
-
showError(((_result$flag8 = result.flag) === null || _result$flag8 === void 0 ? void 0 : _result$flag8.retMsg) || '导出失败,请联系系统管理员');
|
|
955
|
-
return _context9.abrupt("return", false);
|
|
956
|
-
|
|
957
|
-
case 20:
|
|
958
|
-
_context9.next = 27;
|
|
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;
|
|
959
706
|
break;
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
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();
|
|
972
750
|
}
|
|
973
751
|
}, _callee9, null, [[6, 22]]);
|
|
974
752
|
}));
|
|
975
|
-
|
|
976
753
|
return function onExportDtl(_x6, _x7) {
|
|
977
754
|
return _ref9.apply(this, arguments);
|
|
978
755
|
};
|
|
979
756
|
}();
|
|
980
757
|
/** 审核按钮事件 */
|
|
981
|
-
|
|
982
|
-
|
|
983
758
|
var onAudit = /*#__PURE__*/function () {
|
|
984
759
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
985
760
|
var obj, _result$flag9, result;
|
|
986
|
-
|
|
987
761
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
988
|
-
while (1) {
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
_context10.next = 3;
|
|
993
|
-
break;
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
showWarn('当前数据已审核,不能再做审核操作!');
|
|
997
|
-
return _context10.abrupt("return");
|
|
998
|
-
|
|
999
|
-
case 3:
|
|
1000
|
-
obj = _objectSpread({}, masterObject);
|
|
1001
|
-
|
|
1002
|
-
if (masterObject[mstKeyField]) {
|
|
1003
|
-
_context10.next = 7;
|
|
1004
|
-
break;
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
showWarn('当前数据未保存,不能审核');
|
|
1008
|
-
return _context10.abrupt("return");
|
|
1009
|
-
|
|
1010
|
-
case 7:
|
|
1011
|
-
_context10.prev = 7;
|
|
1012
|
-
_context10.next = 10;
|
|
1013
|
-
return showConfirm('确认要审核此数据?', '审核提示');
|
|
1014
|
-
|
|
1015
|
-
case 10:
|
|
1016
|
-
_context10.next = 16;
|
|
762
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
763
|
+
case 0:
|
|
764
|
+
if (!isAudit()) {
|
|
765
|
+
_context10.next = 3;
|
|
1017
766
|
break;
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
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
|
-
_context10.t3 = afterAudit;
|
|
1056
|
-
|
|
1057
|
-
if (!_context10.t3) {
|
|
1058
|
-
_context10.next = 34;
|
|
1059
|
-
break;
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
_context10.next = 32;
|
|
1063
|
-
return afterAudit(result, [obj]);
|
|
1064
|
-
|
|
1065
|
-
case 32:
|
|
1066
|
-
_context10.t4 = _context10.sent;
|
|
1067
|
-
_context10.t3 = _context10.t4 === false;
|
|
1068
|
-
|
|
1069
|
-
case 34:
|
|
1070
|
-
if (!_context10.t3) {
|
|
1071
|
-
_context10.next = 36;
|
|
1072
|
-
break;
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
return _context10.abrupt("return");
|
|
1076
|
-
|
|
1077
|
-
case 36:
|
|
1078
|
-
if ((result === null || result === void 0 ? void 0 : (_result$flag9 = result.flag) === null || _result$flag9 === void 0 ? void 0 : _result$flag9.retCode) === '0') {
|
|
1079
|
-
showSuccess(result.flag.retMsg || '审核成功');
|
|
1080
|
-
Object.assign(masterObject, result.data);
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
_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;
|
|
1084
804
|
break;
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
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();
|
|
1095
843
|
}
|
|
1096
844
|
}, _callee10, null, [[7, 12], [24, 39]]);
|
|
1097
845
|
}));
|
|
1098
|
-
|
|
1099
846
|
return function onAudit() {
|
|
1100
847
|
return _ref10.apply(this, arguments);
|
|
1101
848
|
};
|
|
1102
849
|
}();
|
|
1103
|
-
|
|
1104
850
|
var btnDisabled = function btnDisabled(key) {
|
|
1105
851
|
if (btnStatus && typeof btnStatus(key) === 'boolean') return btnStatus(key);
|
|
1106
|
-
|
|
1107
852
|
switch (key) {
|
|
1108
853
|
case 'edit':
|
|
1109
854
|
return selectedRows.length !== 1;
|
|
1110
|
-
|
|
1111
855
|
case 'remove':
|
|
1112
856
|
return selectedRows.length === 0 || isAudit();
|
|
1113
|
-
|
|
1114
857
|
default:
|
|
1115
858
|
return false;
|
|
1116
859
|
}
|
|
1117
860
|
};
|
|
1118
|
-
|
|
1119
861
|
var onExport = function onExport() {
|
|
1120
862
|
var _tableRef$current4, _tableRef$current4$sh;
|
|
1121
|
-
|
|
1122
863
|
if (!masterObject[mstKeyField]) {
|
|
1123
864
|
showWarn('主表没保存,无法导出数据');
|
|
1124
865
|
return;
|
|
1125
866
|
}
|
|
1126
|
-
|
|
1127
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);
|
|
1128
868
|
};
|
|
1129
|
-
|
|
1130
869
|
var onImport = function onImport() {
|
|
1131
870
|
var _tableRef$current5, _tableRef$current5$sh;
|
|
1132
|
-
|
|
1133
871
|
if (!masterObject[mstKeyField]) {
|
|
1134
872
|
showWarn('主表没保存,无法导入数据');
|
|
1135
873
|
return;
|
|
1136
874
|
}
|
|
1137
|
-
|
|
1138
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);
|
|
1139
876
|
};
|
|
1140
|
-
|
|
1141
877
|
var tableTools = useMemo(function () {
|
|
1142
878
|
return [(toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.add) && !isAudit() && canAdd ? /*#__PURE__*/React.createElement(_Button, {
|
|
1143
879
|
key: "add",
|
|
@@ -1203,6 +939,5 @@ function useDtl(dtlParam) {
|
|
|
1203
939
|
onAudit: onAudit
|
|
1204
940
|
};
|
|
1205
941
|
}
|
|
1206
|
-
|
|
1207
942
|
;
|
|
1208
943
|
export default useDtl;
|