yxuse 3.0.50 → 3.0.51

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/lib/index.es2.js CHANGED
@@ -36,7 +36,7 @@ var __async = (__this, __arguments, generator) => {
36
36
  });
37
37
  };
38
38
  import { g as getToken, s as showFullScreenLoading, h as hideFullScreenLoading, c as checkStatus, a as http } from "./index.es12.js";
39
- import { m as mqtt_minExports, a as areColorsSimilar, c as copyText, e as enumToArray, g as getCownDownTime, b as getSelectOptions, i as isColorEqual, d as isDarkColor, f as isTabActive, n as notifyMessageToSystems, r as receiveMessage, y as yxMessage, h as yxSubscribe } from "./mqtt.min.es.js";
39
+ import { m as mqtt_minExports, a as areColorsSimilar, c as copyText, e as enumToArray, g as getCownDownTime, b as getSelectOptions, i as isColorEqual, d as isDarkColor, n as notifyMessageToSystems, r as receiveMessage, u as useConfirm, y as yxMessage, f as yxSubscribe } from "./mqtt.min.es.js";
40
40
  import "element-plus";
41
41
  function buildQuery(params) {
42
42
  if (!params) return "";
@@ -333,9 +333,9 @@ const utils2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
333
333
  http,
334
334
  isColorEqual,
335
335
  isDarkColor,
336
- isTabActive,
337
336
  notifyMessageToSystems,
338
337
  receiveMessage,
338
+ useConfirm,
339
339
  yxFecth,
340
340
  yxMessage,
341
341
  yxSubscribe
package/lib/index.es5.js CHANGED
@@ -45,9 +45,9 @@ var _elId;
45
45
  import { g as getCommentUntreatedCount, b as getUserThemeList } from "./index.es4.js";
46
46
  import { createElementBlock, openBlock, createStaticVNode, createElementVNode, withDirectives, toDisplayString, vShow, resolveComponent, createBlock, Transition, withCtx, normalizeClass, createCommentVNode, normalizeStyle, Fragment, renderList, resolveDynamicComponent, useCssVars, createVNode, version as version$1, createApp } from "vue";
47
47
  import { c as commonjsGlobal, g as getAugmentedNamespace, a as getDefaultExportFromCjs } from "./dayjs.min.es.js";
48
- import { j as commonjsRequire, h as yxSubscribe, i as isColorEqual } from "./mqtt.min.es.js";
49
- import { e as changeSystemConfig, f as getSystemConfig, a as http, B as BC_LANG_NAME, i as BC_THEME_NAME, k as setSystemConfig } from "./index.es12.js";
48
+ import { h as commonjsRequire, f as yxSubscribe, i as isColorEqual } from "./mqtt.min.es.js";
50
49
  import "element-plus";
50
+ import { e as changeSystemConfig, f as getSystemConfig, a as http, B as BC_LANG_NAME, i as BC_THEME_NAME, k as setSystemConfig } from "./index.es12.js";
51
51
  import "./index.es7.js";
52
52
  import "./index.es11.js";
53
53
  const YX_TITLE = "@font-face {font-family: 'YX-TITLE';font-size: 16px; src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699612675710_ALIBABAPUHUITI-2-105-HEAVY.TTF') format('woff'), url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699612675710_ALIBABAPUHUITI-2-105-HEAVY.TTF') format('woff2'); font-style: normal;font-display: swap;}";
Binary file
package/lib/index.es6.js CHANGED
@@ -49,12 +49,12 @@ var __async = (__this, __arguments, generator) => {
49
49
  step((generator = generator.apply(__this, __arguments)).next());
50
50
  });
51
51
  };
52
- import { defineComponent, reactive, resolveComponent, createBlock, openBlock, createSlots, withCtx, renderSlot, createElementVNode, createVNode, createTextVNode, watch, resolveDynamicComponent, mergeProps, createElementBlock, createCommentVNode, Fragment, renderList, useSlots, useAttrs, ref, onMounted, nextTick, withModifiers, isVNode, toDisplayString, unref, normalizeStyle, normalizeClass, version, createApp } from "vue";
52
+ import { defineComponent, reactive, resolveComponent, createBlock, openBlock, createSlots, withCtx, renderSlot, createElementVNode, createVNode, createTextVNode, watch, resolveDynamicComponent, mergeProps, createElementBlock, createCommentVNode, Fragment, renderList, useSlots, useAttrs, ref, onMounted, nextTick, onBeforeMount, withModifiers, isVNode, toDisplayString, unref, normalizeStyle, normalizeClass, version, createApp } from "vue";
53
53
  import { S as Sortable, _ as _export_sfc, T as Toolbar } from "./index.es5.js";
54
+ import { genFileId } from "element-plus";
54
55
  import { j as jumpToHome, b as getUserConfig } from "./index.es12.js";
55
- import "element-plus";
56
56
  import { u as uploadResourceApi } from "./index.es13.js";
57
- const _hoisted_1$3 = { class: "dialog-footer flex justify-end" };
57
+ const _hoisted_1$4 = { class: "dialog-footer flex justify-end" };
58
58
  const _sfc_main$9 = /* @__PURE__ */ defineComponent({
59
59
  __name: "index",
60
60
  setup(__props, { expose: __expose }) {
@@ -67,6 +67,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
67
67
  autoClose: true
68
68
  });
69
69
  const close = () => {
70
+ dialogMap["cancel"] && dialogMap["cancel"]();
70
71
  dialogOptions.show = false;
71
72
  };
72
73
  const dialogMap = {};
@@ -81,7 +82,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
81
82
  dialogOptions.loading = false;
82
83
  }
83
84
  });
84
- const show = ({ width, title, submit: submit2, cancel, showFooter, autoClose, beforeOpen, beforeSubmit }) => {
85
+ const show = (_0) => __async(this, [_0], function* ({ width, title, submit: submit2, cancel, showFooter, autoClose, beforeOpen, beforeSubmit }) {
85
86
  if (width) dialogOptions.width = width;
86
87
  if (title) dialogOptions.title = title;
87
88
  if (showFooter !== void 0) dialogOptions.showFooter = showFooter;
@@ -89,9 +90,11 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
89
90
  if (submit2) dialogMap["submit"] = submit2;
90
91
  if (cancel) dialogMap["cancel"] = cancel;
91
92
  if (beforeSubmit) dialogMap["beforeSubmit"] = beforeSubmit;
92
- if (beforeOpen) beforeOpen();
93
+ if (beforeOpen) {
94
+ yield beforeOpen();
95
+ }
93
96
  dialogOptions.show = true;
94
- };
97
+ });
95
98
  __expose({
96
99
  show,
97
100
  close
@@ -104,9 +107,10 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
104
107
  attrs: "",
105
108
  width: dialogOptions.width,
106
109
  modelValue: dialogOptions.show,
107
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => dialogOptions.show = $event),
110
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => dialogOptions.show = $event),
108
111
  title: dialogOptions.title,
109
- "destroy-on-close": ""
112
+ "destroy-on-close": "",
113
+ "before-close": close
110
114
  }, createSlots({
111
115
  default: withCtx(() => [
112
116
  renderSlot(_ctx.$slots, "default")
@@ -116,12 +120,12 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
116
120
  dialogOptions.showFooter ? {
117
121
  name: "footer",
118
122
  fn: withCtx(() => [
119
- createElementVNode("span", _hoisted_1$3, [
123
+ createElementVNode("span", _hoisted_1$4, [
120
124
  createVNode(_component_el_button, {
121
125
  plain: "",
122
- onClick: close
126
+ onClick: _cache[0] || (_cache[0] = ($event) => dialogOptions.show = false)
123
127
  }, {
124
- default: withCtx(() => _cache[1] || (_cache[1] = [
128
+ default: withCtx(() => _cache[2] || (_cache[2] = [
125
129
  createTextVNode("取消")
126
130
  ])),
127
131
  _: 1
@@ -130,7 +134,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
130
134
  loading: dialogOptions.loading,
131
135
  onClick: submit
132
136
  }, {
133
- default: withCtx(() => _cache[2] || (_cache[2] = [
137
+ default: withCtx(() => _cache[3] || (_cache[3] = [
134
138
  createTextVNode("确认")
135
139
  ])),
136
140
  _: 1
@@ -143,7 +147,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
143
147
  };
144
148
  }
145
149
  });
146
- const _hoisted_1$2 = { class: "dialog-footer flex justify-end" };
150
+ const _hoisted_1$3 = { class: "dialog-footer flex justify-end" };
147
151
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
148
152
  __name: "index",
149
153
  setup(__props, { expose: __expose }) {
@@ -156,6 +160,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
156
160
  autoClose: true
157
161
  });
158
162
  const close = () => {
163
+ drawerMap["cancel"] && drawerMap["cancel"]();
159
164
  drawerOptions.show = false;
160
165
  };
161
166
  const drawerMap = {};
@@ -170,7 +175,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
170
175
  drawerOptions.loading = false;
171
176
  }
172
177
  });
173
- const show = ({ width, title, submit: submit2, cancel, showFooter, autoClose, beforeOpen, beforeSubmit }) => {
178
+ const show = (_0) => __async(this, [_0], function* ({ width, title, submit: submit2, cancel, showFooter, autoClose, beforeOpen, beforeSubmit }) {
174
179
  if (width) drawerOptions.width = width;
175
180
  if (title) drawerOptions.title = title;
176
181
  if (showFooter !== void 0) drawerOptions.showFooter = showFooter;
@@ -178,9 +183,11 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
178
183
  if (submit2) drawerMap["submit"] = submit2;
179
184
  if (cancel) drawerMap["cancel"] = cancel;
180
185
  if (beforeSubmit) drawerMap["beforeSubmit"] = beforeSubmit;
181
- if (beforeOpen) beforeOpen();
186
+ if (beforeOpen) {
187
+ yield beforeOpen();
188
+ }
182
189
  drawerOptions.show = true;
183
- };
190
+ });
184
191
  __expose({
185
192
  show,
186
193
  close
@@ -191,10 +198,12 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
191
198
  return openBlock(), createBlock(_component_el_drawer, {
192
199
  "close-on-click-modal": false,
193
200
  attrs: "",
194
- width: drawerOptions.width,
201
+ size: drawerOptions.width,
195
202
  modelValue: drawerOptions.show,
196
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => drawerOptions.show = $event),
197
- title: drawerOptions.title
203
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => drawerOptions.show = $event),
204
+ title: drawerOptions.title,
205
+ "destroy-on-close": "",
206
+ onClose: close
198
207
  }, createSlots({
199
208
  default: withCtx(() => [
200
209
  renderSlot(_ctx.$slots, "default")
@@ -204,12 +213,12 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
204
213
  drawerOptions.showFooter ? {
205
214
  name: "footer",
206
215
  fn: withCtx(() => [
207
- createElementVNode("span", _hoisted_1$2, [
216
+ createElementVNode("span", _hoisted_1$3, [
208
217
  createVNode(_component_el_button, {
209
218
  plain: "",
210
- onClick: close
219
+ onClick: _cache[0] || (_cache[0] = ($event) => drawerOptions.show = false)
211
220
  }, {
212
- default: withCtx(() => _cache[1] || (_cache[1] = [
221
+ default: withCtx(() => _cache[2] || (_cache[2] = [
213
222
  createTextVNode("取消")
214
223
  ])),
215
224
  _: 1
@@ -218,7 +227,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
218
227
  loading: drawerOptions.loading,
219
228
  onClick: submit
220
229
  }, {
221
- default: withCtx(() => _cache[2] || (_cache[2] = [
230
+ default: withCtx(() => _cache[3] || (_cache[3] = [
222
231
  createTextVNode("确认")
223
232
  ])),
224
233
  _: 1
@@ -227,7 +236,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
227
236
  ]),
228
237
  key: "0"
229
238
  } : void 0
230
- ]), 1032, ["width", "modelValue", "title"]);
239
+ ]), 1032, ["size", "modelValue", "title"]);
231
240
  };
232
241
  }
233
242
  });
@@ -20457,7 +20466,9 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20457
20466
  props: {
20458
20467
  tableData: {},
20459
20468
  rowKey: {},
20460
- columns: {},
20469
+ columns: {
20470
+ type: [Array, Function]
20471
+ },
20461
20472
  pageInfo: {},
20462
20473
  sort: {
20463
20474
  type: Boolean
@@ -20473,12 +20484,28 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20473
20484
  const slots = useSlots();
20474
20485
  const attrs = useAttrs();
20475
20486
  const tableRef = ref();
20487
+ const columns = ref([]);
20476
20488
  const emit = __emit;
20477
20489
  onMounted(() => {
20478
20490
  nextTick(() => {
20479
20491
  startSort();
20480
20492
  });
20481
20493
  });
20494
+ onBeforeMount(() => __async(this, null, function* () {
20495
+ columns.value = typeof props.columns === "function" ? yield props.columns() : props.columns;
20496
+ columns.value.forEach((col) => {
20497
+ var _a;
20498
+ if (!col.renderType) return;
20499
+ if (["select", "cascader"].includes(col.renderType) && ((_a = col == null ? void 0 : col.config) == null ? void 0 : _a.loadOptions)) {
20500
+ loadOptions(col.config);
20501
+ }
20502
+ });
20503
+ }));
20504
+ const loadOptions = (config) => __async(this, null, function* () {
20505
+ if ((config == null ? void 0 : config.options) && (config == null ? void 0 : config.options.length) === 0 && (config == null ? void 0 : config.loadOptions) && typeof (config == null ? void 0 : config.loadOptions) === "function") {
20506
+ config.options = yield config == null ? void 0 : config.loadOptions();
20507
+ }
20508
+ });
20482
20509
  const startSort = () => {
20483
20510
  var _a, _b;
20484
20511
  if (!props.sort) return;
@@ -20496,10 +20523,9 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20496
20523
  }
20497
20524
  });
20498
20525
  };
20499
- const render = (props2) => {
20526
+ const render2 = (props2) => {
20500
20527
  let _slot;
20501
20528
  const {
20502
- columns,
20503
20529
  rowKey,
20504
20530
  tableData,
20505
20531
  pageInfo
@@ -20583,12 +20609,13 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20583
20609
  "onCurrentChange": handleCurrentChange
20584
20610
  }, null)]);
20585
20611
  };
20612
+ if (!columns.value) return;
20586
20613
  return createVNode(Fragment, null, [createVNode(resolveComponent("el-table"), mergeProps({
20587
20614
  "ref": tableRef
20588
20615
  }, attrs, {
20589
20616
  "row-key": rowKey,
20590
20617
  "data": tableData
20591
- }), _isSlot$1(_slot = renderColumn(columns)) ? _slot : {
20618
+ }), _isSlot$1(_slot = renderColumn(columns.value)) ? _slot : {
20592
20619
  default: () => [_slot]
20593
20620
  }), pagination()]);
20594
20621
  };
@@ -20608,7 +20635,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20608
20635
  exportDataToExcel
20609
20636
  });
20610
20637
  return (_ctx, _cache) => {
20611
- return openBlock(), createBlock(resolveDynamicComponent(render(props)));
20638
+ return openBlock(), createBlock(resolveDynamicComponent(render2(props)));
20612
20639
  };
20613
20640
  }
20614
20641
  }));
@@ -20637,7 +20664,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
20637
20664
  const slots = useSlots();
20638
20665
  const props = __props;
20639
20666
  const emit = __emit;
20640
- const render = (props2) => {
20667
+ const render2 = (props2) => {
20641
20668
  const {
20642
20669
  searchColumns,
20643
20670
  searchParams,
@@ -20686,11 +20713,24 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
20686
20713
  }), slots.default && slots.default()])]);
20687
20714
  };
20688
20715
  return (_ctx, _cache) => {
20689
- return openBlock(), createBlock(resolveDynamicComponent(render(props)));
20716
+ return openBlock(), createBlock(resolveDynamicComponent(render2(props)));
20690
20717
  };
20691
20718
  }
20692
20719
  });
20693
20720
  const index$2 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c70da20e"]]);
20721
+ const _hoisted_1$2 = {
20722
+ xmlns: "http://www.w3.org/2000/svg",
20723
+ viewBox: "0 0 1024 1024"
20724
+ };
20725
+ function render(_ctx, _cache) {
20726
+ return openBlock(), createElementBlock("svg", _hoisted_1$2, _cache[0] || (_cache[0] = [
20727
+ createElementVNode("path", {
20728
+ fill: "currentColor",
20729
+ d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592q0-64.416-42.24-101.376c-28.16-25.344-65.472-37.312-111.232-37.312m-12.672 406.208a54.27 54.27 0 0 0-38.72 14.784 49.4 49.4 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.85 54.85 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.97 51.97 0 0 0-15.488-38.016 55.94 55.94 0 0 0-39.424-14.784"
20730
+ }, null, -1)
20731
+ ]));
20732
+ }
20733
+ const Question = { render };
20694
20734
  function _isSlot(s) {
20695
20735
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
20696
20736
  }
@@ -20719,27 +20759,54 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20719
20759
  }) {
20720
20760
  const formData = ref({});
20721
20761
  const formRules = ref({});
20722
- const initForm = () => {
20762
+ const formColumn = ref([]);
20763
+ const isOptionsComponent = (type) => type && ["select", "cascader"].includes(type);
20764
+ const initForm = () => __async(this, null, function* () {
20765
+ var _a;
20723
20766
  const {
20724
20767
  formList,
20725
20768
  formParams
20726
20769
  } = props;
20727
- if (!(formList == null ? void 0 : formList.length)) return;
20728
- if (!formParams || Object.keys(formParams).length === 0) {
20729
- formList.forEach((item) => {
20730
- var _a;
20731
- if ((_a = item.children) == null ? void 0 : _a.length) {
20732
- item.children.forEach((child) => {
20733
- if (child.prop) formData.value[child == null ? void 0 : child.prop] = "";
20734
- });
20735
- } else if (item.prop) {
20736
- formData.value[item == null ? void 0 : item.prop] = "";
20770
+ formColumn.value = typeof formList === "function" ? yield formList() : formList;
20771
+ if (!Array.isArray(formColumn.value) || formColumn.value.length === 0) {
20772
+ return;
20773
+ }
20774
+ const initialData = {};
20775
+ const fillFormData = (item) => {
20776
+ if (item.prop && !(item.prop in initialData)) {
20777
+ initialData[item.prop] = "";
20778
+ }
20779
+ if (isOptionsComponent(item == null ? void 0 : item.renderType)) {
20780
+ loadOptions(item);
20781
+ }
20782
+ if (Array.isArray(item.children)) {
20783
+ item.children.forEach(fillFormData);
20784
+ }
20785
+ };
20786
+ formColumn.value.forEach((item) => fillFormData(item));
20787
+ if (formParams && Object.keys(formParams).length > 0) {
20788
+ for (const item of formColumn.value) {
20789
+ if (!item.prop) continue;
20790
+ const isAsyncOption = ((_a = item.config) == null ? void 0 : _a.loadOptions) && typeof item.config.loadOptions === "function";
20791
+ if (!(isAsyncOption && formParams[item.prop] !== void 0)) {
20792
+ initialData[item.prop] = formParams[item.prop];
20737
20793
  }
20738
- });
20739
- } else {
20740
- formData.value = formParams;
20794
+ }
20741
20795
  }
20742
- };
20796
+ formData.value = initialData;
20797
+ });
20798
+ const loadOptions = (_0) => __async(this, [_0], function* ({
20799
+ config,
20800
+ prop
20801
+ }) {
20802
+ var _a;
20803
+ if ((config == null ? void 0 : config.options) && (config == null ? void 0 : config.options.length) === 0 && (config == null ? void 0 : config.loadOptions) && typeof (config == null ? void 0 : config.loadOptions) === "function") {
20804
+ config.options = yield config == null ? void 0 : config.loadOptions();
20805
+ if (prop && ((_a = props == null ? void 0 : props.formParams) == null ? void 0 : _a[prop])) {
20806
+ formData.value[prop] = props.formParams[prop];
20807
+ }
20808
+ }
20809
+ });
20743
20810
  const slots = useSlots();
20744
20811
  const attrs = useAttrs();
20745
20812
  const props = __props;
@@ -20755,18 +20822,17 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20755
20822
  }
20756
20823
  });
20757
20824
  const getRules = () => {
20825
+ var _a;
20758
20826
  let rules = {};
20759
- const {
20760
- formList
20761
- } = props;
20762
- if (!(formList == null ? void 0 : formList.length)) return;
20827
+ if (!((_a = formColumn.value) == null ? void 0 : _a.length)) return;
20763
20828
  const handleRule = (item) => {
20829
+ var _a2;
20764
20830
  if (!item.required) return;
20765
20831
  if (!item.prop) return;
20766
20832
  const isSelect = (item == null ? void 0 : item.renderType) && ["select", "cascader"].includes(item == null ? void 0 : item.renderType);
20767
20833
  const defaultRule = {
20768
20834
  required: true,
20769
- message: `${item.label}不能为空`,
20835
+ message: `${(_a2 = item.label) != null ? _a2 : ""}不能为空`,
20770
20836
  trigger: isSelect ? "change" : "blur"
20771
20837
  };
20772
20838
  rules[item.prop] = rules[item.prop] ? [...rules[item.prop], defaultRule] : [defaultRule];
@@ -20774,15 +20840,19 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20774
20840
  rules[item.prop] = [...rules[item.prop], ...item.rules];
20775
20841
  }
20776
20842
  };
20777
- formList.forEach((form) => {
20778
- var _a;
20779
- (_a = form.children) == null ? void 0 : _a.forEach(handleRule);
20843
+ formColumn.value.forEach((form) => {
20844
+ var _a2;
20845
+ (_a2 = form.children) == null ? void 0 : _a2.forEach(handleRule);
20780
20846
  handleRule(form);
20781
20847
  });
20782
20848
  formRules.value = rules;
20783
20849
  };
20784
- initForm();
20785
- getRules();
20850
+ onBeforeMount(() => __async(this, null, function* () {
20851
+ if (props.formList) {
20852
+ yield initForm();
20853
+ getRules();
20854
+ }
20855
+ }));
20786
20856
  const formRef = ref();
20787
20857
  const getFormStyle = () => {
20788
20858
  const {
@@ -20814,13 +20884,14 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20814
20884
  "grid-gap": gap
20815
20885
  }, style);
20816
20886
  };
20817
- const render = (props2) => {
20887
+ const render2 = (props2) => {
20888
+ var _a;
20818
20889
  let _slot;
20819
20890
  const {
20820
- formList,
20821
20891
  formStyle,
20822
20892
  formLayout
20823
20893
  } = props2;
20894
+ if (!((_a = formColumn.value) == null ? void 0 : _a.length)) return;
20824
20895
  const dynamicComponent = ({
20825
20896
  renderType,
20826
20897
  event,
@@ -20828,6 +20899,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20828
20899
  label,
20829
20900
  config
20830
20901
  }) => {
20902
+ if (!prop) return;
20831
20903
  const Component = resolveComponent("el-" + renderType);
20832
20904
  const renderChildComponent = () => {
20833
20905
  if (renderType === "select") return config == null ? void 0 : config.options.map((item) => createVNode(resolveComponent("el-option"), {
@@ -20840,9 +20912,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20840
20912
  }, null));
20841
20913
  return null;
20842
20914
  };
20843
- const _a = config || {}, {
20915
+ const _a2 = config || {}, {
20844
20916
  options
20845
- } = _a, conf = __objRest(_a, [
20917
+ } = _a2, conf = __objRest(_a2, [
20846
20918
  "options"
20847
20919
  ]);
20848
20920
  if (renderType === "cascader") return createVNode(resolveComponent("el-cascader"), mergeProps(event, conf, {
@@ -20851,7 +20923,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20851
20923
  "onUpdate:modelValue": ($event) => formData.value[prop] = $event,
20852
20924
  "placeholder": `请选择${label}`
20853
20925
  }), null);
20854
- let isSelect = ["select", "cascader"].includes(renderType);
20926
+ let isSelect = renderType && ["select", "cascader"].includes(renderType);
20855
20927
  return createVNode(Component, mergeProps(event, {
20856
20928
  "placeholder": `请${isSelect ? "选择" : "输入"}${label}`
20857
20929
  }, conf, {
@@ -20862,21 +20934,15 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20862
20934
  });
20863
20935
  };
20864
20936
  const formItemSlots = (form, scope) => {
20865
- var _a;
20866
- return form.slotName && ((_a = slots[form.slotName]) == null ? void 0 : _a.call(slots, scope));
20937
+ var _a2;
20938
+ return form.slotName && ((_a2 = slots[form.slotName]) == null ? void 0 : _a2.call(slots, scope));
20867
20939
  };
20868
- const renderFormItem = (formList2) => {
20940
+ const renderFormItem = (formList) => {
20869
20941
  const renderForm = (form) => {
20870
20942
  var _b;
20871
- const _a = form, {
20872
- render: render2,
20873
- config,
20874
- renderType,
20943
+ const _a2 = form, {
20875
20944
  className
20876
- } = _a, formProps = __objRest(_a, [
20877
- "render",
20878
- "config",
20879
- "renderType",
20945
+ } = _a2, formProps = __objRest(_a2, [
20880
20946
  "className"
20881
20947
  ]);
20882
20948
  return createVNode(resolveComponent("el-form-item"), mergeProps({
@@ -20892,34 +20958,28 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20892
20958
  return (form == null ? void 0 : form.slotName) && formItemSlots(form, scope);
20893
20959
  },
20894
20960
  label: () => {
20895
- var _a2, _b2;
20961
+ var _a3, _b2;
20896
20962
  return form.label ? createVNode("div", {
20897
- "class": `flex items-center gap-5 ${(_a2 = form.labelClassName) != null ? _a2 : ""}`
20963
+ "class": `flex items-center gap-5 ${(_a3 = form.labelClassName) != null ? _a3 : ""}`
20898
20964
  }, [form.label, form.promptConf ? createVNode(resolveComponent("el-tooltip"), (_b2 = form.promptConf) == null ? void 0 : _b2.tooltipConf, {
20899
20965
  default: () => {
20900
- var _a3, _b3, _c;
20966
+ var _a4, _b3, _c;
20901
20967
  return [createVNode(resolveComponent("el-icon"), {
20902
- "size": (_b3 = (_a3 = form.promptConf) == null ? void 0 : _a3.size) != null ? _b3 : 15,
20968
+ "size": (_b3 = (_a4 = form.promptConf) == null ? void 0 : _a4.size) != null ? _b3 : 15,
20903
20969
  "color": (_c = form.promptConf) == null ? void 0 : _c.color
20904
20970
  }, {
20905
- default: () => [createVNode("svg", {
20906
- "xmlns": "http://www.w3.org/2000/svg",
20907
- "viewBox": "0 0 1024 1024"
20908
- }, [createVNode("path", {
20909
- "fill": "currentColor",
20910
- "d": "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592 0-42.944-14.08-76.736-42.24-101.376-28.16-25.344-65.472-37.312-111.232-37.312zm-12.672 406.208a54.272 54.272 0 0 0-38.72 14.784 49.408 49.408 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.848 54.848 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.968 51.968 0 0 0-15.488-38.016 55.936 55.936 0 0 0-39.424-14.784z"
20911
- }, null)])]
20971
+ default: () => [createVNode(Question, null, null)]
20912
20972
  })];
20913
20973
  }
20914
20974
  }) : ""]) : null;
20915
20975
  }
20916
20976
  });
20917
20977
  };
20918
- return formList2.filter((form) => !form.show || form.show(formData.value)).map((form) => {
20919
- var _a, _b, _c, _d;
20978
+ return formList.filter((form) => !form.show || form.show(formData.value)).map((form) => {
20979
+ var _a2, _b, _c, _d;
20920
20980
  if (form.children && form.children.length > 0) {
20921
20981
  return createVNode("div", {
20922
- "class": `flex flex-col ${(_a = form.groupWrapClassName) != null ? _a : ""}`,
20982
+ "class": `flex flex-col ${(_a2 = form.groupWrapClassName) != null ? _a2 : ""}`,
20923
20983
  "style": __spreadValues({}, form == null ? void 0 : form.groupWrapStyle)
20924
20984
  }, [createVNode("div", {
20925
20985
  "class": (_b = form.groupTitleClassName) != null ? _b : "",
@@ -20938,26 +20998,29 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20938
20998
  "model": formData.value,
20939
20999
  "rules": formRules.value,
20940
21000
  "class": "grid",
20941
- "ref": formRef
21001
+ "ref": formRef,
21002
+ "validate-on-rule-change": false
20942
21003
  }, attrs, {
20943
21004
  "style": __spreadValues({}, getFormStyle())
20944
- }), _isSlot(_slot = renderFormItem(formList)) ? _slot : {
21005
+ }), _isSlot(_slot = renderFormItem(formColumn.value)) ? _slot : {
20945
21006
  default: () => [_slot]
20946
21007
  })]);
20947
21008
  };
20948
21009
  const formValidate = () => __async(this, null, function* () {
20949
- return yield formRef.value.validate((valid) => valid ? true : false);
21010
+ if (!formRef.value) return Promise.resolve(false);
21011
+ return yield formRef.value.validate(() => Promise.resolve());
20950
21012
  });
20951
21013
  __expose({
20952
21014
  formData,
20953
- formValidate
21015
+ formValidate,
21016
+ formRef
20954
21017
  });
20955
21018
  return (_ctx, _cache) => {
20956
- return openBlock(), createBlock(resolveDynamicComponent(render(props)));
21019
+ return openBlock(), createBlock(resolveDynamicComponent(render2(props)));
20957
21020
  };
20958
21021
  }
20959
21022
  }));
20960
- const index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-91a038d9"]]);
21023
+ const index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-2435d575"]]);
20961
21024
  let versionKey, curVersion, updateApp;
20962
21025
  const updateSysVersion = () => {
20963
21026
  localStorage.setItem(versionKey, curVersion);
@@ -21064,6 +21127,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
21064
21127
  },
21065
21128
  emits: ["update:fileObsUrl", "getFile"],
21066
21129
  setup(__props, {
21130
+ expose: __expose,
21067
21131
  emit: __emit
21068
21132
  }) {
21069
21133
  const attrs = useAttrs();
@@ -21071,6 +21135,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
21071
21135
  const fileList = ref([]);
21072
21136
  const props = __props;
21073
21137
  const fileObsUrl = ref("");
21138
+ const upload = ref();
21074
21139
  const emit = __emit;
21075
21140
  const uploadFile = (_0) => __async(this, [_0], function* ({
21076
21141
  file
@@ -21086,7 +21151,16 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
21086
21151
  fileObsUrl.value = data.fileUrl;
21087
21152
  emit("update:fileObsUrl", fileObsUrl.value);
21088
21153
  });
21089
- const render = (props2) => {
21154
+ const onExceed = (files) => {
21155
+ upload.value.clearFiles();
21156
+ const file = files[0];
21157
+ file.uid = genFileId();
21158
+ upload.value.handleStart(file);
21159
+ };
21160
+ __expose({
21161
+ upload
21162
+ });
21163
+ const render2 = (props2) => {
21090
21164
  const defaultTrigger = () => {
21091
21165
  return createVNode(resolveComponent("el-button"), null, {
21092
21166
  default: () => {
@@ -21096,10 +21170,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
21096
21170
  });
21097
21171
  };
21098
21172
  return createVNode(Fragment, null, [createVNode(resolveComponent("el-upload"), mergeProps({
21173
+ "ref": "upload",
21099
21174
  "class": "w-full h-full",
21100
21175
  "http-request": uploadFile,
21101
21176
  "file-list": fileList.value
21102
- }, attrs), {
21177
+ }, attrs, {
21178
+ "on-exceed": onExceed
21179
+ }), {
21103
21180
  trigger: () => {
21104
21181
  return (props2 == null ? void 0 : props2.triggerRender) ? props2 == null ? void 0 : props2.triggerRender(fileObsUrl.value) : slots["trigger"] ? slots["trigger"]() : defaultTrigger();
21105
21182
  },
@@ -21111,7 +21188,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
21111
21188
  })]);
21112
21189
  };
21113
21190
  return (_ctx, _cache) => {
21114
- return openBlock(), createBlock(resolveDynamicComponent(render(props)), {
21191
+ return openBlock(), createBlock(resolveDynamicComponent(render2(props)), {
21115
21192
  "model-value": fileObsUrl.value
21116
21193
  }, null, 8, ["model-value"]);
21117
21194
  };
Binary file