@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.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @ecan-bi/datav@1.0.98 */
1
+ /*! @ecan-bi/datav@1.1.0 */
2
2
  (function(global, factory) {
3
3
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("echarts/core"), require("resize-detector"), require("ant-design-vue"), require("ant-design-vue/es/spin/style"), require("ant-design-vue/es/skeleton/style"), require("lodash-es"), require("axios"), require("mitt"), require("dayjs"), require("ant-design-vue/es/progress/style"), require("ant-design-vue/es/input/style"), require("ant-design-vue/es/date-picker/style"), require("ant-design-vue/es/date-picker/locale/zh_CN"), require("ant-design-vue/es/select/style"), require("ant-design-vue/es/button/style"), require("ant-design-vue/es/checkbox/style"), require("echarts/renderers"), require("echarts/charts"), require("echarts/components"), require("echarts"), require("ant-design-vue/es/modal/style"), require("ant-design-vue/es/table/style")) : typeof define === "function" && define.amd ? define(["exports", "vue", "echarts/core", "resize-detector", "ant-design-vue", "ant-design-vue/es/spin/style", "ant-design-vue/es/skeleton/style", "lodash-es", "axios", "mitt", "dayjs", "ant-design-vue/es/progress/style", "ant-design-vue/es/input/style", "ant-design-vue/es/date-picker/style", "ant-design-vue/es/date-picker/locale/zh_CN", "ant-design-vue/es/select/style", "ant-design-vue/es/button/style", "ant-design-vue/es/checkbox/style", "echarts/renderers", "echarts/charts", "echarts/components", "echarts", "ant-design-vue/es/modal/style", "ant-design-vue/es/table/style"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@ecan/bi-datav"] = {}, global.vue, global["echarts/core"], global["resize-detector"], global["ant-design-vue"], null, null, global["lodash-es"], global.axios, global.mitt, global.dayjs, null, null, null, global["ant-design-vue/es/date-picker/locale/zh_CN"], null, null, null, global["echarts/renderers"], global["echarts/charts"], global["echarts/components"], global.echarts));
4
4
  })(this, function(exports2, vue, core, resizeDetector, antDesignVue, style$1, style$2, lodashEs, axios, mitt, dayjs, style$3, style$4, style$5, locale, style$6, style$7, style$8, renderers, charts, components$1, echarts) {
@@ -1756,7 +1756,7 @@
1756
1756
  _params[key] = useVariablesInText(value);
1757
1757
  }
1758
1758
  });
1759
- _params = { ...window.config.requestParams, ..._params, ...params };
1759
+ _params = { ...window.config.requestParams, ...params, ..._params };
1760
1760
  let urlParams = "";
1761
1761
  const keys = Object.keys(_params);
1762
1762
  const last = keys.length - 1;
@@ -6764,7 +6764,7 @@
6764
6764
  const pageNum = vue.ref(1);
6765
6765
  const pageSize = vue.computed(() => props2.paginationPageSize);
6766
6766
  const handleChildrenColumns = (_columns) => {
6767
- if (Array.isArray(_columns)) {
6767
+ if (Array.isArray(_columns) && _columns.length > 0) {
6768
6768
  const len = _columns.length;
6769
6769
  const columnsFixedNum = props2.columnsFixedNum;
6770
6770
  for (let i = 0; i < len; i++) {
@@ -6874,14 +6874,14 @@
6874
6874
  tableColumns.value = columns;
6875
6875
  tableDataSource.value = dataSource;
6876
6876
  } else {
6877
- tableColumns.value = vue.unref(myColumns);
6878
- tableDataSource.value = vue.unref(myDataSource);
6877
+ tableColumns.value = lodashEs.cloneDeep(vue.unref(myColumns));
6878
+ tableDataSource.value = lodashEs.cloneDeep(vue.unref(myDataSource));
6879
6879
  }
6880
6880
  }, {
6881
6881
  deep: true,
6882
6882
  immediate: true
6883
6883
  });
6884
- const orderCondition = vue.ref(void 0);
6884
+ const orderCondition = vue.ref("");
6885
6885
  const requestData = useRequestData(props2);
6886
6886
  const loading = vue.ref(false);
6887
6887
  const handleRequestData = async (isUseLoading = true) => {
@@ -6889,9 +6889,10 @@
6889
6889
  try {
6890
6890
  if (isUseLoading)
6891
6891
  loading.value = true;
6892
- let params = {
6893
- orderCondition: vue.unref(orderCondition)
6894
- };
6892
+ let params = {};
6893
+ if (vue.unref(orderCondition)) {
6894
+ params.orderCondition = vue.unref(orderCondition);
6895
+ }
6895
6896
  if (props2.paginationShow) {
6896
6897
  params = {
6897
6898
  pageNum: vue.unref(pageNum),
@@ -6903,7 +6904,9 @@
6903
6904
  const res = await requestData(params);
6904
6905
  const { rows = [], total: tableTotal = 0 } = ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.data) || {};
6905
6906
  total.value = tableTotal;
6906
- myDataSource.value = rows;
6907
+ if (Array.isArray(rows)) {
6908
+ myDataSource.value = rows;
6909
+ }
6907
6910
  } catch (e) {
6908
6911
  console.error(e);
6909
6912
  } finally {
@@ -7019,8 +7022,12 @@
7019
7022
  refreshData
7020
7023
  });
7021
7024
  const summaryList = vue.computed(() => {
7022
- const columns = props2.columns;
7023
- const summaryList2 = props2.isUseSeq ? [{ total: "\u5C0F\u8BA1" }] : [];
7025
+ const columns = vue.unref(tableColumns);
7026
+ let summaryList2 = [];
7027
+ if (props2.isUseSeq) {
7028
+ columns.shift();
7029
+ summaryList2 = [{ total: "\u5C0F\u8BA1" }];
7030
+ }
7024
7031
  let calcTotalCount = 0;
7025
7032
  for (let i = 0; i < columns.length; i++) {
7026
7033
  const column = columns[i];
@@ -7042,16 +7049,20 @@
7042
7049
  return [];
7043
7050
  const start = (vue.unref(pageNum) - 1) * vue.unref(pageSize);
7044
7051
  const end = start + vue.unref(pageSize);
7045
- const records = vue.unref(myDataSource).slice(start, end);
7046
- for (let i = 0; i < records.length; i++) {
7047
- const record = records[i];
7048
- for (let j = 0; j < summaryList2.length; j++) {
7049
- const summary = summaryList2[j];
7050
- const { dataIndex, total: total2 } = summary;
7051
- const num = +record[dataIndex];
7052
- if (!Number.isNaN(num) && total2 != null) {
7053
- summary.total = num + total2;
7052
+ const records = vue.unref(tableDataSource).slice(start, end);
7053
+ for (let i = 0; i < summaryList2.length; i++) {
7054
+ const summary = summaryList2[i];
7055
+ let total2 = 0;
7056
+ const { isCalcTotal, dataIndex } = summary;
7057
+ if (isCalcTotal === true) {
7058
+ for (let j = 0; j < records.length; j++) {
7059
+ const record = records[j];
7060
+ const num = record[dataIndex];
7061
+ if (!isNaN(num)) {
7062
+ total2 = num + total2;
7063
+ }
7054
7064
  }
7065
+ summary.total = total2;
7055
7066
  }
7056
7067
  }
7057
7068
  return summaryList2;
@@ -7105,7 +7116,7 @@
7105
7116
  };
7106
7117
  }
7107
7118
  });
7108
- const Table_vue_vue_type_style_index_0_scoped_9d631b38_lang = "";
7119
+ const Table_vue_vue_type_style_index_0_scoped_33b428a2_lang = "";
7109
7120
  const Table_vue_vue_type_style_index_1_lang = "";
7110
7121
  const _hoisted_1$1 = {
7111
7122
  key: 1,
@@ -7192,8 +7203,8 @@
7192
7203
  default: vue.withCtx(() => [
7193
7204
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.summaryList, (summary, index2) => {
7194
7205
  return vue.openBlock(), vue.createBlock(_component_a_table_summary_cell, {
7195
- key: summary.dataIndex + index2,
7196
- index: summary.index,
7206
+ key: index2,
7207
+ index: index2,
7197
7208
  style: vue.normalizeStyle({
7198
7209
  backgroundColor: _ctx.cellBackgroundColor,
7199
7210
  textAlign: summary.cellAlign || "center",
@@ -7203,8 +7214,12 @@
7203
7214
  }, {
7204
7215
  default: vue.withCtx(() => [
7205
7216
  vue.createElementVNode("div", {
7206
- class: vue.normalizeClass([_ctx.contrastClass(summary.total, summary.format)])
7207
- }, vue.toDisplayString((summary.format != null || summary.format !== "") && _ctx.formatFn(summary.total, summary.format)), 3)
7217
+ class: vue.normalizeClass([_ctx.contrastClass(summary.total, summary.format)]),
7218
+ style: vue.normalizeStyle({
7219
+ fontSize: _ctx.fontSize,
7220
+ fontWeight: _ctx.fontWeight
7221
+ })
7222
+ }, vue.toDisplayString((summary.format != null || summary.format !== "") && _ctx.formatFn(summary.total, summary.format)), 7)
7208
7223
  ]),
7209
7224
  _: 2
7210
7225
  }, 1032, ["index", "style"]);
@@ -7223,7 +7238,7 @@
7223
7238
  }, 8, ["loading"])
7224
7239
  ], 4);
7225
7240
  }
7226
- const Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-9d631b38"]]);
7241
+ const Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-33b428a2"]]);
7227
7242
  const EcanTable = withInstall(Table);
7228
7243
  const mapProps = {
7229
7244
  ...props,