mooho-base-admin-plus 2.10.17 → 2.10.18

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/history.md CHANGED
@@ -188,3 +188,4 @@ mooho-base-admin-plus@2.10.14 - 内嵌表格增加筛选栏按钮插槽
188
188
  mooho-base-admin-plus@2.10.15 - 修复上一版本bug
189
189
  mooho-base-admin-plus@2.10.16 - 修复上一版本bug
190
190
  mooho-base-admin-plus@2.10.17 - 内嵌表格默认增加行数可配置
191
+ mooho-base-admin-plus@2.10.18 - 优化表格、表单、筛选项默认值
@@ -30283,13 +30283,13 @@ const comboSelect = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["render", _sfc_re
30283
30283
  a[this.sourceDataCode] = JSON.parse(this.modelValue).join(","), this.loadDataView(this.source).then(async (r) => {
30284
30284
  if (r.dataView.isCustom) {
30285
30285
  let o = await customModelApi.query(r.dataView.model, a, [this.sourceDataCode, this.sourceDisplayCode]);
30286
- o.data.length > 0 && (this.selected = o.data.map((s) => this.parseData(s, this.sourceDisplayCode)).join(","), console.log("res.data", o.data), this.selectedData = o.data);
30286
+ o.data.length > 0 && (this.selected = o.data.map((s) => this.parseData(s, this.sourceDisplayCode)).join(","), this.selectedData = o.data);
30287
30287
  } else if (r.dataView.isDataSource) {
30288
30288
  let o = await dataSourceApi.query(r.dataView.dataSource, a);
30289
30289
  o.table.length > 0 && (this.selected = o.table.map((s) => this.parseData(s, this.sourceDisplayCode)).join(","), this.selectedData = o.table);
30290
30290
  } else {
30291
30291
  let o = await modelApi.query(r.dataView.model, a, [this.sourceDataCode, this.sourceDisplayCode]);
30292
- o.data.length > 0 && (this.selected = o.data.map((s) => this.parseData(s, this.sourceDisplayCode)).join(","), console.log("res.data", o.data), this.selectedData = o.data);
30292
+ o.data.length > 0 && (this.selected = o.data.map((s) => this.parseData(s, this.sourceDisplayCode)).join(","), this.selectedData = o.data);
30293
30293
  }
30294
30294
  });
30295
30295
  } else {
@@ -33455,6 +33455,29 @@ const columnEdit = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_ren
33455
33455
  return o.forEach((l) => {
33456
33456
  l.value.split(",").some((u) => u.trim() == r.trim()) && (s = l.color);
33457
33457
  }), s;
33458
+ },
33459
+ /**
33460
+ * 获取默认值
33461
+ *
33462
+ * @public
33463
+ */
33464
+ getDefaultData(a = (o, s, l) => this.setData(o, s.code, l), r = (o, s, l) => this.setArrayData(o, s.code, l)) {
33465
+ let o = {};
33466
+ if (this.columns.forEach((s) => {
33467
+ if (s.defaultValue)
33468
+ if (s.defaultValue == "{today}") {
33469
+ let u = (/* @__PURE__ */ new Date()).toISOString().replace(/T.*/, "");
33470
+ a(o, s, new Date(u));
33471
+ } else if (s.defaultValue.startsWith("{today(") && s.defaultValue.endsWith(")}")) {
33472
+ let l = s.defaultValue.substr(7, s.defaultValue.length - 9);
33473
+ a(o, s, format$4(/* @__PURE__ */ new Date(), l));
33474
+ } else s.defaultValue == "{currentUserID}" ? a(o, s, this.info.id) : s.defaultValue == "{currentUser}" ? a(o, s, this.info.name) : s.controlType == "MultiSelect" || s.controlType == "MultiTreeSelect" || s.controlType == "MultiComboSelect" ? r(o, s, s.defaultValue.split(",")) : s.dataType === "Integer" ? a(o, s, parseInt(s.defaultValue)) : s.dataType === "Decimal" ? a(o, s, parseFloat(s.defaultValue)) : s.dataType === "Boolean" && s.defaultValue.toUpperCase == "TRUE" ? a(o, s, !0) : s.dataType === "Boolean" && s.defaultValue.toUpperCase == "FALSE" ? a(o, s, !1) : a(o, s, s.defaultValue);
33475
+ else
33476
+ (s.controlType == "Check" || s.controlType == "Switch") && s.dataType === "Boolean" ? a(o, s, !1) : a(o, s, null);
33477
+ }), this.defaultData)
33478
+ for (let s in this.defaultData)
33479
+ a(o, s, this.defaultData[s]);
33480
+ return o;
33458
33481
  }
33459
33482
  }
33460
33483
  };
@@ -38086,25 +38109,6 @@ const draggable = /* @__PURE__ */ getDefaultExportFromCjs(vuedraggable_umdExport
38086
38109
  r.needClear = !1, r.needRefresh = !1;
38087
38110
  }
38088
38111
  },
38089
- // 获取默认值
38090
- getDefaultData() {
38091
- let a = {};
38092
- this.columns.forEach((r) => {
38093
- if (r.defaultValue)
38094
- if (r.defaultValue == "{today}") {
38095
- let s = (/* @__PURE__ */ new Date()).toISOString().replace(/T.*/, "");
38096
- this.setData(a, r.code, new Date(s));
38097
- } else if (r.defaultValue.startsWith("{today(") && r.defaultValue.endsWith(")}")) {
38098
- let o = r.defaultValue.substr(7, r.defaultValue.length - 9);
38099
- this.setData(a, r.code, format$4(/* @__PURE__ */ new Date(), o));
38100
- } else r.defaultValue == "{currentUserID}" ? this.setData(a, r.code, this.info.id) : r.defaultValue == "{currentUser}" ? this.setData(a, r.code, this.info.name) : r.dataType === "Integer" ? this.setData(a, r.code, parseInt(r.defaultValue)) : r.dataType === "Decimal" ? this.setData(a, r.code, parseFloat(r.defaultValue)) : r.dataType === "Boolean" && r.defaultValue.toUpperCase == "TRUE" ? this.setData(a, r.code, !0) : r.dataType === "Boolean" && r.defaultValue.toUpperCase == "FALSE" ? this.setData(a, r.code, !1) : this.setData(a, r.code, r.defaultValue);
38101
- else
38102
- r.dataType === "Boolean" ? this.setData(a, r.code, !1) : this.setData(a, r.code, null);
38103
- });
38104
- for (let r in this.defaultData)
38105
- this.setData(a, r, this.defaultData[r]);
38106
- return a;
38107
- },
38108
38112
  // 编辑
38109
38113
  edit(a, r) {
38110
38114
  this.$emit("edit", { column: a, index: r });
@@ -40400,17 +40404,10 @@ const modalTable = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["render", _sfc_ren
40400
40404
  computed: {},
40401
40405
  methods: {
40402
40406
  init() {
40403
- let a = this.data;
40404
- this.columns.forEach((r) => {
40405
- if (r.defaultValue)
40406
- if (r.defaultValue == "{today}") {
40407
- let s = (/* @__PURE__ */ new Date()).toISOString().replace(/T.*/, "");
40408
- this.setFilterData(a, r, new Date(s));
40409
- } else if (r.defaultValue.startsWith("{today(") && r.defaultValue.endsWith(")}")) {
40410
- let o = r.defaultValue.substr(7, r.defaultValue.length - 9);
40411
- this.setFilterData(a, r, format$4(/* @__PURE__ */ new Date(), o));
40412
- } else r.defaultValue == "{currentUserID}" ? this.setFilterData(a, r, this.info.id) : r.defaultValue == "{currentUser}" ? this.setFilterData(a, r, this.info.name) : r.dataType === "Integer" ? this.setFilterData(a, r, parseInt(r.defaultValue)) : r.dataType === "Decimal" ? this.setFilterData(a, r, parseFloat(r.defaultValue)) : r.dataType === "Boolean" && r.defaultValue.toUpperCase == "TRUE" ? this.setFilterData(a, r, !0) : r.dataType === "Boolean" && r.defaultValue.toUpperCase == "FALSE" ? this.setFilterData(a, r, !1) : this.setFilterData(a, r, r.defaultValue);
40413
- }), setTimeout(() => {
40407
+ let a = this.getDefaultData(this.setFilterData, this.setArrayFilterData);
40408
+ for (let r in a)
40409
+ this.data[r] = a[r];
40410
+ setTimeout(() => {
40414
40411
  this.initStaticItem(), this.initTrigger(), this.onDataChange();
40415
40412
  });
40416
40413
  },
@@ -41687,29 +41684,6 @@ const tableSetting = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_r
41687
41684
  this.initTab(), this.initStaticItem(), this.initTrigger(), this.onDataChange();
41688
41685
  });
41689
41686
  },
41690
- /**
41691
- * 获取默认值
41692
- *
41693
- * @public
41694
- */
41695
- getDefaultData() {
41696
- let a = {};
41697
- this.columns.forEach((r) => {
41698
- if (r.defaultValue)
41699
- if (r.defaultValue == "{today}") {
41700
- let s = (/* @__PURE__ */ new Date()).toISOString().replace(/T.*/, "");
41701
- this.setData(a, r.code, new Date(s));
41702
- } else if (r.defaultValue.startsWith("{today(") && r.defaultValue.endsWith(")}")) {
41703
- let o = r.defaultValue.substr(7, r.defaultValue.length - 9);
41704
- this.setData(a, r.code, format$4(/* @__PURE__ */ new Date(), o));
41705
- } else r.defaultValue == "{currentUserID}" ? this.setData(a, r.code, this.info.id) : r.defaultValue == "{currentUser}" ? this.setData(a, r.code, this.info.name) : r.dataType === "Integer" ? this.setData(a, r.code, parseInt(r.defaultValue)) : r.dataType === "Decimal" ? this.setData(a, r.code, parseFloat(r.defaultValue)) : r.dataType === "Boolean" && r.defaultValue.toUpperCase == "TRUE" ? this.setData(a, r.code, !0) : r.dataType === "Boolean" && r.defaultValue.toUpperCase == "FALSE" ? this.setData(a, r.code, !1) : this.setData(a, r.code, r.defaultValue);
41706
- else
41707
- (r.controlType == "Check" || r.controlType == "Switch") && r.dataType === "Boolean" ? this.setData(a, r.code, !1) : this.setData(a, r.code, null);
41708
- });
41709
- for (let r in this.defaultData)
41710
- this.setData(a, r, this.defaultData[r]);
41711
- return a;
41712
- },
41713
41687
  /**
41714
41688
  * 重置
41715
41689
  *
@@ -43252,26 +43226,6 @@ const _sfc_main$n = {
43252
43226
  }));
43253
43227
  });
43254
43228
  },
43255
- /**
43256
- * 获取默认值
43257
- *
43258
- * @public
43259
- */
43260
- getDefaultData() {
43261
- let a = {};
43262
- return this.columns.forEach((r) => {
43263
- if (r.defaultValue)
43264
- if (r.defaultValue == "{today}") {
43265
- let s = (/* @__PURE__ */ new Date()).toISOString().replace(/T.*/, "");
43266
- this.setData(a, r.code, new Date(s));
43267
- } else if (r.defaultValue.startsWith("{today(") && r.defaultValue.endsWith(")}")) {
43268
- let o = r.defaultValue.substr(7, r.defaultValue.length - 9);
43269
- this.setData(a, r.code, format$4(/* @__PURE__ */ new Date(), o));
43270
- } else r.defaultValue == "{currentUserID}" ? this.setData(a, r.code, this.info.id) : r.defaultValue == "{currentUser}" ? this.setData(a, r.code, this.info.name) : r.dataType === "Integer" ? this.setData(a, r.code, parseInt(r.defaultValue)) : r.dataType === "Decimal" ? this.setData(a, r.code, parseFloat(r.defaultValue)) : r.dataType === "Boolean" && r.defaultValue.toUpperCase == "TRUE" ? this.setData(a, r.code, !0) : r.dataType === "Boolean" && r.defaultValue.toUpperCase == "FALSE" ? this.setData(a, r.code, !1) : this.setData(a, r.code, r.defaultValue);
43271
- else
43272
- r.dataType === "Boolean" ? this.setData(a, r.code, !1) : this.setData(a, r.code, null);
43273
- }), a;
43274
- },
43275
43229
  /**
43276
43230
  * 添加新行
43277
43231
  *
@@ -43345,7 +43299,7 @@ const _sfc_main$n = {
43345
43299
  if (this.static ? a = this.copy(this.staticData) : a = this.copy(this.data), a.forEach((r) => {
43346
43300
  for (let o in r)
43347
43301
  o.startsWith("_") && delete r[o];
43348
- }), console.log("data", a), this.tableView.adjustEnable) {
43302
+ }), this.tableView.adjustEnable) {
43349
43303
  let r = 0;
43350
43304
  for (let o of a)
43351
43305
  o.orderNo = r, r += 10;
@@ -43862,7 +43816,6 @@ const _sfc_main$n = {
43862
43816
  },
43863
43817
  // 打开弹出表单
43864
43818
  async openModalForm(a, r) {
43865
- console.log("control", a);
43866
43819
  let o;
43867
43820
  a.formView.isCustom ? o = await customModelApi.get(a.formView.model, r) : o = await modelApi.get(a.formView.model, r), a.open(o);
43868
43821
  }
@@ -44684,7 +44637,7 @@ function _sfc_render$n(a, r, o, s, l, u) {
44684
44637
  ], 2)
44685
44638
  ], 2);
44686
44639
  }
44687
- const viewTable = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$n], ["__scopeId", "data-v-89d27d4b"]]), __vite_glob_1_32 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
44640
+ const viewTable = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$n], ["__scopeId", "data-v-4273ba1a"]]), __vite_glob_1_32 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
44688
44641
  __proto__: null,
44689
44642
  default: viewTable
44690
44643
  }, Symbol.toStringTag, { value: "Module" })), _sfc_main$m = {