ls-pro-common 1.0.26 → 1.0.29
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/components/InputTable.js +19 -9
- package/es/hooks/useDtl/index.js +63 -36
- package/es/hooks/useSingle/index.js +44 -27
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- 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/components/InputTable.js +19 -9
- package/lib/hooks/useDtl/index.js +63 -36
- package/lib/hooks/useSingle/index.js +44 -27
- package/lib/index.d.ts +2 -1
- package/lib/index.js +8 -0
- 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;
|
|
@@ -10,7 +10,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
10
10
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
11
11
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
12
12
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
13
|
-
var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect"],
|
|
13
|
+
var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps"],
|
|
14
14
|
_excluded2 = ["current", "pageSize"];
|
|
15
15
|
import React from "react";
|
|
16
16
|
import { useRef, useState, useEffect, useContext } from 'react';
|
|
@@ -66,6 +66,7 @@ function InputTable(prop) {
|
|
|
66
66
|
allowClear = _prop$allowClear === void 0 ? true : _prop$allowClear,
|
|
67
67
|
_prop$keepSelect = prop.keepSelect,
|
|
68
68
|
keepSelect = _prop$keepSelect === void 0 ? false : _prop$keepSelect,
|
|
69
|
+
fieldProps = prop.fieldProps,
|
|
69
70
|
rest = _objectWithoutProperties(prop, _excluded);
|
|
70
71
|
|
|
71
72
|
var textNameProp = textName || name + '__text';
|
|
@@ -148,7 +149,6 @@ function InputTable(prop) {
|
|
|
148
149
|
var tableDom = /*#__PURE__*/React.createElement(ProTable, _extends({
|
|
149
150
|
columns: columns,
|
|
150
151
|
request: loadData,
|
|
151
|
-
rowKey: valueField,
|
|
152
152
|
manualRequest: false,
|
|
153
153
|
actionRef: tableRef,
|
|
154
154
|
search: {
|
|
@@ -219,7 +219,7 @@ function InputTable(prop) {
|
|
|
219
219
|
name: name
|
|
220
220
|
})), rest.label ? /*#__PURE__*/React.createElement(ProFormText, _extends({
|
|
221
221
|
name: textNameProp
|
|
222
|
-
}, rest), /*#__PURE__*/React.createElement(_Input, {
|
|
222
|
+
}, rest), /*#__PURE__*/React.createElement(_Input, _extends({
|
|
223
223
|
suffix: /*#__PURE__*/React.createElement(_Popover, {
|
|
224
224
|
content: /*#__PURE__*/React.createElement("div", {
|
|
225
225
|
style: {
|
|
@@ -232,9 +232,14 @@ function InputTable(prop) {
|
|
|
232
232
|
trigger: "click",
|
|
233
233
|
visible: visible,
|
|
234
234
|
onVisibleChange: setVisible
|
|
235
|
-
}, /*#__PURE__*/React.createElement(MoreOutlined,
|
|
235
|
+
}, /*#__PURE__*/React.createElement(MoreOutlined, {
|
|
236
|
+
onClick: function onClick(e) {
|
|
237
|
+
setVisible(true);
|
|
238
|
+
e.stopPropagation && e.stopPropagation();
|
|
239
|
+
}
|
|
240
|
+
})),
|
|
236
241
|
onClick: function onClick() {
|
|
237
|
-
|
|
242
|
+
setVisible(true);
|
|
238
243
|
},
|
|
239
244
|
onInput: function onInput(e) {
|
|
240
245
|
var _formRef$current6;
|
|
@@ -257,7 +262,7 @@ function InputTable(prop) {
|
|
|
257
262
|
},
|
|
258
263
|
readOnly: readonly,
|
|
259
264
|
allowClear: allowClear
|
|
260
|
-
})) : /*#__PURE__*/React.createElement(_Input, _extends({
|
|
265
|
+
}, fieldProps))) : /*#__PURE__*/React.createElement(_Input, _extends({
|
|
261
266
|
suffix: /*#__PURE__*/React.createElement(_Popover, {
|
|
262
267
|
content: /*#__PURE__*/React.createElement("div", {
|
|
263
268
|
style: {
|
|
@@ -270,9 +275,14 @@ function InputTable(prop) {
|
|
|
270
275
|
trigger: "click",
|
|
271
276
|
visible: visible,
|
|
272
277
|
onVisibleChange: setVisible
|
|
273
|
-
}, /*#__PURE__*/React.createElement(MoreOutlined,
|
|
278
|
+
}, /*#__PURE__*/React.createElement(MoreOutlined, {
|
|
279
|
+
onClick: function onClick(e) {
|
|
280
|
+
setVisible(true);
|
|
281
|
+
e.stopPropagation && e.stopPropagation();
|
|
282
|
+
}
|
|
283
|
+
})),
|
|
274
284
|
onClick: function onClick() {
|
|
275
|
-
|
|
285
|
+
setVisible(true);
|
|
276
286
|
},
|
|
277
287
|
onInput: function onInput(e) {
|
|
278
288
|
var _formRef$current8;
|
|
@@ -299,7 +309,7 @@ function InputTable(prop) {
|
|
|
299
309
|
readOnly: readonly,
|
|
300
310
|
value: text,
|
|
301
311
|
allowClear: allowClear
|
|
302
|
-
},
|
|
312
|
+
}, fieldProps)));
|
|
303
313
|
}
|
|
304
314
|
|
|
305
315
|
export default InputTable;
|
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;
|