zhihao-ui 1.2.4 → 1.2.7

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 (51) hide show
  1. package/dist/es/{BaseInfo-DSoB7lXu.js → BaseInfo-CboHDiqp.js} +1 -1
  2. package/dist/es/{Button-CSkwolvy.js → Button-C1Q6WvkI.js} +2 -2
  3. package/dist/es/{DatePicker-BuM1QvvJ.js → DatePicker-AcRbvS-8.js} +2 -2
  4. package/dist/es/{DetailHeader-DLWS2a6d.js → DetailHeader-CoaVXtN3.js} +3 -3
  5. package/dist/es/{DetailSubTitle-Bohm33lU.js → DetailSubTitle-Csp4LjFx.js} +2 -2
  6. package/dist/es/{Dialog-dbO52Pj0.js → Dialog-CtU-qGdR.js} +3 -3
  7. package/dist/es/DiyDataTable-CP7yYQaU.js +277 -0
  8. package/dist/es/{EditInfoPair-sJNaUadM.js → EditInfoPair-DBbRqppY.js} +3 -3
  9. package/dist/es/{FileWrapper-BQgaAu1K.js → FileWrapper-BwQhQopY.js} +4 -4
  10. package/dist/es/{Grid-P-t8UiMv.js → Grid-B-FutGih.js} +1 -1
  11. package/dist/es/{InfoPair-BNypeCJn.js → InfoPair-WmMCXoUh.js} +3 -3
  12. package/dist/es/{Input-DpsLV8LI.js → Input-DFnH7_jo.js} +11 -11
  13. package/dist/es/{Loading-DXdxoKLU.js → Loading-BW6Doqh_.js} +2 -2
  14. package/dist/es/{Map-BchE1ZDm.js → Map-IjNHD4K5.js} +448 -276
  15. package/dist/es/{MessageBox-DRwBLDiG.js → MessageBox-CjuBt74R.js} +15 -15
  16. package/dist/es/{MoneyInput-E6oSL6tO.js → MoneyInput-BwkFhS2B.js} +7 -7
  17. package/dist/es/{PageHeadPanel-fhMuGUkI.js → PageHeadPanel-BhR3Bq1A.js} +2 -2
  18. package/dist/es/{ToolTips-lv_GNnZo.js → ToolTips-BEYXkt4n.js} +3 -3
  19. package/dist/es/index.js +34 -29
  20. package/dist/es/{utils-BMWHW3o7.js → utils-B1dH8Kx6.js} +1 -1
  21. package/dist/es/{vendor-BXx3MaXc.js → vendor-Cu-cEPs_.js} +14931 -10415
  22. package/dist/index.css +1 -1
  23. package/dist/types/components/DiyDataTable/DiyDataTable.vue.d.ts +70 -0
  24. package/dist/types/components/DiyDataTable/index.d.ts +152 -0
  25. package/dist/types/components/DiyDataTable/type.d.ts +46 -0
  26. package/dist/types/components/Map/Map.vue.d.ts +14 -2
  27. package/dist/types/components/Map/config.d.ts +2 -0
  28. package/dist/types/components/Map/enum/index.d.ts +1 -0
  29. package/dist/types/components/Map/enum/ship.d.ts +10 -0
  30. package/dist/types/components/Map/index.d.ts +42 -6
  31. package/dist/types/components/Map/interface/entity/queryLicenseResponse.d.ts +0 -111
  32. package/dist/types/components/Map/interface/entity/shipMapData.d.ts +5 -2
  33. package/dist/types/components/Map/interface/entity/shipMarker.d.ts +2 -2
  34. package/dist/types/components/Map/interface/entity/shipTrack.d.ts +0 -4
  35. package/dist/types/components/Map/interface/entity/vehicle.d.ts +171 -0
  36. package/dist/types/components/Map/interface/index.d.ts +4 -3
  37. package/dist/types/components/Map/interface/vo/vehicleVo.d.ts +20 -0
  38. package/dist/types/components/Map/render/canvasRender/canvasRender.d.ts +1 -0
  39. package/dist/types/components/Map/render/canvasRender/renderCustomOverlay.d.ts +3 -0
  40. package/dist/types/components/Map/render/canvasRender/renderShipStyle.d.ts +1 -1
  41. package/dist/types/components/Map/render/renderMarker.d.ts +6 -0
  42. package/dist/types/components/Map/render/renderShip.d.ts +6 -1
  43. package/dist/types/components/Map/render/renderTruck.d.ts +7 -2
  44. package/dist/types/components/Map/utils/format.d.ts +2 -0
  45. package/dist/types/components/Map/utils/store.d.ts +3 -0
  46. package/dist/types/components/MessageBox/MessageBox.vue.d.ts +8 -8
  47. package/dist/types/components/MessageBox/index.d.ts +12 -12
  48. package/dist/types/components/index.d.ts +1 -0
  49. package/dist/umd/index.css +1 -1
  50. package/dist/umd/index.umd.cjs +52 -37
  51. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- var A = Object.defineProperty;
2
- var x = (e, t, o) => t in e ? A(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
- var L = (e, t, o) => x(e, typeof t != "symbol" ? t + "" : t, o);
1
+ var x = Object.defineProperty;
2
+ var R = (e, t, o) => t in e ? x(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
+ var y = (e, t, o) => R(e, typeof t != "symbol" ? t + "" : t, o);
4
4
  import { ref, defineComponent, useModel, watch, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, withCtx, Fragment, renderList, unref, createBlock, toDisplayString, createCommentVNode, mergeModels, normalizeClass, nextTick, onMounted } from "vue";
5
- import { g as getLength, V as VectorSource, e as VectorLayer, S as Style, C as CircleStyle, F as Fill, f as Stroke, D as Draw, O as Overlay, u as unByKey, i as ElOption, j as ScaleLine$1, T as Text, k as Feature, P as Point, l as fromLonLat, m as cloneDeep, G as GeoJSON, W as WebGLPointsLayer, h as hooks, L as LineString, t as transform, n as TileLayer, X as XYZ, M as Map$1, o as View } from "./vendor-BXx3MaXc.js";
6
- import { _ as _export_sfc } from "./Button-CSkwolvy.js";
7
- import { w as withInstall } from "./utils-BMWHW3o7.js";
5
+ import { m as getLength, V as VectorSource, n as VectorLayer, S as Style, C as CircleStyle, F as Fill, o as Stroke, D as Draw, O as Overlay, u as unByKey, p as ElOption, q as ScaleLine$1, T as Text, r as Feature, P as Point, s as fromLonLat, d as cloneDeep, G as GeoJSON, W as WebGLPointsLayer, t as transform, h as hooks, L as LineString, v as TileLayer, X as XYZ, M as Map$1, w as View } from "./vendor-Cu-cEPs_.js";
6
+ import { _ as _export_sfc } from "./Button-C1Q6WvkI.js";
7
+ import { w as withInstall } from "./utils-B1dH8Kx6.js";
8
8
  var BaseMapType = /* @__PURE__ */ ((e) => (e[e.vector = 0] = "vector", e[e.satellite = 1] = "satellite", e))(BaseMapType || {}), CAR_COLOR = /* @__PURE__ */ ((e) => (e[e.BLUE = 1] = "BLUE", e[e.YELLOW = 2] = "YELLOW", e[e.Y_GREEN = 3] = "Y_GREEN", e))(CAR_COLOR || {}), DEVICE_TYPE = /* @__PURE__ */ ((e) => (e[e.HOST = 1] = "HOST", e[e.TALK = 2] = "TALK", e[e.STORAGE = 3] = "STORAGE", e[e.INTERNET = 4] = "INTERNET", e[e.CAMERA = 5] = "CAMERA", e[e.LOAD = 6] = "LOAD", e))(DEVICE_TYPE || {}), LENGTH_UNIT = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(LENGTH_UNIT || {});
9
9
  const LENGTH_UNIT_LABEL = {
10
10
  1: "M",
@@ -13,7 +13,53 @@ const LENGTH_UNIT_LABEL = {
13
13
  // km
14
14
  3: "NM"
15
15
  // nm
16
- }, formatLength = function(e, t) {
16
+ };
17
+ var SWITCH_BTN = /* @__PURE__ */ ((e) => (e.Camera = "camera", e.Mobile = "mobile", e.WaterGauge = "waterGauge", e))(SWITCH_BTN || {});
18
+ class ShipMapData {
19
+ constructor(t, o, n, a, r, l, s, c, d, u, m, i, h, w, L, I, T, b, p, v, f, M) {
20
+ y(this, "id");
21
+ // mmsi
22
+ y(this, "mmsi");
23
+ // 船舶三角形填充色
24
+ y(this, "fill");
25
+ // 船类型 "7": "货船",
26
+ y(this, "shipType");
27
+ // 船名
28
+ y(this, "name");
29
+ // 长度
30
+ y(this, "length");
31
+ // 宽度
32
+ y(this, "breadth");
33
+ // 经度
34
+ y(this, "lon");
35
+ // 纬度
36
+ y(this, "lat");
37
+ // 时间
38
+ y(this, "createdAt");
39
+ // 速度
40
+ y(this, "speed");
41
+ // 来源
42
+ y(this, "from");
43
+ // 船状态 "stop":"静止","sail":"航行","work":"作业","danger":"危险","other":"其他"
44
+ y(this, "sailStatus");
45
+ // 船艏向
46
+ y(this, "hdg");
47
+ // 航迹向
48
+ y(this, "cog");
49
+ // 设备定位类型
50
+ y(this, "posType");
51
+ y(this, "type");
52
+ // 航向角度
53
+ y(this, "angle");
54
+ // 左侧是否显示色块
55
+ y(this, "leftIconColor");
56
+ y(this, "existDevice");
57
+ y(this, "existMobile");
58
+ y(this, "existWaterGauge");
59
+ this.id = t, this.mmsi = o, this.fill = n, this.shipType = a, this.name = r, this.length = l, this.breadth = s, this.lon = c, this.lat = d, this.createdAt = u, this.speed = m, this.from = i, this.sailStatus = h, this.hdg = w, this.cog = L, this.posType = I, this.type = T, this.angle = b, this.leftIconColor = p, this.existDevice = v, this.existMobile = f, this.existWaterGauge = M;
60
+ }
61
+ }
62
+ const formatLength = function(e, t) {
17
63
  const n = getLength(e);
18
64
  let a = "";
19
65
  switch (t) {
@@ -31,7 +77,30 @@ const LENGTH_UNIT_LABEL = {
31
77
  }, convertSixHundredThousandToLatLng = function(e, t) {
32
78
  const o = Number(t) / 6e5;
33
79
  return [Number(e) / 6e5, o];
34
- }, mapInstance = ref(), shipsLayer = ref(), largeAmountShipsLayer = ref();
80
+ }, convertShipMapData = (e) => {
81
+ const t = (o) => new ShipMapData(
82
+ o.id,
83
+ o.id,
84
+ // 船舶三角形填充色
85
+ o.fill || "#04C900",
86
+ "70",
87
+ o.cnname || o.name,
88
+ o.len,
89
+ o.wid,
90
+ o.lon,
91
+ o.lat,
92
+ (/* @__PURE__ */ new Date()).getTime(),
93
+ o.spd,
94
+ o.from,
95
+ o.status,
96
+ Number(o.hdg),
97
+ o.cog,
98
+ Number(o.postype),
99
+ "other",
100
+ o.cog
101
+ );
102
+ return Array.isArray(e) ? e.map((o) => t(o)) : t(e);
103
+ }, mapInstance = ref(), shipsLayer = ref(), selectShipsLayer = ref(), allShips = ref([]), largeAmountShipsLayer = ref();
35
104
  ref();
36
105
  const trucksLayer = ref(), shipTrackLineFeatures = ref([]), trackLineVectorSource = ref(), shipTrackVectorLayer = ref();
37
106
  ref();
@@ -48,8 +117,8 @@ const labels = ref([]), _hoisted_1$4 = {
48
117
  emits: /* @__PURE__ */ mergeModels(["close"], ["update:visible"]),
49
118
  setup(e, { expose: t, emit: o }) {
50
119
  const n = o, a = useModel(e, "visible"), r = ref(LENGTH_UNIT.NM), l = ref([]), s = ref(!1), c = new VectorSource();
51
- let d, u, m, i, v;
52
- const k = new VectorLayer({
120
+ let d, u, m, i, h;
121
+ const w = new VectorLayer({
53
122
  source: c,
54
123
  style: {
55
124
  "fill-color": "rgba(255, 255, 255, 0.2)",
@@ -58,19 +127,19 @@ const labels = ref([]), _hoisted_1$4 = {
58
127
  "circle-radius": 7,
59
128
  "circle-fill-color": "#ffcc33"
60
129
  }
61
- }), I = function(h) {
62
- if (h.dragging)
130
+ }), L = function(g) {
131
+ if (g.dragging)
63
132
  return;
64
- let y = "点击选择起点";
65
- d && (y = "单击继续,双击结束"), u && (u.innerHTML = y, m.setPosition(h.coordinate), u.classList.remove("hidden"));
66
- }, E = () => {
67
- mapInstance.value && (mapInstance.value.on("pointermove", I), mapInstance.value.getViewport().addEventListener("mouseout", function() {
68
- var h;
69
- (h = u == null ? void 0 : u.classList) == null || h.add("hidden");
133
+ let S = "点击选择起点";
134
+ d && (S = "单击继续,双击结束"), u && (u.innerHTML = S, m.setPosition(g.coordinate), u.classList.remove("hidden"));
135
+ }, I = () => {
136
+ mapInstance.value && (mapInstance.value.on("pointermove", L), mapInstance.value.getViewport().addEventListener("mouseout", function() {
137
+ var g;
138
+ (g = u == null ? void 0 : u.classList) == null || g.add("hidden");
70
139
  }), s.value = !0);
71
140
  };
72
- let w;
73
- const _ = new Style({
141
+ let T;
142
+ const b = new Style({
74
143
  fill: new Fill({
75
144
  color: "rgba(255, 255, 255, 0.2)"
76
145
  }),
@@ -90,117 +159,117 @@ const labels = ref([]), _hoisted_1$4 = {
90
159
  })
91
160
  });
92
161
  function p() {
93
- var h, y;
94
- l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((M) => {
95
- var T;
96
- (T = M == null ? void 0 : M.parentNode) == null || T.removeChild(M);
97
- }), c.clear(), (h = mapInstance.value) == null || h.removeInteraction(w), (y = mapInstance.value) == null || y.removeLayer(k), u != null && u.parentNode && u.parentNode.removeChild(u);
162
+ var g, S;
163
+ l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((_) => {
164
+ var k;
165
+ (k = _ == null ? void 0 : _.parentNode) == null || k.removeChild(_);
166
+ }), c.clear(), (g = mapInstance.value) == null || g.removeInteraction(T), (S = mapInstance.value) == null || S.removeLayer(w), u != null && u.parentNode && u.parentNode.removeChild(u);
98
167
  }
99
- function g() {
100
- var y, M;
101
- p(), (y = mapInstance.value) == null || y.addLayer(k), w = new Draw({
168
+ function v() {
169
+ var S, _;
170
+ p(), (S = mapInstance.value) == null || S.addLayer(w), T = new Draw({
102
171
  source: c,
103
172
  type: "LineString",
104
173
  style: function() {
105
- return _;
174
+ return b;
106
175
  }
107
- }), (M = mapInstance.value) == null || M.addInteraction(w), S(), f();
108
- let h;
109
- w.on("drawstart", function(T) {
110
- var N;
111
- d = T.feature;
112
- let b;
113
- h = (N = d.getGeometry()) == null ? void 0 : N.on("change", function(R) {
114
- const F = R.target;
115
- let C = formatLength(F, r.value);
116
- b = F.getLastCoordinate(), i && C && (i.innerHTML = C), v.setPosition(b);
176
+ }), (_ = mapInstance.value) == null || _.addInteraction(T), M(), f();
177
+ let g;
178
+ T.on("drawstart", function(k) {
179
+ var F;
180
+ d = k.feature;
181
+ let V;
182
+ g = (F = d.getGeometry()) == null ? void 0 : F.on("change", function(A) {
183
+ const N = A.target;
184
+ let P = formatLength(N, r.value);
185
+ V = N.getLastCoordinate(), i && P && (i.innerHTML = P), h.setPosition(V);
117
186
  });
118
- }), w.on("drawend", function() {
119
- i && (i.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), i != null && i.innerHTML && l.value.push(i == null ? void 0 : i.innerHTML), v.setOffset([0, -7]), d = null, i = null, S(), h && unByKey(h);
187
+ }), T.on("drawend", function() {
188
+ i && (i.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), i != null && i.innerHTML && l.value.push(i == null ? void 0 : i.innerHTML), h.setOffset([0, -7]), d = null, i = null, M(), g && unByKey(g);
120
189
  });
121
190
  }
122
191
  function f() {
123
- var h;
192
+ var g;
124
193
  u != null && u.parentNode && u.parentNode.removeChild(u), u = document.createElement("div"), u.className = "ol-tooltip hidden", m = new Overlay({
125
194
  element: u,
126
195
  offset: [15, 0],
127
196
  positioning: "center-left"
128
- }), (h = mapInstance.value) == null || h.addOverlay(m);
197
+ }), (g = mapInstance.value) == null || g.addOverlay(m);
129
198
  }
130
- function S() {
131
- var h;
132
- i != null && i.parentNode && i.parentNode.removeChild(i), i = document.createElement("div"), i.className = "ol-tooltip ol-tooltip-measure", v = new Overlay({
199
+ function M() {
200
+ var g;
201
+ i != null && i.parentNode && i.parentNode.removeChild(i), i = document.createElement("div"), i.className = "ol-tooltip ol-tooltip-measure", h = new Overlay({
133
202
  element: i,
134
203
  offset: [0, -15],
135
204
  positioning: "bottom-center",
136
205
  stopEvent: !1,
137
206
  insertFirst: !1
138
- }), (h = mapInstance.value) == null || h.addOverlay(v);
207
+ }), (g = mapInstance.value) == null || g.addOverlay(h);
139
208
  }
140
- const V = (h) => {
141
- var T, b;
142
- l.value[h] && l.value.splice(h, 1);
143
- const y = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
144
- y[h] && ((b = (T = y[h]) == null ? void 0 : T.parentNode) == null || b.removeChild(y[h]));
145
- const M = c.getFeatures();
146
- M[h] && c.removeFeature(M[h]);
147
- }, P = () => {
209
+ const E = (g) => {
210
+ var k, V;
211
+ l.value[g] && l.value.splice(g, 1);
212
+ const S = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
213
+ S[g] && ((V = (k = S[g]) == null ? void 0 : k.parentNode) == null || V.removeChild(S[g]));
214
+ const _ = c.getFeatures();
215
+ _[g] && c.removeFeature(_[g]);
216
+ }, C = () => {
148
217
  n("close");
149
218
  };
150
219
  return watch(() => a, () => {
151
- a && !s.value && (E(), g());
220
+ a && !s.value && (I(), v());
152
221
  }, { deep: !0, immediate: !0 }), t({
153
- addInteraction: g,
222
+ addInteraction: v,
154
223
  removeInteraction: p
155
- }), (h, y) => {
156
- const M = resolveComponent("el-select");
224
+ }), (g, S) => {
225
+ const _ = resolveComponent("el-select");
157
226
  return a.value ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
158
227
  createElementVNode("div", { class: "header" }, [
159
- y[1] || (y[1] = createElementVNode("div", { class: "title" }, "测量", -1)),
228
+ S[1] || (S[1] = createElementVNode("div", { class: "title" }, "测量", -1)),
160
229
  createElementVNode("i", {
161
- onClick: P,
230
+ onClick: C,
162
231
  class: "map-iconfont icon-close"
163
232
  })
164
233
  ]),
165
234
  createElementVNode("div", _hoisted_2$2, [
166
- y[2] || (y[2] = createElementVNode("div", { class: "tips" }, "在地图上点击多个点测量距离,距离单位", -1)),
167
- createVNode(M, {
235
+ S[2] || (S[2] = createElementVNode("div", { class: "tips" }, "在地图上点击多个点测量距离,距离单位", -1)),
236
+ createVNode(_, {
168
237
  class: "select-length-unit",
169
238
  modelValue: r.value,
170
- "onUpdate:modelValue": y[0] || (y[0] = (T) => r.value = T)
239
+ "onUpdate:modelValue": S[0] || (S[0] = (k) => r.value = k)
171
240
  }, {
172
241
  default: withCtx(() => [
173
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(LENGTH_UNIT_LABEL), (T) => (openBlock(), createBlock(unref(ElOption), {
174
- key: unref(LENGTH_UNIT)[T],
175
- label: T,
176
- value: unref(LENGTH_UNIT)[T]
242
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(LENGTH_UNIT_LABEL), (k) => (openBlock(), createBlock(unref(ElOption), {
243
+ key: unref(LENGTH_UNIT)[k],
244
+ label: k,
245
+ value: unref(LENGTH_UNIT)[k]
177
246
  }, null, 8, ["label", "value"]))), 128))
178
247
  ]),
179
248
  _: 1
180
249
  }, 8, ["modelValue"])
181
250
  ]),
182
251
  createElementVNode("div", _hoisted_3$1, [
183
- (openBlock(!0), createElementBlock(Fragment, null, renderList(l.value, (T, b) => (openBlock(), createElementBlock("div", {
252
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(l.value, (k, V) => (openBlock(), createElementBlock("div", {
184
253
  class: "measure-history-item",
185
- key: b
254
+ key: V
186
255
  }, [
187
256
  createElementVNode("div", _hoisted_4, [
188
- y[3] || (y[3] = createElementVNode("i", { class: "map-iconfont icon-a-Frame-11" }, null, -1)),
189
- createElementVNode("span", _hoisted_5, "线段" + toDisplayString(b + 1), 1),
190
- createElementVNode("span", _hoisted_6, toDisplayString(T), 1)
257
+ S[3] || (S[3] = createElementVNode("i", { class: "map-iconfont icon-a-Frame-11" }, null, -1)),
258
+ createElementVNode("span", _hoisted_5, "线段" + toDisplayString(V + 1), 1),
259
+ createElementVNode("span", _hoisted_6, toDisplayString(k), 1)
191
260
  ]),
192
261
  createElementVNode("div", {
193
262
  class: "delete-button",
194
- onClick: (N) => V(b)
195
- }, y[4] || (y[4] = [
196
- createElementVNode("i", { class: "map-iconfont icon-delete" }, null, -1)
263
+ onClick: (F) => E(V)
264
+ }, S[4] || (S[4] = [
265
+ createElementVNode("i", { class: "map-iconfont icon-a-delete1" }, null, -1)
197
266
  ]), 8, _hoisted_7)
198
267
  ]))), 128))
199
268
  ])
200
269
  ])) : createCommentVNode("", !0);
201
270
  };
202
271
  }
203
- }), Measure = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-6318713d"]]), _hoisted_1$3 = { class: "tool-panel" }, _hoisted_2$1 = { class: "tool-components" }, _sfc_main$5 = /* @__PURE__ */ defineComponent({
272
+ }), Measure = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-8e976a28"]]), _hoisted_1$3 = { class: "tool-panel" }, _hoisted_2$1 = { class: "tool-components" }, _sfc_main$5 = /* @__PURE__ */ defineComponent({
204
273
  __name: "toolPanel",
205
274
  props: {
206
275
  vehicleMode: {}
@@ -225,20 +294,16 @@ const labels = ref([]), _hoisted_1$4 = {
225
294
  class: normalizeClass(["switch-btn", `${n.value && "active"}`]),
226
295
  onClick: d
227
296
  }, i[1] || (i[1] = [
228
- createElementVNode("i", { class: "map-iconfont icon-a-Frame1" }, null, -1),
297
+ createElementVNode("i", { class: "map-iconfont icon-measure" }, null, -1),
229
298
  createElementVNode("div", { class: "button-text" }, "测距", -1)
230
299
  ]), 2)) : createCommentVNode("", !0),
231
300
  createElementVNode("div", {
232
301
  class: normalizeClass(["switch-btn", { active: r.value }]),
233
302
  onClick: l
234
303
  }, i[2] || (i[2] = [
235
- createElementVNode("i", { class: "map-iconfont icon-a-Frame19" }, null, -1),
304
+ createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
236
305
  createElementVNode("div", { class: "button-text" }, "绿点", -1)
237
306
  ]), 2),
238
- i[4] || (i[4] = createElementVNode("div", { class: "switch-btn" }, [
239
- createElementVNode("i", { class: "map-iconfont icon-Frame-13" }),
240
- createElementVNode("div", { class: "button-text" }, "图层")
241
- ], -1)),
242
307
  createElementVNode("div", {
243
308
  class: normalizeClass(["switch-btn", { active: s.value === unref(BaseMapType).satellite }]),
244
309
  onClick: c
@@ -253,13 +318,13 @@ const labels = ref([]), _hoisted_1$4 = {
253
318
  ref_key: "measureRef",
254
319
  ref: a,
255
320
  visible: n.value,
256
- "onUpdate:visible": i[0] || (i[0] = (v) => n.value = v),
321
+ "onUpdate:visible": i[0] || (i[0] = (h) => n.value = h),
257
322
  onClose: u
258
323
  }, null, 8, ["visible"])) : createCommentVNode("", !0)
259
324
  ])
260
325
  ], 64));
261
326
  }
262
- }), ToolPanel = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-d5e1b71d"]]), _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$4 = /* @__PURE__ */ defineComponent({
327
+ }), ToolPanel = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-6072039b"]]), _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$4 = /* @__PURE__ */ defineComponent({
263
328
  __name: "scaleLine",
264
329
  setup(e, { expose: t }) {
265
330
  const o = new ScaleLine$1({
@@ -279,25 +344,27 @@ const labels = ref([]), _hoisted_1$4 = {
279
344
  }
280
345
  },
281
346
  setup(e) {
282
- const t = e, o = () => {
283
- const a = t.map.getView(), r = a.getZoom();
284
- a.setZoom(r + 1);
285
- }, n = () => {
286
- const a = t.map.getView(), r = a.getZoom();
287
- a.setZoom(r - 1);
347
+ const t = () => {
348
+ if (!mapInstance.value) return;
349
+ const n = mapInstance.value.getView(), a = n.getZoom();
350
+ a && n.setZoom(a + 1);
351
+ }, o = () => {
352
+ if (!mapInstance.value) return;
353
+ const n = mapInstance.value.getView(), a = n.getZoom();
354
+ a && n.setZoom(a - 1);
288
355
  };
289
- return (a, r) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
356
+ return (n, a) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
290
357
  createElementVNode("div", {
291
- onClick: o,
358
+ onClick: t,
292
359
  class: "button big-button"
293
360
  }, "+"),
294
361
  createElementVNode("div", {
295
- onClick: n,
362
+ onClick: o,
296
363
  class: "button small-button"
297
364
  }, "-")
298
365
  ]));
299
366
  }
300
- }), ZoomControl = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-fc659cee"]]), CDN_URL = "https://static.zhihaoscm.cn/", tiandituKey = "a6e8f78974f2581f2ca00485b40c948f", baseMap = {
367
+ }), ZoomControl = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-f2b62b21"]]), CDN_URL = "https://static.zhihaoscm.cn/", tiandituKey = "a6e8f78974f2581f2ca00485b40c948f", baseMap = {
301
368
  // 矢量底图
302
369
  tiandituTile: `http://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,
303
370
  // 矢量注记
@@ -315,6 +382,8 @@ const labels = ref([]), _hoisted_1$4 = {
315
382
  min: 3,
316
383
  // 地图缩放最大层级
317
384
  max: 18,
385
+ // 查看船舶详情时地图缩放层级
386
+ findShip: 13,
318
387
  // 船舶绿点图最大显示层级
319
388
  shipGreenDotMax: 11,
320
389
  // 船形图标最小渲染层级
@@ -346,7 +415,7 @@ const labels = ref([]), _hoisted_1$4 = {
346
415
  }, "数据来源:自然资源部 & NavInfo", -1))
347
416
  ]));
348
417
  }
349
- }), Copyright = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-0b80cd67"]]), _sfc_main$1 = /* @__PURE__ */ defineComponent({
418
+ }), Copyright = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-9c5c2f7b"]]), _sfc_main$1 = /* @__PURE__ */ defineComponent({
350
419
  __name: "fullscreen",
351
420
  props: {
352
421
  pageRef: {
@@ -364,11 +433,11 @@ const labels = ref([]), _hoisted_1$4 = {
364
433
  onClick: n
365
434
  }, [
366
435
  createElementVNode("i", {
367
- class: normalizeClass(`map-iconfont ${o.value ? "icon-quxiaoquanping" : "icon-quanping1"} `)
436
+ class: normalizeClass(`map-iconfont ${o.value ? "icon-quxiaoquanping" : "icon-quanping"} `)
368
437
  }, null, 2)
369
438
  ]));
370
439
  }
371
- }), Fullscreen = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-adf8fd0c"]]), equatorialCircumference = 2003750834e-2;
440
+ }), Fullscreen = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-ed59d7cb"]]), equatorialCircumference = 2003750834e-2;
372
441
  function lonLatToMercator(e) {
373
442
  const t = e[0] * equatorialCircumference / 180;
374
443
  let o = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
@@ -430,8 +499,21 @@ const getAngle = (e, t) => {
430
499
  for (const [r, l] of e)
431
500
  r < t && (t = r), l < o && (o = l), r > n && (n = r), l > a && (a = l);
432
501
  return [t, o, n, a];
502
+ }, calculatePolygonCentroid = (e) => {
503
+ if (!Array.isArray(e) || e.length < 3)
504
+ throw new Error("A polygon must have at least 3 coordinates.");
505
+ let t = 0, o = 0, n = 0;
506
+ const a = e.length;
507
+ for (let s = 0; s < a - 1; s++) {
508
+ const [c, d] = e[s], [u, m] = e[s + 1], i = c * m - u * d;
509
+ n += i, t += (c + u) * i, o += (d + m) * i;
510
+ }
511
+ if (n *= 0.5, n === 0)
512
+ throw new Error("多边形面积为零");
513
+ const r = t / (6 * n), l = o / (6 * n);
514
+ return [r, l];
433
515
  }, rotateShapeModel = (e, t) => {
434
- const [o, n] = e[0], a = t * Math.PI / 180, r = Math.cos(a), l = Math.sin(a);
516
+ const [o, n] = calculatePolygonCentroid(e), a = t * Math.PI / 180, r = Math.cos(a), l = Math.sin(a);
435
517
  return e.map(([s, c]) => {
436
518
  const d = s - o, u = c - n, m = d * r - u * l + o, i = d * l + u * r + n;
437
519
  return [m, i];
@@ -511,12 +593,12 @@ function drawLabelBody(e, t, o) {
511
593
  e.restore();
512
594
  let u, m = -1, i = r + 3 * a;
513
595
  if (m = 0, u = calculateBounds(l, m, d, i, c), u && m > -1) {
514
- let v = getBottomLeftPoint(u), k = getTopRighttPoint(u);
596
+ let h = getBottomLeftPoint(u), w = getTopRighttPoint(u);
515
597
  return {
516
598
  center: l,
517
599
  x: calculateAnchorPoint(l, m, d, i, c),
518
- l: k,
519
- r: v,
600
+ l: w,
601
+ r: h,
520
602
  bounds: u,
521
603
  position: m
522
604
  };
@@ -539,10 +621,10 @@ const drawText = (e, t, o, n, a, r, l) => {
539
621
  if (t && o) {
540
622
  let c = { font: labelFont, labelOutSize, labelHeight, center: t, text: o }, d = drawLabelBody(e, labels.value, c);
541
623
  if (d) {
542
- const { x: u, bounds: m, l: i } = d, v = [getTopLeftPoint(m), getBottomLeftPoint(m), getBottomRightPoint(m), getTopRighttPoint(m)];
543
- labels.value.push(d), drawPolygon(e, [t, u], n, "#000", !1, null, null, null, null, labelAlpha), drawPolygon(e, v, n, r, !0);
544
- const [k, I] = i;
545
- drawText(e, [k, I + labelOutSize + labelHeight + 1], o, a);
624
+ const { x: u, bounds: m, l: i } = d, h = [getTopLeftPoint(m), getBottomLeftPoint(m), getBottomRightPoint(m), getTopRighttPoint(m)];
625
+ labels.value.push(d), drawPolygon(e, [t, u], n, "#000", !1, null, null, null, null, labelAlpha), drawPolygon(e, h, n, r, !0);
626
+ const [w, L] = i;
627
+ drawText(e, [w, L + labelOutSize + labelHeight + 1], o, a);
546
628
  }
547
629
  }
548
630
  return null;
@@ -568,21 +650,21 @@ const setTruckStyle = (e, t, o, n) => new Style({
568
650
  c = c / s - 20, d = d / s;
569
651
  const u = c - 70, m = d - 68;
570
652
  let i = 180;
571
- const v = 56, k = "#FFFFFF";
572
- let I = 176;
573
- const E = 52;
574
- let w = "#164AFF", _ = "#FFFFFF";
575
- o === CAR_COLOR.YELLOW ? (I = 176, w = "#FFC81E", _ = "rgba(0,0,0,0.88)") : o === CAR_COLOR.Y_GREEN && (i = 200, I = 196, w = "#8FED7C", _ = "rgba(0,0,0,0.88)"), n != null && n.length && (i += n.length * 56), fillRectRadius(l, u, m, i, v, k), fillRectRadius(l, u + 2, m + 2, I, E, w), o === CAR_COLOR.Y_GREEN && fillRectRadius(l, u + 2, m + 2, 68, E, "#FFC81E"), l.save(), l.restore(), l.fillStyle = _, l.font = "bold 28px Arial", l.textAlign = "left", l.textBaseline = "middle";
653
+ const h = 56, w = "#FFFFFF";
654
+ let L = 176;
655
+ const I = 52;
656
+ let T = "#164AFF", b = "#FFFFFF";
657
+ o === CAR_COLOR.YELLOW ? (L = 176, T = "#FFC81E", b = "rgba(0,0,0,0.88)") : o === CAR_COLOR.Y_GREEN && (i = 200, L = 196, T = "#8FED7C", b = "rgba(0,0,0,0.88)"), n != null && n.length && (i += n.length * 56), fillRectRadius(l, u, m, i, h, w), fillRectRadius(l, u + 2, m + 2, L, I, T), o === CAR_COLOR.Y_GREEN && fillRectRadius(l, u + 2, m + 2, 68, I, "#FFC81E"), l.save(), l.restore(), l.fillStyle = b, l.font = "bold 28px Arial", l.textAlign = "left", l.textBaseline = "middle";
576
658
  const p = `${t.slice(0, 2) + " · " + t.slice(2)}`;
577
659
  if (l.fillText(p, u + 12, m + 32), l.save(), l.restore(), n != null && n.length) {
578
660
  const f = l.measureText(p).width + 12;
579
- let S = 0;
580
- n.forEach((V) => {
581
- V === DEVICE_TYPE.CAMERA && (l.drawImage(cameraImage, c - 54 + f + S * 56, d - 64, 50, 50), ++S), V === DEVICE_TYPE.LOAD && (l.drawImage(loadImage, c - 54 + f + S * 56, d - 64, 50, 50), ++S);
661
+ let M = 0;
662
+ n.forEach((E) => {
663
+ E === DEVICE_TYPE.CAMERA && (l.drawImage(cameraImage, c - 54 + f + M * 56, d - 64, 50, 50), ++M), E === DEVICE_TYPE.LOAD && (l.drawImage(loadImage, c - 54 + f + M * 56, d - 64, 50, 50), ++M);
582
664
  });
583
665
  }
584
- const g = dotImage;
585
- l.drawImage(g, c + i / 2 - 90, d, 50 / s, 50 / s), l.restore();
666
+ const v = dotImage;
667
+ l.drawImage(v, c + i / 2 - 90, d, 50 / s, 50 / s), l.restore();
586
668
  }
587
669
  });
588
670
  ref([]);
@@ -609,48 +691,7 @@ const renderTrucksMarker = (e) => {
609
691
  truckMarkerList.forEach((e) => {
610
692
  e.feature && (trucksVectorSource == null || trucksVectorSource.removeFeature(e.feature));
611
693
  }), truckMarkerList = [];
612
- };
613
- class ShipMapData {
614
- constructor(t, o, n, a, r, l, s, c, d, u, m, i, v, k, I, E, w, _, p = 1) {
615
- L(this, "id");
616
- // mmsi
617
- L(this, "mmsi");
618
- // 船舶三角形填充色
619
- L(this, "fill");
620
- // 船类型 "7": "货船",
621
- L(this, "shipType");
622
- // 船名
623
- L(this, "name");
624
- // 长度
625
- L(this, "length");
626
- // 宽度
627
- L(this, "breadth");
628
- // 经度
629
- L(this, "lon");
630
- // 纬度
631
- L(this, "lat");
632
- // 时间
633
- L(this, "createdAt");
634
- // 速度
635
- L(this, "speed");
636
- // 来源
637
- L(this, "from");
638
- // 船状态 "stop":"静止","sail":"航行","work":"作业","danger":"危险","other":"其他"
639
- L(this, "sailStatus");
640
- // 船艏向
641
- L(this, "hdg");
642
- // 航迹向
643
- L(this, "cog");
644
- // 设备定位类型
645
- L(this, "posType");
646
- L(this, "type");
647
- // 航向角度
648
- L(this, "angle");
649
- L(this, "isShow");
650
- this.id = t, this.mmsi = o, this.fill = n, this.shipType = a, this.name = r, this.length = l, this.breadth = s, this.lon = c, this.lat = d, this.createdAt = u, this.speed = m, this.from = i, this.sailStatus = v, this.hdg = k, this.cog = I, this.posType = E, this.type = w, this.angle = _, this.isShow = p;
651
- }
652
- }
653
- const triangleModel = multiplyPixelRatio([
694
+ }, triangleModel = multiplyPixelRatio([
654
695
  [0, -8],
655
696
  [5, 8],
656
697
  [-5, 8]
@@ -714,12 +755,12 @@ const triangleModel = multiplyPixelRatio([
714
755
  [0, -24]
715
756
  ]
716
757
  }
717
- }, speedCondition = [[1, 10], [10, 20], [20, 1 / 0]], drawShipModelByZoom = { 16: [200, 30], 17: [50, 5], 18: [1, 1] }, setShipStyle = (e, t) => new Style({
718
- renderer: (o, n) => {
719
- const a = n.context, r = n.feature.get("data");
758
+ }, speedCondition = [[1, 10], [10, 20], [20, 1 / 0]], drawShipModelByZoom = { 16: [200, 30], 17: [50, 5], 18: [1, 1] }, setShipStyle = (e) => new Style({
759
+ renderer: (t, o) => {
760
+ const n = o.context, a = o.feature.get("data");
720
761
  try {
721
- const l = drawShipBody(a, r, o);
722
- l && drawHeading(a, r, l), drawShipLabel(a, r, o);
762
+ const r = drawShipBody(n, a, t);
763
+ r && (drawHeading(n, a, r), e && drawSelectBounds(n, r)), drawShipLabel(n, a, t);
723
764
  } catch {
724
765
  return !1;
725
766
  }
@@ -730,17 +771,18 @@ const triangleModel = multiplyPixelRatio([
730
771
  if (!n) return;
731
772
  let a = [];
732
773
  const [r, l] = drawShipModelByZoom[n] || [0, 0], [s, c] = o;
733
- if (n <= mapZoom.shipModelMax && n > mapZoom.shipModelMin && t.length >= r && t.breadth >= l) {
734
- const d = drawCurrentShipShapeModel(t, n);
735
- a = rotateShapeModel(d.map((u) => {
774
+ if (n <= mapZoom.shipModelMax && n > mapZoom.shipModelMin && t.length >= r && t.breadth >= l)
775
+ a = rotateShapeModel(drawCurrentShipShapeModel(t, n), t.angle).map((u) => {
776
+ const [m, i] = u;
777
+ return [s + m, c + i];
778
+ });
779
+ else {
780
+ const d = rotateShapeModel(triangleModel, t.angle);
781
+ o.length === 2 && (a = d.map((u) => {
736
782
  const [m, i] = u;
737
783
  return [s + m, c + i];
738
- }), t.angle);
739
- } else
740
- o.length === 2 && (a = rotateShapeModel(triangleModel.map((d) => {
741
- const [u, m] = d;
742
- return [s + u, c + m];
743
- }), t.angle));
784
+ }));
785
+ }
744
786
  if (!(a.length > 2)) return !1;
745
787
  e.save(), e.beginPath(), e.moveTo(a[0][0], a[0][1]);
746
788
  for (let d = 1; d < a.length; d++)
@@ -793,11 +835,16 @@ const triangleModel = multiplyPixelRatio([
793
835
  return r;
794
836
  };
795
837
  let shipsMarkerList = [], shipsVectorSource, largeAmountShipsSource;
838
+ const selectedShipData = ref(null);
839
+ let selectShipsVectorSource;
796
840
  const renderShips = (e) => {
797
841
  if (!mapInstance.value) return;
798
842
  const t = mapInstance.value.getView().getZoom();
799
- if (!(!t || t <= mapZoom.shipGreenDotMax))
800
- return t > mapZoom.shipGreenDotMax && t < mapZoom.shipModelMin || e.length > 500 ? (deleteAllShipMarkers(), renderLargeAmountShips(e)) : (largeAmountShipsSource == null || largeAmountShipsSource.clear(), renderShipsMarker(e));
843
+ if (selectedShipData.value && nextTick(() => {
844
+ selectSingleShipMarker(selectedShipData.value);
845
+ }).then((o) => {
846
+ }), !(!t || t < mapZoom.shipGreenDotMax))
847
+ return allShips.value = e, t > mapZoom.shipGreenDotMax && t < mapZoom.shipModelMin || e.length > 500 ? (deleteAllShipMarkers(), renderLargeAmountShips(e)) : (largeAmountShipsSource == null || largeAmountShipsSource.clear(), renderShipsMarker(e));
801
848
  }, renderLargeAmountShips = (e) => {
802
849
  if (!mapInstance.value) return;
803
850
  const t = e.map((o) => ({
@@ -828,88 +875,127 @@ const renderShips = (e) => {
828
875
  // 获取 'cog' 属性值
829
876
  0
830
877
  // 如果 'cog' 属性不存在,使用默认值 0
831
- ]
878
+ ],
879
+ "shape-scale": [0.8, 1.2]
832
880
  }
833
881
  }), mapInstance.value.addLayer(largeAmountShipsLayer.value), largeAmountShipsLayer.value;
834
882
  }, renderShipsMarker = (e) => {
835
- if (mapInstance.value)
836
- return deleteAllShipMarkers(), e.forEach((t) => {
837
- const o = [t.lon, t.lat], n = new Feature({
838
- geometry: new Point(fromLonLat(o))
839
- }), a = new ShipMapData(
840
- t.id,
841
- t.id,
842
- // 船舶三角形填充色
843
- t.fill || "#04C900",
844
- "70",
845
- t.cnname || t.name,
846
- t.len,
847
- t.wid,
848
- t.lon,
849
- t.lat,
850
- (/* @__PURE__ */ new Date()).getTime(),
851
- t.spd,
852
- t.from,
853
- t.status,
854
- Number(t.hdg),
855
- t.cog,
856
- Number(t.postype),
857
- "other",
858
- t.cog,
859
- 1
860
- );
861
- n.set("data", a), n.setStyle(
862
- setShipStyle(!1, t.id)
883
+ if (!mapInstance.value) return;
884
+ deleteAllShipMarkers();
885
+ let t = convertShipMapData(e);
886
+ if (t = customFilterShips(t), !!(t != null && t.length))
887
+ return t.forEach((o) => {
888
+ const n = [o.lon, o.lat], a = new Feature({
889
+ geometry: new Point(fromLonLat(n))
890
+ });
891
+ a.set("data", o), a.setStyle(
892
+ setShipStyle(!1, o.id)
863
893
  ), shipsMarkerList.push({
864
- ship: t,
865
- lonlat: o,
866
- feature: n
894
+ ship: o,
895
+ lonlat: n,
896
+ feature: a
867
897
  });
868
898
  }), shipsVectorSource = new VectorSource({
869
- features: shipsMarkerList.map((t) => t.feature)
899
+ features: shipsMarkerList.map((o) => o.feature)
870
900
  }), shipsLayer.value = new VectorLayer({
871
901
  source: shipsVectorSource
872
902
  }), mapInstance.value.addLayer(shipsLayer.value), shipsLayer.value;
873
- }, deleteAllShipMarkers = () => {
903
+ }, customFilterShips = (e) => {
904
+ let t = cloneDeep(e);
905
+ return t = t.filter((o) => {
906
+ var a, r, l;
907
+ let n = getFilterItem(o).every(({ btnShow: s, value: c }) => s ? !!c : !0);
908
+ return switchBtnShow.value.camera || switchBtnShow.value.mobile || switchBtnShow.value.waterGauge ? ((a = selectedShipData.value) == null ? void 0 : a.id) === o.id && clearSelectFeature() : (r = selectedShipData.value) != null && r.id && findShip((l = selectedShipData.value) == null ? void 0 : l.id, selectedShipData.value, !1), n;
909
+ }), t;
910
+ }, getFilterItem = (e) => [
911
+ { btnShow: switchBtnShow.value.camera, value: e == null ? void 0 : e.existDevice },
912
+ { btnShow: switchBtnShow.value.mobile, value: e == null ? void 0 : e.existMobile },
913
+ { btnShow: switchBtnShow.value.waterGauge, value: e == null ? void 0 : e.existWaterGauge }
914
+ ], deleteAllShipMarkers = () => {
874
915
  shipsMarkerList.forEach((e) => {
875
916
  e.feature && (shipsVectorSource == null || shipsVectorSource.removeFeature(e.feature));
876
917
  }), shipsMarkerList = [];
877
- }, findShip = (e) => {
878
- var t, o, n;
879
- return (n = (o = (t = shipsLayer.value) == null ? void 0 : t.getSource()) == null ? void 0 : o.getFeatures()) == null ? void 0 : n.find((a) => {
880
- var r;
881
- return ((r = a.get("data")) == null ? void 0 : r.id) === e;
918
+ }, selectSingleShipMarker = (e) => {
919
+ if (!mapInstance.value) return;
920
+ const t = convertShipMapData(e), o = [t.lon, t.lat], n = new Feature({
921
+ geometry: new Point(fromLonLat(o))
922
+ });
923
+ return n.set("data", t), n.setStyle(
924
+ setShipStyle(!0, t.id)
925
+ ), shipsMarkerList.push({
926
+ ship: t,
927
+ lonlat: o,
928
+ feature: n
929
+ }), selectShipsVectorSource = new VectorSource({
930
+ features: [n]
931
+ }), selectShipsLayer.value = new VectorLayer({
932
+ source: selectShipsVectorSource
933
+ }), mapInstance.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!0), selectShipsLayer.value;
934
+ }, findShip = (e, t, o = !0) => {
935
+ var a, r, l, s, c;
936
+ if (!e || !mapInstance.value) return;
937
+ const n = (l = (r = (a = shipsLayer.value) == null ? void 0 : a.getSource()) == null ? void 0 : r.getFeatures()) == null ? void 0 : l.find((d) => {
938
+ var u;
939
+ return ((u = d.get("data")) == null ? void 0 : u.id) === e;
882
940
  });
941
+ if (n)
942
+ selectedShipData.value = n;
943
+ else if (t)
944
+ selectedShipData.value = t, selectSingleShipMarker(t);
945
+ else {
946
+ console.error("找不到船舶");
947
+ return;
948
+ }
949
+ if (o && ((s = selectedShipData.value) != null && s.lon) && ((c = selectedShipData.value) != null && c.lat)) {
950
+ const d = mapInstance.value.getView(), u = new Point([selectedShipData.value.lon, selectedShipData.value.lat]);
951
+ d.setCenter(transform(u.getCoordinates(), projection.data, projection.mercator));
952
+ const m = d.getZoom(), i = m < mapZoom.findShip ? mapZoom.findShip : m;
953
+ d.setZoom(i);
954
+ }
955
+ return n;
956
+ }, clearSelectFeature = () => {
957
+ selectedShipData.value = null, mapInstance.value && (selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsLayer.value = new VectorLayer({
958
+ source: selectShipsVectorSource
959
+ }), mapInstance.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!1));
960
+ }, hiddenAllShips = () => {
961
+ var e, t;
962
+ (e = shipsLayer.value) == null || e.setVisible(!1), (t = largeAmountShipsLayer.value) == null || t.setVisible(!1);
963
+ }, switchBtnShow = ref({
964
+ // 船舶摄像头过滤开关
965
+ [SWITCH_BTN.Camera]: !1,
966
+ // 船舶联系方式过滤开关
967
+ [SWITCH_BTN.Mobile]: !1,
968
+ // 船舶水尺过滤开关
969
+ [SWITCH_BTN.WaterGauge]: !1
970
+ }), switchFilterItem = (e, t) => {
971
+ switchBtnShow.value[e] = t, renderShips(allShips.value);
972
+ }, rerenderShip = () => {
973
+ renderShips(allShips.value);
883
974
  }, stopIcon = "&#xe6e2;", stopColor = "#E31818", slowIcon = "&#xe703;", slowColor = "#1890FF", dropletsIcon = "&#xe6d2", trackList$1 = ref([]), renderTrackLine = (e, t, o) => {
884
- var r;
975
+ var r, l;
885
976
  const n = e[t];
886
977
  if (!n) return;
887
- trackList$1.value = n.reverse().map((l, s) => (l.center = [l.lon, l.lat], l.centerPoint = lonLatToMercator(l.center), l.id = t, l.index = s, l.time = hooks(l.createdAt).format("YYYY-MM-DD HH:mm:ss"), l));
888
- let a = trackList$1.value.map((l) => l.centerPoint);
978
+ (r = trackLineVectorSource.value) == null || r.clear(), trackList$1.value = [], trackList$1.value = n.reverse().map((s, c) => (s.center = [s.lon, s.lat], s.centerPoint = lonLatToMercator(s.center), s.id = t, s.index = c, s.time = hooks(s.createdAt).format("YYYY-MM-DD HH:mm:ss"), s));
979
+ let a = trackList$1.value.map((s) => s.centerPoint);
889
980
  if (a.length >= 2) {
890
- let l = new LineString(a);
891
- const s = new Feature({ geometry: l });
892
- s.setStyle(
981
+ let s = new LineString(a);
982
+ const c = new Feature({ geometry: s });
983
+ c.setStyle(
893
984
  new Style({
894
985
  stroke: new Stroke({
895
986
  color: o,
896
987
  width: 2
897
988
  })
898
989
  })
899
- ), s.setId(t), s.set("type", "line");
900
- const c = shipTrackLineFeatures.value.findIndex((d) => d.getId() === t);
901
- c >= 0 ? shipTrackLineFeatures.value[c] = s : shipTrackLineFeatures.value.push(s), trackLineVectorSource.value = new VectorSource({
990
+ ), c.setId(t), c.set("type", "line");
991
+ const d = shipTrackLineFeatures.value.findIndex((u) => u.getId() === t);
992
+ d >= 0 ? shipTrackLineFeatures.value[d] = c : shipTrackLineFeatures.value.push(c), trackLineVectorSource.value = new VectorSource({
902
993
  features: shipTrackLineFeatures.value
903
994
  }), shipTrackVectorLayer.value = new VectorLayer({
904
- source: trackLineVectorSource.value,
905
- style: {
906
- "fill-color": "rgba(255, 255, 255, 0.2)",
907
- "stroke-color": "#ffcc33",
908
- "stroke-width": 2,
909
- "circle-radius": 7,
910
- "circle-fill-color": "#ffcc33"
911
- }
912
- }), renderPoint(o), (r = mapInstance.value) == null || r.addLayer(shipTrackVectorLayer.value);
995
+ source: trackLineVectorSource.value
996
+ }), setTimeout(() => {
997
+ renderPoint(o);
998
+ }, 500), (l = mapInstance.value) == null || l.addLayer(shipTrackVectorLayer.value);
913
999
  }
914
1000
  }, renderPoint = (e) => {
915
1001
  if (!mapInstance.value) return;
@@ -964,15 +1050,15 @@ const renderShips = (e) => {
964
1050
  geometry: new Point(s.centerPoint)
965
1051
  });
966
1052
  i.set("type", "track_icon");
967
- let v = new Style({
1053
+ let h = new Style({
968
1054
  text: new Text({
969
1055
  font: "Normal 22px iconfont",
970
1056
  text: getIconFont(dropletsIcon),
971
1057
  offsetY: -10
972
1058
  }),
973
1059
  zIndex: 99
974
- }), k = [];
975
- s.state === "0" ? ((u = v.getText()) == null || u.setFill(new Fill({ color: stopColor })), k.push(r)) : ((m = v.getText()) == null || m.setFill(new Fill({ color: slowColor })), k.push(l)), k.push(v), i.setStyle(k), trackLineVectorSource.value.addFeature(i);
1060
+ }), w = [];
1061
+ s.state === "0" ? ((u = h.getText()) == null || u.setFill(new Fill({ color: stopColor })), w.push(r)) : ((m = h.getText()) == null || m.setFill(new Fill({ color: slowColor })), w.push(l)), w.push(h), i.setStyle(w), trackLineVectorSource.value.addFeature(i);
976
1062
  }
977
1063
  }), renderArrow(n, e), renderIconPoint();
978
1064
  }, renderArrow = (e, t) => {
@@ -1032,9 +1118,14 @@ const renderShips = (e) => {
1032
1118
  const a = n.context;
1033
1119
  drawLabel(a, o, e.time, t, "#000", "rgba(255,255,255,.8)");
1034
1120
  }
1035
- }), showTracks = ref([]), trackList = ref([]), trackLayer = ref(null), trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, a = "ship") => {
1121
+ }), showTracks = ref([]), trackList = ref([]);
1122
+ ref(null);
1123
+ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, a = "ship") => {
1036
1124
  var u;
1037
- if (removeAllTrackLayer(), (t == null ? void 0 : t.length) < 2) {
1125
+ if (nextTick(() => {
1126
+ hiddenAllShips();
1127
+ }).then((m) => {
1128
+ }), (t == null ? void 0 : t.length) < 2) {
1038
1129
  ((u = showTracks.value) == null ? void 0 : u.findIndex((m) => m.id === e)) < 0 && showTracks.value.push({ id: e, length: "" });
1039
1130
  return;
1040
1131
  }
@@ -1047,13 +1138,13 @@ const renderShips = (e) => {
1047
1138
  ), c = new LineString(s), d = formatLength(c, n) || "--";
1048
1139
  nextTick(() => {
1049
1140
  var i;
1050
- const m = (i = showTracks.value) == null ? void 0 : i.findIndex((v) => v.id === e);
1141
+ const m = (i = showTracks.value) == null ? void 0 : i.findIndex((h) => h.id === e);
1051
1142
  m < 0 ? showTracks.value.push({ id: e, length: d }) : showTracks.value[m].length = d, renderTrackLine(r, e, o), ++cursor.value, cursor.value > l.length && (cursor.value = 0), resetTrackView(e);
1052
1143
  }).then(() => {
1053
1144
  });
1054
1145
  }, removeAllTrackLayer = () => {
1055
1146
  var e;
1056
- (e = trackLayer.value) == null || e.removeAllLayer();
1147
+ showTracks.value = [], (e = trackLineVectorSource.value) == null || e.clear();
1057
1148
  }, resetTrackView = (e) => {
1058
1149
  var n, a;
1059
1150
  const t = mapInstance.value.getView(), o = (a = (n = shipTrackLineFeatures.value.find((r) => r.getId() === e)) == null ? void 0 : n.getGeometry()) == null ? void 0 : a.getExtent();
@@ -1063,6 +1154,76 @@ const renderShips = (e) => {
1063
1154
  } catch (r) {
1064
1155
  console.log(r);
1065
1156
  }
1157
+ }, drawCustomContent = (e, t, o, n = "top-left", a = !1) => {
1158
+ var u, m;
1159
+ if (!t || !mapInstance.value) return;
1160
+ document.querySelectorAll(".truck-custom-content").forEach((i) => i.parentNode.removeChild(i));
1161
+ const r = document.createElement("div");
1162
+ r.innerHTML = o;
1163
+ const l = new Overlay({
1164
+ element: r,
1165
+ position: t,
1166
+ // 初始位置
1167
+ positioning: n,
1168
+ stopEvent: a
1169
+ // 设置不阻拦事件
1170
+ });
1171
+ if (a) {
1172
+ let i = !1, h = [0, 0], w = [0, 0];
1173
+ r.addEventListener("mousedown", function(L) {
1174
+ var I;
1175
+ i = !0, L.clientX, L.clientY, h = (I = mapInstance.value) == null ? void 0 : I.getCoordinateFromPixel([L.clientX - 200, L.clientY - 200]), w = [
1176
+ L.clientX - r.getBoundingClientRect().left + 160,
1177
+ L.clientY - r.getBoundingClientRect().top + 84
1178
+ ], L.preventDefault();
1179
+ }), document.addEventListener("mousemove", function(L) {
1180
+ var I;
1181
+ if (i) {
1182
+ let T = (I = mapInstance.value) == null ? void 0 : I.getCoordinateFromPixel([L.clientX - w[0], L.clientY - w[1]]), b = T[0] - h[0], p = T[1] - h[1];
1183
+ l.setPosition([h[0] + b, h[1] + p]);
1184
+ }
1185
+ }), document.addEventListener("mouseup", function() {
1186
+ i = !1;
1187
+ });
1188
+ }
1189
+ (u = mapInstance.value) == null || u.addOverlay(l);
1190
+ const s = r.querySelector(".close-button");
1191
+ s && s.addEventListener("click", () => {
1192
+ var i, h;
1193
+ (i = mapInstance.value) == null || i.removeOverlay(l), (h = r.parentNode) == null || h.removeChild(r);
1194
+ });
1195
+ let c = JSON.parse(JSON.stringify(t));
1196
+ const d = (m = mapInstance.value) == null ? void 0 : m.getCoordinateFromPixel(c);
1197
+ return l.setPosition(d), l;
1198
+ }, vehicle = ref(null), focusShipData = ref(), currentTruckOverlay = ref(null), findTruck = async (e) => {
1199
+ if (!mapInstance.value) return;
1200
+ focusShipData.value = e;
1201
+ const t = convertSixHundredThousandToLatLng(e.lon, e.lat), o = mapInstance.value.getPixelFromCoordinate(transform(t, projection.data, projection.mercator));
1202
+ currentTruckOverlay.value = drawTruckIcon(e.vno, o, e == null ? void 0 : e.drc);
1203
+ const n = mapInstance.value.getView(), a = new Point(t);
1204
+ n.setCenter(transform(a.getCoordinates(), projection.data, projection.mercator));
1205
+ }, clearAllTruck = () => {
1206
+ vehicle.value.clearAllShip();
1207
+ }, drawTruckIcon = (e, t, o) => {
1208
+ const n = `<div id="${e}" class="ol-custom-content truck-custom-content" style="width: 80px; height: 80px; transform: rotate(${o}deg);">
1209
+ <img src="${CDN_URL}map/car-icon.gif" width="100%" height="100%" />
1210
+ </div>`;
1211
+ return drawCustomContent(e, t, n, "center-center");
1212
+ }, removeTruckIcon = () => {
1213
+ var t;
1214
+ const e = (t = currentTruckOverlay.value) == null ? void 0 : t.getElement();
1215
+ e && (e.innerHTML = "");
1216
+ }, zoomTruckIcon = () => {
1217
+ var r;
1218
+ if (!mapInstance.value) return;
1219
+ const e = mapInstance.value.getView().getZoom(), t = 120, o = 60;
1220
+ function n(l) {
1221
+ return l < 14 ? o : l >= 14 && l <= 18 ? Math.round((l - 14) * (t - o) / 4 + o) : t;
1222
+ }
1223
+ const a = n(e);
1224
+ (r = document.querySelectorAll(".truck-custom-content")) == null || r.forEach((l) => {
1225
+ l.style.width = `${a}px`, l.style.height = `${a}px`;
1226
+ });
1066
1227
  }, _sfc_main = /* @__PURE__ */ defineComponent({
1067
1228
  __name: "Map",
1068
1229
  props: {
@@ -1077,8 +1238,8 @@ const renderShips = (e) => {
1077
1238
  ((p) => {
1078
1239
  p[p.tiandituTile = new TileLayer({ source: new XYZ({ url: baseMap.tiandituTile }) })] = "tiandituTile", p[p.tiandituTileMark = new TileLayer({ source: new XYZ({ url: baseMap.tiandituTileMark }) })] = "tiandituTileMark", p[p.tiandituImgTile = new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTile }), visible: !1 })] = "tiandituImgTile", p[p.tiandituImgTileMark = new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTileMark }), visible: !1 })] = "tiandituImgTileMark", p[p.greenMark = new TileLayer({ source: new XYZ({ url: baseMap.greenTile }) })] = "greenMark";
1079
1240
  })(i || (i = {}));
1080
- const v = () => {
1081
- var g;
1241
+ const h = () => {
1242
+ var v;
1082
1243
  const p = {
1083
1244
  projection: projection.mercator,
1084
1245
  // 地图投影坐标系
@@ -1105,59 +1266,76 @@ const renderShips = (e) => {
1105
1266
  i.greenMark
1106
1267
  ],
1107
1268
  view: new View(p)
1108
- }), a.value.setScaleLine(), console.log(mapInstance.value.getLayers().getArray()), (g = mapInstance.value) == null || g.on("moveend", E);
1269
+ }), a.value.setScaleLine(), console.log(mapInstance.value.getLayers().getArray()), (v = mapInstance.value) == null || v.on("moveend", I);
1109
1270
  };
1110
1271
  onMounted(() => {
1111
- v();
1272
+ h();
1112
1273
  });
1113
- const k = (p) => {
1114
- var g;
1115
- (g = mapInstance.value) == null || g.getLayers().forEach((f) => {
1274
+ const w = (p) => {
1275
+ var v;
1276
+ (v = mapInstance.value) == null || v.getLayers().forEach((f) => {
1116
1277
  f.ol_uid === i.greenMark.ol_uid && (f.setVisible(p), u.value = p);
1117
1278
  });
1118
- }, I = (p) => {
1119
- var g;
1120
- console.log("mode", p), (g = mapInstance.value) == null || g.getLayers().forEach((f) => {
1279
+ }, L = (p) => {
1280
+ var v;
1281
+ console.log("mode", p), (v = mapInstance.value) == null || v.getLayers().forEach((f) => {
1121
1282
  (f.ol_uid === i.tiandituTile.ol_uid || f.ol_uid === i.tiandituTileMark.ol_uid || f.ol_uid === i.tiandituImgTile.ol_uid || f.ol_uid === i.tiandituImgTileMark.ol_uid) && f.setVisible(!1), (p === BaseMapType.vector && f.ol_uid === i.tiandituTile.ol_uid || f.ol_uid === i.tiandituTileMark.ol_uid || p === BaseMapType.satellite && f.ol_uid === i.tiandituImgTile.ol_uid || f.ol_uid === i.tiandituImgTileMark.ol_uid) && (console.log(p, f.ol_uid), f.setVisible(!0));
1122
1283
  });
1123
- }, E = () => {
1124
- const p = mapInstance.value.getView(), g = p.getZoom();
1125
- g && w(g);
1284
+ }, I = () => {
1285
+ const p = mapInstance.value.getView(), v = p.getZoom();
1286
+ v && T(v);
1126
1287
  const f = p.calculateExtent(mapInstance.value.getSize());
1127
- f && g && _(f, g);
1128
- }, w = (p) => {
1129
- var S;
1288
+ f && v && b(f, v);
1289
+ }, T = (p) => {
1290
+ var M, E, C, g;
1130
1291
  c.value = p;
1131
- const g = (S = mapInstance.value) == null ? void 0 : S.getLayers(), f = s.vehicleMode === "ship" ? g == null ? void 0 : g.getArray().find((V) => V.ol_uid === i.greenMark.ol_uid) : void 0;
1132
- !d.value && u.value && p < mapZoom.shipGreenDotMax ? (m.value = !0, f == null || f.setVisible(!0)) : (m.value = !1, f == null || f.setVisible(!1)), l("zoomChanged", p);
1133
- }, _ = (p, g) => {
1134
- const f = transform([p[0], p[1]], projection.mercator, projection.data), S = transform([p[2], p[3]], projection.mercator, projection.data);
1135
- l("extentChanged", { extent: [f, S], zoom: g });
1292
+ const v = (M = mapInstance.value) == null ? void 0 : M.getLayers(), f = s.vehicleMode === "ship" ? v == null ? void 0 : v.getArray().find((S) => S.ol_uid === i.greenMark.ol_uid) : void 0;
1293
+ !d.value && u.value && p < mapZoom.shipGreenDotMax ? (m.value = !0, f == null || f.setVisible(!0), (E = shipsLayer.value) == null || E.setVisible(!1), (C = largeAmountShipsLayer.value) == null || C.setVisible(!1)) : (m.value = !1, f == null || f.setVisible(!1), (g = largeAmountShipsLayer.value) == null || g.setVisible(!0)), l("zoomChanged", p);
1294
+ }, b = (p, v) => {
1295
+ const f = transform([p[0], p[1]], projection.mercator, projection.data), M = transform([p[2], p[3]], projection.mercator, projection.data);
1296
+ l("extentChanged", { extent: [f, M], zoom: v });
1136
1297
  };
1137
1298
  return t({
1138
1299
  mapInstance,
1139
- initMap: v,
1300
+ initMap: h,
1140
1301
  renderTrucksMarker,
1141
- renderShips,
1302
+ renderShip: renderShips,
1142
1303
  renderTrack,
1304
+ findTruck,
1305
+ removeTruckIcon,
1306
+ clearAllTruck,
1143
1307
  closeTrack: () => {
1144
1308
  var p;
1145
1309
  (p = shipTrackVectorLayer.value) == null || p.setVisible(!1);
1146
1310
  },
1147
- findShip
1148
- }), (p, g) => (openBlock(), createElementBlock("div", {
1311
+ closeTruckTrack: () => {
1312
+ var p;
1313
+ (p = shipTrackVectorLayer.value) == null || p.setVisible(!1);
1314
+ },
1315
+ clearSelectFeature,
1316
+ findShip,
1317
+ showTracks,
1318
+ removeAllTrackLayer,
1319
+ switchFilterItem,
1320
+ rerenderShip,
1321
+ switchGreenDot: () => w(!1),
1322
+ zoomTruckIcon,
1323
+ renderTruckTrack: (p, v, f) => {
1324
+ renderTrack(p, v, f, LENGTH_UNIT.KM, "truck");
1325
+ }
1326
+ }), (p, v) => (openBlock(), createElementBlock("div", {
1149
1327
  class: "map-page map-container",
1150
1328
  ref_key: "pageRef",
1151
1329
  ref: n
1152
1330
  }, [
1153
- g[0] || (g[0] = createElementVNode("div", {
1331
+ v[0] || (v[0] = createElementVNode("div", {
1154
1332
  id: "map",
1155
1333
  class: "map"
1156
1334
  }, null, -1)),
1157
1335
  createVNode(ToolPanel, {
1158
1336
  "vehicle-mode": p.vehicleMode,
1159
- onSwitchGreenDot: k,
1160
- onSwitchMapTile: I
1337
+ onSwitchGreenDot: w,
1338
+ onSwitchMapTile: L
1161
1339
  }, null, 8, ["vehicle-mode"]),
1162
1340
  createVNode(ScaleLine, {
1163
1341
  ref_key: "scaleLineControl",
@@ -1165,19 +1343,13 @@ const renderShips = (e) => {
1165
1343
  }, null, 512),
1166
1344
  createVNode(ZoomControl, {
1167
1345
  ref_key: "zoomControl",
1168
- ref: r,
1169
- map: unref(mapInstance)
1170
- }, null, 8, ["map"]),
1346
+ ref: r
1347
+ }, null, 512),
1171
1348
  createVNode(Copyright),
1172
- createVNode(Fullscreen, { page: n.value }, null, 8, ["page"]),
1173
- g[1] || (g[1] = createElementVNode("span", {
1174
- class: "icon map-iconfont",
1175
- style: { "user-select": "text" }
1176
- }, " ", -1)),
1177
- g[2] || (g[2] = createElementVNode("span", { class: "icon map-iconfont icon-arrow" }, null, -1))
1349
+ createVNode(Fullscreen, { page: n.value }, null, 8, ["page"])
1178
1350
  ], 512));
1179
1351
  }
1180
- }), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e4db8f6e"]]), ZhMap = withInstall(Map);
1352
+ }), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-1bfdec9b"]]), ZhMap = withInstall(Map);
1181
1353
  export {
1182
1354
  ZhMap as Z
1183
1355
  };