| | |
| | | }, |
| | | data() { |
| | | return { |
| | | list: [], |
| | | baseList: [], |
| | | query: {}, |
| | | page: { |
| | | size: 10, |
| | |
| | | style: { |
| | | 'color': '#fff' |
| | | }, |
| | | listApi: '', |
| | | baseListApi: '', |
| | | // regUserName: '用户-' + this.getRandomName(Math.floor(Math.random() * (6 - 2) + 3)), |
| | | // regAvatarUrl: 'https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png', |
| | | regUserName: '', |
| | |
| | | await this.getList(type) |
| | | }, |
| | | async getList(type = 'get') { |
| | | if (this.listApi) { |
| | | if (this.baseListApi) { |
| | | this.$message.showLoading() |
| | | const { |
| | | data |
| | | } = await this.$http.request(type, this.listApi, { |
| | | } = await this.$http.request(type, this.baseListApi, { |
| | | params: { |
| | | ...this.query, |
| | | ...this.page |
| | |
| | | }) |
| | | if (data) { |
| | | if (data && Array.isArray(data)) { |
| | | this.list = data || [] |
| | | this.baseList = data || [] |
| | | this.page.total = data.length || 0 |
| | | } else { |
| | | if (this.page.current === 1) { |
| | | this.list = data.records || [] |
| | | this.baseList = data.records || [] |
| | | } else { |
| | | //根据id去重正常 |
| | | var ids = [] |
| | | var idsMap = {} |
| | | for (var item of this.list) { |
| | | for (var item of this.baseList) { |
| | | ids.push(item.id) |
| | | if (item.id) { |
| | | idsMap[item.id] = item |
| | |
| | | var hasnew = false |
| | | for (var item of data.records) { |
| | | if (ids.indexOf(item.id) < 0) { |
| | | this.list.push(item) |
| | | this.baseList.push(item) |
| | | } else { |
| | | //最好更新一下 |
| | | idsMap[item.id] = { |