Browse Source

表格优化提交

main
likunming 11 months ago
parent
commit
5a4ec5fde4
  1. 2
      io.sc.platform.core.frontend/package.json
  2. 14
      io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue
  3. 4
      io.sc.platform.core.frontend/src/platform/components/toolbar/ChildrenBtn.vue
  4. 6
      io.sc.platform.core.frontend/src/platform/components/toolbar/WToolbar.vue

2
io.sc.platform.core.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "platform-core",
"version": "8.1.146",
"version": "8.1.147",
"description": "前端核心包,用于快速构建前端的脚手架",
"//main": "库的主文件",
"main": "dist/platform-core.js",

14
io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue

@ -913,6 +913,7 @@ const state = reactive({
middleHeight: 0, // middle()
columnHeadHeight: 0, //
tableTitleWidth: 0, // title
titleTotalHeight: 0, // title
},
pagination: {
config: {
@ -1192,7 +1193,10 @@ const noDataTrHeightComputed = computed(() => {
(state.refHeightWidth.middleScrollWidth - state.refHeightWidth.middleWidth > 0 ? 15 : 0) -
otherHeight;
return {
height: props.height > 0 ? props.height + 'px' : resultHeight + 'px',
height:
props.height > 0
? props.height - state.refHeightWidth.titleTotalHeight - (state.refHeightWidth.middleScrollWidth - state.refHeightWidth.middleWidth > 0 ? 15 : 0) + 'px'
: resultHeight + 'px',
};
});
const noDataTrColspanComputed = computed(() => {
@ -1267,6 +1271,13 @@ const onResize = () => {
state.refHeightWidth.middleHeight = state.refHeightWidth.columnHeadHeight + scrollHeight;
}
state.refHeightWidth.tableTitleWidth = tableRef.value.$el.getElementsByClassName('_table-title')[0]?.clientWidth;
let titleTotalHeight = tableRef.value.$el.getElementsByTagName('thead')[0].offsetHeight;
// top
if (table.rows.length === 0) {
const noDataTrHeight = tableRef.value.$el.getElementsByClassName('noDataTr')[0].offsetHeight;
titleTotalHeight = titleTotalHeight - noDataTrHeight;
}
state.refHeightWidth.titleTotalHeight = titleTotalHeight;
}
};
@ -1708,6 +1719,7 @@ const stickyHeaderColumn = (time = 500) => {
const noDataTrHeight = tableRef.value.$el.getElementsByClassName('noDataTr')[0].offsetHeight;
titleTotalHeight = titleTotalHeight - noDataTrHeight;
}
state.refHeightWidth.titleTotalHeight = titleTotalHeight;
const titleRowHeight = titleTotalHeight / columnTitleState.columnTitleRowNum;
if (columnTitleState.columnTitleRowNum) {
const row1Height = titleRowHeight * 1;

4
io.sc.platform.core.frontend/src/platform/components/toolbar/ChildrenBtn.vue

@ -1,7 +1,6 @@
<template>
<q-item
clickable
:dense="dense"
:disable="
button[0].enableIf
? !button[0].enableIf({
@ -22,7 +21,7 @@
</q-item-section>
<q-menu anchor="top end" self="top start">
<q-list :dense="dense">
<q-list>
<template v-for="(childrenBtn, index) in button" :key="index">
<template v-if="index === 0 && !childrenBtn.click"></template>
<q-separator v-else-if="typeof childrenBtn === 'string' && childrenBtn === 'separator'" />
@ -48,7 +47,6 @@
})
: false
"
:dense="dense"
@click="buttonClick(childrenBtn)"
>
<q-item-section>

6
io.sc.platform.core.frontend/src/platform/components/toolbar/WToolbar.vue

@ -36,7 +36,7 @@
<span style="padding-left: 3px">{{ btn.data[0].label }}</span>
</div>
</template>
<q-list :dense="dense">
<q-list>
<template v-for="(childrenBtn, childrenIndex) in btn.data" :key="'button_c_' + childrenIndex">
<template v-if="childrenIndex === 0"></template>
<template v-else>
@ -52,7 +52,6 @@
v-else
v-close-popup
clickable
:dense="dense"
:disable="
childrenBtn.enableIf
? !childrenBtn.enableIf({
@ -121,7 +120,7 @@
<span>{{ $t('more') }}</span>
</div>
</template>
<q-list :dense="dense">
<q-list>
<template v-for="(childrenBtn, childrenIndex) in moreActions" :key="'moreAction_' + childrenIndex">
<q-separator v-if="typeof childrenBtn.data === 'string' && childrenBtn.data === 'separator'" />
<ChildrenBtn
@ -135,7 +134,6 @@
v-else
v-close-popup
clickable
:dense="dense"
:disable="
childrenBtn.data.enableIf
? !childrenBtn.data.enableIf({

Loading…
Cancel
Save