ls-pro-common 3.0.13 → 3.0.15
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/CHANGELOG.md +746 -0
- package/es/components/404.d.ts +3 -0
- package/es/components/404.jpg +0 -0
- package/es/components/404.js +9 -0
- package/es/components/AreaCascader.d.ts +4 -0
- package/es/components/AreaCascader.js +76 -0
- package/es/components/AreaCascaderPanel.d.ts +5 -0
- package/es/components/AreaCascaderPanel.js +230 -0
- package/es/components/DescritionCard.d.ts +11 -0
- package/es/components/DescritionCard.js +79 -0
- package/es/components/DtlLayout.d.ts +44 -0
- package/es/components/DtlLayout.js +116 -0
- package/es/components/GroupTip.d.ts +10 -0
- package/es/components/GroupTip.js +31 -0
- package/es/components/IconBack.d.ts +3 -0
- package/es/components/IconBack.js +20 -0
- package/es/components/IconBell.d.ts +3 -0
- package/es/components/IconBell.js +22 -0
- package/es/components/IconQuestion.d.ts +3 -0
- package/es/components/IconQuestion.js +26 -0
- package/es/components/IconSearch.d.ts +3 -0
- package/es/components/IconSearch.js +22 -0
- package/es/components/IconSelector.d.ts +14 -0
- package/es/components/IconSelector.js +222 -0
- package/es/components/IconText.d.ts +3 -0
- package/es/components/IconText.js +30 -0
- package/es/components/ImageSelector.d.ts +31 -0
- package/es/components/ImageSelector.js +437 -0
- package/es/components/InputMultiLine.d.ts +46 -0
- package/es/components/InputMultiLine.js +139 -0
- package/es/components/InputTable.d.ts +106 -0
- package/es/components/InputTable.js +473 -0
- package/es/components/Loading.d.ts +8 -0
- package/es/components/Loading.js +20 -0
- package/es/components/Permission.d.ts +6 -0
- package/es/components/Permission.js +13 -0
- package/es/components/antd-custom.less +356 -0
- package/es/components/common.less +474 -0
- package/es/hooks/useDtl/index.d.ts +47 -0
- package/es/hooks/useDtl/index.js +949 -0
- package/es/hooks/useGetState.d.ts +1 -0
- package/es/hooks/useGetState.js +17 -0
- package/es/hooks/usePermission/index.d.ts +15 -0
- package/es/hooks/usePermission/index.js +58 -0
- package/es/hooks/useSingle/index.d.ts +54 -0
- package/es/hooks/useSingle/index.js +662 -0
- package/es/http/index.d.ts +53 -0
- package/es/http/index.js +309 -0
- package/es/index.d.ts +32 -0
- package/es/index.js +26 -0
- package/es/service/BaseService.d.ts +24 -0
- package/es/service/BaseService.js +214 -0
- package/es/typing.d.ts +53 -0
- package/es/typing.js +1 -0
- package/es/utils/index.d.ts +258 -0
- package/es/utils/index.js +682 -0
- package/lib/components/404.d.ts +3 -0
- package/lib/components/404.jpg +0 -0
- package/lib/components/404.js +17 -0
- package/lib/components/AreaCascader.d.ts +4 -0
- package/lib/components/AreaCascader.js +85 -0
- package/lib/components/AreaCascaderPanel.d.ts +5 -0
- package/lib/components/AreaCascaderPanel.js +239 -0
- package/lib/components/DescritionCard.d.ts +11 -0
- package/lib/components/DescritionCard.js +88 -0
- package/lib/components/DtlLayout.d.ts +44 -0
- package/lib/components/DtlLayout.js +125 -0
- package/lib/components/GroupTip.d.ts +10 -0
- package/lib/components/GroupTip.js +39 -0
- package/lib/components/IconBack.d.ts +3 -0
- package/lib/components/IconBack.js +28 -0
- package/lib/components/IconBell.d.ts +3 -0
- package/lib/components/IconBell.js +30 -0
- package/lib/components/IconQuestion.d.ts +3 -0
- package/lib/components/IconQuestion.js +34 -0
- package/lib/components/IconSearch.d.ts +3 -0
- package/lib/components/IconSearch.js +30 -0
- package/lib/components/IconSelector.d.ts +14 -0
- package/lib/components/IconSelector.js +230 -0
- package/lib/components/IconText.d.ts +3 -0
- package/lib/components/IconText.js +38 -0
- package/lib/components/ImageSelector.d.ts +31 -0
- package/lib/components/ImageSelector.js +445 -0
- package/lib/components/InputMultiLine.d.ts +46 -0
- package/lib/components/InputMultiLine.js +148 -0
- package/lib/components/InputTable.d.ts +106 -0
- package/lib/components/InputTable.js +482 -0
- package/lib/components/Loading.d.ts +8 -0
- package/lib/components/Loading.js +28 -0
- package/lib/components/Permission.d.ts +6 -0
- package/lib/components/Permission.js +21 -0
- package/lib/components/antd-custom.less +356 -0
- package/lib/components/common.less +474 -0
- package/lib/hooks/useDtl/index.d.ts +47 -0
- package/lib/hooks/useDtl/index.js +957 -0
- package/lib/hooks/useGetState.d.ts +1 -0
- package/lib/hooks/useGetState.js +24 -0
- package/lib/hooks/usePermission/index.d.ts +15 -0
- package/lib/hooks/usePermission/index.js +65 -0
- package/lib/hooks/useSingle/index.d.ts +54 -0
- package/lib/hooks/useSingle/index.js +670 -0
- package/lib/http/index.d.ts +53 -0
- package/lib/http/index.js +323 -0
- package/lib/index.d.ts +32 -0
- package/lib/service/BaseService.d.ts +24 -0
- package/lib/service/BaseService.js +222 -0
- package/lib/typing.d.ts +53 -0
- package/lib/typing.js +5 -0
- package/lib/utils/index.d.ts +258 -0
- package/lib/utils/index.js +779 -0
- package/package.json +5 -13
|
@@ -0,0 +1,949 @@
|
|
|
1
|
+
import "antd/es/button/style";
|
|
2
|
+
import _Button from "antd/es/button";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
6
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
7
|
+
var _excluded = ["current", "pageSize", "sumProperties"];
|
|
8
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
|
+
import React from "react";
|
|
10
|
+
import { useState, useRef, useCallback, useMemo } from 'react';
|
|
11
|
+
import { PlusCircleOutlined, EditOutlined, DeleteOutlined, ImportOutlined, ExportOutlined } from '@ant-design/icons';
|
|
12
|
+
import { showConfirm, showWarn, showError, showSuccess } from '../../utils';
|
|
13
|
+
import { httpPost } from '../../http';
|
|
14
|
+
import usePermission from '../usePermission';
|
|
15
|
+
function useDtl(dtlParam) {
|
|
16
|
+
var mstService = dtlParam.service,
|
|
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$ifHistory = dtlParam.ifHistory,
|
|
37
|
+
ifHistory = _dtlParam$ifHistory === void 0 ? 0 : _dtlParam$ifHistory;
|
|
38
|
+
var _usePermission = usePermission(),
|
|
39
|
+
canAdd = _usePermission.canAdd,
|
|
40
|
+
canEdit = _usePermission.canEdit,
|
|
41
|
+
canDelete = _usePermission.canDelete,
|
|
42
|
+
canImport = _usePermission.canImport,
|
|
43
|
+
canExport = _usePermission.canExport;
|
|
44
|
+
/** @name 选中行数据 */
|
|
45
|
+
var _useState = useState([]),
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
selectedRows = _useState2[0],
|
|
48
|
+
setSelectedRows = _useState2[1];
|
|
49
|
+
/** @name 显示新增编辑框 */
|
|
50
|
+
var _useState3 = useState(false),
|
|
51
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
52
|
+
showEdit = _useState4[0],
|
|
53
|
+
setShowEdit = _useState4[1];
|
|
54
|
+
/** @name 新增或编辑对象初始值 */
|
|
55
|
+
var _useState5 = useState(dtlItem),
|
|
56
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
57
|
+
editItem = _useState6[0],
|
|
58
|
+
setEditItem = _useState6[1];
|
|
59
|
+
/** @name 从表表格Ref */
|
|
60
|
+
var tableRef = useRef();
|
|
61
|
+
/** @name 主表表单Ref */
|
|
62
|
+
var formRef = useRef();
|
|
63
|
+
/** @name 从表编辑表单Ref */
|
|
64
|
+
var dtlFormRef = useRef();
|
|
65
|
+
/**@name 判断是否已审核 */
|
|
66
|
+
var isAudit = useCallback(function () {
|
|
67
|
+
if (!auditStatus || !statusField) return false;
|
|
68
|
+
return Number(masterObject[statusField] || 0) >= auditStatus;
|
|
69
|
+
}, [auditStatus, statusField, masterObject]);
|
|
70
|
+
/** @name 保存主表 */
|
|
71
|
+
var onSaveMst = /*#__PURE__*/function () {
|
|
72
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values) {
|
|
73
|
+
var _result$flag;
|
|
74
|
+
var data, result;
|
|
75
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
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();
|
|
137
|
+
}
|
|
138
|
+
}, _callee);
|
|
139
|
+
}));
|
|
140
|
+
return function onSaveMst(_x) {
|
|
141
|
+
return _ref.apply(this, arguments);
|
|
142
|
+
};
|
|
143
|
+
}();
|
|
144
|
+
/** @name 主从一起保存 */
|
|
145
|
+
var onSaveMstDtl = /*#__PURE__*/function () {
|
|
146
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
147
|
+
var _formRef$current, _formRef$current$getF, _tableRef$current, _tableRef$current$get, _tableRef$current2, _tableRef$current2$ge, _result$flag2;
|
|
148
|
+
var isDelete,
|
|
149
|
+
values,
|
|
150
|
+
mst,
|
|
151
|
+
dtlEditData,
|
|
152
|
+
dtlData,
|
|
153
|
+
param,
|
|
154
|
+
result,
|
|
155
|
+
_args2 = arguments;
|
|
156
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
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,
|
|
193
|
+
updateRows: [],
|
|
194
|
+
deleteRows: []
|
|
195
|
+
};
|
|
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: []
|
|
204
|
+
};
|
|
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();
|
|
257
|
+
}
|
|
258
|
+
}, _callee2);
|
|
259
|
+
}));
|
|
260
|
+
return function onSaveMstDtl() {
|
|
261
|
+
return _ref2.apply(this, arguments);
|
|
262
|
+
};
|
|
263
|
+
}();
|
|
264
|
+
/** 删除按钮事件 */
|
|
265
|
+
var onRemoveMst = /*#__PURE__*/function () {
|
|
266
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
267
|
+
var _result$flag3;
|
|
268
|
+
var ids, result;
|
|
269
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
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();
|
|
337
|
+
}
|
|
338
|
+
}, _callee3);
|
|
339
|
+
}));
|
|
340
|
+
return function onRemoveMst() {
|
|
341
|
+
return _ref3.apply(this, arguments);
|
|
342
|
+
};
|
|
343
|
+
}();
|
|
344
|
+
/** 新增按钮事件 */
|
|
345
|
+
var onAddDtl = /*#__PURE__*/function () {
|
|
346
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
347
|
+
var item,
|
|
348
|
+
_formRef$current2,
|
|
349
|
+
mstVal,
|
|
350
|
+
mst,
|
|
351
|
+
_args4 = arguments;
|
|
352
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
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)) {
|
|
357
|
+
_context4.next = 16;
|
|
358
|
+
break;
|
|
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();
|
|
405
|
+
}
|
|
406
|
+
}, _callee4, null, [[2, 13]]);
|
|
407
|
+
}));
|
|
408
|
+
return function onAddDtl() {
|
|
409
|
+
return _ref4.apply(this, arguments);
|
|
410
|
+
};
|
|
411
|
+
}();
|
|
412
|
+
/** 编辑按钮事件 */
|
|
413
|
+
var onEditDtl = /*#__PURE__*/function () {
|
|
414
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
415
|
+
var item,
|
|
416
|
+
_args5 = arguments;
|
|
417
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
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();
|
|
451
|
+
}
|
|
452
|
+
}, _callee5);
|
|
453
|
+
}));
|
|
454
|
+
return function onEditDtl() {
|
|
455
|
+
return _ref5.apply(this, arguments);
|
|
456
|
+
};
|
|
457
|
+
}();
|
|
458
|
+
/** 删除按钮事件 */
|
|
459
|
+
var onRemoveDtl = function onRemoveDtl() {
|
|
460
|
+
var rows = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : selectedRows;
|
|
461
|
+
if (!rows || !rows.length) {
|
|
462
|
+
showWarn('请选择需要删除的数据');
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
showConfirm('确认要删除选择的数据?').then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
466
|
+
var _result$flag4;
|
|
467
|
+
var ids, result;
|
|
468
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
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);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
case 19:
|
|
518
|
+
case "end":
|
|
519
|
+
return _context6.stop();
|
|
520
|
+
}
|
|
521
|
+
}, _callee6);
|
|
522
|
+
})));
|
|
523
|
+
};
|
|
524
|
+
/** 新增,更改对应的保存事件 */
|
|
525
|
+
var onSaveDtl = /*#__PURE__*/function () {
|
|
526
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(formData) {
|
|
527
|
+
var _result$flag5;
|
|
528
|
+
var data, result;
|
|
529
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
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();
|
|
588
|
+
}
|
|
589
|
+
}, _callee7);
|
|
590
|
+
}));
|
|
591
|
+
return function onSaveDtl(_x2) {
|
|
592
|
+
return _ref7.apply(this, arguments);
|
|
593
|
+
};
|
|
594
|
+
}();
|
|
595
|
+
/** 加载数据方法 */
|
|
596
|
+
var onLoadDtl = /*#__PURE__*/function () {
|
|
597
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(params, sort, filter) {
|
|
598
|
+
var _tableRef$current3, _tableRef$current3$cl;
|
|
599
|
+
var current, pageSize, sumProperties, rest, param, key, sortArr, _key, _key2, result;
|
|
600
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
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];
|
|
633
|
+
}
|
|
634
|
+
}
|
|
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 (ifHistory === 1) {
|
|
652
|
+
param.ifHistory = 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();
|
|
690
|
+
}
|
|
691
|
+
}, _callee8);
|
|
692
|
+
}));
|
|
693
|
+
return function onLoadDtl(_x3, _x4, _x5) {
|
|
694
|
+
return _ref8.apply(this, arguments);
|
|
695
|
+
};
|
|
696
|
+
}();
|
|
697
|
+
var onExportDtl = /*#__PURE__*/function () {
|
|
698
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(url, param) {
|
|
699
|
+
var _param$exportColumns, _param$searchData;
|
|
700
|
+
var searchArr, _result$flag6, result, _result$flag7, _result$flag8;
|
|
701
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
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;
|
|
706
|
+
break;
|
|
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
|
+
// 处理导出历史数据传参
|
|
719
|
+
if (ifHistory && !param.searchData || !((_param$searchData = param.searchData) === null || _param$searchData === void 0 ? void 0 : _param$searchData.includes('ifHistory=1'))) {
|
|
720
|
+
searchArr = (param.searchData || '').split('&');
|
|
721
|
+
searchArr.push('ifHistory=1');
|
|
722
|
+
param.searchData = searchArr.join('&');
|
|
723
|
+
}
|
|
724
|
+
_context9.prev = 7;
|
|
725
|
+
_context9.next = 10;
|
|
726
|
+
return httpPost(url, param);
|
|
727
|
+
case 10:
|
|
728
|
+
result = _context9.sent;
|
|
729
|
+
if (!(result.data && typeof result.data === 'string')) {
|
|
730
|
+
_context9.next = 14;
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
733
|
+
window.open(result.data);
|
|
734
|
+
return _context9.abrupt("return", true);
|
|
735
|
+
case 14:
|
|
736
|
+
if (!(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retCode) === '0')) {
|
|
737
|
+
_context9.next = 19;
|
|
738
|
+
break;
|
|
739
|
+
}
|
|
740
|
+
showSuccess(((_result$flag7 = result.flag) === null || _result$flag7 === void 0 ? void 0 : _result$flag7.retMsg) || '导出成功');
|
|
741
|
+
return _context9.abrupt("return", true);
|
|
742
|
+
case 19:
|
|
743
|
+
showError(((_result$flag8 = result.flag) === null || _result$flag8 === void 0 ? void 0 : _result$flag8.retMsg) || '导出失败,请联系系统管理员');
|
|
744
|
+
return _context9.abrupt("return", false);
|
|
745
|
+
case 21:
|
|
746
|
+
_context9.next = 27;
|
|
747
|
+
break;
|
|
748
|
+
case 23:
|
|
749
|
+
_context9.prev = 23;
|
|
750
|
+
_context9.t0 = _context9["catch"](7);
|
|
751
|
+
showError(_context9.t0.message);
|
|
752
|
+
return _context9.abrupt("return", false);
|
|
753
|
+
case 27:
|
|
754
|
+
case "end":
|
|
755
|
+
return _context9.stop();
|
|
756
|
+
}
|
|
757
|
+
}, _callee9, null, [[7, 23]]);
|
|
758
|
+
}));
|
|
759
|
+
return function onExportDtl(_x6, _x7) {
|
|
760
|
+
return _ref9.apply(this, arguments);
|
|
761
|
+
};
|
|
762
|
+
}();
|
|
763
|
+
/** 审核按钮事件 */
|
|
764
|
+
var onAudit = /*#__PURE__*/function () {
|
|
765
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
766
|
+
var obj, _result$flag9, result;
|
|
767
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
768
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
769
|
+
case 0:
|
|
770
|
+
if (!isAudit()) {
|
|
771
|
+
_context10.next = 3;
|
|
772
|
+
break;
|
|
773
|
+
}
|
|
774
|
+
showWarn('当前数据已审核,不能再做审核操作!');
|
|
775
|
+
return _context10.abrupt("return");
|
|
776
|
+
case 3:
|
|
777
|
+
obj = _objectSpread({}, masterObject);
|
|
778
|
+
if (masterObject[mstKeyField]) {
|
|
779
|
+
_context10.next = 7;
|
|
780
|
+
break;
|
|
781
|
+
}
|
|
782
|
+
showWarn('当前数据未保存,不能审核');
|
|
783
|
+
return _context10.abrupt("return");
|
|
784
|
+
case 7:
|
|
785
|
+
_context10.prev = 7;
|
|
786
|
+
_context10.next = 10;
|
|
787
|
+
return showConfirm('确认要审核此数据?', '审核提示');
|
|
788
|
+
case 10:
|
|
789
|
+
_context10.next = 16;
|
|
790
|
+
break;
|
|
791
|
+
case 12:
|
|
792
|
+
_context10.prev = 12;
|
|
793
|
+
_context10.t0 = _context10["catch"](7);
|
|
794
|
+
console.log('终止审核', _context10.t0);
|
|
795
|
+
return _context10.abrupt("return");
|
|
796
|
+
case 16:
|
|
797
|
+
_context10.t1 = beforeAudit;
|
|
798
|
+
if (!_context10.t1) {
|
|
799
|
+
_context10.next = 22;
|
|
800
|
+
break;
|
|
801
|
+
}
|
|
802
|
+
_context10.next = 20;
|
|
803
|
+
return beforeAudit(obj);
|
|
804
|
+
case 20:
|
|
805
|
+
_context10.t2 = _context10.sent;
|
|
806
|
+
_context10.t1 = _context10.t2 === false;
|
|
807
|
+
case 22:
|
|
808
|
+
if (!_context10.t1) {
|
|
809
|
+
_context10.next = 24;
|
|
810
|
+
break;
|
|
811
|
+
}
|
|
812
|
+
return _context10.abrupt("return");
|
|
813
|
+
case 24:
|
|
814
|
+
_context10.prev = 24;
|
|
815
|
+
_context10.next = 27;
|
|
816
|
+
return mstService.audit([obj]);
|
|
817
|
+
case 27:
|
|
818
|
+
result = _context10.sent;
|
|
819
|
+
_context10.t3 = afterAudit;
|
|
820
|
+
if (!_context10.t3) {
|
|
821
|
+
_context10.next = 34;
|
|
822
|
+
break;
|
|
823
|
+
}
|
|
824
|
+
_context10.next = 32;
|
|
825
|
+
return afterAudit(result, [obj]);
|
|
826
|
+
case 32:
|
|
827
|
+
_context10.t4 = _context10.sent;
|
|
828
|
+
_context10.t3 = _context10.t4 === false;
|
|
829
|
+
case 34:
|
|
830
|
+
if (!_context10.t3) {
|
|
831
|
+
_context10.next = 36;
|
|
832
|
+
break;
|
|
833
|
+
}
|
|
834
|
+
return _context10.abrupt("return");
|
|
835
|
+
case 36:
|
|
836
|
+
if ((result === null || result === void 0 ? void 0 : (_result$flag9 = result.flag) === null || _result$flag9 === void 0 ? void 0 : _result$flag9.retCode) === '0') {
|
|
837
|
+
showSuccess(result.flag.retMsg || '审核成功');
|
|
838
|
+
Object.assign(masterObject, result.data);
|
|
839
|
+
}
|
|
840
|
+
_context10.next = 42;
|
|
841
|
+
break;
|
|
842
|
+
case 39:
|
|
843
|
+
_context10.prev = 39;
|
|
844
|
+
_context10.t5 = _context10["catch"](24);
|
|
845
|
+
console.log('审核异常', _context10.t5);
|
|
846
|
+
case 42:
|
|
847
|
+
case "end":
|
|
848
|
+
return _context10.stop();
|
|
849
|
+
}
|
|
850
|
+
}, _callee10, null, [[7, 12], [24, 39]]);
|
|
851
|
+
}));
|
|
852
|
+
return function onAudit() {
|
|
853
|
+
return _ref10.apply(this, arguments);
|
|
854
|
+
};
|
|
855
|
+
}();
|
|
856
|
+
var btnDisabled = function btnDisabled(key) {
|
|
857
|
+
if (btnStatus && typeof btnStatus(key) === 'boolean') return btnStatus(key);
|
|
858
|
+
switch (key) {
|
|
859
|
+
case 'edit':
|
|
860
|
+
return selectedRows.length !== 1;
|
|
861
|
+
case 'remove':
|
|
862
|
+
return selectedRows.length === 0 || isAudit();
|
|
863
|
+
default:
|
|
864
|
+
return false;
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
var onExport = function onExport() {
|
|
868
|
+
var _tableRef$current4, _tableRef$current4$sh;
|
|
869
|
+
if (!masterObject[mstKeyField]) {
|
|
870
|
+
showWarn('主表没保存,无法导出数据');
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
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);
|
|
874
|
+
};
|
|
875
|
+
var onImport = function onImport() {
|
|
876
|
+
var _tableRef$current5, _tableRef$current5$sh;
|
|
877
|
+
if (!masterObject[mstKeyField]) {
|
|
878
|
+
showWarn('主表没保存,无法导入数据');
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
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);
|
|
882
|
+
};
|
|
883
|
+
var tableTools = useMemo(function () {
|
|
884
|
+
return [(toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.add) && !isAudit() && canAdd ? /*#__PURE__*/React.createElement(_Button, {
|
|
885
|
+
key: "add",
|
|
886
|
+
onClick: function onClick() {
|
|
887
|
+
return onAddDtl();
|
|
888
|
+
},
|
|
889
|
+
disabled: btnDisabled('add'),
|
|
890
|
+
icon: /*#__PURE__*/React.createElement(PlusCircleOutlined, null)
|
|
891
|
+
}, "\u65B0\u589E") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.edit) && !isAudit() && (canAdd || canEdit) ? /*#__PURE__*/React.createElement(_Button, {
|
|
892
|
+
key: "edit",
|
|
893
|
+
disabled: btnDisabled('edit'),
|
|
894
|
+
onClick: function onClick() {
|
|
895
|
+
return onEditDtl();
|
|
896
|
+
},
|
|
897
|
+
icon: /*#__PURE__*/React.createElement(EditOutlined, null)
|
|
898
|
+
}, "\u7F16\u8F91") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.remove) && !isAudit() && (canAdd || canEdit || canDelete) ? /*#__PURE__*/React.createElement(_Button, {
|
|
899
|
+
key: "remove",
|
|
900
|
+
onClick: function onClick() {
|
|
901
|
+
return onRemoveDtl();
|
|
902
|
+
},
|
|
903
|
+
danger: true,
|
|
904
|
+
disabled: btnDisabled('remove'),
|
|
905
|
+
icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
|
|
906
|
+
}, "\u5220\u9664") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.import) && !isAudit() && (canAdd || canEdit || canImport) ? /*#__PURE__*/React.createElement(_Button, {
|
|
907
|
+
key: "import",
|
|
908
|
+
onClick: function onClick() {
|
|
909
|
+
onImport();
|
|
910
|
+
},
|
|
911
|
+
disabled: btnDisabled('import'),
|
|
912
|
+
icon: /*#__PURE__*/React.createElement(ImportOutlined, null)
|
|
913
|
+
}, "\u5BFC\u5165") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.export) && canExport ? /*#__PURE__*/React.createElement(_Button, {
|
|
914
|
+
key: "export",
|
|
915
|
+
onClick: function onClick() {
|
|
916
|
+
onExport();
|
|
917
|
+
},
|
|
918
|
+
disabled: btnDisabled('export'),
|
|
919
|
+
icon: /*#__PURE__*/React.createElement(ExportOutlined, null)
|
|
920
|
+
}, "\u5BFC\u51FA") : false].filter(function (o) {
|
|
921
|
+
return o !== false;
|
|
922
|
+
});
|
|
923
|
+
}, [selectedRows, auditStatus, statusField, masterObject]);
|
|
924
|
+
return {
|
|
925
|
+
formRef: formRef,
|
|
926
|
+
tableRef: tableRef,
|
|
927
|
+
dtlFormRef: dtlFormRef,
|
|
928
|
+
selectedRows: selectedRows,
|
|
929
|
+
showEdit: showEdit,
|
|
930
|
+
editItem: editItem,
|
|
931
|
+
tableTools: tableTools,
|
|
932
|
+
setSelectedRows: setSelectedRows,
|
|
933
|
+
setShowEdit: setShowEdit,
|
|
934
|
+
setEditItem: setEditItem,
|
|
935
|
+
onRemoveDtl: onRemoveDtl,
|
|
936
|
+
onSaveDtl: onSaveDtl,
|
|
937
|
+
onLoadDtl: onLoadDtl,
|
|
938
|
+
onAddDtl: onAddDtl,
|
|
939
|
+
onEditDtl: onEditDtl,
|
|
940
|
+
onSaveMst: onSaveMst,
|
|
941
|
+
onSaveMstDtl: onSaveMstDtl,
|
|
942
|
+
onRemoveMst: onRemoveMst,
|
|
943
|
+
onExportDtl: onExportDtl,
|
|
944
|
+
isAudit: isAudit,
|
|
945
|
+
onAudit: onAudit
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
;
|
|
949
|
+
export default useDtl;
|