ol-base-components 3.6.1 → 3.6.3
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.mjs +109 -27
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +10 -2
package/dist/index.mjs
CHANGED
|
@@ -13800,7 +13800,7 @@ var render$2 = function() {
|
|
|
13800
13800
|
}) : _vm._e(), _vm._v(" " + _vm._s(btn.title) + " ")]);
|
|
13801
13801
|
}), _vm._t("toolbarAfter", null, null, _vm.toolbarSlotScope)], 2), _c("div", {
|
|
13802
13802
|
staticClass: "crud-toolbar-right"
|
|
13803
|
-
}, [_vm._t("toolbarActions", null, null, _vm.toolbarSlotScope), _vm.$cfg("showColumnFilterBtn") ? [_vm.
|
|
13803
|
+
}, [_vm._t("toolbarActions", null, null, _vm.toolbarSlotScope), _vm.$cfg("showColumnFilterBtn") ? [_vm.resolvedColumnConfigMode === "simple" ? _c("el-dropdown", {
|
|
13804
13804
|
staticClass: "crud-toolbar-action",
|
|
13805
13805
|
attrs: {
|
|
13806
13806
|
"trigger": "click"
|
|
@@ -13926,11 +13926,6 @@ var render$2 = function() {
|
|
|
13926
13926
|
})], null, true)
|
|
13927
13927
|
})];
|
|
13928
13928
|
})], _vm.operates && _vm.operates.length > 0 ? _c("el-table-column", _vm._b({
|
|
13929
|
-
attrs: {
|
|
13930
|
-
"label": "操作",
|
|
13931
|
-
"align": "center",
|
|
13932
|
-
"min-width": _vm.operatesMinWidth
|
|
13933
|
-
},
|
|
13934
13929
|
scopedSlots: _vm._u([{
|
|
13935
13930
|
key: "default",
|
|
13936
13931
|
fn: function(_ref2) {
|
|
@@ -13956,7 +13951,11 @@ var render$2 = function() {
|
|
|
13956
13951
|
})], 2)];
|
|
13957
13952
|
}
|
|
13958
13953
|
}], null, false, 2917153455)
|
|
13959
|
-
}, "el-table-column",
|
|
13954
|
+
}, "el-table-column", Object.assign({
|
|
13955
|
+
label: "操作",
|
|
13956
|
+
align: "center",
|
|
13957
|
+
minWidth: _vm.operatesMinWidth
|
|
13958
|
+
}, _vm.operatesAttrs || {}), false)) : _vm._e(), _c("div", {
|
|
13960
13959
|
staticClass: "crud-empty",
|
|
13961
13960
|
attrs: {
|
|
13962
13961
|
"slot": "empty"
|
|
@@ -13969,7 +13968,7 @@ var render$2 = function() {
|
|
|
13969
13968
|
}, [_c("el-pagination", {
|
|
13970
13969
|
attrs: {
|
|
13971
13970
|
"current-page": _vm.displayPagination.page,
|
|
13972
|
-
"page-sizes": _vm.
|
|
13971
|
+
"page-sizes": _vm.resolvedPageSizes,
|
|
13973
13972
|
"page-size": _vm.displayPagination.limit,
|
|
13974
13973
|
"total": _vm.displayPagination.total,
|
|
13975
13974
|
"layout": "total, sizes, prev, pager, next, jumper"
|
|
@@ -13978,7 +13977,7 @@ var render$2 = function() {
|
|
|
13978
13977
|
"size-change": _vm.onSizeChange,
|
|
13979
13978
|
"current-change": _vm.onPageChange
|
|
13980
13979
|
}
|
|
13981
|
-
})], 1) : _vm._e(), _vm.
|
|
13980
|
+
})], 1) : _vm._e(), _vm.resolvedColumnConfigMode === "persisted" ? _c("ol-column-config", {
|
|
13982
13981
|
attrs: {
|
|
13983
13982
|
"visible": _vm.columnConfigVisible,
|
|
13984
13983
|
"columns": _vm.columnsForConfig,
|
|
@@ -13996,7 +13995,7 @@ var render$2 = function() {
|
|
|
13996
13995
|
attrs: {
|
|
13997
13996
|
"visible": _vm.entityChangeVisible,
|
|
13998
13997
|
"selected-rows": _vm.currentSelection,
|
|
13999
|
-
"page-params": _vm.
|
|
13998
|
+
"page-params": _vm.resolvedPageParams
|
|
14000
13999
|
},
|
|
14001
14000
|
on: {
|
|
14002
14001
|
"update:visible": function($event) {
|
|
@@ -14020,7 +14019,15 @@ var render$2 = function() {
|
|
|
14020
14019
|
var staticRenderFns$2 = [];
|
|
14021
14020
|
const index_vue_vue_type_style_index_0_scoped_true_lang$1 = "";
|
|
14022
14021
|
const index_vue_vue_type_style_index_1_lang$1 = "";
|
|
14023
|
-
const DATE_TYPES = [
|
|
14022
|
+
const DATE_TYPES = [
|
|
14023
|
+
"date",
|
|
14024
|
+
"datetime",
|
|
14025
|
+
"daterange",
|
|
14026
|
+
"datetimerange",
|
|
14027
|
+
"month",
|
|
14028
|
+
"monthrange",
|
|
14029
|
+
"year"
|
|
14030
|
+
];
|
|
14024
14031
|
const newFieldToOld = (field) => ({
|
|
14025
14032
|
...field,
|
|
14026
14033
|
value: field.prop,
|
|
@@ -14196,7 +14203,11 @@ const __vue2_script$2 = {
|
|
|
14196
14203
|
fetchingData: false,
|
|
14197
14204
|
// 自动请求模式下的内部数据存储
|
|
14198
14205
|
internalTableData: [],
|
|
14199
|
-
internalPagination: {
|
|
14206
|
+
internalPagination: {
|
|
14207
|
+
page: 1,
|
|
14208
|
+
limit: this.$olBaseConfig && this.$olBaseConfig.pagination && this.$olBaseConfig.pagination.limit || 30,
|
|
14209
|
+
total: 0
|
|
14210
|
+
},
|
|
14200
14211
|
// 打印数据
|
|
14201
14212
|
printListObj: { title: "", tableHeader: [], tableData: [] },
|
|
14202
14213
|
// 列配置弹窗(persisted 模式)
|
|
@@ -14209,9 +14220,45 @@ const __vue2_script$2 = {
|
|
|
14209
14220
|
};
|
|
14210
14221
|
},
|
|
14211
14222
|
computed: {
|
|
14212
|
-
/**
|
|
14223
|
+
/** 实际请求方式(三级优先级:prop > $olBaseConfig > 默认 'get') */
|
|
14213
14224
|
finalMethod() {
|
|
14214
|
-
|
|
14225
|
+
if (this.$options.propsData && "method" in this.$options.propsData) {
|
|
14226
|
+
return this.method;
|
|
14227
|
+
}
|
|
14228
|
+
const base = this.$olBaseConfig || {};
|
|
14229
|
+
if (base.method !== void 0)
|
|
14230
|
+
return base.method;
|
|
14231
|
+
return "get";
|
|
14232
|
+
},
|
|
14233
|
+
/** 列配置模式(三级优先级) */
|
|
14234
|
+
resolvedColumnConfigMode() {
|
|
14235
|
+
if (this.$options.propsData && "columnConfigMode" in this.$options.propsData) {
|
|
14236
|
+
return this.columnConfigMode;
|
|
14237
|
+
}
|
|
14238
|
+
const base = this.$olBaseConfig || {};
|
|
14239
|
+
if (base.columnConfigMode !== void 0)
|
|
14240
|
+
return base.columnConfigMode;
|
|
14241
|
+
return this.columnConfigMode;
|
|
14242
|
+
},
|
|
14243
|
+
/** 分页参数名映射(三级优先级) */
|
|
14244
|
+
resolvedPageParams() {
|
|
14245
|
+
if (this.$options.propsData && "pageParams" in this.$options.propsData) {
|
|
14246
|
+
return this.pageParams;
|
|
14247
|
+
}
|
|
14248
|
+
const base = this.$olBaseConfig || {};
|
|
14249
|
+
if (base.pageParams !== void 0)
|
|
14250
|
+
return base.pageParams;
|
|
14251
|
+
return this.pageParams;
|
|
14252
|
+
},
|
|
14253
|
+
/** 每页条数选项(三级优先级) */
|
|
14254
|
+
resolvedPageSizes() {
|
|
14255
|
+
if (this.$options.propsData && "pageSizes" in this.$options.propsData) {
|
|
14256
|
+
return this.pageSizes;
|
|
14257
|
+
}
|
|
14258
|
+
const base = this.$olBaseConfig || {};
|
|
14259
|
+
if (base.pageSizes !== void 0)
|
|
14260
|
+
return base.pageSizes;
|
|
14261
|
+
return this.pageSizes;
|
|
14215
14262
|
},
|
|
14216
14263
|
/** 是否启用内部数据管理(自动模式有 url,手动模式有 fetchData) */
|
|
14217
14264
|
shouldAutoFetch() {
|
|
@@ -14373,7 +14420,7 @@ const __vue2_script$2 = {
|
|
|
14373
14420
|
},
|
|
14374
14421
|
async mounted() {
|
|
14375
14422
|
this.syncColumnSlots();
|
|
14376
|
-
if (this.$cfg("showColumnFilterBtn") && this.
|
|
14423
|
+
if (this.$cfg("showColumnFilterBtn") && this.resolvedColumnConfigMode === "persisted") {
|
|
14377
14424
|
await this.loadColumnConfig();
|
|
14378
14425
|
}
|
|
14379
14426
|
if (this.$cfg("showCustomSearch")) {
|
|
@@ -14486,7 +14533,11 @@ const __vue2_script$2 = {
|
|
|
14486
14533
|
manualField.prop = userProp;
|
|
14487
14534
|
} else {
|
|
14488
14535
|
this.searchFields.push(swaggerField);
|
|
14489
|
-
this.$set(
|
|
14536
|
+
this.$set(
|
|
14537
|
+
this.internalSearchModel,
|
|
14538
|
+
swaggerField.prop,
|
|
14539
|
+
swaggerField.defaultValue != null ? swaggerField.defaultValue : null
|
|
14540
|
+
);
|
|
14490
14541
|
}
|
|
14491
14542
|
});
|
|
14492
14543
|
this.autoDetectRangeTimeFields(parameters);
|
|
@@ -14662,7 +14713,11 @@ const __vue2_script$2 = {
|
|
|
14662
14713
|
type: "datetimerange",
|
|
14663
14714
|
visible: true,
|
|
14664
14715
|
defaultValue: null,
|
|
14665
|
-
props: {
|
|
14716
|
+
props: {
|
|
14717
|
+
valueFormat: "yyyy-MM-dd HH:mm:ss",
|
|
14718
|
+
format: "yyyy/MM/dd HH:mm:ss",
|
|
14719
|
+
defaultTime: ["00:00:00", "23:59:59"]
|
|
14720
|
+
},
|
|
14666
14721
|
originalFields: { begin: "BeginTime", end: "EndTime" }
|
|
14667
14722
|
});
|
|
14668
14723
|
}
|
|
@@ -14683,7 +14738,11 @@ const __vue2_script$2 = {
|
|
|
14683
14738
|
type: "datetimerange",
|
|
14684
14739
|
visible: true,
|
|
14685
14740
|
defaultValue: null,
|
|
14686
|
-
props: {
|
|
14741
|
+
props: {
|
|
14742
|
+
valueFormat: "yyyy-MM-dd HH:mm:ss",
|
|
14743
|
+
format: "yyyy/MM/dd HH:mm:ss",
|
|
14744
|
+
defaultTime: ["00:00:00", "23:59:59"]
|
|
14745
|
+
},
|
|
14687
14746
|
originalFields: { begin: beginParam.name, end: endName }
|
|
14688
14747
|
});
|
|
14689
14748
|
const rmBeginIdx = searchFields.findIndex((f2) => f2.prop === beginParam.name);
|
|
@@ -14697,11 +14756,14 @@ const __vue2_script$2 = {
|
|
|
14697
14756
|
});
|
|
14698
14757
|
toAdd.forEach((f2) => {
|
|
14699
14758
|
searchFields.push(f2);
|
|
14700
|
-
this.$set(this.internalSearchModel, f2.prop, f2.defaultValue
|
|
14759
|
+
this.$set(this.internalSearchModel, f2.prop, f2.defaultValue != null ? f2.defaultValue : null);
|
|
14701
14760
|
});
|
|
14702
14761
|
if (toAdd.length) {
|
|
14703
14762
|
this.initSearchDefaults();
|
|
14704
|
-
console.log(
|
|
14763
|
+
console.log(
|
|
14764
|
+
`\x1B[36m\x1B[4mol-crud 自动识别日期范围字段`,
|
|
14765
|
+
toAdd.map((f2) => f2.prop)
|
|
14766
|
+
);
|
|
14705
14767
|
}
|
|
14706
14768
|
},
|
|
14707
14769
|
// ===================== 搜索 =====================
|
|
@@ -14779,7 +14841,7 @@ const __vue2_script$2 = {
|
|
|
14779
14841
|
async fetchList() {
|
|
14780
14842
|
if (!this.shouldAutoFetch)
|
|
14781
14843
|
return;
|
|
14782
|
-
const { page: pageKey, limit: limitKey } = this.
|
|
14844
|
+
const { page: pageKey, limit: limitKey } = this.resolvedPageParams || {};
|
|
14783
14845
|
const page = this.internalPagination.page;
|
|
14784
14846
|
const limit = this.internalPagination.limit;
|
|
14785
14847
|
const { cleanParams } = this.buildSearchParams();
|
|
@@ -14818,7 +14880,9 @@ const __vue2_script$2 = {
|
|
|
14818
14880
|
if (!apiUrl)
|
|
14819
14881
|
return;
|
|
14820
14882
|
if (typeof this.get !== "function" && typeof this.post !== "function") {
|
|
14821
|
-
console.warn(
|
|
14883
|
+
console.warn(
|
|
14884
|
+
"[ol-crud] 未找到 this.get/this.post,无法自动拉取数据,请使用 fetchData 或手动传入 tableData"
|
|
14885
|
+
);
|
|
14822
14886
|
return;
|
|
14823
14887
|
}
|
|
14824
14888
|
let params;
|
|
@@ -14882,7 +14946,7 @@ const __vue2_script$2 = {
|
|
|
14882
14946
|
}
|
|
14883
14947
|
const result = response && response.result || response || {};
|
|
14884
14948
|
const rows = result.items || result.records || result.list || result.data || [];
|
|
14885
|
-
const total = result.total
|
|
14949
|
+
const total = result.total != null ? result.total : result.totalCount != null ? result.totalCount : result.count != null ? result.count : rows.length != null ? rows.length : 0;
|
|
14886
14950
|
if (Array.isArray(result)) {
|
|
14887
14951
|
return { rows: result, total: result.length };
|
|
14888
14952
|
}
|
|
@@ -15029,12 +15093,30 @@ const __vue2_script$2 = {
|
|
|
15029
15093
|
});
|
|
15030
15094
|
};
|
|
15031
15095
|
walkUser(this.columns);
|
|
15032
|
-
const sorted = [...fields].sort(
|
|
15096
|
+
const sorted = [...fields].sort(
|
|
15097
|
+
(a2, b2) => (a2.order != null ? a2.order : 0) - (b2.order != null ? b2.order : 0)
|
|
15098
|
+
);
|
|
15033
15099
|
const apiColumns = sorted.map((f2) => {
|
|
15034
15100
|
const user = userColMap[f2.fieldName];
|
|
15035
|
-
const base = {
|
|
15101
|
+
const base = {
|
|
15102
|
+
prop: f2.fieldName,
|
|
15103
|
+
label: f2.displayName || f2.fieldName,
|
|
15104
|
+
show: f2.isVisible !== false,
|
|
15105
|
+
fixed: f2.isFixed || false,
|
|
15106
|
+
sortable: false
|
|
15107
|
+
};
|
|
15036
15108
|
if (user) {
|
|
15037
|
-
return {
|
|
15109
|
+
return {
|
|
15110
|
+
...base,
|
|
15111
|
+
render: user.render,
|
|
15112
|
+
renderSlot: user.renderSlot,
|
|
15113
|
+
sortable: user.sortable,
|
|
15114
|
+
attrs: user.attrs,
|
|
15115
|
+
width: user.width,
|
|
15116
|
+
minWidth: user.minWidth,
|
|
15117
|
+
children: user.children,
|
|
15118
|
+
enumName: f2.enumName || user.enumName
|
|
15119
|
+
};
|
|
15038
15120
|
}
|
|
15039
15121
|
return { ...base, enumName: f2.enumName || void 0 };
|
|
15040
15122
|
});
|
|
@@ -15258,7 +15340,7 @@ var __component__$2 = /* @__PURE__ */ normalizeComponent(
|
|
|
15258
15340
|
staticRenderFns$2,
|
|
15259
15341
|
false,
|
|
15260
15342
|
__vue2_injectStyles$2,
|
|
15261
|
-
"
|
|
15343
|
+
"6f1e4166",
|
|
15262
15344
|
null,
|
|
15263
15345
|
null
|
|
15264
15346
|
);
|