hy-dispatch-ui-v3 0.2.79 → 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.
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
  }
@@ -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,7 +1,7 @@
1
1
  import { unref, toRef } from 'vue';
2
2
  import '../../../utils/index.mjs';
3
- import { genColumnDefaultLabel, columnTimeRangeOptionsHandler, 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 = {}) {
@@ -70,7 +70,7 @@ function appFormItemHandler(column = {}) {
70
70
  }
71
71
  const resetAppFormValue = (columns = [], obj = {}) => {
72
72
  for (const item of columns) {
73
- const value = funRunHandler(item.defaultValue);
73
+ const value = columnDefaultValueHandler(item);
74
74
  if (item.type === "array") {
75
75
  if (isArray(value)) {
76
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,8 +1,8 @@
1
1
  import { unref, toRef } from 'vue';
2
2
  import '../../../hooks/index.mjs';
3
3
  import '../../../utils/index.mjs';
4
- import { genColumnDefaultLabel, columnTimeRangeOptionsHandler, genValueByProp } from '../../../utils/form.mjs';
5
- import { mergeDeep, funRunHandler } from '../../../utils/handler.mjs';
4
+ import { genColumnDefaultLabel, columnTimeRangeOptionsHandler, columnDefaultValueHandler, genValueByProp } from '../../../utils/form.mjs';
5
+ import { mergeDeep } from '../../../utils/handler.mjs';
6
6
 
7
7
  const genColumnWidth = (config) => {
8
8
  let { width, inputWidth, type, attrs } = config || {};
@@ -77,7 +77,7 @@ function appSearchItemHandler(column = {}) {
77
77
  }
78
78
  const resetAppSearchValue = (columns = [], obj = {}) => {
79
79
  for (const item of columns) {
80
- const value = funRunHandler(item.defaultValue);
80
+ const value = columnDefaultValueHandler(item);
81
81
  if (Array.isArray(item.prop)) {
82
82
  for (let i = 0; i < item.prop.length; i++) {
83
83
  genValueByProp(obj, item.prop[i], Array.isArray(value) ? value[i] : void 0);
@@ -30,6 +30,7 @@ export { HyTour } from './hyTour/index.mjs';
30
30
  export { HyDrawer } from './hyDrawer/index.mjs';
31
31
  export { HyStatus } from './hyStatus/index.mjs';
32
32
  export { HyCheckboxGroup } from './hyCheckboxGroup/index.mjs';
33
+ export { HyLocationMap } from './hyLocationMap/index.mjs';
33
34
  export { resetAppFormValue, useAppForm } from './hyForm/js/useAppForm.mjs';
34
35
  export { resetAppSearchValue, useAppSearch } from './hySearch/js/useAppSearch.mjs';
35
36
  export { useAppTable } from './hyTable/js/useAppTable.mjs';
package/es/index.mjs CHANGED
@@ -28,6 +28,7 @@ export { HyFilePlayback } from './bussiness/hyFilePlayback/index.mjs';
28
28
  export { HyForm } from './components/hyForm/index.mjs';
29
29
  export { HyIcon } from './components/hyIcon/index.mjs';
30
30
  export { HyIconBox } from './components/hyIconBox/index.mjs';
31
+ export { HyLocationMap } from './components/hyLocationMap/index.mjs';
31
32
  export { HyMap } from './components/hyMap/index.mjs';
32
33
  export { HyMapAearchPlace } from './bussiness/hyMapAearchPlace/index.mjs';
33
34
  export { HyMenu } from './components/hyMenu/index.mjs';
@@ -53,7 +54,7 @@ export { base64Decrypt, encryptToBase64, generateRandomCode } from './utils/cryp
53
54
  export { blobToDataURL, fileFormUpload, fileJsonUplaod, fileUpload, presignedUrl, sizeToTextHandler } from './utils/file.mjs';
54
55
  export { bus, usePublish, useSubscribe } from './hooks/useSubscribe.mjs';
55
56
  export { clearResizeObserver, useResizeObserver } from './hooks/useResizeObserver.mjs';
56
- export { clearSpace, columnHelpHandler, columnLabelHandler, columnPlaceholderHandler, columnRuleHandler, columnTimeRangeOptionsHandler, columnnoDataTextHandler, genColumnDefaultLabel, genColumnShortcuts, genRuleRequiredMsgHandler, genValueByProp, getValueByProp, setValueByProp } from './utils/form.mjs';
57
+ export { clearSpace, columnDefaultValueHandler, columnHelpHandler, columnLabelHandler, columnPlaceholderHandler, columnRuleHandler, columnTimeRangeOptionsHandler, columnnoDataTextHandler, genColumnDefaultLabel, genColumnShortcuts, genRuleRequiredMsgHandler, genValueByProp, getValueByProp, setValueByProp } from './utils/form.mjs';
57
58
  export { cloneDeep, copyText, createUniqueId, funRunHandler, mergeDeep, withInstall } from './utils/handler.mjs';
58
59
  export { configProviderContextKey, provideGlobalConfig, useGlobalConfig } from './hooks/useGlobalConfig.mjs';
59
60
  export { defaultAxios, localApiKey, useApi } from './hooks/useApi.mjs';
package/es/utils/form.mjs CHANGED
@@ -2,6 +2,7 @@ import dayjs from 'dayjs';
2
2
  import { unref } from 'vue';
3
3
  import '../hooks/index.mjs';
4
4
  import { isString, isArray, isBoolean, isFunction, isObject, isNumber, isEmpty } from './is.mjs';
5
+ import { funRunHandler } from './handler.mjs';
5
6
  import { $t } from '../hooks/useLocale.mjs';
6
7
 
7
8
  function getValueByProp(model, prop) {
@@ -210,28 +211,48 @@ function genColumnShortcuts(column) {
210
211
  value: genShortcutItem
211
212
  };
212
213
  });
213
- function genShortcutItem() {
214
- const format = "YYYY-MM-DD";
215
- const date = dayjs(Date.now());
216
- const { value, unit, type } = this.options;
217
- const timeRangeFill2 = this.options.timeRangeFill || type === "datetimerange";
218
- if (unit === "day" && value === 1) {
219
- return [
220
- date.format(`${format}${timeRangeFill2 ? " 00:00:00" : ""}`),
221
- date.format(`${format}${timeRangeFill2 ? " 23:59:59" : ""}`)
222
- ];
223
- } else if (unit === "day") {
224
- return [
225
- date.subtract(value - 1, unit).format(`${format}${timeRangeFill2 ? " 00:00:00" : ""}`),
226
- date.format(`${format}${timeRangeFill2 ? " 23:59:59" : ""}`)
227
- ];
228
- } else {
229
- return [
230
- date.subtract(value, unit).format(`${format}${timeRangeFill2 ? " 00:00:00" : ""}`),
231
- date.format(`${format}${timeRangeFill2 ? " 23:59:59" : ""}`)
232
- ];
233
- }
214
+ }
215
+ function genShortcutItem(options = this.options) {
216
+ const format = "YYYY-MM-DD";
217
+ const date = dayjs(Date.now());
218
+ const { value, unit, type } = options;
219
+ const timeRangeFill = options.timeRangeFill || type === "datetimerange";
220
+ if (!isNumber(value) || value < 1) {
221
+ console.warning("timeRangeOptions \u7684 value \u5B57\u6BB5\u8981\u4F20\u5165\u6570\u5B57");
222
+ return [];
223
+ }
224
+ if (!["day", "month", "year"].includes(unit)) {
225
+ console.warning("timeRangeOptions \u7684 unit \u5B57\u6BB5\u4F20\u5165\u683C\u5F0F\u9519\u8BEF");
226
+ return [];
227
+ }
228
+ if (unit === "day" && value === 1) {
229
+ return [
230
+ date.format(`${format}${timeRangeFill ? " 00:00:00" : ""}`),
231
+ date.format(`${format}${timeRangeFill ? " 23:59:59" : ""}`)
232
+ ];
233
+ } else if (unit === "day") {
234
+ return [
235
+ date.subtract(value - 1, unit).format(`${format}${timeRangeFill ? " 00:00:00" : ""}`),
236
+ date.format(`${format}${timeRangeFill ? " 23:59:59" : ""}`)
237
+ ];
238
+ } else {
239
+ return [
240
+ date.subtract(value, unit).format(`${format}${timeRangeFill ? " 00:00:00" : ""}`),
241
+ date.format(`${format}${timeRangeFill ? " 23:59:59" : ""}`)
242
+ ];
234
243
  }
235
244
  }
245
+ function columnDefaultValueHandler(column) {
246
+ const { type, defaultValue, attrs } = column || {};
247
+ const value = funRunHandler(defaultValue);
248
+ if (type === "date-picker" && isObject(value) && ["datetimerange", "daterange", "monthrange", "yearrange"].includes(attrs.type)) {
249
+ return genShortcutItem({
250
+ ...value,
251
+ type: attrs.type,
252
+ timeRangeFill: attrs.timeRangeFill
253
+ });
254
+ }
255
+ return value;
256
+ }
236
257
 
237
- export { clearSpace, columnHelpHandler, columnLabelHandler, columnPlaceholderHandler, columnRuleHandler, columnTimeRangeOptionsHandler, columnnoDataTextHandler, genColumnDefaultLabel, genColumnShortcuts, genRuleRequiredMsgHandler, genValueByProp, getValueByProp, setValueByProp };
258
+ export { clearSpace, columnDefaultValueHandler, columnHelpHandler, columnLabelHandler, columnPlaceholderHandler, columnRuleHandler, columnTimeRangeOptionsHandler, columnnoDataTextHandler, genColumnDefaultLabel, genColumnShortcuts, genRuleRequiredMsgHandler, genValueByProp, getValueByProp, setValueByProp };
@@ -4,7 +4,7 @@ export { isArray, isBoolean, isEmpty, isFile, isFunction, isNull, isNumber, isOb
4
4
  export { cloneDeep, copyText, createUniqueId, funRunHandler, mergeDeep, withInstall } from './handler.mjs';
5
5
  export { formatDuration, getDefaultValueFormatByType } from './date.mjs';
6
6
  export { blobToDataURL, fileFormUpload, fileJsonUplaod, fileUpload, presignedUrl, sizeToTextHandler } from './file.mjs';
7
- export { clearSpace, columnHelpHandler, columnLabelHandler, columnPlaceholderHandler, columnRuleHandler, columnTimeRangeOptionsHandler, columnnoDataTextHandler, genColumnDefaultLabel, genColumnShortcuts, genRuleRequiredMsgHandler, genValueByProp, getValueByProp, setValueByProp } from './form.mjs';
7
+ export { clearSpace, columnDefaultValueHandler, columnHelpHandler, columnLabelHandler, columnPlaceholderHandler, columnRuleHandler, columnTimeRangeOptionsHandler, columnnoDataTextHandler, genColumnDefaultLabel, genColumnShortcuts, genRuleRequiredMsgHandler, genValueByProp, getValueByProp, setValueByProp } from './form.mjs';
8
8
  export { enterNumbersRrLetters, enterTheMumber, filterSpaces, formatTimeFn, getPublicFileSize, inputForbidden, keepTwoDecimalPlaces, onlyNumber } from './input.mjs';
9
9
  export { PERMISSION } from './permission.mjs';
10
10
  export { InitMap, setMapServer, setPoiServer } from './map/index.mjs';
package/es/version.mjs CHANGED
@@ -1,3 +1,3 @@
1
- const version = "0.2.78";
1
+ const version = "0.2.79";
2
2
 
3
3
  export { version };
@@ -72,7 +72,7 @@ function appFormItemHandler(column = {}) {
72
72
  }
73
73
  const resetAppFormValue = (columns = [], obj = {}) => {
74
74
  for (const item of columns) {
75
- const value = handler.funRunHandler(item.defaultValue);
75
+ const value = form.columnDefaultValueHandler(item);
76
76
  if (item.type === "array") {
77
77
  if (is.isArray(value)) {
78
78
  obj[item.prop] = value;
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('../../utils/index.js');
6
+ var locationMap = require('./locationMap.vue.js');
7
+ var handler = require('../../utils/handler.js');
8
+
9
+ const HyLocationMap = handler.withInstall(locationMap.default);
10
+
11
+ exports.HyLocationMap = HyLocationMap;
12
+ exports.default = HyLocationMap;
@@ -0,0 +1,219 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var vue = require('vue');
6
+ var elementPlus = require('element-plus');
7
+ require('../../utils/index.js');
8
+ require('../index.js');
9
+ require('../../hooks/index.js');
10
+ var index = require('../../utils/map/index.js');
11
+ var useBaseMainStore = require('../../hooks/useBaseMainStore.js');
12
+ var index$1 = require('../hyMap/index.js');
13
+
14
+ const _sfc_main = {
15
+ __name: "locationMap",
16
+ props: {
17
+ html: {
18
+ type: String,
19
+ default: ""
20
+ },
21
+ iconSize: {
22
+ type: Array,
23
+ default: null
24
+ },
25
+ iconAnchor: {
26
+ type: Array,
27
+ defalt: null
28
+ }
29
+ },
30
+ emits: ["setMapSize", "complete", "on-geographicalPosition"],
31
+ setup(__props, { expose: __expose, emit: __emit }) {
32
+ const props = __props;
33
+ const emits = __emit;
34
+ const containerRef = vue.useTemplateRef("containerRef");
35
+ const children = vue.computed(
36
+ () => props.column.children.map((item) => {
37
+ if (item.type === "address") {
38
+ return {
39
+ rightSlot: "addressRight",
40
+ ...item,
41
+ type: "input",
42
+ slot: "address",
43
+ attrs: {
44
+ placeholder: "\u8F93\u5165\u5730\u5740\u53EF\u641C\u7D22",
45
+ ...item.attrs
46
+ }
47
+ };
48
+ }
49
+ return {
50
+ ...item,
51
+ type: "input",
52
+ attrs: {
53
+ // placeholder: item.type === 'lng' ? '经度' : '维度',
54
+ ...item.attrs
55
+ }
56
+ };
57
+ })
58
+ );
59
+ const mapConfig = JSON.parse(window.sessionStorage.getItem("mapConfig") || "{}");
60
+ let hyMap = null;
61
+ let map = null;
62
+ const poiServer = index.setPoiServer(mapConfig);
63
+ let marker = null;
64
+ function placeSearchFn(address) {
65
+ poiServer.placeSearch({
66
+ pageSize: 1,
67
+ // 单页显示结果条数
68
+ pageIndex: 1,
69
+ convertIngAndLat: false,
70
+ query: address
71
+ }).then(({ results }) => {
72
+ console.log(results);
73
+ if (results && results.length) {
74
+ const geographicalPosition = results[0];
75
+ throughCoordinatePosition(geographicalPosition.lng, geographicalPosition.lat);
76
+ } else {
77
+ elementPlus.ElMessage.error("\u6CA1\u6709\u627E\u5230\u641C\u7D22\u5730\u7406\u4F4D\u7F6E");
78
+ }
79
+ }).catch((error) => {
80
+ console.log("\u672A\u627E\u5230\u5730\u5740", error);
81
+ elementPlus.ElMessage.error("\u6CA1\u6709\u627E\u5230\u641C\u7D22\u5730\u7406\u4F4D\u7F6E");
82
+ });
83
+ }
84
+ function throughCoordinatePosition(lng, lat) {
85
+ return new Promise((resolve) => {
86
+ poiServer.geocoderFormat({
87
+ lat,
88
+ lng
89
+ }).then(({ results }) => {
90
+ geographicalPositionFn({
91
+ lng,
92
+ lat,
93
+ address: results.address,
94
+ name: results.address
95
+ });
96
+ resolve(200);
97
+ }).catch(() => {
98
+ geographicalPositionFn({
99
+ lng,
100
+ lat,
101
+ address: `${Number(lat).toFixed(6)}\u3001${Number(lng).toFixed(6)}`,
102
+ name: `${Number(lat).toFixed(6)}\u3001${Number(lng).toFixed(6)}`
103
+ });
104
+ resolve(200);
105
+ });
106
+ });
107
+ }
108
+ function geographicalPositionFn(obj) {
109
+ const form = {
110
+ address: obj.address,
111
+ lng: obj.lng,
112
+ lat: obj.lat
113
+ };
114
+ emits("on-geographicalPosition", form);
115
+ }
116
+ function complete(initHyMap, initMap) {
117
+ hyMap = initHyMap;
118
+ map = initMap;
119
+ map.on("click", (res) => {
120
+ const latlng = res.latlng;
121
+ setMarker(res.latlng);
122
+ throughCoordinatePosition(latlng.lng, latlng.lat);
123
+ });
124
+ emits("complete", { hyMap, map });
125
+ }
126
+ async function setMarker({ lat, lng }, getAddress = false) {
127
+ if (marker) {
128
+ marker.setLatLng({ lat, lng });
129
+ map.setView({ lat, lng }, mapConfig.maxZoom || 18);
130
+ } else {
131
+ const divIcon = hyMap.DivIcon({
132
+ 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>',
133
+ iconSize: props.iconSize || [36, 56],
134
+ iconAnchor: props.iconAnchor || [20, 56]
135
+ });
136
+ marker = hyMap.Marker({
137
+ icon: divIcon,
138
+ zIndexOffset: 1,
139
+ position: {
140
+ lat,
141
+ lng
142
+ }
143
+ });
144
+ marker.addTo(map);
145
+ map.setView({ lat, lng }, mapConfig.maxZoom || 18);
146
+ }
147
+ if (getAddress) {
148
+ await throughCoordinatePosition(lng, lat);
149
+ }
150
+ return 200;
151
+ }
152
+ function clearMarker() {
153
+ if (marker) {
154
+ marker.remove();
155
+ marker = null;
156
+ }
157
+ }
158
+ function setMapSize() {
159
+ emits("setMapSize");
160
+ if (map) {
161
+ setTimeout(() => {
162
+ map.invalidateSize();
163
+ setTimeout(() => {
164
+ console.log("marker", marker);
165
+ if (marker) {
166
+ const latlng = marker.getLatLng();
167
+ console.log("latlng", latlng);
168
+ map.setView({ lat: latlng.lat, lng: latlng.lng }, mapConfig.maxZoom || 18);
169
+ } else {
170
+ const { baseMainStore } = useBaseMainStore.useBaseMainStore();
171
+ const userInfo = baseMainStore.value.getters.userInfo;
172
+ console.log("userInfo", userInfo);
173
+ if (userInfo) {
174
+ map.setView({ lat: userInfo.lat, lng: userInfo.lng }, mapConfig.maxZoom || 18);
175
+ }
176
+ }
177
+ });
178
+ });
179
+ }
180
+ }
181
+ function setView({ lat, lng }, zoom) {
182
+ map.setView({ lat, lng }, zoom || mapConfig.maxZoom || 18);
183
+ }
184
+ vue.onBeforeUnmount(() => {
185
+ if (marker) {
186
+ marker.remove();
187
+ }
188
+ if (map) {
189
+ map.removeMap();
190
+ }
191
+ map = null;
192
+ hyMap = null;
193
+ });
194
+ __expose({
195
+ setMarker,
196
+ clearMarker,
197
+ placeSearchFn,
198
+ setMapSize,
199
+ setView
200
+ });
201
+ return (_ctx, _cache) => {
202
+ return vue.openBlock(), vue.createElementBlock("div", { class: "w-full h-full flex flex-col" }, [
203
+ vue.createElementVNode("div", {
204
+ class: "relative z-50 text-xl text-red-800",
205
+ onClick: setMapSize
206
+ }, "111111111"),
207
+ vue.createElementVNode("div", { class: "w-full h-full relative z-10" }, [
208
+ vue.createVNode(vue.unref(index$1.HyMap), {
209
+ mapType: vue.unref(mapConfig).mapType,
210
+ mapConfig: vue.unref(mapConfig),
211
+ onComplete: complete
212
+ }, null, 8, ["mapType", "mapConfig"])
213
+ ])
214
+ ]);
215
+ };
216
+ }
217
+ };
218
+
219
+ exports.default = _sfc_main;
@@ -2,6 +2,8 @@
2
2
 
3
3
  var index = require('../../../utils/map/index.js');
4
4
  var vue = require('vue');
5
+ require('../../../hooks/index.js');
6
+ var useBaseMainStore = require('../../../hooks/useBaseMainStore.js');
5
7
 
6
8
  const useAppMapWrapper = (hy) => {
7
9
  const {
@@ -135,13 +137,13 @@ const useAppMapWrapper = (hy) => {
135
137
  delete container._amap_id;
136
138
  container.innerHTML = "";
137
139
  }
140
+ const { baseMainStore } = useBaseMainStore.useBaseMainStore();
141
+ const userInfo = baseMainStore.value.getters.userInfo;
142
+ console.log("\u5730\u56FE\u521D\u59CB\u5316: userInfo", userInfo);
138
143
  hy.map.value = hy.hyMap.value.InitMap(mapRef.value, {
139
144
  minZoom: mapConfig.minZoom || 8,
140
145
  maxZoom: mapConfig.maxZoom || 18,
141
- center: mapConfig.center || {
142
- lat: 22.553681,
143
- lng: 113.931936
144
- },
146
+ center: { lat: userInfo?.lat || 22.553681, lng: userInfo?.lng || 113.931936 },
145
147
  zoom: mapConfig.zoom || 14,
146
148
  completeCallbacks: () => {
147
149
  vue.nextTick(() => {
@@ -79,7 +79,7 @@ function appSearchItemHandler(column = {}) {
79
79
  }
80
80
  const resetAppSearchValue = (columns = [], obj = {}) => {
81
81
  for (const item of columns) {
82
- const value = handler.funRunHandler(item.defaultValue);
82
+ const value = form.columnDefaultValueHandler(item);
83
83
  if (Array.isArray(item.prop)) {
84
84
  for (let i = 0; i < item.prop.length; i++) {
85
85
  form.genValueByProp(obj, item.prop[i], Array.isArray(value) ? value[i] : void 0);
@@ -1,37 +1,38 @@
1
1
  'use strict';
2
2
 
3
- var index$m = require('./hyOrgCascader/index.js');
3
+ var index$n = require('./hyOrgCascader/index.js');
4
4
  var index$b = require('./hyConfirmDialog/index.js');
5
5
  var index = require('./hyDatePicker/index.js');
6
6
  var index$f = require('./hyForm/index.js');
7
7
  var index$g = require('./hyIcon/index.js');
8
8
  var index$h = require('./hyIconBox/index.js');
9
- var index$o = require('./hySearch/index.js');
10
- var index$q = require('./hyTable/index.js');
9
+ var index$p = require('./hySearch/index.js');
10
+ var index$r = require('./hyTable/index.js');
11
11
  var index$4 = require('./hyTooltip/index.js');
12
12
  var index$a = require('./hyConfigProvider/index.js');
13
13
  var index$8 = require('./hyButton/index.js');
14
- var index$u = require('./hyUserAvatar/index.js');
15
- var index$k = require('./hyNoPermissions/index.js');
16
- var index$l = require('./hyNoPermissionsMap/index.js');
14
+ var index$v = require('./hyUserAvatar/index.js');
15
+ var index$l = require('./hyNoPermissions/index.js');
16
+ var index$m = require('./hyNoPermissionsMap/index.js');
17
17
  var index$c = require('./hyCutter/index.js');
18
18
  var index$d = require('./hyDialog/index.js');
19
- var index$j = require('./hyMenu/index.js');
20
- var index$t = require('./hyTree/index.js');
21
- var index$v = require('./hyVideoPlayer/index.js');
19
+ var index$k = require('./hyMenu/index.js');
20
+ var index$u = require('./hyTree/index.js');
21
+ var index$w = require('./hyVideoPlayer/index.js');
22
22
  var index$5 = require('./hyAudioPlayer/index.js');
23
23
  var index$1 = require('./hyInput/index.js');
24
24
  var index$3 = require('./hyTimePicker/index.js');
25
25
  var index$6 = require('./hyTableForm/index.js');
26
- var index$r = require('./hyTableActionButton/index.js');
26
+ var index$s = require('./hyTableActionButton/index.js');
27
27
  var index$7 = require('./hyBatchUploadDialog/index.js');
28
- var index$i = require('./hyMap/index.js');
29
- var index$n = require('./hyRadioGroup/index.js');
28
+ var index$j = require('./hyMap/index.js');
29
+ var index$o = require('./hyRadioGroup/index.js');
30
30
  var index$2 = require('./hyLoading/index.js');
31
- var index$s = require('./hyTour/index.js');
31
+ var index$t = require('./hyTour/index.js');
32
32
  var index$e = require('./hyDrawer/index.js');
33
- var index$p = require('./hyStatus/index.js');
33
+ var index$q = require('./hyStatus/index.js');
34
34
  var index$9 = require('./hyCheckboxGroup/index.js');
35
+ var index$i = require('./hyLocationMap/index.js');
35
36
  var useAppForm = require('./hyForm/js/useAppForm.js');
36
37
  var useAppSearch = require('./hySearch/js/useAppSearch.js');
37
38
  var useAppTable = require('./hyTable/js/useAppTable.js');
@@ -39,27 +40,27 @@ var useAppTableForm = require('./hyTableForm/js/useAppTableForm.js');
39
40
 
40
41
 
41
42
 
42
- exports.HyOrgCascader = index$m.HyOrgCascader;
43
+ exports.HyOrgCascader = index$n.HyOrgCascader;
43
44
  exports.HyConfirmDialog = index$b.HyConfirmDialog;
44
45
  exports.ElDatePicker = index.ElDatePicker;
45
46
  exports.HyDatePicker = index.HyDatePicker;
46
47
  exports.HyForm = index$f.HyForm;
47
48
  exports.HyIcon = index$g.HyIcon;
48
49
  exports.HyIconBox = index$h.HyIconBox;
49
- exports.HySearch = index$o.HySearch;
50
- exports.HyTable = index$q.HyTable;
50
+ exports.HySearch = index$p.HySearch;
51
+ exports.HyTable = index$r.HyTable;
51
52
  exports.ElTooltip = index$4.ElTooltip;
52
53
  exports.HyTooltip = index$4.HyTooltip;
53
54
  exports.HyConfigProvider = index$a.HyConfigProvider;
54
55
  exports.HyButton = index$8.HyButton;
55
- exports.HyUserAvatar = index$u.HyUserAvatar;
56
- exports.HyNoPermissions = index$k.HyNoPermissions;
57
- exports.HyNoPermissionsMap = index$l.HyNoPermissionsMap;
56
+ exports.HyUserAvatar = index$v.HyUserAvatar;
57
+ exports.HyNoPermissions = index$l.HyNoPermissions;
58
+ exports.HyNoPermissionsMap = index$m.HyNoPermissionsMap;
58
59
  exports.HyCutter = index$c.HyCutter;
59
60
  exports.HyDialog = index$d.HyDialog;
60
- exports.HyMenu = index$j.HyMenu;
61
- exports.HyTree = index$t.HyTree;
62
- exports.HyVideoPlayer = index$v.HyVideoPlayer;
61
+ exports.HyMenu = index$k.HyMenu;
62
+ exports.HyTree = index$u.HyTree;
63
+ exports.HyVideoPlayer = index$w.HyVideoPlayer;
63
64
  exports.HyAudioPlayer = index$5.HyAudioPlayer;
64
65
  exports.ElInput = index$1.ElInput;
65
66
  exports.HyInput = index$1.HyInput;
@@ -68,16 +69,17 @@ exports.ElTimePicker = index$3.ElTimePicker;
68
69
  exports.HyTimePicker = index$3.HyTimePicker;
69
70
  exports.HyBatchTableForm = index$6.HyBatchTableForm;
70
71
  exports.HyTableForm = index$6.HyTableForm;
71
- exports.HyTableActionButton = index$r.HyTableActionButton;
72
+ exports.HyTableActionButton = index$s.HyTableActionButton;
72
73
  exports.HyBatchUploadDialog = index$7.HyBatchUploadDialog;
73
- exports.HyMap = index$i.HyMap;
74
- exports.HyRadioGroup = index$n.HyRadioGroup;
74
+ exports.HyMap = index$j.HyMap;
75
+ exports.HyRadioGroup = index$o.HyRadioGroup;
75
76
  exports.ElLoading = index$2.ElLoading;
76
77
  exports.HyLoading = index$2.ElLoading;
77
- exports.HyTour = index$s.HyTour;
78
+ exports.HyTour = index$t.HyTour;
78
79
  exports.HyDrawer = index$e.HyDrawer;
79
- exports.HyStatus = index$p.HyStatus;
80
+ exports.HyStatus = index$q.HyStatus;
80
81
  exports.HyCheckboxGroup = index$9.HyCheckboxGroup;
82
+ exports.HyLocationMap = index$i.HyLocationMap;
81
83
  exports.resetAppFormValue = useAppForm.resetAppFormValue;
82
84
  exports.useAppForm = useAppForm.useAppForm;
83
85
  exports.resetAppSearchValue = useAppSearch.resetAppSearchValue;
package/lib/index.js CHANGED
@@ -32,26 +32,27 @@ var index$k = require('./bussiness/hyFilePlayback/index.js');
32
32
  var index$l = require('./components/hyForm/index.js');
33
33
  var index$m = require('./components/hyIcon/index.js');
34
34
  var index$n = require('./components/hyIconBox/index.js');
35
- var index$o = require('./components/hyMap/index.js');
36
- var index$p = require('./bussiness/hyMapAearchPlace/index.js');
37
- var index$q = require('./components/hyMenu/index.js');
38
- var index$r = require('./components/hyNoPermissions/index.js');
39
- var index$s = require('./components/hyNoPermissionsMap/index.js');
40
- var index$t = require('./components/hyOrgCascader/index.js');
41
- var index$u = require('./bussiness/hyOrgGroupTree/index.js');
42
- var index$v = require('./bussiness/hyPlanGroupDeviceTree/index.js');
43
- var index$w = require('./components/hyRadioGroup/index.js');
44
- var index$x = require('./bussiness/hyRuleSetting/index.js');
45
- var index$y = require('./components/hySearch/index.js');
46
- var index$z = require('./components/hyStatus/index.js');
47
- var index$A = require('./components/hyTable/index.js');
48
- var index$B = require('./components/hyTableActionButton/index.js');
49
- var index$C = require('./components/hyTour/index.js');
50
- var index$D = require('./components/hyTree/index.js');
51
- var index$E = require('./components/hyUserAvatar/index.js');
52
- var index$F = require('./bussiness/hyUserTree/index.js');
53
- var index$G = require('./components/hyVideoPlayer/index.js');
54
- var index$H = require('./utils/map/index.js');
35
+ var index$o = require('./components/hyLocationMap/index.js');
36
+ var index$p = require('./components/hyMap/index.js');
37
+ var index$q = require('./bussiness/hyMapAearchPlace/index.js');
38
+ var index$r = require('./components/hyMenu/index.js');
39
+ var index$s = require('./components/hyNoPermissions/index.js');
40
+ var index$t = require('./components/hyNoPermissionsMap/index.js');
41
+ var index$u = require('./components/hyOrgCascader/index.js');
42
+ var index$v = require('./bussiness/hyOrgGroupTree/index.js');
43
+ var index$w = require('./bussiness/hyPlanGroupDeviceTree/index.js');
44
+ var index$x = require('./components/hyRadioGroup/index.js');
45
+ var index$y = require('./bussiness/hyRuleSetting/index.js');
46
+ var index$z = require('./components/hySearch/index.js');
47
+ var index$A = require('./components/hyStatus/index.js');
48
+ var index$B = require('./components/hyTable/index.js');
49
+ var index$C = require('./components/hyTableActionButton/index.js');
50
+ var index$D = require('./components/hyTour/index.js');
51
+ var index$E = require('./components/hyTree/index.js');
52
+ var index$F = require('./components/hyUserAvatar/index.js');
53
+ var index$G = require('./bussiness/hyUserTree/index.js');
54
+ var index$H = require('./components/hyVideoPlayer/index.js');
55
+ var index$I = require('./utils/map/index.js');
55
56
  var permission = require('./utils/permission.js');
56
57
  var crypto = require('./utils/crypto.js');
57
58
  var file = require('./utils/file.js');
@@ -138,32 +139,33 @@ exports.HyFilePlayback = index$k.HyFilePlayback;
138
139
  exports.HyForm = index$l.HyForm;
139
140
  exports.HyIcon = index$m.HyIcon;
140
141
  exports.HyIconBox = index$n.HyIconBox;
141
- exports.HyMap = index$o.HyMap;
142
- exports.HyMapAearchPlace = index$p.HyMapAearchPlace;
143
- exports.HyMenu = index$q.HyMenu;
144
- exports.HyNoPermissions = index$r.HyNoPermissions;
145
- exports.HyNoPermissionsMap = index$s.HyNoPermissionsMap;
146
- exports.HyOrgCascader = index$t.HyOrgCascader;
147
- exports.HyOrgGroupTree = index$u.HyOrgGroupTree;
148
- exports.HyPlanGroupDeviceTree = index$v.HyPlanGroupDeviceTree;
149
- exports.HyRadioGroup = index$w.HyRadioGroup;
150
- exports.HyRuleAssignDialog = index$x.HyRuleAssignDialog;
151
- exports.HyRuleFenceDialog = index$x.HyRuleFenceDialog;
152
- exports.HyRuleSetting = index$x.HyRuleSetting;
153
- exports.HyRuleSettingDialog = index$x.HyRuleSettingDialog;
154
- exports.HySetRuleAggregationAlarmDialog = index$x.HySetRuleAggregationAlarmDialog;
155
- exports.HySearch = index$y.HySearch;
156
- exports.HyStatus = index$z.HyStatus;
157
- exports.HyTable = index$A.HyTable;
158
- exports.HyTableActionButton = index$B.HyTableActionButton;
159
- exports.HyTour = index$C.HyTour;
160
- exports.HyTree = index$D.HyTree;
161
- exports.HyUserAvatar = index$E.HyUserAvatar;
162
- exports.HyUserTree = index$F.HyUserTree;
163
- exports.HyVideoPlayer = index$G.HyVideoPlayer;
164
- exports.InitMap = index$H.InitMap;
165
- exports.setMapServer = index$H.setMapServer;
166
- exports.setPoiServer = index$H.setPoiServer;
142
+ exports.HyLocationMap = index$o.HyLocationMap;
143
+ exports.HyMap = index$p.HyMap;
144
+ exports.HyMapAearchPlace = index$q.HyMapAearchPlace;
145
+ exports.HyMenu = index$r.HyMenu;
146
+ exports.HyNoPermissions = index$s.HyNoPermissions;
147
+ exports.HyNoPermissionsMap = index$t.HyNoPermissionsMap;
148
+ exports.HyOrgCascader = index$u.HyOrgCascader;
149
+ exports.HyOrgGroupTree = index$v.HyOrgGroupTree;
150
+ exports.HyPlanGroupDeviceTree = index$w.HyPlanGroupDeviceTree;
151
+ exports.HyRadioGroup = index$x.HyRadioGroup;
152
+ exports.HyRuleAssignDialog = index$y.HyRuleAssignDialog;
153
+ exports.HyRuleFenceDialog = index$y.HyRuleFenceDialog;
154
+ exports.HyRuleSetting = index$y.HyRuleSetting;
155
+ exports.HyRuleSettingDialog = index$y.HyRuleSettingDialog;
156
+ exports.HySetRuleAggregationAlarmDialog = index$y.HySetRuleAggregationAlarmDialog;
157
+ exports.HySearch = index$z.HySearch;
158
+ exports.HyStatus = index$A.HyStatus;
159
+ exports.HyTable = index$B.HyTable;
160
+ exports.HyTableActionButton = index$C.HyTableActionButton;
161
+ exports.HyTour = index$D.HyTour;
162
+ exports.HyTree = index$E.HyTree;
163
+ exports.HyUserAvatar = index$F.HyUserAvatar;
164
+ exports.HyUserTree = index$G.HyUserTree;
165
+ exports.HyVideoPlayer = index$H.HyVideoPlayer;
166
+ exports.InitMap = index$I.InitMap;
167
+ exports.setMapServer = index$I.setMapServer;
168
+ exports.setPoiServer = index$I.setPoiServer;
167
169
  exports.PERMISSION = permission.PERMISSION;
168
170
  exports.base64Decrypt = crypto.base64Decrypt;
169
171
  exports.encryptToBase64 = crypto.encryptToBase64;
@@ -180,6 +182,7 @@ exports.useSubscribe = useSubscribe.useSubscribe;
180
182
  exports.clearResizeObserver = useResizeObserver.clearResizeObserver;
181
183
  exports.useResizeObserver = useResizeObserver.useResizeObserver;
182
184
  exports.clearSpace = form.clearSpace;
185
+ exports.columnDefaultValueHandler = form.columnDefaultValueHandler;
183
186
  exports.columnHelpHandler = form.columnHelpHandler;
184
187
  exports.columnLabelHandler = form.columnLabelHandler;
185
188
  exports.columnPlaceholderHandler = form.columnPlaceholderHandler;
package/lib/utils/form.js CHANGED
@@ -4,6 +4,7 @@ var dayjs = require('dayjs');
4
4
  var vue = require('vue');
5
5
  require('../hooks/index.js');
6
6
  var is = require('./is.js');
7
+ var handler = require('./handler.js');
7
8
  var useLocale = require('../hooks/useLocale.js');
8
9
 
9
10
  function getValueByProp(model, prop) {
@@ -212,31 +213,52 @@ function genColumnShortcuts(column) {
212
213
  value: genShortcutItem
213
214
  };
214
215
  });
215
- function genShortcutItem() {
216
- const format = "YYYY-MM-DD";
217
- const date = dayjs(Date.now());
218
- const { value, unit, type } = this.options;
219
- const timeRangeFill2 = this.options.timeRangeFill || type === "datetimerange";
220
- if (unit === "day" && value === 1) {
221
- return [
222
- date.format(`${format}${timeRangeFill2 ? " 00:00:00" : ""}`),
223
- date.format(`${format}${timeRangeFill2 ? " 23:59:59" : ""}`)
224
- ];
225
- } else if (unit === "day") {
226
- return [
227
- date.subtract(value - 1, unit).format(`${format}${timeRangeFill2 ? " 00:00:00" : ""}`),
228
- date.format(`${format}${timeRangeFill2 ? " 23:59:59" : ""}`)
229
- ];
230
- } else {
231
- return [
232
- date.subtract(value, unit).format(`${format}${timeRangeFill2 ? " 00:00:00" : ""}`),
233
- date.format(`${format}${timeRangeFill2 ? " 23:59:59" : ""}`)
234
- ];
235
- }
216
+ }
217
+ function genShortcutItem(options = this.options) {
218
+ const format = "YYYY-MM-DD";
219
+ const date = dayjs(Date.now());
220
+ const { value, unit, type } = options;
221
+ const timeRangeFill = options.timeRangeFill || type === "datetimerange";
222
+ if (!is.isNumber(value) || value < 1) {
223
+ console.warning("timeRangeOptions \u7684 value \u5B57\u6BB5\u8981\u4F20\u5165\u6570\u5B57");
224
+ return [];
225
+ }
226
+ if (!["day", "month", "year"].includes(unit)) {
227
+ console.warning("timeRangeOptions \u7684 unit \u5B57\u6BB5\u4F20\u5165\u683C\u5F0F\u9519\u8BEF");
228
+ return [];
229
+ }
230
+ if (unit === "day" && value === 1) {
231
+ return [
232
+ date.format(`${format}${timeRangeFill ? " 00:00:00" : ""}`),
233
+ date.format(`${format}${timeRangeFill ? " 23:59:59" : ""}`)
234
+ ];
235
+ } else if (unit === "day") {
236
+ return [
237
+ date.subtract(value - 1, unit).format(`${format}${timeRangeFill ? " 00:00:00" : ""}`),
238
+ date.format(`${format}${timeRangeFill ? " 23:59:59" : ""}`)
239
+ ];
240
+ } else {
241
+ return [
242
+ date.subtract(value, unit).format(`${format}${timeRangeFill ? " 00:00:00" : ""}`),
243
+ date.format(`${format}${timeRangeFill ? " 23:59:59" : ""}`)
244
+ ];
236
245
  }
237
246
  }
247
+ function columnDefaultValueHandler(column) {
248
+ const { type, defaultValue, attrs } = column || {};
249
+ const value = handler.funRunHandler(defaultValue);
250
+ if (type === "date-picker" && is.isObject(value) && ["datetimerange", "daterange", "monthrange", "yearrange"].includes(attrs.type)) {
251
+ return genShortcutItem({
252
+ ...value,
253
+ type: attrs.type,
254
+ timeRangeFill: attrs.timeRangeFill
255
+ });
256
+ }
257
+ return value;
258
+ }
238
259
 
239
260
  exports.clearSpace = clearSpace;
261
+ exports.columnDefaultValueHandler = columnDefaultValueHandler;
240
262
  exports.columnHelpHandler = columnHelpHandler;
241
263
  exports.columnLabelHandler = columnLabelHandler;
242
264
  exports.columnPlaceholderHandler = columnPlaceholderHandler;
@@ -54,6 +54,7 @@ exports.fileUpload = file.fileUpload;
54
54
  exports.presignedUrl = file.presignedUrl;
55
55
  exports.sizeToTextHandler = file.sizeToTextHandler;
56
56
  exports.clearSpace = form.clearSpace;
57
+ exports.columnDefaultValueHandler = form.columnDefaultValueHandler;
57
58
  exports.columnHelpHandler = form.columnHelpHandler;
58
59
  exports.columnLabelHandler = form.columnLabelHandler;
59
60
  exports.columnPlaceholderHandler = form.columnPlaceholderHandler;
package/lib/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const version = "0.2.78";
3
+ const version = "0.2.79";
4
4
 
5
5
  exports.version = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hy-dispatch-ui-v3",
3
- "version": "0.2.79",
3
+ "version": "0.2.80",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "scripts": {