ls-pro-common 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common.css +138 -1
- package/dist/common.js +1 -1
- package/dist/common.js.LICENSE.txt +5 -3
- package/dist/common.min.css +138 -1
- package/dist/common.min.js +1 -1
- package/dist/common.min.js.LICENSE.txt +5 -3
- package/es/components/AreaCascader.js +35 -48
- package/es/components/AreaCascaderPanel.d.ts +5 -0
- package/es/components/AreaCascaderPanel.js +230 -0
- package/es/components/DescritionCard.js +14 -19
- package/es/components/DtlLayout.js +25 -38
- package/es/components/IconSelector.js +27 -50
- package/es/components/ImageSelector.js +89 -139
- package/es/components/InputMultiLine.js +33 -45
- package/es/components/InputTable.d.ts +2 -0
- package/es/components/InputTable.js +118 -160
- package/es/components/Loading.js +3 -6
- package/es/components/common.less +158 -1
- package/es/hooks/useDtl/index.d.ts +2 -0
- package/es/hooks/useDtl/index.js +676 -941
- package/es/hooks/usePermission/index.js +0 -9
- package/es/hooks/useSingle/index.d.ts +2 -0
- package/es/hooks/useSingle/index.js +440 -599
- package/es/http/index.js +113 -149
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -2
- package/es/service/BaseService.js +121 -195
- package/es/utils/index.js +12 -111
- package/lib/components/404.js +1 -6
- package/lib/components/AreaCascader.js +37 -63
- package/lib/components/AreaCascaderPanel.d.ts +5 -0
- package/lib/components/AreaCascaderPanel.js +239 -0
- package/lib/components/DescritionCard.js +16 -33
- package/lib/components/DtlLayout.js +27 -49
- package/lib/components/IconSelector.js +29 -64
- package/lib/components/ImageSelector.js +91 -162
- package/lib/components/InputMultiLine.js +35 -61
- package/lib/components/InputTable.d.ts +2 -0
- package/lib/components/InputTable.js +120 -185
- package/lib/components/Loading.js +4 -16
- package/lib/components/common.less +158 -1
- package/lib/hooks/useDtl/index.d.ts +2 -0
- package/lib/hooks/useDtl/index.js +677 -957
- package/lib/hooks/usePermission/index.js +0 -12
- package/lib/hooks/useSingle/index.d.ts +2 -0
- package/lib/hooks/useSingle/index.js +441 -614
- package/lib/http/index.js +111 -158
- package/lib/index.d.ts +2 -1
- package/lib/index.js +9 -20
- package/lib/service/BaseService.js +121 -201
- package/lib/utils/index.js +13 -209
- package/package.json +2 -2
|
@@ -1,40 +1,24 @@
|
|
|
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
|
/**
|
|
39
23
|
* 单表基本增删改查 hooks
|
|
40
24
|
* @param service 单表服务
|
|
@@ -45,716 +29,560 @@ var _excluded = ["current", "pageSize", "sumProperties"];
|
|
|
45
29
|
*/
|
|
46
30
|
function useSingle(inParam) {
|
|
47
31
|
var _usePermission = (0, _usePermission2.default)(),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
32
|
+
resourceId = _usePermission.resourceId,
|
|
33
|
+
loginName = _usePermission.loginName,
|
|
34
|
+
checkRight = _usePermission.checkRight,
|
|
35
|
+
canAdd = _usePermission.canAdd,
|
|
36
|
+
canEdit = _usePermission.canEdit,
|
|
37
|
+
canDelete = _usePermission.canDelete,
|
|
38
|
+
canAudit = _usePermission.canAudit,
|
|
39
|
+
canImport = _usePermission.canImport,
|
|
40
|
+
canExport = _usePermission.canExport;
|
|
58
41
|
var service = inParam.service,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
42
|
+
toolConfig = inParam.toolConfig,
|
|
43
|
+
initItem = inParam.initItem,
|
|
44
|
+
statusField = inParam.statusField,
|
|
45
|
+
auditStatus = inParam.auditStatus,
|
|
46
|
+
beforeAudit = inParam.beforeAudit,
|
|
47
|
+
beforeLoad = inParam.beforeLoad,
|
|
48
|
+
beforeRemove = inParam.beforeRemove,
|
|
49
|
+
beforeAdd = inParam.beforeAdd,
|
|
50
|
+
beforeEdit = inParam.beforeEdit,
|
|
51
|
+
beforeSave = inParam.beforeSave,
|
|
52
|
+
afterRemove = inParam.afterRemove,
|
|
53
|
+
afterSave = inParam.afterSave,
|
|
54
|
+
afterAudit = inParam.afterAudit,
|
|
55
|
+
btnStatus = inParam.btnStatus;
|
|
73
56
|
/** @name 选中行数据 */
|
|
74
|
-
|
|
75
57
|
var _useState = (0, _react.useState)([]),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
58
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
59
|
+
selectedRows = _useState2[0],
|
|
60
|
+
setSelectedRows = _useState2[1];
|
|
79
61
|
/** @name 显示新增编辑框 */
|
|
80
|
-
|
|
81
|
-
|
|
82
62
|
var _useState3 = (0, _react.useState)(false),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
63
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
64
|
+
showEdit = _useState4[0],
|
|
65
|
+
setShowEdit = _useState4[1];
|
|
86
66
|
/** @name 新增或编辑对象初始值 */
|
|
87
|
-
|
|
88
|
-
|
|
89
67
|
var _useState5 = (0, _react.useState)(initItem),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
68
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
69
|
+
editItem = _useState6[0],
|
|
70
|
+
setEditItem = _useState6[1];
|
|
93
71
|
/** @name 表格Ref */
|
|
94
|
-
|
|
95
|
-
|
|
96
72
|
var tableRef = (0, _react.useRef)();
|
|
97
73
|
/** @name 查询表单Ref */
|
|
98
|
-
|
|
99
74
|
var formRef = (0, _react.useRef)();
|
|
100
75
|
/**@name 编辑表单Ref */
|
|
101
|
-
|
|
102
76
|
var editFormRef = (0, _react.useRef)();
|
|
77
|
+
/**@name 查看历史数据 */
|
|
78
|
+
var _useState7 = (0, _react.useState)(0),
|
|
79
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
80
|
+
ifHistoryData = _useState8[0],
|
|
81
|
+
setIfHistoryData = _useState8[1];
|
|
82
|
+
/** 判断是否已审核,只有传入审核状态和状态字段才进行判断 */
|
|
83
|
+
var isAudit = (0, _react.useCallback)(function () {
|
|
84
|
+
var row = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
85
|
+
if (!auditStatus || !statusField) return false;
|
|
86
|
+
if (!row && !selectedRows.length) return false;
|
|
87
|
+
if (row) {
|
|
88
|
+
return Number(row[statusField] || 0) >= auditStatus;
|
|
89
|
+
}
|
|
90
|
+
return selectedRows.findIndex(function (o) {
|
|
91
|
+
return Number(o[statusField] || 0) >= auditStatus;
|
|
92
|
+
}) > -1;
|
|
93
|
+
}, [auditStatus, statusField, selectedRows]);
|
|
103
94
|
/** 新增按钮事件 */
|
|
104
|
-
|
|
105
95
|
var onAdd = /*#__PURE__*/function () {
|
|
106
96
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(item) {
|
|
107
97
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
108
|
-
while (1) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
_context.
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return _context.abrupt("return");
|
|
136
|
-
|
|
137
|
-
case 9:
|
|
138
|
-
setEditItem(item);
|
|
139
|
-
setShowEdit(true);
|
|
140
|
-
|
|
141
|
-
case 11:
|
|
142
|
-
case "end":
|
|
143
|
-
return _context.stop();
|
|
144
|
-
}
|
|
98
|
+
while (1) switch (_context.prev = _context.next) {
|
|
99
|
+
case 0:
|
|
100
|
+
if (!item) {
|
|
101
|
+
item = (0, _objectSpread2.default)({}, initItem);
|
|
102
|
+
}
|
|
103
|
+
_context.t0 = beforeAdd;
|
|
104
|
+
if (!_context.t0) {
|
|
105
|
+
_context.next = 7;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
_context.next = 5;
|
|
109
|
+
return beforeAdd(item);
|
|
110
|
+
case 5:
|
|
111
|
+
_context.t1 = _context.sent;
|
|
112
|
+
_context.t0 = _context.t1 === false;
|
|
113
|
+
case 7:
|
|
114
|
+
if (!_context.t0) {
|
|
115
|
+
_context.next = 9;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
return _context.abrupt("return");
|
|
119
|
+
case 9:
|
|
120
|
+
setEditItem(item);
|
|
121
|
+
setShowEdit(true);
|
|
122
|
+
case 11:
|
|
123
|
+
case "end":
|
|
124
|
+
return _context.stop();
|
|
145
125
|
}
|
|
146
126
|
}, _callee);
|
|
147
127
|
}));
|
|
148
|
-
|
|
149
128
|
return function onAdd(_x) {
|
|
150
129
|
return _ref.apply(this, arguments);
|
|
151
130
|
};
|
|
152
131
|
}();
|
|
153
132
|
/** 编辑按钮事件 */
|
|
154
|
-
|
|
155
|
-
|
|
156
133
|
var onEdit = /*#__PURE__*/function () {
|
|
157
134
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(item) {
|
|
158
135
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
159
|
-
while (1) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return _context2.abrupt("return");
|
|
196
|
-
|
|
197
|
-
case 12:
|
|
198
|
-
setEditItem(item);
|
|
199
|
-
setShowEdit(true);
|
|
200
|
-
|
|
201
|
-
case 14:
|
|
202
|
-
case "end":
|
|
203
|
-
return _context2.stop();
|
|
204
|
-
}
|
|
136
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
137
|
+
case 0:
|
|
138
|
+
if (!(!item && !selectedRows.length)) {
|
|
139
|
+
_context2.next = 3;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
(0, _utils.showWarn)('请先选择需要更改的数据');
|
|
143
|
+
return _context2.abrupt("return");
|
|
144
|
+
case 3:
|
|
145
|
+
if (!item) {
|
|
146
|
+
item = (0, _objectSpread2.default)({}, selectedRows[0]);
|
|
147
|
+
}
|
|
148
|
+
_context2.t0 = beforeEdit;
|
|
149
|
+
if (!_context2.t0) {
|
|
150
|
+
_context2.next = 10;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
_context2.next = 8;
|
|
154
|
+
return beforeEdit(item);
|
|
155
|
+
case 8:
|
|
156
|
+
_context2.t1 = _context2.sent;
|
|
157
|
+
_context2.t0 = _context2.t1 === false;
|
|
158
|
+
case 10:
|
|
159
|
+
if (!_context2.t0) {
|
|
160
|
+
_context2.next = 12;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
return _context2.abrupt("return");
|
|
164
|
+
case 12:
|
|
165
|
+
setEditItem(item);
|
|
166
|
+
setShowEdit(true);
|
|
167
|
+
case 14:
|
|
168
|
+
case "end":
|
|
169
|
+
return _context2.stop();
|
|
205
170
|
}
|
|
206
171
|
}, _callee2);
|
|
207
172
|
}));
|
|
208
|
-
|
|
209
173
|
return function onEdit(_x2) {
|
|
210
174
|
return _ref2.apply(this, arguments);
|
|
211
175
|
};
|
|
212
176
|
}();
|
|
213
177
|
/** 删除按钮事件 */
|
|
214
|
-
|
|
215
|
-
|
|
216
178
|
var onRemove = function onRemove(row) {
|
|
217
179
|
if (!row && !selectedRows.length) {
|
|
218
180
|
(0, _utils.showWarn)('请选择需要删除的数据');
|
|
219
181
|
return;
|
|
220
182
|
}
|
|
221
|
-
|
|
222
183
|
if (isAudit(row)) {
|
|
223
184
|
(0, _utils.showWarn)('选择中数据中有已审核,不能删除!');
|
|
224
185
|
return;
|
|
225
186
|
}
|
|
226
|
-
|
|
227
187
|
(0, _utils.showConfirm)('确认要删除选择的数据?').then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
228
188
|
var rows, ids, _result$flag, result;
|
|
229
|
-
|
|
230
189
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
231
|
-
while (1) {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
if (!beforeRemove) {
|
|
237
|
-
_context3.next = 7;
|
|
238
|
-
break;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
_context3.next = 4;
|
|
242
|
-
return beforeRemove(rows);
|
|
243
|
-
|
|
244
|
-
case 4:
|
|
245
|
-
ids = _context3.sent;
|
|
246
|
-
|
|
247
|
-
if (!(ids === false)) {
|
|
248
|
-
_context3.next = 7;
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
return _context3.abrupt("return");
|
|
253
|
-
|
|
254
|
-
case 7:
|
|
255
|
-
if (!ids) {
|
|
256
|
-
ids = rows.map(function (o) {
|
|
257
|
-
return o.id;
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
_context3.prev = 8;
|
|
262
|
-
_context3.next = 11;
|
|
263
|
-
return service.remove(ids);
|
|
264
|
-
|
|
265
|
-
case 11:
|
|
266
|
-
result = _context3.sent;
|
|
267
|
-
_context3.t0 = afterRemove;
|
|
268
|
-
|
|
269
|
-
if (!_context3.t0) {
|
|
270
|
-
_context3.next = 18;
|
|
271
|
-
break;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
_context3.next = 16;
|
|
275
|
-
return afterRemove(result, rows);
|
|
276
|
-
|
|
277
|
-
case 16:
|
|
278
|
-
_context3.t1 = _context3.sent;
|
|
279
|
-
_context3.t0 = _context3.t1 === false;
|
|
280
|
-
|
|
281
|
-
case 18:
|
|
282
|
-
if (!_context3.t0) {
|
|
283
|
-
_context3.next = 20;
|
|
284
|
-
break;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
return _context3.abrupt("return");
|
|
288
|
-
|
|
289
|
-
case 20:
|
|
290
|
-
if ((result === null || result === void 0 ? void 0 : (_result$flag = result.flag) === null || _result$flag === void 0 ? void 0 : _result$flag.retCode) === '0') {
|
|
291
|
-
(0, _utils.showSuccess)(result.flag.retMsg || '删除成功');
|
|
292
|
-
|
|
293
|
-
if (tableRef.current) {
|
|
294
|
-
tableRef.current.reload(false);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
_context3.next = 26;
|
|
190
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
191
|
+
case 0:
|
|
192
|
+
rows = row ? [row] : selectedRows;
|
|
193
|
+
if (!beforeRemove) {
|
|
194
|
+
_context3.next = 7;
|
|
299
195
|
break;
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
196
|
+
}
|
|
197
|
+
_context3.next = 4;
|
|
198
|
+
return beforeRemove(rows);
|
|
199
|
+
case 4:
|
|
200
|
+
ids = _context3.sent;
|
|
201
|
+
if (!(ids === false)) {
|
|
202
|
+
_context3.next = 7;
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
return _context3.abrupt("return");
|
|
206
|
+
case 7:
|
|
207
|
+
if (!ids) {
|
|
208
|
+
ids = rows.map(function (o) {
|
|
209
|
+
return o.id;
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
_context3.prev = 8;
|
|
213
|
+
_context3.next = 11;
|
|
214
|
+
return service.remove(ids);
|
|
215
|
+
case 11:
|
|
216
|
+
result = _context3.sent;
|
|
217
|
+
_context3.t0 = afterRemove;
|
|
218
|
+
if (!_context3.t0) {
|
|
219
|
+
_context3.next = 18;
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
_context3.next = 16;
|
|
223
|
+
return afterRemove(result, rows);
|
|
224
|
+
case 16:
|
|
225
|
+
_context3.t1 = _context3.sent;
|
|
226
|
+
_context3.t0 = _context3.t1 === false;
|
|
227
|
+
case 18:
|
|
228
|
+
if (!_context3.t0) {
|
|
229
|
+
_context3.next = 20;
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
return _context3.abrupt("return");
|
|
233
|
+
case 20:
|
|
234
|
+
if ((result === null || result === void 0 ? void 0 : (_result$flag = result.flag) === null || _result$flag === void 0 ? void 0 : _result$flag.retCode) === '0') {
|
|
235
|
+
(0, _utils.showSuccess)(result.flag.retMsg || '删除成功');
|
|
236
|
+
if (tableRef.current) {
|
|
237
|
+
tableRef.current.reload(false);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
_context3.next = 26;
|
|
241
|
+
break;
|
|
242
|
+
case 23:
|
|
243
|
+
_context3.prev = 23;
|
|
244
|
+
_context3.t2 = _context3["catch"](8);
|
|
245
|
+
console.log(_context3.t2);
|
|
246
|
+
case 26:
|
|
247
|
+
case "end":
|
|
248
|
+
return _context3.stop();
|
|
310
249
|
}
|
|
311
250
|
}, _callee3, null, [[8, 23]]);
|
|
312
251
|
})));
|
|
313
252
|
};
|
|
314
253
|
/** 审核按钮事件 */
|
|
315
|
-
|
|
316
|
-
|
|
317
254
|
var onAudit = /*#__PURE__*/function () {
|
|
318
255
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(row) {
|
|
319
256
|
var rows, _result$flag2, result;
|
|
320
|
-
|
|
321
257
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
322
|
-
while (1) {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
_context4.next = 3;
|
|
327
|
-
break;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
(0, _utils.showWarn)('请选择需要审核的数据');
|
|
331
|
-
return _context4.abrupt("return");
|
|
332
|
-
|
|
333
|
-
case 3:
|
|
334
|
-
if (!isAudit(row)) {
|
|
335
|
-
_context4.next = 6;
|
|
336
|
-
break;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
(0, _utils.showWarn)('选择中数据中有已审核,不能再次进行操作!');
|
|
340
|
-
return _context4.abrupt("return");
|
|
341
|
-
|
|
342
|
-
case 6:
|
|
343
|
-
rows = (row ? [row] : selectedRows).map(function (o) {
|
|
344
|
-
var obj = (0, _objectSpread2.default)({}, o); //@ts-ignore
|
|
345
|
-
|
|
346
|
-
obj[statusField] = auditStatus;
|
|
347
|
-
return obj;
|
|
348
|
-
});
|
|
349
|
-
_context4.prev = 7;
|
|
350
|
-
_context4.next = 10;
|
|
351
|
-
return (0, _utils.showConfirm)('确认要审核选中的数据?', '审核提示');
|
|
352
|
-
|
|
353
|
-
case 10:
|
|
354
|
-
_context4.next = 16;
|
|
258
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
259
|
+
case 0:
|
|
260
|
+
if (!(!row && !selectedRows.length)) {
|
|
261
|
+
_context4.next = 3;
|
|
355
262
|
break;
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
case 16:
|
|
364
|
-
_context4.t1 = beforeAudit;
|
|
365
|
-
|
|
366
|
-
if (!_context4.t1) {
|
|
367
|
-
_context4.next = 22;
|
|
368
|
-
break;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
_context4.next = 20;
|
|
372
|
-
return beforeAudit(rows);
|
|
373
|
-
|
|
374
|
-
case 20:
|
|
375
|
-
_context4.t2 = _context4.sent;
|
|
376
|
-
_context4.t1 = _context4.t2 === false;
|
|
377
|
-
|
|
378
|
-
case 22:
|
|
379
|
-
if (!_context4.t1) {
|
|
380
|
-
_context4.next = 24;
|
|
381
|
-
break;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
return _context4.abrupt("return");
|
|
385
|
-
|
|
386
|
-
case 24:
|
|
387
|
-
_context4.prev = 24;
|
|
388
|
-
_context4.next = 27;
|
|
389
|
-
return service.audit(rows);
|
|
390
|
-
|
|
391
|
-
case 27:
|
|
392
|
-
result = _context4.sent;
|
|
393
|
-
|
|
394
|
-
if (!afterAudit) {
|
|
395
|
-
_context4.next = 31;
|
|
396
|
-
break;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
afterAudit(result, rows);
|
|
400
|
-
return _context4.abrupt("return");
|
|
401
|
-
|
|
402
|
-
case 31:
|
|
403
|
-
if ((result === null || result === void 0 ? void 0 : (_result$flag2 = result.flag) === null || _result$flag2 === void 0 ? void 0 : _result$flag2.retCode) === '0') {
|
|
404
|
-
(0, _utils.showSuccess)(result.flag.retMsg || '审核成功');
|
|
405
|
-
|
|
406
|
-
if (tableRef.current) {
|
|
407
|
-
tableRef.current.reload(false);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
_context4.next = 37;
|
|
263
|
+
}
|
|
264
|
+
(0, _utils.showWarn)('请选择需要审核的数据');
|
|
265
|
+
return _context4.abrupt("return");
|
|
266
|
+
case 3:
|
|
267
|
+
if (!isAudit(row)) {
|
|
268
|
+
_context4.next = 6;
|
|
412
269
|
break;
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
return
|
|
422
|
-
|
|
270
|
+
}
|
|
271
|
+
(0, _utils.showWarn)('选择中数据中有已审核,不能再次进行操作!');
|
|
272
|
+
return _context4.abrupt("return");
|
|
273
|
+
case 6:
|
|
274
|
+
rows = (row ? [row] : selectedRows).map(function (o) {
|
|
275
|
+
var obj = (0, _objectSpread2.default)({}, o);
|
|
276
|
+
//@ts-ignore
|
|
277
|
+
obj[statusField] = auditStatus;
|
|
278
|
+
return obj;
|
|
279
|
+
});
|
|
280
|
+
_context4.prev = 7;
|
|
281
|
+
_context4.next = 10;
|
|
282
|
+
return (0, _utils.showConfirm)('确认要审核选中的数据?', '审核提示');
|
|
283
|
+
case 10:
|
|
284
|
+
_context4.next = 16;
|
|
285
|
+
break;
|
|
286
|
+
case 12:
|
|
287
|
+
_context4.prev = 12;
|
|
288
|
+
_context4.t0 = _context4["catch"](7);
|
|
289
|
+
console.log(_context4.t0);
|
|
290
|
+
return _context4.abrupt("return");
|
|
291
|
+
case 16:
|
|
292
|
+
_context4.t1 = beforeAudit;
|
|
293
|
+
if (!_context4.t1) {
|
|
294
|
+
_context4.next = 22;
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
_context4.next = 20;
|
|
298
|
+
return beforeAudit(rows);
|
|
299
|
+
case 20:
|
|
300
|
+
_context4.t2 = _context4.sent;
|
|
301
|
+
_context4.t1 = _context4.t2 === false;
|
|
302
|
+
case 22:
|
|
303
|
+
if (!_context4.t1) {
|
|
304
|
+
_context4.next = 24;
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
return _context4.abrupt("return");
|
|
308
|
+
case 24:
|
|
309
|
+
_context4.prev = 24;
|
|
310
|
+
_context4.next = 27;
|
|
311
|
+
return service.audit(rows);
|
|
312
|
+
case 27:
|
|
313
|
+
result = _context4.sent;
|
|
314
|
+
if (!afterAudit) {
|
|
315
|
+
_context4.next = 31;
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
afterAudit(result, rows);
|
|
319
|
+
return _context4.abrupt("return");
|
|
320
|
+
case 31:
|
|
321
|
+
if ((result === null || result === void 0 ? void 0 : (_result$flag2 = result.flag) === null || _result$flag2 === void 0 ? void 0 : _result$flag2.retCode) === '0') {
|
|
322
|
+
(0, _utils.showSuccess)(result.flag.retMsg || '审核成功');
|
|
323
|
+
if (tableRef.current) {
|
|
324
|
+
tableRef.current.reload(false);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
_context4.next = 37;
|
|
328
|
+
break;
|
|
329
|
+
case 34:
|
|
330
|
+
_context4.prev = 34;
|
|
331
|
+
_context4.t3 = _context4["catch"](24);
|
|
332
|
+
console.log(_context4.t3);
|
|
333
|
+
case 37:
|
|
334
|
+
case "end":
|
|
335
|
+
return _context4.stop();
|
|
423
336
|
}
|
|
424
337
|
}, _callee4, null, [[7, 12], [24, 34]]);
|
|
425
338
|
}));
|
|
426
|
-
|
|
427
339
|
return function onAudit(_x3) {
|
|
428
340
|
return _ref4.apply(this, arguments);
|
|
429
341
|
};
|
|
430
342
|
}();
|
|
431
343
|
/** 新增,更改对应的保存事件 */
|
|
432
|
-
|
|
433
|
-
|
|
434
344
|
var onSave = /*#__PURE__*/function () {
|
|
435
345
|
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(formData) {
|
|
436
346
|
var data, _result$flag3, result;
|
|
437
|
-
|
|
438
347
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
439
|
-
while (1) {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
if (!_context5.t0) {
|
|
447
|
-
_context5.next = 8;
|
|
448
|
-
break;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
_context5.next = 6;
|
|
452
|
-
return beforeSave(data);
|
|
453
|
-
|
|
454
|
-
case 6:
|
|
455
|
-
_context5.t1 = _context5.sent;
|
|
456
|
-
_context5.t0 = _context5.t1 === false;
|
|
457
|
-
|
|
458
|
-
case 8:
|
|
459
|
-
if (!_context5.t0) {
|
|
460
|
-
_context5.next = 10;
|
|
461
|
-
break;
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
return _context5.abrupt("return", false);
|
|
465
|
-
|
|
466
|
-
case 10:
|
|
467
|
-
_context5.next = 12;
|
|
468
|
-
return service.save(data);
|
|
469
|
-
|
|
470
|
-
case 12:
|
|
471
|
-
result = _context5.sent;
|
|
472
|
-
|
|
473
|
-
if (!afterSave) {
|
|
474
|
-
_context5.next = 17;
|
|
475
|
-
break;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
_context5.next = 16;
|
|
479
|
-
return afterSave(result, data, false);
|
|
480
|
-
|
|
481
|
-
case 16:
|
|
482
|
-
return _context5.abrupt("return", _context5.sent);
|
|
483
|
-
|
|
484
|
-
case 17:
|
|
485
|
-
if (!((result === null || result === void 0 ? void 0 : (_result$flag3 = result.flag) === null || _result$flag3 === void 0 ? void 0 : _result$flag3.retCode) === '0')) {
|
|
486
|
-
_context5.next = 21;
|
|
487
|
-
break;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
(0, _utils.showSuccess)(result.flag.retMsg || '操作成功');
|
|
491
|
-
|
|
492
|
-
if (tableRef.current) {
|
|
493
|
-
tableRef.current.reload(false);
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
return _context5.abrupt("return", true);
|
|
497
|
-
|
|
498
|
-
case 21:
|
|
499
|
-
_context5.next = 26;
|
|
348
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
349
|
+
case 0:
|
|
350
|
+
data = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, editItem), formData);
|
|
351
|
+
_context5.prev = 1;
|
|
352
|
+
_context5.t0 = beforeSave;
|
|
353
|
+
if (!_context5.t0) {
|
|
354
|
+
_context5.next = 8;
|
|
500
355
|
break;
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
356
|
+
}
|
|
357
|
+
_context5.next = 6;
|
|
358
|
+
return beforeSave(data);
|
|
359
|
+
case 6:
|
|
360
|
+
_context5.t1 = _context5.sent;
|
|
361
|
+
_context5.t0 = _context5.t1 === false;
|
|
362
|
+
case 8:
|
|
363
|
+
if (!_context5.t0) {
|
|
364
|
+
_context5.next = 10;
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
return _context5.abrupt("return", false);
|
|
368
|
+
case 10:
|
|
369
|
+
_context5.next = 12;
|
|
370
|
+
return service.save(data);
|
|
371
|
+
case 12:
|
|
372
|
+
result = _context5.sent;
|
|
373
|
+
if (!afterSave) {
|
|
374
|
+
_context5.next = 17;
|
|
375
|
+
break;
|
|
376
|
+
}
|
|
377
|
+
_context5.next = 16;
|
|
378
|
+
return afterSave(result, data, false);
|
|
379
|
+
case 16:
|
|
380
|
+
return _context5.abrupt("return", _context5.sent);
|
|
381
|
+
case 17:
|
|
382
|
+
if (!((result === null || result === void 0 ? void 0 : (_result$flag3 = result.flag) === null || _result$flag3 === void 0 ? void 0 : _result$flag3.retCode) === '0')) {
|
|
383
|
+
_context5.next = 21;
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
386
|
+
(0, _utils.showSuccess)(result.flag.retMsg || '操作成功');
|
|
387
|
+
if (tableRef.current) {
|
|
388
|
+
tableRef.current.reload(false);
|
|
389
|
+
}
|
|
390
|
+
return _context5.abrupt("return", true);
|
|
391
|
+
case 21:
|
|
392
|
+
_context5.next = 26;
|
|
393
|
+
break;
|
|
394
|
+
case 23:
|
|
395
|
+
_context5.prev = 23;
|
|
396
|
+
_context5.t2 = _context5["catch"](1);
|
|
397
|
+
console.log(_context5.t2);
|
|
398
|
+
case 26:
|
|
399
|
+
return _context5.abrupt("return", false);
|
|
400
|
+
case 27:
|
|
401
|
+
case "end":
|
|
402
|
+
return _context5.stop();
|
|
514
403
|
}
|
|
515
404
|
}, _callee5, null, [[1, 23]]);
|
|
516
405
|
}));
|
|
517
|
-
|
|
518
406
|
return function onSave(_x4) {
|
|
519
407
|
return _ref5.apply(this, arguments);
|
|
520
408
|
};
|
|
521
409
|
}();
|
|
522
410
|
/** 加载数据方法 */
|
|
523
|
-
|
|
524
|
-
|
|
525
411
|
var onLoad = /*#__PURE__*/function () {
|
|
526
412
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(params, sort, filter) {
|
|
527
413
|
var _tableRef$current, _tableRef$current$cle;
|
|
528
|
-
|
|
529
|
-
var current, pageSize, sumProperties, rest, param, key, _key, sortArr, _key2, result;
|
|
530
|
-
|
|
414
|
+
var current, pageSize, sumProperties, rest, param, key, k, sortArr, _key, result;
|
|
531
415
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
532
|
-
while (1) {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
416
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
417
|
+
case 0:
|
|
418
|
+
current = params.current, pageSize = params.pageSize, sumProperties = params.sumProperties, rest = (0, _objectWithoutProperties2.default)(params, _excluded);
|
|
419
|
+
param = {}; // 分页
|
|
420
|
+
if (current) {
|
|
421
|
+
param.page = current;
|
|
422
|
+
param.pageSize = pageSize;
|
|
423
|
+
}
|
|
424
|
+
// 合计
|
|
425
|
+
if (sumProperties) {
|
|
426
|
+
param.sumProperties = sumProperties;
|
|
427
|
+
delete param.page;
|
|
428
|
+
delete param.pageSize;
|
|
429
|
+
}
|
|
430
|
+
// 处理查询条件
|
|
431
|
+
for (key in rest) {
|
|
432
|
+
if (rest[key] === '') {
|
|
433
|
+
delete rest[key];
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
if (Object.keys(rest).length) {
|
|
437
|
+
param.where = rest;
|
|
438
|
+
}
|
|
439
|
+
if (filter && Object.keys(filter).length) {
|
|
440
|
+
param.where = param.where || {};
|
|
441
|
+
for (k in filter) {
|
|
442
|
+
if (filter[k] && !param.where[k]) {
|
|
443
|
+
param.where[k] = filter[k];
|
|
554
444
|
}
|
|
555
445
|
}
|
|
556
|
-
|
|
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
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
success: false,
|
|
611
|
-
total: 0
|
|
612
|
-
});
|
|
613
|
-
|
|
614
|
-
case 18:
|
|
615
|
-
if (sumProperties && param.sort) {
|
|
616
|
-
delete param.sort;
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
_context6.next = 21;
|
|
620
|
-
return service.load(param);
|
|
621
|
-
|
|
622
|
-
case 21:
|
|
623
|
-
result = _context6.sent;
|
|
624
|
-
result.data = result.rows || [];
|
|
625
|
-
result.success = true;
|
|
626
|
-
|
|
627
|
-
if (sumProperties) {
|
|
628
|
-
result.data = result.footer;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
return _context6.abrupt("return", result);
|
|
632
|
-
|
|
633
|
-
case 26:
|
|
634
|
-
case "end":
|
|
635
|
-
return _context6.stop();
|
|
636
|
-
}
|
|
446
|
+
if (!Object.keys(param.where).length) {
|
|
447
|
+
delete param.where;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
//处理排序
|
|
451
|
+
if (!sumProperties && sort && Object.keys(sort).length) {
|
|
452
|
+
sortArr = [];
|
|
453
|
+
for (_key in sort) {
|
|
454
|
+
sortArr.push(_key + ' ' + (sort[_key] === 'ascend' ? 'asc' : 'desc'));
|
|
455
|
+
}
|
|
456
|
+
param.sort = sortArr.join(',');
|
|
457
|
+
}
|
|
458
|
+
if (ifHistoryData) {
|
|
459
|
+
param.history = 1;
|
|
460
|
+
}
|
|
461
|
+
setSelectedRows([]);
|
|
462
|
+
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$cle = _tableRef$current.clearSelected) === null || _tableRef$current$cle === void 0 ? void 0 : _tableRef$current$cle.call(_tableRef$current);
|
|
463
|
+
_context6.t0 = beforeLoad;
|
|
464
|
+
if (!_context6.t0) {
|
|
465
|
+
_context6.next = 17;
|
|
466
|
+
break;
|
|
467
|
+
}
|
|
468
|
+
_context6.next = 15;
|
|
469
|
+
return beforeLoad(param);
|
|
470
|
+
case 15:
|
|
471
|
+
_context6.t1 = _context6.sent;
|
|
472
|
+
_context6.t0 = _context6.t1 === false;
|
|
473
|
+
case 17:
|
|
474
|
+
if (!_context6.t0) {
|
|
475
|
+
_context6.next = 19;
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
return _context6.abrupt("return", {
|
|
479
|
+
data: [],
|
|
480
|
+
success: false,
|
|
481
|
+
total: 0
|
|
482
|
+
});
|
|
483
|
+
case 19:
|
|
484
|
+
if (sumProperties && param.sort) {
|
|
485
|
+
delete param.sort;
|
|
486
|
+
}
|
|
487
|
+
_context6.next = 22;
|
|
488
|
+
return service.load(param);
|
|
489
|
+
case 22:
|
|
490
|
+
result = _context6.sent;
|
|
491
|
+
result.data = result.rows || [];
|
|
492
|
+
result.success = true;
|
|
493
|
+
if (sumProperties) {
|
|
494
|
+
result.data = result.footer;
|
|
495
|
+
}
|
|
496
|
+
return _context6.abrupt("return", result);
|
|
497
|
+
case 27:
|
|
498
|
+
case "end":
|
|
499
|
+
return _context6.stop();
|
|
637
500
|
}
|
|
638
501
|
}, _callee6);
|
|
639
502
|
}));
|
|
640
|
-
|
|
641
503
|
return function onLoad(_x5, _x6, _x7) {
|
|
642
504
|
return _ref6.apply(this, arguments);
|
|
643
505
|
};
|
|
644
506
|
}();
|
|
645
|
-
|
|
646
507
|
var onExport = /*#__PURE__*/function () {
|
|
647
508
|
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(url, param) {
|
|
648
509
|
var _param$exportColumns;
|
|
649
|
-
|
|
650
510
|
var _result$flag4, result, _result$flag5, _result$flag6;
|
|
651
|
-
|
|
652
511
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
653
|
-
while (1) {
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
_context7.next = 3;
|
|
658
|
-
break;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
(0, _utils.showWarn)('请选择要导出的列');
|
|
662
|
-
return _context7.abrupt("return", false);
|
|
663
|
-
|
|
664
|
-
case 3:
|
|
665
|
-
if (param.findUrl) {
|
|
666
|
-
_context7.next = 6;
|
|
667
|
-
break;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
(0, _utils.showWarn)('请配置业务接口 bizApi 属性');
|
|
671
|
-
return _context7.abrupt("return", false);
|
|
672
|
-
|
|
673
|
-
case 6:
|
|
674
|
-
_context7.prev = 6;
|
|
675
|
-
_context7.next = 9;
|
|
676
|
-
return (0, _http.httpPost)(url, param, true, false);
|
|
677
|
-
|
|
678
|
-
case 9:
|
|
679
|
-
result = _context7.sent;
|
|
680
|
-
|
|
681
|
-
if (!(result.data && typeof result.data === 'string')) {
|
|
682
|
-
_context7.next = 13;
|
|
683
|
-
break;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
window.open(result.data);
|
|
687
|
-
return _context7.abrupt("return", true);
|
|
688
|
-
|
|
689
|
-
case 13:
|
|
690
|
-
if (!(((_result$flag4 = result.flag) === null || _result$flag4 === void 0 ? void 0 : _result$flag4.retCode) === '0')) {
|
|
691
|
-
_context7.next = 18;
|
|
692
|
-
break;
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
(0, _utils.showSuccess)(((_result$flag5 = result.flag) === null || _result$flag5 === void 0 ? void 0 : _result$flag5.retMsg) || '导出成功');
|
|
696
|
-
return _context7.abrupt("return", true);
|
|
697
|
-
|
|
698
|
-
case 18:
|
|
699
|
-
(0, _utils.showError)(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retMsg) || '导出失败,请联系系统管理员');
|
|
700
|
-
return _context7.abrupt("return", false);
|
|
701
|
-
|
|
702
|
-
case 20:
|
|
703
|
-
_context7.next = 27;
|
|
512
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
513
|
+
case 0:
|
|
514
|
+
if ((_param$exportColumns = param.exportColumns) === null || _param$exportColumns === void 0 ? void 0 : _param$exportColumns.length) {
|
|
515
|
+
_context7.next = 3;
|
|
704
516
|
break;
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
517
|
+
}
|
|
518
|
+
(0, _utils.showWarn)('请选择要导出的列');
|
|
519
|
+
return _context7.abrupt("return", false);
|
|
520
|
+
case 3:
|
|
521
|
+
if (param.findUrl) {
|
|
522
|
+
_context7.next = 6;
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
(0, _utils.showWarn)('请配置业务接口 bizApi 属性');
|
|
526
|
+
return _context7.abrupt("return", false);
|
|
527
|
+
case 6:
|
|
528
|
+
_context7.prev = 6;
|
|
529
|
+
_context7.next = 9;
|
|
530
|
+
return (0, _http.httpPost)(url, param, true, false);
|
|
531
|
+
case 9:
|
|
532
|
+
result = _context7.sent;
|
|
533
|
+
if (!(result.data && typeof result.data === 'string')) {
|
|
534
|
+
_context7.next = 13;
|
|
535
|
+
break;
|
|
536
|
+
}
|
|
537
|
+
window.open(result.data);
|
|
538
|
+
return _context7.abrupt("return", true);
|
|
539
|
+
case 13:
|
|
540
|
+
if (!(((_result$flag4 = result.flag) === null || _result$flag4 === void 0 ? void 0 : _result$flag4.retCode) === '0')) {
|
|
541
|
+
_context7.next = 18;
|
|
542
|
+
break;
|
|
543
|
+
}
|
|
544
|
+
(0, _utils.showSuccess)(((_result$flag5 = result.flag) === null || _result$flag5 === void 0 ? void 0 : _result$flag5.retMsg) || '导出成功');
|
|
545
|
+
return _context7.abrupt("return", true);
|
|
546
|
+
case 18:
|
|
547
|
+
(0, _utils.showError)(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retMsg) || '导出失败,请联系系统管理员');
|
|
548
|
+
return _context7.abrupt("return", false);
|
|
549
|
+
case 20:
|
|
550
|
+
_context7.next = 27;
|
|
551
|
+
break;
|
|
552
|
+
case 22:
|
|
553
|
+
_context7.prev = 22;
|
|
554
|
+
_context7.t0 = _context7["catch"](6);
|
|
555
|
+
console.log(_context7.t0);
|
|
556
|
+
(0, _utils.showError)(_context7.t0.message);
|
|
557
|
+
return _context7.abrupt("return", false);
|
|
558
|
+
case 27:
|
|
559
|
+
case "end":
|
|
560
|
+
return _context7.stop();
|
|
717
561
|
}
|
|
718
562
|
}, _callee7, null, [[6, 22]]);
|
|
719
563
|
}));
|
|
720
|
-
|
|
721
564
|
return function onExport(_x8, _x9) {
|
|
722
565
|
return _ref7.apply(this, arguments);
|
|
723
566
|
};
|
|
724
567
|
}();
|
|
725
|
-
|
|
568
|
+
/**
|
|
569
|
+
* 判断按钮状态
|
|
570
|
+
* @param key
|
|
571
|
+
* @returns
|
|
572
|
+
*/
|
|
726
573
|
var btnDisabled = function btnDisabled(key) {
|
|
727
574
|
if (btnStatus && typeof btnStatus(key) === 'boolean') return btnStatus(key);
|
|
728
|
-
|
|
729
575
|
switch (key) {
|
|
730
576
|
case 'edit':
|
|
731
577
|
return selectedRows.length !== 1 || isAudit();
|
|
732
|
-
|
|
733
578
|
case 'remove':
|
|
734
579
|
case 'audit':
|
|
735
580
|
return selectedRows.length === 0 || isAudit();
|
|
736
|
-
|
|
737
581
|
default:
|
|
738
582
|
return false;
|
|
739
583
|
}
|
|
740
584
|
};
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
var isAudit = (0, _react.useCallback)(function () {
|
|
745
|
-
var row = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
746
|
-
if (!auditStatus || !statusField) return false;
|
|
747
|
-
if (!row && !selectedRows.length) return false;
|
|
748
|
-
|
|
749
|
-
if (row) {
|
|
750
|
-
return Number(row[statusField] || 0) >= auditStatus;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
return selectedRows.findIndex(function (o) {
|
|
754
|
-
return Number(o[statusField] || 0) >= auditStatus;
|
|
755
|
-
}) > -1;
|
|
756
|
-
}, [auditStatus, statusField, selectedRows]); // 处理内置 table 按钮,新增,编辑,删除,审核,导入,导出
|
|
757
|
-
|
|
585
|
+
// 处理内置 table 按钮,新增,编辑,删除,审核,导入,导出
|
|
758
586
|
var tableTools = (0, _react.useMemo)(function () {
|
|
759
587
|
return [(toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.add) && canAdd ? /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
760
588
|
key: "add",
|
|
@@ -789,7 +617,6 @@ function useSingle(inParam) {
|
|
|
789
617
|
key: "import",
|
|
790
618
|
onClick: function onClick() {
|
|
791
619
|
var _tableRef$current2, _tableRef$current2$sh;
|
|
792
|
-
|
|
793
620
|
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$sh = _tableRef$current2.showImport) === null || _tableRef$current2$sh === void 0 ? void 0 : _tableRef$current2$sh.call(_tableRef$current2);
|
|
794
621
|
},
|
|
795
622
|
disabled: btnDisabled('import'),
|
|
@@ -798,12 +625,11 @@ function useSingle(inParam) {
|
|
|
798
625
|
key: "export",
|
|
799
626
|
onClick: function onClick() {
|
|
800
627
|
var _tableRef$current3, _tableRef$current3$sh;
|
|
801
|
-
|
|
802
628
|
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current3 = tableRef.current) === null || _tableRef$current3 === void 0 ? void 0 : (_tableRef$current3$sh = _tableRef$current3.showExport) === null || _tableRef$current3$sh === void 0 ? void 0 : _tableRef$current3$sh.call(_tableRef$current3);
|
|
803
629
|
},
|
|
804
630
|
disabled: btnDisabled('export'),
|
|
805
631
|
icon: /*#__PURE__*/_react.default.createElement(_icons.ExportOutlined, null)
|
|
806
|
-
}, "\u5BFC\u51FA") : false].filter(function (
|
|
632
|
+
}, "\u5BFC\u51FA") : false].filter(function () {
|
|
807
633
|
return Boolean;
|
|
808
634
|
});
|
|
809
635
|
}, [selectedRows]);
|
|
@@ -828,10 +654,11 @@ function useSingle(inParam) {
|
|
|
828
654
|
resourceId: resourceId,
|
|
829
655
|
checkRight: checkRight,
|
|
830
656
|
loginName: loginName,
|
|
831
|
-
isAudit: isAudit
|
|
657
|
+
isAudit: isAudit,
|
|
658
|
+
ifHistoryData: ifHistoryData,
|
|
659
|
+
setIfHistoryData: setIfHistoryData
|
|
832
660
|
};
|
|
833
661
|
}
|
|
834
|
-
|
|
835
662
|
;
|
|
836
663
|
var _default = useSingle;
|
|
837
664
|
exports.default = _default;
|