| | |
| | | <template> |
| | | <a-card :bordered="false"> |
| | | <a-table |
| | | ref="detailTable" |
| | | size="middle" |
| | | bordered |
| | | rowKey="id" |
| | | :columns="columns" |
| | | :dataSource="dataSource" |
| | | :pagination="ipagination" |
| | | :loading="loading" |
| | | class="j-table-force-nowrap" |
| | | @change="handleTableChange"> |
| | | </a-table> |
| | | </a-card> |
| | | <a-table ref="detailTable" size="middle" bordered rowKey="id" :columns="columns" :dataSource="dataSource" |
| | | :pagination="ipagination" :loading="loading" class="j-table-force-nowrap" @change="handleTableChange"/> |
| | | </template> |
| | | |
| | | <script> |
| | |
| | | } |
| | | }, |
| | | filterKey: { |
| | | type: String |
| | | type: String, |
| | | default: '' |
| | | } |
| | | }, |
| | | data() { |
| | |
| | | immediate: true, |
| | | handler(val) { |
| | | if (val) { |
| | | console.log('val---------------------', val) |
| | | this.$nextTick(() => this.loadData(1)) |
| | | this.loadData(1) |
| | | } else { |
| | | this.clearList() |
| | | } |
| | |
| | | }, |
| | | methods: { |
| | | loadData(arg) { |
| | | if (this.standardId && this.standardId === '-1') { |
| | | this.clearList() |
| | | return |
| | | } |
| | | //加载数据 若传入参数1则加载第一页的内容 |
| | | if (arg === 1) { |
| | | this.ipagination.current = 1 |
| | |
| | | } |
| | | this.dataSource = [] |
| | | params.standardId = this.standardId |
| | | params.itemCategory = this.filterKey |
| | | this.loading = true |
| | | console.log('----------------------', this.filterKey) |
| | | getAction(this.url.list, params).then((res) => { |
| | | getAction(this.url.list, params) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | // console.log(res) |
| | | //update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------ |
| | | if (this.filterKey) this.dataSource = res.result.records.filter(item => item.itemCategory == this.filterKey) |
| | | else this.dataSource = res.result.records |
| | | this.dataSource = res.result.records |
| | | if (res.result.total) { |
| | | this.ipagination.total = res.result.total |
| | | } else { |
| | | this.ipagination.total = 0 |
| | | } |
| | | //update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------ |
| | | } else { |
| | | this.$message.warning(res.message) |
| | | this.$notification.warning({ |
| | | message: '消息', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }).finally(() => { |
| | | }) |
| | | .finally(() => { |
| | | this.loading = false |
| | | }) |
| | | }, |
| | | clearList() { |
| | | this.dataSource = [] |
| | | this.selectedRowKeys = [] |
| | | this.ipagination.current = 1 |
| | | this.clearSelected() |
| | | } |
| | | } |
| | | } |