export default { data () { return { tableLoading: true, totalCount: 0, page: 1, page_size: 20 } }, 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 api = (/^\/v1/.test(this.tableUrl) ? '' : '/api/auth') + this.tableUrl const { code, data } = await this.$fetch(api, { page: this.page, page_size: this.page_size, ...this.searchForm }, 'get') this.tableLoading = false if (this.tableData && (data.data || data.list) && code === 200) { this.tableData = data.data || data.list this.totalCount = Number(data.total) if (this.tableUrl === '/v1/user/song/list') { this.user_song_name = data.user_song_name } if (this.tableUrl === '/v1/user/record/price/List') { this.total_price = data.total_price } } }, 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() } } }