@juzhenfe/page-model 3.15.1 → 3.16.1

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
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { reactive, defineComponent, openBlock, createElementBlock, computed, ref, resolveComponent, normalizeClass, unref, createVNode, mergeProps, withCtx, Fragment, renderList, createBlock, createElementVNode, toDisplayString, nextTick, watch, markRaw, getCurrentInstance, resolveDynamicComponent, renderSlot, h, inject, createTextVNode, withModifiers, toRefs, onUnmounted, useSlots, toHandlers, createSlots, onMounted, createCommentVNode, render, Teleport, normalizeStyle, pushScopeId, popScopeId, resolveDirective, withDirectives, vShow, onActivated, watchEffect, normalizeProps, guardReactiveProps, provide, Transition } from "vue";
7
+ import { reactive, defineComponent, openBlock, createElementBlock, computed, ref, resolveComponent, normalizeClass, unref, createVNode, mergeProps, withCtx, Fragment, renderList, createBlock, createElementVNode, toDisplayString, nextTick, watch, markRaw, getCurrentInstance, resolveDynamicComponent, renderSlot, h, inject, createTextVNode, withModifiers, toRefs, onUnmounted, useSlots, toHandlers, createSlots, onMounted, createCommentVNode, render, Teleport, normalizeStyle, withDirectives, vShow, pushScopeId, popScopeId, resolveDirective, onActivated, watchEffect, normalizeProps, guardReactiveProps, provide, Transition } from "vue";
8
8
  import { ElMessage, ElLoading, useZIndex, ElMessageBox } from "element-plus";
9
9
  function defineConfig(config) {
10
10
  return reactive(config);
@@ -4728,10 +4728,16 @@ class TableManager extends IManager {
4728
4728
  updateLoading(loading2) {
4729
4729
  this.loadingData = loading2;
4730
4730
  }
4731
+ get pageIndexKey() {
4732
+ return this.table.pageIndexKey || "pageIndex";
4733
+ }
4734
+ get pageSizeKey() {
4735
+ return this.table.pageSizeKey || "pageSize";
4736
+ }
4731
4737
  getReqParams() {
4732
4738
  return {
4733
- pageIndex: this.currentPage,
4734
- pageSize: this.pageSizeUserSet || this.pageSize,
4739
+ [this.pageIndexKey]: this.currentPage,
4740
+ [this.pageSizeKey]: this.pageSizeUserSet || this.pageSize,
4735
4741
  ...this.sortParams,
4736
4742
  ...this.getColumnParams(),
4737
4743
  ...this.getColumnSortParams()
@@ -4950,7 +4956,9 @@ class TableManager extends IManager {
4950
4956
  this.tableEvents["rowContextmenu"] = function(row, column, event) {
4951
4957
  _rowContextmenu == null ? void 0 : _rowContextmenu.call(this, row, column, event);
4952
4958
  event.preventDefault();
4953
- const rowIndex = this.tableData.findIndex((a) => a[this.rowKey] === row[this.rowKey]);
4959
+ const rowIndex = this.tableData.findIndex(
4960
+ (a) => a[this.rowKey] === row[this.rowKey]
4961
+ );
4954
4962
  this.exposeActions.showContextMenu(row, rowIndex, event);
4955
4963
  try {
4956
4964
  this.tableRef.setCurrentRow(row);
@@ -5264,25 +5272,8 @@ class TableManager extends IManager {
5264
5272
  return (_a = rowData[el.prop]) != null ? _a : "";
5265
5273
  }
5266
5274
  }
5267
- async exportDataToExcel(opts) {
5268
- var _a, _b, _c;
5269
- const depLoadResult = await this.loadExcelDependence();
5270
- if (!depLoadResult) {
5271
- return false;
5272
- }
5273
- const childrenKey = ((_b = (_a = this.table.props) == null ? void 0 : _a.treeProps) == null ? void 0 : _b.children) || "children";
5274
- function patchChildrenData(data) {
5275
- return data.reduce((memo, item) => {
5276
- memo.push(item);
5277
- if (item[childrenKey] && Array.isArray(item[childrenKey])) {
5278
- memo = memo.concat(patchChildrenData(item[childrenKey]));
5279
- }
5280
- return memo;
5281
- }, []);
5282
- }
5283
- const exportData = patchChildrenData(opts.data);
5284
- this.manager.context.$emit("_exported", exportData);
5285
- const exportEls = opts.columns.filter((a) => !a.children);
5275
+ getExcelDataHeader(columns) {
5276
+ const exportEls = columns.filter((a) => !a.children);
5286
5277
  const excelData = [[]];
5287
5278
  const cols = [];
5288
5279
  exportEls.forEach((el) => {
@@ -5291,16 +5282,55 @@ class TableManager extends IManager {
5291
5282
  wpx: el.width || el.minWidth || 120
5292
5283
  });
5293
5284
  });
5294
- for (let i = 0, len = exportData.length; i < len; i++) {
5285
+ return {
5286
+ exportEls,
5287
+ excelData,
5288
+ cols
5289
+ };
5290
+ }
5291
+ insertExcelData(excelData, exportEls, insertData) {
5292
+ for (let i = 0, len = insertData.length; i < len; i++) {
5295
5293
  const rowData = [];
5296
5294
  for (let j = 0; j < exportEls.length; j++) {
5297
- const item = exportData[i];
5295
+ const item = insertData[i];
5298
5296
  const el = exportEls[j];
5299
5297
  let val = this.getTableCellText(el, item);
5300
5298
  rowData.push(val);
5301
5299
  }
5302
5300
  excelData.push(rowData);
5303
5301
  }
5302
+ }
5303
+ patchChildrenData(data, childrenKey) {
5304
+ return data.reduce((memo, item) => {
5305
+ memo.push(item);
5306
+ if (item[childrenKey] && Array.isArray(item[childrenKey])) {
5307
+ memo = memo.concat(this.patchChildrenData(item[childrenKey], childrenKey));
5308
+ }
5309
+ return memo;
5310
+ }, []);
5311
+ }
5312
+ async exportDataToExcel(opts) {
5313
+ var _a, _b;
5314
+ const depLoadResult = await this.loadExcelDependence();
5315
+ if (!depLoadResult) {
5316
+ return false;
5317
+ }
5318
+ const childrenKey = ((_b = (_a = this.table.props) == null ? void 0 : _a.treeProps) == null ? void 0 : _b.children) || "children";
5319
+ const exportData = this.patchChildrenData(opts.data, childrenKey);
5320
+ this.manager.context.$emit("_exported", exportData);
5321
+ const {
5322
+ exportEls,
5323
+ excelData,
5324
+ cols
5325
+ } = this.getExcelDataHeader(opts.columns);
5326
+ this.insertExcelData(excelData, exportEls, exportData);
5327
+ this.exportDataToExcelByExcelData(opts.filename, excelData, cols, {
5328
+ exportData,
5329
+ exportEls
5330
+ });
5331
+ }
5332
+ exportDataToExcelByExcelData(filename, excelData, cols, mergeOpt) {
5333
+ var _a;
5304
5334
  try {
5305
5335
  let s2ab = function(s) {
5306
5336
  var buf = new ArrayBuffer(s.length);
@@ -5310,11 +5340,11 @@ class TableManager extends IManager {
5310
5340
  return buf;
5311
5341
  };
5312
5342
  var sheet = window.oXlsx.utils.aoa_to_sheet(excelData);
5313
- if (typeof ((_c = this.table.xlsx) == null ? void 0 : _c.mergeFn) === "function") {
5343
+ if (typeof ((_a = this.table.xlsx) == null ? void 0 : _a.mergeFn) === "function") {
5314
5344
  sheet["!merges"] = this.table.xlsx.mergeFn.call(
5315
5345
  this,
5316
- exportData,
5317
- exportEls
5346
+ mergeOpt.exportData || [],
5347
+ mergeOpt.exportEls || []
5318
5348
  );
5319
5349
  }
5320
5350
  Object.keys(sheet).forEach((colKey) => {
@@ -5369,7 +5399,7 @@ class TableManager extends IManager {
5369
5399
  const url = URL.createObjectURL(blob);
5370
5400
  const aLink = document.createElement("a");
5371
5401
  aLink.href = url;
5372
- aLink.download = opts.filename;
5402
+ aLink.download = filename;
5373
5403
  aLink.click();
5374
5404
  return true;
5375
5405
  } catch (e) {
@@ -5656,9 +5686,15 @@ var FilterMatchModeEnum$1 = /* @__PURE__ */ ((FilterMatchModeEnum2) => {
5656
5686
  FilterMatchModeEnum2["\u5C0F\u4E8E"] = "lt";
5657
5687
  FilterMatchModeEnum2["\u5927\u4E8E\u7B49\u4E8E"] = "ge";
5658
5688
  FilterMatchModeEnum2["\u5C0F\u4E8E\u7B49\u4E8E"] = "le";
5689
+ FilterMatchModeEnum2["\u662Fnull\u503C"] = "isNull";
5690
+ FilterMatchModeEnum2["\u4E0D\u662Fnull\u503C"] = "isNotNull";
5691
+ FilterMatchModeEnum2["\u662F\u7A7A\u5B57\u7B26\u4E32"] = "isEmptyString";
5692
+ FilterMatchModeEnum2["\u4E0D\u662F\u7A7A\u5B57\u7B26\u4E32"] = "isNotEmptyString";
5693
+ FilterMatchModeEnum2["\u662F\u7A7A\u503C"] = "isEmpty";
5694
+ FilterMatchModeEnum2["\u4E0D\u662F\u7A7A\u503C"] = "isNotEmpty";
5659
5695
  return FilterMatchModeEnum2;
5660
5696
  })(FilterMatchModeEnum$1 || {});
5661
- const compareOptions$1 = {
5697
+ let compareOptions$1 = {
5662
5698
  ["string"]: [
5663
5699
  {
5664
5700
  label: "\u5305\u542B",
@@ -5683,6 +5719,30 @@ const compareOptions$1 = {
5683
5719
  {
5684
5720
  label: "\u4E0D\u7B49\u4E8E",
5685
5721
  value: "neq"
5722
+ },
5723
+ {
5724
+ label: "\u662Fnull\u503C",
5725
+ value: "isNull"
5726
+ },
5727
+ {
5728
+ label: "\u4E0D\u662Fnull\u503C",
5729
+ value: "isNotNull"
5730
+ },
5731
+ {
5732
+ label: "\u662F\u7A7A\u5B57\u7B26\u4E32",
5733
+ value: "isEmptyString"
5734
+ },
5735
+ {
5736
+ label: "\u4E0D\u662F\u7A7A\u5B57\u7B26\u4E32",
5737
+ value: "isNotEmptyString"
5738
+ },
5739
+ {
5740
+ label: "\u662F\u7A7A\u503C",
5741
+ value: "isEmpty"
5742
+ },
5743
+ {
5744
+ label: "\u4E0D\u662F\u7A7A\u503C",
5745
+ value: "isNotEmpty"
5686
5746
  }
5687
5747
  ],
5688
5748
  ["number"]: [
@@ -5709,6 +5769,14 @@ const compareOptions$1 = {
5709
5769
  {
5710
5770
  label: "\u5C0F\u4E8E\u7B49\u4E8E",
5711
5771
  value: "le"
5772
+ },
5773
+ {
5774
+ label: "\u662Fnull\u503C",
5775
+ value: "isNull"
5776
+ },
5777
+ {
5778
+ label: "\u4E0D\u662Fnull\u503C",
5779
+ value: "isNotNull"
5712
5780
  }
5713
5781
  ],
5714
5782
  ["date"]: [
@@ -5735,9 +5803,31 @@ const compareOptions$1 = {
5735
5803
  {
5736
5804
  label: "\u5C0F\u4E8E\u7B49\u4E8E",
5737
5805
  value: "le"
5806
+ },
5807
+ {
5808
+ label: "\u662Fnull\u503C",
5809
+ value: "isNull"
5810
+ },
5811
+ {
5812
+ label: "\u4E0D\u662Fnull\u503C",
5813
+ value: "isNotNull"
5738
5814
  }
5739
5815
  ]
5740
5816
  };
5817
+ const updateCompareOptions = (_compareOptions) => {
5818
+ compareOptions$1 = _compareOptions;
5819
+ };
5820
+ let noValueOptions = [
5821
+ "isNull",
5822
+ "isNotNull",
5823
+ "isEmptyString",
5824
+ "isNotEmptyString",
5825
+ "isEmpty",
5826
+ "isNotEmpty"
5827
+ ];
5828
+ const updateCompareNoValueOptions = (_noValueOptions) => {
5829
+ noValueOptions = _noValueOptions;
5830
+ };
5741
5831
  var index_vue_vue_type_style_index_0_scoped_true_lang$a = "";
5742
5832
  const _hoisted_1$g = { key: 1 };
5743
5833
  const _sfc_main$y = defineComponent({
@@ -5909,12 +5999,14 @@ const _sfc_main$y = defineComponent({
5909
5999
  createElementVNode("div", {
5910
6000
  class: normalizeClass(unref(createBEMName)("input"))
5911
6001
  }, [
5912
- createVNode(_component_el_input, {
6002
+ withDirectives(createVNode(_component_el_input, {
5913
6003
  modelValue: item.value,
5914
6004
  "onUpdate:modelValue": ($event) => item.value = $event,
5915
6005
  placeholder: "\u8BF7\u8F93\u5165",
5916
6006
  clearable: ""
5917
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
6007
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]), [
6008
+ [vShow, !unref(noValueOptions).includes(item.condition)]
6009
+ ])
5918
6010
  ], 2),
5919
6011
  filterMultiple.value ? (openBlock(), createBlock(_component_el_icon, {
5920
6012
  key: 0,
@@ -5954,13 +6046,15 @@ const _sfc_main$y = defineComponent({
5954
6046
  createElementVNode("div", {
5955
6047
  class: normalizeClass(unref(createBEMName)("input"))
5956
6048
  }, [
5957
- createVNode(_component_el_input_number, {
6049
+ withDirectives(createVNode(_component_el_input_number, {
5958
6050
  modelValue: item.value,
5959
6051
  "onUpdate:modelValue": ($event) => item.value = $event,
5960
6052
  "controls-position": "right",
5961
6053
  clearable: "",
5962
6054
  placeholder: "\u8BF7\u8F93\u5165"
5963
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
6055
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]), [
6056
+ [vShow, !unref(noValueOptions).includes(item.condition)]
6057
+ ])
5964
6058
  ], 2),
5965
6059
  filterMultiple.value ? (openBlock(), createBlock(_component_el_icon, {
5966
6060
  key: 0,
@@ -6000,13 +6094,15 @@ const _sfc_main$y = defineComponent({
6000
6094
  createElementVNode("div", {
6001
6095
  class: normalizeClass(unref(createBEMName)("input"))
6002
6096
  }, [
6003
- createVNode(_component_el_date_picker, {
6097
+ withDirectives(createVNode(_component_el_date_picker, {
6004
6098
  modelValue: item.value,
6005
6099
  "onUpdate:modelValue": ($event) => item.value = $event,
6006
6100
  placeholder: "\u8BF7\u9009\u62E9\u65E5\u671F",
6007
6101
  "value-format": "YYYY-MM-DD",
6008
6102
  clearable: ""
6009
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
6103
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]), [
6104
+ [vShow, !unref(noValueOptions).includes(item.condition)]
6105
+ ])
6010
6106
  ], 2),
6011
6107
  filterMultiple.value ? (openBlock(), createBlock(_component_el_icon, {
6012
6108
  key: 0,
@@ -6144,7 +6240,7 @@ const _sfc_main$y = defineComponent({
6144
6240
  };
6145
6241
  }
6146
6242
  });
6147
- var FilterZone$1 = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-9b1b33b8"]]);
6243
+ var FilterZone$1 = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-076a0f3a"]]);
6148
6244
  var index_vue_vue_type_style_index_0_lang$7 = "";
6149
6245
  const _hoisted_1$f = ["data-key", "title"];
6150
6246
  const _hoisted_2$7 = {
@@ -6158,7 +6254,7 @@ const _hoisted_5$4 = {
6158
6254
  class: "el-table-cell_editable"
6159
6255
  };
6160
6256
  const _hoisted_6$3 = { class: "el-table-cell_editable-inputer" };
6161
- const _hoisted_7$3 = {
6257
+ const _hoisted_7$2 = {
6162
6258
  key: 0,
6163
6259
  class: "el-table-cell_loading"
6164
6260
  };
@@ -6385,7 +6481,7 @@ const _sfc_main$x = defineComponent({
6385
6481
  columnEl.columnKey,
6386
6482
  row[tableManager.value.rowKey]
6387
6483
  ) + "-loading"
6388
- ) ? (openBlock(), createElementBlock("div", _hoisted_7$3, [
6484
+ ) ? (openBlock(), createElementBlock("div", _hoisted_7$2, [
6389
6485
  createVNode(_component_el_icon, { class: "is-loading" }, {
6390
6486
  default: withCtx(() => [
6391
6487
  createVNode(unref(loading))
@@ -7543,12 +7639,6 @@ const _sfc_main$v = defineComponent({
7543
7639
  {
7544
7640
  label: "\u6C47\u603B"
7545
7641
  },
7546
- {
7547
- label: "\u5BBD\u5EA6"
7548
- },
7549
- {
7550
- label: "\u6700\u5C0F\u5BBD\u5EA6"
7551
- },
7552
7642
  {
7553
7643
  label: "\u56FA\u5B9A\u5217"
7554
7644
  }
@@ -7574,7 +7664,6 @@ const _sfc_main$v = defineComponent({
7574
7664
  const _component_el_switch = resolveComponent("el-switch");
7575
7665
  const _component_el_radio_button = resolveComponent("el-radio-button");
7576
7666
  const _component_el_radio_group = resolveComponent("el-radio-group");
7577
- const _component_el_input_number = resolveComponent("el-input-number");
7578
7667
  const _component_el_button = resolveComponent("el-button");
7579
7668
  return openBlock(), createBlock(_sfc_main$D, {
7580
7669
  modelValue: visible.value,
@@ -7693,30 +7782,6 @@ const _sfc_main$v = defineComponent({
7693
7782
  !_ctx.onlyShow ? (openBlock(), createElementBlock("div", {
7694
7783
  key: 2,
7695
7784
  class: normalizeClass(unref(createBEMName)("cell"))
7696
- }, [
7697
- createVNode(_component_el_input_number, {
7698
- modelValue: element.width,
7699
- "onUpdate:modelValue": ($event) => element.width = $event,
7700
- size: "small",
7701
- controls: false,
7702
- placeholder: "\u8F93\u5165\u6570\u5B57"
7703
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
7704
- ], 2)) : createCommentVNode("", true),
7705
- !_ctx.onlyShow ? (openBlock(), createElementBlock("div", {
7706
- key: 3,
7707
- class: normalizeClass(unref(createBEMName)("cell"))
7708
- }, [
7709
- createVNode(_component_el_input_number, {
7710
- modelValue: element.minWidth,
7711
- "onUpdate:modelValue": ($event) => element.minWidth = $event,
7712
- size: "small",
7713
- controls: false,
7714
- placeholder: "\u8F93\u5165\u6570\u5B57"
7715
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
7716
- ], 2)) : createCommentVNode("", true),
7717
- !_ctx.onlyShow ? (openBlock(), createElementBlock("div", {
7718
- key: 4,
7719
- class: normalizeClass(unref(createBEMName)("cell"))
7720
7785
  }, [
7721
7786
  createVNode(_component_el_radio_group, {
7722
7787
  modelValue: element.fixed,
@@ -7950,7 +8015,7 @@ const useUserConfig = () => {
7950
8015
  const tableChangeEmiter = new EventEmitter();
7951
8016
  var index_vue_vue_type_style_index_0_lang$6 = "";
7952
8017
  var index_vue_vue_type_style_index_1_scoped_true_lang$1 = "";
7953
- const _withScopeId$3 = (n) => (pushScopeId("data-v-1098de7a"), n = n(), popScopeId(), n);
8018
+ const _withScopeId$3 = (n) => (pushScopeId("data-v-5b551558"), n = n(), popScopeId(), n);
7954
8019
  const _hoisted_1$e = { title: "\u5168\u9009/\u53D6\u6D88" };
7955
8020
  const _hoisted_2$6 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ createElementVNode("i", {
7956
8021
  class: "pm-icon icon-drag-dot",
@@ -7964,20 +8029,25 @@ const _sfc_main$t = defineComponent({
7964
8029
  props: {
7965
8030
  els: {}
7966
8031
  },
7967
- emits: ["save-columns", "export"],
8032
+ emits: ["save-columns"],
7968
8033
  setup(__props, { emit: __emit }) {
7969
8034
  const innerEls = ref([]);
7970
8035
  const { BEMSpace, createBEMName } = createBEMSpace("column-tools");
7971
8036
  const props = __props;
7972
8037
  const { els } = toRefs(props);
7973
8038
  const emit = __emit;
8039
+ const isExternalChange = ref(false);
7974
8040
  watch(
7975
8041
  els,
7976
8042
  () => {
8043
+ isExternalChange.value = true;
7977
8044
  innerEls.value = cloneDeep(props.els).map((a) => {
7978
8045
  a.userConfigShow = a.userConfigShow === false ? false : true;
7979
8046
  return a;
7980
8047
  });
8048
+ setTimeout(() => {
8049
+ isExternalChange.value = false;
8050
+ }, 10);
7981
8051
  },
7982
8052
  {
7983
8053
  immediate: true,
@@ -7987,6 +8057,19 @@ const _sfc_main$t = defineComponent({
7987
8057
  const onSaveColumns = () => {
7988
8058
  emit("save-columns", innerEls.value);
7989
8059
  };
8060
+ watch(
8061
+ () => {
8062
+ return innerEls.value;
8063
+ },
8064
+ () => {
8065
+ if (!isExternalChange.value) {
8066
+ onSaveColumns();
8067
+ }
8068
+ },
8069
+ {
8070
+ deep: true
8071
+ }
8072
+ );
7990
8073
  const {
7991
8074
  columnToolsSettingRef,
7992
8075
  showColumnToolsSetting,
@@ -7997,7 +8080,7 @@ const _sfc_main$t = defineComponent({
7997
8080
  emit("save-columns", columns);
7998
8081
  };
7999
8082
  const showSetting = () => {
8000
- showColumnToolsSetting(innerEls.value);
8083
+ showColumnToolsSetting(jsonClone(innerEls.value));
8001
8084
  };
8002
8085
  const { userConfig, updateUserConfig } = useUserShowRowConfig(props.els);
8003
8086
  const onSubmitConfig = (config) => {
@@ -8013,9 +8096,6 @@ const _sfc_main$t = defineComponent({
8013
8096
  const onShowUserConfig = () => {
8014
8097
  showUserConfig(userConfig.value);
8015
8098
  };
8016
- const onExportData = () => {
8017
- emit("export");
8018
- };
8019
8099
  const isAllShow = computed({
8020
8100
  get() {
8021
8101
  return innerEls.value.every((item) => !!item.userConfigShow);
@@ -8049,7 +8129,6 @@ const _sfc_main$t = defineComponent({
8049
8129
  return (_ctx, _cache) => {
8050
8130
  const _component_el_checkbox = resolveComponent("el-checkbox");
8051
8131
  const _component_el_icon = resolveComponent("el-icon");
8052
- const _component_el_button = resolveComponent("el-button");
8053
8132
  return openBlock(), createElementBlock(Fragment, null, [
8054
8133
  createElementVNode("div", {
8055
8134
  class: normalizeClass(unref(createBEMName)("header"))
@@ -8133,31 +8212,6 @@ const _sfc_main$t = defineComponent({
8133
8212
  _: 1
8134
8213
  }, 8, ["modelValue", "class"])
8135
8214
  ], 2),
8136
- createElementVNode("div", {
8137
- class: normalizeClass(unref(createBEMName)("actions"))
8138
- }, [
8139
- createVNode(_component_el_button, {
8140
- size: "small",
8141
- link: "",
8142
- onClick: onExportData
8143
- }, {
8144
- default: withCtx(() => [
8145
- createTextVNode("\u5BFC\u51FA\u8868\u683C")
8146
- ]),
8147
- _: 1
8148
- }),
8149
- createVNode(_component_el_button, {
8150
- size: "small",
8151
- link: "",
8152
- type: "primary",
8153
- onClick: onSaveColumns
8154
- }, {
8155
- default: withCtx(() => [
8156
- createTextVNode("\u4FDD\u5B58\u4FEE\u6539")
8157
- ]),
8158
- _: 1
8159
- })
8160
- ], 2),
8161
8215
  unref(isRenderColumnToolsSetting) ? (openBlock(), createBlock(_sfc_main$v, {
8162
8216
  key: 0,
8163
8217
  ref_key: "columnToolsSettingRef",
@@ -8176,16 +8230,15 @@ const _sfc_main$t = defineComponent({
8176
8230
  };
8177
8231
  }
8178
8232
  });
8179
- var ColumnTools$1 = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-1098de7a"]]);
8233
+ var ColumnTools$1 = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-5b551558"]]);
8180
8234
  var index_vue_vue_type_style_index_0_scoped_true_lang$9 = "";
8181
- const _withScopeId$2 = (n) => (pushScopeId("data-v-15dbe923"), n = n(), popScopeId(), n);
8235
+ const _withScopeId$2 = (n) => (pushScopeId("data-v-d12a7d22"), n = n(), popScopeId(), n);
8182
8236
  const _hoisted_1$d = { key: 0 };
8183
- const _hoisted_2$5 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("span", { class: "export-wrod" }, "\u4ECE\u7B2C", -1));
8184
- const _hoisted_3$4 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("span", { class: "export-wrod" }, "\u9875\u5F00\u59CB\u5BFC\u51FA\uFF0C\u6BCF\u9875", -1));
8185
- const _hoisted_4$3 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("span", { class: "export-wrod" }, "\u6761\u6570\u636E", -1));
8186
- const _hoisted_5$2 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("div", null, null, -1));
8187
- const _hoisted_6$2 = { class: "export-columns" };
8188
- const _hoisted_7$2 = { class: "bottom-box" };
8237
+ const _hoisted_2$5 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("span", { class: "export-wrod" }, "\u5BFC\u51FA", -1));
8238
+ const _hoisted_3$4 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("span", { class: "export-wrod" }, "\u6761\u6570\u636E", -1));
8239
+ const _hoisted_4$3 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("div", null, null, -1));
8240
+ const _hoisted_5$2 = { class: "export-columns" };
8241
+ const _hoisted_6$2 = { class: "bottom-box" };
8189
8242
  const _sfc_main$s = defineComponent({
8190
8243
  __name: "index",
8191
8244
  emits: ["closed"],
@@ -8204,15 +8257,13 @@ const _sfc_main$s = defineComponent({
8204
8257
  };
8205
8258
  const formData = reactive({
8206
8259
  filename: getDefaultFileName(),
8207
- pageIndex: 1,
8208
- pageSize: 99999,
8260
+ pageSize: 100,
8209
8261
  fromApi: true,
8210
8262
  exportSelected: false
8211
8263
  });
8212
8264
  const resetFormData = () => {
8213
8265
  formData.filename = getDefaultFileName();
8214
- formData.pageIndex = 1;
8215
- formData.pageSize = 99999;
8266
+ formData.pageSize = 100;
8216
8267
  formData.fromApi = true;
8217
8268
  formData.exportSelected = false;
8218
8269
  };
@@ -8220,6 +8271,8 @@ const _sfc_main$s = defineComponent({
8220
8271
  const libLoading = ref(false);
8221
8272
  const dataLoading = ref(false);
8222
8273
  const libLoadFail = ref(false);
8274
+ const showProgress = ref(false);
8275
+ const apiLoadingProgress = ref(0);
8223
8276
  const loadXlsx = async () => {
8224
8277
  libLoading.value = true;
8225
8278
  loadingText.value = "\u4F9D\u8D56\u52A0\u8F7D\u4E2D";
@@ -8245,43 +8298,85 @@ const _sfc_main$s = defineComponent({
8245
8298
  });
8246
8299
  };
8247
8300
  const doExport = async () => {
8248
- var _a, _b;
8301
+ var _a, _b, _c, _d;
8249
8302
  const manager = tableManager.manager;
8250
8303
  const config = manager.config;
8251
8304
  const method = (_a = config.getMethod) == null ? void 0 : _a.toLowerCase();
8252
- let list = [];
8305
+ const checkedNodes = treeRef.value.getCheckedNodes();
8306
+ const tableEls = checkedNodes.filter((a) => !a.children);
8253
8307
  if (formData.fromApi) {
8254
8308
  try {
8255
8309
  loadingText.value = "\u6570\u636E\u52A0\u8F7D\u4E2D";
8256
8310
  dataLoading.value = true;
8257
8311
  let searchFormManager = manager.searchFormManager;
8312
+ const tableManager2 = manager.tableManager;
8258
8313
  let reqData = manager.getListReqData();
8259
8314
  if ((_b = config.searchForm) == null ? void 0 : _b.beforeSubmit) {
8260
- let result2 = config.searchForm.beforeSubmit.call(searchFormManager, reqData);
8261
- if (result2 instanceof Promise) {
8262
- result2 = await result2;
8315
+ let result = config.searchForm.beforeSubmit.call(searchFormManager, reqData);
8316
+ if (result instanceof Promise) {
8317
+ result = await result;
8263
8318
  }
8264
- if (!result2) {
8319
+ if (!result) {
8265
8320
  return false;
8266
8321
  }
8267
- reqData = result2;
8322
+ reqData = result;
8268
8323
  }
8269
- let reqResult = await PageModelManager.request[method](
8270
- config.getUrl,
8271
- {
8272
- ...reqData,
8273
- pageIndex: formData.pageIndex,
8274
- pageSize: formData.pageSize
8324
+ const exportPageSize = config.table.exportPageSize || 100;
8325
+ const reqPageSize = formData.pageSize;
8326
+ const perTimePageSize = Math.min(reqPageSize, exportPageSize);
8327
+ const requestTimes = Math.ceil(reqPageSize / perTimePageSize);
8328
+ const lastRequestPageSize = reqPageSize - (requestTimes - 1) * perTimePageSize;
8329
+ const depLoadResult = await tableManager2.loadExcelDependence();
8330
+ if (!depLoadResult) {
8331
+ return false;
8332
+ }
8333
+ showProgress.value = true;
8334
+ const { exportEls, excelData, cols } = tableManager2.getExcelDataHeader(tableEls);
8335
+ for (let index2 = 0; index2 < requestTimes; index2++) {
8336
+ apiLoadingProgress.value = Number((index2 / requestTimes * 100).toFixed(2));
8337
+ let reqResult = await PageModelManager.request[method](
8338
+ config.getUrl,
8339
+ {
8340
+ ...reqData,
8341
+ [tableManager2.pageIndexKey]: index2 + 1,
8342
+ [tableManager2.pageSizeKey]: perTimePageSize
8343
+ }
8344
+ );
8345
+ let result = manager.proceessResult(reqResult);
8346
+ let list = result.list;
8347
+ let resultCount = list.length;
8348
+ if (index2 === requestTimes - 1) {
8349
+ list = list.slice(0, lastRequestPageSize);
8275
8350
  }
8276
- );
8277
- var result = manager.proceessResult(reqResult);
8278
- list = result.list;
8351
+ const childrenKey = ((_d = (_c = tableManager2.table.props) == null ? void 0 : _c.treeProps) == null ? void 0 : _d.children) || "children";
8352
+ let exportData = [];
8353
+ if (childrenKey) {
8354
+ exportData = tableManager2.patchChildrenData(list, childrenKey);
8355
+ } else {
8356
+ exportData = list;
8357
+ }
8358
+ tableManager2.insertExcelData(excelData, exportEls, exportData);
8359
+ reqResult = null;
8360
+ result = null;
8361
+ list = null;
8362
+ exportData = null;
8363
+ if (resultCount < perTimePageSize) {
8364
+ apiLoadingProgress.value = 100;
8365
+ break;
8366
+ }
8367
+ }
8368
+ tableManager2.exportDataToExcelByExcelData(formData.filename, excelData, cols, {
8369
+ exportData: [],
8370
+ exportEls
8371
+ });
8372
+ showProgress.value = false;
8279
8373
  } catch (error) {
8280
8374
  ElMessage.warning("\u6570\u636E\u83B7\u53D6\u5931\u8D25!");
8281
8375
  } finally {
8282
8376
  dataLoading.value = false;
8283
8377
  }
8284
8378
  } else {
8379
+ let list = [];
8285
8380
  if (typeof config.table.getExportSelectableData === "function") {
8286
8381
  list = config.table.getExportSelectableData.call(tableManager);
8287
8382
  } else {
@@ -8295,16 +8390,14 @@ const _sfc_main$s = defineComponent({
8295
8390
  ElMessage.info("\u65E0\u5BFC\u51FA\u6570\u636E");
8296
8391
  return false;
8297
8392
  }
8298
- }
8299
- const checkedNodes = treeRef.value.getCheckedNodes();
8300
- const exportEls = checkedNodes.filter((a) => !a.children);
8301
- const exportResult = await tableManager.exportDataToExcel({
8302
- columns: exportEls,
8303
- data: list,
8304
- filename: formData.filename
8305
- });
8306
- if (!exportResult) {
8307
- return false;
8393
+ const exportResult = await tableManager.exportDataToExcel({
8394
+ columns: tableEls,
8395
+ data: list,
8396
+ filename: formData.filename
8397
+ });
8398
+ if (!exportResult) {
8399
+ return false;
8400
+ }
8308
8401
  }
8309
8402
  };
8310
8403
  const show = (data) => {
@@ -8337,24 +8430,27 @@ const _sfc_main$s = defineComponent({
8337
8430
  const _component_el_scrollbar = resolveComponent("el-scrollbar");
8338
8431
  const _component_el_form = resolveComponent("el-form");
8339
8432
  const _component_el_empty = resolveComponent("el-empty");
8433
+ const _component_el_progress = resolveComponent("el-progress");
8340
8434
  const _component_el_button = resolveComponent("el-button");
8341
8435
  const _directive_loading = resolveDirective("loading");
8342
8436
  return openBlock(), createBlock(_sfc_main$D, {
8343
8437
  modelValue: visible.value,
8344
- "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => visible.value = $event),
8438
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => visible.value = $event),
8345
8439
  title: "\u5BFC\u51FA\u8868\u683C\u6570\u636E",
8346
8440
  width: "700px",
8347
8441
  "dialog-props": { appendToBody: true, destroyOnClose: true },
8348
8442
  "dialog-events": {
8349
- closed: onClosed
8443
+ closed: onClosed,
8444
+ closeOnClickModal: false,
8445
+ closeOnPressEscape: false
8350
8446
  }
8351
8447
  }, {
8352
8448
  bottom: withCtx(() => [
8353
- createElementVNode("div", _hoisted_7$2, [
8449
+ createElementVNode("div", _hoisted_6$2, [
8354
8450
  createVNode(_component_el_button, {
8355
- disabled: libLoading.value || libLoadFail.value,
8451
+ disabled: libLoading.value || dataLoading.value,
8356
8452
  type: "info",
8357
- onClick: _cache[5] || (_cache[5] = ($event) => visible.value = false)
8453
+ onClick: _cache[4] || (_cache[4] = ($event) => visible.value = false)
8358
8454
  }, {
8359
8455
  default: withCtx(() => [
8360
8456
  createTextVNode("\u53D6\u6D88")
@@ -8362,7 +8458,7 @@ const _sfc_main$s = defineComponent({
8362
8458
  _: 1
8363
8459
  }, 8, ["disabled"]),
8364
8460
  createVNode(_component_el_button, {
8365
- disabled: libLoading.value || libLoadFail.value,
8461
+ disabled: libLoading.value || libLoadFail.value || dataLoading.value,
8366
8462
  type: "success",
8367
8463
  onClick: doExport
8368
8464
  }, {
@@ -8412,35 +8508,25 @@ const _sfc_main$s = defineComponent({
8412
8508
  ]),
8413
8509
  _: 1
8414
8510
  }, 8, ["disabled"]),
8415
- createVNode(_component_el_radio, {
8416
- label: false,
8417
- disabled: !unref(tableManager).table.selectable
8418
- }, {
8511
+ createVNode(_component_el_radio, { label: false }, {
8419
8512
  default: withCtx(() => [
8420
8513
  createTextVNode("\u8868\u683C\u5F53\u524D\u9875\u6570\u636E")
8421
8514
  ]),
8422
8515
  _: 1
8423
- }, 8, ["disabled"])
8516
+ })
8424
8517
  ]),
8425
8518
  _: 1
8426
8519
  }, 8, ["modelValue"]),
8427
8520
  formData.fromApi ? (openBlock(), createElementBlock("div", _hoisted_1$d, [
8428
8521
  _hoisted_2$5,
8429
- createVNode(_component_el_input_number, {
8430
- modelValue: formData.pageIndex,
8431
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => formData.pageIndex = $event),
8432
- min: 1,
8433
- size: "small"
8434
- }, null, 8, ["modelValue"]),
8435
- _hoisted_3$4,
8436
8522
  createVNode(_component_el_input_number, {
8437
8523
  modelValue: formData.pageSize,
8438
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => formData.pageSize = $event),
8524
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => formData.pageSize = $event),
8439
8525
  min: 1,
8440
8526
  size: "small"
8441
8527
  }, null, 8, ["modelValue"]),
8442
- _hoisted_4$3,
8443
- _hoisted_5$2
8528
+ _hoisted_3$4,
8529
+ _hoisted_4$3
8444
8530
  ])) : createCommentVNode("", true)
8445
8531
  ]),
8446
8532
  _: 1
@@ -8453,7 +8539,7 @@ const _sfc_main$s = defineComponent({
8453
8539
  default: withCtx(() => [
8454
8540
  createVNode(_component_el_radio_group, {
8455
8541
  modelValue: formData.exportSelected,
8456
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => formData.exportSelected = $event)
8542
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => formData.exportSelected = $event)
8457
8543
  }, {
8458
8544
  default: withCtx(() => [
8459
8545
  createVNode(_component_el_radio, { label: false }, {
@@ -8479,7 +8565,7 @@ const _sfc_main$s = defineComponent({
8479
8565
  })) : createCommentVNode("", true),
8480
8566
  createVNode(_component_el_form_item, { label: "\u5BFC\u51FA\u5B57\u6BB5" }, {
8481
8567
  default: withCtx(() => [
8482
- createElementVNode("div", _hoisted_6$2, [
8568
+ createElementVNode("div", _hoisted_5$2, [
8483
8569
  createVNode(_component_el_scrollbar, { height: "100%" }, {
8484
8570
  default: withCtx(() => [
8485
8571
  createVNode(_component_el_tree, {
@@ -8506,14 +8592,22 @@ const _sfc_main$s = defineComponent({
8506
8592
  ]),
8507
8593
  withDirectives(createVNode(_component_el_empty, { description: "\u4F9D\u8D56\u52A0\u8F7D\u5931\u8D25" }, null, 512), [
8508
8594
  [vShow, libLoadFail.value]
8509
- ])
8595
+ ]),
8596
+ showProgress.value ? (openBlock(), createBlock(_component_el_progress, {
8597
+ key: 0,
8598
+ class: "progress-box",
8599
+ "stroke-width": 20,
8600
+ "text-inside": true,
8601
+ striped: "",
8602
+ percentage: apiLoadingProgress.value
8603
+ }, null, 8, ["percentage"])) : createCommentVNode("", true)
8510
8604
  ]),
8511
8605
  _: 1
8512
8606
  }, 8, ["modelValue", "dialog-events"]);
8513
8607
  };
8514
8608
  }
8515
8609
  });
8516
- var ExportForm = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-15dbe923"]]);
8610
+ var ExportForm = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-d12a7d22"]]);
8517
8611
  const SAVE_NAME$2 = "table-columns";
8518
8612
  const columnsSaver$1 = new ConfigSaver(SAVE_NAME$2);
8519
8613
  const saveTableColumns = columnsSaver$1.setContents.bind(columnsSaver$1);
@@ -11876,12 +11970,14 @@ const _sfc_main$8 = defineComponent({
11876
11970
  createElementVNode("div", {
11877
11971
  class: normalizeClass(unref(createBEMName)("input"))
11878
11972
  }, [
11879
- createVNode(_component_el_input, {
11973
+ withDirectives(createVNode(_component_el_input, {
11880
11974
  modelValue: item.value,
11881
11975
  "onUpdate:modelValue": ($event) => item.value = $event,
11882
11976
  placeholder: "\u8BF7\u8F93\u5165",
11883
11977
  clearable: ""
11884
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
11978
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]), [
11979
+ [vShow, !unref(noValueOptions).includes(item.condition)]
11980
+ ])
11885
11981
  ], 2)
11886
11982
  ], 64)) : item.filterType === unref(FilterItemTypeEnum$1).\u6570\u5B57 ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
11887
11983
  createVNode(_component_el_select, {
@@ -11904,13 +12000,15 @@ const _sfc_main$8 = defineComponent({
11904
12000
  createElementVNode("div", {
11905
12001
  class: normalizeClass(unref(createBEMName)("input"))
11906
12002
  }, [
11907
- createVNode(_component_el_input_number, {
12003
+ withDirectives(createVNode(_component_el_input_number, {
11908
12004
  modelValue: item.value,
11909
12005
  "onUpdate:modelValue": ($event) => item.value = $event,
11910
12006
  "controls-position": "right",
11911
12007
  clearable: "",
11912
12008
  placeholder: "\u8BF7\u8F93\u5165"
11913
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
12009
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]), [
12010
+ [vShow, !unref(noValueOptions).includes(item.condition)]
12011
+ ])
11914
12012
  ], 2)
11915
12013
  ], 64)) : item.filterType === unref(FilterItemTypeEnum$1).\u65E5\u671F ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
11916
12014
  createVNode(_component_el_select, {
@@ -11933,13 +12031,15 @@ const _sfc_main$8 = defineComponent({
11933
12031
  createElementVNode("div", {
11934
12032
  class: normalizeClass(unref(createBEMName)("input"))
11935
12033
  }, [
11936
- createVNode(_component_el_date_picker, {
12034
+ withDirectives(createVNode(_component_el_date_picker, {
11937
12035
  modelValue: item.value,
11938
12036
  "onUpdate:modelValue": ($event) => item.value = $event,
11939
12037
  placeholder: "\u8BF7\u9009\u62E9\u65E5\u671F",
11940
12038
  "value-format": "YYYY-MM-DD",
11941
12039
  clearable: ""
11942
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
12040
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]), [
12041
+ [vShow, !unref(noValueOptions).includes(item.condition)]
12042
+ ])
11943
12043
  ], 2)
11944
12044
  ], 64)) : item.filterType === unref(FilterItemTypeEnum$1).\u5E03\u5C14\u503C ? (openBlock(), createElementBlock("div", {
11945
12045
  key: 3,
@@ -12096,7 +12196,7 @@ const _sfc_main$8 = defineComponent({
12096
12196
  };
12097
12197
  }
12098
12198
  });
12099
- var ColumnFilterTools = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-16a43018"]]);
12199
+ var ColumnFilterTools = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-47c894ea"]]);
12100
12200
  var index_vue_vue_type_style_index_0_scoped_true_lang$3 = "";
12101
12201
  const _withScopeId$1 = (n) => (pushScopeId("data-v-4c74a2a2"), n = n(), popScopeId(), n);
12102
12202
  const _hoisted_1$5 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("span", null, "\u8BBE\u7F6E\u6392\u5E8F\u6761\u4EF6", -1));
@@ -14367,7 +14467,7 @@ const defineEditableTable = function(config) {
14367
14467
  };
14368
14468
  var iconfont = "";
14369
14469
  const name = "@juzhenfe/page-model";
14370
- const version = "3.15.1";
14470
+ const version = "3.16.1";
14371
14471
  const types = "dist/main.d.ts";
14372
14472
  const main = "dist/index.umd.js";
14373
14473
  const keywords = [
@@ -14447,4 +14547,4 @@ const ModelComponent = {
14447
14547
  saveTableColumns(content);
14448
14548
  }
14449
14549
  };
14450
- export { ButtonsRenderer, _sfc_main$w as DraggableList, index as EditableTable, _sfc_main$D as FormDialog, _sfc_main$d as FormDrawer, PageModelForm, _sfc_main$A as TableCellRenderer, _sfc_main$v as TableColumnSetting, columnTools, ModelComponent as default, defineConfig, defineEditableTable, defineForm };
14550
+ export { ButtonsRenderer, _sfc_main$w as DraggableList, index as EditableTable, FilterItemTypeEnum$1 as FilterItemTypeEnum, FilterMatchModeEnum$1 as FilterMatchModeEnum, _sfc_main$D as FormDialog, _sfc_main$d as FormDrawer, PageModelForm, _sfc_main$A as TableCellRenderer, _sfc_main$v as TableColumnSetting, columnTools, ModelComponent as default, defineConfig, defineEditableTable, defineForm, updateCompareNoValueOptions, updateCompareOptions };