hy-dispatch-ui-v3 0.2.59 → 0.2.61

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 (102) hide show
  1. package/dist/tailwind.css +131 -6
  2. package/es/_virtual/_plugin-vue_export-helper.mjs +9 -0
  3. package/es/api/index.mjs +137 -0
  4. package/es/bussiness/hyAddDepartmentType/addDepartmentType.vue.mjs +365 -0
  5. package/es/bussiness/hyAddDepartmentType/index.mjs +6 -0
  6. package/es/bussiness/hyAddDepartmentType/style/addDepartmentType.scss +31 -0
  7. package/es/bussiness/index.mjs +1 -1
  8. package/es/components/hyAudioPlayer/audioPlayer.vue.mjs +1 -1
  9. package/es/components/hyBatchUploadDialog/batchUploadDialog.vue.mjs +45 -36
  10. package/es/components/hyDatePicker/datePicker.vue.mjs +2 -0
  11. package/es/components/hyForm/cpns/formItem.vue.mjs +106 -43
  12. package/es/components/hyForm/cpns/locationSelect.vue.mjs +358 -0
  13. package/es/components/hyForm/form.vue.mjs +83 -31
  14. package/es/components/hyForm/js/index.mjs +9 -2
  15. package/es/components/hyForm/js/useAppForm.mjs +6 -36
  16. package/es/components/hyMap/map.vue.mjs +3 -3
  17. package/es/components/hyMenu/menu.vue.mjs +38 -23
  18. package/es/components/hyMenu/style/menu.scss +3 -1
  19. package/es/components/hyOrgCascader/js/index.mjs +2 -2
  20. package/es/components/hyRadioGroup/index.mjs +6 -0
  21. package/es/components/hyRadioGroup/radioGroup.vue.mjs +123 -0
  22. package/es/components/hyRadioGroup/style/radioGroup.scss +0 -0
  23. package/es/components/hySearch/cpns/searchItem.vue.mjs +20 -13
  24. package/es/components/hySearch/js/useAppSearch.mjs +3 -33
  25. package/es/components/hyTable/cpns/virtualTable.vue.mjs +9 -1
  26. package/es/components/hyTable/js/index.mjs +6 -3
  27. package/es/components/hyTable/js/search.mjs +1 -0
  28. package/es/components/hyTable/table.vue.mjs +11 -4
  29. package/es/components/hyTableForm/batchTableForm.vue.mjs +5 -2
  30. package/es/components/hyTableForm/tableForm.vue.mjs +6 -0
  31. package/es/components/hyTree/js/index.mjs +69 -53
  32. package/es/components/hyTree/tree.vue.mjs +36 -1
  33. package/es/components/hyVideoPlayer/js/index.mjs +0 -1
  34. package/es/components/index.mjs +1 -0
  35. package/es/hooks/useApi.mjs +2 -2
  36. package/es/hooks/useGlobalConfig.mjs +1 -1
  37. package/es/index.mjs +4 -1
  38. package/es/locale/en.mjs +17 -1
  39. package/es/locale/zh_CN.mjs +17 -1
  40. package/es/static/hy-svg-icons/hy-icon-ops-linear-shouqi.js +8 -0
  41. package/es/static/hy-svg-icons/hy-icon-ops-linear-zhankai.js +8 -0
  42. package/es/style/index.scss +53 -0
  43. package/es/style/theme.scss +0 -53
  44. package/es/utils/form.mjs +56 -7
  45. package/es/utils/handler.mjs +5 -0
  46. package/es/utils/index.mjs +2 -1
  47. package/es/utils/map/hook/bigMap.mjs +4 -0
  48. package/es/utils/map/hook/gaode.mjs +3 -0
  49. package/es/utils/map/hook/leafletjs.mjs +10 -10
  50. package/es/utils/map/index.mjs +27 -7
  51. package/es/utils/tree.mjs +1 -0
  52. package/es/version.mjs +1 -1
  53. package/lib/_virtual/_plugin-vue_export-helper.js +13 -0
  54. package/lib/api/index.js +147 -0
  55. package/lib/bussiness/hyAddDepartmentType/addDepartmentType.vue.js +369 -0
  56. package/lib/bussiness/hyAddDepartmentType/index.js +11 -0
  57. package/lib/bussiness/hyAddDepartmentType/style/addDepartmentType.scss +31 -0
  58. package/lib/bussiness/index.js +5 -0
  59. package/lib/components/hyBatchUploadDialog/batchUploadDialog.vue.js +44 -35
  60. package/lib/components/hyDatePicker/datePicker.vue.js +2 -0
  61. package/lib/components/hyForm/cpns/formItem.vue.js +111 -48
  62. package/lib/components/hyForm/cpns/locationSelect.vue.js +362 -0
  63. package/lib/components/hyForm/form.vue.js +79 -27
  64. package/lib/components/hyForm/js/index.js +9 -1
  65. package/lib/components/hyForm/js/useAppForm.js +5 -35
  66. package/lib/components/hyMap/map.vue.js +3 -3
  67. package/lib/components/hyMenu/menu.vue.js +37 -22
  68. package/lib/components/hyMenu/style/menu.scss +3 -1
  69. package/lib/components/hyOrgCascader/js/index.js +2 -2
  70. package/lib/components/hyRadioGroup/index.js +11 -0
  71. package/lib/components/hyRadioGroup/radioGroup.vue.js +127 -0
  72. package/lib/components/hyRadioGroup/style/radioGroup.scss +0 -0
  73. package/lib/components/hySearch/cpns/searchItem.vue.js +19 -12
  74. package/lib/components/hySearch/js/useAppSearch.js +2 -32
  75. package/lib/components/hyTable/cpns/virtualTable.vue.js +9 -1
  76. package/lib/components/hyTable/js/index.js +6 -3
  77. package/lib/components/hyTable/js/search.js +1 -0
  78. package/lib/components/hyTable/table.vue.js +43 -36
  79. package/lib/components/hyTableForm/batchTableForm.vue.js +5 -2
  80. package/lib/components/hyTableForm/tableForm.vue.js +6 -0
  81. package/lib/components/hyTree/js/index.js +69 -53
  82. package/lib/components/hyTree/tree.vue.js +36 -1
  83. package/lib/components/hyVideoPlayer/js/index.js +0 -1
  84. package/lib/components/index.js +14 -12
  85. package/lib/hooks/useApi.js +2 -2
  86. package/lib/index.js +61 -49
  87. package/lib/locale/en.js +17 -1
  88. package/lib/locale/zh_CN.js +17 -1
  89. package/lib/static/hy-svg-icons/hy-icon-ops-linear-shouqi.js +8 -0
  90. package/lib/static/hy-svg-icons/hy-icon-ops-linear-zhankai.js +8 -0
  91. package/lib/style/index.scss +53 -0
  92. package/lib/style/theme.scss +0 -53
  93. package/lib/utils/form.js +57 -5
  94. package/lib/utils/handler.js +5 -0
  95. package/lib/utils/index.js +8 -0
  96. package/lib/utils/map/hook/bigMap.js +4 -0
  97. package/lib/utils/map/hook/gaode.js +3 -0
  98. package/lib/utils/map/hook/leafletjs.js +10 -10
  99. package/lib/utils/map/index.js +26 -6
  100. package/lib/utils/tree.js +10 -0
  101. package/lib/version.js +1 -1
  102. package/package.json +2 -2
@@ -1,13 +1,15 @@
1
- import { useTemplateRef, computed, unref, openBlock, createBlock, normalizeStyle, withCtx, createCommentVNode, createElementVNode, renderSlot, toDisplayString, createElementBlock, createVNode, normalizeClass, Fragment, mergeProps } from 'vue';
2
- import { ElFormItem, ElIcon, ElSelect, ElRadioGroup, ElCheckboxGroup, ElSwitch, ElInputNumber } from 'element-plus';
3
- import { QuestionFilled } from '@element-plus/icons-vue';
4
- import { columnShowHandler, columnItemStyle, isRequired, columnHelpHandler, isReadonly, renderText, isDisabled, optionsHandler } from '../js/index.mjs';
1
+ import { useTemplateRef, computed, unref, openBlock, createElementBlock, normalizeClass, normalizeStyle, createBlock, withCtx, createCommentVNode, createElementVNode, renderSlot, toDisplayString, createVNode, Fragment, mergeProps } from 'vue';
2
+ import { ElFormItem, ElSelect, ElRadioGroup, ElCheckboxGroup, ElSwitch, ElInputNumber, ElCascader } from 'element-plus';
3
+ import { columnVisibleHandler, columnItemStyle, columnShowHandler, isRequired, columnHelpHandler, isReadonly, renderText, isDisabled, optionsHandler } from '../js/index.mjs';
4
+ import { useLocale } from '../../../hooks/useLocale.mjs';
5
5
  import { isArray } from '../../../utils/is.mjs';
6
- import { setValueByProp, getValueByProp, columnRuleHandler } from '../../../utils/form.mjs';
6
+ import { setValueByProp, getValueByProp, columnPlaceholderHandler, columnLabelHandler, columnRuleHandler } from '../../../utils/form.mjs';
7
7
  import { HyTooltip } from '../../hyTooltip/index.mjs';
8
+ import { HyIcon } from '../../hyIcon/index.mjs';
8
9
  import { HyInput } from '../../hyInput/index.mjs';
9
10
  import { HyDatePicker } from '../../hyDatePicker/index.mjs';
10
11
  import { HyTimePicker } from '../../hyTimePicker/index.mjs';
12
+ import { HyRadioGroup } from '../../hyRadioGroup/index.mjs';
11
13
  import { HyOrgCascader } from '../../hyOrgCascader/index.mjs';
12
14
 
13
15
  const _sfc_main = {
@@ -53,6 +55,7 @@ const _sfc_main = {
53
55
  }
54
56
  },
55
57
  setup(__props) {
58
+ const { t } = useLocale();
56
59
  const props = __props;
57
60
  const formItemRef = useTemplateRef("formItemRef");
58
61
  const columnProp = computed(() => {
@@ -82,6 +85,13 @@ const _sfc_main = {
82
85
  setValueByProp(props.model, prop, val);
83
86
  }
84
87
  });
88
+ const columnAttrs = computed(() => {
89
+ return {
90
+ ...props.column.attrs,
91
+ label: columnLabelHandler(props.column, props.model),
92
+ placeholder: columnPlaceholderHandler(props.column, props.model)
93
+ };
94
+ });
85
95
  function getColumnRuleHandler(column, model) {
86
96
  if (!isRequired(props, column) && formItemRef.value) {
87
97
  formItemRef.value.clearValidate();
@@ -94,10 +104,19 @@ const _sfc_main = {
94
104
  onChange(props.column, props.model);
95
105
  }
96
106
  return (_ctx, _cache) => {
97
- return unref(columnShowHandler)(props, __props.column) ? (openBlock(), createBlock(unref(ElFormItem), {
107
+ return !unref(columnVisibleHandler)(props, __props.column) ? (openBlock(), createElementBlock("div", {
98
108
  key: 0,
109
+ id: __props.column.id,
110
+ style: normalizeStyle(unref(columnItemStyle)(props, __props.column)),
111
+ class: normalizeClass(["hy-el-form-item", [
112
+ __props.size === "large" ? "hy-el-form-item--large" : __props.size === "small" ? "hy-el-form-item--small" : "hy-el-form-item--default",
113
+ __props.size === "large" ? "min-h-[72px]" : __props.size === "small" ? "min-h-[56px]" : "min-h-[64px]"
114
+ ]])
115
+ }, null, 14, ["id"])) : unref(columnShowHandler)(props, __props.column) ? (openBlock(), createBlock(unref(ElFormItem), {
116
+ key: 1,
99
117
  ref_key: "formItemRef",
100
118
  ref: formItemRef,
119
+ id: __props.column.id,
101
120
  prop: columnProp.value,
102
121
  rules: getColumnRuleHandler(__props.column, props.model),
103
122
  style: normalizeStyle(unref(columnItemStyle)(props, __props.column))
@@ -114,7 +133,7 @@ const _sfc_main = {
114
133
  createElementVNode(
115
134
  "span",
116
135
  { class: "text-main" },
117
- toDisplayString(__props.column.label || "\xA0"),
136
+ toDisplayString(unref(columnLabelHandler)(__props.column, props.model) || "\xA0"),
118
137
  1
119
138
  /* TEXT */
120
139
  )
@@ -123,32 +142,43 @@ const _sfc_main = {
123
142
  key: 0,
124
143
  class: "label-required"
125
144
  })) : createCommentVNode("v-if", true),
126
- unref(columnHelpHandler)(props, __props.column) ? (openBlock(), createBlock(unref(HyTooltip), {
145
+ unref(columnHelpHandler)(props, __props.column) || __props.column.tooltipContentSlot ? (openBlock(), createBlock(unref(HyTooltip), {
127
146
  key: 1,
128
147
  "is-always": "",
129
- overLine: 1,
130
- content: unref(columnHelpHandler)(props, __props.column)
148
+ overLine: 1
131
149
  }, {
150
+ content: withCtx(() => [
151
+ !__props.column.tooltipContentSlot ? (openBlock(), createElementBlock(
152
+ "span",
153
+ { key: 0 },
154
+ toDisplayString(unref(columnHelpHandler)(props, __props.column)),
155
+ 1
156
+ /* TEXT */
157
+ )) : createCommentVNode("v-if", true),
158
+ renderSlot(_ctx.$slots, __props.column.tooltipContentSlot)
159
+ ]),
132
160
  default: withCtx(() => [
133
- createVNode(unref(ElIcon), {
134
- size: "14",
135
- color: "rgba(var(--hy-theme))",
136
- class: "ml-1.5"
137
- }, {
138
- default: withCtx(() => [
139
- createVNode(unref(QuestionFilled))
140
- ]),
141
- _: 1
142
- /* STABLE */
143
- })
161
+ createElementVNode("span", { class: "text-xs text-theme ml-2" }, [
162
+ createVNode(unref(HyIcon), {
163
+ "svg-name": "dispatch-share-v3-base-help",
164
+ class: "!w-3 !h-3 mr-1"
165
+ }),
166
+ createElementVNode(
167
+ "span",
168
+ null,
169
+ toDisplayString(unref(t)("hy.help")),
170
+ 1
171
+ /* TEXT */
172
+ )
173
+ ])
144
174
  ]),
145
- _: 1
146
- /* STABLE */
147
- }, 8, ["content"])) : createCommentVNode("v-if", true)
175
+ _: 3
176
+ /* FORWARDED */
177
+ })) : createCommentVNode("v-if", true)
148
178
  ]),
149
179
  __props.column.rightSlot && _ctx.$slots[__props.column.rightSlot] ? (openBlock(), createElementBlock("div", {
150
180
  key: 0,
151
- class: "ml-2"
181
+ class: "ml-2 flex items-center"
152
182
  }, [
153
183
  renderSlot(_ctx.$slots, __props.column.rightSlot, {
154
184
  column: __props.column,
@@ -206,7 +236,7 @@ const _sfc_main = {
206
236
  createVNode(unref(HyInput), mergeProps({
207
237
  modelValue: bindValue.value,
208
238
  "onUpdate:modelValue": ($event) => bindValue.value = $event
209
- }, __props.column.attrs, {
239
+ }, columnAttrs.value, {
210
240
  disabled: unref(isDisabled)(props, __props.column),
211
241
  onChange: onChangeHandler
212
242
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])
@@ -221,7 +251,7 @@ const _sfc_main = {
221
251
  createVNode(unref(ElSelect), mergeProps({
222
252
  modelValue: bindValue.value,
223
253
  "onUpdate:modelValue": ($event) => bindValue.value = $event
224
- }, __props.column.attrs, {
254
+ }, columnAttrs.value, {
225
255
  disabled: unref(isDisabled)(props, __props.column),
226
256
  options: unref(optionsHandler)(props, __props.column),
227
257
  onChange: onChangeHandler
@@ -235,7 +265,7 @@ const _sfc_main = {
235
265
  [
236
266
  createCommentVNode(" \u65E5\u671F\u9009\u62E9\u6846 "),
237
267
  ["datetimerange", "daterange", "monthrange", "yearrange"].includes(
238
- __props.column.attrs?.type
268
+ columnAttrs.value?.type
239
269
  ) && unref(isArray)(__props.column.field) ? (openBlock(), createBlock(unref(HyDatePicker), mergeProps({
240
270
  key: 0,
241
271
  start: bindValue.value,
@@ -245,7 +275,7 @@ const _sfc_main = {
245
275
  "is-range": true,
246
276
  style: { "width": "100%" },
247
277
  teleported: true
248
- }, __props.column.attrs, {
278
+ }, columnAttrs.value, {
249
279
  disabled: unref(isDisabled)(props, __props.column),
250
280
  onChange: onChangeHandler
251
281
  }), null, 16, ["start", "onUpdate:start", "end", "onUpdate:end", "disabled"])) : (openBlock(), createBlock(unref(HyDatePicker), mergeProps({
@@ -255,7 +285,7 @@ const _sfc_main = {
255
285
  "is-range": false,
256
286
  style: { "width": "100%" },
257
287
  teleported: true
258
- }, __props.column.attrs, {
288
+ }, columnAttrs.value, {
259
289
  disabled: unref(isDisabled)(props, __props.column),
260
290
  onChange: onChangeHandler
261
291
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"]))
@@ -267,7 +297,7 @@ const _sfc_main = {
267
297
  { key: 4 },
268
298
  [
269
299
  createCommentVNode(" \u65F6\u95F4\u9009\u62E9\u6846 "),
270
- __props.column.attrs.isRange ? (openBlock(), createBlock(unref(HyTimePicker), mergeProps({
300
+ columnAttrs.value.isRange ? (openBlock(), createBlock(unref(HyTimePicker), mergeProps({
271
301
  key: 0,
272
302
  start: bindValue.value,
273
303
  "onUpdate:start": ($event) => bindValue.value = $event,
@@ -276,7 +306,7 @@ const _sfc_main = {
276
306
  "is-range": true,
277
307
  style: { "width": "100%" },
278
308
  teleported: true
279
- }, __props.column.attrs, {
309
+ }, columnAttrs.value, {
280
310
  disabled: unref(isDisabled)(props, __props.column),
281
311
  onChange: onChangeHandler
282
312
  }), null, 16, ["start", "onUpdate:start", "end", "onUpdate:end", "disabled"])) : (openBlock(), createBlock(unref(HyTimePicker), mergeProps({
@@ -286,7 +316,7 @@ const _sfc_main = {
286
316
  "is-range": false,
287
317
  style: { "width": "100%" },
288
318
  teleported: true
289
- }, __props.column.attrs, {
319
+ }, columnAttrs.value, {
290
320
  disabled: unref(isDisabled)(props, __props.column),
291
321
  onChange: onChangeHandler
292
322
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"]))
@@ -301,7 +331,7 @@ const _sfc_main = {
301
331
  createVNode(unref(ElRadioGroup), mergeProps({
302
332
  modelValue: bindValue.value,
303
333
  "onUpdate:modelValue": ($event) => bindValue.value = $event
304
- }, __props.column.attrs, {
334
+ }, columnAttrs.value, {
305
335
  disabled: unref(isDisabled)(props, __props.column),
306
336
  options: unref(optionsHandler)(props, __props.column),
307
337
  onChange: onChangeHandler
@@ -309,15 +339,32 @@ const _sfc_main = {
309
339
  ],
310
340
  2112
311
341
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
312
- )) : __props.column.type === "checkbox" ? (openBlock(), createElementBlock(
342
+ )) : __props.column.type === "radio-group" ? (openBlock(), createElementBlock(
313
343
  Fragment,
314
344
  { key: 6 },
345
+ [
346
+ createCommentVNode(" \u5355\u9009\u6309\u94AE "),
347
+ createVNode(unref(HyRadioGroup), mergeProps({
348
+ modelValue: bindValue.value,
349
+ "onUpdate:modelValue": ($event) => bindValue.value = $event
350
+ }, columnAttrs.value, {
351
+ disabled: unref(isDisabled)(props, __props.column),
352
+ options: unref(optionsHandler)(props, __props.column),
353
+ size: __props.size,
354
+ onChange: onChangeHandler
355
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options", "size"])
356
+ ],
357
+ 2112
358
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
359
+ )) : __props.column.type === "checkbox" ? (openBlock(), createElementBlock(
360
+ Fragment,
361
+ { key: 7 },
315
362
  [
316
363
  createCommentVNode(" \u591A\u9009 "),
317
364
  createVNode(unref(ElCheckboxGroup), mergeProps({
318
365
  modelValue: bindValue.value,
319
366
  "onUpdate:modelValue": ($event) => bindValue.value = $event
320
- }, __props.column.attrs, {
367
+ }, columnAttrs.value, {
321
368
  disabled: unref(isDisabled)(props, __props.column),
322
369
  options: unref(optionsHandler)(props, __props.column),
323
370
  onChange: onChangeHandler
@@ -327,7 +374,7 @@ const _sfc_main = {
327
374
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
328
375
  )) : __props.column.type === "switch" ? (openBlock(), createElementBlock(
329
376
  Fragment,
330
- { key: 7 },
377
+ { key: 8 },
331
378
  [
332
379
  createCommentVNode(" \u5F00\u5173 "),
333
380
  createVNode(unref(ElSwitch), mergeProps({
@@ -336,7 +383,7 @@ const _sfc_main = {
336
383
  "inline-prompt": "",
337
384
  width: "80",
338
385
  style: { "--hy-el-switch-on-color": "#5ab95f", "--hy-el-switch-off-color": "rgba(var(--hy-background), 1)" }
339
- }, __props.column.attrs, {
386
+ }, columnAttrs.value, {
340
387
  disabled: unref(isDisabled)(props, __props.column),
341
388
  onChange: onChangeHandler
342
389
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])
@@ -345,13 +392,13 @@ const _sfc_main = {
345
392
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
346
393
  )) : __props.column.type === "input-number" ? (openBlock(), createElementBlock(
347
394
  Fragment,
348
- { key: 8 },
395
+ { key: 9 },
349
396
  [
350
397
  createCommentVNode(" \u6570\u5B57\u8F93\u5165\u6846 "),
351
398
  createVNode(unref(ElInputNumber), mergeProps({
352
399
  modelValue: bindValue.value,
353
400
  "onUpdate:modelValue": ($event) => bindValue.value = $event
354
- }, __props.column.attrs, {
401
+ }, columnAttrs.value, {
355
402
  disabled: unref(isDisabled)(props, __props.column),
356
403
  onChange: onChangeHandler
357
404
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])
@@ -360,20 +407,36 @@ const _sfc_main = {
360
407
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
361
408
  )) : __props.column.type === "org-cascader" ? (openBlock(), createElementBlock(
362
409
  Fragment,
363
- { key: 9 },
410
+ { key: 10 },
364
411
  [
365
412
  createCommentVNode(" \u90E8\u95E8\u7EA7\u8054\u9009\u62E9\u6846 "),
366
413
  createVNode(unref(HyOrgCascader), mergeProps({
367
414
  modelValue: bindValue.value,
368
415
  "onUpdate:modelValue": ($event) => bindValue.value = $event,
369
416
  class: "w-full"
370
- }, __props.column.attrs, {
417
+ }, columnAttrs.value, {
371
418
  disabled: unref(isDisabled)(props, __props.column),
372
419
  onChange: onChangeHandler
373
420
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])
374
421
  ],
375
422
  2112
376
423
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
424
+ )) : __props.column.type === "cascader" ? (openBlock(), createElementBlock(
425
+ Fragment,
426
+ { key: 11 },
427
+ [
428
+ createCommentVNode(" \u7EA7\u8054\u9009\u62E9\u6846 "),
429
+ createVNode(unref(ElCascader), mergeProps({
430
+ modelValue: bindValue.value,
431
+ "onUpdate:modelValue": ($event) => bindValue.value = $event
432
+ }, columnAttrs.value, {
433
+ disabled: unref(isDisabled)(props, __props.column),
434
+ options: unref(optionsHandler)(props, __props.column),
435
+ onChange: onChangeHandler
436
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
437
+ ],
438
+ 2112
439
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
377
440
  )) : createCommentVNode("v-if", true)
378
441
  ],
379
442
  64
@@ -382,7 +445,7 @@ const _sfc_main = {
382
445
  ]),
383
446
  _: 3
384
447
  /* FORWARDED */
385
- }, 8, ["prop", "rules", "style"])) : createCommentVNode("v-if", true);
448
+ }, 8, ["id", "prop", "rules", "style"])) : createCommentVNode("v-if", true);
386
449
  };
387
450
  }
388
451
  };
@@ -0,0 +1,358 @@
1
+ import { useTemplateRef, computed, onBeforeUnmount, openBlock, createElementBlock, createElementVNode, normalizeStyle, Fragment, renderList, createBlock, createSlots, withCtx, createVNode, unref, mergeProps, withKeys, renderSlot, normalizeClass, withModifiers, toDisplayString } from 'vue';
2
+ import { ElMessage } from 'element-plus';
3
+ import _sfc_main$1 from './formItem.vue.mjs';
4
+ import { useLocale } from '../../../hooks/useLocale.mjs';
5
+ import { isArray, isNumber } from '../../../utils/is.mjs';
6
+ import { setValueByProp, getValueByProp } from '../../../utils/form.mjs';
7
+ import { setPoiServer } from '../../../utils/map/index.mjs';
8
+ import { HyInput } from '../../hyInput/index.mjs';
9
+ import { HyIcon } from '../../hyIcon/index.mjs';
10
+ import { HyMap } from '../../hyMap/index.mjs';
11
+
12
+ const _sfc_main = {
13
+ __name: "locationSelect",
14
+ props: {
15
+ model: {
16
+ type: Object,
17
+ default: () => ({})
18
+ },
19
+ column: {
20
+ type: Object,
21
+ default: () => ({})
22
+ },
23
+ rules: {
24
+ type: Object,
25
+ default: () => ({})
26
+ },
27
+ columnNum: {
28
+ type: Number,
29
+ default: 1
30
+ },
31
+ loading: {
32
+ type: Boolean,
33
+ default: false
34
+ },
35
+ disabled: {
36
+ type: Boolean,
37
+ default: false
38
+ },
39
+ readonly: {
40
+ type: Boolean,
41
+ default: false
42
+ },
43
+ size: {
44
+ type: String,
45
+ default: "default"
46
+ },
47
+ allMapSelect: {
48
+ type: Boolean,
49
+ default: false
50
+ }
51
+ },
52
+ emits: ["setMapSize"],
53
+ setup(__props, { expose: __expose, emit: __emit }) {
54
+ const props = __props;
55
+ const emits = __emit;
56
+ const { t } = useLocale();
57
+ const containerRef = useTemplateRef("containerRef");
58
+ const addressValue = computed({
59
+ get() {
60
+ const item = props.column.children.find((v) => v.type === "address");
61
+ if (item) {
62
+ const prop = isArray(item.field) ? item.field[0] : item.field;
63
+ return getValueByProp(props.model, prop);
64
+ }
65
+ return "";
66
+ },
67
+ set(val) {
68
+ const item = props.column.children.find((v) => v.type === "address");
69
+ if (item) {
70
+ const prop = isArray(item.field) ? item.field[0] : item.field;
71
+ setValueByProp(props.model, prop, val);
72
+ }
73
+ }
74
+ });
75
+ const lngValue = computed({
76
+ get() {
77
+ const item = props.column.children.find((v) => v.type === "lng");
78
+ if (item) {
79
+ const prop = isArray(item.field) ? item.field[0] : item.field;
80
+ return getValueByProp(props.model, prop);
81
+ }
82
+ return "";
83
+ },
84
+ set(val) {
85
+ const item = props.column.children.find((v) => v.type === "lng");
86
+ if (item) {
87
+ const prop = isArray(item.field) ? item.field[0] : item.field;
88
+ setValueByProp(props.model, prop, val);
89
+ }
90
+ }
91
+ });
92
+ const latValue = computed({
93
+ get() {
94
+ const item = props.column.children.find((v) => v.type === "lat");
95
+ if (item) {
96
+ const prop = isArray(item.field) ? item.field[0] : item.field;
97
+ return getValueByProp(props.model, prop);
98
+ }
99
+ return "";
100
+ },
101
+ set(val) {
102
+ const item = props.column.children.find((v) => v.type === "lat");
103
+ if (item) {
104
+ const prop = isArray(item.field) ? item.field[0] : item.field;
105
+ setValueByProp(props.model, prop, val);
106
+ }
107
+ }
108
+ });
109
+ const containerStyle = computed(() => {
110
+ const columnNum = isNumber(props.column.columnNum) && props.column.columnNum > 0 ? props.column.columnNum : isNumber(props.columnNum) && props.columnNum > 0 ? props.columnNum || 1 : 1;
111
+ return {
112
+ gridTemplateColumns: `repeat(${columnNum}, minmax(0, 1fr))`
113
+ };
114
+ });
115
+ const children = computed(
116
+ () => props.column.children.map((item) => {
117
+ if (item.type === "address") {
118
+ return {
119
+ rightSlot: "addressRight",
120
+ ...item,
121
+ type: "input",
122
+ slot: "address",
123
+ attrs: {
124
+ placeholder: "\u8F93\u5165\u5730\u5740\u53EF\u641C\u7D22",
125
+ ...item.attrs
126
+ }
127
+ };
128
+ }
129
+ return {
130
+ ...item,
131
+ type: "input",
132
+ attrs: {
133
+ // placeholder: item.type === 'lng' ? '经度' : '维度',
134
+ ...item.attrs
135
+ }
136
+ };
137
+ })
138
+ );
139
+ const mapConfig = JSON.parse(window.sessionStorage.getItem("mapConfig") || "{}");
140
+ let hyMap = null;
141
+ let map = null;
142
+ const poiServer = setPoiServer(mapConfig);
143
+ let marker = null;
144
+ function placeSearchFn(address) {
145
+ poiServer.placeSearch({
146
+ pageSize: 1,
147
+ // 单页显示结果条数
148
+ pageIndex: 1,
149
+ convertIngAndLat: false,
150
+ query: address
151
+ }).then(({ results }) => {
152
+ console.log(results);
153
+ if (results && results.length) {
154
+ const geographicalPosition = results[0];
155
+ throughCoordinatePosition(
156
+ geographicalPosition.lng,
157
+ geographicalPosition.lat
158
+ );
159
+ } else {
160
+ ElMessage.error("\u6CA1\u6709\u627E\u5230\u641C\u7D22\u5730\u7406\u4F4D\u7F6E");
161
+ }
162
+ }).catch((error) => {
163
+ console.log("\u672A\u627E\u5230\u5730\u5740", error);
164
+ ElMessage.error("\u6CA1\u6709\u627E\u5230\u641C\u7D22\u5730\u7406\u4F4D\u7F6E");
165
+ });
166
+ }
167
+ function throughCoordinatePosition(lng, lat) {
168
+ poiServer.geocoderFormat({
169
+ lat,
170
+ lng
171
+ }).then(({ results }) => {
172
+ geographicalPositionFn({
173
+ lng,
174
+ lat,
175
+ address: results.address,
176
+ name: results.address
177
+ });
178
+ }).catch(() => {
179
+ geographicalPositionFn({
180
+ lng,
181
+ lat,
182
+ address: `${Number(lat).toFixed(6)}\u3001${Number(lng).toFixed(6)}`,
183
+ name: `${Number(lat).toFixed(6)}\u3001${Number(lng).toFixed(6)}`
184
+ });
185
+ });
186
+ }
187
+ function geographicalPositionFn(obj) {
188
+ console.log("\u7ED3\u679C", obj);
189
+ addressValue.value = obj.address;
190
+ lngValue.value = obj.lng;
191
+ latValue.value = obj.lat;
192
+ }
193
+ function addressEnter() {
194
+ console.log("\u6848\u4EF6enter");
195
+ if (addressValue.value) {
196
+ placeSearchFn(addressValue.value);
197
+ }
198
+ }
199
+ function complete(initHyMap, initMap) {
200
+ hyMap = initHyMap;
201
+ map = initMap;
202
+ map.on("click", (res) => {
203
+ console.log(res);
204
+ const latlng = res.latlng;
205
+ setMarker(res.latlng);
206
+ throughCoordinatePosition(latlng.lng, latlng.lat);
207
+ });
208
+ }
209
+ function setMarker({ lat, lng }) {
210
+ if (marker) {
211
+ marker.setLatLng({ lat, lng });
212
+ map.setView({ lat, lng }, mapConfig.maxZoom || 18);
213
+ } else {
214
+ const divIcon = hyMap.DivIcon({
215
+ 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>',
216
+ iconSize: [36, 56],
217
+ iconAnchor: [20, 56]
218
+ });
219
+ marker = hyMap.Marker({
220
+ icon: divIcon,
221
+ zIndexOffset: 1,
222
+ position: {
223
+ lat,
224
+ lng
225
+ }
226
+ });
227
+ marker.addTo(map);
228
+ map.setView({ lat, lng }, mapConfig.maxZoom || 18);
229
+ }
230
+ }
231
+ function setMapSize() {
232
+ emits("setMapSize");
233
+ setTimeout(() => {
234
+ map.invalidateSize();
235
+ });
236
+ }
237
+ onBeforeUnmount(() => {
238
+ if (marker) {
239
+ marker.remove();
240
+ }
241
+ map.removeMap();
242
+ map = null;
243
+ hyMap = null;
244
+ });
245
+ __expose({
246
+ setMarker
247
+ });
248
+ return (_ctx, _cache) => {
249
+ return openBlock(), createElementBlock("div", { class: "w-full h-full flex flex-col" }, [
250
+ createElementVNode(
251
+ "div",
252
+ {
253
+ ref_key: "containerRef",
254
+ ref: containerRef,
255
+ class: "grid gap-x-6",
256
+ style: normalizeStyle(containerStyle.value)
257
+ },
258
+ [
259
+ (openBlock(true), createElementBlock(
260
+ Fragment,
261
+ null,
262
+ renderList(children.value, (item, index) => {
263
+ return openBlock(), createBlock(_sfc_main$1, {
264
+ key: index,
265
+ model: __props.model,
266
+ column: item,
267
+ rules: __props.rules,
268
+ size: __props.size,
269
+ loading: __props.loading,
270
+ disabled: __props.disabled,
271
+ readonly: __props.readonly
272
+ }, createSlots({
273
+ addressRight: withCtx(() => [
274
+ createElementVNode("div", { class: "h-full flex items-center text-auxiliary" }, [
275
+ createElementVNode("span", { class: "text-xs" }, [
276
+ createVNode(unref(HyIcon), {
277
+ "svg-name": "dispatch-share-tips",
278
+ class: "!w-3 !h-3 mr-1 text-auxiliary"
279
+ }),
280
+ createElementVNode("span", null, "\u53EF\u901A\u8FC7\u5730\u56FE\u70B9\u9009\u4EE5\u83B7\u53D6\u7CBE\u786E\u5750\u6807")
281
+ ])
282
+ ])
283
+ ]),
284
+ address: withCtx(({ column }) => [
285
+ createVNode(unref(HyInput), mergeProps({
286
+ modelValue: addressValue.value,
287
+ "onUpdate:modelValue": ($event) => addressValue.value = $event
288
+ }, { ref_for: true }, column.attrs, {
289
+ onKeyup: withKeys(addressEnter, ["enter"])
290
+ }), null, 16, ["modelValue", "onUpdate:modelValue"])
291
+ ]),
292
+ _: 2
293
+ /* DYNAMIC */
294
+ }, [
295
+ renderList(_ctx.$slots, (_, slotName) => {
296
+ return {
297
+ name: slotName,
298
+ fn: withCtx((scope) => [
299
+ renderSlot(_ctx.$slots, slotName, mergeProps({ ref_for: true }, scope))
300
+ ])
301
+ };
302
+ })
303
+ ]), 1032, ["model", "column", "rules", "size", "loading", "disabled", "readonly"]);
304
+ }),
305
+ 128
306
+ /* KEYED_FRAGMENT */
307
+ ))
308
+ ],
309
+ 4
310
+ /* STYLE */
311
+ ),
312
+ createElementVNode(
313
+ "div",
314
+ {
315
+ class: normalizeClass([[__props.allMapSelect ? "h-0 flex-grow" : "h-[280px]"], "w-full border border-border rounded relative box-border"])
316
+ },
317
+ [
318
+ createElementVNode("div", { class: "w-full h-full relative z-10" }, [
319
+ createVNode(unref(HyMap), {
320
+ mapType: unref(mapConfig).mapType,
321
+ mapConfig: unref(mapConfig),
322
+ onComplete: complete
323
+ }, null, 8, ["mapType", "mapConfig"])
324
+ ]),
325
+ createElementVNode(
326
+ "div",
327
+ {
328
+ class: normalizeClass(["z-20 cursor-pointer absolute rounded top-2 right-2 w-[110px] h-8 border bg-background/70 text-xs flex items-center justify-center gap-1", [
329
+ __props.allMapSelect ? "border-theme text-theme" : "border-border/50 text-main"
330
+ ]]),
331
+ onClick: withModifiers(setMapSize, ["stop"])
332
+ },
333
+ [
334
+ createVNode(unref(HyIcon), {
335
+ svgName: __props.allMapSelect ? "ops-button-reduce" : "ops-button-amplify",
336
+ class: normalizeClass(["!w-3 !h-3 text-main", [__props.allMapSelect ? "text-theme" : "text-main"]])
337
+ }, null, 8, ["svgName", "class"]),
338
+ createElementVNode(
339
+ "span",
340
+ null,
341
+ toDisplayString(__props.allMapSelect ? "\u9000\u51FA\u5730\u56FE\u653E\u5927" : "\u653E\u5927\u5730\u56FE\u70B9\u9009"),
342
+ 1
343
+ /* TEXT */
344
+ )
345
+ ],
346
+ 2
347
+ /* CLASS */
348
+ )
349
+ ],
350
+ 2
351
+ /* CLASS */
352
+ )
353
+ ]);
354
+ };
355
+ }
356
+ };
357
+
358
+ export { _sfc_main as default };