|
|
@@ -300,27 +300,7 @@ const tableBoxClass = computed(() => {
|
|
|
|
|
|
return classStr
|
|
|
})
|
|
|
-const tableBoxStyle = computed(() => {
|
|
|
- const style = props.tableBoxStyle ?? {}
|
|
|
- if (props.tableBoxHeight) {
|
|
|
- style.height = Number(props.tableBoxHeight) ? props.tableBoxHeight + "px" : props.tableBoxHeight
|
|
|
- } else {
|
|
|
- nextTick(() => {
|
|
|
- const tableBoxAuotHeight =
|
|
|
- document.documentElement.clientHeight -
|
|
|
- (document.querySelector(".app-header")?.clientHeight ?? 0) -
|
|
|
- (document.querySelector(".app-footer")?.clientHeight ?? 0) -
|
|
|
- 5
|
|
|
- style.height = tableBoxAuotHeight + "px"
|
|
|
- })
|
|
|
- }
|
|
|
- if (props.tableBoxWidth) {
|
|
|
- style.width = Number(props.tableBoxWidth) ? props.tableBoxWidth + "px" : props.tableBoxWidth
|
|
|
- } else {
|
|
|
- style.width = "100%"
|
|
|
- }
|
|
|
- return style
|
|
|
-})
|
|
|
+const _tableBoxStyle = ref(calcTableBoxStyle())
|
|
|
const fixedColumn = computed(() => props.fixedNumber > 0 || props.fixedRightNumber > 0)
|
|
|
const tableStyle = computed(() => {
|
|
|
let style = ""
|
|
|
@@ -567,7 +547,27 @@ const customSearch = () => {
|
|
|
search()
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+function calcTableBoxStyle() {
|
|
|
+ const style = props.tableBoxStyle ?? {}
|
|
|
+ if (props.tableBoxHeight) {
|
|
|
+ style.height = Number(props.tableBoxHeight) ? props.tableBoxHeight + "px" : props.tableBoxHeight
|
|
|
+ } else {
|
|
|
+ nextTick(() => {
|
|
|
+ const tableBoxAuotHeight =
|
|
|
+ document.documentElement.clientHeight -
|
|
|
+ (document.querySelector(".app-header")?.clientHeight ?? 0) -
|
|
|
+ (document.querySelector(".app-footer")?.clientHeight ?? 0) -
|
|
|
+ 5
|
|
|
+ style.height = tableBoxAuotHeight + "px"
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (props.tableBoxWidth) {
|
|
|
+ style.width = Number(props.tableBoxWidth) ? props.tableBoxWidth + "px" : props.tableBoxWidth
|
|
|
+ } else {
|
|
|
+ style.width = "100%"
|
|
|
+ }
|
|
|
+ return style
|
|
|
+}
|
|
|
function search(isReset = true) {
|
|
|
if (isReset) {
|
|
|
resetData()
|
|
|
@@ -878,6 +878,9 @@ function init() {
|
|
|
initFixedColumns()
|
|
|
BindInterEvent()
|
|
|
})
|
|
|
+ window.addEventListener("resize", () => {
|
|
|
+ _tableBoxStyle.value = calcTableBoxStyle()
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
onMounted(init)
|
|
|
@@ -896,7 +899,7 @@ defineExpose({
|
|
|
})
|
|
|
</script>
|
|
|
<template>
|
|
|
- <div ref="tableBoxRef" class="vb-table" :id="id" :class="tableBoxClass" :style="tableBoxStyle">
|
|
|
+ <div ref="tableBoxRef" class="vb-table" :id="id" :class="tableBoxClass" :style="_tableBoxStyle">
|
|
|
<Toolbar
|
|
|
v-if="showToolbar"
|
|
|
:tableTitle="tableTitle"
|
|
|
@@ -925,15 +928,15 @@ defineExpose({
|
|
|
</Content>
|
|
|
<template v-if="loading">
|
|
|
<div class="h-100px d-flex justify-content-center flex-column align-items-center">
|
|
|
- <div class="spinner-border text-gray-500 mb-5"></div>
|
|
|
- <span class="text-gray-500">{{ loadingText }}</span>
|
|
|
+ <div class="spinner-border text-gray-700 mb-5"></div>
|
|
|
+ <span class="text-gray-700">{{ loadingText }}</span>
|
|
|
</div>
|
|
|
</template>
|
|
|
<div
|
|
|
v-else-if="displayData.length == 0 && !loading"
|
|
|
class="h-100px d-flex justify-content-center flex-column align-items-center">
|
|
|
<img class="mb-2" :src="getAssetPath('media/table/empty.svg')" />
|
|
|
- <span class="text-gray-500">{{ emptyTableText }}</span>
|
|
|
+ <span class="text-gray-700">{{ emptyTableText }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-if="props.fixedRightNumber > 0" ref="rightFixedRef" class="fixed-columns-right">
|