@ecan-bi/datav 1.0.98 → 1.1.0

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/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @ecan-bi/datav@1.0.98 */
1
+ /*! @ecan-bi/datav@1.1.0 */
2
2
  var _a, _b, _c, _d;
3
3
  import { watch, inject, computed, unref, watchEffect, defineComponent, shallowRef, toRefs, onMounted, onUnmounted, h, nextTick, createVNode, resolveComponent, openBlock, createElementBlock, createBlock, renderSlot, withCtx, ref, normalizeStyle, createCommentVNode, provide, toDisplayString, Fragment, renderList, createElementVNode, normalizeClass, pushScopeId, popScopeId, createSlots, resolveDynamicComponent, mergeProps, withModifiers, withDirectives, vShow } from "vue";
4
4
  import { throttle, init, use, registerMap } from "echarts/core";
@@ -1751,7 +1751,7 @@ const useRequestData = (props2, callBack = () => {
1751
1751
  _params[key] = useVariablesInText(value);
1752
1752
  }
1753
1753
  });
1754
- _params = { ...window.config.requestParams, ..._params, ...params };
1754
+ _params = { ...window.config.requestParams, ...params, ..._params };
1755
1755
  let urlParams = "";
1756
1756
  const keys = Object.keys(_params);
1757
1757
  const last = keys.length - 1;
@@ -6759,7 +6759,7 @@ const _sfc_main$1 = defineComponent({
6759
6759
  const pageNum = ref(1);
6760
6760
  const pageSize = computed(() => props2.paginationPageSize);
6761
6761
  const handleChildrenColumns = (_columns) => {
6762
- if (Array.isArray(_columns)) {
6762
+ if (Array.isArray(_columns) && _columns.length > 0) {
6763
6763
  const len = _columns.length;
6764
6764
  const columnsFixedNum = props2.columnsFixedNum;
6765
6765
  for (let i = 0; i < len; i++) {
@@ -6869,14 +6869,14 @@ const _sfc_main$1 = defineComponent({
6869
6869
  tableColumns.value = columns;
6870
6870
  tableDataSource.value = dataSource;
6871
6871
  } else {
6872
- tableColumns.value = unref(myColumns);
6873
- tableDataSource.value = unref(myDataSource);
6872
+ tableColumns.value = cloneDeep(unref(myColumns));
6873
+ tableDataSource.value = cloneDeep(unref(myDataSource));
6874
6874
  }
6875
6875
  }, {
6876
6876
  deep: true,
6877
6877
  immediate: true
6878
6878
  });
6879
- const orderCondition = ref(void 0);
6879
+ const orderCondition = ref("");
6880
6880
  const requestData = useRequestData(props2);
6881
6881
  const loading = ref(false);
6882
6882
  const handleRequestData = async (isUseLoading = true) => {
@@ -6884,9 +6884,10 @@ const _sfc_main$1 = defineComponent({
6884
6884
  try {
6885
6885
  if (isUseLoading)
6886
6886
  loading.value = true;
6887
- let params = {
6888
- orderCondition: unref(orderCondition)
6889
- };
6887
+ let params = {};
6888
+ if (unref(orderCondition)) {
6889
+ params.orderCondition = unref(orderCondition);
6890
+ }
6890
6891
  if (props2.paginationShow) {
6891
6892
  params = {
6892
6893
  pageNum: unref(pageNum),
@@ -6898,7 +6899,9 @@ const _sfc_main$1 = defineComponent({
6898
6899
  const res = await requestData(params);
6899
6900
  const { rows = [], total: tableTotal = 0 } = ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.data) || {};
6900
6901
  total.value = tableTotal;
6901
- myDataSource.value = rows;
6902
+ if (Array.isArray(rows)) {
6903
+ myDataSource.value = rows;
6904
+ }
6902
6905
  } catch (e) {
6903
6906
  console.error(e);
6904
6907
  } finally {
@@ -7014,8 +7017,12 @@ const _sfc_main$1 = defineComponent({
7014
7017
  refreshData
7015
7018
  });
7016
7019
  const summaryList = computed(() => {
7017
- const columns = props2.columns;
7018
- const summaryList2 = props2.isUseSeq ? [{ total: "\u5C0F\u8BA1" }] : [];
7020
+ const columns = unref(tableColumns);
7021
+ let summaryList2 = [];
7022
+ if (props2.isUseSeq) {
7023
+ columns.shift();
7024
+ summaryList2 = [{ total: "\u5C0F\u8BA1" }];
7025
+ }
7019
7026
  let calcTotalCount = 0;
7020
7027
  for (let i = 0; i < columns.length; i++) {
7021
7028
  const column = columns[i];
@@ -7037,16 +7044,20 @@ const _sfc_main$1 = defineComponent({
7037
7044
  return [];
7038
7045
  const start = (unref(pageNum) - 1) * unref(pageSize);
7039
7046
  const end = start + unref(pageSize);
7040
- const records = unref(myDataSource).slice(start, end);
7041
- for (let i = 0; i < records.length; i++) {
7042
- const record = records[i];
7043
- for (let j = 0; j < summaryList2.length; j++) {
7044
- const summary = summaryList2[j];
7045
- const { dataIndex, total: total2 } = summary;
7046
- const num = +record[dataIndex];
7047
- if (!Number.isNaN(num) && total2 != null) {
7048
- summary.total = num + total2;
7047
+ const records = unref(tableDataSource).slice(start, end);
7048
+ for (let i = 0; i < summaryList2.length; i++) {
7049
+ const summary = summaryList2[i];
7050
+ let total2 = 0;
7051
+ const { isCalcTotal, dataIndex } = summary;
7052
+ if (isCalcTotal === true) {
7053
+ for (let j = 0; j < records.length; j++) {
7054
+ const record = records[j];
7055
+ const num = record[dataIndex];
7056
+ if (!isNaN(num)) {
7057
+ total2 = num + total2;
7058
+ }
7049
7059
  }
7060
+ summary.total = total2;
7050
7061
  }
7051
7062
  }
7052
7063
  return summaryList2;
@@ -7100,7 +7111,7 @@ const _sfc_main$1 = defineComponent({
7100
7111
  };
7101
7112
  }
7102
7113
  });
7103
- const Table_vue_vue_type_style_index_0_scoped_9d631b38_lang = "";
7114
+ const Table_vue_vue_type_style_index_0_scoped_33b428a2_lang = "";
7104
7115
  const Table_vue_vue_type_style_index_1_lang = "";
7105
7116
  const _hoisted_1$1 = {
7106
7117
  key: 1,
@@ -7187,8 +7198,8 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
7187
7198
  default: withCtx(() => [
7188
7199
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.summaryList, (summary, index2) => {
7189
7200
  return openBlock(), createBlock(_component_a_table_summary_cell, {
7190
- key: summary.dataIndex + index2,
7191
- index: summary.index,
7201
+ key: index2,
7202
+ index: index2,
7192
7203
  style: normalizeStyle({
7193
7204
  backgroundColor: _ctx.cellBackgroundColor,
7194
7205
  textAlign: summary.cellAlign || "center",
@@ -7198,8 +7209,12 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
7198
7209
  }, {
7199
7210
  default: withCtx(() => [
7200
7211
  createElementVNode("div", {
7201
- class: normalizeClass([_ctx.contrastClass(summary.total, summary.format)])
7202
- }, toDisplayString((summary.format != null || summary.format !== "") && _ctx.formatFn(summary.total, summary.format)), 3)
7212
+ class: normalizeClass([_ctx.contrastClass(summary.total, summary.format)]),
7213
+ style: normalizeStyle({
7214
+ fontSize: _ctx.fontSize,
7215
+ fontWeight: _ctx.fontWeight
7216
+ })
7217
+ }, toDisplayString((summary.format != null || summary.format !== "") && _ctx.formatFn(summary.total, summary.format)), 7)
7203
7218
  ]),
7204
7219
  _: 2
7205
7220
  }, 1032, ["index", "style"]);
@@ -7218,7 +7233,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
7218
7233
  }, 8, ["loading"])
7219
7234
  ], 4);
7220
7235
  }
7221
- const Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-9d631b38"]]);
7236
+ const Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-33b428a2"]]);
7222
7237
  const EcanTable = withInstall(Table);
7223
7238
  const mapProps = {
7224
7239
  ...props,