修改 时间组件问题
This commit is contained in:
@@ -3,6 +3,7 @@ import createAxios from '@/utils/request'
|
||||
import { requestPayload } from '@/utils/request'
|
||||
import { Method } from 'axios'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
|
||||
interface TableStoreParams {
|
||||
url: string
|
||||
pk?: string
|
||||
@@ -39,7 +40,7 @@ export default class TableStore {
|
||||
loadCallback: null,
|
||||
resetCallback: null,
|
||||
beforeSearchFun: null,
|
||||
height: mainHeight(20 + (this.showPage ? 58 : 0)).height as string,
|
||||
height: '',
|
||||
publicHeight: 0
|
||||
})
|
||||
|
||||
@@ -55,9 +56,11 @@ export default class TableStore {
|
||||
this.table.loadCallback = options.loadCallback || null
|
||||
this.table.beforeSearchFun = options.beforeSearchFun || null
|
||||
Object.assign(this.table.params, options.params)
|
||||
this.table.height = mainHeight(20 + (this.showPage ? 58 : 0) + this.table.publicHeight).height as string
|
||||
}
|
||||
|
||||
index() {
|
||||
this.table.beforeSearchFun && this.table.beforeSearchFun()
|
||||
this.table.data = []
|
||||
this.table.loading = true
|
||||
// 重置用的数据数据
|
||||
@@ -73,8 +76,16 @@ export default class TableStore {
|
||||
requestPayload(this.method, this.table.params)
|
||||
)
|
||||
).then((res: any) => {
|
||||
this.table.data = res.data.records || res.data
|
||||
this.table.total = res.data.total || res.data.length || 0
|
||||
if (res.data) {
|
||||
this.table.data = res.data.records || res.data
|
||||
this.table.total = res.data.total || res.data.length || 0
|
||||
} else {
|
||||
this.table.data = []
|
||||
this.table.total = 0
|
||||
}
|
||||
if (Array.isArray(res)) {
|
||||
this.table.data = res
|
||||
}
|
||||
if (this.isWebPaging) {
|
||||
this.table.webPagingData = window.XEUtils.chunk(this.table.data, this.table.params.pageSize)
|
||||
this.table.data = this.table.webPagingData[this.table.params.pageNum - 1]
|
||||
@@ -94,7 +105,6 @@ export default class TableStore {
|
||||
[
|
||||
'search',
|
||||
() => {
|
||||
this.table.beforeSearchFun && this.table.beforeSearchFun()
|
||||
this.table.params.pageNum = 1
|
||||
this.index()
|
||||
}
|
||||
@@ -103,8 +113,8 @@ export default class TableStore {
|
||||
'reset',
|
||||
() => {
|
||||
delete this.initData.pageSize
|
||||
console.log(this.table.params)
|
||||
console.log(this.initData)
|
||||
// console.log(this.table.params)
|
||||
// console.log(this.initData)
|
||||
Object.assign(this.table.params, this.initData)
|
||||
this.index()
|
||||
this.table.resetCallback && this.table.resetCallback()
|
||||
|
||||
Reference in New Issue
Block a user