@fecp/designer 5.5.119 → 5.5.121

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 (115) hide show
  1. package/es/designer/package.json.mjs +1 -1
  2. package/es/designer/src/packages/dataSource/index.vue.mjs +3 -3
  3. package/es/designer/src/packages/dialog/index.vue2.mjs +15 -15
  4. package/es/designer/src/packages/dialog/useDialogDialog.mjs +1 -1
  5. package/es/designer/src/packages/dialogGlobal/index.vue2.mjs +15 -16
  6. package/es/designer/src/packages/dialogGlobal/useDialogGlobalDialog.mjs +1 -1
  7. package/es/designer/src/packages/event/pageEvent.vue.mjs +1 -1
  8. package/es/designer/src/packages/form/index.vue.mjs +2 -2
  9. package/es/designer/src/packages/form/property/widgets.vue.mjs +2 -2
  10. package/es/designer.css +505 -415
  11. package/es/packages/mobile/index.mjs +2 -0
  12. package/es/packages/mobile/src/api/index.mjs +1 -1
  13. package/es/packages/mobile/src/assets/images/baseRate.png.mjs +1 -1
  14. package/es/packages/mobile/src/assets/images/home-bg.png.mjs +1 -1
  15. package/es/packages/mobile/src/assets/images/rentCalc.png.mjs +1 -1
  16. package/es/packages/mobile/src/assets/images/user.png.mjs +4 -0
  17. package/es/packages/mobile/src/components/all.mjs +2 -0
  18. package/es/packages/mobile/src/components/base/card/Card.vue.mjs +2 -2
  19. package/es/packages/mobile/src/components/custom/appDetail/AppDetail.vue.mjs +62 -44
  20. package/es/packages/mobile/src/components/custom/appTimeLine/AppTimeLine.vue.mjs +2 -2
  21. package/es/packages/mobile/src/components/custom/approvalBar/ApprovalBar.vue.mjs +128 -67
  22. package/es/packages/mobile/src/components/custom/approvalList/ApprovalList.vue.mjs +5 -5
  23. package/es/packages/mobile/src/components/custom/customCode/CustomCode.vue.mjs +60 -0
  24. package/es/packages/mobile/src/components/custom/customCode/index.mjs +10 -0
  25. package/es/packages/mobile/src/components/custom/document/Document.vue.mjs +2 -2
  26. package/es/packages/mobile/src/components/custom/userSelect/UserSelect.vue.mjs +2 -2
  27. package/es/packages/mobile/src/components/dataDisplay/cardList/CardList.vue.mjs +187 -7
  28. package/es/packages/mobile/src/components/dataDisplay/dataStat/DataStat.vue.mjs +2 -2
  29. package/es/packages/mobile/src/components/dataDisplay/mine/Mine.vue.mjs +33 -9
  30. package/es/packages/mobile/src/components/dataDisplay/rentCalcResult/RentCalcResult.vue.mjs +39 -79
  31. package/es/packages/mobile/src/components/feedback/quickFilter/QuickFilter.vue.mjs +10 -2
  32. package/es/packages/mobile/src/components/form/field/Field.vue.mjs +167 -32
  33. package/es/packages/mobile/src/components/form/fieldArea/FieldArea.vue.mjs +3 -2
  34. package/es/packages/mobile/src/components/form/fieldCalendarPicker/FieldCalendarPicker.vue.mjs +13 -15
  35. package/es/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.mjs +10 -10
  36. package/es/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.mjs +7 -23
  37. package/es/packages/mobile/src/components/form/fieldDatePicker/FieldDatePicker.vue.mjs +14 -26
  38. package/es/packages/mobile/src/components/form/fieldDateTimePicker/FieldDateTimePicker.vue.mjs +14 -15
  39. package/es/packages/mobile/src/components/form/fieldIndustry/FieldIndustry.vue.mjs +6 -19
  40. package/es/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.mjs +9 -25
  41. package/es/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.mjs +8 -24
  42. package/es/packages/mobile/src/components/form/search/Search.vue.mjs +15 -6
  43. package/es/packages/mobile/src/components/form/uploader/Uploader.vue.mjs +2 -2
  44. package/es/packages/mobile/src/components/navigation/tabbar/Tabbar.vue.mjs +9 -5
  45. package/es/packages/mobile/src/components/navigation/tabs/Tabs.vue.mjs +58 -25
  46. package/es/packages/mobile/src/index.vue.mjs +21 -4
  47. package/es/packages/mobile/src/page.vue.mjs +342 -138
  48. package/es/packages/mobile/src/utils/common.mjs +21 -0
  49. package/es/packages/mobile/src/utils/datasource.mjs +3 -3
  50. package/es/packages/mobile/src/utils/eventFlow/actionHandlers.mjs +35 -22
  51. package/es/packages/mobile/src/utils/formatterUtil.mjs +4 -24
  52. package/es/packages/mobile/src/utils/formulajs/calculate.mjs +11 -5
  53. package/es/packages/mobile/src/utils/optionUtil.mjs +3 -28
  54. package/es/packages/mobile/src/utils/pageHistory.mjs +16 -0
  55. package/es/packages/mobile/src/utils/validation.mjs +129 -0
  56. package/es/packages/vue/src/components/forms/number/Number.vue.mjs +3 -2
  57. package/es/packages/vue/src/components/table/TableColumn.vue.mjs +12 -8
  58. package/lib/designer/package.json.js +1 -1
  59. package/lib/designer/src/packages/dataSource/index.vue.js +3 -3
  60. package/lib/designer/src/packages/dialog/index.vue2.js +15 -15
  61. package/lib/designer/src/packages/dialog/useDialogDialog.js +1 -1
  62. package/lib/designer/src/packages/dialogGlobal/index.vue2.js +15 -16
  63. package/lib/designer/src/packages/dialogGlobal/useDialogGlobalDialog.js +1 -1
  64. package/lib/designer/src/packages/event/pageEvent.vue.js +1 -1
  65. package/lib/designer/src/packages/form/index.vue.js +2 -2
  66. package/lib/designer/src/packages/form/property/widgets.vue.js +2 -2
  67. package/lib/designer.css +505 -415
  68. package/lib/packages/mobile/index.js +4 -2
  69. package/lib/packages/mobile/src/api/index.js +1 -1
  70. package/lib/packages/mobile/src/assets/images/baseRate.png.js +1 -1
  71. package/lib/packages/mobile/src/assets/images/home-bg.png.js +1 -1
  72. package/lib/packages/mobile/src/assets/images/rentCalc.png.js +1 -1
  73. package/lib/packages/mobile/src/assets/images/user.png.js +4 -0
  74. package/lib/packages/mobile/src/components/all.js +2 -0
  75. package/lib/packages/mobile/src/components/base/card/Card.vue.js +2 -2
  76. package/lib/packages/mobile/src/components/custom/appDetail/AppDetail.vue.js +61 -43
  77. package/lib/packages/mobile/src/components/custom/appTimeLine/AppTimeLine.vue.js +2 -2
  78. package/lib/packages/mobile/src/components/custom/approvalBar/ApprovalBar.vue.js +131 -70
  79. package/lib/packages/mobile/src/components/custom/approvalList/ApprovalList.vue.js +5 -5
  80. package/lib/packages/mobile/src/components/custom/customCode/CustomCode.vue.js +60 -0
  81. package/lib/packages/mobile/src/components/custom/customCode/index.js +10 -0
  82. package/lib/packages/mobile/src/components/custom/document/Document.vue.js +2 -2
  83. package/lib/packages/mobile/src/components/custom/userSelect/UserSelect.vue.js +2 -2
  84. package/lib/packages/mobile/src/components/dataDisplay/cardList/CardList.vue.js +187 -7
  85. package/lib/packages/mobile/src/components/dataDisplay/dataStat/DataStat.vue.js +2 -2
  86. package/lib/packages/mobile/src/components/dataDisplay/mine/Mine.vue.js +38 -14
  87. package/lib/packages/mobile/src/components/dataDisplay/rentCalcResult/RentCalcResult.vue.js +39 -79
  88. package/lib/packages/mobile/src/components/feedback/quickFilter/QuickFilter.vue.js +10 -2
  89. package/lib/packages/mobile/src/components/form/field/Field.vue.js +165 -30
  90. package/lib/packages/mobile/src/components/form/fieldArea/FieldArea.vue.js +3 -2
  91. package/lib/packages/mobile/src/components/form/fieldCalendarPicker/FieldCalendarPicker.vue.js +13 -15
  92. package/lib/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.js +9 -9
  93. package/lib/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.js +6 -22
  94. package/lib/packages/mobile/src/components/form/fieldDatePicker/FieldDatePicker.vue.js +13 -25
  95. package/lib/packages/mobile/src/components/form/fieldDateTimePicker/FieldDateTimePicker.vue.js +13 -14
  96. package/lib/packages/mobile/src/components/form/fieldIndustry/FieldIndustry.vue.js +6 -19
  97. package/lib/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.js +8 -24
  98. package/lib/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.js +7 -23
  99. package/lib/packages/mobile/src/components/form/search/Search.vue.js +15 -6
  100. package/lib/packages/mobile/src/components/form/uploader/Uploader.vue.js +2 -2
  101. package/lib/packages/mobile/src/components/navigation/tabbar/Tabbar.vue.js +9 -5
  102. package/lib/packages/mobile/src/components/navigation/tabs/Tabs.vue.js +61 -28
  103. package/lib/packages/mobile/src/index.vue.js +20 -3
  104. package/lib/packages/mobile/src/page.vue.js +341 -137
  105. package/lib/packages/mobile/src/utils/common.js +21 -0
  106. package/lib/packages/mobile/src/utils/datasource.js +3 -3
  107. package/lib/packages/mobile/src/utils/eventFlow/actionHandlers.js +35 -22
  108. package/lib/packages/mobile/src/utils/formatterUtil.js +3 -23
  109. package/lib/packages/mobile/src/utils/formulajs/calculate.js +11 -5
  110. package/lib/packages/mobile/src/utils/optionUtil.js +2 -27
  111. package/lib/packages/mobile/src/utils/pageHistory.js +16 -0
  112. package/lib/packages/mobile/src/utils/validation.js +129 -0
  113. package/lib/packages/vue/src/components/forms/number/Number.vue.js +3 -2
  114. package/lib/packages/vue/src/components/table/TableColumn.vue.js +12 -8
  115. package/package.json +1 -1
@@ -1,17 +1,16 @@
1
- import { ref, getCurrentInstance, computed, watch, onMounted, nextTick, provide, resolveComponent, createElementBlock, openBlock, Fragment, createBlock, createCommentVNode, createElementVNode, normalizeProps, mergeProps, unref, normalizeStyle, createVNode, guardReactiveProps, isRef, withCtx, resolveDynamicComponent } from "vue";
1
+ /* empty css */
2
+ import { ref, getCurrentInstance, computed, watch, onMounted, nextTick, provide, resolveComponent, createElementBlock, openBlock, Fragment, createBlock, createCommentVNode, createVNode, normalizeProps, mergeProps, withCtx, unref, normalizeStyle, guardReactiveProps, isRef, createElementVNode, resolveDynamicComponent } from "vue";
2
3
  import homeBg from "./assets/images/home-bg.png.mjs";
3
4
  import "../../../node_modules/grid-layout-plus/es/index.mjs";
4
5
  import * as all from "./components/all.mjs";
5
6
  import { pageHistory } from "./utils/pageHistory.mjs";
6
7
  import { usePageEvents } from "./composables/usePageEvents.mjs";
7
- import hooks from "../../../node_modules/moment/dist/moment.mjs";
8
+ import "../../../node_modules/moment/dist/moment.mjs";
9
+ import { createDataSource } from "./utils/datasource.mjs";
8
10
  import { parseSingleParamValue } from "./utils/parseRouteParams.mjs";
9
- /* empty css */
10
- /* empty css */
11
- /* empty css */
12
- /* empty css */
13
11
  import { cloneDeep, isEqual } from "./utils/common.mjs";
14
12
  import "./utils/eventBus.mjs";
13
+ /* empty css */
15
14
  /* empty css */
16
15
  /* empty css */
17
16
  /* empty css */
@@ -19,11 +18,13 @@ import "./utils/eventBus.mjs";
19
18
  import { useEventFlow } from "./utils/eventFlow/eventFlowHandler.mjs";
20
19
  import { checkFilterMatch, checkFieldInFilterConfig, checkFieldInResultConfig } from "./utils/parseFilterConfig.mjs";
21
20
  import { calculate } from "./utils/formulajs/calculate.mjs";
21
+ import { generateFieldRules } from "./utils/validation.mjs";
22
22
  /* empty css */
23
23
  import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
24
24
  import De from "../../../node_modules/grid-layout-plus/es/components/grid-layout.vue.mjs";
25
- const _hoisted_1 = { class: "grid-wrapper no-scrollbar" };
26
- const _hoisted_2 = { class: "component-content" };
25
+ import { Form } from "../../../node_modules/vant/es/form/index.mjs";
26
+ import { showToast } from "../../../node_modules/vant/es/toast/function-call.mjs";
27
+ const _hoisted_1 = { class: "component-content" };
27
28
  const colNum = 24;
28
29
  const rowHeight = 10;
29
30
  const _sfc_main = {
@@ -39,18 +40,26 @@ const _sfc_main = {
39
40
  params: {
40
41
  type: Object,
41
42
  default: {}
43
+ },
44
+ initSearchData: {
45
+ type: Object,
46
+ default: {}
42
47
  }
43
48
  },
44
- setup(__props, { expose: __expose }) {
49
+ emits: ["layoutDataHeight"],
50
+ setup(__props, { expose: __expose, emit: __emit }) {
45
51
  var _a;
46
52
  const props = __props;
53
+ const emit = __emit;
47
54
  const configLoading = ref(true);
48
55
  const instance = getCurrentInstance();
49
56
  const ctx = instance.proxy;
50
57
  const formData = ref(props.params);
58
+ const formRules = ref({});
51
59
  function getComp(type) {
52
60
  return all[type];
53
61
  }
62
+ const formRef = ref();
54
63
  const gridLayout = ref();
55
64
  const tabbarActive = ref(0);
56
65
  const childPage = ref(null);
@@ -94,7 +103,18 @@ const _sfc_main = {
94
103
  })) || [];
95
104
  }
96
105
  const loadFormData = (state) => {
106
+ var _a2;
97
107
  const defaultData = { ...props.params };
108
+ if (fieldsData.value) {
109
+ (_a2 = fieldsData.value) == null ? void 0 : _a2.forEach((component) => {
110
+ if (component.fieldName) {
111
+ let defaultValue = component.defaultValue || null;
112
+ if (defaultValue) {
113
+ defaultData[component.fieldName] = defaultValue;
114
+ }
115
+ }
116
+ });
117
+ }
98
118
  if (hiddenFields.value && hiddenFields.value.length > 0) {
99
119
  hiddenFields.value.forEach((field) => {
100
120
  if (field.fieldName) {
@@ -116,44 +136,197 @@ const _sfc_main = {
116
136
  formData.value = { ...defaultData };
117
137
  console.log("初始化赋值", formData.value);
118
138
  };
139
+ const initFormRule = () => {
140
+ var _a2;
141
+ const rules = {};
142
+ if (fieldsData.value) {
143
+ (_a2 = fieldsData.value) == null ? void 0 : _a2.forEach((component) => {
144
+ if (component.fieldName) {
145
+ const fieldRules = generateFieldRules(component, formData, [
146
+ ...fieldsData.value,
147
+ ...hiddenFields.value
148
+ ]);
149
+ if (fieldRules.length > 0) {
150
+ rules[component.fieldName] = fieldRules;
151
+ }
152
+ }
153
+ });
154
+ }
155
+ formRules.value = rules;
156
+ };
119
157
  const prevFormData = ref({});
120
158
  let linkaged = false;
159
+ let isDesigner = false;
160
+ const dataSourceOptions = ref({});
161
+ const dictionaryOptions = ref({});
121
162
  onMounted(async () => {
163
+ var _a2, _b;
122
164
  prevFormData.value = {};
123
165
  linkaged = false;
124
166
  loadFormData();
125
- const pageEvents = usePageEvents(() => ({
126
- pageEventConfig: props.parentPage.pageEventConfig,
127
- fields: [...fieldsData.value, ...hiddenFields.value],
128
- instance,
129
- formData: formData.value,
130
- localConfig: props.parentPage,
131
- components: {
132
- form: ctx
167
+ try {
168
+ const uid = (_b = (_a2 = formRef.value) == null ? void 0 : _a2.$el) == null ? void 0 : _b.closest(".device-content");
169
+ if (uid) {
170
+ isDesigner = true;
133
171
  }
134
- }));
135
- if (pageEvents) {
136
- pageEvents.handleBeforeUnmount();
137
- pageEvents.handleUnmounted();
138
- if (props.parentPage.pageEventConfig) {
139
- const onCreatedEvent = props.parentPage.pageEventConfig.find(
140
- (e) => e.name === "onCreated"
141
- );
142
- if (onCreatedEvent) {
143
- console.log("🚀 页面 onCreated 事件触发");
144
- try {
145
- await pageEvents.executeEvent("onCreated");
146
- } catch (error) {
172
+ } catch (error) {
173
+ }
174
+ if (!isDesigner) {
175
+ const pageEvents = usePageEvents(() => ({
176
+ pageEventConfig: props.parentPage.pageEventConfig,
177
+ fields: [...fieldsData.value, ...hiddenFields.value],
178
+ instance,
179
+ formData: formData.value,
180
+ localConfig: props.parentPage,
181
+ components: {
182
+ form: ctx
183
+ }
184
+ }));
185
+ if (pageEvents) {
186
+ pageEvents.handleBeforeUnmount();
187
+ pageEvents.handleUnmounted();
188
+ if (props.parentPage.pageEventConfig) {
189
+ const onCreatedEvent = props.parentPage.pageEventConfig.find(
190
+ (e) => e.name === "onCreated"
191
+ );
192
+ if (onCreatedEvent) {
193
+ console.log("🚀 页面 onCreated 事件触发");
194
+ try {
195
+ await pageEvents.executeEvent("onCreated");
196
+ } catch (error) {
197
+ }
147
198
  }
148
199
  }
149
200
  }
150
201
  }
151
202
  loadEventFlow();
203
+ await initParmDic();
204
+ mergeOptionsToFields();
152
205
  initGridLayoutDataConfig();
206
+ initFormRule();
153
207
  initLinkage();
154
208
  configLoading.value = false;
155
209
  });
210
+ const initParmDic = async () => {
211
+ var _a2, _b;
212
+ const fields = fieldsData.value || [];
213
+ const fieldDataSources = /* @__PURE__ */ new Set();
214
+ const dictionaryKeys = /* @__PURE__ */ new Set();
215
+ for (const component of fields) {
216
+ const fieldType = component.fieldType;
217
+ if ((fieldType === "picker" || fieldType === "radio" || fieldType === "checkbox" || fieldType === "cascader") && component.optionConfig) {
218
+ const { optionSource, dataSourceValue, dictionaryValue } = component.optionConfig;
219
+ if (optionSource === "dataSource" && dataSourceValue) {
220
+ fieldDataSources.add(dataSourceValue);
221
+ } else if (optionSource === "dictionary" && dictionaryValue) {
222
+ dictionaryKeys.add(dictionaryValue);
223
+ }
224
+ }
225
+ }
226
+ for (const dataSourceId of fieldDataSources) {
227
+ if (dataSourceOptions.value[dataSourceId]) continue;
228
+ try {
229
+ const dsManager = createDataSource({
230
+ http: ctx.$http,
231
+ dataSources: currentPage.value.dataSources,
232
+ currentDataSourceId: dataSourceId,
233
+ pagination: false,
234
+ data: formData.value,
235
+ fields: [...fieldsData.value, ...hiddenFields.value]
236
+ });
237
+ const data = await dsManager.fetch();
238
+ let options = [];
239
+ if (Array.isArray(data)) {
240
+ options = data;
241
+ } else if (typeof data === "object") {
242
+ options = Array.isArray(data.data) ? data.data : ((_a2 = data.data) == null ? void 0 : _a2.records) || ((_b = data.data) == null ? void 0 : _b.list) || [];
243
+ }
244
+ dataSourceOptions.value[dataSourceId] = options;
245
+ dsManager.destroy();
246
+ } catch (error) {
247
+ console.error(`Failed to load data source ${dataSourceId}:`, error);
248
+ }
249
+ }
250
+ if (dictionaryKeys.size > 0) {
251
+ try {
252
+ const keyName = Array.from(dictionaryKeys).join(",");
253
+ const response = await ctx.$http.postFormMobile(
254
+ "/base-server/parm/sysParmDic/getDicListByKey",
255
+ {
256
+ keyName
257
+ },
258
+ true
259
+ );
260
+ const dictionaryData = response;
261
+ if (typeof dictionaryData === "object") {
262
+ Object.keys(dictionaryData).forEach((dictKey) => {
263
+ if (dictionaryKeys.has(dictKey)) {
264
+ const dictItems = dictionaryData[dictKey];
265
+ if (Array.isArray(dictItems)) {
266
+ dictionaryOptions.value[dictKey] = dictItems;
267
+ }
268
+ }
269
+ });
270
+ }
271
+ } catch (error) {
272
+ console.error("Failed to load dictionary data:", error);
273
+ }
274
+ }
275
+ };
276
+ const mergeOptionsToFields = () => {
277
+ if (fieldsData.value) {
278
+ fieldsData.value.forEach((component) => {
279
+ if (!component.optionConfig) return;
280
+ const {
281
+ optionSource,
282
+ dataSourceValue,
283
+ dictionaryValue,
284
+ displayField,
285
+ valueField,
286
+ idField,
287
+ pidField
288
+ } = component.optionConfig;
289
+ if (optionSource === "dataSource" && dataSourceOptions.value[dataSourceValue]) {
290
+ const rawOptions = dataSourceOptions.value[dataSourceValue];
291
+ const labelField = displayField || "label";
292
+ const keyField = valueField || "value";
293
+ component.optionConfig.options = rawOptions.map((item) => ({
294
+ label: item[labelField],
295
+ value: item[keyField],
296
+ disabled: item.disabled || false,
297
+ ...item
298
+ }));
299
+ } else if (optionSource === "dictionary" && dictionaryOptions.value[dictionaryValue]) {
300
+ const rawOptions = dictionaryOptions.value[dictionaryValue];
301
+ const labelField = "optName";
302
+ const keyField = "optCode";
303
+ component.optionConfig.options = rawOptions.map((item) => ({
304
+ label: item[labelField],
305
+ value: item[keyField],
306
+ disabled: item.disabled || false
307
+ }));
308
+ } else if (optionSource === "custom") {
309
+ component.optionConfig.options = component.optionConfig.options || [];
310
+ }
311
+ });
312
+ }
313
+ };
156
314
  const gridLayoutFieldsData = ref([]);
315
+ const gridWrapperHeight = ref(null);
316
+ watch(
317
+ () => gridLayoutFieldsData,
318
+ (val) => {
319
+ if (Array.isArray(val.value)) {
320
+ const maxY = val.value.reduce(
321
+ (max, item) => Math.max(max, item.y + item.h),
322
+ 0
323
+ );
324
+ gridWrapperHeight.value = maxY * rowHeight;
325
+ emit("layoutDataHeight", gridWrapperHeight.value);
326
+ }
327
+ },
328
+ { immediate: true, deep: true }
329
+ );
157
330
  const oriGridLayoutData = ref([]);
158
331
  function initGridLayoutDataConfig() {
159
332
  if (!Array.isArray(props.parentPage.layoutData)) {
@@ -169,7 +342,7 @@ const _sfc_main = {
169
342
  }
170
343
  return item;
171
344
  }) || [];
172
- oriGridLayoutData.value = gridLayoutData;
345
+ oriGridLayoutData.value = sortLayoutItems(gridLayoutData);
173
346
  }
174
347
  function initLinkage() {
175
348
  if (!Array.isArray(props.parentPage.layoutData)) {
@@ -259,6 +432,16 @@ const _sfc_main = {
259
432
  });
260
433
  }
261
434
  });
435
+ const rules = {};
436
+ updatedLayoutData.forEach(({ component }) => {
437
+ if (component.props.fieldName) {
438
+ const fieldRules = generateFieldRules(component.props, formData, fields);
439
+ if (fieldRules.length > 0) {
440
+ rules[component.props.fieldName] = fieldRules;
441
+ }
442
+ }
443
+ });
444
+ formRules.value = rules;
262
445
  relevantConfigs.disabled.forEach((item) => {
263
446
  const dataLinkFieldList = item.dataLinkFieldList || [];
264
447
  dataLinkFieldList.forEach((fieldId) => {
@@ -394,20 +577,6 @@ const _sfc_main = {
394
577
  });
395
578
  handleEvent.value = createHandleEvent;
396
579
  }
397
- const valueFormatMap = {
398
- date: "YYYYMMDD",
399
- week: "YYYYMMDD",
400
- month: "YYYYMM",
401
- year: "YYYY",
402
- datetime: "YYYYMMDDHHmmss"
403
- };
404
- const formValueFormatMap = {
405
- date: "YYYY/MM/DD",
406
- week: "YYYY/MM/DD",
407
- month: "YYYY/MM",
408
- year: "YYYY",
409
- datetime: "YYYY/MM/DD HH:mm:ss"
410
- };
411
580
  const getFormData = () => {
412
581
  const result = { ...formData.value };
413
582
  const processField = (field) => {
@@ -422,27 +591,6 @@ const _sfc_main = {
422
591
  if (Array.isArray(value)) {
423
592
  result[fieldName] = value.join(splitStr);
424
593
  }
425
- } else if (fieldName && fieldType === "date" && value) {
426
- const dateValueType = field.dateValueType;
427
- const valueFormat = valueFormatMap[field.dateType] || "YYYYMMDD";
428
- const formValueFormat = formValueFormatMap[field.dateType] || "YYYY/MM/DD";
429
- switch (dateValueType) {
430
- case "date":
431
- result[fieldName] = hooks(value, formValueFormat).toDate();
432
- break;
433
- case "timestamp":
434
- result[fieldName] = hooks(value, formValueFormat).valueOf();
435
- break;
436
- case "string":
437
- default:
438
- result[fieldName] = hooks(value, formValueFormat).format(
439
- valueFormat
440
- );
441
- break;
442
- }
443
- }
444
- if (fieldType != "number" && !result[fieldName]) {
445
- result[fieldName] = "";
446
594
  }
447
595
  };
448
596
  if (fieldsData.value) {
@@ -457,6 +605,26 @@ const _sfc_main = {
457
605
  }
458
606
  return result;
459
607
  };
608
+ const validate = () => {
609
+ var _a2;
610
+ return (_a2 = formRef.value) == null ? void 0 : _a2.validate().then(() => getFormData()).catch((errors) => {
611
+ nextTick(() => {
612
+ const firstError = document.querySelector(".van-field__error-message");
613
+ if (firstError) {
614
+ showToast({
615
+ message: firstError.innerHTML,
616
+ icon: "warning-o",
617
+ duration: 2e3
618
+ });
619
+ firstError.scrollIntoView({
620
+ behavior: "smooth",
621
+ block: "center"
622
+ });
623
+ }
624
+ });
625
+ throw errors;
626
+ });
627
+ };
460
628
  const setFormData = (data) => {
461
629
  const processedData = { ...data };
462
630
  const processField = (field) => {
@@ -466,11 +634,8 @@ const _sfc_main = {
466
634
  return;
467
635
  }
468
636
  const value = processedData[fieldName];
469
- if (fieldName && (fieldType === "checkbox" || fieldType === "multipleSelection" || fieldType === "cascader" || fieldType === "area" || fieldType === "industry")) {
637
+ if (fieldName && (fieldType === "checkbox" || fieldType === "multipleSelection" || fieldType === "cascader")) {
470
638
  let splitStr = "|";
471
- if (fieldType === "cascader" || fieldType === "area" || fieldType === "industry") {
472
- splitStr = ",";
473
- }
474
639
  if (typeof value === "string" && value.includes(splitStr)) {
475
640
  processedData[fieldName] = value.split(splitStr);
476
641
  } else if (typeof value === "string" && value !== "") {
@@ -484,12 +649,6 @@ const _sfc_main = {
484
649
  }
485
650
  return item;
486
651
  });
487
- } else if (fieldName && fieldType === "date" && value) {
488
- const valueFormat = valueFormatMap[field.dateType] || "YYYYMMDD";
489
- const formValueFormat = formValueFormatMap[field.dateType] || "YYYY/MM/DD";
490
- processedData[fieldName] = hooks(value, valueFormat).format(
491
- formValueFormat
492
- );
493
652
  }
494
653
  };
495
654
  if (fieldsData.value) {
@@ -504,11 +663,40 @@ const _sfc_main = {
504
663
  }
505
664
  formData.value = { ...formData.value, ...processedData };
506
665
  };
666
+ const compRefs = {};
667
+ const setCompRef = (id, el) => {
668
+ if (el) compRefs[id] = el;
669
+ };
670
+ function onSearch(filter) {
671
+ Object.values(compRefs).forEach((comp) => {
672
+ if (comp == null ? void 0 : comp.onSearch) {
673
+ comp.onSearch(filter);
674
+ }
675
+ });
676
+ }
677
+ watch(
678
+ () => props.initSearchData,
679
+ () => {
680
+ onSearch(props.initSearchData);
681
+ }
682
+ );
683
+ function refreshGridLayoutItemHeight(compId, height) {
684
+ var _a2;
685
+ gridLayoutFieldsData.value.forEach((item) => {
686
+ const id = item.component.id;
687
+ if (compId == id) {
688
+ item.h = height / 10;
689
+ }
690
+ });
691
+ (_a2 = gridLayout == null ? void 0 : gridLayout.value) == null ? void 0 : _a2.resizeEvent();
692
+ }
507
693
  provide("handleEvent", handleEvent);
508
694
  provide("formData", formData);
695
+ provide("refreshGridLayoutItemHeight", refreshGridLayoutItemHeight);
509
696
  __expose({
510
697
  setFormData,
511
- getFormData
698
+ getFormData,
699
+ validate
512
700
  });
513
701
  return (_ctx, _cache) => {
514
702
  const _component_FecMobileNavBar = resolveComponent("FecMobileNavBar");
@@ -521,70 +709,86 @@ const _sfc_main = {
521
709
  const _component_FecMobileApprovalList = resolveComponent("FecMobileApprovalList");
522
710
  const _component_FecMobileRentCalcResult = resolveComponent("FecMobileRentCalcResult");
523
711
  const _component_FecMobileMine = resolveComponent("FecMobileMine");
712
+ const _component_van_form = Form;
524
713
  const _component_FecMobileTabbar = resolveComponent("FecMobileTabbar");
525
714
  const _component_FecMobileActionBar = resolveComponent("FecMobileActionBar");
526
715
  return openBlock(), createElementBlock(Fragment, null, [
527
716
  __props.parentPage.isNavBar ? (openBlock(), createBlock(_component_FecMobileNavBar, normalizeProps(mergeProps({ key: 0 }, __props.parentPage.navBarConfig)), null, 16)) : createCommentVNode("", true),
528
- createElementVNode("div", _hoisted_1, [
529
- __props.parentPage.footerType == "tabbar" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
530
- unref(childPage) ? (openBlock(), createBlock(_component_page, {
531
- key: 0,
532
- parentPage: unref(childPage)
533
- }, null, 8, ["parentPage"])) : createCommentVNode("", true)
534
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
535
- __props.parentPage.type == "home" ? (openBlock(), createElementBlock("div", {
536
- key: 0,
537
- class: "home-page",
538
- style: normalizeStyle({
539
- backgroundImage: `url(${unref(homeBg)})`,
540
- backgroundRepeat: "no-repeat",
541
- backgroundSize: "100%",
542
- backgroundPosition: "center -20px",
543
- backgroundColor: "#f7f8fa",
544
- height: "100%"
545
- })
546
- }, [
547
- createVNode(_component_FecMobileHomeHeader, normalizeProps(guardReactiveProps(__props.parentPage.layoutData.homeHeader)), null, 16),
548
- createVNode(_component_FecMobileMenuGrid, normalizeProps(guardReactiveProps(__props.parentPage.layoutData.menuGridProps)), null, 16),
549
- createVNode(_component_FecMobileHomeTools, normalizeProps(guardReactiveProps(__props.parentPage.layoutData.homeTools)), null, 16),
550
- createVNode(_component_FecMobileDataStat)
551
- ], 4)) : __props.parentPage.type == "approval" ? (openBlock(), createBlock(_component_FecMobileAppDetail, mergeProps({ key: 1 }, __props.parentPage.layoutData.appDetailProps, {
552
- actionBar: __props.parentPage.layoutData.actionBar,
553
- params: __props.params
554
- }), null, 16, ["actionBar", "params"])) : __props.parentPage.type == "flowList" ? (openBlock(), createBlock(_component_FecMobileApprovalList, normalizeProps(mergeProps({ key: 2 }, __props.parentPage.layoutData.approvalListProps)), null, 16)) : __props.parentPage.type == "rentCalcResult" ? (openBlock(), createBlock(_component_FecMobileRentCalcResult, {
555
- key: 3,
556
- params: __props.params
557
- }, null, 8, ["params"])) : __props.parentPage.type == "mine" ? (openBlock(), createBlock(_component_FecMobileMine, { key: 4 })) : (openBlock(), createBlock(unref(De), {
558
- key: 5,
559
- ref_key: "gridLayout",
560
- ref: gridLayout,
561
- layout: unref(gridLayoutFieldsData),
562
- "onUpdate:layout": _cache[0] || (_cache[0] = ($event) => isRef(gridLayoutFieldsData) ? gridLayoutFieldsData.value = $event : null),
563
- "row-height": rowHeight,
564
- margin: [0, 0],
565
- "col-num": colNum,
566
- "use-css-transforms": false,
567
- "is-draggable": false,
568
- "is-resizable": false,
569
- style: { "height": "100%", "width": "100%" }
570
- }, {
571
- item: withCtx(({ item: { component } }) => [
572
- createElementVNode("div", _hoisted_2, [
573
- (openBlock(), createBlock(resolveDynamicComponent(getComp(component.fieldType)), mergeProps(component.props, {
574
- modelValue: unref(formData)[component.props.fieldName],
575
- "onUpdate:modelValue": ($event) => unref(formData)[component.props.fieldName] = $event,
576
- dataSources: unref(currentPage).dataSources,
577
- formData: unref(formData),
578
- compId: component.id,
579
- fields: [...unref(fieldsData), ...unref(hiddenFields)],
580
- params: __props.params
581
- }), null, 16, ["modelValue", "onUpdate:modelValue", "dataSources", "formData", "compId", "fields", "params"]))
582
- ])
583
- ]),
584
- _: 1
585
- }, 8, ["layout"]))
586
- ], 64))
587
- ]),
717
+ createVNode(_component_van_form, {
718
+ class: "grid-wrapper no-scrollbar",
719
+ ref_key: "formRef",
720
+ ref: formRef,
721
+ "scroll-to-error": "",
722
+ "submit-on-enter": false,
723
+ "show-error": "",
724
+ "scroll-to-error-position": "center"
725
+ }, {
726
+ default: withCtx(() => [
727
+ __props.parentPage.footerType == "tabbar" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
728
+ unref(childPage) ? (openBlock(), createBlock(_component_page, {
729
+ key: 0,
730
+ parentPage: unref(childPage)
731
+ }, null, 8, ["parentPage"])) : createCommentVNode("", true)
732
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
733
+ __props.parentPage.type == "home" ? (openBlock(), createElementBlock("div", {
734
+ key: 0,
735
+ class: "home-page",
736
+ style: normalizeStyle({
737
+ backgroundImage: `url(${unref(homeBg)})`,
738
+ backgroundRepeat: "no-repeat",
739
+ backgroundSize: "100%",
740
+ backgroundPosition: "center -20px",
741
+ backgroundColor: "#f7f8fa",
742
+ height: "100%"
743
+ })
744
+ }, [
745
+ createVNode(_component_FecMobileHomeHeader, normalizeProps(guardReactiveProps(__props.parentPage.layoutData.homeHeader)), null, 16),
746
+ createVNode(_component_FecMobileMenuGrid, normalizeProps(guardReactiveProps(__props.parentPage.layoutData.menuGridProps)), null, 16),
747
+ createVNode(_component_FecMobileHomeTools, normalizeProps(guardReactiveProps(__props.parentPage.layoutData.homeTools)), null, 16),
748
+ createVNode(_component_FecMobileDataStat)
749
+ ], 4)) : __props.parentPage.type == "approval" ? (openBlock(), createBlock(_component_FecMobileAppDetail, mergeProps({ key: 1 }, __props.parentPage.layoutData.appDetailProps, {
750
+ actionBar: __props.parentPage.layoutData.actionBar,
751
+ params: __props.params
752
+ }), null, 16, ["actionBar", "params"])) : __props.parentPage.type == "flowList" ? (openBlock(), createBlock(_component_FecMobileApprovalList, normalizeProps(mergeProps({ key: 2 }, __props.parentPage.layoutData.approvalListProps)), null, 16)) : __props.parentPage.type == "rentCalcResult" ? (openBlock(), createBlock(_component_FecMobileRentCalcResult, {
753
+ key: 3,
754
+ params: __props.params
755
+ }, null, 8, ["params"])) : __props.parentPage.type == "mine" ? (openBlock(), createBlock(_component_FecMobileMine, { key: 4 })) : (openBlock(), createBlock(unref(De), {
756
+ key: 5,
757
+ ref_key: "gridLayout",
758
+ ref: gridLayout,
759
+ layout: unref(gridLayoutFieldsData),
760
+ "onUpdate:layout": _cache[0] || (_cache[0] = ($event) => isRef(gridLayoutFieldsData) ? gridLayoutFieldsData.value = $event : null),
761
+ "row-height": rowHeight,
762
+ margin: [0, 0],
763
+ "col-num": colNum,
764
+ "use-css-transforms": false,
765
+ "is-draggable": false,
766
+ "is-resizable": false,
767
+ style: { "height": "100%", "width": "100%", "position": "relative" }
768
+ }, {
769
+ item: withCtx(({ item: { component } }) => [
770
+ createElementVNode("div", _hoisted_1, [
771
+ (openBlock(), createBlock(resolveDynamicComponent(getComp(component.fieldType)), mergeProps({
772
+ ref: (el) => setCompRef(component.id, el)
773
+ }, component.props, {
774
+ name: component.props.fieldName,
775
+ modelValue: unref(formData)[component.props.fieldName],
776
+ "onUpdate:modelValue": ($event) => unref(formData)[component.props.fieldName] = $event,
777
+ dataSources: unref(currentPage).dataSources,
778
+ formData: unref(formData),
779
+ compId: component.id,
780
+ fields: [...unref(fieldsData), ...unref(hiddenFields)],
781
+ params: __props.params,
782
+ rules: unref(formRules)[component.props.fieldName]
783
+ }), null, 16, ["name", "modelValue", "onUpdate:modelValue", "dataSources", "formData", "compId", "fields", "params", "rules"]))
784
+ ])
785
+ ]),
786
+ _: 1
787
+ }, 8, ["layout"]))
788
+ ], 64))
789
+ ]),
790
+ _: 1
791
+ }, 512),
588
792
  __props.parentPage.footerType == "tabbar" ? (openBlock(), createBlock(_component_FecMobileTabbar, mergeProps({
589
793
  key: 1,
590
794
  modelValue: unref(tabbarActive),
@@ -595,7 +799,7 @@ const _sfc_main = {
595
799
  };
596
800
  }
597
801
  };
598
- const MobilePage = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ce6e3f7e"]]);
802
+ const MobilePage = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-aa11f142"]]);
599
803
  export {
600
804
  MobilePage as default
601
805
  };
@@ -34,6 +34,26 @@ const findPageById = (pageList, pageId) => {
34
34
  if (item.children && item.children.length > 0) {
35
35
  const found = findPageById(item.children, pageId);
36
36
  if (found) {
37
+ if (item.type === "folder") {
38
+ return found;
39
+ }
40
+ return { ...found, parentPage: item };
41
+ }
42
+ }
43
+ }
44
+ return null;
45
+ };
46
+ const findPageByKey = (pageList, pageKey) => {
47
+ for (const item of pageList) {
48
+ if (item.path == pageKey) {
49
+ return item;
50
+ }
51
+ if (item.children && item.children.length > 0) {
52
+ const found = findPageByKey(item.children, pageKey);
53
+ if (found) {
54
+ if (item.type == "folder") {
55
+ return found;
56
+ }
37
57
  return { ...found, parentPage: item };
38
58
  }
39
59
  }
@@ -43,6 +63,7 @@ const findPageById = (pageList, pageId) => {
43
63
  export {
44
64
  cloneDeep,
45
65
  findPageById,
66
+ findPageByKey,
46
67
  isEqual,
47
68
  removeEmptyValues
48
69
  };