@fecp/designer 5.3.22 → 5.4.2

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 (39) hide show
  1. package/es/designer/package.json.mjs +1 -1
  2. package/es/designer/src/components/ParamsConfig.vue2.mjs +1 -1
  3. package/es/designer/src/components/ValueSelector.vue.mjs +191 -0
  4. package/es/designer/src/layout/aside/HiddenFieldDialog.vue.mjs +1 -1
  5. package/es/designer/src/packages/advancedFilter/ValueInput.vue2.mjs +1 -1
  6. package/es/designer/src/packages/dataLinkage/index.vue.mjs +1 -1
  7. package/es/designer/src/packages/dialogGlobal/index.vue.mjs +1 -1
  8. package/es/designer/src/packages/form/property/approvalHistory.vue.mjs +1 -1
  9. package/es/designer/src/packages/form/property/subForm.vue.mjs +1 -1
  10. package/es/designer/src/packages/prod/index.vue.mjs +1 -1
  11. package/es/designer/src/packages/table/aside/index.mjs +2 -1
  12. package/es/designer/src/packages/table/default.mjs +51 -53
  13. package/es/designer/src/packages/table/headerBtn.vue.mjs +1 -1
  14. package/es/designer/src/packages/table/index.vue.mjs +3 -1
  15. package/es/designer/src/packages/table/tableSummary.vue.mjs +112 -0
  16. package/es/designer.css +101 -78
  17. package/es/packages/vue/src/components/forms/form/Form.vue.mjs +2 -2
  18. package/es/packages/vue/src/components/table/Table.vue.mjs +130 -10
  19. package/es/packages/vue/src/components/table/TableColumn.vue.mjs +1 -1
  20. package/lib/designer/package.json.js +1 -1
  21. package/lib/designer/src/components/ParamsConfig.vue2.js +1 -1
  22. package/lib/designer/src/components/ValueSelector.vue.js +191 -0
  23. package/lib/designer/src/layout/aside/HiddenFieldDialog.vue.js +1 -1
  24. package/lib/designer/src/packages/advancedFilter/ValueInput.vue2.js +1 -1
  25. package/lib/designer/src/packages/dataLinkage/index.vue.js +1 -1
  26. package/lib/designer/src/packages/dialogGlobal/index.vue.js +1 -1
  27. package/lib/designer/src/packages/form/property/approvalHistory.vue.js +1 -1
  28. package/lib/designer/src/packages/form/property/subForm.vue.js +1 -1
  29. package/lib/designer/src/packages/prod/index.vue.js +1 -1
  30. package/lib/designer/src/packages/table/aside/index.js +2 -1
  31. package/lib/designer/src/packages/table/default.js +51 -53
  32. package/lib/designer/src/packages/table/headerBtn.vue.js +1 -1
  33. package/lib/designer/src/packages/table/index.vue.js +3 -1
  34. package/lib/designer/src/packages/table/tableSummary.vue.js +112 -0
  35. package/lib/designer.css +101 -78
  36. package/lib/packages/vue/src/components/forms/form/Form.vue.js +2 -2
  37. package/lib/packages/vue/src/components/table/Table.vue.js +130 -10
  38. package/lib/packages/vue/src/components/table/TableColumn.vue.js +1 -1
  39. package/package.json +1 -1
@@ -175,7 +175,93 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
175
175
  }
176
176
  return localConfig.value.height || 500;
177
177
  });
178
- const initDataSourceManager = () => {
178
+ const summaryConfig = vue.computed(() => {
179
+ return localConfig.value.summaryConfig || {
180
+ enabled: false,
181
+ mode: "current",
182
+ summaryFields: []
183
+ };
184
+ });
185
+ const allSummaryData = vue.ref({});
186
+ const footerData = vue.computed(() => {
187
+ const config = summaryConfig.value;
188
+ const { enabled, mode, summaryFields = [] } = config;
189
+ if (!enabled) return [];
190
+ const firstItem = fieldsData.value.find((item) => item.isShow);
191
+ if (!firstItem) {
192
+ return [];
193
+ }
194
+ const firstSummaryField = firstItem.fieldName;
195
+ const footerRow = { _isFooter: true };
196
+ if (firstSummaryField) {
197
+ footerRow[firstSummaryField] = "合计";
198
+ }
199
+ if (mode === "current") {
200
+ summaryFields.forEach((fieldName) => {
201
+ const sum = displayData.value.reduce((total, item) => {
202
+ const value = parseFloat(item[fieldName]);
203
+ return total + (isNaN(value) ? 0 : value);
204
+ }, 0);
205
+ if (isNaN(sum)) {
206
+ footerRow[fieldName] = "";
207
+ } else {
208
+ const field = fieldsData.value.find((f) => f.fieldName === fieldName);
209
+ footerRow[fieldName] = formatSummaryValue(sum, field);
210
+ }
211
+ });
212
+ } else if (mode === "all") {
213
+ summaryFields.forEach((fieldName) => {
214
+ const sum = allSummaryData.value[fieldName];
215
+ if (sum !== void 0 && sum !== null) {
216
+ const field = fieldsData.value.find((f) => f.fieldName === fieldName);
217
+ footerRow[fieldName] = formatSummaryValue(sum, field);
218
+ } else {
219
+ footerRow[fieldName] = "加载中...";
220
+ }
221
+ });
222
+ }
223
+ return [footerRow];
224
+ });
225
+ function formatSummaryValue(value, field) {
226
+ if (!field) {
227
+ return value;
228
+ }
229
+ const format = field.format;
230
+ field.hasDecimalPlaces;
231
+ field.decimalPlaces ?? 2;
232
+ let result = value;
233
+ switch (format) {
234
+ case "yuan":
235
+ result = value;
236
+ break;
237
+ case "wan":
238
+ result = value / 1e4;
239
+ break;
240
+ case "million":
241
+ result = value / 1e6;
242
+ break;
243
+ case "percentage":
244
+ result = value * 100;
245
+ break;
246
+ case "permillage":
247
+ result = value * 1e3;
248
+ break;
249
+ case "permillion":
250
+ result = value * 1e4;
251
+ break;
252
+ default:
253
+ result = value;
254
+ }
255
+ if (field.format == "yuan" || field.format == "wan" || field.format == "million") {
256
+ const formatted = result.toLocaleString("en-US", {
257
+ minimumFractionDigits: field.hasDecimalPlaces && field.decimalPlaces !== void 0 ? field.decimalPlaces : 0,
258
+ maximumFractionDigits: field.hasDecimalPlaces && field.decimalPlaces !== void 0 ? field.decimalPlaces : 20
259
+ });
260
+ return formatted;
261
+ }
262
+ return result;
263
+ }
264
+ const initDataSourceManager = async () => {
179
265
  var _a, _b;
180
266
  if (!((_a = localConfig.value.dataSources) == null ? void 0 : _a.length)) return;
181
267
  dataSourceManager.value = datasource.createDataSource({
@@ -199,7 +285,36 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
199
285
  emit("data-error", err);
200
286
  });
201
287
  if (!props.tableData || props.tableData.length === 0) {
202
- dataSourceManager.value.fetch();
288
+ tableDataFetch();
289
+ if (localConfig.value.summaryConfig.enabled && localConfig.value.summaryConfig.mode == "all") {
290
+ const summaryAllDataManager = datasource.createDataSource({
291
+ http: ctx.$http,
292
+ initSearchData: searchData.value,
293
+ dataSources: localConfig.value.dataSources,
294
+ currentDataSourceId: localConfig.value.dataSourceId,
295
+ pagination: {
296
+ pageNo: 1,
297
+ pageSize: 0
298
+ // 获取全部数据
299
+ },
300
+ data: hiddenFormData.value,
301
+ fields: fieldsData.value,
302
+ sortRules: localConfig.value.sortRules,
303
+ templateId: localConfig.value.templateKey
304
+ });
305
+ const data = await summaryAllDataManager.fetch();
306
+ const summaryFields = localConfig.value.summaryConfig.summaryFields || [];
307
+ const allList = (data == null ? void 0 : data.list) || [];
308
+ const summaryResult = {};
309
+ summaryFields.forEach((fieldName) => {
310
+ const sum = allList.reduce((total, item) => {
311
+ const value = parseFloat(item[fieldName]);
312
+ return total + (isNaN(value) ? 0 : value);
313
+ }, 0);
314
+ summaryResult[fieldName] = sum;
315
+ });
316
+ allSummaryData.value = summaryResult;
317
+ }
203
318
  }
204
319
  loadFieldDataSources();
205
320
  };
@@ -331,14 +446,14 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
331
446
  const orderValue = order ? order.replace("ending", "") : "";
332
447
  if (dataSourceManager.value) {
333
448
  dataSourceManager.value.updateSort(property, orderValue);
334
- dataSourceManager.value.fetch();
449
+ tableDataFetch();
335
450
  }
336
451
  emit("sort-change", { field: property, order: orderValue });
337
452
  };
338
453
  const handlePageChange = ({ pageNo, pageSize }) => {
339
454
  if (dataSourceManager.value) {
340
455
  dataSourceManager.value.updatePagination(pageNo, pageSize);
341
- dataSourceManager.value.fetch();
456
+ tableDataFetch();
342
457
  }
343
458
  emit("page-change", { pageNo, pageSize });
344
459
  };
@@ -354,7 +469,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
354
469
  const handleFilterSearch = (filters) => {
355
470
  if (dataSourceManager.value) {
356
471
  dataSourceManager.value.updateParams(filters);
357
- dataSourceManager.value.fetch();
472
+ tableDataFetch();
358
473
  clearSelection();
359
474
  } else {
360
475
  searchData.value = filters;
@@ -363,7 +478,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
363
478
  const handleFilterReset = () => {
364
479
  if (dataSourceManager.value) {
365
480
  dataSourceManager.value.clearParams();
366
- dataSourceManager.value.fetch();
481
+ tableDataFetch();
367
482
  clearSelection();
368
483
  }
369
484
  };
@@ -394,7 +509,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
394
509
  $table.clearFilter();
395
510
  }
396
511
  }
397
- dataSourceManager.value.fetch();
512
+ tableDataFetch();
398
513
  }
399
514
  };
400
515
  const reset = () => {
@@ -409,9 +524,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
409
524
  $table.clearSort();
410
525
  }
411
526
  dataSourceManager.value.clearSort();
412
- dataSourceManager.value.fetch();
527
+ tableDataFetch();
413
528
  }
414
529
  };
530
+ async function tableDataFetch() {
531
+ await dataSourceManager.value.fetch();
532
+ }
415
533
  const exportConfig = vue.reactive({
416
534
  modes: ["current", "selected", "all", "empty"],
417
535
  original: false
@@ -621,6 +739,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
621
739
  "row-config": rowConfig.value,
622
740
  "radio-config": vue.unref(radioConfig),
623
741
  "checkbox-config": vue.unref(checkboxConfig),
742
+ "show-footer": summaryConfig.value.enabled,
743
+ "footer-data": footerData.value,
624
744
  onSortChange: handleSortChange,
625
745
  onCheckboxChange: handleCheckboxChange,
626
746
  onCheckboxAll: handleCheckboxAll,
@@ -659,7 +779,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
659
779
  ];
660
780
  }),
661
781
  _: 3
662
- }, 8, ["data", "auto-resize", "height", "export-config", "row-config", "radio-config", "checkbox-config"])
782
+ }, 8, ["data", "auto-resize", "height", "export-config", "row-config", "radio-config", "checkbox-config", "show-footer", "footer-data"])
663
783
  ]),
664
784
  isPagination.value ? (vue.openBlock(), vue.createBlock(Pagination.default, {
665
785
  key: 2,
@@ -675,5 +795,5 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
675
795
  };
676
796
  }
677
797
  });
678
- const _Table = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-03f3150c"]]);
798
+ const _Table = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-aa3130aa"]]);
679
799
  exports.default = _Table;
@@ -401,5 +401,5 @@ const _sfc_main = {
401
401
  };
402
402
  }
403
403
  };
404
- const TableColumn = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-1fac212e"]]);
404
+ const TableColumn = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-3e5372d4"]]);
405
405
  exports.default = TableColumn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fecp/designer",
3
- "version": "5.3.22",
3
+ "version": "5.4.2",
4
4
  "main": "lib/designer/index.js",
5
5
  "module": "es/designer/index.mjs",
6
6
  "files": [