|
@@ -144,6 +144,7 @@ const handleSizeChange = (val: number) => {
|
|
|
const loadTableData = async () => {
|
|
|
return new Promise(async (resolve, reject) => {
|
|
|
loading.value = true
|
|
|
+ // 如果是直接传入的数据
|
|
|
if (props.dataList) {
|
|
|
tableData.splice(0, tableData.length, ...props.dataList)
|
|
|
|
|
@@ -152,6 +153,7 @@ const loadTableData = async () => {
|
|
|
|
|
|
resolve(true)
|
|
|
} else {
|
|
|
+ // 如果是需要表格自己请求数据的
|
|
|
if (props.requestConfig) {
|
|
|
try {
|
|
|
// 如果开启了分页查询,那么要计算出需要展示的页码位置所对应的偏移量
|
|
@@ -162,6 +164,7 @@ const loadTableData = async () => {
|
|
|
reqconfig.otherOptions.limit = paginationConfig.limit
|
|
|
}
|
|
|
await getTableData(reqconfig.url, reqconfig.otherOptions, props.openPageQuery)
|
|
|
+
|
|
|
backupTableData.splice(0, backupTableData.length, ...tableData)
|
|
|
resolve(true)
|
|
|
} catch (err) {
|
|
@@ -236,6 +239,9 @@ const resetTableData = () => {
|
|
|
const queryTableData = () => {
|
|
|
if (props.openRemoteinquiry && props.requestConfig) {
|
|
|
reqconfig.otherOptions = { ...props.requestConfig.otherOptions, ...queryFormData }
|
|
|
+ // 需要在查询前清除掉目前的数据,不然会导致之前缓存的数据混入
|
|
|
+ // 比如第一页已经缓存了,在第二页重新查询,在切回第一页,还是显示查询前的数据,因为缓存没被清除
|
|
|
+ tableData.splice(0, tableData.length)
|
|
|
getData()
|
|
|
} else {
|
|
|
let filteredTable = []
|