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