@innoways/drip-form-theme-antd 6.3.2 → 6.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/index.js +217 -63
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -17,20 +17,20 @@ import 'antd/es/col/style';
|
|
|
17
17
|
import _Col from 'antd/es/col';
|
|
18
18
|
import 'antd/es/select/style';
|
|
19
19
|
import _Select from 'antd/es/select';
|
|
20
|
+
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
20
21
|
import 'antd/es/message/style';
|
|
21
22
|
import _message from 'antd/es/message';
|
|
22
|
-
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
23
23
|
import 'antd/es/form/style';
|
|
24
24
|
import _Form from 'antd/es/form';
|
|
25
25
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
26
26
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
27
|
+
import { fetchFn, typeCheck, isEmpty, binaryData2Blob, checkImg, isValidHttpUrl, fetchFnJsonKey } from '@innoways/utils';
|
|
27
28
|
import 'antd/es/radio/style';
|
|
28
29
|
import _Radio from 'antd/es/radio';
|
|
29
30
|
import reactIs from 'react-is';
|
|
30
31
|
import 'antd/es/tooltip/style';
|
|
31
32
|
import _Tooltip from 'antd/es/tooltip';
|
|
32
33
|
import { QuestionCircleOutlined, InboxOutlined, PlusOutlined, UploadOutlined } from '@ant-design/icons';
|
|
33
|
-
import { typeCheck, isEmpty, binaryData2Blob, checkImg, isValidHttpUrl, fetchFnJsonKey } from '@innoways/utils';
|
|
34
34
|
import { Collapse, Button, Popconfirm } from 'antd';
|
|
35
35
|
import 'antd/es/input-number/style';
|
|
36
36
|
import _InputNumber from 'antd/es/input-number';
|
|
@@ -66,10 +66,27 @@ import _TreeSelect from 'antd/es/tree-select';
|
|
|
66
66
|
function ownKeys$f(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
67
67
|
|
|
68
68
|
function _objectSpread$f(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$f(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$f(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
69
|
+
var searchTypes = [{
|
|
70
|
+
label: 'Google',
|
|
71
|
+
value: 'WGS84'
|
|
72
|
+
}, {
|
|
73
|
+
label: 'Amap',
|
|
74
|
+
value: 'GCJ02'
|
|
75
|
+
}];
|
|
69
76
|
|
|
70
77
|
function GpsModal(_ref) {
|
|
71
78
|
var isOpen = _ref.isOpen,
|
|
72
|
-
setIsOpen = _ref.setIsOpen
|
|
79
|
+
setIsOpen = _ref.setIsOpen,
|
|
80
|
+
onChange = _ref.onChange;
|
|
81
|
+
var columns = [{
|
|
82
|
+
title: 'Address',
|
|
83
|
+
dataIndex: 'address',
|
|
84
|
+
key: 'address'
|
|
85
|
+
}, {
|
|
86
|
+
title: 'Location',
|
|
87
|
+
dataIndex: 'location',
|
|
88
|
+
key: 'location'
|
|
89
|
+
}];
|
|
73
90
|
|
|
74
91
|
var _useState = useState({
|
|
75
92
|
type: '',
|
|
@@ -81,19 +98,96 @@ function GpsModal(_ref) {
|
|
|
81
98
|
gpsData = _useState2[0],
|
|
82
99
|
setGpsData = _useState2[1];
|
|
83
100
|
|
|
84
|
-
var _useState3 = useState(
|
|
85
|
-
_useState4 = _slicedToArray(_useState3, 2)
|
|
86
|
-
_useState4[0]
|
|
87
|
-
_useState4[1];
|
|
101
|
+
var _useState3 = useState(3),
|
|
102
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
103
|
+
pageSize = _useState4[0],
|
|
104
|
+
setPageSize = _useState4[1];
|
|
105
|
+
|
|
106
|
+
var _useState5 = useState([]),
|
|
107
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
108
|
+
selectedRows = _useState6[0],
|
|
109
|
+
setSelectedRows = _useState6[1];
|
|
110
|
+
|
|
111
|
+
var _useState7 = useState([]),
|
|
112
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
113
|
+
selectedRowKeys = _useState8[0],
|
|
114
|
+
setSelectedRowKeys = _useState8[1];
|
|
115
|
+
|
|
116
|
+
var _useState9 = useState(false),
|
|
117
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
118
|
+
loading = _useState10[0],
|
|
119
|
+
setLoading = _useState10[1];
|
|
120
|
+
|
|
121
|
+
var _useState11 = useState([]),
|
|
122
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
123
|
+
gpApiData = _useState12[0],
|
|
124
|
+
setGpApiData = _useState12[1];
|
|
88
125
|
|
|
89
126
|
var _Form$useForm = _Form.useForm(),
|
|
90
127
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
91
128
|
form = _Form$useForm2[0];
|
|
92
129
|
|
|
130
|
+
var baseSearchUrl = 'http://localhost:8000/api/v1/gps/searchGps';
|
|
131
|
+
|
|
93
132
|
var handleGpsDataChange = function handleGpsDataChange(value, name) {
|
|
94
133
|
setGpsData(_objectSpread$f(_objectSpread$f({}, gpsData), {}, _defineProperty({}, name, value)));
|
|
95
134
|
};
|
|
96
135
|
|
|
136
|
+
var handleResult = function handleResult(result1, type, addressFg) {
|
|
137
|
+
if (type == searchTypes[1].value) {
|
|
138
|
+
if (result1.status == '1') {
|
|
139
|
+
if (addressFg) {
|
|
140
|
+
//By Address
|
|
141
|
+
if (result1.geocodes) {
|
|
142
|
+
return result1.geocodes.map(function (item) {
|
|
143
|
+
return {
|
|
144
|
+
key: item.formatted_address,
|
|
145
|
+
address: item.formatted_address,
|
|
146
|
+
location: item.location,
|
|
147
|
+
longitude: item.location.split(',')[0],
|
|
148
|
+
latitude: item.location.split(',')[1]
|
|
149
|
+
};
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
//By Location
|
|
154
|
+
if (result1.regeocode) {
|
|
155
|
+
var _result1$regeocode = result1.regeocode,
|
|
156
|
+
formatted_address = _result1$regeocode.formatted_address,
|
|
157
|
+
addressComponent = _result1$regeocode.addressComponent;
|
|
158
|
+
return [{
|
|
159
|
+
key: formatted_address,
|
|
160
|
+
address: formatted_address,
|
|
161
|
+
location: addressComponent.streetNumber.location,
|
|
162
|
+
longitude: addressComponent.streetNumber.location.split(',')[0],
|
|
163
|
+
latitude: addressComponent.streetNumber.location.split(',')[1]
|
|
164
|
+
}];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
} else {
|
|
169
|
+
//谷歌
|
|
170
|
+
if (result1.status == 'OK') {
|
|
171
|
+
//By Address & By Location
|
|
172
|
+
if (result1.results) {
|
|
173
|
+
return result1.results.map(function (item) {
|
|
174
|
+
return {
|
|
175
|
+
key: item.formatted_address,
|
|
176
|
+
address: item.formatted_address,
|
|
177
|
+
location: "".concat(item.geometry.location.lng, ",").concat(item.geometry.location.lat),
|
|
178
|
+
longitude: item.geometry.location.lng,
|
|
179
|
+
latitude: item.geometry.location.lat
|
|
180
|
+
};
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
_message.error('Location not found!', 2);
|
|
187
|
+
|
|
188
|
+
return [];
|
|
189
|
+
};
|
|
190
|
+
|
|
97
191
|
var handleValidate = function handleValidate() {
|
|
98
192
|
form.validateFields(['type', 'address']);
|
|
99
193
|
var type = gpsData.type,
|
|
@@ -139,38 +233,41 @@ function GpsModal(_ref) {
|
|
|
139
233
|
while (1) {
|
|
140
234
|
switch (_context.prev = _context.next) {
|
|
141
235
|
case 0:
|
|
236
|
+
setLoading(true);
|
|
237
|
+
|
|
142
238
|
if (!handleValidate()) {
|
|
143
|
-
_context.next =
|
|
239
|
+
_context.next = 4;
|
|
144
240
|
break;
|
|
145
241
|
}
|
|
146
242
|
|
|
147
|
-
_context.next =
|
|
148
|
-
return
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
243
|
+
_context.next = 4;
|
|
244
|
+
return fetchFn({
|
|
245
|
+
url: baseSearchUrl,
|
|
246
|
+
params: [{
|
|
247
|
+
key: 'type',
|
|
248
|
+
value: gpsData.type
|
|
249
|
+
}, {
|
|
250
|
+
key: 'address',
|
|
251
|
+
value: gpsData.address
|
|
252
|
+
}, {
|
|
253
|
+
key: 'ostype',
|
|
254
|
+
value: 'DynamicForm'
|
|
255
|
+
}],
|
|
256
|
+
method: 'POST'
|
|
160
257
|
}).then(function (res) {
|
|
161
|
-
if (res.
|
|
162
|
-
var
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
258
|
+
if (res.Code === 0) {
|
|
259
|
+
var getDetails = res.Data;
|
|
260
|
+
setGpApiData(handleResult(getDetails, gpsData.type, true));
|
|
261
|
+
} else {
|
|
262
|
+
_message.error('Address not found!', 2);
|
|
166
263
|
}
|
|
167
|
-
})["catch"](function (
|
|
168
|
-
console.log('err', err === null || err === void 0 ? void 0 : err.response);
|
|
169
|
-
|
|
264
|
+
})["catch"](function () {
|
|
170
265
|
_message.error('Address not found!', 2);
|
|
266
|
+
})["finally"](function () {
|
|
267
|
+
setLoading(false);
|
|
171
268
|
});
|
|
172
269
|
|
|
173
|
-
case
|
|
270
|
+
case 4:
|
|
174
271
|
case "end":
|
|
175
272
|
return _context.stop();
|
|
176
273
|
}
|
|
@@ -195,29 +292,33 @@ function GpsModal(_ref) {
|
|
|
195
292
|
}
|
|
196
293
|
|
|
197
294
|
_context2.next = 3;
|
|
198
|
-
return
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
295
|
+
return fetchFn({
|
|
296
|
+
url: baseSearchUrl,
|
|
297
|
+
params: [{
|
|
298
|
+
key: 'type',
|
|
299
|
+
value: gpsData.type
|
|
300
|
+
}, {
|
|
301
|
+
key: 'latitude',
|
|
302
|
+
value: gpsData.latitude
|
|
303
|
+
}, {
|
|
304
|
+
key: 'longitude',
|
|
305
|
+
value: gpsData.longitude
|
|
306
|
+
}, {
|
|
307
|
+
key: 'ostype',
|
|
308
|
+
value: 'DynamicForm'
|
|
309
|
+
}],
|
|
310
|
+
method: 'POST'
|
|
208
311
|
}).then(function (res) {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
var getDetails = res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.data;
|
|
215
|
-
console.log(getDetails); // setGpsData(getDetails)
|
|
312
|
+
if (res.Code === 0) {
|
|
313
|
+
var getDetails = res.Data;
|
|
314
|
+
setGpApiData(handleResult(getDetails, gpsData.type, false));
|
|
315
|
+
} else {
|
|
316
|
+
_message.error('Location not found!', 2);
|
|
216
317
|
}
|
|
217
|
-
})["catch"](function (
|
|
218
|
-
console.log('err', err === null || err === void 0 ? void 0 : err.response);
|
|
219
|
-
|
|
318
|
+
})["catch"](function () {
|
|
220
319
|
_message.error('Location not found!', 2);
|
|
320
|
+
})["finally"](function () {
|
|
321
|
+
setLoading(false);
|
|
221
322
|
});
|
|
222
323
|
|
|
223
324
|
case 3:
|
|
@@ -233,12 +334,51 @@ function GpsModal(_ref) {
|
|
|
233
334
|
};
|
|
234
335
|
}();
|
|
235
336
|
|
|
337
|
+
var rowSelection = {
|
|
338
|
+
type: 'radio',
|
|
339
|
+
onChange: function onChange(selRowKeys, selRows) {
|
|
340
|
+
setSelectedRowKeys(selRowKeys);
|
|
341
|
+
setSelectedRows(selRows);
|
|
342
|
+
},
|
|
343
|
+
selectedRowKeys: selectedRowKeys
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
var beforeSearch = function beforeSearch() {
|
|
347
|
+
setLoading(true);
|
|
348
|
+
setSelectedRows([]);
|
|
349
|
+
setSelectedRowKeys([]);
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
var reset = function reset() {
|
|
353
|
+
setSelectedRows([]);
|
|
354
|
+
setSelectedRowKeys([]);
|
|
355
|
+
setGpApiData([]);
|
|
356
|
+
setGpsData({
|
|
357
|
+
type: '',
|
|
358
|
+
address: '',
|
|
359
|
+
latitude: '',
|
|
360
|
+
longitude: ''
|
|
361
|
+
});
|
|
362
|
+
form.resetFields();
|
|
363
|
+
setLoading(false);
|
|
364
|
+
setIsOpen(false);
|
|
365
|
+
};
|
|
366
|
+
|
|
236
367
|
return /*#__PURE__*/React.createElement(_Modal, {
|
|
237
368
|
title: "Modal",
|
|
238
369
|
visible: isOpen,
|
|
239
|
-
|
|
370
|
+
okButtonProps: {
|
|
371
|
+
disabled: selectedRows.length === 0
|
|
372
|
+
},
|
|
373
|
+
onOk: function onOk() {
|
|
374
|
+
if (selectedRows.length > 0) {
|
|
375
|
+
onChange(selectedRows[0].address || '');
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
reset();
|
|
379
|
+
},
|
|
240
380
|
onCancel: function onCancel() {
|
|
241
|
-
|
|
381
|
+
reset();
|
|
242
382
|
},
|
|
243
383
|
okText: "Save",
|
|
244
384
|
cancelText: "Cancel"
|
|
@@ -254,13 +394,7 @@ function GpsModal(_ref) {
|
|
|
254
394
|
message: 'Please select type!'
|
|
255
395
|
}]
|
|
256
396
|
}, /*#__PURE__*/React.createElement(_Select, {
|
|
257
|
-
options:
|
|
258
|
-
label: 'Google',
|
|
259
|
-
value: 'WGS84'
|
|
260
|
-
}, {
|
|
261
|
-
label: 'Amap',
|
|
262
|
-
value: 'GCJ02'
|
|
263
|
-
}],
|
|
397
|
+
options: searchTypes,
|
|
264
398
|
value: gpsData.type,
|
|
265
399
|
onChange: function onChange(e) {
|
|
266
400
|
return handleGpsDataChange(e, 'type');
|
|
@@ -292,7 +426,8 @@ function GpsModal(_ref) {
|
|
|
292
426
|
}, /*#__PURE__*/React.createElement(_Button, {
|
|
293
427
|
color: "primary",
|
|
294
428
|
onClick: function onClick() {
|
|
295
|
-
|
|
429
|
+
beforeSearch();
|
|
430
|
+
handleAddressSearch();
|
|
296
431
|
}
|
|
297
432
|
}, "Search")))), /*#__PURE__*/React.createElement(_Col, {
|
|
298
433
|
span: 24
|
|
@@ -336,11 +471,29 @@ function GpsModal(_ref) {
|
|
|
336
471
|
},
|
|
337
472
|
color: "primary",
|
|
338
473
|
onClick: function onClick() {
|
|
339
|
-
|
|
474
|
+
beforeSearch();
|
|
475
|
+
handleLocationSearch();
|
|
340
476
|
}
|
|
341
477
|
}, "Search")))))), /*#__PURE__*/React.createElement("div", {
|
|
342
478
|
className: "servicesTable mb-1 mt-1"
|
|
343
|
-
}, /*#__PURE__*/React.createElement(_Table,
|
|
479
|
+
}, /*#__PURE__*/React.createElement(_Table, {
|
|
480
|
+
pagination: {
|
|
481
|
+
pageSize: pageSize,
|
|
482
|
+
pageSizeOptions: ['3', '10', '20', '50'],
|
|
483
|
+
total: gpApiData.length,
|
|
484
|
+
showSizeChanger: true,
|
|
485
|
+
showTotal: function showTotal(total) {
|
|
486
|
+
return "Total ".concat(total, " items");
|
|
487
|
+
},
|
|
488
|
+
onChange: function onChange(page, pageSize) {
|
|
489
|
+
setPageSize(pageSize);
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
columns: columns,
|
|
493
|
+
dataSource: gpApiData,
|
|
494
|
+
rowSelection: rowSelection,
|
|
495
|
+
loading: loading
|
|
496
|
+
})));
|
|
344
497
|
}
|
|
345
498
|
|
|
346
499
|
/**
|
|
@@ -492,7 +645,8 @@ var PlaceAutoCompleteField = function PlaceAutoCompleteField(_ref) {
|
|
|
492
645
|
style: style
|
|
493
646
|
}, restProps)), /*#__PURE__*/React.createElement(GpsModal, {
|
|
494
647
|
isOpen: globalState.webModalForPlaceAutoCompleteField === fieldKey,
|
|
495
|
-
setIsOpen: handleIsGPSModalOpen
|
|
648
|
+
setIsOpen: handleIsGPSModalOpen,
|
|
649
|
+
onChange: _onChange
|
|
496
650
|
}));
|
|
497
651
|
};
|
|
498
652
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@innoways/drip-form-theme-antd",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.3",
|
|
4
4
|
"author": "JDFED",
|
|
5
5
|
"description": "drip-form antd主题包",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@ant-design/icons": "^4.7.0",
|
|
33
33
|
"@babel/runtime": "^7.10.2",
|
|
34
|
-
"@innoways/hooks": "^6.3.
|
|
35
|
-
"@innoways/utils": "^6.3.
|
|
34
|
+
"@innoways/hooks": "^6.3.3",
|
|
35
|
+
"@innoways/utils": "^6.3.3",
|
|
36
36
|
"antd": "^4.16.13",
|
|
37
37
|
"flatpickr": "^4.6.13",
|
|
38
38
|
"moment": "^2.26.0",
|