|
@@ -1,4 +1,4 @@
|
|
|
-import { reactive, ref, computed, watch, unref } from 'vue'
|
|
|
+import { reactive, ref, computed, watch, unref, onUnmounted } from 'vue'
|
|
|
import { typeOf } from '@/utils/common'
|
|
|
import useFetch from '@/hooks/useFetch'
|
|
|
import useSection from '@/hooks/useSection'
|
|
@@ -132,32 +132,40 @@ const useTable = <
|
|
|
})
|
|
|
|
|
|
const pagination = computed(() => {
|
|
|
- return Object.assign(DEFAULT_PAGINATION, {
|
|
|
+ return Object.assign({}, DEFAULT_PAGINATION, {
|
|
|
pageSize: baseParams.pageSize,
|
|
|
pageCount: pageCount.value,
|
|
|
total: total.value,
|
|
|
})
|
|
|
})
|
|
|
const isLastPage = computed(() => {
|
|
|
- return currentPage.value * baseParams.pageSize + 1 > total.value
|
|
|
+ // return currentPage.value * baseParams.pageSize + 1 > total.value
|
|
|
+ return pageCount.value == currentPage.value
|
|
|
})
|
|
|
- bus.on('toNextTablePage', () => {
|
|
|
+
|
|
|
+ const busFunc1 = () => {
|
|
|
// if (isLastPage.value) {
|
|
|
// ElMessage.warning('当前页已是最后一页')
|
|
|
// } else {
|
|
|
currentPage.value = Number(currentPage.value) + 1
|
|
|
// }
|
|
|
- })
|
|
|
+ }
|
|
|
+ bus.on('toNextTablePage', busFunc1)
|
|
|
|
|
|
- bus.on('atBottomRowFromUseTableCheck', () => {
|
|
|
+ const busFunc2 = () => {
|
|
|
+ console.log('pageCount.value == currentPage.value', pageCount.value, currentPage.value)
|
|
|
//被useTableCheck告知到了最后一行
|
|
|
if (isLastPage.value) {
|
|
|
ElMessage.warning('当前页已是最后一页')
|
|
|
} else {
|
|
|
mainStore.setRowNextBottomDialogStatus(true)
|
|
|
}
|
|
|
+ }
|
|
|
+ bus.on('atBottomRowFromUseTableCheck', busFunc2)
|
|
|
+ onUnmounted(() => {
|
|
|
+ bus.off('toNextTablePage', busFunc1)
|
|
|
+ bus.off('atBottomRowFromUseTableCheck', busFunc2)
|
|
|
})
|
|
|
-
|
|
|
return {
|
|
|
tableRef,
|
|
|
elTableRef,
|