ls-pro-common 3.0.96 → 3.0.98
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 +63 -0
- package/dist/common.js +1 -1
- package/dist/common.less +2 -1
- package/dist/common.min.css +63 -0
- package/dist/common.min.js +1 -1
- package/es/components/AreaCascader.js +5 -8
- package/es/components/AreaCascaderPanel.js +5 -9
- package/es/components/InputTable.js +87 -61
- package/es/components/ProButton/index.d.ts +10 -0
- package/es/components/ProButton/index.js +40 -0
- package/es/components/RecordLog/index.d.ts +16 -0
- package/es/components/RecordLog/index.js +114 -0
- package/es/components/RecordLog/index.less +71 -0
- package/es/hooks/useMdm.d.ts +7 -0
- package/es/hooks/useMdm.js +47 -0
- package/es/http/index.d.ts +2 -1
- package/es/http/index.js +16 -9
- package/es/http/mdmRequest.d.ts +184 -0
- package/es/http/mdmRequest.js +351 -0
- package/es/index.d.ts +6 -2
- package/es/index.js +6 -2
- package/es/utils/array.d.ts +26 -0
- package/es/utils/array.js +74 -0
- package/es/utils/format.d.ts +82 -0
- package/es/utils/format.js +148 -0
- package/es/utils/index.d.ts +19 -125
- package/es/utils/index.js +21 -478
- package/es/utils/modal.d.ts +43 -0
- package/es/utils/modal.js +225 -0
- package/es/utils/size.d.ts +9 -0
- package/es/utils/size.js +81 -0
- package/lib/components/AreaCascader.js +5 -8
- package/lib/components/AreaCascaderPanel.js +5 -9
- package/lib/components/InputTable.js +87 -61
- package/lib/components/ProButton/index.d.ts +10 -0
- package/lib/components/ProButton/index.js +40 -0
- package/lib/components/RecordLog/index.d.ts +16 -0
- package/lib/components/RecordLog/index.js +114 -0
- package/lib/components/RecordLog/index.less +71 -0
- package/lib/hooks/useMdm.d.ts +7 -0
- package/lib/hooks/useMdm.js +47 -0
- package/lib/http/index.d.ts +2 -1
- package/lib/http/index.js +16 -9
- package/lib/http/mdmRequest.d.ts +184 -0
- package/lib/http/mdmRequest.js +351 -0
- package/lib/index.d.ts +6 -2
- package/lib/index.js +6 -2
- package/lib/utils/array.d.ts +26 -0
- package/lib/utils/array.js +74 -0
- package/lib/utils/format.d.ts +82 -0
- package/lib/utils/format.js +148 -0
- package/lib/utils/index.d.ts +19 -125
- package/lib/utils/index.js +21 -478
- package/lib/utils/modal.d.ts +43 -0
- package/lib/utils/modal.js +225 -0
- package/lib/utils/size.d.ts +9 -0
- package/lib/utils/size.js +81 -0
- package/package.json +4 -2
|
@@ -6,7 +6,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
6
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
7
|
import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
8
8
|
import { httpGet } from '../http';
|
|
9
|
-
import { getCache, setCache, treeEach
|
|
9
|
+
import { getCache, setCache, treeEach } from '../utils';
|
|
10
10
|
var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
11
11
|
var _useState = useState([]),
|
|
12
12
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -34,14 +34,11 @@ var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
34
34
|
return _context.abrupt("return");
|
|
35
35
|
case 4:
|
|
36
36
|
api = '/petrel/petrel-location-center-api/sysAdministrativeDivision/allByTree';
|
|
37
|
-
|
|
38
|
-
api = toGatewayUrl('/tenant-mdm-api/sysAdministrativeDivision/allByTree');
|
|
39
|
-
}
|
|
40
|
-
_context.next = 8;
|
|
37
|
+
_context.next = 7;
|
|
41
38
|
return httpGet(api, {}, false);
|
|
42
|
-
case
|
|
39
|
+
case 7:
|
|
43
40
|
result = _context.sent;
|
|
44
|
-
opts =
|
|
41
|
+
opts = result.rows || [];
|
|
45
42
|
treeEach(opts, function (item) {
|
|
46
43
|
item.label = item.name;
|
|
47
44
|
item.value = item.id;
|
|
@@ -55,7 +52,7 @@ var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
55
52
|
});
|
|
56
53
|
setCache('areaOptions', opts, true);
|
|
57
54
|
setOptions(opts);
|
|
58
|
-
case
|
|
55
|
+
case 12:
|
|
59
56
|
case "end":
|
|
60
57
|
return _context.stop();
|
|
61
58
|
}
|
|
@@ -9,9 +9,8 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
10
|
import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
11
11
|
import { httpGet } from '../http';
|
|
12
|
-
import { getCache, setCache, treeEach
|
|
12
|
+
import { getCache, setCache, treeEach } from '../utils';
|
|
13
13
|
import './common.less';
|
|
14
|
-
import { toGatewayUrl } from 'ls-pro-table';
|
|
15
14
|
var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
16
15
|
var propsConfig = _objectSpread({
|
|
17
16
|
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
@@ -94,14 +93,11 @@ var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
94
93
|
return _context.abrupt("return");
|
|
95
94
|
case 3:
|
|
96
95
|
api = '/petrel/petrel-location-center-api/sysAdministrativeDivision/allByTree';
|
|
97
|
-
|
|
98
|
-
api = toGatewayUrl('/tenant-mdm-api/sysAdministrativeDivision/allByTree');
|
|
99
|
-
}
|
|
100
|
-
_context.next = 7;
|
|
96
|
+
_context.next = 6;
|
|
101
97
|
return httpGet(api, {}, false);
|
|
102
|
-
case
|
|
98
|
+
case 6:
|
|
103
99
|
result = _context.sent;
|
|
104
|
-
opts =
|
|
100
|
+
opts = result.rows || [];
|
|
105
101
|
treeEach(opts, function (item) {
|
|
106
102
|
item.label = item.name;
|
|
107
103
|
item.value = item.id;
|
|
@@ -115,7 +111,7 @@ var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
115
111
|
setCache('areaOptionsPanel', opts, true);
|
|
116
112
|
setOptions(opts);
|
|
117
113
|
setShowData(opts);
|
|
118
|
-
case
|
|
114
|
+
case 12:
|
|
119
115
|
case "end":
|
|
120
116
|
return _context.stop();
|
|
121
117
|
}
|
|
@@ -5,11 +5,11 @@ import _Popover from "antd/es/popover";
|
|
|
5
5
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
6
6
|
import "antd/es/button/style";
|
|
7
7
|
import _Button from "antd/es/button";
|
|
8
|
-
import
|
|
8
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
9
9
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
10
10
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
11
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
11
12
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
12
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
13
13
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
14
14
|
var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps", "searchField", "fillMap", "loadOnShow", "triggerCheck", "getPopupContainer", "placement", "arrowPointAtCenter", "rowKey", "method", "changeOnSelect", "record"],
|
|
15
15
|
_excluded2 = ["current", "pageSize"];
|
|
@@ -39,11 +39,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
39
39
|
text = _useState6[0],
|
|
40
40
|
setText = _useState6[1];
|
|
41
41
|
var inputRef = useRef();
|
|
42
|
-
|
|
43
|
-
return _objectSpread(_objectSpread({}, inputRef.current), {}, {
|
|
44
|
-
clear: handleClear
|
|
45
|
-
});
|
|
46
|
-
});
|
|
42
|
+
var initRows = useRef(null); //用于存储初始行数据
|
|
47
43
|
var columns = prop.columns,
|
|
48
44
|
url = prop.url,
|
|
49
45
|
textName = prop.textName,
|
|
@@ -124,13 +120,51 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
124
120
|
if (col) return col.searchField || col.dataIndex;
|
|
125
121
|
return textField || valueField;
|
|
126
122
|
}, [columns, searchField, valueField, textField]);
|
|
123
|
+
var getFormValue = function getFormValue() {
|
|
124
|
+
var _formRef$current2, _formRef$current2$get;
|
|
125
|
+
if (rowKey) {
|
|
126
|
+
var _formRef$current, _formRef$current$getF, _formRef$current$getF2;
|
|
127
|
+
return formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : (_formRef$current$getF = _formRef$current.getFieldsValue) === null || _formRef$current$getF === void 0 ? void 0 : (_formRef$current$getF2 = _formRef$current$getF.call(_formRef$current)) === null || _formRef$current$getF2 === void 0 ? void 0 : _formRef$current$getF2[rowKey];
|
|
128
|
+
}
|
|
129
|
+
return formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : (_formRef$current2$get = _formRef$current2.getFieldsValue) === null || _formRef$current2$get === void 0 ? void 0 : _formRef$current2$get.call(_formRef$current2);
|
|
130
|
+
};
|
|
131
|
+
var setFormValue = function setFormValue(formValue) {
|
|
132
|
+
if (rowKey) {
|
|
133
|
+
var _formRef$current3, _formRef$current3$set;
|
|
134
|
+
formRef === null || formRef === void 0 ? void 0 : (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : (_formRef$current3$set = _formRef$current3.setFieldsValue) === null || _formRef$current3$set === void 0 ? void 0 : _formRef$current3$set.call(_formRef$current3, _defineProperty({}, rowKey, formValue));
|
|
135
|
+
} else {
|
|
136
|
+
var _formRef$current4, _formRef$current4$set;
|
|
137
|
+
formRef === null || formRef === void 0 ? void 0 : (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : (_formRef$current4$set = _formRef$current4.setFieldsValue) === null || _formRef$current4$set === void 0 ? void 0 : _formRef$current4$set.call(_formRef$current4, formValue);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
127
140
|
var loadData = /*#__PURE__*/function () {
|
|
128
141
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
|
|
129
|
-
var current, pageSize, restParams, data, _tableRef$
|
|
142
|
+
var current, pageSize, restParams, _selectRowRef$current, _rows, data, _tableRef$current2, _tableRef$current2$cl, result, rows, formValue, val, _selectRowRef$current2, arr, pageSelectedRows;
|
|
130
143
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
131
144
|
while (1) switch (_context.prev = _context.next) {
|
|
132
145
|
case 0:
|
|
133
|
-
current = param.current, pageSize = param.pageSize, restParams = _objectWithoutProperties(param, _excluded2);
|
|
146
|
+
current = param.current, pageSize = param.pageSize, restParams = _objectWithoutProperties(param, _excluded2); //如果精灵框初始有值(用于编辑页面)先把初始值加载到第一页,才能默认选中。
|
|
147
|
+
if (!(visible && multiple && Array.isArray(initRows.current))) {
|
|
148
|
+
_context.next = 9;
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
_rows = initRows.current;
|
|
152
|
+
initRows.current = null;
|
|
153
|
+
(_selectRowRef$current = selectRowRef.current).push.apply(_selectRowRef$current, _toConsumableArray(_rows));
|
|
154
|
+
selectedKeys.push.apply(selectedKeys, _toConsumableArray(_rows.map(function (o) {
|
|
155
|
+
return o[tableKey];
|
|
156
|
+
})));
|
|
157
|
+
setSelectedKeys(Array.from(new Set(selectedKeys)));
|
|
158
|
+
setTimeout(function () {
|
|
159
|
+
var _tableRef$current, _tableRef$current$rel;
|
|
160
|
+
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$rel = _tableRef$current.reload) === null || _tableRef$current$rel === void 0 ? void 0 : _tableRef$current$rel.call(_tableRef$current);
|
|
161
|
+
}, 0);
|
|
162
|
+
return _context.abrupt("return", {
|
|
163
|
+
data: _rows,
|
|
164
|
+
total: _rows.length,
|
|
165
|
+
success: true
|
|
166
|
+
});
|
|
167
|
+
case 9:
|
|
134
168
|
data = {};
|
|
135
169
|
if (isV2) {
|
|
136
170
|
data['page.pn'] = current;
|
|
@@ -146,27 +180,27 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
146
180
|
}
|
|
147
181
|
if (!keepSelect) {
|
|
148
182
|
selectRowRef.current = [];
|
|
149
|
-
(_tableRef$
|
|
183
|
+
(_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$cl = _tableRef$current2.clearSelected) === null || _tableRef$current2$cl === void 0 ? void 0 : _tableRef$current2$cl.call(_tableRef$current2);
|
|
150
184
|
}
|
|
151
185
|
if (beforeLoad) {
|
|
152
186
|
beforeLoad(data);
|
|
153
187
|
}
|
|
154
188
|
if (!(method !== 'GET')) {
|
|
155
|
-
_context.next =
|
|
189
|
+
_context.next = 20;
|
|
156
190
|
break;
|
|
157
191
|
}
|
|
158
|
-
_context.next =
|
|
192
|
+
_context.next = 17;
|
|
159
193
|
return httpPost(url, data);
|
|
160
|
-
case
|
|
194
|
+
case 17:
|
|
161
195
|
result = _context.sent;
|
|
162
|
-
_context.next =
|
|
196
|
+
_context.next = 23;
|
|
163
197
|
break;
|
|
164
|
-
case
|
|
165
|
-
_context.next =
|
|
198
|
+
case 20:
|
|
199
|
+
_context.next = 22;
|
|
166
200
|
return httpGet(url, data);
|
|
167
|
-
case
|
|
201
|
+
case 22:
|
|
168
202
|
result = _context.sent;
|
|
169
|
-
case
|
|
203
|
+
case 23:
|
|
170
204
|
rows = (result.rows || []).filter(function (o) {
|
|
171
205
|
return o;
|
|
172
206
|
});
|
|
@@ -187,7 +221,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
187
221
|
return o[valueField] === row[valueField];
|
|
188
222
|
});
|
|
189
223
|
});
|
|
190
|
-
(_selectRowRef$
|
|
224
|
+
(_selectRowRef$current2 = selectRowRef.current).push.apply(_selectRowRef$current2, _toConsumableArray(pageSelectedRows));
|
|
191
225
|
selectedKeys.push.apply(selectedKeys, _toConsumableArray(pageSelectedRows.map(function (o) {
|
|
192
226
|
return o[tableKey];
|
|
193
227
|
})));
|
|
@@ -199,7 +233,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
199
233
|
total: Number(result.total || 0),
|
|
200
234
|
success: true
|
|
201
235
|
});
|
|
202
|
-
case
|
|
236
|
+
case 27:
|
|
203
237
|
case "end":
|
|
204
238
|
return _context.stop();
|
|
205
239
|
}
|
|
@@ -209,40 +243,6 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
209
243
|
return _ref.apply(this, arguments);
|
|
210
244
|
};
|
|
211
245
|
}();
|
|
212
|
-
var getFormValue = function getFormValue() {
|
|
213
|
-
var _formRef$current2, _formRef$current2$get;
|
|
214
|
-
if (rowKey) {
|
|
215
|
-
var _formRef$current, _formRef$current$getF, _formRef$current$getF2;
|
|
216
|
-
return formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : (_formRef$current$getF = _formRef$current.getFieldsValue) === null || _formRef$current$getF === void 0 ? void 0 : (_formRef$current$getF2 = _formRef$current$getF.call(_formRef$current)) === null || _formRef$current$getF2 === void 0 ? void 0 : _formRef$current$getF2[rowKey];
|
|
217
|
-
}
|
|
218
|
-
return formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : (_formRef$current2$get = _formRef$current2.getFieldsValue) === null || _formRef$current2$get === void 0 ? void 0 : _formRef$current2$get.call(_formRef$current2);
|
|
219
|
-
};
|
|
220
|
-
var setFormValue = function setFormValue(formValue) {
|
|
221
|
-
if (rowKey) {
|
|
222
|
-
var _formRef$current3, _formRef$current3$set;
|
|
223
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : (_formRef$current3$set = _formRef$current3.setFieldsValue) === null || _formRef$current3$set === void 0 ? void 0 : _formRef$current3$set.call(_formRef$current3, _defineProperty({}, rowKey, formValue));
|
|
224
|
-
} else {
|
|
225
|
-
var _formRef$current4, _formRef$current4$set;
|
|
226
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : (_formRef$current4$set = _formRef$current4.setFieldsValue) === null || _formRef$current4$set === void 0 ? void 0 : _formRef$current4$set.call(_formRef$current4, formValue);
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
// 初始化数据,主要设置名称
|
|
230
|
-
useEffect(function () {
|
|
231
|
-
var _formValue$textNamePr, _formValue$name;
|
|
232
|
-
var formValue = getFormValue();
|
|
233
|
-
if (!formValue) return;
|
|
234
|
-
var txt = (_formValue$textNamePr = formValue === null || formValue === void 0 ? void 0 : formValue[textNameProp]) !== null && _formValue$textNamePr !== void 0 ? _formValue$textNamePr : record === null || record === void 0 ? void 0 : record[textNameProp];
|
|
235
|
-
var val = (_formValue$name = formValue === null || formValue === void 0 ? void 0 : formValue[name]) !== null && _formValue$name !== void 0 ? _formValue$name : record === null || record === void 0 ? void 0 : record[name];
|
|
236
|
-
setText(txt !== null && txt !== void 0 ? txt : val);
|
|
237
|
-
if (val && !txt) {
|
|
238
|
-
formValue[textNameProp] = val;
|
|
239
|
-
setFormValue(formValue);
|
|
240
|
-
// 多值选择或选择的初始值不在第一页时显示有问题
|
|
241
|
-
if (textField !== valueField) {
|
|
242
|
-
initName(val);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}, [rowKey]);
|
|
246
246
|
var initName = function initName(val) {
|
|
247
247
|
var _columns$find;
|
|
248
248
|
if (!val) return;
|
|
@@ -251,14 +251,18 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
251
251
|
})) === null || _columns$find === void 0 ? void 0 : _columns$find.searchField) || valueField;
|
|
252
252
|
var param = {
|
|
253
253
|
current: 1,
|
|
254
|
-
pageSize:
|
|
254
|
+
pageSize: 1000
|
|
255
255
|
};
|
|
256
256
|
if (Array.isArray(val)) val = val.join(',');
|
|
257
257
|
if (val.toString().includes(',')) {
|
|
258
258
|
fieldName += '_in';
|
|
259
259
|
}
|
|
260
|
+
if (isV2) {
|
|
261
|
+
fieldName = 'search.' + fieldName;
|
|
262
|
+
}
|
|
260
263
|
param[fieldName] = val;
|
|
261
264
|
loadData(param).then(function (result) {
|
|
265
|
+
initRows.current = result.data;
|
|
262
266
|
var rows = (result.data || []).filter(function (o) {
|
|
263
267
|
return o;
|
|
264
268
|
});
|
|
@@ -272,6 +276,23 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
272
276
|
setFormValue(formValue);
|
|
273
277
|
});
|
|
274
278
|
};
|
|
279
|
+
// 初始化数据,主要设置名称
|
|
280
|
+
useEffect(function () {
|
|
281
|
+
var _formValue$textNamePr, _formValue$name;
|
|
282
|
+
var formValue = getFormValue();
|
|
283
|
+
if (!formValue) return;
|
|
284
|
+
var txt = (_formValue$textNamePr = formValue === null || formValue === void 0 ? void 0 : formValue[textNameProp]) !== null && _formValue$textNamePr !== void 0 ? _formValue$textNamePr : record === null || record === void 0 ? void 0 : record[textNameProp];
|
|
285
|
+
var val = (_formValue$name = formValue === null || formValue === void 0 ? void 0 : formValue[name]) !== null && _formValue$name !== void 0 ? _formValue$name : record === null || record === void 0 ? void 0 : record[name];
|
|
286
|
+
setText(txt !== null && txt !== void 0 ? txt : val);
|
|
287
|
+
if (val && !txt) {
|
|
288
|
+
formValue[textNameProp] = val;
|
|
289
|
+
setFormValue(formValue);
|
|
290
|
+
// 多值选择或选择的初始值不在第一页时显示有问题
|
|
291
|
+
if (textField !== valueField) {
|
|
292
|
+
initName(val);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}, [rowKey]);
|
|
275
296
|
// 处理返回数据
|
|
276
297
|
var handleValue = function handleValue(row) {
|
|
277
298
|
var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
@@ -320,10 +341,10 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
320
341
|
}
|
|
321
342
|
};
|
|
322
343
|
var handleClear = function handleClear() {
|
|
323
|
-
var _tableRef$
|
|
344
|
+
var _tableRef$current3, _tableRef$current3$cl;
|
|
324
345
|
selectRowRef.current = [];
|
|
325
346
|
setSelectedKeys([]);
|
|
326
|
-
(_tableRef$
|
|
347
|
+
(_tableRef$current3 = tableRef.current) === null || _tableRef$current3 === void 0 ? void 0 : (_tableRef$current3$cl = _tableRef$current3.clearSelected) === null || _tableRef$current3$cl === void 0 ? void 0 : _tableRef$current3$cl.call(_tableRef$current3);
|
|
327
348
|
setText('');
|
|
328
349
|
var formValue = getFormValue();
|
|
329
350
|
if (!formValue) return;
|
|
@@ -376,17 +397,22 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
376
397
|
}
|
|
377
398
|
}
|
|
378
399
|
};
|
|
400
|
+
useImperativeHandle(ref, function () {
|
|
401
|
+
return _objectSpread(_objectSpread({}, inputRef.current), {}, {
|
|
402
|
+
clear: handleClear
|
|
403
|
+
});
|
|
404
|
+
});
|
|
379
405
|
useEffect(function () {
|
|
380
406
|
if (!text && multiple) {
|
|
381
|
-
var _tableRef$
|
|
407
|
+
var _tableRef$current4, _tableRef$current4$cl;
|
|
382
408
|
selectRowRef.current = [];
|
|
383
|
-
(_tableRef$
|
|
409
|
+
(_tableRef$current4 = tableRef.current) === null || _tableRef$current4 === void 0 ? void 0 : (_tableRef$current4$cl = _tableRef$current4.clearSelected) === null || _tableRef$current4$cl === void 0 ? void 0 : _tableRef$current4$cl.call(_tableRef$current4);
|
|
384
410
|
}
|
|
385
411
|
}, [text, multiple]);
|
|
386
412
|
useEffect(function () {
|
|
387
413
|
if (visible && loadOnShow) {
|
|
388
|
-
var _tableRef$
|
|
389
|
-
(_tableRef$
|
|
414
|
+
var _tableRef$current5, _tableRef$current5$re;
|
|
415
|
+
(_tableRef$current5 = tableRef.current) === null || _tableRef$current5 === void 0 ? void 0 : (_tableRef$current5$re = _tableRef$current5.reload) === null || _tableRef$current5$re === void 0 ? void 0 : _tableRef$current5$re.call(_tableRef$current5);
|
|
390
416
|
}
|
|
391
417
|
}, [visible, loadOnShow]);
|
|
392
418
|
var tableDom = /*#__PURE__*/React.createElement(ProTable, _extends({
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @name 防抖按钮 */
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import { type ButtonProps, TooltipProps } from 'antd';
|
|
4
|
+
export interface ProButtonProps extends ButtonProps {
|
|
5
|
+
/** @name 防抖时间,默认为300ms */
|
|
6
|
+
time?: number;
|
|
7
|
+
tip?: JSX.Element | string;
|
|
8
|
+
tipProps?: TooltipProps;
|
|
9
|
+
}
|
|
10
|
+
export default function ProButton(props: ProButtonProps): JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import "antd/es/tooltip/style";
|
|
2
|
+
import _Tooltip from "antd/es/tooltip";
|
|
3
|
+
import "antd/es/button/style";
|
|
4
|
+
import _Button from "antd/es/button";
|
|
5
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
6
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
|
+
var _excluded = ["onClick", "time", "tip", "tipProps"];
|
|
8
|
+
import React from "react";
|
|
9
|
+
/** @name 防抖按钮 */
|
|
10
|
+
import { useRef } from 'react';
|
|
11
|
+
export default function ProButton(props) {
|
|
12
|
+
var onClick = props.onClick,
|
|
13
|
+
_props$time = props.time,
|
|
14
|
+
time = _props$time === void 0 ? 300 : _props$time,
|
|
15
|
+
tip = props.tip,
|
|
16
|
+
tipProps = props.tipProps,
|
|
17
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
18
|
+
var clickTime = useRef(0);
|
|
19
|
+
var handleClick = function handleClick(e) {
|
|
20
|
+
if (time > 0) {
|
|
21
|
+
var now = Date.now();
|
|
22
|
+
if (now - clickTime.current > time) {
|
|
23
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
24
|
+
}
|
|
25
|
+
clickTime.current = now;
|
|
26
|
+
} else {
|
|
27
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
if (tip) {
|
|
31
|
+
return /*#__PURE__*/React.createElement(_Tooltip, _extends({}, tipProps, {
|
|
32
|
+
title: tip
|
|
33
|
+
}), /*#__PURE__*/React.createElement(_Button, _extends({
|
|
34
|
+
onClick: handleClick
|
|
35
|
+
}, rest)));
|
|
36
|
+
}
|
|
37
|
+
return /*#__PURE__*/React.createElement(_Button, _extends({
|
|
38
|
+
onClick: handleClick
|
|
39
|
+
}, rest));
|
|
40
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 记录变更日志
|
|
3
|
+
*
|
|
4
|
+
* @param recordKey 记录key
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import './index.less';
|
|
8
|
+
export interface RecordLogProps {
|
|
9
|
+
recordKey: string;
|
|
10
|
+
fieldsMap?: Record<string, string>;
|
|
11
|
+
showResourceName?: boolean;
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const RecordLog: (props: RecordLogProps) => JSX.Element;
|
|
16
|
+
export default RecordLog;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import "antd/es/empty/style";
|
|
2
|
+
import _Empty from "antd/es/empty";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
/**
|
|
5
|
+
* 记录变更日志
|
|
6
|
+
*
|
|
7
|
+
* @param recordKey 记录key
|
|
8
|
+
*/
|
|
9
|
+
import React, { useEffect, useState, useMemo } from 'react';
|
|
10
|
+
import { EditOutlined, ArrowRightOutlined } from '@ant-design/icons';
|
|
11
|
+
import { httpGet } from '../../http';
|
|
12
|
+
import './index.less';
|
|
13
|
+
var OP_TYPE_MAP = {
|
|
14
|
+
A: '新增',
|
|
15
|
+
U: '编辑',
|
|
16
|
+
D: '删除'
|
|
17
|
+
};
|
|
18
|
+
var RecordLog = function RecordLog(props) {
|
|
19
|
+
var _useState = useState([]),
|
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
+
logData = _useState2[0],
|
|
22
|
+
setLogData = _useState2[1];
|
|
23
|
+
var _props$recordKey = props.recordKey,
|
|
24
|
+
recordKey = _props$recordKey === void 0 ? '' : _props$recordKey,
|
|
25
|
+
_props$fieldsMap = props.fieldsMap,
|
|
26
|
+
fieldsMap = _props$fieldsMap === void 0 ? {} : _props$fieldsMap,
|
|
27
|
+
_props$showResourceNa = props.showResourceName,
|
|
28
|
+
showResourceName = _props$showResourceNa === void 0 ? true : _props$showResourceNa,
|
|
29
|
+
style = props.style,
|
|
30
|
+
_props$className = props.className,
|
|
31
|
+
className = _props$className === void 0 ? '' : _props$className;
|
|
32
|
+
var getLogData = function getLogData() {
|
|
33
|
+
var url = '/lesoon-petrel-behaviour-api/behUserOperateLog/page';
|
|
34
|
+
var params = {
|
|
35
|
+
pageSize: 5000,
|
|
36
|
+
sort: 'createTime desc',
|
|
37
|
+
where: {
|
|
38
|
+
dataCode: recordKey
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
httpGet(url, params).then(function (res) {
|
|
42
|
+
var rows = (res === null || res === void 0 ? void 0 : res.rows) || [];
|
|
43
|
+
rows.forEach(function (row) {
|
|
44
|
+
try {
|
|
45
|
+
row.content = JSON.parse(row.content);
|
|
46
|
+
row.content.forEach(function (item) {
|
|
47
|
+
var o = item.oldValue || '';
|
|
48
|
+
item.oldValue = !o || o == '[]' || (o === null || o === void 0 ? void 0 : o.length) == 0 ? '空' : o + '';
|
|
49
|
+
var n = item.newValue || '';
|
|
50
|
+
item.newValue = !n || n == '[]' || (n === null || n === void 0 ? void 0 : n.length) == 0 ? '空' : n + '';
|
|
51
|
+
item.fieldDisPlayName = fieldsMap[item.fieldName] || item.fieldDisPlayName;
|
|
52
|
+
});
|
|
53
|
+
} catch (_unused) {
|
|
54
|
+
row.content = [];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
setLogData(rows);
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
if (!recordKey) return;
|
|
62
|
+
getLogData();
|
|
63
|
+
}, [recordKey]);
|
|
64
|
+
var renderFields = function renderFields(fields) {
|
|
65
|
+
if (!fields || !fields.length) return null;
|
|
66
|
+
return fields.map(function (field) {
|
|
67
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: "log-item-field",
|
|
69
|
+
key: Math.random() + ''
|
|
70
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
71
|
+
className: "log-item-label"
|
|
72
|
+
}, field.fieldDisPlayName, " :"), /*#__PURE__*/React.createElement("span", {
|
|
73
|
+
className: "log-item-value"
|
|
74
|
+
}, field.oldValue), /*#__PURE__*/React.createElement(ArrowRightOutlined, {
|
|
75
|
+
style: {
|
|
76
|
+
fontSize: '14px',
|
|
77
|
+
margin: '0 10px'
|
|
78
|
+
}
|
|
79
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
80
|
+
className: "log-item-value"
|
|
81
|
+
}, field.newValue));
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
var LogDom = useMemo(function () {
|
|
85
|
+
return logData.map(function (item) {
|
|
86
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
className: "record-log-item"
|
|
88
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
className: "log-item-time"
|
|
90
|
+
}, item.createTime), /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
className: "log-item-center"
|
|
92
|
+
}, /*#__PURE__*/React.createElement(EditOutlined, {
|
|
93
|
+
style: {
|
|
94
|
+
fontSize: '20px'
|
|
95
|
+
}
|
|
96
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: "log-item-line"
|
|
98
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
className: "log-item-box"
|
|
100
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: "log-item-header"
|
|
102
|
+
}, showResourceName && /*#__PURE__*/React.createElement("span", null, item.resourceName || ''), /*#__PURE__*/React.createElement("span", null, item.creator || ''), /*#__PURE__*/React.createElement("span", null, OP_TYPE_MAP[item.operateType] || OP_TYPE_MAP['U']), /*#__PURE__*/React.createElement("span", null, item.dataName || ''), /*#__PURE__*/React.createElement("span", null, item.dataCode || '')), /*#__PURE__*/React.createElement("div", {
|
|
103
|
+
className: "log-item-content"
|
|
104
|
+
}, renderFields(item.content)))));
|
|
105
|
+
});
|
|
106
|
+
}, [logData]);
|
|
107
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: "record-log ".concat(className),
|
|
109
|
+
style: style
|
|
110
|
+
}, logData.length ? LogDom : /*#__PURE__*/React.createElement(_Empty, {
|
|
111
|
+
description: "\u6682\u65E0\u53D8\u66F4\u6570\u636E"
|
|
112
|
+
}));
|
|
113
|
+
};
|
|
114
|
+
export default RecordLog;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
.record-log {
|
|
2
|
+
height: 100%;
|
|
3
|
+
padding: 8px;
|
|
4
|
+
overflow: auto;
|
|
5
|
+
border: 1px solid #f1f0f0;
|
|
6
|
+
|
|
7
|
+
.record-log-item {
|
|
8
|
+
display: flex;
|
|
9
|
+
margin-bottom: 8px;
|
|
10
|
+
}
|
|
11
|
+
.log-item-time {
|
|
12
|
+
flex-wrap: wrap;
|
|
13
|
+
color: #a1a0a1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.log-item-center {
|
|
17
|
+
position: relative;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
margin: 0 10px;
|
|
21
|
+
.log-item-line {
|
|
22
|
+
position: relative;
|
|
23
|
+
flex: 1;
|
|
24
|
+
width: 0.5px;
|
|
25
|
+
margin: auto;
|
|
26
|
+
border: 1px dashed #dcdbdb;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.log-item-box {
|
|
31
|
+
margin-bottom: 5px;
|
|
32
|
+
border: 1px solid #eee;
|
|
33
|
+
border-radius: 6px;
|
|
34
|
+
|
|
35
|
+
&:hover {
|
|
36
|
+
box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.2);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.log-item-header {
|
|
40
|
+
padding: 8px 5px;
|
|
41
|
+
color: #000;
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
background-color: #f3f7fc;
|
|
44
|
+
border-radius: 6px 6px 0 0;
|
|
45
|
+
span {
|
|
46
|
+
padding: 0 5px;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.log-item-content {
|
|
51
|
+
padding: 5px 0;
|
|
52
|
+
padding-left: 12px;
|
|
53
|
+
background: #fff;
|
|
54
|
+
border-bottom-right-radius: 6px;
|
|
55
|
+
border-bottom-left-radius: 6px;
|
|
56
|
+
|
|
57
|
+
.log-item-field {
|
|
58
|
+
padding: 3px 5px;
|
|
59
|
+
|
|
60
|
+
.log-item-label {
|
|
61
|
+
padding-right: 10px;
|
|
62
|
+
color: #a1a0a1;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.log-item-value {
|
|
66
|
+
color: #000;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { getMdmData } from '../http/mdmRequest';
|
|
6
|
+
export default function (props) {
|
|
7
|
+
var type = props.type,
|
|
8
|
+
_props$params = props.params,
|
|
9
|
+
params = _props$params === void 0 ? {} : _props$params;
|
|
10
|
+
var _useState = useState([]),
|
|
11
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
12
|
+
list = _useState2[0],
|
|
13
|
+
setList = _useState2[1];
|
|
14
|
+
var _useState3 = useState(false),
|
|
15
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
16
|
+
loading = _useState4[0],
|
|
17
|
+
setLoading = _useState4[1];
|
|
18
|
+
var run = /*#__PURE__*/function () {
|
|
19
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
20
|
+
var res, rows;
|
|
21
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
22
|
+
while (1) switch (_context.prev = _context.next) {
|
|
23
|
+
case 0:
|
|
24
|
+
_context.prev = 0;
|
|
25
|
+
setLoading(true);
|
|
26
|
+
_context.next = 4;
|
|
27
|
+
return getMdmData(type, params);
|
|
28
|
+
case 4:
|
|
29
|
+
res = _context.sent;
|
|
30
|
+
rows = res.rows || [];
|
|
31
|
+
setList(rows);
|
|
32
|
+
case 7:
|
|
33
|
+
_context.prev = 7;
|
|
34
|
+
setLoading(false);
|
|
35
|
+
return _context.finish(7);
|
|
36
|
+
case 10:
|
|
37
|
+
case "end":
|
|
38
|
+
return _context.stop();
|
|
39
|
+
}
|
|
40
|
+
}, _callee, null, [[0,, 7, 10]]);
|
|
41
|
+
}));
|
|
42
|
+
return function run() {
|
|
43
|
+
return _ref.apply(this, arguments);
|
|
44
|
+
};
|
|
45
|
+
}();
|
|
46
|
+
return [run, list, setList, loading];
|
|
47
|
+
}
|
package/es/http/index.d.ts
CHANGED
|
@@ -40,8 +40,9 @@ export declare function httpDelete(url: string, data: any, needGateWay?: boolean
|
|
|
40
40
|
* 读取数据字典
|
|
41
41
|
*
|
|
42
42
|
* @param dictCode 字典编码
|
|
43
|
+
* @param showValue 是否显示值
|
|
43
44
|
* @param needGateWay 是否需要网关 默认为true
|
|
44
|
-
* @returns Promise<Record<string,string
|
|
45
|
+
* @returns Promise<Record<string,string>[]>
|
|
45
46
|
*/
|
|
46
47
|
export declare function getDict(dictCode: string, showValue?: boolean, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
47
48
|
/**
|