hy-dispatch-ui-v3 0.2.78 → 0.2.80

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 (36) hide show
  1. package/dist/tailwind.css +18 -4
  2. package/es/components/hyDatePicker/datePicker.vue.mjs +34 -4
  3. package/es/components/hyForm/cpns/formItem.vue.mjs +71 -62
  4. package/es/components/hyForm/js/useAppForm.mjs +4 -3
  5. package/es/components/hyLocationMap/index.mjs +7 -0
  6. package/es/components/hyLocationMap/locationMap.vue.mjs +215 -0
  7. package/es/components/hyLocationMap/style/locationMap.scss +0 -0
  8. package/es/components/hyMap/js/index.mjs +6 -4
  9. package/es/components/hySearch/js/useAppSearch.mjs +4 -31
  10. package/es/components/hyTable/js/search.mjs +1 -1
  11. package/es/components/hyTooltip/tooltip.vue.mjs +27 -17
  12. package/es/components/index.mjs +1 -0
  13. package/es/index.mjs +2 -1
  14. package/es/utils/form.mjs +68 -22
  15. package/es/utils/index.mjs +1 -1
  16. package/es/utils/is.mjs +1 -1
  17. package/es/utils/permission.mjs +3 -1
  18. package/es/version.mjs +1 -1
  19. package/lib/components/hyDatePicker/datePicker.vue.js +32 -2
  20. package/lib/components/hyForm/cpns/formItem.vue.js +70 -61
  21. package/lib/components/hyForm/js/useAppForm.js +2 -1
  22. package/lib/components/hyLocationMap/index.js +12 -0
  23. package/lib/components/hyLocationMap/locationMap.vue.js +219 -0
  24. package/lib/components/hyLocationMap/style/locationMap.scss +0 -0
  25. package/lib/components/hyMap/js/index.js +6 -4
  26. package/lib/components/hySearch/js/useAppSearch.js +2 -29
  27. package/lib/components/hyTable/js/search.js +1 -1
  28. package/lib/components/hyTooltip/tooltip.vue.js +26 -16
  29. package/lib/components/index.js +30 -28
  30. package/lib/index.js +50 -46
  31. package/lib/utils/form.js +69 -21
  32. package/lib/utils/index.js +2 -0
  33. package/lib/utils/is.js +1 -1
  34. package/lib/utils/permission.js +3 -1
  35. package/lib/version.js +1 -1
  36. package/package.json +1 -1
package/dist/tailwind.css CHANGED
@@ -273,6 +273,10 @@
273
273
  z-index: 20;
274
274
  }
275
275
 
276
+ .z-50 {
277
+ z-index: 50;
278
+ }
279
+
276
280
  .z-\[1\] {
277
281
  z-index: 1;
278
282
  }
@@ -1027,10 +1031,6 @@
1027
1031
  max-width: 200px;
1028
1032
  }
1029
1033
 
1030
- .max-w-\[300px\] {
1031
- max-width: 300px;
1032
- }
1033
-
1034
1034
  .max-w-full {
1035
1035
  max-width: 100%;
1036
1036
  }
@@ -1674,6 +1674,10 @@
1674
1674
  padding-left: 52px;
1675
1675
  }
1676
1676
 
1677
+ .pr-0 {
1678
+ padding-right: 0px;
1679
+ }
1680
+
1677
1681
  .pr-1 {
1678
1682
  padding-right: 0.25rem;
1679
1683
  }
@@ -1769,6 +1773,11 @@
1769
1773
  line-height: 1.25rem;
1770
1774
  }
1771
1775
 
1776
+ .text-xl {
1777
+ font-size: 1.25rem;
1778
+ line-height: 1.75rem;
1779
+ }
1780
+
1772
1781
  .text-xs {
1773
1782
  font-size: 0.75rem;
1774
1783
  line-height: 1rem;
@@ -1843,6 +1852,11 @@
1843
1852
  color: rgb(var(--hy-main), var(--tw-text-opacity, 1));
1844
1853
  }
1845
1854
 
1855
+ .text-red-800 {
1856
+ --tw-text-opacity: 1;
1857
+ color: rgb(153 27 27 / var(--tw-text-opacity, 1));
1858
+ }
1859
+
1846
1860
  .text-success {
1847
1861
  --tw-text-opacity: 1;
1848
1862
  color: rgb(var(--hy-success), var(--tw-text-opacity, 1));
@@ -1,10 +1,11 @@
1
- import { defineComponent, useTemplateRef, useModel, computed, watch, unref, openBlock, createBlock, mergeProps, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps, mergeModels } from 'vue';
1
+ import { defineComponent, useTemplateRef, useModel, computed, watch, ref, unref, openBlock, createBlock, mergeProps, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps, mergeModels } from 'vue';
2
+ import dayjs from 'dayjs';
2
3
  import { ElDatePicker } from 'element-plus';
3
4
  import '../../utils/index.mjs';
4
5
  import '../../hooks/index.mjs';
5
6
  import { $t } from '../../hooks/useLocale.mjs';
6
7
  import { getDefaultValueFormatByType } from '../../utils/date.mjs';
7
- import { isArray } from '../../utils/is.mjs';
8
+ import { isArray, isNumber, isFunction } from '../../utils/is.mjs';
8
9
 
9
10
  import "./style/datePicker.scss";
10
11
 
@@ -33,7 +34,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
33
34
  type: String
34
35
  },
35
36
  startPlaceholder: String,
36
- endPlaceholder: String
37
+ endPlaceholder: String,
38
+ disabledDate: Function,
39
+ // 超出禁用天数
40
+ exceedDisableDays: Number
37
41
  }, {
38
42
  "modelValue": { type: [String, Date, Array] },
39
43
  "modelModifiers": {},
@@ -111,6 +115,30 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
111
115
  }
112
116
  emits("change", dateValue.value);
113
117
  }
118
+ const pickDate = ref();
119
+ const exceedDisableDays = computed(() => {
120
+ const val = Number(props.exceedDisableDays);
121
+ return isNumber(val) ? val : void 0;
122
+ });
123
+ const disabledDate = (date) => {
124
+ if (isFunction(props.disabledDate)) return props.disabledDate(date);
125
+ if (!pickDate.value || !isNumber(exceedDisableDays.value) || exceedDisableDays.value < 1) {
126
+ return false;
127
+ }
128
+ const minTime = dayjs(pickDate.value).subtract(exceedDisableDays.value - 1, "day");
129
+ const maxTime = dayjs(pickDate.value).add(exceedDisableDays.value - 1, "day");
130
+ return date.getTime() < minTime.valueOf() || date.getTime() > maxTime.valueOf();
131
+ };
132
+ function onCalendarChangeHandler(dates) {
133
+ if (!dates || !isNumber(exceedDisableDays.value) || exceedDisableDays.value < 1 || !["daterange", "datetimerange"].includes(props.type)) {
134
+ return;
135
+ }
136
+ const [start, end] = dates;
137
+ pickDate.value = start ? start.getTime() : null;
138
+ if (end) {
139
+ pickDate.value = null;
140
+ }
141
+ }
114
142
  __expose({
115
143
  focus() {
116
144
  if (!unref(appDatePicker)) return;
@@ -142,7 +170,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
142
170
  "start-placeholder": startPlaceholder.value,
143
171
  "range-separator": unref($t)("datePicker.to"),
144
172
  "end-placeholder": endPlaceholder.value,
145
- onChange: onChangeHandler
173
+ disabledDate,
174
+ onChange: onChangeHandler,
175
+ onCalendarChange: onCalendarChangeHandler
146
176
  }), createSlots({
147
177
  _: 2
148
178
  /* DYNAMIC */
@@ -6,7 +6,7 @@ import '../../index.mjs';
6
6
  import { formContextKey, optionsHandler, isRequired, columnVisibleHandler, columnItemStyle, columnShowHandler, isReadonly, renderText, isDisabled } from '../js/index.mjs';
7
7
  import '../../../hooks/index.mjs';
8
8
  import { isBoolean, isArray } from '../../../utils/is.mjs';
9
- import { setValueByProp, getValueByProp, columnPlaceholderHandler, columnnoDataTextHandler, columnLabelHandler, columnRuleHandler, columnHelpHandler } from '../../../utils/form.mjs';
9
+ import { setValueByProp, getValueByProp, genColumnShortcuts, columnPlaceholderHandler, columnnoDataTextHandler, columnLabelHandler, columnRuleHandler, columnHelpHandler } from '../../../utils/form.mjs';
10
10
  import { HyTooltip } from '../../hyTooltip/index.mjs';
11
11
  import { HyIcon } from '../../hyIcon/index.mjs';
12
12
  import { $t } from '../../../hooks/useLocale.mjs';
@@ -123,7 +123,8 @@ const _sfc_main = {
123
123
  ...attrs,
124
124
  label: columnLabelHandler(props.column, props.model),
125
125
  noDataText: columnnoDataTextHandler(props.column, props.model),
126
- placeholder: columnPlaceholderHandler(props.column, props.model)
126
+ placeholder: columnPlaceholderHandler(props.column, props.model),
127
+ shortcuts: genColumnShortcuts(props.column)
127
128
  };
128
129
  });
129
130
  async function obtainOptions(isMountedLoad = false) {
@@ -261,74 +262,82 @@ const _sfc_main = {
261
262
  "show-message": showMessage.value
262
263
  }, createSlots({
263
264
  default: withCtx(() => [
264
- createElementVNode("div", { class: "w-full flex justify-between text-main" }, [
265
- createElementVNode("div", { class: "flex items-center" }, [
266
- createElementVNode("span", { class: "text-main whitespace-nowrap" }, [
267
- renderSlot(_ctx.$slots, __props.column.labelSlot, {
268
- column: columnConfig.value,
269
- model: __props.model,
270
- required: unref(isRequired)(props, __props.column)
271
- }, () => [
272
- createTextVNode(
273
- toDisplayString(unref(columnLabelHandler)(__props.column, props.model) || "\xA0"),
274
- 1
275
- /* TEXT */
276
- )
277
- ])
278
- ]),
279
- unref(isRequired)(props, __props.column) ? (openBlock(), createElementBlock("span", {
280
- key: 0,
281
- class: "label-required"
282
- })) : createCommentVNode("v-if", true),
283
- unref(columnHelpHandler)(props, __props.column) || __props.column.tooltipContentSlot ? (openBlock(), createBlock(unref(HyTooltip), {
284
- key: 1,
285
- "is-always": "",
286
- overLine: 1
287
- }, {
288
- content: withCtx(() => [
289
- !__props.column.tooltipContentSlot ? (openBlock(), createElementBlock(
290
- "span",
291
- { key: 0 },
292
- toDisplayString(unref(columnHelpHandler)(props, __props.column)),
293
- 1
294
- /* TEXT */
295
- )) : createCommentVNode("v-if", true),
296
- renderSlot(_ctx.$slots, __props.column.tooltipContentSlot, {
265
+ createElementVNode(
266
+ "div",
267
+ {
268
+ class: normalizeClass(["w-full flex justify-between text-main", __props.column.labelClass])
269
+ },
270
+ [
271
+ createElementVNode("div", { class: "flex items-center" }, [
272
+ createElementVNode("span", { class: "text-main whitespace-nowrap" }, [
273
+ renderSlot(_ctx.$slots, __props.column.labelSlot, {
297
274
  column: columnConfig.value,
298
275
  model: __props.model,
299
276
  required: unref(isRequired)(props, __props.column)
300
- })
301
- ]),
302
- default: withCtx(() => [
303
- createElementVNode("span", { class: "text-xs text-theme ml-2" }, [
304
- createVNode(unref(HyIcon), {
305
- "svg-name": "dispatch-share-v3-base-help",
306
- class: "!w-3 !h-3 mr-1"
307
- }),
308
- createElementVNode(
309
- "span",
310
- null,
311
- toDisplayString(unref($t)("hy.help")),
277
+ }, () => [
278
+ createTextVNode(
279
+ toDisplayString(unref(columnLabelHandler)(__props.column, props.model) || "\xA0"),
312
280
  1
313
281
  /* TEXT */
314
282
  )
315
283
  ])
316
284
  ]),
317
- _: 3
318
- /* FORWARDED */
319
- })) : createCommentVNode("v-if", true)
320
- ]),
321
- __props.column.rightSlot && _ctx.$slots[__props.column.rightSlot] ? (openBlock(), createElementBlock("div", {
322
- key: 0,
323
- class: "ml-2 flex items-center"
324
- }, [
325
- renderSlot(_ctx.$slots, __props.column.rightSlot, {
326
- column: columnConfig.value,
327
- model: __props.model,
328
- required: unref(isRequired)(props, __props.column)
329
- })
330
- ])) : createCommentVNode("v-if", true)
331
- ]),
285
+ unref(isRequired)(props, __props.column) ? (openBlock(), createElementBlock("span", {
286
+ key: 0,
287
+ class: "label-required"
288
+ })) : createCommentVNode("v-if", true),
289
+ unref(columnHelpHandler)(props, __props.column) || __props.column.tooltipContentSlot ? (openBlock(), createBlock(unref(HyTooltip), {
290
+ key: 1,
291
+ "is-always": "",
292
+ overLine: 1
293
+ }, {
294
+ content: withCtx(() => [
295
+ !__props.column.tooltipContentSlot ? (openBlock(), createElementBlock(
296
+ "span",
297
+ { key: 0 },
298
+ toDisplayString(unref(columnHelpHandler)(props, __props.column)),
299
+ 1
300
+ /* TEXT */
301
+ )) : createCommentVNode("v-if", true),
302
+ renderSlot(_ctx.$slots, __props.column.tooltipContentSlot, {
303
+ column: columnConfig.value,
304
+ model: __props.model,
305
+ required: unref(isRequired)(props, __props.column)
306
+ })
307
+ ]),
308
+ default: withCtx(() => [
309
+ createElementVNode("span", { class: "text-xs text-theme ml-2" }, [
310
+ createVNode(unref(HyIcon), {
311
+ "svg-name": "dispatch-share-v3-base-help",
312
+ class: "!w-3 !h-3 mr-1"
313
+ }),
314
+ createElementVNode(
315
+ "span",
316
+ null,
317
+ toDisplayString(unref($t)("hy.help")),
318
+ 1
319
+ /* TEXT */
320
+ )
321
+ ])
322
+ ]),
323
+ _: 3
324
+ /* FORWARDED */
325
+ })) : createCommentVNode("v-if", true)
326
+ ]),
327
+ __props.column.rightSlot && _ctx.$slots[__props.column.rightSlot] ? (openBlock(), createElementBlock("div", {
328
+ key: 0,
329
+ class: "ml-2 flex items-center"
330
+ }, [
331
+ renderSlot(_ctx.$slots, __props.column.rightSlot, {
332
+ column: columnConfig.value,
333
+ model: __props.model,
334
+ required: unref(isRequired)(props, __props.column)
335
+ })
336
+ ])) : createCommentVNode("v-if", true)
337
+ ],
338
+ 2
339
+ /* CLASS */
340
+ ),
332
341
  unref(isReadonly)(props, __props.column) || !__props.column.type && !__props.column.slot ? (openBlock(), createElementBlock(
333
342
  "div",
334
343
  {
@@ -1,7 +1,7 @@
1
1
  import { unref, toRef } from 'vue';
2
2
  import '../../../utils/index.mjs';
3
- import { genColumnDefaultLabel, genValueByProp } from '../../../utils/form.mjs';
4
- import { mergeDeep, funRunHandler } from '../../../utils/handler.mjs';
3
+ import { genColumnDefaultLabel, columnTimeRangeOptionsHandler, columnDefaultValueHandler, genValueByProp } from '../../../utils/form.mjs';
4
+ import { mergeDeep } from '../../../utils/handler.mjs';
5
5
  import { isArray } from '../../../utils/is.mjs';
6
6
 
7
7
  function appFormItemHandler(column = {}) {
@@ -15,6 +15,7 @@ function appFormItemHandler(column = {}) {
15
15
  label,
16
16
  readonly: column.readonly || false,
17
17
  rules: column.rules,
18
+ timeRangeOptions: columnTimeRangeOptionsHandler(column),
18
19
  attrs
19
20
  }
20
21
  );
@@ -69,7 +70,7 @@ function appFormItemHandler(column = {}) {
69
70
  }
70
71
  const resetAppFormValue = (columns = [], obj = {}) => {
71
72
  for (const item of columns) {
72
- const value = funRunHandler(item.defaultValue);
73
+ const value = columnDefaultValueHandler(item);
73
74
  if (item.type === "array") {
74
75
  if (isArray(value)) {
75
76
  obj[item.prop] = value;
@@ -0,0 +1,7 @@
1
+ import '../../utils/index.mjs';
2
+ import _sfc_main from './locationMap.vue.mjs';
3
+ import { withInstall } from '../../utils/handler.mjs';
4
+
5
+ const HyLocationMap = withInstall(_sfc_main);
6
+
7
+ export { HyLocationMap, HyLocationMap as default };
@@ -0,0 +1,215 @@
1
+ import { useTemplateRef, computed, onBeforeUnmount, openBlock, createElementBlock, createElementVNode, createVNode, unref } from 'vue';
2
+ import { ElMessage } from 'element-plus';
3
+ import '../../utils/index.mjs';
4
+ import '../index.mjs';
5
+ import '../../hooks/index.mjs';
6
+ import { setPoiServer } from '../../utils/map/index.mjs';
7
+ import { useBaseMainStore } from '../../hooks/useBaseMainStore.mjs';
8
+ import { HyMap } from '../hyMap/index.mjs';
9
+
10
+ const _sfc_main = {
11
+ __name: "locationMap",
12
+ props: {
13
+ html: {
14
+ type: String,
15
+ default: ""
16
+ },
17
+ iconSize: {
18
+ type: Array,
19
+ default: null
20
+ },
21
+ iconAnchor: {
22
+ type: Array,
23
+ defalt: null
24
+ }
25
+ },
26
+ emits: ["setMapSize", "complete", "on-geographicalPosition"],
27
+ setup(__props, { expose: __expose, emit: __emit }) {
28
+ const props = __props;
29
+ const emits = __emit;
30
+ const containerRef = useTemplateRef("containerRef");
31
+ const children = computed(
32
+ () => props.column.children.map((item) => {
33
+ if (item.type === "address") {
34
+ return {
35
+ rightSlot: "addressRight",
36
+ ...item,
37
+ type: "input",
38
+ slot: "address",
39
+ attrs: {
40
+ placeholder: "\u8F93\u5165\u5730\u5740\u53EF\u641C\u7D22",
41
+ ...item.attrs
42
+ }
43
+ };
44
+ }
45
+ return {
46
+ ...item,
47
+ type: "input",
48
+ attrs: {
49
+ // placeholder: item.type === 'lng' ? '经度' : '维度',
50
+ ...item.attrs
51
+ }
52
+ };
53
+ })
54
+ );
55
+ const mapConfig = JSON.parse(window.sessionStorage.getItem("mapConfig") || "{}");
56
+ let hyMap = null;
57
+ let map = null;
58
+ const poiServer = setPoiServer(mapConfig);
59
+ let marker = null;
60
+ function placeSearchFn(address) {
61
+ poiServer.placeSearch({
62
+ pageSize: 1,
63
+ // 单页显示结果条数
64
+ pageIndex: 1,
65
+ convertIngAndLat: false,
66
+ query: address
67
+ }).then(({ results }) => {
68
+ console.log(results);
69
+ if (results && results.length) {
70
+ const geographicalPosition = results[0];
71
+ throughCoordinatePosition(geographicalPosition.lng, geographicalPosition.lat);
72
+ } else {
73
+ ElMessage.error("\u6CA1\u6709\u627E\u5230\u641C\u7D22\u5730\u7406\u4F4D\u7F6E");
74
+ }
75
+ }).catch((error) => {
76
+ console.log("\u672A\u627E\u5230\u5730\u5740", error);
77
+ ElMessage.error("\u6CA1\u6709\u627E\u5230\u641C\u7D22\u5730\u7406\u4F4D\u7F6E");
78
+ });
79
+ }
80
+ function throughCoordinatePosition(lng, lat) {
81
+ return new Promise((resolve) => {
82
+ poiServer.geocoderFormat({
83
+ lat,
84
+ lng
85
+ }).then(({ results }) => {
86
+ geographicalPositionFn({
87
+ lng,
88
+ lat,
89
+ address: results.address,
90
+ name: results.address
91
+ });
92
+ resolve(200);
93
+ }).catch(() => {
94
+ geographicalPositionFn({
95
+ lng,
96
+ lat,
97
+ address: `${Number(lat).toFixed(6)}\u3001${Number(lng).toFixed(6)}`,
98
+ name: `${Number(lat).toFixed(6)}\u3001${Number(lng).toFixed(6)}`
99
+ });
100
+ resolve(200);
101
+ });
102
+ });
103
+ }
104
+ function geographicalPositionFn(obj) {
105
+ const form = {
106
+ address: obj.address,
107
+ lng: obj.lng,
108
+ lat: obj.lat
109
+ };
110
+ emits("on-geographicalPosition", form);
111
+ }
112
+ function complete(initHyMap, initMap) {
113
+ hyMap = initHyMap;
114
+ map = initMap;
115
+ map.on("click", (res) => {
116
+ const latlng = res.latlng;
117
+ setMarker(res.latlng);
118
+ throughCoordinatePosition(latlng.lng, latlng.lat);
119
+ });
120
+ emits("complete", { hyMap, map });
121
+ }
122
+ async function setMarker({ lat, lng }, getAddress = false) {
123
+ if (marker) {
124
+ marker.setLatLng({ lat, lng });
125
+ map.setView({ lat, lng }, mapConfig.maxZoom || 18);
126
+ } else {
127
+ const divIcon = hyMap.DivIcon({
128
+ html: props.html || '<svg class="hy-icon !w-9 !h-14 mr-1 text-auxiliary" svgName="map-marker-trajectory-personnel"><use xlink:href="#hy-icon-map-marker-trajectory-personnel"></use></svg>',
129
+ iconSize: props.iconSize || [36, 56],
130
+ iconAnchor: props.iconAnchor || [20, 56]
131
+ });
132
+ marker = hyMap.Marker({
133
+ icon: divIcon,
134
+ zIndexOffset: 1,
135
+ position: {
136
+ lat,
137
+ lng
138
+ }
139
+ });
140
+ marker.addTo(map);
141
+ map.setView({ lat, lng }, mapConfig.maxZoom || 18);
142
+ }
143
+ if (getAddress) {
144
+ await throughCoordinatePosition(lng, lat);
145
+ }
146
+ return 200;
147
+ }
148
+ function clearMarker() {
149
+ if (marker) {
150
+ marker.remove();
151
+ marker = null;
152
+ }
153
+ }
154
+ function setMapSize() {
155
+ emits("setMapSize");
156
+ if (map) {
157
+ setTimeout(() => {
158
+ map.invalidateSize();
159
+ setTimeout(() => {
160
+ console.log("marker", marker);
161
+ if (marker) {
162
+ const latlng = marker.getLatLng();
163
+ console.log("latlng", latlng);
164
+ map.setView({ lat: latlng.lat, lng: latlng.lng }, mapConfig.maxZoom || 18);
165
+ } else {
166
+ const { baseMainStore } = useBaseMainStore();
167
+ const userInfo = baseMainStore.value.getters.userInfo;
168
+ console.log("userInfo", userInfo);
169
+ if (userInfo) {
170
+ map.setView({ lat: userInfo.lat, lng: userInfo.lng }, mapConfig.maxZoom || 18);
171
+ }
172
+ }
173
+ });
174
+ });
175
+ }
176
+ }
177
+ function setView({ lat, lng }, zoom) {
178
+ map.setView({ lat, lng }, zoom || mapConfig.maxZoom || 18);
179
+ }
180
+ onBeforeUnmount(() => {
181
+ if (marker) {
182
+ marker.remove();
183
+ }
184
+ if (map) {
185
+ map.removeMap();
186
+ }
187
+ map = null;
188
+ hyMap = null;
189
+ });
190
+ __expose({
191
+ setMarker,
192
+ clearMarker,
193
+ placeSearchFn,
194
+ setMapSize,
195
+ setView
196
+ });
197
+ return (_ctx, _cache) => {
198
+ return openBlock(), createElementBlock("div", { class: "w-full h-full flex flex-col" }, [
199
+ createElementVNode("div", {
200
+ class: "relative z-50 text-xl text-red-800",
201
+ onClick: setMapSize
202
+ }, "111111111"),
203
+ createElementVNode("div", { class: "w-full h-full relative z-10" }, [
204
+ createVNode(unref(HyMap), {
205
+ mapType: unref(mapConfig).mapType,
206
+ mapConfig: unref(mapConfig),
207
+ onComplete: complete
208
+ }, null, 8, ["mapType", "mapConfig"])
209
+ ])
210
+ ]);
211
+ };
212
+ }
213
+ };
214
+
215
+ export { _sfc_main as default };
@@ -1,5 +1,7 @@
1
1
  import { InitMap } from '../../../utils/map/index.mjs';
2
2
  import { shallowRef, nextTick } from 'vue';
3
+ import '../../../hooks/index.mjs';
4
+ import { useBaseMainStore } from '../../../hooks/useBaseMainStore.mjs';
3
5
 
4
6
  const useAppMapWrapper = (hy) => {
5
7
  const {
@@ -133,13 +135,13 @@ const useAppMapWrapper = (hy) => {
133
135
  delete container._amap_id;
134
136
  container.innerHTML = "";
135
137
  }
138
+ const { baseMainStore } = useBaseMainStore();
139
+ const userInfo = baseMainStore.value.getters.userInfo;
140
+ console.log("\u5730\u56FE\u521D\u59CB\u5316: userInfo", userInfo);
136
141
  hy.map.value = hy.hyMap.value.InitMap(mapRef.value, {
137
142
  minZoom: mapConfig.minZoom || 8,
138
143
  maxZoom: mapConfig.maxZoom || 18,
139
- center: mapConfig.center || {
140
- lat: 22.553681,
141
- lng: 113.931936
142
- },
144
+ center: { lat: userInfo?.lat || 22.553681, lng: userInfo?.lng || 113.931936 },
143
145
  zoom: mapConfig.zoom || 14,
144
146
  completeCallbacks: () => {
145
147
  nextTick(() => {
@@ -1,10 +1,8 @@
1
1
  import { unref, toRef } from 'vue';
2
2
  import '../../../hooks/index.mjs';
3
3
  import '../../../utils/index.mjs';
4
- import { isNumber } from '../../../utils/is.mjs';
5
- import { $t } from '../../../hooks/useLocale.mjs';
6
- import { genColumnDefaultLabel, genValueByProp } from '../../../utils/form.mjs';
7
- import { mergeDeep, funRunHandler } from '../../../utils/handler.mjs';
4
+ import { genColumnDefaultLabel, columnTimeRangeOptionsHandler, columnDefaultValueHandler, genValueByProp } from '../../../utils/form.mjs';
5
+ import { mergeDeep } from '../../../utils/handler.mjs';
8
6
 
9
7
  const genColumnWidth = (config) => {
10
8
  let { width, inputWidth, type, attrs } = config || {};
@@ -31,31 +29,6 @@ const genColumnWidth = (config) => {
31
29
  }
32
30
  return { width, inputWidth };
33
31
  };
34
- const timeRangeOptionsHandler = (config) => {
35
- const { timeRangeOptions } = config || {};
36
- if (!timeRangeOptions?.length) return timeRangeOptions;
37
- return timeRangeOptions.reduce((list, item) => {
38
- let { value, label, unit } = item;
39
- if (!value || !isNumber(value) || isNaN(value)) return list;
40
- const isPlural = value > 1;
41
- if (!label) {
42
- switch (unit) {
43
- case "year":
44
- label = $t("hy.lastDate", [value + $t(isPlural ? "hy.years" : "hy.year")]);
45
- break;
46
- case "month":
47
- label = $t("hy.lastDate", [value + $t(isPlural ? "hy.months" : "hy.month")]);
48
- break;
49
- case "day":
50
- default:
51
- unit = "day";
52
- label = value === 1 ? $t("hy.today") : $t("hy.lastDate", [value + $t(isPlural ? "hy.days" : "hy.day")]);
53
- }
54
- }
55
- list.push({ ...item, label, unit });
56
- return list;
57
- }, []);
58
- };
59
32
  function appSearchItemHandler(column = {}) {
60
33
  const label = genColumnDefaultLabel(column);
61
34
  const attrs = {
@@ -72,7 +45,7 @@ function appSearchItemHandler(column = {}) {
72
45
  readonly: column.readonly || false,
73
46
  width,
74
47
  inputWidth,
75
- timeRangeOptions: timeRangeOptionsHandler(column),
48
+ timeRangeOptions: columnTimeRangeOptionsHandler(column),
76
49
  attrs
77
50
  }
78
51
  );
@@ -104,7 +77,7 @@ function appSearchItemHandler(column = {}) {
104
77
  }
105
78
  const resetAppSearchValue = (columns = [], obj = {}) => {
106
79
  for (const item of columns) {
107
- const value = funRunHandler(item.defaultValue);
80
+ const value = columnDefaultValueHandler(item);
108
81
  if (Array.isArray(item.prop)) {
109
82
  for (let i = 0; i < item.prop.length; i++) {
110
83
  genValueByProp(obj, item.prop[i], Array.isArray(value) ? value[i] : void 0);
@@ -46,7 +46,7 @@ function useAppTableSearch(hy) {
46
46
  } else {
47
47
  tableDataSource.value = data;
48
48
  }
49
- totalElements.value = res.data.totalElements;
49
+ totalElements.value = res.data.totalElements || data.length || 0;
50
50
  hy.expandRowKeys.value = [];
51
51
  emits("reqSuccess", tableDataSource.value);
52
52
  }