export default { data() { return { tableLoading: true, totalCount: 0, page: 1, page_size: 10 } }, computed: { vheight() { return document.body.clientHeight - 280 } }, methods: { async init() { Object.keys(this.searchForm).map(key => { if (this.searchForm[key] === '') { this.searchForm[key] = undefined } }) this.tableLoading = true const { code, data } = await this.$fetch(this.tableUrl, { page: this.page, page_size: this.page_size, ...this.searchForm }, 'get') this.tableLoading = false if (this.tableData && data.data && code === 200) { this.tableData = data.data this.totalCount = Number(data.total) } }, handleCurrentChange(page) { this.page = page this.init() }, handleSizeChange(page_size) { this.page_size = page_size this.handleCurrentChange(1) //this.searchSubmit() }, async searchSubmit() { this.page = 1 await this.init() }, searchReset(obj = {}) { Object.keys(this.searchForm).forEach(item => { this.searchForm[item] = undefined }) Object.keys(obj).forEach(item => { this.searchForm[item] = obj[item] }) this.searchSubmit() } } }