@weitutech/by-components 1.1.44 → 1.1.46
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/lib/by-components.common.js +500 -331
- package/lib/by-components.umd.js +528 -359
- package/lib/by-components.umd.min.js +1 -1
- package/package.json +1 -1
|
@@ -60535,7 +60535,7 @@ if (typeof window !== 'undefined') {
|
|
|
60535
60535
|
var es_iterator_constructor = __webpack_require__(8111);
|
|
60536
60536
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.for-each.js
|
|
60537
60537
|
var es_iterator_for_each = __webpack_require__(7588);
|
|
60538
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
60538
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"268ca57a-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/pager/index.vue?vue&type=template&id=43bb822c
|
|
60539
60539
|
var render = function render() {
|
|
60540
60540
|
var _vm = this,
|
|
60541
60541
|
_c = _vm._self._c;
|
|
@@ -60742,8 +60742,8 @@ var component = normalizeComponent(
|
|
|
60742
60742
|
)
|
|
60743
60743
|
|
|
60744
60744
|
/* harmony default export */ var pager = (component.exports);
|
|
60745
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
60746
|
-
var
|
|
60745
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"268ca57a-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/table/index.vue?vue&type=template&id=849a6584
|
|
60746
|
+
var tablevue_type_template_id_849a6584_render = function render() {
|
|
60747
60747
|
var _vm = this,
|
|
60748
60748
|
_c = _vm._self._c;
|
|
60749
60749
|
return _c('div', [_c('vxe-grid', _vm._g(_vm._b({
|
|
@@ -60807,6 +60807,7 @@ var tablevue_type_template_id_58d17823_render = function render() {
|
|
|
60807
60807
|
attrs: {
|
|
60808
60808
|
"info-method": _vm.gridOptions.customColumnConfig.infoMethod,
|
|
60809
60809
|
"submit-method": _vm.gridOptions.customColumnConfig.submitMethod,
|
|
60810
|
+
"fixed-max-count": _vm.gridOptions.customColumnConfig.fixedMaxCount,
|
|
60810
60811
|
"dialog-visible": _vm.customTableVisible
|
|
60811
60812
|
},
|
|
60812
60813
|
on: {
|
|
@@ -60816,7 +60817,7 @@ var tablevue_type_template_id_58d17823_render = function render() {
|
|
|
60816
60817
|
}
|
|
60817
60818
|
}) : _vm._e()], 1);
|
|
60818
60819
|
};
|
|
60819
|
-
var
|
|
60820
|
+
var tablevue_type_template_id_849a6584_staticRenderFns = [];
|
|
60820
60821
|
|
|
60821
60822
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
|
|
60822
60823
|
var es_array_push = __webpack_require__(4114);
|
|
@@ -60836,8 +60837,8 @@ var es_set_is_superset_of_v2 = __webpack_require__(2475);
|
|
|
60836
60837
|
var es_set_symmetric_difference_v2 = __webpack_require__(5024);
|
|
60837
60838
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.union.v2.js
|
|
60838
60839
|
var es_set_union_v2 = __webpack_require__(1698);
|
|
60839
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
60840
|
-
var
|
|
60840
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"268ca57a-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/custom-column/index.vue?vue&type=template&id=22c5acce
|
|
60841
|
+
var custom_columnvue_type_template_id_22c5acce_render = function render() {
|
|
60841
60842
|
var _vm = this,
|
|
60842
60843
|
_c = _vm._self._c;
|
|
60843
60844
|
return _c('div', {
|
|
@@ -61038,7 +61039,7 @@ var custom_columnvue_type_template_id_6ff46ecd_render = function render() {
|
|
|
61038
61039
|
}) : _vm._e()]);
|
|
61039
61040
|
}), 0)], 1)], 1)], 1)])])])], 1);
|
|
61040
61041
|
};
|
|
61041
|
-
var
|
|
61042
|
+
var custom_columnvue_type_template_id_22c5acce_staticRenderFns = [];
|
|
61042
61043
|
|
|
61043
61044
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
|
|
61044
61045
|
var es_iterator_filter = __webpack_require__(2489);
|
|
@@ -61087,6 +61088,324 @@ const deepClone = target => {
|
|
|
61087
61088
|
// 返回最终结果
|
|
61088
61089
|
return result;
|
|
61089
61090
|
};
|
|
61091
|
+
;// ./src/utils/tableUtils.js
|
|
61092
|
+
|
|
61093
|
+
|
|
61094
|
+
|
|
61095
|
+
|
|
61096
|
+
|
|
61097
|
+
|
|
61098
|
+
/**
|
|
61099
|
+
* 判断是否缓存了表格列宽
|
|
61100
|
+
* @param {*} name 表格名称
|
|
61101
|
+
* @returns
|
|
61102
|
+
*/
|
|
61103
|
+
const isCachedTableColumns = name => {
|
|
61104
|
+
if (!name) return false;
|
|
61105
|
+
return !!localStorage.getItem(name);
|
|
61106
|
+
};
|
|
61107
|
+
|
|
61108
|
+
/**
|
|
61109
|
+
* 删除表格列宽缓存
|
|
61110
|
+
* @param {*} name 表格名称
|
|
61111
|
+
*/
|
|
61112
|
+
const removeCachedTableColumns = name => {
|
|
61113
|
+
localStorage.removeItem(name);
|
|
61114
|
+
};
|
|
61115
|
+
|
|
61116
|
+
/**
|
|
61117
|
+
* 缓存列宽
|
|
61118
|
+
* @param {*} name 表格名称
|
|
61119
|
+
* @param {*} context
|
|
61120
|
+
*/
|
|
61121
|
+
const saveCachedColumns = (name, context) => {
|
|
61122
|
+
if (!name) return;
|
|
61123
|
+
// 获取列宽信息
|
|
61124
|
+
const collectColumn = context.$table.collectColumn;
|
|
61125
|
+
// 获取已缓存的列宽数据
|
|
61126
|
+
const cachedColumns = getCachedColumns(name);
|
|
61127
|
+
|
|
61128
|
+
// 递归查找并更新列宽
|
|
61129
|
+
const updateColumnWidth = (columns, targetField, newWidth) => {
|
|
61130
|
+
const result = [];
|
|
61131
|
+
for (const col of columns) {
|
|
61132
|
+
if (col.children) {
|
|
61133
|
+
const updatedChildren = updateColumnWidth(col.children, targetField, newWidth);
|
|
61134
|
+
if (updatedChildren.length > 0) {
|
|
61135
|
+
result.push({
|
|
61136
|
+
field: col.field,
|
|
61137
|
+
width: newWidth,
|
|
61138
|
+
children: updatedChildren
|
|
61139
|
+
});
|
|
61140
|
+
}
|
|
61141
|
+
} else if (targetField && targetField !== '' && col.field === targetField) {
|
|
61142
|
+
//如果没设置field不缓存
|
|
61143
|
+
result.push({
|
|
61144
|
+
field: col.field,
|
|
61145
|
+
width: newWidth
|
|
61146
|
+
});
|
|
61147
|
+
}
|
|
61148
|
+
}
|
|
61149
|
+
return result;
|
|
61150
|
+
};
|
|
61151
|
+
|
|
61152
|
+
//当前拖动的列
|
|
61153
|
+
const currentColumn = context.column;
|
|
61154
|
+
|
|
61155
|
+
// 更新被拖动列的宽度(只缓存被拖动的列)
|
|
61156
|
+
const updatedColumns = updateColumnWidth(collectColumn, currentColumn.field, currentColumn.renderWidth);
|
|
61157
|
+
|
|
61158
|
+
// 合并新的列宽信息到缓存中
|
|
61159
|
+
const mergeColumns = (newColumns, cachedColumns) => {
|
|
61160
|
+
const result = [...cachedColumns];
|
|
61161
|
+
for (const newCol of newColumns) {
|
|
61162
|
+
const existingIndex = result.findIndex(col => col.field === newCol.field);
|
|
61163
|
+
if (existingIndex !== -1) {
|
|
61164
|
+
// 如果存在子列,递归合并
|
|
61165
|
+
if (newCol.children && result[existingIndex].children) {
|
|
61166
|
+
result[existingIndex].children = mergeColumns(newCol.children, result[existingIndex].children);
|
|
61167
|
+
} else {
|
|
61168
|
+
// 更新宽度
|
|
61169
|
+
result[existingIndex].width = newCol.width;
|
|
61170
|
+
}
|
|
61171
|
+
} else {
|
|
61172
|
+
// 添加新的列信息
|
|
61173
|
+
result.push(newCol);
|
|
61174
|
+
}
|
|
61175
|
+
}
|
|
61176
|
+
return result;
|
|
61177
|
+
};
|
|
61178
|
+
|
|
61179
|
+
// 合并并保存更新后的列宽数据
|
|
61180
|
+
const finalColumns = mergeColumns(updatedColumns, cachedColumns);
|
|
61181
|
+
|
|
61182
|
+
//缓存列宽
|
|
61183
|
+
localStorage.setItem(name, JSON.stringify(finalColumns));
|
|
61184
|
+
};
|
|
61185
|
+
|
|
61186
|
+
/**
|
|
61187
|
+
* 获取列宽缓存
|
|
61188
|
+
* @param {*} name 表格名称
|
|
61189
|
+
* @returns
|
|
61190
|
+
*/
|
|
61191
|
+
const getCachedColumns = name => {
|
|
61192
|
+
return JSON.parse(localStorage.getItem(name) || '[]');
|
|
61193
|
+
};
|
|
61194
|
+
|
|
61195
|
+
/**
|
|
61196
|
+
* 替换列宽 - 表格列数据替换成缓存中的列宽(若有列宽缓存)
|
|
61197
|
+
* @param {*} name
|
|
61198
|
+
* @param {*} columns
|
|
61199
|
+
* @returns
|
|
61200
|
+
*/
|
|
61201
|
+
const replaceColumnWidthToColumns = (name, columns) => {
|
|
61202
|
+
if (!name) {
|
|
61203
|
+
return columns;
|
|
61204
|
+
}
|
|
61205
|
+
const cacheColumns = getCachedColumns(name);
|
|
61206
|
+
if (!cacheColumns) {
|
|
61207
|
+
return columns;
|
|
61208
|
+
}
|
|
61209
|
+
|
|
61210
|
+
// 递归处理多级表头的列宽
|
|
61211
|
+
const processColumnWidth = (columns, cacheColumns) => {
|
|
61212
|
+
return columns.map(column => {
|
|
61213
|
+
if (column.children) {
|
|
61214
|
+
const cacheColumn = cacheColumns.find(col => col.field === column.field);
|
|
61215
|
+
return {
|
|
61216
|
+
...column,
|
|
61217
|
+
...((cacheColumn === null || cacheColumn === void 0 ? void 0 : cacheColumn.width) && {
|
|
61218
|
+
width: cacheColumn.width
|
|
61219
|
+
}),
|
|
61220
|
+
children: processColumnWidth(column.children, (cacheColumn === null || cacheColumn === void 0 ? void 0 : cacheColumn.children) || [])
|
|
61221
|
+
};
|
|
61222
|
+
}
|
|
61223
|
+
const cacheColumn = cacheColumns.filter(col => col.field && col.field !== '') //有设置field才替换width给列
|
|
61224
|
+
.find(col => col.field === column.field);
|
|
61225
|
+
return {
|
|
61226
|
+
...column,
|
|
61227
|
+
...((cacheColumn === null || cacheColumn === void 0 ? void 0 : cacheColumn.width) && {
|
|
61228
|
+
width: cacheColumn.width
|
|
61229
|
+
})
|
|
61230
|
+
};
|
|
61231
|
+
});
|
|
61232
|
+
};
|
|
61233
|
+
return processColumnWidth(columns, cacheColumns);
|
|
61234
|
+
};
|
|
61235
|
+
|
|
61236
|
+
/**
|
|
61237
|
+
* 重写列宽 (v3是否要替换这个方法的逻辑???)
|
|
61238
|
+
* @param fromColumns 原始列
|
|
61239
|
+
* @param toColumns 目标列
|
|
61240
|
+
* @returns 重写后的列
|
|
61241
|
+
*/
|
|
61242
|
+
const rewriteWidthColumns = (fromColumns, toColumns) => {
|
|
61243
|
+
if (!fromColumns || !toColumns) return [];
|
|
61244
|
+
if (!fromColumns || fromColumns.length === 0) return toColumns;
|
|
61245
|
+
const result = [];
|
|
61246
|
+
for (const col of toColumns) {
|
|
61247
|
+
const fromCol = fromColumns.find(from => from.field === col.field);
|
|
61248
|
+
if (col.children) {
|
|
61249
|
+
// 递归处理子列
|
|
61250
|
+
const newCol = {
|
|
61251
|
+
...col,
|
|
61252
|
+
children: rewriteWidthColumns((fromCol === null || fromCol === void 0 ? void 0 : fromCol.children) || [], col.children)
|
|
61253
|
+
};
|
|
61254
|
+
// 如果 fromCol 有 width,则添加 width,否则不添加 width 字段
|
|
61255
|
+
if (fromCol) {
|
|
61256
|
+
if (fromCol !== null && fromCol !== void 0 && fromCol.width) {
|
|
61257
|
+
newCol.width = fromCol.width;
|
|
61258
|
+
} else {
|
|
61259
|
+
delete newCol.width;
|
|
61260
|
+
}
|
|
61261
|
+
}
|
|
61262
|
+
result.push(newCol);
|
|
61263
|
+
} else {
|
|
61264
|
+
const newCol = {
|
|
61265
|
+
...col
|
|
61266
|
+
};
|
|
61267
|
+
// 如果 fromCol 有 width,则添加 width,否则不添加 width 字段
|
|
61268
|
+
if (fromCol) {
|
|
61269
|
+
if (fromCol !== null && fromCol !== void 0 && fromCol.width) {
|
|
61270
|
+
newCol.width = fromCol.width;
|
|
61271
|
+
} else {
|
|
61272
|
+
delete newCol.width;
|
|
61273
|
+
}
|
|
61274
|
+
}
|
|
61275
|
+
result.push(newCol);
|
|
61276
|
+
}
|
|
61277
|
+
}
|
|
61278
|
+
return result;
|
|
61279
|
+
};
|
|
61280
|
+
|
|
61281
|
+
/**
|
|
61282
|
+
* 递归增加slot
|
|
61283
|
+
* @param {*} fields 字段信息
|
|
61284
|
+
* @param {*} slotSet 收集的slot
|
|
61285
|
+
*/
|
|
61286
|
+
const recursiveSlot = (fields, slotSet) => {
|
|
61287
|
+
if (!fields || !Array.isArray(fields)) {
|
|
61288
|
+
return;
|
|
61289
|
+
}
|
|
61290
|
+
fields.forEach(col => {
|
|
61291
|
+
if (col.slots) {
|
|
61292
|
+
const slots = Object.values(col.slots);
|
|
61293
|
+
slots.forEach(slot => slotSet.add(slot));
|
|
61294
|
+
}
|
|
61295
|
+
if (col.children) {
|
|
61296
|
+
recursiveSlot(col.children, slotSet);
|
|
61297
|
+
}
|
|
61298
|
+
});
|
|
61299
|
+
};
|
|
61300
|
+
|
|
61301
|
+
/**
|
|
61302
|
+
* 为表格创建分组列结构(将固定列按一级表头分组) -- 有二级表头情况
|
|
61303
|
+
* @param columns 原始列分组数据
|
|
61304
|
+
* @param fixed_max_count 固定列最大数量
|
|
61305
|
+
*/
|
|
61306
|
+
const groupedColumnsForTable = (columns, fixed_max_count = 6) => {
|
|
61307
|
+
let fixedCount = 0; // 先统计所有固定列的数量
|
|
61308
|
+
columns.forEach(group => {
|
|
61309
|
+
group.data.forEach(col => {
|
|
61310
|
+
if (col.fixed === 'left' && ['true', true, '1', 1].includes(col.type)) {
|
|
61311
|
+
fixedCount++;
|
|
61312
|
+
}
|
|
61313
|
+
});
|
|
61314
|
+
});
|
|
61315
|
+
|
|
61316
|
+
//如果固定列数量>固定列最大数量,直接返回原始分组结构,但去除所有fixed属性
|
|
61317
|
+
if (fixedCount > fixed_max_count) {
|
|
61318
|
+
//超过fixed_max_count个固定列,取消所有固定
|
|
61319
|
+
const result = columns.map(group => ({
|
|
61320
|
+
...group,
|
|
61321
|
+
fixed: undefined,
|
|
61322
|
+
data: group.data.map(col => ({
|
|
61323
|
+
...col,
|
|
61324
|
+
fixed: undefined
|
|
61325
|
+
}))
|
|
61326
|
+
}));
|
|
61327
|
+
return result;
|
|
61328
|
+
}
|
|
61329
|
+
|
|
61330
|
+
// 固定列数量<=6个时,才进行重新分组
|
|
61331
|
+
const fixedGroups = [];
|
|
61332
|
+
const normalGroups = [];
|
|
61333
|
+
columns.forEach(group => {
|
|
61334
|
+
const fixedItems = [];
|
|
61335
|
+
const normalItems = [];
|
|
61336
|
+
group.data.forEach(col => {
|
|
61337
|
+
if (col.fixed === 'left') {
|
|
61338
|
+
fixedItems.push(col);
|
|
61339
|
+
} else {
|
|
61340
|
+
normalItems.push(col);
|
|
61341
|
+
}
|
|
61342
|
+
});
|
|
61343
|
+
|
|
61344
|
+
// 如果有固定的列,加入固定分组
|
|
61345
|
+
if (fixedItems.length > 0) {
|
|
61346
|
+
fixedGroups.push({
|
|
61347
|
+
label: group.label,
|
|
61348
|
+
fixed: 'left',
|
|
61349
|
+
data: fixedItems
|
|
61350
|
+
});
|
|
61351
|
+
}
|
|
61352
|
+
|
|
61353
|
+
// 如果有普通列,加入普通分组
|
|
61354
|
+
if (normalItems.length > 0) {
|
|
61355
|
+
normalGroups.push({
|
|
61356
|
+
label: group.label,
|
|
61357
|
+
data: normalItems
|
|
61358
|
+
});
|
|
61359
|
+
}
|
|
61360
|
+
});
|
|
61361
|
+
const result = [...fixedGroups, ...normalGroups];
|
|
61362
|
+
|
|
61363
|
+
// 将固定分组添加到最前面
|
|
61364
|
+
return result;
|
|
61365
|
+
};
|
|
61366
|
+
|
|
61367
|
+
/**
|
|
61368
|
+
* 判断左侧固定个数,决定是否左侧固定还是取消固定 -- 无二级表头情况
|
|
61369
|
+
* @param {*} cols 列数据
|
|
61370
|
+
* @param {*} fixed_max_count 固定列最大数量
|
|
61371
|
+
* @returns
|
|
61372
|
+
*/
|
|
61373
|
+
const resetFixedColumns = (cols, fixed_max_count = 6) => {
|
|
61374
|
+
if (!cols) return [];
|
|
61375
|
+
let fixedCount = 0;
|
|
61376
|
+
cols.forEach(col => {
|
|
61377
|
+
if (col.fixed === 'left' && ['true', true, '1', 1].includes(col.type)) {
|
|
61378
|
+
fixedCount++;
|
|
61379
|
+
}
|
|
61380
|
+
});
|
|
61381
|
+
if (fixedCount > fixed_max_count) {
|
|
61382
|
+
cols.map(item => {
|
|
61383
|
+
item.fixed = false;
|
|
61384
|
+
});
|
|
61385
|
+
}
|
|
61386
|
+
return cols;
|
|
61387
|
+
};
|
|
61388
|
+
|
|
61389
|
+
// 判空
|
|
61390
|
+
const isNullValue = value => {
|
|
61391
|
+
if (value === null || value === undefined) {
|
|
61392
|
+
return true;
|
|
61393
|
+
}
|
|
61394
|
+
if (Number.isNaN(value)) {
|
|
61395
|
+
return true;
|
|
61396
|
+
}
|
|
61397
|
+
if (value === '' || value === 0) {
|
|
61398
|
+
return true;
|
|
61399
|
+
}
|
|
61400
|
+
if (typeof value === 'object' && Object.keys(value).length === 0) {
|
|
61401
|
+
return true;
|
|
61402
|
+
}
|
|
61403
|
+
if (Array.isArray(value) && value.length === 0) {
|
|
61404
|
+
return true;
|
|
61405
|
+
}
|
|
61406
|
+
return false;
|
|
61407
|
+
};
|
|
61408
|
+
|
|
61090
61409
|
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/custom-column/index.vue?vue&type=script&lang=js
|
|
61091
61410
|
|
|
61092
61411
|
|
|
@@ -61098,6 +61417,7 @@ const deepClone = target => {
|
|
|
61098
61417
|
|
|
61099
61418
|
|
|
61100
61419
|
|
|
61420
|
+
|
|
61101
61421
|
/* harmony default export */ var custom_columnvue_type_script_lang_js = ({
|
|
61102
61422
|
name: 'CustomColumn',
|
|
61103
61423
|
components: {
|
|
@@ -61117,6 +61437,14 @@ const deepClone = target => {
|
|
|
61117
61437
|
type: Function,
|
|
61118
61438
|
required: true,
|
|
61119
61439
|
default: () => {}
|
|
61440
|
+
},
|
|
61441
|
+
//左侧固定列最多个数 - 默认6个 (超出个数时,左侧固定失效)
|
|
61442
|
+
fixedMaxCount: {
|
|
61443
|
+
type: Number,
|
|
61444
|
+
default: 6,
|
|
61445
|
+
validator: value => {
|
|
61446
|
+
return value >= 0;
|
|
61447
|
+
}
|
|
61120
61448
|
}
|
|
61121
61449
|
},
|
|
61122
61450
|
data() {
|
|
@@ -61223,7 +61551,7 @@ const deepClone = target => {
|
|
|
61223
61551
|
this.checkBoxMenu = this.deepClone(initColumn);
|
|
61224
61552
|
this.draggableMenu = setDraggableMenu(this.checkBoxMenu);
|
|
61225
61553
|
} else {
|
|
61226
|
-
console.log('==========从未被保存过', initColumn)
|
|
61554
|
+
// console.log('==========从未被保存过', initColumn)
|
|
61227
61555
|
|
|
61228
61556
|
// 从未被保存过
|
|
61229
61557
|
let num = 0;
|
|
@@ -61245,12 +61573,8 @@ const deepClone = target => {
|
|
|
61245
61573
|
this.checkBoxMenu = this.deepClone(initColumn);
|
|
61246
61574
|
this.draggableMenu = setDraggableMenu(this.checkBoxMenu);
|
|
61247
61575
|
}
|
|
61248
|
-
this
|
|
61249
|
-
|
|
61250
|
-
// changeTableGroup 回调:对固定列进行重新分组
|
|
61251
|
-
const groupedColumns = this.createGroupedColumnsForTable(this.checkBoxMenu);
|
|
61252
|
-
this.$emit('changeTableGroup', groupedColumns);
|
|
61253
|
-
// this.$emit('changeTableGroup', this.checkBoxMenu)
|
|
61576
|
+
this.emitChangeTable(this.draggableMenu.filter(item => item.key !== 'sort-cut-off').sort((a, b) => a.sort - b.sort));
|
|
61577
|
+
this.emitChangeTableGroup(this.checkBoxMenu);
|
|
61254
61578
|
},
|
|
61255
61579
|
// 全不选
|
|
61256
61580
|
selectNone() {
|
|
@@ -61340,96 +61664,35 @@ const deepClone = target => {
|
|
|
61340
61664
|
}
|
|
61341
61665
|
});
|
|
61342
61666
|
} else {
|
|
61343
|
-
params.column.push({
|
|
61344
|
-
label: parent.label,
|
|
61345
|
-
data: [other]
|
|
61346
|
-
});
|
|
61347
|
-
}
|
|
61348
|
-
}
|
|
61349
|
-
});
|
|
61350
|
-
await this.submitMethod(params);
|
|
61351
|
-
|
|
61352
|
-
// changeTable 回调:返回正常排序的列数据
|
|
61353
|
-
const cols = [];
|
|
61354
|
-
params.column.forEach(item => {
|
|
61355
|
-
cols.push(...item.data);
|
|
61356
|
-
});
|
|
61357
|
-
this.$emit('changeTable', cols.sort((a, b) => a.sort - b.sort));
|
|
61358
|
-
|
|
61359
|
-
// changeTableGroup 回调:对固定列进行重新分组
|
|
61360
|
-
const groupedColumns = this.createGroupedColumnsForTable(params.column);
|
|
61361
|
-
this.$emit('changeTableGroup', groupedColumns);
|
|
61362
|
-
this.closeDialog();
|
|
61363
|
-
},
|
|
61364
|
-
/**
|
|
61365
|
-
* 为表格创建分组列结构(将固定列按一级表头分组)
|
|
61366
|
-
* @param columns 原始列分组数据
|
|
61367
|
-
*/
|
|
61368
|
-
createGroupedColumnsForTable(columns) {
|
|
61369
|
-
console.log('==========columns', columns);
|
|
61370
|
-
|
|
61371
|
-
// 先统计所有固定列的数量
|
|
61372
|
-
let fixedCount = 0;
|
|
61373
|
-
columns.forEach(group => {
|
|
61374
|
-
group.data.forEach(col => {
|
|
61375
|
-
if (col.fixed === 'left' && ['true', true, '1', 1].includes(col.type)) {
|
|
61376
|
-
fixedCount++;
|
|
61377
|
-
}
|
|
61378
|
-
});
|
|
61379
|
-
});
|
|
61380
|
-
console.log('==========固定列个数:', fixedCount);
|
|
61381
|
-
|
|
61382
|
-
// *** 如果固定列数量>6个,直接返回原始分组结构,但去除所有fixed属性 start
|
|
61383
|
-
if (fixedCount > 6) {
|
|
61384
|
-
const result = columns.map(group => ({
|
|
61385
|
-
...group,
|
|
61386
|
-
fixed: undefined,
|
|
61387
|
-
data: group.data.map(col => ({
|
|
61388
|
-
...col,
|
|
61389
|
-
fixed: undefined
|
|
61390
|
-
}))
|
|
61391
|
-
}));
|
|
61392
|
-
console.log('==========超过6个固定列,取消所有固定:', result);
|
|
61393
|
-
return result;
|
|
61394
|
-
}
|
|
61395
|
-
// *** 如果固定列数量>6个,直接返回原始分组结构,但去除所有fixed属性 end
|
|
61396
|
-
|
|
61397
|
-
// 固定列数量<=6个时,才进行重新分组
|
|
61398
|
-
const fixedGroups = [];
|
|
61399
|
-
const normalGroups = [];
|
|
61400
|
-
columns.forEach(group => {
|
|
61401
|
-
const fixedItems = [];
|
|
61402
|
-
const normalItems = [];
|
|
61403
|
-
group.data.forEach(col => {
|
|
61404
|
-
if (col.fixed === 'left') {
|
|
61405
|
-
fixedItems.push(col);
|
|
61406
|
-
} else {
|
|
61407
|
-
normalItems.push(col);
|
|
61408
|
-
}
|
|
61409
|
-
});
|
|
61410
|
-
|
|
61411
|
-
// 如果有固定的列,加入固定分组
|
|
61412
|
-
if (fixedItems.length > 0) {
|
|
61413
|
-
fixedGroups.push({
|
|
61414
|
-
label: group.label,
|
|
61415
|
-
fixed: 'left',
|
|
61416
|
-
data: fixedItems
|
|
61417
|
-
});
|
|
61418
|
-
}
|
|
61419
|
-
|
|
61420
|
-
// 如果有普通列,加入普通分组
|
|
61421
|
-
if (normalItems.length > 0) {
|
|
61422
|
-
normalGroups.push({
|
|
61423
|
-
label: group.label,
|
|
61424
|
-
data: normalItems
|
|
61425
|
-
});
|
|
61667
|
+
params.column.push({
|
|
61668
|
+
label: parent.label,
|
|
61669
|
+
data: [other]
|
|
61670
|
+
});
|
|
61671
|
+
}
|
|
61426
61672
|
}
|
|
61427
61673
|
});
|
|
61428
|
-
|
|
61429
|
-
console.log('==========<=6个固定列,正常分组:', result);
|
|
61674
|
+
await this.submitMethod(params);
|
|
61430
61675
|
|
|
61431
|
-
//
|
|
61432
|
-
|
|
61676
|
+
// changeTable 回调:返回正常排序的列数据
|
|
61677
|
+
const cols = [];
|
|
61678
|
+
params.column.forEach(item => {
|
|
61679
|
+
cols.push(...item.data);
|
|
61680
|
+
});
|
|
61681
|
+
this.emitChangeTable(cols.sort((a, b) => a.sort - b.sort));
|
|
61682
|
+
this.emitChangeTableGroup(params.column);
|
|
61683
|
+
this.closeDialog();
|
|
61684
|
+
},
|
|
61685
|
+
// changeTable
|
|
61686
|
+
emitChangeTable(cols) {
|
|
61687
|
+
//表头左侧固定逻辑(对固定列fixed重新赋值)
|
|
61688
|
+
const reCols = resetFixedColumns(cols, this.fixedMaxCount);
|
|
61689
|
+
this.$emit('changeTable', reCols);
|
|
61690
|
+
},
|
|
61691
|
+
// changeTableGroup
|
|
61692
|
+
emitChangeTableGroup(cols) {
|
|
61693
|
+
//表头左侧固定逻辑(对固定列进行重新分组)
|
|
61694
|
+
const groupedCols = groupedColumnsForTable(cols, this.fixedMaxCount);
|
|
61695
|
+
this.$emit('changeTableGroup', groupedCols);
|
|
61433
61696
|
},
|
|
61434
61697
|
// 关闭弹窗
|
|
61435
61698
|
closeDialog() {
|
|
@@ -61452,8 +61715,8 @@ const deepClone = target => {
|
|
|
61452
61715
|
;
|
|
61453
61716
|
var custom_column_component = normalizeComponent(
|
|
61454
61717
|
components_custom_columnvue_type_script_lang_js,
|
|
61455
|
-
|
|
61456
|
-
|
|
61718
|
+
custom_columnvue_type_template_id_22c5acce_render,
|
|
61719
|
+
custom_columnvue_type_template_id_22c5acce_staticRenderFns,
|
|
61457
61720
|
false,
|
|
61458
61721
|
null,
|
|
61459
61722
|
null,
|
|
@@ -61462,216 +61725,6 @@ var custom_column_component = normalizeComponent(
|
|
|
61462
61725
|
)
|
|
61463
61726
|
|
|
61464
61727
|
/* harmony default export */ var custom_column = (custom_column_component.exports);
|
|
61465
|
-
;// ./src/utils/tableUtils.js
|
|
61466
|
-
|
|
61467
|
-
|
|
61468
|
-
|
|
61469
|
-
|
|
61470
|
-
|
|
61471
|
-
|
|
61472
|
-
/**
|
|
61473
|
-
* 判断是否缓存了表格列宽
|
|
61474
|
-
* @param {*} name 表格名称
|
|
61475
|
-
* @returns
|
|
61476
|
-
*/
|
|
61477
|
-
const isCachedTableColumns = name => {
|
|
61478
|
-
if (!name) return false;
|
|
61479
|
-
return !!localStorage.getItem(name);
|
|
61480
|
-
};
|
|
61481
|
-
|
|
61482
|
-
/**
|
|
61483
|
-
* 删除表格列宽缓存
|
|
61484
|
-
* @param {*} name 表格名称
|
|
61485
|
-
*/
|
|
61486
|
-
const removeCachedTableColumns = name => {
|
|
61487
|
-
localStorage.removeItem(name);
|
|
61488
|
-
};
|
|
61489
|
-
|
|
61490
|
-
/**
|
|
61491
|
-
* 缓存列宽
|
|
61492
|
-
* @param {*} name 表格名称
|
|
61493
|
-
* @param {*} context
|
|
61494
|
-
*/
|
|
61495
|
-
const saveCachedColumns = (name, context) => {
|
|
61496
|
-
if (!name) return;
|
|
61497
|
-
// 获取列宽信息
|
|
61498
|
-
const collectColumn = context.$table.collectColumn;
|
|
61499
|
-
// 获取已缓存的列宽数据
|
|
61500
|
-
const cachedColumns = getCachedColumns(name);
|
|
61501
|
-
|
|
61502
|
-
// 递归查找并更新列宽
|
|
61503
|
-
const updateColumnWidth = (columns, targetField, newWidth) => {
|
|
61504
|
-
const result = [];
|
|
61505
|
-
for (const col of columns) {
|
|
61506
|
-
if (col.children) {
|
|
61507
|
-
const updatedChildren = updateColumnWidth(col.children, targetField, newWidth);
|
|
61508
|
-
if (updatedChildren.length > 0) {
|
|
61509
|
-
result.push({
|
|
61510
|
-
field: col.field,
|
|
61511
|
-
width: newWidth,
|
|
61512
|
-
children: updatedChildren
|
|
61513
|
-
});
|
|
61514
|
-
}
|
|
61515
|
-
} else if (targetField && targetField !== '' && col.field === targetField) {
|
|
61516
|
-
//如果没设置field不缓存
|
|
61517
|
-
result.push({
|
|
61518
|
-
field: col.field,
|
|
61519
|
-
width: newWidth
|
|
61520
|
-
});
|
|
61521
|
-
}
|
|
61522
|
-
}
|
|
61523
|
-
return result;
|
|
61524
|
-
};
|
|
61525
|
-
|
|
61526
|
-
//当前拖动的列
|
|
61527
|
-
const currentColumn = context.column;
|
|
61528
|
-
|
|
61529
|
-
// 更新被拖动列的宽度(只缓存被拖动的列)
|
|
61530
|
-
const updatedColumns = updateColumnWidth(collectColumn, currentColumn.field, currentColumn.renderWidth);
|
|
61531
|
-
|
|
61532
|
-
// 合并新的列宽信息到缓存中
|
|
61533
|
-
const mergeColumns = (newColumns, cachedColumns) => {
|
|
61534
|
-
const result = [...cachedColumns];
|
|
61535
|
-
for (const newCol of newColumns) {
|
|
61536
|
-
const existingIndex = result.findIndex(col => col.field === newCol.field);
|
|
61537
|
-
if (existingIndex !== -1) {
|
|
61538
|
-
// 如果存在子列,递归合并
|
|
61539
|
-
if (newCol.children && result[existingIndex].children) {
|
|
61540
|
-
result[existingIndex].children = mergeColumns(newCol.children, result[existingIndex].children);
|
|
61541
|
-
} else {
|
|
61542
|
-
// 更新宽度
|
|
61543
|
-
result[existingIndex].width = newCol.width;
|
|
61544
|
-
}
|
|
61545
|
-
} else {
|
|
61546
|
-
// 添加新的列信息
|
|
61547
|
-
result.push(newCol);
|
|
61548
|
-
}
|
|
61549
|
-
}
|
|
61550
|
-
return result;
|
|
61551
|
-
};
|
|
61552
|
-
|
|
61553
|
-
// 合并并保存更新后的列宽数据
|
|
61554
|
-
const finalColumns = mergeColumns(updatedColumns, cachedColumns);
|
|
61555
|
-
|
|
61556
|
-
//缓存列宽
|
|
61557
|
-
localStorage.setItem(name, JSON.stringify(finalColumns));
|
|
61558
|
-
};
|
|
61559
|
-
|
|
61560
|
-
/**
|
|
61561
|
-
* 获取列宽缓存
|
|
61562
|
-
* @param {*} name 表格名称
|
|
61563
|
-
* @returns
|
|
61564
|
-
*/
|
|
61565
|
-
const getCachedColumns = name => {
|
|
61566
|
-
return JSON.parse(localStorage.getItem(name) || '[]');
|
|
61567
|
-
};
|
|
61568
|
-
|
|
61569
|
-
/**
|
|
61570
|
-
* 替换列宽 - 表格列数据替换成缓存中的列宽(若有列宽缓存)
|
|
61571
|
-
* @param {*} name
|
|
61572
|
-
* @param {*} columns
|
|
61573
|
-
* @returns
|
|
61574
|
-
*/
|
|
61575
|
-
const replaceColumnWidthToColumns = (name, columns) => {
|
|
61576
|
-
if (!name) {
|
|
61577
|
-
return columns;
|
|
61578
|
-
}
|
|
61579
|
-
const cacheColumns = getCachedColumns(name);
|
|
61580
|
-
if (!cacheColumns) {
|
|
61581
|
-
return columns;
|
|
61582
|
-
}
|
|
61583
|
-
|
|
61584
|
-
// 递归处理多级表头的列宽
|
|
61585
|
-
const processColumnWidth = (columns, cacheColumns) => {
|
|
61586
|
-
return columns.map(column => {
|
|
61587
|
-
if (column.children) {
|
|
61588
|
-
const cacheColumn = cacheColumns.find(col => col.field === column.field);
|
|
61589
|
-
return {
|
|
61590
|
-
...column,
|
|
61591
|
-
...((cacheColumn === null || cacheColumn === void 0 ? void 0 : cacheColumn.width) && {
|
|
61592
|
-
width: cacheColumn.width
|
|
61593
|
-
}),
|
|
61594
|
-
children: processColumnWidth(column.children, (cacheColumn === null || cacheColumn === void 0 ? void 0 : cacheColumn.children) || [])
|
|
61595
|
-
};
|
|
61596
|
-
}
|
|
61597
|
-
const cacheColumn = cacheColumns.filter(col => col.field && col.field !== '') //有设置field才替换width给列
|
|
61598
|
-
.find(col => col.field === column.field);
|
|
61599
|
-
return {
|
|
61600
|
-
...column,
|
|
61601
|
-
...((cacheColumn === null || cacheColumn === void 0 ? void 0 : cacheColumn.width) && {
|
|
61602
|
-
width: cacheColumn.width
|
|
61603
|
-
})
|
|
61604
|
-
};
|
|
61605
|
-
});
|
|
61606
|
-
};
|
|
61607
|
-
return processColumnWidth(columns, cacheColumns);
|
|
61608
|
-
};
|
|
61609
|
-
|
|
61610
|
-
/**
|
|
61611
|
-
* 重写列宽 (v3是否要替换这个方法的逻辑???)
|
|
61612
|
-
* @param fromColumns 原始列
|
|
61613
|
-
* @param toColumns 目标列
|
|
61614
|
-
* @returns 重写后的列
|
|
61615
|
-
*/
|
|
61616
|
-
const rewriteWidthColumns = (fromColumns, toColumns) => {
|
|
61617
|
-
if (!fromColumns || !toColumns) return [];
|
|
61618
|
-
if (!fromColumns || fromColumns.length === 0) return toColumns;
|
|
61619
|
-
const result = [];
|
|
61620
|
-
for (const col of toColumns) {
|
|
61621
|
-
const fromCol = fromColumns.find(from => from.field === col.field);
|
|
61622
|
-
if (col.children) {
|
|
61623
|
-
// 递归处理子列
|
|
61624
|
-
const newCol = {
|
|
61625
|
-
...col,
|
|
61626
|
-
children: rewriteWidthColumns((fromCol === null || fromCol === void 0 ? void 0 : fromCol.children) || [], col.children)
|
|
61627
|
-
};
|
|
61628
|
-
// 如果 fromCol 有 width,则添加 width,否则不添加 width 字段
|
|
61629
|
-
if (fromCol) {
|
|
61630
|
-
if (fromCol !== null && fromCol !== void 0 && fromCol.width) {
|
|
61631
|
-
newCol.width = fromCol.width;
|
|
61632
|
-
} else {
|
|
61633
|
-
delete newCol.width;
|
|
61634
|
-
}
|
|
61635
|
-
}
|
|
61636
|
-
result.push(newCol);
|
|
61637
|
-
} else {
|
|
61638
|
-
const newCol = {
|
|
61639
|
-
...col
|
|
61640
|
-
};
|
|
61641
|
-
// 如果 fromCol 有 width,则添加 width,否则不添加 width 字段
|
|
61642
|
-
if (fromCol) {
|
|
61643
|
-
if (fromCol !== null && fromCol !== void 0 && fromCol.width) {
|
|
61644
|
-
newCol.width = fromCol.width;
|
|
61645
|
-
} else {
|
|
61646
|
-
delete newCol.width;
|
|
61647
|
-
}
|
|
61648
|
-
}
|
|
61649
|
-
result.push(newCol);
|
|
61650
|
-
}
|
|
61651
|
-
}
|
|
61652
|
-
return result;
|
|
61653
|
-
};
|
|
61654
|
-
|
|
61655
|
-
/**
|
|
61656
|
-
* 递归增加slot
|
|
61657
|
-
* @param {*} fields 字段信息
|
|
61658
|
-
* @param {*} slotSet 收集的slot
|
|
61659
|
-
*/
|
|
61660
|
-
const recursiveSlot = (fields, slotSet) => {
|
|
61661
|
-
if (!fields || !Array.isArray(fields)) {
|
|
61662
|
-
return;
|
|
61663
|
-
}
|
|
61664
|
-
fields.forEach(col => {
|
|
61665
|
-
if (col.slots) {
|
|
61666
|
-
const slots = Object.values(col.slots);
|
|
61667
|
-
slots.forEach(slot => slotSet.add(slot));
|
|
61668
|
-
}
|
|
61669
|
-
if (col.children) {
|
|
61670
|
-
recursiveSlot(col.children, slotSet);
|
|
61671
|
-
}
|
|
61672
|
-
});
|
|
61673
|
-
};
|
|
61674
|
-
|
|
61675
61728
|
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/table/index.vue?vue&type=script&lang=js
|
|
61676
61729
|
|
|
61677
61730
|
|
|
@@ -61693,6 +61746,34 @@ const recursiveSlot = (fields, slotSet) => {
|
|
|
61693
61746
|
CustomColumn: custom_column
|
|
61694
61747
|
},
|
|
61695
61748
|
props: {
|
|
61749
|
+
/**
|
|
61750
|
+
* 表格配置项
|
|
61751
|
+
* @property {Object} pagerConfig - 分页配置
|
|
61752
|
+
* @property {number} pagerConfig.currentPage - 当前页码
|
|
61753
|
+
* @property {number} pagerConfig.pageSize - 每页条数
|
|
61754
|
+
* @property {number} pagerConfig.total - 总条数
|
|
61755
|
+
* @property {number[]} pagerConfig.pageSizes - 每页条数选项
|
|
61756
|
+
* @property {boolean} pagerConfig.frontendPagination - 是否启用前端分页
|
|
61757
|
+
* @property {Array} columns - 表格列配置
|
|
61758
|
+
* @property {Object} customColumnConfig - 自定义列配置
|
|
61759
|
+
* @property {boolean} customColumnConfig.showCustomColumn - 是否显示自定义列按钮
|
|
61760
|
+
* @property {Function} customColumnConfig.infoMethod - 获取自定义列信息的方法
|
|
61761
|
+
* @property {Function} customColumnConfig.submitMethod - 提交自定义列配置的方法
|
|
61762
|
+
* @property {number} customColumnConfig.fixedMaxCount - 固定列最大数量
|
|
61763
|
+
* @property {Array} customColumnConfig.slots - 自定义插槽配置
|
|
61764
|
+
* @property {Object} resizableConfig - 列宽调整配置
|
|
61765
|
+
* @property {number} resizableConfig.minWidth - 最小列宽
|
|
61766
|
+
* @property {Object} rowConfig - 行配置
|
|
61767
|
+
* @property {number} rowConfig.height - 行高
|
|
61768
|
+
* @property {boolean} rowConfig.isHover - 是否显示hover效果
|
|
61769
|
+
* @property {Object} sortConfig - 排序配置
|
|
61770
|
+
* @property {boolean} sortConfig.remote - 是否远程排序
|
|
61771
|
+
* @property {string} sortConfig.trigger - 排序触发方式
|
|
61772
|
+
* @property {Array} copyFields - 可复制字段列表
|
|
61773
|
+
* @property {string} emptyText - 空数据提示文本
|
|
61774
|
+
* @property {Object} loadingConfig - 加载配置
|
|
61775
|
+
* @property {string} loadingConfig.text - 加载提示文本
|
|
61776
|
+
*/
|
|
61696
61777
|
gridOptions: {
|
|
61697
61778
|
type: Object,
|
|
61698
61779
|
default: () => ({})
|
|
@@ -61722,7 +61803,10 @@ const recursiveSlot = (fields, slotSet) => {
|
|
|
61722
61803
|
hasCache: false,
|
|
61723
61804
|
// 原始列配置
|
|
61724
61805
|
originColumns: [],
|
|
61725
|
-
tempColumns: []
|
|
61806
|
+
tempColumns: [],
|
|
61807
|
+
// 存储所有数据(用于前端分页)
|
|
61808
|
+
allData: [],
|
|
61809
|
+
tableLoading: false
|
|
61726
61810
|
};
|
|
61727
61811
|
},
|
|
61728
61812
|
mounted() {
|
|
@@ -61738,10 +61822,33 @@ const recursiveSlot = (fields, slotSet) => {
|
|
|
61738
61822
|
this.originColumns = result;
|
|
61739
61823
|
},
|
|
61740
61824
|
deep: true
|
|
61825
|
+
},
|
|
61826
|
+
'gridOptions.data': {
|
|
61827
|
+
handler() {
|
|
61828
|
+
this.$nextTick(() => {
|
|
61829
|
+
setTimeout(() => {
|
|
61830
|
+
if (this.$refs.xGrid && this.$refs.xGrid.refreshScroll) {
|
|
61831
|
+
this.$refs.xGrid.refreshScroll(); // 刷新滚动布局
|
|
61832
|
+
}
|
|
61833
|
+
if (this.$refs.xGrid && this.$refs.xGrid.scrollTo) {
|
|
61834
|
+
this.$refs.xGrid.scrollTo({
|
|
61835
|
+
top: 0,
|
|
61836
|
+
left: 0
|
|
61837
|
+
});
|
|
61838
|
+
const tableData = this.$refs.xGrid.getTableData().fullData;
|
|
61839
|
+
if (tableData && tableData.length > 0) {
|
|
61840
|
+
this.$refs.xGrid.scrollToRow(tableData[0]);
|
|
61841
|
+
}
|
|
61842
|
+
}
|
|
61843
|
+
}, 0);
|
|
61844
|
+
});
|
|
61845
|
+
},
|
|
61846
|
+
deep: true
|
|
61741
61847
|
}
|
|
61742
61848
|
},
|
|
61743
61849
|
computed: {
|
|
61744
61850
|
options() {
|
|
61851
|
+
var _others$pagerConfig;
|
|
61745
61852
|
const {
|
|
61746
61853
|
customColumnConfig,
|
|
61747
61854
|
columns,
|
|
@@ -61754,21 +61861,35 @@ const recursiveSlot = (fields, slotSet) => {
|
|
|
61754
61861
|
// 使用列宽缓存值(若有)
|
|
61755
61862
|
const newColumns = replaceColumnWidthToColumns(this.name, columns);
|
|
61756
61863
|
this.setHasCache();
|
|
61864
|
+
|
|
61865
|
+
// 处理前端分页
|
|
61866
|
+
let data = others.data || [];
|
|
61867
|
+
if ((_others$pagerConfig = others.pagerConfig) !== null && _others$pagerConfig !== void 0 && _others$pagerConfig.frontendPagination) {
|
|
61868
|
+
// 保存完整数据
|
|
61869
|
+
this.allData = [...data];
|
|
61870
|
+
data = this.spliteListData(this.allData, others.pagerConfig.currentPage, others.pagerConfig.pageSize);
|
|
61871
|
+
}
|
|
61872
|
+
|
|
61873
|
+
// 移除 others 中的 data,避免覆盖
|
|
61874
|
+
const {
|
|
61875
|
+
data: _,
|
|
61876
|
+
...restOthers
|
|
61877
|
+
} = others;
|
|
61757
61878
|
return {
|
|
61758
61879
|
border: true,
|
|
61759
61880
|
resizable: true,
|
|
61760
61881
|
showOverflow: !this.autoHeight,
|
|
61761
|
-
// 行高自动撑高
|
|
61762
61882
|
height: 550,
|
|
61763
61883
|
align: 'left',
|
|
61764
61884
|
copyFields: [],
|
|
61765
|
-
pagerConfig:
|
|
61885
|
+
pagerConfig: others.pagerConfig,
|
|
61766
61886
|
emptyText: '暂无数据',
|
|
61887
|
+
loading: this.tableLoading,
|
|
61767
61888
|
loadingConfig: {
|
|
61768
61889
|
text: '加载中...'
|
|
61769
61890
|
},
|
|
61770
61891
|
columns: newColumns,
|
|
61771
|
-
|
|
61892
|
+
data,
|
|
61772
61893
|
resizableConfig: {
|
|
61773
61894
|
minWidth: 50,
|
|
61774
61895
|
...this.gridOptions.resizableConfig
|
|
@@ -61782,7 +61903,8 @@ const recursiveSlot = (fields, slotSet) => {
|
|
|
61782
61903
|
remote: true,
|
|
61783
61904
|
trigger: 'cell',
|
|
61784
61905
|
...this.gridOptions.sortConfig
|
|
61785
|
-
}
|
|
61906
|
+
},
|
|
61907
|
+
...restOthers
|
|
61786
61908
|
};
|
|
61787
61909
|
},
|
|
61788
61910
|
// 插槽集合
|
|
@@ -61830,11 +61952,58 @@ const recursiveSlot = (fields, slotSet) => {
|
|
|
61830
61952
|
}
|
|
61831
61953
|
},
|
|
61832
61954
|
pageChange(values) {
|
|
61833
|
-
|
|
61834
|
-
|
|
61835
|
-
|
|
61955
|
+
var _this$gridOptions$pag;
|
|
61956
|
+
// 前端分页
|
|
61957
|
+
if ((_this$gridOptions$pag = this.gridOptions.pagerConfig) !== null && _this$gridOptions$pag !== void 0 && _this$gridOptions$pag.frontendPagination) {
|
|
61958
|
+
this.tableLoading = true;
|
|
61959
|
+
setTimeout(() => {
|
|
61960
|
+
const newData = this.spliteListData(this.allData, values.page, values.limit);
|
|
61961
|
+
this.$refs.xGrid.reloadData(newData);
|
|
61962
|
+
setTimeout(() => {
|
|
61963
|
+
if (this.$refs.xGrid) {
|
|
61964
|
+
this.$refs.xGrid.scrollTo(0, 0);
|
|
61965
|
+
}
|
|
61966
|
+
setTimeout(() => {
|
|
61967
|
+
this.tableLoading = false;
|
|
61968
|
+
}, 0);
|
|
61969
|
+
}, 0);
|
|
61970
|
+
}, 0);
|
|
61971
|
+
} else {
|
|
61972
|
+
if (this.$refs.xGrid) {
|
|
61973
|
+
this.$refs.xGrid.scrollTo(0, 0);
|
|
61974
|
+
}
|
|
61975
|
+
// 只有在后端分页模式下才触发page-change事件
|
|
61976
|
+
this.$emit('page-change', values);
|
|
61977
|
+
}
|
|
61978
|
+
},
|
|
61979
|
+
// 前端分页 - 截取当前页展示数据
|
|
61980
|
+
spliteListData(allData, currentPage, pageSize) {
|
|
61981
|
+
if (!Array.isArray(allData) || allData.length === 0) {
|
|
61982
|
+
return [];
|
|
61983
|
+
}
|
|
61984
|
+
|
|
61985
|
+
// 检查第一条数据是否需要特殊处理
|
|
61986
|
+
const firstRow = allData[0];
|
|
61987
|
+
const specialFirstRow = firstRow && typeof firstRow === 'object' && isNullValue(firstRow.id) ? firstRow : null;
|
|
61988
|
+
|
|
61989
|
+
// 获取实际需要分页的数据(排除特殊的第一条)
|
|
61990
|
+
const normalData = specialFirstRow ? allData.slice(1) : allData;
|
|
61991
|
+
const start = (currentPage - 1) * pageSize;
|
|
61992
|
+
const end = start + pageSize;
|
|
61993
|
+
|
|
61994
|
+
// 更新分页配置
|
|
61995
|
+
this.gridOptions.pagerConfig.currentPage = currentPage;
|
|
61996
|
+
this.gridOptions.pagerConfig.pageSize = pageSize;
|
|
61997
|
+
this.gridOptions.pagerConfig.total = allData.length;
|
|
61998
|
+
|
|
61999
|
+
// 获取当前页数据
|
|
62000
|
+
let currentPageData = normalData.slice(start, end);
|
|
62001
|
+
|
|
62002
|
+
// 如果有特殊的第一条数据,添加到当前页数据的开头
|
|
62003
|
+
if (specialFirstRow) {
|
|
62004
|
+
currentPageData = [specialFirstRow, ...currentPageData];
|
|
61836
62005
|
}
|
|
61837
|
-
|
|
62006
|
+
return currentPageData;
|
|
61838
62007
|
},
|
|
61839
62008
|
copy(text) {
|
|
61840
62009
|
const oInput = document.createElement('input');
|
|
@@ -61944,8 +62113,8 @@ const recursiveSlot = (fields, slotSet) => {
|
|
|
61944
62113
|
;
|
|
61945
62114
|
var table_component = normalizeComponent(
|
|
61946
62115
|
components_tablevue_type_script_lang_js,
|
|
61947
|
-
|
|
61948
|
-
|
|
62116
|
+
tablevue_type_template_id_849a6584_render,
|
|
62117
|
+
tablevue_type_template_id_849a6584_staticRenderFns,
|
|
61949
62118
|
false,
|
|
61950
62119
|
null,
|
|
61951
62120
|
null,
|
|
@@ -61954,7 +62123,7 @@ var table_component = normalizeComponent(
|
|
|
61954
62123
|
)
|
|
61955
62124
|
|
|
61956
62125
|
/* harmony default export */ var table = (table_component.exports);
|
|
61957
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
62126
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"268ca57a-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/form/form.vue?vue&type=template&id=f2397dbe&scoped=true
|
|
61958
62127
|
var formvue_type_template_id_f2397dbe_scoped_true_render = function render() {
|
|
61959
62128
|
var _vm = this,
|
|
61960
62129
|
_c = _vm._self._c;
|
|
@@ -62234,7 +62403,7 @@ var formvue_type_template_id_f2397dbe_scoped_true_render = function render() {
|
|
|
62234
62403
|
};
|
|
62235
62404
|
var formvue_type_template_id_f2397dbe_scoped_true_staticRenderFns = [];
|
|
62236
62405
|
|
|
62237
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
62406
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"268ca57a-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/form/comps/pair-number-input.vue?vue&type=template&id=3344cc16
|
|
62238
62407
|
var pair_number_inputvue_type_template_id_3344cc16_render = function render() {
|
|
62239
62408
|
var _vm = this,
|
|
62240
62409
|
_c = _vm._self._c;
|
|
@@ -62338,7 +62507,7 @@ var pair_number_input_component = normalizeComponent(
|
|
|
62338
62507
|
)
|
|
62339
62508
|
|
|
62340
62509
|
/* harmony default export */ var pair_number_input = (pair_number_input_component.exports);
|
|
62341
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
62510
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"268ca57a-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/form/comps/custom-date-picker.vue?vue&type=template&id=2b63f178
|
|
62342
62511
|
var custom_date_pickervue_type_template_id_2b63f178_render = function render() {
|
|
62343
62512
|
var _vm = this,
|
|
62344
62513
|
_c = _vm._self._c;
|
|
@@ -62753,7 +62922,7 @@ var form_component = normalizeComponent(
|
|
|
62753
62922
|
)
|
|
62754
62923
|
|
|
62755
62924
|
/* harmony default export */ var form_form = (form_component.exports);
|
|
62756
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
62925
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"268ca57a-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/page-search/page-search.vue?vue&type=template&id=feae5b44
|
|
62757
62926
|
var page_searchvue_type_template_id_feae5b44_render = function render() {
|
|
62758
62927
|
var _vm = this,
|
|
62759
62928
|
_c = _vm._self._c;
|
|
@@ -62923,7 +63092,7 @@ var page_search_component = normalizeComponent(
|
|
|
62923
63092
|
)
|
|
62924
63093
|
|
|
62925
63094
|
/* harmony default export */ var page_search = (page_search_component.exports);
|
|
62926
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
63095
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"268ca57a-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/fold-search/index.vue?vue&type=template&id=828bc332
|
|
62927
63096
|
var fold_searchvue_type_template_id_828bc332_render = function render() {
|
|
62928
63097
|
var _vm = this,
|
|
62929
63098
|
_c = _vm._self._c;
|
|
@@ -62999,7 +63168,7 @@ var fold_search_component = normalizeComponent(
|
|
|
62999
63168
|
)
|
|
63000
63169
|
|
|
63001
63170
|
/* harmony default export */ var fold_search = (fold_search_component.exports);
|
|
63002
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
63171
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"268ca57a-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/form/comps/select.vue?vue&type=template&id=2ee8e5b9
|
|
63003
63172
|
var selectvue_type_template_id_2ee8e5b9_render = function render() {
|
|
63004
63173
|
var _vm = this,
|
|
63005
63174
|
_c = _vm._self._c;
|
|
@@ -63209,7 +63378,7 @@ var select_component = normalizeComponent(
|
|
|
63209
63378
|
)
|
|
63210
63379
|
|
|
63211
63380
|
/* harmony default export */ var comps_select = (select_component.exports);
|
|
63212
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
63381
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"268ca57a-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/form/comps/date-picker-range.vue?vue&type=template&id=0ae5d93f
|
|
63213
63382
|
var date_picker_rangevue_type_template_id_0ae5d93f_render = function render() {
|
|
63214
63383
|
var _vm = this,
|
|
63215
63384
|
_c = _vm._self._c;
|