hy-dispatch-ui-v3 0.2.61 → 0.2.62

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.
Files changed (66) hide show
  1. package/dist/tailwind.css +66 -0
  2. package/es/api/device.mjs +18 -0
  3. package/es/api/index.mjs +1 -1
  4. package/es/api/sypct.mjs +18 -0
  5. package/es/api/task.mjs +18 -0
  6. package/es/bussiness/hyMapAearchPlace/index.mjs +6 -0
  7. package/es/bussiness/hyMapAearchPlace/js/index.mjs +653 -0
  8. package/es/bussiness/hyMapAearchPlace/mapAearchPlace.vue.mjs +347 -0
  9. package/es/bussiness/hyMapAearchPlace/mapAearchPlaceItem.vue.mjs +99 -0
  10. package/es/bussiness/hyMapAearchPlace/style/mapAearchPlace.scss +71 -0
  11. package/es/bussiness/index.mjs +1 -0
  12. package/es/components/hyBatchUploadDialog/batchUploadDialog.vue.mjs +22 -3
  13. package/es/components/hyButton/style/button.scss +1 -1
  14. package/es/components/hyConfigProvider/configProvider.vue.mjs +4 -0
  15. package/es/components/hyConfirmDialog/confirmDialog.vue.mjs +2 -2
  16. package/es/components/hyDialog/dialog.vue.mjs +24 -4
  17. package/es/components/hyForm/cpns/locationSelect.vue.mjs +3 -1
  18. package/es/components/hyMap/map.vue.mjs +10 -3
  19. package/es/components/hySearch/cpns/searchItem.vue.mjs +17 -1
  20. package/es/components/hyTable/table.vue.mjs +8 -1
  21. package/es/components/hyTableForm/batchTableForm.vue.mjs +36 -59
  22. package/es/components/hyTableForm/js/index.mjs +8 -58
  23. package/es/components/hyTableForm/tableForm.vue.mjs +9 -3
  24. package/es/hooks/index.mjs +1 -0
  25. package/es/hooks/useGlobalConfig.mjs +5 -0
  26. package/es/hooks/useMapConfig.mjs +18 -0
  27. package/es/index.mjs +2 -0
  28. package/es/static/hy-svg-icons/hy-icon-ops-list-editorialdownsizing.js +14 -0
  29. package/es/static/hy-svg-icons/hy-icon-ops-list-suoxiao.js +14 -0
  30. package/es/style/element/hy-element.scss +10 -1
  31. package/es/utils/form.mjs +5 -1
  32. package/es/utils/map/js/webgis.mjs +1 -1
  33. package/es/version.mjs +1 -1
  34. package/lib/api/device.js +20 -0
  35. package/lib/api/index.js +1 -1
  36. package/lib/api/sypct.js +20 -0
  37. package/lib/api/task.js +20 -0
  38. package/lib/bussiness/hyMapAearchPlace/index.js +11 -0
  39. package/lib/bussiness/hyMapAearchPlace/js/index.js +655 -0
  40. package/lib/bussiness/hyMapAearchPlace/mapAearchPlace.vue.js +351 -0
  41. package/lib/bussiness/hyMapAearchPlace/mapAearchPlaceItem.vue.js +103 -0
  42. package/lib/bussiness/hyMapAearchPlace/style/mapAearchPlace.scss +71 -0
  43. package/lib/bussiness/index.js +2 -0
  44. package/lib/components/hyBatchUploadDialog/batchUploadDialog.vue.js +22 -3
  45. package/lib/components/hyButton/style/button.scss +1 -1
  46. package/lib/components/hyConfigProvider/configProvider.vue.js +4 -0
  47. package/lib/components/hyConfirmDialog/confirmDialog.vue.js +2 -2
  48. package/lib/components/hyDialog/dialog.vue.js +23 -3
  49. package/lib/components/hyForm/cpns/locationSelect.vue.js +3 -1
  50. package/lib/components/hyMap/map.vue.js +10 -3
  51. package/lib/components/hySearch/cpns/searchItem.vue.js +16 -0
  52. package/lib/components/hyTable/table.vue.js +8 -1
  53. package/lib/components/hyTableForm/batchTableForm.vue.js +33 -56
  54. package/lib/components/hyTableForm/js/index.js +7 -58
  55. package/lib/components/hyTableForm/tableForm.vue.js +8 -2
  56. package/lib/hooks/index.js +3 -0
  57. package/lib/hooks/useGlobalConfig.js +5 -0
  58. package/lib/hooks/useMapConfig.js +21 -0
  59. package/lib/index.js +31 -26
  60. package/lib/static/hy-svg-icons/hy-icon-ops-list-editorialdownsizing.js +14 -0
  61. package/lib/static/hy-svg-icons/hy-icon-ops-list-suoxiao.js +14 -0
  62. package/lib/style/element/hy-element.scss +10 -1
  63. package/lib/utils/form.js +4 -0
  64. package/lib/utils/map/js/webgis.js +1 -0
  65. package/lib/version.js +1 -1
  66. package/package.json +1 -1
@@ -0,0 +1,653 @@
1
+ import { ref, computed, nextTick } from 'vue';
2
+ import { ElMessage } from 'element-plus';
3
+ import { pageApi, findAllApi } from '../../../api/index.mjs';
4
+ import { childTaskFindAllApi } from '../../../api/task.mjs';
5
+ import { detailApi } from '../../../api/device.mjs';
6
+ import { unbindCphmTaskApi } from '../../../api/sypct.mjs';
7
+ import { getCoordinate, WGS84ToGCJ02, WGS84ToBD09, GCJ02ToWGS84, BD09ToWGS84, GCJ02ToBD09, BD09ToGCJ02 } from '../../../utils/map/js/webgis.mjs';
8
+ import { setPoiServer } from '../../../utils/map/index.mjs';
9
+ import { onlyNumber } from '../../../utils/input.mjs';
10
+ import { isPermission } from '../../../utils/is.mjs';
11
+
12
+ const CoordinateDict = {
13
+ 0: "WGS84",
14
+ 1: "GCJ02",
15
+ 2: "BD09"
16
+ };
17
+ const CoordinateMap = {
18
+ WGS84: 0,
19
+ GCJ02: 1,
20
+ BD09: 2
21
+ };
22
+ const useMapAearchPlace = (hy) => {
23
+ const { props, emits, t } = hy;
24
+ const poiServer = setPoiServer(props.mapConfig);
25
+ const searchAddressTypeList = ref([
26
+ { label: "\u5730\u7406\u5730\u5740", value: 1 },
27
+ // 水源点: 2
28
+ // 防火单位: 3
29
+ {
30
+ label: "\u90E8\u95E8\u540D\u79F0",
31
+ value: 4,
32
+ permission: "operator_departmentManage"
33
+ },
34
+ { label: "\u67E5\u7ECF\u7EAC\u5EA6", value: 5 },
35
+ {
36
+ label: "\u67E5\u5DE1\u67E5\u70B9",
37
+ value: 6,
38
+ permission: "mission_patrolInspectionTask"
39
+ },
40
+ {
41
+ label: "\u4EFB\u52A1\u540D\u79F0",
42
+ value: 7,
43
+ permission: "mission_commonTasks"
44
+ },
45
+ {
46
+ label: "\u67E5\u8BE2\u8F66\u8F86",
47
+ value: 8,
48
+ permission: "commands_dutyStatus"
49
+ }
50
+ ]);
51
+ const nextPageParams = ref(null);
52
+ const lnglat = ref({
53
+ lng: null,
54
+ lngType: null,
55
+ lat: null,
56
+ latType: null
57
+ });
58
+ const lnglatList = ref([
59
+ {
60
+ titleName: "\u586B\u5199\u7ECF\u7EAC\u5EA6",
61
+ lng: null,
62
+ lat: null
63
+ }
64
+ ]);
65
+ const customCoordinate = ref(null);
66
+ const searchResultList = ref([]);
67
+ const searchAddressType = ref(1);
68
+ const placeholder = ref("\u8F93\u5165\u5730\u5740\u8FDB\u884C\u641C\u7D22");
69
+ const searchAddress = ref(null);
70
+ const valid = ref(true);
71
+ const size = ref(10);
72
+ const page = ref(0);
73
+ const noMore = ref(false);
74
+ const loading = ref(false);
75
+ const colorObject = ref({});
76
+ const timeOut = ref(null);
77
+ const showItem = ref(null);
78
+ const isFocus = ref(false);
79
+ let queryMarkerPoint = null;
80
+ const disabled = computed(() => {
81
+ return hy.loading.value || hy.noMore.value;
82
+ });
83
+ const commonOptions = computed(() => {
84
+ return {
85
+ bmCorrect: 1
86
+ };
87
+ });
88
+ const mapCoordinate = computed(() => {
89
+ return parseInt(hy.commonOptions.value.bmCorrect);
90
+ });
91
+ const mapCoordinateName = computed(() => {
92
+ return CoordinateDict[hy.mapCoordinate.value];
93
+ });
94
+ async function setSelectList() {
95
+ const selectList = [];
96
+ props.selectIdList.forEach((id) => {
97
+ const item = hy.selectList.find((item2) => item2.value === id);
98
+ if (item) {
99
+ if (!item.permission || isPermission(item.permission)) {
100
+ selectList.push(item);
101
+ }
102
+ }
103
+ });
104
+ await nextTick();
105
+ hy.searchAddressType.value = selectList[0].value;
106
+ hy.selectList = selectList;
107
+ }
108
+ async function lnglatCheckFn(content) {
109
+ onlyNumber(hy.lnglat.value, content);
110
+ await nextTick();
111
+ if (hy.lnglat.value[`${content}`]) {
112
+ let reg = null;
113
+ if (content === "lng") {
114
+ reg = /^(-|\+)?(((\d|[1-9]\d|1[0-7]\d|0{1,3})\.\d{0,15})|(\d|[1-9]\d|1[0-7]\d|0{1,3})|180\.0{0,15}|180)$/;
115
+ } else {
116
+ reg = /^(-|\+)?([0-8]?\d{1}\.\d{0,15}|90\.0{0,15}|[0-8]?\d{1}|90)$/;
117
+ }
118
+ if (reg.test(hy.lnglat.value[`${content}`])) {
119
+ hy.lnglat.value[`${content}Type`] = true;
120
+ } else {
121
+ hy.lnglat.value[`${content}Type`] = false;
122
+ }
123
+ } else {
124
+ hy.lnglat.value[`${content}Type`] = false;
125
+ }
126
+ const lng = hy.lnglat.value.lng;
127
+ const lat = hy.lnglat.value.lat;
128
+ let lnglatList2 = [];
129
+ if (hy.lnglat.value.latType && hy.lnglat.value.lngType) {
130
+ let wgs84 = {};
131
+ let gcj02 = {};
132
+ let bd09 = {};
133
+ if (hy.mapCoordinate.value === CoordinateMap.WGS84) {
134
+ wgs84 = {
135
+ titleName: "(WGS84-\u56FD\u9645\u901A\u7528\u5750\u6807\u7CFB)",
136
+ lng,
137
+ lat,
138
+ coordinate: CoordinateMap.WGS84
139
+ };
140
+ const gcj20Res = WGS84ToGCJ02(lat, lng);
141
+ gcj02 = {
142
+ titleName: "\uFF08GCJ02-\u706B\u661F\u5750\u6807\u7CFB\uFF09",
143
+ lng: gcj20Res.lng,
144
+ lat: gcj20Res.lat,
145
+ coordinate: CoordinateMap.GCJ02
146
+ };
147
+ const bd09Res = WGS84ToBD09(lat, lng);
148
+ bd09 = {
149
+ titleName: "\uFF08BD09-\u706B\u661F\u5750\u6807\u7CFB\uFF09",
150
+ lng: bd09Res.lng,
151
+ lat: bd09Res.lat,
152
+ coordinate: CoordinateMap.BD09
153
+ };
154
+ } else if (hy.mapCoordinate.value === CoordinateMap.GCJ02) {
155
+ gcj02 = {
156
+ titleName: "\uFF08GCJ02-\u706B\u661F\u5750\u6807\u7CFB\uFF09",
157
+ lng,
158
+ lat,
159
+ coordinate: CoordinateMap.GCJ02
160
+ };
161
+ const wgs84Res = GCJ02ToWGS84(lat, lng);
162
+ wgs84 = {
163
+ titleName: "(WGS84-\u56FD\u9645\u901A\u7528\u5750\u6807\u7CFB)",
164
+ lng: wgs84Res.lng,
165
+ lat: wgs84Res.lat,
166
+ coordinate: CoordinateMap.WGS84
167
+ };
168
+ const bd09Res = GCJ02ToBD09(lat, lng);
169
+ bd09 = {
170
+ titleName: "\uFF08BD09-\u706B\u661F\u5750\u6807\u7CFB\uFF09",
171
+ lng: bd09Res.lng,
172
+ lat: bd09Res.lat,
173
+ coordinate: CoordinateMap.BD09
174
+ };
175
+ } else if (hy.mapCoordinate.value === CoordinateMap.BD09) {
176
+ bd09 = {
177
+ titleName: "\uFF08BD09-\u706B\u661F\u5750\u6807\u7CFB\uFF09",
178
+ lng,
179
+ lat,
180
+ coordinate: CoordinateMap.BD09
181
+ };
182
+ const gcj20Res = BD09ToGCJ02(lat, lng);
183
+ gcj02 = {
184
+ titleName: "\uFF08GCJ02-\u706B\u661F\u5750\u6807\u7CFB\uFF09",
185
+ lng: gcj20Res.lng,
186
+ lat: gcj20Res.lat,
187
+ coordinate: CoordinateMap.GCJ02
188
+ };
189
+ const wgs84Res = BD09ToWGS84(lat, lng);
190
+ wgs84 = {
191
+ titleName: "(WGS84-\u56FD\u9645\u901A\u7528\u5750\u6807\u7CFB)",
192
+ lng: wgs84Res.lng,
193
+ lat: wgs84Res.lat,
194
+ coordinate: CoordinateMap.WGS84
195
+ };
196
+ }
197
+ lnglatList2 = [wgs84, gcj02, bd09];
198
+ } else {
199
+ lnglatList2 = [
200
+ {
201
+ titleName: "\u586B\u5199\u7ECF\u7EAC\u5EA6",
202
+ lng,
203
+ lat
204
+ }
205
+ ];
206
+ }
207
+ await nextTick();
208
+ hy.lnglatList.value = [...lnglatList2];
209
+ }
210
+ function onFocus() {
211
+ hy.isFocus.value = true;
212
+ }
213
+ function onBlur() {
214
+ hy.isFocus.value = false;
215
+ }
216
+ function lnglatClick(item) {
217
+ if (hy.lnglat.value.lngType && hy.lnglat.value.latType) {
218
+ let lng = item.lng;
219
+ let lat = item.lat;
220
+ const data = getCoordinate(
221
+ { lat, lng },
222
+ {
223
+ importCoordinate: item.coordinate,
224
+ leaveCoordinate: hy.mapCoordinate.value
225
+ }
226
+ );
227
+ lng = data.lng;
228
+ lat = data.lat;
229
+ hy.mapJumpLocationFn({
230
+ lng,
231
+ lat
232
+ });
233
+ }
234
+ }
235
+ function queryMarkerPointDelete() {
236
+ if (hy.timeOut.value) {
237
+ clearTimeout(hy.timeOut.value);
238
+ hy.timeOut.value = null;
239
+ }
240
+ if (hy.queryMarkerPoint) {
241
+ hy.queryMarkerPoint.remove(props.map);
242
+ hy.queryMarkerPoint = null;
243
+ }
244
+ }
245
+ function setQueryMarkerPoint(row) {
246
+ hy.queryMarkerPointDelete();
247
+ if (!props.map) return;
248
+ const { lat, lng } = row;
249
+ hy.queryMarkerPoint = props.hyMap.Marker({
250
+ icon: props.hyMap.DivIcon({
251
+ html: `<div class="hy-map-aearch-place-twinkle-marker w-[40px] h-[60px]" style="position: absolute; transform: translate(-50%, -54px)">
252
+ <svg class= "svg-icon" style="width: inherit;height: inherit;">
253
+ <use xlink:href = "#hy-icon-map-marker-trajectory-personnel"></use>
254
+ </svg>
255
+ </div>`,
256
+ iconSize: [0, 0],
257
+ iconAnchor: [0, 0]
258
+ }),
259
+ position: { lng, lat },
260
+ zIndexOffset: 1
261
+ });
262
+ hy.queryMarkerPoint.addTo(props.map);
263
+ hy.timeOut.value = setTimeout(() => {
264
+ hy.queryMarkerPointDelete();
265
+ }, 4e3);
266
+ }
267
+ function mapJumpLocationFn(row) {
268
+ if (hy.searchAddressType.value === 8) {
269
+ if (row.deviceId) {
270
+ detailApi({ deviceId: row.deviceId }).then((res) => {
271
+ if (res.code === 200) {
272
+ const data = res.data;
273
+ if (hy.showItem.value) {
274
+ props.setMarkerToMap();
275
+ }
276
+ nextTick(() => {
277
+ if (data.lat && data.lng) {
278
+ props.map.panTo([row.lng, row.lat]);
279
+ props.map.setZoom(18);
280
+ }
281
+ if (props.onSelectMarker) {
282
+ props.onSelectMarker(data);
283
+ }
284
+ if (props.setMarkerToMap) {
285
+ hy.showItem.value = data;
286
+ props.setMarkerToMap(1, data);
287
+ }
288
+ });
289
+ }
290
+ });
291
+ } else {
292
+ ElMessage.warning("\u5F53\u524D\u7528\u6237\u672A\u7ED1\u5B9A\u8BBE\u5907");
293
+ }
294
+ } else {
295
+ const { lat, lng } = row;
296
+ if (!lat || !lng) {
297
+ let msg = "\u6CA1\u6709\u5B9A\u4F4D\u4FE1\u606F";
298
+ if (hy.searchAddressType.value === 4) {
299
+ msg = "\u8BE5\u90E8\u95E8\u6CA1\u6709\u5B9A\u4F4D\u4FE1\u606F";
300
+ } else if (hy.searchAddressType.value === 6) {
301
+ msg = "\u8BE5\u5DE1\u67E5\u70B9\u6CA1\u6709\u5B9A\u4F4D\u4FE1\u606F";
302
+ } else if (hy.searchAddressType.value === 7) {
303
+ msg = "\u8BE5\u4EFB\u52A1\u6CA1\u6709\u5B9A\u4F4D\u4FE1\u606F";
304
+ }
305
+ ElMessage.warning(msg);
306
+ return;
307
+ }
308
+ props.map.setView(row, 18);
309
+ hy.setQueryMarkerPoint(row);
310
+ hy.resetFn(1);
311
+ }
312
+ }
313
+ function unbindVehicleFn(row) {
314
+ hy.$deleteConfirmationBox(
315
+ {
316
+ deleteTitleImg: "tips",
317
+ deleteTitle: "\u63D0\u793A",
318
+ deleteContent: `
319
+ <div>
320
+ <p>\u786E\u8BA4\u5C06\u8F66\u8F86\u4E0E\u4EBA\u5458\u89E3\u7ED1\uFF1F</p>
321
+ </div>
322
+ `,
323
+ submitText: "\u786E\u8BA4\u89E3\u7ED1",
324
+ closeText: "\u53D6\u6D88",
325
+ closeShow: true
326
+ },
327
+ () => {
328
+ unbindCphmTaskApi({
329
+ zyId: row.zyId,
330
+ userId: row.userId
331
+ }).then((res) => {
332
+ if (res.code === 200) {
333
+ ElMessage.success("\u89E3\u7ED1\u6210\u529F");
334
+ hy.getVehicleList();
335
+ } else {
336
+ ElMessage.error(res.msg);
337
+ }
338
+ }).catch((err) => {
339
+ console.error(err);
340
+ });
341
+ }
342
+ );
343
+ }
344
+ function throttle(fn, delay) {
345
+ return (params) => {
346
+ if (!hy.valid.value) {
347
+ return false;
348
+ }
349
+ hy.valid.value = false;
350
+ setTimeout(() => {
351
+ fn(params);
352
+ hy.valid.value = true;
353
+ }, delay);
354
+ };
355
+ }
356
+ async function load() {
357
+ hy.loading.value = true;
358
+ hy.page.value++;
359
+ await nextTick();
360
+ hy.getData();
361
+ }
362
+ function searchAddressTypeFn() {
363
+ hy.searchAddress.value = null;
364
+ hy.lnglat.value = {
365
+ lng: null,
366
+ lngType: null,
367
+ lat: null,
368
+ latType: null
369
+ };
370
+ hy.lnglatList.value = [
371
+ {
372
+ titleName: "\u586B\u5199\u7ECF\u7EAC\u5EA6",
373
+ lng: null,
374
+ lat: null
375
+ }
376
+ ];
377
+ hy.placeholderFn();
378
+ hy.resetFn();
379
+ }
380
+ function resetFn(type) {
381
+ hy.searchResultList.value = [];
382
+ hy.page.value = 1;
383
+ hy.noMore.value = false;
384
+ hy.loading.value = false;
385
+ nextTick(() => {
386
+ if (type !== 1) {
387
+ hy.getData();
388
+ }
389
+ });
390
+ }
391
+ function getData() {
392
+ if (hy.searchAddress.value && hy.searchAddress.value.length) {
393
+ if (hy.searchAddressType.value === 1) {
394
+ hy.addressRequestFn();
395
+ } else if (hy.searchAddressType.value === 4) {
396
+ hy.organizationPageFn();
397
+ } else if (hy.searchAddressType.value === 6) {
398
+ hy.patrolPointFn();
399
+ } else if (hy.searchAddressType.value === 7) {
400
+ hy.getTaskList();
401
+ } else if (hy.searchAddressType.value === 8) {
402
+ hy.getVehicleList();
403
+ }
404
+ } else {
405
+ hy.resetFn(1);
406
+ }
407
+ }
408
+ function addressRequestFn() {
409
+ if (hy.page.value === 1) {
410
+ hy.nextPageParams.value = null;
411
+ }
412
+ poiServer.placeSearch({
413
+ pageSize: hy.size.value,
414
+ // 单页显示结果条数
415
+ pageIndex: hy.page.value,
416
+ query: hy.searchAddress.value,
417
+ convertIngAndLat: false,
418
+ // 谷歌地图下一页传入
419
+ nextPageParams: hy.nextPageParams.value
420
+ }).then(({ results, nextPageParams: nextPageParams2 }) => {
421
+ hy.nextPageParams.value = nextPageParams2;
422
+ if (results) {
423
+ const dataList = results;
424
+ const list = [];
425
+ for (let i = 0; i < dataList.length; i++) {
426
+ const item = dataList[i];
427
+ list.push({
428
+ lng: hy.keepDecimal(item.lng),
429
+ lat: hy.keepDecimal(item.lat),
430
+ id: hy.createUniqueId(1),
431
+ address: item.address || item.name,
432
+ title: hy.titleFn(item.name)
433
+ });
434
+ }
435
+ nextTick(() => {
436
+ hy.loading.value = false;
437
+ hy.searchResultList.value.push(...list);
438
+ });
439
+ }
440
+ }).catch(() => {
441
+ hy.loading.value = false;
442
+ hy.noMore.value = true;
443
+ ElMessage.error("\u672A\u641C\u7D22\u5230\u5185\u5BB9");
444
+ });
445
+ }
446
+ function keepDecimal(num, precision = 8) {
447
+ return Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision);
448
+ }
449
+ async function getVehicleList() {
450
+ const res = await findAllApi("sypct/task/cphmResUse", {
451
+ // page: hy.page.value - 1,
452
+ // size: 10,
453
+ query: hy.searchAddress.value
454
+ });
455
+ if (res.code === 200) {
456
+ const dataList = res.data || [];
457
+ const list = [];
458
+ hy.searchResultList.value = [];
459
+ for (let i = 0; i < dataList.length; i++) {
460
+ const item = dataList[i];
461
+ list.push({
462
+ id: `${i}-${item.zyId}`,
463
+ ...item,
464
+ cphm: hy.titleFn(item.cphm || ""),
465
+ name: hy.titleFn(item.name || "")
466
+ });
467
+ }
468
+ nextTick(() => {
469
+ hy.loading.value = false;
470
+ hy.searchResultList.value.push(...list);
471
+ if (dataList.length === 0 && hy.searchResultList.value.length === 0) {
472
+ ElMessage.error("\u672A\u641C\u7D22\u5230\u5185\u5BB9");
473
+ }
474
+ hy.noMore.value = true;
475
+ });
476
+ }
477
+ }
478
+ async function getTaskList() {
479
+ const res = await childTaskFindAllApi({
480
+ taskStatus: "jxz",
481
+ query: hy.searchAddress.value
482
+ });
483
+ if (res && res.code === 200) {
484
+ const dataList = res.data || [];
485
+ const list = [];
486
+ for (let i = 0; i < dataList.length; i++) {
487
+ const item = dataList[i];
488
+ if (item.lat && item.lng) {
489
+ list.push({
490
+ id: `${item.taskId}_${item.orgId}`,
491
+ lat: item.lat,
492
+ lng: item.lng,
493
+ orgName: item.orgName,
494
+ title: hy.titleFn(item.rwmc)
495
+ });
496
+ }
497
+ }
498
+ nextTick(() => {
499
+ hy.loading.value = false;
500
+ hy.searchResultList.value.push(...list);
501
+ if (dataList.length === 0 && hy.searchResultList.value.length === 0) {
502
+ ElMessage.error("\u672A\u641C\u7D22\u5230\u5185\u5BB9");
503
+ }
504
+ hy.noMore.value = true;
505
+ });
506
+ }
507
+ }
508
+ function organizationPageFn() {
509
+ pageApi("organization", {
510
+ page: hy.page.value - 1,
511
+ size: 10,
512
+ query: hy.searchAddress.value
513
+ }).then((res) => {
514
+ if (res.code === 200) {
515
+ const dataList = res.data.content || [];
516
+ const list = [];
517
+ for (let i = 0; i < dataList.length; i++) {
518
+ const item = dataList[i];
519
+ list.push({
520
+ id: item.id,
521
+ address: item.address || item.companyName,
522
+ ...item,
523
+ title: hy.titleFn(item.companyName)
524
+ });
525
+ }
526
+ nextTick(() => {
527
+ hy.loading.value = false;
528
+ hy.searchResultList.value.push(...list);
529
+ if (dataList.length === 0 && hy.searchResultList.value.length === 0) {
530
+ ElMessage.error("\u672A\u641C\u7D22\u5230\u5185\u5BB9");
531
+ }
532
+ if (hy.page.value === res.data.totalPages) {
533
+ hy.noMore.value = true;
534
+ }
535
+ });
536
+ }
537
+ });
538
+ }
539
+ function patrolPointFn() {
540
+ pageApi("scrollCheck/scp", {
541
+ page: hy.page.value - 1,
542
+ size: 10,
543
+ query: hy.searchAddress.value
544
+ }).then((res) => {
545
+ if (res.code === 200) {
546
+ const dataList = res.data.content || [];
547
+ const list = [];
548
+ for (let i = 0; i < dataList.length; i++) {
549
+ const item = dataList[i];
550
+ if (item.lng && item.lat) {
551
+ list.push({
552
+ id: item.id,
553
+ ...item,
554
+ address: item.address || item.pointName,
555
+ title: hy.titleFn(item.pointName)
556
+ });
557
+ }
558
+ }
559
+ nextTick(() => {
560
+ hy.loading.value = false;
561
+ hy.searchResultList.value.push(...list);
562
+ if (dataList.length === 0 && hy.searchResultList.value.length === 0) {
563
+ ElMessage.error("\u672A\u641C\u7D22\u5230\u5185\u5BB9");
564
+ }
565
+ if (hy.page.value === res.data.totalPages) {
566
+ hy.noMore.value = true;
567
+ }
568
+ });
569
+ }
570
+ });
571
+ }
572
+ function titleFn(title = "") {
573
+ const arr = [];
574
+ for (let i = 0; i < title.length; i++) {
575
+ const item = title[i];
576
+ const index = hy.searchAddress.value.indexOf(item);
577
+ const json = {
578
+ content: title[i]
579
+ };
580
+ if (index === -1) {
581
+ json.type = 1;
582
+ } else {
583
+ json.type = 2;
584
+ }
585
+ arr.push(json);
586
+ }
587
+ return arr;
588
+ }
589
+ function placeholderFn() {
590
+ if (hy.searchAddressType.value === 1) {
591
+ hy.placeholder.value = "\u8F93\u5165\u5730\u5740\u8FDB\u884C\u641C\u7D22";
592
+ } else if (hy.searchAddressType.value === 4) {
593
+ hy.placeholder.value = "\u8F93\u5165\u90E8\u95E8\u8FDB\u884C\u641C\u7D22";
594
+ } else if (hy.searchAddressType.value === 6) {
595
+ hy.placeholder.value = "\u8F93\u5165\u5DE1\u67E5\u70B9\u8FDB\u884C\u641C\u7D22";
596
+ } else if (hy.searchAddressType.value === 7) {
597
+ hy.placeholder.value = "\u8F93\u5165\u4EFB\u52A1\u540D\u79F0\u8FDB\u884C\u641C\u7D22";
598
+ } else if (hy.searchAddressType.value === 8) {
599
+ hy.placeholder.value = "\u8F93\u5165\u8F66\u724C\u53F7\u7801/\u7528\u6237\u540D\u8FDB\u884C\u641C\u7D22";
600
+ } else {
601
+ hy.placeholder.value = null;
602
+ }
603
+ }
604
+ return {
605
+ searchAddressTypeList,
606
+ nextPageParams,
607
+ lnglat,
608
+ lnglatList,
609
+ customCoordinate,
610
+ searchResultList,
611
+ searchAddressType,
612
+ placeholder,
613
+ searchAddress,
614
+ valid,
615
+ size,
616
+ page,
617
+ noMore,
618
+ loading,
619
+ colorObject,
620
+ timeOut,
621
+ isFocus,
622
+ queryMarkerPoint,
623
+ showItem,
624
+ disabled,
625
+ commonOptions,
626
+ mapCoordinate,
627
+ mapCoordinateName,
628
+ setSelectList,
629
+ lnglatCheckFn,
630
+ onFocus,
631
+ onBlur,
632
+ lnglatClick,
633
+ queryMarkerPointDelete,
634
+ setQueryMarkerPoint,
635
+ mapJumpLocationFn,
636
+ unbindVehicleFn,
637
+ throttle,
638
+ load,
639
+ searchAddressTypeFn,
640
+ resetFn,
641
+ getData,
642
+ addressRequestFn,
643
+ keepDecimal,
644
+ getVehicleList,
645
+ getTaskList,
646
+ organizationPageFn,
647
+ patrolPointFn,
648
+ titleFn,
649
+ placeholderFn
650
+ };
651
+ };
652
+
653
+ export { useMapAearchPlace };