|
@ -6,6 +6,7 @@ |
|
|
flat |
|
|
flat |
|
|
binary-state-sort |
|
|
binary-state-sort |
|
|
:no-data-label="state.noDataLabel" |
|
|
:no-data-label="state.noDataLabel" |
|
|
|
|
|
:hide-no-data="true" |
|
|
:loading-label="state.loadingLabel" |
|
|
:loading-label="state.loadingLabel" |
|
|
v-bind="attrs" |
|
|
v-bind="attrs" |
|
|
:selection="selectionComputed" |
|
|
:selection="selectionComputed" |
|
@ -70,6 +71,9 @@ |
|
|
{{ c.label }} |
|
|
{{ c.label }} |
|
|
</q-th> |
|
|
</q-th> |
|
|
</q-tr> |
|
|
</q-tr> |
|
|
|
|
|
<q-tr v-if="table.rows.length === 0" :style="noDataTrHeightComputed" class="noDataTr"> |
|
|
|
|
|
<q-td :colspan="noDataTrColspanComputed" align="center" valian="middle"><q-icon size="2em" :name="IconEnum.提示" />{{ state.noDataLabel }}</q-td> |
|
|
|
|
|
</q-tr> |
|
|
</template> |
|
|
</template> |
|
|
<template v-else> |
|
|
<template v-else> |
|
|
<q-tr :props="scope"> |
|
|
<q-tr :props="scope"> |
|
@ -92,6 +96,9 @@ |
|
|
</q-th> |
|
|
</q-th> |
|
|
</template> |
|
|
</template> |
|
|
</q-tr> |
|
|
</q-tr> |
|
|
|
|
|
<q-tr v-if="table.rows.length === 0" :style="noDataTrHeightComputed" class="noDataTr"> |
|
|
|
|
|
<q-td :colspan="noDataTrColspanComputed" align="center" valian="middle"><q-icon size="2em" :name="IconEnum.提示" />{{ state.noDataLabel }}</q-td> |
|
|
|
|
|
</q-tr> |
|
|
</template> |
|
|
</template> |
|
|
</template> |
|
|
</template> |
|
|
<template #body="scope"> |
|
|
<template #body="scope"> |
|
@ -158,6 +165,11 @@ |
|
|
</template> |
|
|
</template> |
|
|
</q-tr> |
|
|
</q-tr> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
<!-- <template v-if="table.rows.length === 0" #top-row> |
|
|
|
|
|
<q-tr> |
|
|
|
|
|
<q-td >{{ state.noDataLabel }}</q-td> |
|
|
|
|
|
</q-tr> |
|
|
|
|
|
</template> --> |
|
|
<template #loading> |
|
|
<template #loading> |
|
|
<q-inner-loading :showing="state.loading" style="z-index: 999"> |
|
|
<q-inner-loading :showing="state.loading" style="z-index: 999"> |
|
|
<q-spinner-gears size="50px" color="primary" /> |
|
|
<q-spinner-gears size="50px" color="primary" /> |
|
@ -197,6 +209,7 @@ |
|
|
</template> |
|
|
</template> |
|
|
<template v-else> 共 {{ state.pagination.rowsNumber }} 条记录 </template> |
|
|
<template v-else> 共 {{ state.pagination.rowsNumber }} 条记录 </template> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
<!-- |
|
|
<template v-if="!attrs['hide-bottom']" #no-data="{ message }"> |
|
|
<template v-if="!attrs['hide-bottom']" #no-data="{ message }"> |
|
|
<div class="full-width row flex-center text-dark q-gutter-sm" :style="`height:` + noDataBottomHeightComputed"> |
|
|
<div class="full-width row flex-center text-dark q-gutter-sm" :style="`height:` + noDataBottomHeightComputed"> |
|
|
<q-icon size="2em" :name="IconEnum.提示" /> |
|
|
<q-icon size="2em" :name="IconEnum.提示" /> |
|
@ -204,7 +217,7 @@ |
|
|
{{ message }} |
|
|
{{ message }} |
|
|
</span> |
|
|
</span> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> --> |
|
|
</q-table> |
|
|
</q-table> |
|
|
<w-dialog ref="dialogRef" v-bind="editor.dialog" :title="dialog.dialogTitle" :buttons="dialog.dialogButtons"> |
|
|
<w-dialog ref="dialogRef" v-bind="editor.dialog" :title="dialog.dialogTitle" :buttons="dialog.dialogButtons"> |
|
|
<w-form ref="dialogFormRef" v-bind="editor.form" class="pt-1.5 px-1.5"></w-form> |
|
|
<w-form ref="dialogFormRef" v-bind="editor.form" class="pt-1.5 px-1.5"></w-form> |
|
@ -892,6 +905,7 @@ const state = reactive({ |
|
|
// 表格响应式高宽 |
|
|
// 表格响应式高宽 |
|
|
refHeightWidth: { |
|
|
refHeightWidth: { |
|
|
yLocation: 0, // 表格当前所在Y轴位置 |
|
|
yLocation: 0, // 表格当前所在Y轴位置 |
|
|
|
|
|
noDataTrYLocation: 0, // 无数据提示行所在Y轴位置 |
|
|
topHeight: 0, // 表格当前top区域高度(表格列头上方区域) |
|
|
topHeight: 0, // 表格当前top区域高度(表格列头上方区域) |
|
|
bottomHeight: 0, // 表格当前bottom区域高度(无可用数据、分页那块区域) |
|
|
bottomHeight: 0, // 表格当前bottom区域高度(无可用数据、分页那块区域) |
|
|
middleWidth: 0, // 表格当前middle区域宽度(表格列头及数据行区域) |
|
|
middleWidth: 0, // 表格当前middle区域宽度(表格列头及数据行区域) |
|
@ -1145,53 +1159,61 @@ const tableHeightComputed = computed(() => { |
|
|
mainPaddingBottom - |
|
|
mainPaddingBottom - |
|
|
mainContainerPaddingBottom - |
|
|
mainContainerPaddingBottom - |
|
|
otherHeight; |
|
|
otherHeight; |
|
|
if ((table.rows && table.rows.length > 0) || attrs['hide-bottom']) { |
|
|
|
|
|
return { |
|
|
return { |
|
|
height: props.height > 0 ? props.height + 'px' : resultHeight + 'px', |
|
|
height: props.height > 0 ? props.height + 'px' : resultHeight + 'px', |
|
|
}; |
|
|
}; |
|
|
} else { |
|
|
// if ((table.rows && table.rows.length > 0) || attrs['hide-bottom']) { |
|
|
return { |
|
|
|
|
|
height: state.refHeightWidth.middleHeight + 'px', |
|
|
// } else { |
|
|
}; |
|
|
// return { |
|
|
} |
|
|
// height: state.refHeightWidth.middleHeight + 'px', |
|
|
|
|
|
// }; |
|
|
|
|
|
// } |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const noDataBottomHeightComputed = computed(() => { |
|
|
const noDataTrHeightComputed = computed(() => { |
|
|
// 浏览器可视区域高度 |
|
|
// 浏览器可视区域高度 |
|
|
const screenHeight = $q.screen.height; |
|
|
const screenHeight = $q.screen.height; |
|
|
// 系统底部高度(一般用来显示XX版权所有那一层) |
|
|
// 系统底部高度(一般用来显示XX版权所有那一层) |
|
|
const footerHeight = gc.theme.footer.show ? gc.theme.footer.height : 0; |
|
|
const footerHeight = gc.theme.footer.show ? gc.theme.footer.height : 0; |
|
|
// 其他高度,边框,用户自定义留白等,默认 4px |
|
|
|
|
|
const otherHeight = table.spaceHeight || 4; |
|
|
|
|
|
// 主面板下边距 |
|
|
// 主面板下边距 |
|
|
const mainPaddingBottom = gc.theme.main.paddingBottom || 0; |
|
|
const mainPaddingBottom = gc.theme.main.paddingBottom || 0; |
|
|
// 主面板容器下边距 |
|
|
// 主面板容器下边距 |
|
|
const mainContainerPaddingBottom = gc.theme.main.containerPaddingBottom || 0; |
|
|
const mainContainerPaddingBottom = gc.theme.main.containerPaddingBottom || 0; |
|
|
|
|
|
// 其他高度,边框,用户自定义留白等,默认 4px |
|
|
|
|
|
const otherHeight = table.spaceHeight || 4; |
|
|
const resultHeight = |
|
|
const resultHeight = |
|
|
screenHeight - |
|
|
screenHeight - |
|
|
state.refHeightWidth.yLocation - |
|
|
state.refHeightWidth.noDataTrYLocation - |
|
|
state.refHeightWidth.topHeight - |
|
|
(state.refHeightWidth.bottomHeight || 0) - |
|
|
state.refHeightWidth.middleHeight - |
|
|
footerHeight - |
|
|
mainPaddingBottom - |
|
|
mainPaddingBottom - |
|
|
mainContainerPaddingBottom - |
|
|
mainContainerPaddingBottom - |
|
|
footerHeight - |
|
|
(state.refHeightWidth.middleScrollWidth - state.refHeightWidth.middleWidth > 0 ? 15 : 0) - |
|
|
otherHeight; |
|
|
otherHeight; |
|
|
if (table.rows && table.rows.length > 0) { |
|
|
return { |
|
|
return '0px'; |
|
|
height: props.height > 0 ? props.height + 'px' : resultHeight + 'px', |
|
|
} else { |
|
|
}; |
|
|
return table.inFullscreen ? resultHeight + 'px' : props.height > 0 ? props.height + 'px' : resultHeight + 'px'; |
|
|
}); |
|
|
} |
|
|
const noDataTrColspanComputed = computed(() => { |
|
|
|
|
|
let colspan = excludeColumnNum.value; |
|
|
|
|
|
colspan += visibleColumnsComputed.value.length; |
|
|
|
|
|
return colspan; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// 表格进入全屏模式时所在Y轴会变成0,退出时也无法准确获得,最终导致出现滚动条,需要在进入全屏时记录Y轴位置。 |
|
|
// 表格进入全屏模式时所在Y轴会变成0,退出时也无法准确获得,最终导致出现滚动条,需要在进入全屏时记录Y轴位置。 |
|
|
let tableY = 0; |
|
|
let tableY = 0; |
|
|
|
|
|
let noDataTrY = 0; |
|
|
const tableFullscreenFun = (value) => { |
|
|
const tableFullscreenFun = (value) => { |
|
|
table.inFullscreen = !table.inFullscreen; |
|
|
table.inFullscreen = !table.inFullscreen; |
|
|
if (value) { |
|
|
if (value) { |
|
|
tableY = state.refHeightWidth.yLocation; |
|
|
tableY = state.refHeightWidth.yLocation; |
|
|
|
|
|
noDataTrY = state.refHeightWidth.noDataTrYLocation; |
|
|
} else { |
|
|
} else { |
|
|
state.refHeightWidth.yLocation = tableY; |
|
|
state.refHeightWidth.yLocation = tableY; |
|
|
|
|
|
state.refHeightWidth.noDataTrYLocation = noDataTrY; |
|
|
tableY = 0; |
|
|
tableY = 0; |
|
|
|
|
|
noDataTrY = 0; |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -1227,6 +1249,9 @@ const onResize = () => { |
|
|
handlerQueryFormShowField(); |
|
|
handlerQueryFormShowField(); |
|
|
if (tableRef.value) { |
|
|
if (tableRef.value) { |
|
|
state.refHeightWidth.yLocation = tableRef.value.$el.getBoundingClientRect().y; |
|
|
state.refHeightWidth.yLocation = tableRef.value.$el.getBoundingClientRect().y; |
|
|
|
|
|
if (tableRef.value.$el.getElementsByClassName('noDataTr').length > 0) { |
|
|
|
|
|
state.refHeightWidth.noDataTrYLocation = tableRef.value.$el.getElementsByClassName('noDataTr')[0].getBoundingClientRect().y; |
|
|
|
|
|
} |
|
|
state.refHeightWidth.topHeight = tableRef.value.$el.getElementsByClassName('q-table__top')[0]?.clientHeight; |
|
|
state.refHeightWidth.topHeight = tableRef.value.$el.getElementsByClassName('q-table__top')[0]?.clientHeight; |
|
|
state.refHeightWidth.middleWidth = tableRef.value.$el.getElementsByClassName('q-table__middle')[0]?.clientWidth; |
|
|
state.refHeightWidth.middleWidth = tableRef.value.$el.getElementsByClassName('q-table__middle')[0]?.clientWidth; |
|
|
state.refHeightWidth.middleScrollWidth = tableRef.value.$el.getElementsByClassName('q-table__middle')[0]?.scrollWidth; |
|
|
state.refHeightWidth.middleScrollWidth = tableRef.value.$el.getElementsByClassName('q-table__middle')[0]?.scrollWidth; |
|
@ -1614,6 +1639,9 @@ const stickyHeaderColumn = (time = 500) => { |
|
|
// 延迟处理锁定列及表格宽高的获取 |
|
|
// 延迟处理锁定列及表格宽高的获取 |
|
|
if (tableRef.value) { |
|
|
if (tableRef.value) { |
|
|
state.refHeightWidth.yLocation = tableRef.value.$el.getBoundingClientRect()?.y; |
|
|
state.refHeightWidth.yLocation = tableRef.value.$el.getBoundingClientRect()?.y; |
|
|
|
|
|
if (tableRef.value.$el.getElementsByClassName('noDataTr').length > 0) { |
|
|
|
|
|
state.refHeightWidth.noDataTrYLocation = tableRef.value.$el.getElementsByClassName('noDataTr')[0].getBoundingClientRect().y; |
|
|
|
|
|
} |
|
|
state.refHeightWidth.topHeight = tableRef.value.$el.getElementsByClassName('q-table__top')[0]?.clientHeight; |
|
|
state.refHeightWidth.topHeight = tableRef.value.$el.getElementsByClassName('q-table__top')[0]?.clientHeight; |
|
|
state.refHeightWidth.bottomHeight = tableRef.value.$el.getElementsByClassName('q-table__bottom')[0]?.clientHeight; |
|
|
state.refHeightWidth.bottomHeight = tableRef.value.$el.getElementsByClassName('q-table__bottom')[0]?.clientHeight; |
|
|
state.refHeightWidth.middleWidth = tableRef.value.$el.getElementsByClassName('q-table__middle')[0]?.clientWidth; |
|
|
state.refHeightWidth.middleWidth = tableRef.value.$el.getElementsByClassName('q-table__middle')[0]?.clientWidth; |
|
@ -1674,9 +1702,14 @@ const stickyHeaderColumn = (time = 500) => { |
|
|
column1Width + column2Width + column3Width + column4Width + column5Width + column6Width + column7Width + column8Width + column9Width + 'px', |
|
|
column1Width + column2Width + column3Width + column4Width + column5Width + column6Width + column7Width + column8Width + column9Width + 'px', |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
const titleTotalHeight = tableDom.getElementsByTagName('thead')[0].offsetHeight; |
|
|
let titleTotalHeight = tableDom.getElementsByTagName('thead')[0].offsetHeight; |
|
|
|
|
|
// 无数据时列头会增加一行,多表头的top距离计算会出错,需减掉多出来的提示行。 |
|
|
|
|
|
if (table.rows.length === 0) { |
|
|
|
|
|
const noDataTrHeight = tableRef.value.$el.getElementsByClassName('noDataTr')[0].offsetHeight; |
|
|
|
|
|
titleTotalHeight = titleTotalHeight - noDataTrHeight; |
|
|
|
|
|
} |
|
|
const titleRowHeight = titleTotalHeight / columnTitleState.columnTitleRowNum; |
|
|
const titleRowHeight = titleTotalHeight / columnTitleState.columnTitleRowNum; |
|
|
if (columnTitleState.columnTitleRowNum > 1) { |
|
|
if (columnTitleState.columnTitleRowNum) { |
|
|
const row1Height = titleRowHeight * 1; |
|
|
const row1Height = titleRowHeight * 1; |
|
|
const row2Height = titleRowHeight * 2; |
|
|
const row2Height = titleRowHeight * 2; |
|
|
const row3Height = titleRowHeight * 3; |
|
|
const row3Height = titleRowHeight * 3; |
|
@ -1717,7 +1750,10 @@ const stickyHeaderColumn = (time = 500) => { |
|
|
if (denseBottomComputed.value && (!attrs.hasOwnProperty('hide-bottom') || attrs['hide-bottom'] === false)) { |
|
|
if (denseBottomComputed.value && (!attrs.hasOwnProperty('hide-bottom') || attrs['hide-bottom'] === false)) { |
|
|
tableRef.value.$el.getElementsByClassName('q-table__bottom')[0].style.setProperty('--tableBottomHeight', 33 + 'px'); |
|
|
tableRef.value.$el.getElementsByClassName('q-table__bottom')[0].style.setProperty('--tableBottomHeight', 33 + 'px'); |
|
|
tableRef.value.$el.getElementsByClassName('q-table__bottom')[0].style.setProperty('--tableBottomButtonHeight', 24 + 'px'); |
|
|
tableRef.value.$el.getElementsByClassName('q-table__bottom')[0].style.setProperty('--tableBottomButtonHeight', 24 + 'px'); |
|
|
} else if (!attrs.hasOwnProperty('hide-bottom') || attrs['hide-bottom'] === false) { |
|
|
} else if ( |
|
|
|
|
|
(!attrs.hasOwnProperty('hide-bottom') || attrs['hide-bottom'] === false) && |
|
|
|
|
|
tableRef.value.$el.getElementsByClassName('q-table__bottom').length > 0 |
|
|
|
|
|
) { |
|
|
tableRef.value.$el.getElementsByClassName('q-table__bottom')[0].style.setProperty('--tableBottomHeight', 50 + 'px'); |
|
|
tableRef.value.$el.getElementsByClassName('q-table__bottom')[0].style.setProperty('--tableBottomHeight', 50 + 'px'); |
|
|
tableRef.value.$el.getElementsByClassName('q-table__bottom')[0].style.setProperty('--tableBottomButtonHeight', 40 + 'px'); |
|
|
tableRef.value.$el.getElementsByClassName('q-table__bottom')[0].style.setProperty('--tableBottomButtonHeight', 40 + 'px'); |
|
|
} |
|
|
} |
|
|