ls-pro-common 1.0.25 → 1.0.28
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.js +1 -1
- package/dist/common.min.js +1 -1
- package/es/components/DtlLayout.d.ts +2 -0
- package/es/components/DtlLayout.js +8 -1
- package/es/components/IconSelector.d.ts +19 -0
- package/es/components/IconSelector.js +293 -0
- package/es/hooks/useDtl/index.js +63 -36
- package/es/hooks/useSingle/index.js +45 -28
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/utils/index.d.ts +6 -0
- package/es/utils/index.js +21 -0
- package/lib/components/DtlLayout.d.ts +2 -0
- package/lib/components/DtlLayout.js +8 -1
- package/lib/components/IconSelector.d.ts +19 -0
- package/lib/components/IconSelector.js +322 -0
- package/lib/hooks/useDtl/index.js +63 -36
- package/lib/hooks/useSingle/index.js +45 -28
- package/lib/index.d.ts +2 -1
- package/lib/index.js +8 -0
- package/lib/utils/index.d.ts +6 -0
- package/lib/utils/index.js +26 -1
- package/package.json +3 -3
|
@@ -10,6 +10,8 @@ export declare type DtlLyaoutProps = Record<string, any> & {
|
|
|
10
10
|
renderButton?: (defaultBtn: JSX.Element[]) => JSX.Element[];
|
|
11
11
|
/** 审核方法 */
|
|
12
12
|
onAudit?: () => void;
|
|
13
|
+
/**按钮状态 */
|
|
14
|
+
btnStatus?: (btnKey: string) => boolean | void;
|
|
13
15
|
/** 保存按钮文本 */
|
|
14
16
|
btnSaveText?: string;
|
|
15
17
|
/** 返回按钮文本 */
|
|
@@ -20,7 +20,8 @@ function DtlLayout(props) {
|
|
|
20
20
|
_props$btnSaveText = props.btnSaveText,
|
|
21
21
|
btnSaveText = _props$btnSaveText === void 0 ? '保存' : _props$btnSaveText,
|
|
22
22
|
_props$btnExitText = props.btnExitText,
|
|
23
|
-
btnExitText = _props$btnExitText === void 0 ? '返回' : _props$btnExitText
|
|
23
|
+
btnExitText = _props$btnExitText === void 0 ? '返回' : _props$btnExitText,
|
|
24
|
+
btnStatus = props.btnStatus;
|
|
24
25
|
var dtlTitle = useMemo(function () {
|
|
25
26
|
if (title) return title;
|
|
26
27
|
if (!masterObject) return '';
|
|
@@ -38,6 +39,7 @@ function DtlLayout(props) {
|
|
|
38
39
|
|
|
39
40
|
formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.submit();
|
|
40
41
|
},
|
|
42
|
+
disabled: btnStatus ? btnStatus('btnSave') || false : false,
|
|
41
43
|
icon: /*#__PURE__*/React.createElement(SaveOutlined, null)
|
|
42
44
|
}, btnSaveText), /*#__PURE__*/React.createElement(_Button, {
|
|
43
45
|
key: "btnBack",
|
|
@@ -50,6 +52,11 @@ function DtlLayout(props) {
|
|
|
50
52
|
if (props.onAudit) {
|
|
51
53
|
b.unshift( /*#__PURE__*/React.createElement(_Button, {
|
|
52
54
|
key: "btnAudit",
|
|
55
|
+
disabled: btnStatus ? btnStatus('btnAudit') || false : false,
|
|
56
|
+
onClick: function onClick() {
|
|
57
|
+
if (!props.onAudit) return;
|
|
58
|
+
props.onAudit();
|
|
59
|
+
},
|
|
53
60
|
icon: /*#__PURE__*/React.createElement(CheckOutlined, null)
|
|
54
61
|
}, "\u5BA1\u6838"));
|
|
55
62
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { InputProps } from 'antd';
|
|
3
|
+
import type { ProFormItemProps } from 'ls-pro-form';
|
|
4
|
+
export declare type IconSelectorProps = ProFormItemProps<InputProps> & {
|
|
5
|
+
/** @name 图标类型 */
|
|
6
|
+
type: string;
|
|
7
|
+
/** @name 是否可上传,默认可上传 */
|
|
8
|
+
uploadable?: boolean;
|
|
9
|
+
/** @name 弹框title */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** @name 弹框宽度 */
|
|
12
|
+
modalWidth?: string;
|
|
13
|
+
/**
|
|
14
|
+
* @name 最大值, 默认2M
|
|
15
|
+
*/
|
|
16
|
+
maxSize?: number;
|
|
17
|
+
};
|
|
18
|
+
declare function IconSelector(prop: IconSelectorProps): JSX.Element;
|
|
19
|
+
export default IconSelector;
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import "antd/es/modal/style";
|
|
2
|
+
import _Modal from "antd/es/modal";
|
|
3
|
+
import "antd/es/card/style";
|
|
4
|
+
import _Card from "antd/es/card";
|
|
5
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
|
+
import "antd/es/upload/style";
|
|
7
|
+
import _Upload from "antd/es/upload";
|
|
8
|
+
import "antd/es/button/style";
|
|
9
|
+
import _Button from "antd/es/button";
|
|
10
|
+
import "antd/es/input/style";
|
|
11
|
+
import _Input from "antd/es/input";
|
|
12
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
13
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
14
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
15
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
16
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
17
|
+
var _excluded = ["type", "uploadable", "readonly", "allowClear", "title", "modalWidth", "name", "maxSize"];
|
|
18
|
+
import React from "react";
|
|
19
|
+
import { useMemo, useState, useEffect, useContext } from 'react';
|
|
20
|
+
import { ProFormText, ProFormContext } from 'ls-pro-form';
|
|
21
|
+
import { PlusOutlined, UploadOutlined } from '@ant-design/icons';
|
|
22
|
+
import { httpGet, httpPost } from '../http';
|
|
23
|
+
import { getCache, toGatewayUrl, showError, showWarn, showSuccess } from '../utils';
|
|
24
|
+
var fileCenter = getCache('file-center-api') || '/zuul/petrel-file-center-api/';
|
|
25
|
+
var pageSize = 16;
|
|
26
|
+
|
|
27
|
+
function IconSelector(prop) {
|
|
28
|
+
//@ts-ignore?
|
|
29
|
+
var _useContext = useContext(ProFormContext),
|
|
30
|
+
formRef = _useContext.formRef;
|
|
31
|
+
|
|
32
|
+
var _useState = useState(false),
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
visible = _useState2[0],
|
|
35
|
+
setVisible = _useState2[1];
|
|
36
|
+
|
|
37
|
+
var _useState3 = useState(''),
|
|
38
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
39
|
+
imgUrl = _useState4[0],
|
|
40
|
+
setImgUrl = _useState4[1];
|
|
41
|
+
|
|
42
|
+
var _useState5 = useState(1),
|
|
43
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
44
|
+
page = _useState6[0],
|
|
45
|
+
setPage = _useState6[1];
|
|
46
|
+
|
|
47
|
+
var _useState7 = useState(0),
|
|
48
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
49
|
+
total = _useState8[0],
|
|
50
|
+
setTotal = _useState8[1];
|
|
51
|
+
|
|
52
|
+
var _useState9 = useState([]),
|
|
53
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
54
|
+
list = _useState10[0],
|
|
55
|
+
setList = _useState10[1];
|
|
56
|
+
|
|
57
|
+
var type = prop.type,
|
|
58
|
+
_prop$uploadable = prop.uploadable,
|
|
59
|
+
uploadable = _prop$uploadable === void 0 ? true : _prop$uploadable,
|
|
60
|
+
_prop$readonly = prop.readonly,
|
|
61
|
+
readonly = _prop$readonly === void 0 ? true : _prop$readonly,
|
|
62
|
+
allowClear = prop.allowClear,
|
|
63
|
+
_prop$title = prop.title,
|
|
64
|
+
title = _prop$title === void 0 ? "选择图标" : _prop$title,
|
|
65
|
+
_prop$modalWidth = prop.modalWidth,
|
|
66
|
+
modalWidth = _prop$modalWidth === void 0 ? '600px' : _prop$modalWidth,
|
|
67
|
+
name = prop.name,
|
|
68
|
+
_prop$maxSize = prop.maxSize,
|
|
69
|
+
maxSize = _prop$maxSize === void 0 ? 2 : _prop$maxSize,
|
|
70
|
+
rest = _objectWithoutProperties(prop, _excluded);
|
|
71
|
+
|
|
72
|
+
var uploadImgApi = useMemo(function () {
|
|
73
|
+
return toGatewayUrl(fileCenter + 'file/upload/' + type);
|
|
74
|
+
}, [type]);
|
|
75
|
+
var showImgApi = useMemo(function () {
|
|
76
|
+
return fileCenter + 'file/show/' + type;
|
|
77
|
+
}, [type]);
|
|
78
|
+
|
|
79
|
+
var loadData = /*#__PURE__*/function () {
|
|
80
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(pageIndex) {
|
|
81
|
+
var url, param, result, rows;
|
|
82
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
83
|
+
while (1) {
|
|
84
|
+
switch (_context.prev = _context.next) {
|
|
85
|
+
case 0:
|
|
86
|
+
url = "/petrel-itg-api/sysMongo/page";
|
|
87
|
+
param = {
|
|
88
|
+
"search.status": 1,
|
|
89
|
+
"search.collectName": type,
|
|
90
|
+
"page.pn": pageIndex,
|
|
91
|
+
"page.size": pageSize
|
|
92
|
+
};
|
|
93
|
+
_context.next = 4;
|
|
94
|
+
return httpGet(url, param);
|
|
95
|
+
|
|
96
|
+
case 4:
|
|
97
|
+
result = _context.sent;
|
|
98
|
+
rows = result.rows || [];
|
|
99
|
+
setList(rows);
|
|
100
|
+
setTotal(result.total || 0);
|
|
101
|
+
|
|
102
|
+
case 8:
|
|
103
|
+
case "end":
|
|
104
|
+
return _context.stop();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}, _callee);
|
|
108
|
+
}));
|
|
109
|
+
|
|
110
|
+
return function loadData(_x) {
|
|
111
|
+
return _ref.apply(this, arguments);
|
|
112
|
+
};
|
|
113
|
+
}();
|
|
114
|
+
|
|
115
|
+
useEffect(function () {
|
|
116
|
+
if (!visible) return;
|
|
117
|
+
loadData(page);
|
|
118
|
+
}, [visible, page]);
|
|
119
|
+
var totalPage = useMemo(function () {
|
|
120
|
+
if (total === 0) return 1;
|
|
121
|
+
return Math.ceil(total / pageSize);
|
|
122
|
+
}, [total]); // 验证上传文件大小
|
|
123
|
+
|
|
124
|
+
var beforeUpload = function beforeUpload(file) {
|
|
125
|
+
var sizeLimit = file.size / 1024 / 1024 >= maxSize;
|
|
126
|
+
|
|
127
|
+
if (sizeLimit) {
|
|
128
|
+
showError("\u4E0A\u4F20\u7684\u6587\u4EF6\u4E0D\u80FD\u5927\u4E8E".concat(maxSize, "M"));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return !sizeLimit;
|
|
132
|
+
}; // 上传图片并调用 sysMongo 接口保存
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
var onUpload = function onUpload(info) {
|
|
136
|
+
if (info.file.status === 'done') {
|
|
137
|
+
var _result$flag;
|
|
138
|
+
|
|
139
|
+
var result = info.file.response;
|
|
140
|
+
|
|
141
|
+
if ((result === null || result === void 0 ? void 0 : (_result$flag = result.flag) === null || _result$flag === void 0 ? void 0 : _result$flag.retCode) === '0') {
|
|
142
|
+
var f = result.data[0];
|
|
143
|
+
var data = {
|
|
144
|
+
collectName: type,
|
|
145
|
+
mongoUrl: showImgApi + "/" + f.fileId,
|
|
146
|
+
mongoName: f.fileName || "",
|
|
147
|
+
remarks: "",
|
|
148
|
+
status: 1
|
|
149
|
+
};
|
|
150
|
+
var url = "/petrel/petrel-itg-api/sysMongo";
|
|
151
|
+
httpPost(url, data, true, false).then(function (res) {
|
|
152
|
+
if (res.flag.retCode === "0") {
|
|
153
|
+
showSuccess("上传成功");
|
|
154
|
+
|
|
155
|
+
if (page !== totalPage) {
|
|
156
|
+
setPage(totalPage);
|
|
157
|
+
} else {
|
|
158
|
+
loadData(totalPage);
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
showSuccess(result.flag.retMsg);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
} else {
|
|
165
|
+
var _result$flag2;
|
|
166
|
+
|
|
167
|
+
showError((result === null || result === void 0 ? void 0 : (_result$flag2 = result.flag) === null || _result$flag2 === void 0 ? void 0 : _result$flag2.retMsg) || '上传图片失败,请联系管理员');
|
|
168
|
+
}
|
|
169
|
+
} else if (info.file.status === 'error') {
|
|
170
|
+
showError('上传数据失败,请联系管理员');
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProFormText, _extends({
|
|
175
|
+
name: name
|
|
176
|
+
}, rest), /*#__PURE__*/React.createElement(_Input, _extends({
|
|
177
|
+
addonAfter: imgUrl ? /*#__PURE__*/React.createElement("img", {
|
|
178
|
+
style: {
|
|
179
|
+
maxWidth: 22,
|
|
180
|
+
maxHeight: 22
|
|
181
|
+
},
|
|
182
|
+
src: imgUrl,
|
|
183
|
+
onClick: function onClick() {
|
|
184
|
+
return setVisible(true);
|
|
185
|
+
}
|
|
186
|
+
}) : /*#__PURE__*/React.createElement(PlusOutlined, {
|
|
187
|
+
onClick: function onClick() {
|
|
188
|
+
return setVisible(true);
|
|
189
|
+
}
|
|
190
|
+
})
|
|
191
|
+
}, rest.fieldProps, {
|
|
192
|
+
readOnly: readonly,
|
|
193
|
+
allowClear: allowClear
|
|
194
|
+
}))), /*#__PURE__*/React.createElement(_Modal, {
|
|
195
|
+
title: title,
|
|
196
|
+
visible: visible,
|
|
197
|
+
width: modalWidth,
|
|
198
|
+
destroyOnClose: true,
|
|
199
|
+
onCancel: function onCancel() {
|
|
200
|
+
return setVisible(false);
|
|
201
|
+
},
|
|
202
|
+
bodyStyle: {
|
|
203
|
+
padding: 8
|
|
204
|
+
},
|
|
205
|
+
footer: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
206
|
+
style: {
|
|
207
|
+
display: 'inline-block',
|
|
208
|
+
marginRight: 8
|
|
209
|
+
}
|
|
210
|
+
}, /*#__PURE__*/React.createElement(_Upload, {
|
|
211
|
+
beforeUpload: beforeUpload,
|
|
212
|
+
onChange: onUpload,
|
|
213
|
+
action: uploadImgApi,
|
|
214
|
+
showUploadList: false,
|
|
215
|
+
name: "file",
|
|
216
|
+
maxCount: 1,
|
|
217
|
+
headers: {
|
|
218
|
+
token: localStorage.getItem('token') || ''
|
|
219
|
+
},
|
|
220
|
+
accept: ".png,.gif,.jpg,.jpeg,.bmp"
|
|
221
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
|
222
|
+
icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
|
|
223
|
+
}, "\u4E0A\u4F20\u65B0\u56FE"))), /*#__PURE__*/React.createElement(_Button, {
|
|
224
|
+
disabled: page === 1,
|
|
225
|
+
onClick: function onClick() {
|
|
226
|
+
setPage(page - 1);
|
|
227
|
+
}
|
|
228
|
+
}, "\u4E0A\u4E00\u9875"), /*#__PURE__*/React.createElement("span", {
|
|
229
|
+
style: {
|
|
230
|
+
padding: 8
|
|
231
|
+
}
|
|
232
|
+
}, page, "/", totalPage), /*#__PURE__*/React.createElement(_Button, {
|
|
233
|
+
disabled: page === totalPage,
|
|
234
|
+
onClick: function onClick() {
|
|
235
|
+
setPage(page + 1);
|
|
236
|
+
}
|
|
237
|
+
}, "\u4E0B\u4E00\u9875"), /*#__PURE__*/React.createElement(_Button, {
|
|
238
|
+
onClick: function onClick() {
|
|
239
|
+
return loadData(page);
|
|
240
|
+
}
|
|
241
|
+
}, "\u5237\u65B0"))
|
|
242
|
+
}, list.map(function (o) {
|
|
243
|
+
return /*#__PURE__*/React.createElement(_Card, {
|
|
244
|
+
hoverable: true,
|
|
245
|
+
style: {
|
|
246
|
+
width: '125px',
|
|
247
|
+
height: '130px',
|
|
248
|
+
display: 'inline-block',
|
|
249
|
+
margin: '10px',
|
|
250
|
+
verticalAlign: 'middle'
|
|
251
|
+
},
|
|
252
|
+
bodyStyle: {
|
|
253
|
+
padding: '15px 8px',
|
|
254
|
+
textAlign: 'center'
|
|
255
|
+
},
|
|
256
|
+
onDoubleClick: function onDoubleClick() {
|
|
257
|
+
if (!name) {
|
|
258
|
+
showWarn('选择图标组件未设置name属性');
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
var formVal = formRef.current.getFieldsValue();
|
|
263
|
+
|
|
264
|
+
var val = _objectSpread({}, formVal); //@ts-ignore
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
val[name] = o.mongoUrl;
|
|
268
|
+
formRef.current.setFieldsValue(val);
|
|
269
|
+
setImgUrl(toGatewayUrl(o.mongoUrl));
|
|
270
|
+
setVisible(false);
|
|
271
|
+
}
|
|
272
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
273
|
+
style: {
|
|
274
|
+
height: 80
|
|
275
|
+
}
|
|
276
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
277
|
+
title: o.mongoName,
|
|
278
|
+
style: {
|
|
279
|
+
maxWidth: '80px',
|
|
280
|
+
maxHeight: '80px'
|
|
281
|
+
},
|
|
282
|
+
src: toGatewayUrl(o.mongoUrl)
|
|
283
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
284
|
+
style: {
|
|
285
|
+
whiteSpace: 'nowrap',
|
|
286
|
+
textOverflow: 'ellipsis',
|
|
287
|
+
overflow: 'hidden'
|
|
288
|
+
}
|
|
289
|
+
}, o.mongoName));
|
|
290
|
+
})));
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export default IconSelector;
|
package/es/hooks/useDtl/index.js
CHANGED
|
@@ -143,7 +143,7 @@ function useDtl(dtlParam) {
|
|
|
143
143
|
break;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
showSuccess(result.flag.retMsg);
|
|
146
|
+
showSuccess(result.flag.retMsg || '操作成功');
|
|
147
147
|
Object.assign(masterObject, result.data);
|
|
148
148
|
setEditItem({});
|
|
149
149
|
return _context.abrupt("return", true);
|
|
@@ -252,7 +252,7 @@ function useDtl(dtlParam) {
|
|
|
252
252
|
break;
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
showSuccess(result.flag.retMsg);
|
|
255
|
+
showSuccess(result.flag.retMsg || '删除成功');
|
|
256
256
|
return _context2.abrupt("return", true);
|
|
257
257
|
|
|
258
258
|
case 28:
|
|
@@ -791,53 +791,48 @@ function useDtl(dtlParam) {
|
|
|
791
791
|
return _context9.abrupt("return");
|
|
792
792
|
|
|
793
793
|
case 3:
|
|
794
|
-
obj = _objectSpread({}, masterObject);
|
|
795
|
-
|
|
796
|
-
_context9.t0 = beforeAudit;
|
|
794
|
+
obj = _objectSpread({}, masterObject);
|
|
797
795
|
|
|
798
|
-
if (
|
|
799
|
-
_context9.next =
|
|
796
|
+
if (masterObject[mstKeyField]) {
|
|
797
|
+
_context9.next = 7;
|
|
800
798
|
break;
|
|
801
799
|
}
|
|
802
800
|
|
|
803
|
-
|
|
804
|
-
return
|
|
801
|
+
showWarn('当前数据未保存,不能审核');
|
|
802
|
+
return _context9.abrupt("return");
|
|
805
803
|
|
|
806
|
-
case
|
|
807
|
-
_context9.
|
|
808
|
-
_context9.
|
|
804
|
+
case 7:
|
|
805
|
+
_context9.prev = 7;
|
|
806
|
+
_context9.next = 10;
|
|
807
|
+
return showConfirm('确认要审核此数据?', '审核提示');
|
|
809
808
|
|
|
810
809
|
case 10:
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
break;
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
return _context9.abrupt("return");
|
|
810
|
+
_context9.next = 16;
|
|
811
|
+
break;
|
|
817
812
|
|
|
818
813
|
case 12:
|
|
819
814
|
_context9.prev = 12;
|
|
820
|
-
_context9.
|
|
821
|
-
|
|
815
|
+
_context9.t0 = _context9["catch"](7);
|
|
816
|
+
console.log('终止审核', _context9.t0);
|
|
817
|
+
return _context9.abrupt("return");
|
|
822
818
|
|
|
823
|
-
case
|
|
824
|
-
|
|
825
|
-
_context9.t2 = afterAudit;
|
|
819
|
+
case 16:
|
|
820
|
+
_context9.t1 = beforeAudit;
|
|
826
821
|
|
|
827
|
-
if (!_context9.
|
|
822
|
+
if (!_context9.t1) {
|
|
828
823
|
_context9.next = 22;
|
|
829
824
|
break;
|
|
830
825
|
}
|
|
831
826
|
|
|
832
827
|
_context9.next = 20;
|
|
833
|
-
return
|
|
828
|
+
return beforeAudit(obj);
|
|
834
829
|
|
|
835
830
|
case 20:
|
|
836
|
-
_context9.
|
|
837
|
-
_context9.
|
|
831
|
+
_context9.t2 = _context9.sent;
|
|
832
|
+
_context9.t1 = _context9.t2 === false;
|
|
838
833
|
|
|
839
834
|
case 22:
|
|
840
|
-
if (!_context9.
|
|
835
|
+
if (!_context9.t1) {
|
|
841
836
|
_context9.next = 24;
|
|
842
837
|
break;
|
|
843
838
|
}
|
|
@@ -845,25 +840,54 @@ function useDtl(dtlParam) {
|
|
|
845
840
|
return _context9.abrupt("return");
|
|
846
841
|
|
|
847
842
|
case 24:
|
|
843
|
+
_context9.prev = 24;
|
|
844
|
+
_context9.next = 27;
|
|
845
|
+
return mstService.audit([obj]);
|
|
846
|
+
|
|
847
|
+
case 27:
|
|
848
|
+
result = _context9.sent;
|
|
849
|
+
_context9.t3 = afterAudit;
|
|
850
|
+
|
|
851
|
+
if (!_context9.t3) {
|
|
852
|
+
_context9.next = 34;
|
|
853
|
+
break;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
_context9.next = 32;
|
|
857
|
+
return afterAudit(result, [obj]);
|
|
858
|
+
|
|
859
|
+
case 32:
|
|
860
|
+
_context9.t4 = _context9.sent;
|
|
861
|
+
_context9.t3 = _context9.t4 === false;
|
|
862
|
+
|
|
863
|
+
case 34:
|
|
864
|
+
if (!_context9.t3) {
|
|
865
|
+
_context9.next = 36;
|
|
866
|
+
break;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
return _context9.abrupt("return");
|
|
870
|
+
|
|
871
|
+
case 36:
|
|
848
872
|
if ((result === null || result === void 0 ? void 0 : (_result$flag8 = result.flag) === null || _result$flag8 === void 0 ? void 0 : _result$flag8.retCode) === '0') {
|
|
849
|
-
showSuccess(result.flag.retMsg);
|
|
873
|
+
showSuccess(result.flag.retMsg || '审核成功');
|
|
850
874
|
Object.assign(masterObject, result.data);
|
|
851
875
|
}
|
|
852
876
|
|
|
853
|
-
_context9.next =
|
|
877
|
+
_context9.next = 42;
|
|
854
878
|
break;
|
|
855
879
|
|
|
856
|
-
case
|
|
857
|
-
_context9.prev =
|
|
858
|
-
_context9.
|
|
859
|
-
console.log(_context9.
|
|
880
|
+
case 39:
|
|
881
|
+
_context9.prev = 39;
|
|
882
|
+
_context9.t5 = _context9["catch"](24);
|
|
883
|
+
console.log('审核异常', _context9.t5);
|
|
860
884
|
|
|
861
|
-
case
|
|
885
|
+
case 42:
|
|
862
886
|
case "end":
|
|
863
887
|
return _context9.stop();
|
|
864
888
|
}
|
|
865
889
|
}
|
|
866
|
-
}, _callee9, null, [[12,
|
|
890
|
+
}, _callee9, null, [[7, 12], [24, 39]]);
|
|
867
891
|
}));
|
|
868
892
|
|
|
869
893
|
return function onAudit() {
|
|
@@ -914,6 +938,7 @@ function useDtl(dtlParam) {
|
|
|
914
938
|
onClick: function onClick() {
|
|
915
939
|
return onAddDtl();
|
|
916
940
|
},
|
|
941
|
+
disabled: btnDisabled('add'),
|
|
917
942
|
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
|
918
943
|
}, "\u65B0\u589E") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.edit) && !isAudit() ? /*#__PURE__*/React.createElement(_Button, {
|
|
919
944
|
key: "edit",
|
|
@@ -935,12 +960,14 @@ function useDtl(dtlParam) {
|
|
|
935
960
|
onClick: function onClick() {
|
|
936
961
|
onImport();
|
|
937
962
|
},
|
|
963
|
+
disabled: btnDisabled('import'),
|
|
938
964
|
icon: /*#__PURE__*/React.createElement(ImportOutlined, null)
|
|
939
965
|
}, "\u5BFC\u5165") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.export) ? /*#__PURE__*/React.createElement(_Button, {
|
|
940
966
|
key: "export",
|
|
941
967
|
onClick: function onClick() {
|
|
942
968
|
onExport();
|
|
943
969
|
},
|
|
970
|
+
disabled: btnDisabled('export'),
|
|
944
971
|
icon: /*#__PURE__*/React.createElement(ExportOutlined, null)
|
|
945
972
|
}, "\u5BFC\u51FA") : false].filter(function (o) {
|
|
946
973
|
return o !== false;
|
|
@@ -185,7 +185,7 @@ function useSingle(inParam) {
|
|
|
185
185
|
|
|
186
186
|
|
|
187
187
|
var onRemove = function onRemove(row) {
|
|
188
|
-
if (!row
|
|
188
|
+
if (!row && !selectedRows.length) {
|
|
189
189
|
showWarn('请选择需要删除的数据');
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
@@ -259,7 +259,7 @@ function useSingle(inParam) {
|
|
|
259
259
|
|
|
260
260
|
case 20:
|
|
261
261
|
if ((result === null || result === void 0 ? void 0 : (_result$flag = result.flag) === null || _result$flag === void 0 ? void 0 : _result$flag.retCode) === '0') {
|
|
262
|
-
showSuccess(result.flag.retMsg);
|
|
262
|
+
showSuccess(result.flag.retMsg || '删除成功');
|
|
263
263
|
|
|
264
264
|
if (tableRef.current) {
|
|
265
265
|
tableRef.current.reload(false);
|
|
@@ -317,69 +317,83 @@ function useSingle(inParam) {
|
|
|
317
317
|
|
|
318
318
|
obj[statusField] = auditStatus;
|
|
319
319
|
return obj;
|
|
320
|
-
});
|
|
320
|
+
});
|
|
321
|
+
_context4.prev = 7;
|
|
322
|
+
_context4.next = 10;
|
|
323
|
+
return showConfirm('确认要审核选中的数据?', '审核提示');
|
|
324
|
+
|
|
325
|
+
case 10:
|
|
326
|
+
_context4.next = 16;
|
|
327
|
+
break;
|
|
328
|
+
|
|
329
|
+
case 12:
|
|
330
|
+
_context4.prev = 12;
|
|
331
|
+
_context4.t0 = _context4["catch"](7);
|
|
332
|
+
console.log(_context4.t0);
|
|
333
|
+
return _context4.abrupt("return");
|
|
321
334
|
|
|
322
|
-
|
|
335
|
+
case 16:
|
|
336
|
+
_context4.t1 = beforeAudit;
|
|
323
337
|
|
|
324
|
-
if (!_context4.
|
|
325
|
-
_context4.next =
|
|
338
|
+
if (!_context4.t1) {
|
|
339
|
+
_context4.next = 22;
|
|
326
340
|
break;
|
|
327
341
|
}
|
|
328
342
|
|
|
329
|
-
_context4.next =
|
|
343
|
+
_context4.next = 20;
|
|
330
344
|
return beforeAudit(rows);
|
|
331
345
|
|
|
332
|
-
case
|
|
333
|
-
_context4.
|
|
334
|
-
_context4.
|
|
346
|
+
case 20:
|
|
347
|
+
_context4.t2 = _context4.sent;
|
|
348
|
+
_context4.t1 = _context4.t2 === false;
|
|
335
349
|
|
|
336
|
-
case
|
|
337
|
-
if (!_context4.
|
|
338
|
-
_context4.next =
|
|
350
|
+
case 22:
|
|
351
|
+
if (!_context4.t1) {
|
|
352
|
+
_context4.next = 24;
|
|
339
353
|
break;
|
|
340
354
|
}
|
|
341
355
|
|
|
342
356
|
return _context4.abrupt("return");
|
|
343
357
|
|
|
344
|
-
case
|
|
345
|
-
_context4.prev =
|
|
346
|
-
_context4.next =
|
|
358
|
+
case 24:
|
|
359
|
+
_context4.prev = 24;
|
|
360
|
+
_context4.next = 27;
|
|
347
361
|
return service.audit(rows);
|
|
348
362
|
|
|
349
|
-
case
|
|
363
|
+
case 27:
|
|
350
364
|
result = _context4.sent;
|
|
351
365
|
|
|
352
366
|
if (!afterAudit) {
|
|
353
|
-
_context4.next =
|
|
367
|
+
_context4.next = 31;
|
|
354
368
|
break;
|
|
355
369
|
}
|
|
356
370
|
|
|
357
371
|
afterAudit(result, rows);
|
|
358
372
|
return _context4.abrupt("return");
|
|
359
373
|
|
|
360
|
-
case
|
|
374
|
+
case 31:
|
|
361
375
|
if ((result === null || result === void 0 ? void 0 : (_result$flag2 = result.flag) === null || _result$flag2 === void 0 ? void 0 : _result$flag2.retCode) === '0') {
|
|
362
|
-
showSuccess(result.flag.retMsg);
|
|
376
|
+
showSuccess(result.flag.retMsg || '审核成功');
|
|
363
377
|
|
|
364
378
|
if (tableRef.current) {
|
|
365
379
|
tableRef.current.reload(false);
|
|
366
380
|
}
|
|
367
381
|
}
|
|
368
382
|
|
|
369
|
-
_context4.next =
|
|
383
|
+
_context4.next = 37;
|
|
370
384
|
break;
|
|
371
385
|
|
|
372
|
-
case
|
|
373
|
-
_context4.prev =
|
|
374
|
-
_context4.
|
|
375
|
-
console.log(_context4.
|
|
386
|
+
case 34:
|
|
387
|
+
_context4.prev = 34;
|
|
388
|
+
_context4.t3 = _context4["catch"](24);
|
|
389
|
+
console.log(_context4.t3);
|
|
376
390
|
|
|
377
|
-
case
|
|
391
|
+
case 37:
|
|
378
392
|
case "end":
|
|
379
393
|
return _context4.stop();
|
|
380
394
|
}
|
|
381
395
|
}
|
|
382
|
-
}, _callee4, null, [[
|
|
396
|
+
}, _callee4, null, [[7, 12], [24, 34]]);
|
|
383
397
|
}));
|
|
384
398
|
|
|
385
399
|
return function onAudit(_x3) {
|
|
@@ -445,7 +459,7 @@ function useSingle(inParam) {
|
|
|
445
459
|
break;
|
|
446
460
|
}
|
|
447
461
|
|
|
448
|
-
showSuccess(result.flag.retMsg);
|
|
462
|
+
showSuccess(result.flag.retMsg || '操作成功');
|
|
449
463
|
|
|
450
464
|
if (tableRef.current) {
|
|
451
465
|
tableRef.current.reload(false);
|
|
@@ -667,6 +681,7 @@ function useSingle(inParam) {
|
|
|
667
681
|
onClick: function onClick() {
|
|
668
682
|
return onAdd(null);
|
|
669
683
|
},
|
|
684
|
+
disabled: btnDisabled('add'),
|
|
670
685
|
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
|
671
686
|
}, "\u65B0\u589E") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.edit) && checkRight(4) ? /*#__PURE__*/React.createElement(_Button, {
|
|
672
687
|
key: "edit",
|
|
@@ -697,6 +712,7 @@ function useSingle(inParam) {
|
|
|
697
712
|
|
|
698
713
|
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);
|
|
699
714
|
},
|
|
715
|
+
disabled: btnDisabled('import'),
|
|
700
716
|
icon: /*#__PURE__*/React.createElement(ImportOutlined, null)
|
|
701
717
|
}, "\u5BFC\u5165") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.export) && checkRight(256) ? /*#__PURE__*/React.createElement(_Button, {
|
|
702
718
|
key: "export",
|
|
@@ -705,6 +721,7 @@ function useSingle(inParam) {
|
|
|
705
721
|
|
|
706
722
|
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);
|
|
707
723
|
},
|
|
724
|
+
disabled: btnDisabled('export'),
|
|
708
725
|
icon: /*#__PURE__*/React.createElement(ExportOutlined, null)
|
|
709
726
|
}, "\u5BFC\u51FA") : false].filter(function (o) {
|
|
710
727
|
return o !== false;
|