hy-dispatch-ui-v3 0.2.65 → 0.2.67

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 (144) hide show
  1. package/dist/tailwind.css +51 -13
  2. package/es/api/organization.mjs +43 -0
  3. package/es/bussiness/hyAcquisitionStationTree/acquisitionStationTree.vue.mjs +245 -0
  4. package/es/bussiness/hyAcquisitionStationTree/index.mjs +7 -0
  5. package/es/bussiness/hyAcquisitionStationTree/js/index.mjs +124 -0
  6. package/es/bussiness/hyAcquisitionStationTree/style/acquisitionStationTree.scss +0 -0
  7. package/es/bussiness/hyDeviceTree/deviceTree.vue.mjs +249 -0
  8. package/es/bussiness/hyDeviceTree/index.mjs +7 -0
  9. package/es/bussiness/hyDeviceTree/js/index.mjs +126 -0
  10. package/es/bussiness/hyDeviceTree/style/deviceTree.scss +0 -0
  11. package/es/bussiness/hyOrgGroupTree/index.mjs +7 -0
  12. package/es/bussiness/hyOrgGroupTree/js/index.mjs +124 -0
  13. package/es/bussiness/hyOrgGroupTree/orgGroupTree.vue.mjs +245 -0
  14. package/es/bussiness/hyOrgGroupTree/style/orgGroupTree.scss +0 -0
  15. package/es/bussiness/hyPlanGroupDeviceTree/index.mjs +7 -0
  16. package/es/bussiness/hyPlanGroupDeviceTree/js/index.mjs +124 -0
  17. package/es/bussiness/hyPlanGroupDeviceTree/planGroupDeviceTree.vue.mjs +245 -0
  18. package/es/bussiness/hyPlanGroupDeviceTree/style/planGroupDeviceTree.scss +0 -0
  19. package/es/bussiness/hyUserTree/index.mjs +7 -0
  20. package/es/bussiness/hyUserTree/js/index.mjs +126 -0
  21. package/es/bussiness/hyUserTree/style/userTree.scss +0 -0
  22. package/es/bussiness/hyUserTree/userTree.vue.mjs +239 -0
  23. package/es/bussiness/index.mjs +5 -0
  24. package/es/components/hyBatchUploadDialog/batchUploadDialog.vue.mjs +183 -149
  25. package/es/components/hyButton/button.vue.mjs +19 -5
  26. package/es/components/hyButton/style/button.scss +72 -0
  27. package/es/components/hyConfirmDialog/confirmDialog.vue.mjs +1 -2
  28. package/es/components/hyForm/cpns/formItem.vue.mjs +254 -32
  29. package/es/components/hyForm/cpns/locationSelect.vue.mjs +8 -1
  30. package/es/components/hyForm/form.vue.mjs +88 -19
  31. package/es/components/hyForm/js/index.mjs +2 -1
  32. package/es/components/hyForm/js/useAppForm.mjs +3 -3
  33. package/es/components/hyIcon/style/icon.scss +1 -0
  34. package/es/components/hyMap/js/index.mjs +6 -6
  35. package/es/components/hyMap/map.vue.mjs +14 -4
  36. package/es/components/hyNoPermissions/noPermissions.vue.mjs +1 -1
  37. package/es/components/hyNoPermissionsMap/noPermissionsMap.vue.mjs +1 -1
  38. package/es/components/hyOrgCascader/orgCascader.vue.mjs +75 -15
  39. package/es/components/hyRadioGroup/radioGroup.vue.mjs +5 -4
  40. package/es/components/hySearch/cpns/searchItem.vue.mjs +434 -206
  41. package/es/components/hySearch/js/index.mjs +2 -1
  42. package/es/components/hySearch/search.vue.mjs +71 -10
  43. package/es/components/hySearch/style/search.scss +7 -0
  44. package/es/components/hyTable/cpns/columnSelect.vue.mjs +21 -22
  45. package/es/components/hyTable/cpns/virtualTable.vue.mjs +35 -21
  46. package/es/components/hyTable/js/index.mjs +16 -17
  47. package/es/components/hyTable/js/search.mjs +28 -2
  48. package/es/components/hyTable/style/table.scss +13 -0
  49. package/es/components/hyTable/table.vue.mjs +55 -22
  50. package/es/components/hyTableActionButton/tableActionButton.vue.mjs +17 -12
  51. package/es/components/hyTableForm/batchTableForm.vue.mjs +36 -5
  52. package/es/components/hyTableForm/js/useAppTableForm.mjs +1 -1
  53. package/es/components/hyTableForm/tableForm.vue.mjs +84 -32
  54. package/es/components/hyTour/index.mjs +7 -0
  55. package/es/components/hyTour/style/tour.scss +0 -0
  56. package/es/components/hyTour/tour.vue.mjs +23 -0
  57. package/es/components/hyTree/config/tree-config.mjs +5 -2
  58. package/es/components/hyTree/js/index.mjs +128 -56
  59. package/es/components/hyTree/tree.vue.mjs +22 -37
  60. package/es/components/index.mjs +1 -0
  61. package/es/index.mjs +6 -0
  62. package/es/static/hy-svg-icons/hy-icon-ops-linear-arrow.js +10 -0
  63. package/es/style/element/hy-element.scss +24 -3
  64. package/es/style/index.scss +0 -1
  65. package/es/style/tailwind.scss +0 -1
  66. package/es/style/theme.scss +1 -0
  67. package/es/utils/is.mjs +3 -1
  68. package/es/utils/map/hook/bigMap.mjs +11 -1
  69. package/es/utils/map/hook/gaode.mjs +60 -17
  70. package/es/utils/map/hook/leafletjs.mjs +25 -4
  71. package/es/utils/map/index.mjs +1 -1
  72. package/es/version.mjs +1 -1
  73. package/lib/api/organization.js +47 -0
  74. package/lib/bussiness/hyAcquisitionStationTree/acquisitionStationTree.vue.js +249 -0
  75. package/lib/bussiness/hyAcquisitionStationTree/index.js +12 -0
  76. package/lib/bussiness/hyAcquisitionStationTree/js/index.js +126 -0
  77. package/lib/bussiness/hyAcquisitionStationTree/style/acquisitionStationTree.scss +0 -0
  78. package/lib/bussiness/hyDeviceTree/deviceTree.vue.js +253 -0
  79. package/lib/bussiness/hyDeviceTree/index.js +12 -0
  80. package/lib/bussiness/hyDeviceTree/js/index.js +128 -0
  81. package/lib/bussiness/hyDeviceTree/style/deviceTree.scss +0 -0
  82. package/lib/bussiness/hyOrgGroupTree/index.js +12 -0
  83. package/lib/bussiness/hyOrgGroupTree/js/index.js +126 -0
  84. package/lib/bussiness/hyOrgGroupTree/orgGroupTree.vue.js +249 -0
  85. package/lib/bussiness/hyOrgGroupTree/style/orgGroupTree.scss +0 -0
  86. package/lib/bussiness/hyPlanGroupDeviceTree/index.js +12 -0
  87. package/lib/bussiness/hyPlanGroupDeviceTree/js/index.js +126 -0
  88. package/lib/bussiness/hyPlanGroupDeviceTree/planGroupDeviceTree.vue.js +249 -0
  89. package/lib/bussiness/hyPlanGroupDeviceTree/style/planGroupDeviceTree.scss +0 -0
  90. package/lib/bussiness/hyUserTree/index.js +12 -0
  91. package/lib/bussiness/hyUserTree/js/index.js +128 -0
  92. package/lib/bussiness/hyUserTree/style/userTree.scss +0 -0
  93. package/lib/bussiness/hyUserTree/userTree.vue.js +243 -0
  94. package/lib/bussiness/index.js +14 -4
  95. package/lib/components/hyBatchUploadDialog/batchUploadDialog.vue.js +182 -148
  96. package/lib/components/hyButton/button.vue.js +18 -4
  97. package/lib/components/hyButton/style/button.scss +72 -0
  98. package/lib/components/hyConfirmDialog/confirmDialog.vue.js +0 -1
  99. package/lib/components/hyForm/cpns/formItem.vue.js +250 -28
  100. package/lib/components/hyForm/cpns/locationSelect.vue.js +8 -1
  101. package/lib/components/hyForm/form.vue.js +86 -17
  102. package/lib/components/hyForm/js/index.js +2 -0
  103. package/lib/components/hyForm/js/useAppForm.js +3 -3
  104. package/lib/components/hyIcon/style/icon.scss +1 -0
  105. package/lib/components/hyMap/js/index.js +5 -5
  106. package/lib/components/hyMap/map.vue.js +13 -3
  107. package/lib/components/hyNoPermissions/noPermissions.vue.js +1 -1
  108. package/lib/components/hyNoPermissionsMap/noPermissionsMap.vue.js +1 -1
  109. package/lib/components/hyOrgCascader/orgCascader.vue.js +73 -13
  110. package/lib/components/hyRadioGroup/radioGroup.vue.js +5 -4
  111. package/lib/components/hySearch/cpns/searchItem.vue.js +431 -203
  112. package/lib/components/hySearch/js/index.js +2 -0
  113. package/lib/components/hySearch/search.vue.js +69 -8
  114. package/lib/components/hySearch/style/search.scss +7 -0
  115. package/lib/components/hyTable/cpns/columnSelect.vue.js +20 -21
  116. package/lib/components/hyTable/cpns/virtualTable.vue.js +51 -37
  117. package/lib/components/hyTable/js/index.js +16 -16
  118. package/lib/components/hyTable/js/search.js +28 -2
  119. package/lib/components/hyTable/style/table.scss +13 -0
  120. package/lib/components/hyTable/table.vue.js +53 -20
  121. package/lib/components/hyTableActionButton/tableActionButton.vue.js +16 -11
  122. package/lib/components/hyTableForm/batchTableForm.vue.js +36 -5
  123. package/lib/components/hyTableForm/js/useAppTableForm.js +1 -1
  124. package/lib/components/hyTableForm/tableForm.vue.js +85 -33
  125. package/lib/components/hyTour/index.js +12 -0
  126. package/lib/components/hyTour/style/tour.scss +0 -0
  127. package/lib/components/hyTour/tour.vue.js +27 -0
  128. package/lib/components/hyTree/config/tree-config.js +5 -2
  129. package/lib/components/hyTree/js/index.js +128 -56
  130. package/lib/components/hyTree/tree.vue.js +22 -37
  131. package/lib/components/index.js +8 -6
  132. package/lib/index.js +67 -55
  133. package/lib/static/hy-svg-icons/hy-icon-ops-linear-arrow.js +10 -0
  134. package/lib/style/element/hy-element.scss +24 -3
  135. package/lib/style/index.scss +0 -1
  136. package/lib/style/tailwind.scss +0 -1
  137. package/lib/style/theme.scss +1 -0
  138. package/lib/utils/is.js +5 -3
  139. package/lib/utils/map/hook/bigMap.js +11 -1
  140. package/lib/utils/map/hook/gaode.js +60 -17
  141. package/lib/utils/map/hook/leafletjs.js +25 -4
  142. package/lib/utils/map/index.js +1 -1
  143. package/lib/version.js +1 -1
  144. package/package.json +2 -2
@@ -1,11 +1,12 @@
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';
1
+ import { inject, useTemplateRef, computed, reactive, toRefs, onMounted, watch, onBeforeUnmount, unref, openBlock, createElementBlock, normalizeClass, normalizeStyle, createBlock, createSlots, withCtx, createElementVNode, renderSlot, toDisplayString, createCommentVNode, createVNode, Fragment, mergeProps } from 'vue';
2
+ import { ElFormItem, ElSelect, ElIcon, ElSelectV2, ElRadioGroup, ElCheckboxGroup, ElSwitch, ElInputNumber, ElCascader } from 'element-plus';
3
+ import { Loading } from '@element-plus/icons-vue';
3
4
  import '../../../utils/index.mjs';
4
5
  import '../../index.mjs';
5
- import { isRequired, columnVisibleHandler, columnItemStyle, columnShowHandler, columnHelpHandler, isReadonly, renderText, isDisabled, optionsHandler } from '../js/index.mjs';
6
+ import { formContextKey, optionsHandler, isRequired, columnVisibleHandler, columnItemStyle, columnShowHandler, columnHelpHandler, isReadonly, renderText, isDisabled } from '../js/index.mjs';
6
7
  import '../../../hooks/index.mjs';
7
8
  import { useLocale } from '../../../hooks/useLocale.mjs';
8
- import { isArray } from '../../../utils/is.mjs';
9
+ import { isBoolean, isArray } from '../../../utils/is.mjs';
9
10
  import { setValueByProp, getValueByProp, columnPlaceholderHandler, columnLabelHandler, columnRuleHandler } from '../../../utils/form.mjs';
10
11
  import { HyTooltip } from '../../hyTooltip/index.mjs';
11
12
  import { HyIcon } from '../../hyIcon/index.mjs';
@@ -60,7 +61,18 @@ const _sfc_main = {
60
61
  setup(__props) {
61
62
  const { t } = useLocale();
62
63
  const props = __props;
64
+ const formContext = inject(formContextKey);
63
65
  const formItemRef = useTemplateRef("formItemRef");
66
+ const orgCascaderRef = useTemplateRef("orgCascaderRef");
67
+ const showMessage = computed(() => {
68
+ if (columnConfig.value.optionsError) {
69
+ return true;
70
+ }
71
+ if (isBoolean(columnConfig.value.showMessage)) {
72
+ return columnConfig.value.showMessage;
73
+ }
74
+ return formContext.showMessage;
75
+ });
64
76
  const columnProp = computed(() => {
65
77
  let field = isArray(props.column.field) ? props.column.field[0] : props.column.field;
66
78
  if (props.parentProp) {
@@ -68,6 +80,10 @@ const _sfc_main = {
68
80
  }
69
81
  return field;
70
82
  });
83
+ const propString = computed(() => {
84
+ if (!columnProp.value) return "";
85
+ return isArray(columnProp.value) ? columnProp.value.join(".") : columnProp.value;
86
+ });
71
87
  const bindValue = computed({
72
88
  get() {
73
89
  const prop = isArray(props.column.field) ? props.column.field[0] : props.column.field;
@@ -88,6 +104,12 @@ const _sfc_main = {
88
104
  setValueByProp(props.model, prop, val);
89
105
  }
90
106
  });
107
+ const columnConfig = computed(() => {
108
+ return {
109
+ ...props.column,
110
+ attrs: columnAttrs.value
111
+ };
112
+ });
91
113
  const columnAttrs = computed(() => {
92
114
  return {
93
115
  ...props.column.attrs,
@@ -95,6 +117,55 @@ const _sfc_main = {
95
117
  placeholder: columnPlaceholderHandler(props.column, props.model)
96
118
  };
97
119
  });
120
+ async function obtainOptions(isMountedLoad = false) {
121
+ return new Promise(async (resolve, reject) => {
122
+ if (props.column.optionsFn) {
123
+ if (!props.column.optionsFn) return;
124
+ props.column.optionsLoading = true;
125
+ props.column.optionsError = "";
126
+ props.column.attrs.options = [];
127
+ if (!(isMountedLoad && props.column.isDefaultGetData === false)) {
128
+ try {
129
+ props.column.attrs.options = await props.column.optionsFn(
130
+ props.column,
131
+ props.model
132
+ );
133
+ props.column.optionsError = "";
134
+ resolve();
135
+ } catch (err) {
136
+ props.column.optionsError = "error";
137
+ console.error(err);
138
+ reject();
139
+ }
140
+ } else {
141
+ resolve();
142
+ }
143
+ } else if (props.column.type === "org-cascader") {
144
+ if (orgCascaderRef.value) {
145
+ props.column.optionsLoading = true;
146
+ props.column.optionsError = "";
147
+ try {
148
+ await orgCascaderRef.value.getData();
149
+ resolve();
150
+ } catch {
151
+ props.column.optionsError = "error";
152
+ reject();
153
+ }
154
+ } else {
155
+ resolve();
156
+ }
157
+ } else {
158
+ resolve();
159
+ }
160
+ props.column.optionsLoading = false;
161
+ });
162
+ }
163
+ function getOptionsHandler(props2, column) {
164
+ if (props2.column.optionsLoading) {
165
+ return [];
166
+ }
167
+ return optionsHandler(props2, props2.column);
168
+ }
98
169
  function getColumnRuleHandler(column, model) {
99
170
  if (!isRequired(props, column) && formItemRef.value) {
100
171
  formItemRef.value.clearValidate();
@@ -104,8 +175,51 @@ const _sfc_main = {
104
175
  function onChangeHandler() {
105
176
  const { onChange } = props.column;
106
177
  if (!onChange) return;
107
- onChange(props.column, props.model);
178
+ onChange(props.column, props.model, props.index);
179
+ }
180
+ async function onReloadOptions() {
181
+ if (props.column.optionsError === "error") {
182
+ try {
183
+ await obtainOptions();
184
+ } catch {
185
+ }
186
+ formContext?.emitOptionsStatus();
187
+ }
108
188
  }
189
+ const context = reactive({
190
+ ...toRefs(props),
191
+ columnProp,
192
+ propString,
193
+ columnConfig,
194
+ columnAttrs,
195
+ obtainOptions,
196
+ optionsLoading: computed(() => props.column.optionsLoading),
197
+ optionsError: computed(() => props.column.optionsError),
198
+ options: computed(() => {
199
+ return getOptionsHandler(props, props.column);
200
+ })
201
+ });
202
+ onMounted(() => {
203
+ if (propString.value) {
204
+ formContext?.addField(context);
205
+ }
206
+ watch(
207
+ () => formContext.model.errorMsg,
208
+ () => {
209
+ const optionsError = props.column.optionsError;
210
+ if (optionsError === "error") {
211
+ props.column.optionsError = "";
212
+ setTimeout(() => {
213
+ props.column.optionsError = "error";
214
+ }, 1);
215
+ }
216
+ },
217
+ { immediate: true, deep: true }
218
+ );
219
+ });
220
+ onBeforeUnmount(() => {
221
+ formContext?.removeField(context);
222
+ });
109
223
  return (_ctx, _cache) => {
110
224
  return !unref(columnVisibleHandler)(props, __props.column) ? (openBlock(), createElementBlock("div", {
111
225
  key: 0,
@@ -122,14 +236,15 @@ const _sfc_main = {
122
236
  id: __props.column.id,
123
237
  prop: columnProp.value,
124
238
  rules: getColumnRuleHandler(__props.column, props.model),
125
- style: normalizeStyle(unref(columnItemStyle)(props, __props.column))
126
- }, {
239
+ style: normalizeStyle(unref(columnItemStyle)(props, __props.column)),
240
+ error: __props.column.optionsError,
241
+ "show-message": showMessage.value
242
+ }, createSlots({
127
243
  default: withCtx(() => [
128
- createCommentVNode(" \u8868\u5355\u9879label "),
129
244
  createElementVNode("div", { class: "w-full flex justify-between text-main" }, [
130
245
  createElementVNode("div", { class: "flex items-center" }, [
131
246
  renderSlot(_ctx.$slots, __props.column.labelSlot, {
132
- column: __props.column,
247
+ column: columnConfig.value,
133
248
  model: __props.model,
134
249
  required: unref(isRequired)(props, __props.column)
135
250
  }, () => [
@@ -158,7 +273,11 @@ const _sfc_main = {
158
273
  1
159
274
  /* TEXT */
160
275
  )) : createCommentVNode("v-if", true),
161
- renderSlot(_ctx.$slots, __props.column.tooltipContentSlot)
276
+ renderSlot(_ctx.$slots, __props.column.tooltipContentSlot, {
277
+ column: columnConfig.value,
278
+ model: __props.model,
279
+ required: unref(isRequired)(props, __props.column)
280
+ })
162
281
  ]),
163
282
  default: withCtx(() => [
164
283
  createElementVNode("span", { class: "text-xs text-theme ml-2" }, [
@@ -184,13 +303,12 @@ const _sfc_main = {
184
303
  class: "ml-2 flex items-center"
185
304
  }, [
186
305
  renderSlot(_ctx.$slots, __props.column.rightSlot, {
187
- column: __props.column,
306
+ column: columnConfig.value,
188
307
  model: __props.model,
189
308
  required: unref(isRequired)(props, __props.column)
190
309
  })
191
310
  ])) : createCommentVNode("v-if", true)
192
311
  ]),
193
- createCommentVNode(" \u5185\u5BB9\u4EC5\u67E5\u770B "),
194
312
  unref(isReadonly)(props, __props.column) || !__props.column.type && !__props.column.slot ? (openBlock(), createElementBlock(
195
313
  "div",
196
314
  {
@@ -226,9 +344,10 @@ const _sfc_main = {
226
344
  Fragment,
227
345
  { key: 1 },
228
346
  [
347
+ createCommentVNode(" \u8868\u5355\u9879 "),
229
348
  createCommentVNode(" \u81EA\u5B9A\u4E49\u5177\u540D\u63D2\u69FD "),
230
349
  __props.column.slot && _ctx.$slots[__props.column.slot] ? renderSlot(_ctx.$slots, __props.column.slot, {
231
- column: __props.column,
350
+ column: columnConfig.value,
232
351
  model: __props.model,
233
352
  required: unref(isRequired)(props, __props.column)
234
353
  }, void 0, void 0, 0) : __props.column.type === "input" ? (openBlock(), createElementBlock(
@@ -256,15 +375,77 @@ const _sfc_main = {
256
375
  "onUpdate:modelValue": ($event) => bindValue.value = $event
257
376
  }, columnAttrs.value, {
258
377
  disabled: unref(isDisabled)(props, __props.column),
259
- options: unref(optionsHandler)(props, __props.column),
378
+ options: getOptionsHandler(props, __props.column),
260
379
  onChange: onChangeHandler
261
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
380
+ }), createSlots({
381
+ _: 2
382
+ /* DYNAMIC */
383
+ }, [
384
+ __props.column.optionsLoading ? {
385
+ name: "empty",
386
+ fn: withCtx(() => [
387
+ createElementVNode("div", { class: "w-full flex items-center justify-center py-2 gap-1.5 text-main text-xs whitespace-nowrap" }, [
388
+ createVNode(unref(ElIcon), {
389
+ size: "16",
390
+ class: "is-loading text-theme"
391
+ }, {
392
+ default: withCtx(() => [
393
+ createVNode(unref(Loading))
394
+ ]),
395
+ _: 1
396
+ /* STABLE */
397
+ }),
398
+ createElementVNode("span", null, "\u6570\u636E\u6B63\u5728\u52A0\u8F7D\u4E2D")
399
+ ])
400
+ ]),
401
+ key: "0"
402
+ } : void 0
403
+ ]), 1040, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
262
404
  ],
263
405
  2112
264
406
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
265
- )) : __props.column.type === "date-picker" ? (openBlock(), createElementBlock(
407
+ )) : __props.column.type === "select-v2" ? (openBlock(), createElementBlock(
266
408
  Fragment,
267
409
  { key: 3 },
410
+ [
411
+ createCommentVNode(" \u865A\u62DF\u5316\u9009\u62E9\u6846 "),
412
+ createVNode(unref(ElSelectV2), mergeProps({
413
+ modelValue: bindValue.value,
414
+ "onUpdate:modelValue": ($event) => bindValue.value = $event
415
+ }, columnAttrs.value, {
416
+ disabled: unref(isDisabled)(props, __props.column),
417
+ options: getOptionsHandler(props, __props.column),
418
+ onChange: onChangeHandler
419
+ }), createSlots({
420
+ _: 2
421
+ /* DYNAMIC */
422
+ }, [
423
+ __props.column.optionsLoading ? {
424
+ name: "empty",
425
+ fn: withCtx(() => [
426
+ createElementVNode("div", { class: "w-full flex items-center justify-center py-2 gap-1.5 text-main text-xs whitespace-nowrap" }, [
427
+ createVNode(unref(ElIcon), {
428
+ size: "16",
429
+ class: "is-loading text-theme"
430
+ }, {
431
+ default: withCtx(() => [
432
+ createVNode(unref(Loading))
433
+ ]),
434
+ _: 1
435
+ /* STABLE */
436
+ }),
437
+ createElementVNode("span", null, "\u6570\u636E\u6B63\u5728\u52A0\u8F7D\u4E2D")
438
+ ])
439
+ ]),
440
+ key: "0"
441
+ } : void 0
442
+ ]), 1040, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
443
+ ],
444
+ 2112
445
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
446
+ )) : __props.column.type === "date-picker" ? (openBlock(), createElementBlock(
447
+ Fragment,
448
+ { key: 4 },
268
449
  [
269
450
  createCommentVNode(" \u65E5\u671F\u9009\u62E9\u6846 "),
270
451
  ["datetimerange", "daterange", "monthrange", "yearrange"].includes(
@@ -297,7 +478,7 @@ const _sfc_main = {
297
478
  /* STABLE_FRAGMENT */
298
479
  )) : __props.column.type === "time-picker" ? (openBlock(), createElementBlock(
299
480
  Fragment,
300
- { key: 4 },
481
+ { key: 5 },
301
482
  [
302
483
  createCommentVNode(" \u65F6\u95F4\u9009\u62E9\u6846 "),
303
484
  columnAttrs.value.isRange ? (openBlock(), createBlock(unref(HyTimePicker), mergeProps({
@@ -328,7 +509,7 @@ const _sfc_main = {
328
509
  /* STABLE_FRAGMENT */
329
510
  )) : __props.column.type === "radio" ? (openBlock(), createElementBlock(
330
511
  Fragment,
331
- { key: 5 },
512
+ { key: 6 },
332
513
  [
333
514
  createCommentVNode(" \u5355\u9009 "),
334
515
  createVNode(unref(ElRadioGroup), mergeProps({
@@ -336,7 +517,7 @@ const _sfc_main = {
336
517
  "onUpdate:modelValue": ($event) => bindValue.value = $event
337
518
  }, columnAttrs.value, {
338
519
  disabled: unref(isDisabled)(props, __props.column),
339
- options: unref(optionsHandler)(props, __props.column),
520
+ options: getOptionsHandler(props, __props.column),
340
521
  onChange: onChangeHandler
341
522
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
342
523
  ],
@@ -344,7 +525,7 @@ const _sfc_main = {
344
525
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
345
526
  )) : __props.column.type === "radio-group" ? (openBlock(), createElementBlock(
346
527
  Fragment,
347
- { key: 6 },
528
+ { key: 7 },
348
529
  [
349
530
  createCommentVNode(" \u5355\u9009\u6309\u94AE "),
350
531
  createVNode(unref(HyRadioGroup), mergeProps({
@@ -352,7 +533,7 @@ const _sfc_main = {
352
533
  "onUpdate:modelValue": ($event) => bindValue.value = $event
353
534
  }, columnAttrs.value, {
354
535
  disabled: unref(isDisabled)(props, __props.column),
355
- options: unref(optionsHandler)(props, __props.column),
536
+ options: getOptionsHandler(props, __props.column),
356
537
  size: __props.size,
357
538
  onChange: onChangeHandler
358
539
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options", "size"])
@@ -361,7 +542,7 @@ const _sfc_main = {
361
542
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
362
543
  )) : __props.column.type === "checkbox" ? (openBlock(), createElementBlock(
363
544
  Fragment,
364
- { key: 7 },
545
+ { key: 8 },
365
546
  [
366
547
  createCommentVNode(" \u591A\u9009 "),
367
548
  createVNode(unref(ElCheckboxGroup), mergeProps({
@@ -369,7 +550,7 @@ const _sfc_main = {
369
550
  "onUpdate:modelValue": ($event) => bindValue.value = $event
370
551
  }, columnAttrs.value, {
371
552
  disabled: unref(isDisabled)(props, __props.column),
372
- options: unref(optionsHandler)(props, __props.column),
553
+ options: getOptionsHandler(props, __props.column),
373
554
  onChange: onChangeHandler
374
555
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
375
556
  ],
@@ -377,7 +558,7 @@ const _sfc_main = {
377
558
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
378
559
  )) : __props.column.type === "switch" ? (openBlock(), createElementBlock(
379
560
  Fragment,
380
- { key: 8 },
561
+ { key: 9 },
381
562
  [
382
563
  createCommentVNode(" \u5F00\u5173 "),
383
564
  createVNode(unref(ElSwitch), mergeProps({
@@ -395,7 +576,7 @@ const _sfc_main = {
395
576
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
396
577
  )) : __props.column.type === "input-number" ? (openBlock(), createElementBlock(
397
578
  Fragment,
398
- { key: 9 },
579
+ { key: 10 },
399
580
  [
400
581
  createCommentVNode(" \u6570\u5B57\u8F93\u5165\u6846 "),
401
582
  createVNode(unref(ElInputNumber), mergeProps({
@@ -410,10 +591,12 @@ const _sfc_main = {
410
591
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
411
592
  )) : __props.column.type === "org-cascader" ? (openBlock(), createElementBlock(
412
593
  Fragment,
413
- { key: 10 },
594
+ { key: 11 },
414
595
  [
415
596
  createCommentVNode(" \u90E8\u95E8\u7EA7\u8054\u9009\u62E9\u6846 "),
416
597
  createVNode(unref(HyOrgCascader), mergeProps({
598
+ ref_key: "orgCascaderRef",
599
+ ref: orgCascaderRef,
417
600
  modelValue: bindValue.value,
418
601
  "onUpdate:modelValue": ($event) => bindValue.value = $event,
419
602
  class: "w-full"
@@ -426,17 +609,41 @@ const _sfc_main = {
426
609
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
427
610
  )) : __props.column.type === "cascader" ? (openBlock(), createElementBlock(
428
611
  Fragment,
429
- { key: 11 },
612
+ { key: 12 },
430
613
  [
431
614
  createCommentVNode(" \u7EA7\u8054\u9009\u62E9\u6846 "),
432
615
  createVNode(unref(ElCascader), mergeProps({
433
616
  modelValue: bindValue.value,
434
617
  "onUpdate:modelValue": ($event) => bindValue.value = $event
435
618
  }, columnAttrs.value, {
619
+ class: "w-full",
436
620
  disabled: unref(isDisabled)(props, __props.column),
437
- options: unref(optionsHandler)(props, __props.column),
621
+ options: getOptionsHandler(props, __props.column),
438
622
  onChange: onChangeHandler
439
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
623
+ }), createSlots({
624
+ _: 2
625
+ /* DYNAMIC */
626
+ }, [
627
+ __props.column.optionsLoading ? {
628
+ name: "empty",
629
+ fn: withCtx(() => [
630
+ createElementVNode("div", { class: "w-full flex items-center justify-center py-2 gap-1.5 text-main text-xs whitespace-nowrap" }, [
631
+ createVNode(unref(ElIcon), {
632
+ size: "16",
633
+ class: "is-loading text-theme"
634
+ }, {
635
+ default: withCtx(() => [
636
+ createVNode(unref(Loading))
637
+ ]),
638
+ _: 1
639
+ /* STABLE */
640
+ }),
641
+ createElementVNode("span", null, "\u6570\u636E\u6B63\u5728\u52A0\u8F7D\u4E2D")
642
+ ])
643
+ ]),
644
+ key: "0"
645
+ } : void 0
646
+ ]), 1040, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
440
647
  ],
441
648
  2112
442
649
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
@@ -446,9 +653,24 @@ const _sfc_main = {
446
653
  /* STABLE_FRAGMENT */
447
654
  ))
448
655
  ]),
449
- _: 3
450
- /* FORWARDED */
451
- }, 8, ["id", "prop", "rules", "style"])) : createCommentVNode("v-if", true);
656
+ _: 2
657
+ /* DYNAMIC */
658
+ }, [
659
+ __props.column.optionsError ? {
660
+ name: "error",
661
+ fn: withCtx(() => [
662
+ createElementVNode("div", { class: "hy-el-form-item__error" }, [
663
+ createElementVNode("span", null, "\u6570\u636E\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7"),
664
+ createElementVNode("span", {
665
+ class: "text-theme cursor-pointer",
666
+ onClick: onReloadOptions
667
+ }, "[\u91CD\u65B0\u52A0\u8F7D]"),
668
+ createElementVNode("span", null, "\u6216\u8054\u7CFB\u7BA1\u7406\u5458")
669
+ ])
670
+ ]),
671
+ key: "0"
672
+ } : void 0
673
+ ]), 1032, ["id", "prop", "rules", "style", "error", "show-message"])) : createCommentVNode("v-if", true);
452
674
  };
453
675
  }
454
676
  };
@@ -232,6 +232,12 @@ const _sfc_main = {
232
232
  map.setView({ lat, lng }, mapConfig.maxZoom || 18);
233
233
  }
234
234
  }
235
+ function clearMarker() {
236
+ if (marker) {
237
+ marker.remove();
238
+ marker = null;
239
+ }
240
+ }
235
241
  function setMapSize() {
236
242
  emits("setMapSize");
237
243
  setTimeout(() => {
@@ -249,7 +255,8 @@ const _sfc_main = {
249
255
  hyMap = null;
250
256
  });
251
257
  __expose({
252
- setMarker
258
+ setMarker,
259
+ clearMarker
253
260
  });
254
261
  return (_ctx, _cache) => {
255
262
  return openBlock(), createElementBlock("div", { class: "w-full h-full flex flex-col" }, [
@@ -1,13 +1,12 @@
1
- import { defineComponent, useTemplateRef, computed, ref, nextTick, unref, openBlock, createBlock, mergeProps, withCtx, createElementVNode, normalizeStyle, createCommentVNode, createElementBlock, Fragment, renderList, normalizeClass, toDisplayString, createVNode, createSlots, renderSlot } from 'vue';
1
+ import { defineComponent, useTemplateRef, computed, ref, reactive, provide, toRefs, onMounted, nextTick, unref, openBlock, createBlock, mergeProps, withCtx, createElementVNode, normalizeStyle, createCommentVNode, createElementBlock, Fragment, renderList, normalizeClass, toDisplayString, createVNode, createSlots, renderSlot } from 'vue';
2
2
  import { ElForm, ElDivider } from 'element-plus';
3
- import '@element-plus/icons-vue';
4
3
  import '../../hooks/index.mjs';
5
4
  import '../../utils/index.mjs';
6
5
  import _sfc_main$4 from './cpns/formItem.vue.mjs';
7
6
  import _sfc_main$1 from './cpns/extraItem.vue.mjs';
8
7
  import _sfc_main$2 from './cpns/arrayItem.vue.mjs';
9
8
  import _sfc_main$3 from './cpns/locationSelect.vue.mjs';
10
- import { columnShowHandler, columnItemStyle } from './js/index.mjs';
9
+ import { formContextKey, columnShowHandler, columnItemStyle } from './js/index.mjs';
11
10
  import { resetAppFormValue } from './js/useAppForm.mjs';
12
11
  import { useLocale } from '../../hooks/useLocale.mjs';
13
12
  import { isArray, isNumber } from '../../utils/is.mjs';
@@ -51,12 +50,16 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
51
50
  type: String,
52
51
  default: "default"
53
52
  // 'large' | 'default' | 'small'
53
+ },
54
+ showMessage: {
55
+ type: Boolean,
56
+ default: true
54
57
  }
55
58
  },
56
59
  emits: ["on-allMapSelect", "complete"],
57
60
  setup(__props, { expose: __expose, emit: __emit }) {
58
- const emit = __emit;
59
61
  const props = __props;
62
+ const emits = __emit;
60
63
  const { t } = useLocale();
61
64
  const formTemplateRef = useTemplateRef("formTemplateRef");
62
65
  const formColumnMap = computed(() => {
@@ -79,52 +82,118 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
79
82
  const allMapSelect = ref(false);
80
83
  function setMapSize() {
81
84
  allMapSelect.value = !allMapSelect.value;
82
- emit("on-allMapSelect", allMapSelect.value);
85
+ emits("on-allMapSelect", allMapSelect.value);
83
86
  }
84
87
  function complete() {
85
- emit("complete");
88
+ emits("complete");
89
+ }
90
+ const fields = reactive([]);
91
+ function addField(field) {
92
+ fields.push(field);
93
+ }
94
+ const removeField = (field) => {
95
+ if (field.propString) {
96
+ fields.splice(fields.indexOf(field), 1);
97
+ }
98
+ };
99
+ function filterFields(fields2 = [], keys = []) {
100
+ const filterKeys = keys.map((prop) => isArray(prop) ? prop.join(".") : prop);
101
+ return filterKeys.length ? fields2.filter(
102
+ (field) => field.propString && filterKeys.includes(field.propString)
103
+ ) : fields2;
104
+ }
105
+ async function obtainOptionsFields(keys, isMountedLoad = false) {
106
+ const filteredFields = filterFields(fields, keys);
107
+ await Promise.allSettled(
108
+ filteredFields.map((field) => field.obtainOptions(isMountedLoad))
109
+ );
110
+ }
111
+ async function getOptions(isMountedLoad = false) {
112
+ await obtainOptionsFields([], isMountedLoad);
113
+ emitOptionsStatus();
114
+ }
115
+ async function getOptionsFields(keys) {
116
+ await obtainOptionsFields(keys);
117
+ emitOptionsStatus();
86
118
  }
119
+ async function getOptionsError() {
120
+ const filteredFields = fields.filter(
121
+ (field) => field.propString && field.optionsError
122
+ );
123
+ await Promise.allSettled(filteredFields.map((field) => field.obtainOptions()));
124
+ emitOptionsStatus();
125
+ }
126
+ function emitOptionsStatus() {
127
+ const hasError = fields.some((item) => item.optionsError === "error");
128
+ emits("optionsStatus", { result: !hasError });
129
+ }
130
+ provide(
131
+ formContextKey,
132
+ reactive({
133
+ ...toRefs(props),
134
+ emits,
135
+ addField,
136
+ removeField,
137
+ emitOptionsStatus
138
+ })
139
+ );
140
+ onMounted(() => {
141
+ getOptions(true);
142
+ });
87
143
  __expose({
88
144
  validate: async (callback) => {
89
145
  await nextTick();
90
146
  return unref(formTemplateRef).validate(callback);
91
147
  },
92
- validateField: async (fields) => {
148
+ validateField: async (fields2) => {
93
149
  await nextTick();
94
- return unref(formTemplateRef).validateField(fields);
150
+ return unref(formTemplateRef).validateField(fields2);
95
151
  },
96
- resetFields: async (fields) => {
152
+ resetFields: async (fields2) => {
97
153
  let columns = props.columns || [];
98
- if (fields && fields?.length) {
99
- columns = fields.map((key) => formColumnMap.value.get(key)).filter(Boolean);
154
+ if (fields2 && fields2?.length) {
155
+ columns = fields2.map((key) => formColumnMap.value.get(key)).filter(Boolean);
100
156
  }
101
157
  resetAppFormValue(columns, props.model);
102
- unref(formTemplateRef).clearValidate(fields);
158
+ unref(formTemplateRef).clearValidate(fields2);
103
159
  },
104
- scrollToField: async (fields) => {
160
+ scrollToField: async (fields2) => {
105
161
  await nextTick();
106
- unref(formTemplateRef).scrollToField(fields);
162
+ unref(formTemplateRef).scrollToField(fields2);
107
163
  },
108
- clearValidate: async (fields) => {
164
+ clearValidate: async (fields2) => {
109
165
  await nextTick();
110
- unref(formTemplateRef).clearValidate(fields);
166
+ unref(formTemplateRef).clearValidate(fields2);
111
167
  },
112
168
  fields: computed(() => {
113
169
  return unref(formTemplateRef)?.fields || [];
114
170
  }),
115
- getField: async (fields) => {
171
+ getField: async (fields2) => {
116
172
  await nextTick();
117
- return unref(formTemplateRef).getField(fields);
173
+ return unref(formTemplateRef).getField(fields2);
118
174
  },
119
175
  setMarker: (latlng) => {
120
176
  if (locationSelectRef.value) {
121
177
  isArray(locationSelectRef.value) ? locationSelectRef.value.map((item) => item.setMarker(latlng)) : locationSelectRef.value.setMarker(latlng);
122
178
  }
123
- }
179
+ },
180
+ clearMarker: () => {
181
+ if (locationSelectRef.value) {
182
+ isArray(locationSelectRef.value) ? locationSelectRef.value.map((item) => item.clearMarker()) : locationSelectRef.value.clearMarker();
183
+ }
184
+ },
124
185
  // setInitialValue: async (value) => {
125
186
  // await nextTick()
126
187
  // unref(formTemplateRef).setInitialValue(value)
127
188
  // }
189
+ getOptions,
190
+ getOptionsFields,
191
+ getOptionsError,
192
+ getOptionsByField: (field) => {
193
+ const [target] = filterFields(fields, [field]);
194
+ if (!target) return null;
195
+ return target.options;
196
+ }
128
197
  });
129
198
  return (_ctx, _cache) => {
130
199
  return openBlock(), createBlock(unref(ElForm), mergeProps({
@@ -6,6 +6,7 @@ import { isNumber, isBoolean, isFunction, isString, isArray, isObject } from '..
6
6
  import { columnRuleHandler, getValueByProp } from '../../../utils/form.mjs';
7
7
  import { useLocale } from '../../../hooks/useLocale.mjs';
8
8
 
9
+ const formContextKey = /* @__PURE__ */ Symbol("formContextKey");
9
10
  function columnItemStyle(props, column) {
10
11
  const style = {};
11
12
  let span = funRunHandler(column.span, column, props.model);
@@ -119,4 +120,4 @@ function optionsHandler(props, column) {
119
120
  return [];
120
121
  }
121
122
 
122
- export { columnHelpHandler, columnItemStyle, columnShowHandler, columnVisibleHandler, isDisabled, isReadonly, isRequired, optionsHandler, renderAddLabel, renderArrayItemLabel, renderText };
123
+ export { columnHelpHandler, columnItemStyle, columnShowHandler, columnVisibleHandler, formContextKey, isDisabled, isReadonly, isRequired, optionsHandler, renderAddLabel, renderArrayItemLabel, renderText };