【fix 66424】解决表格数据不显示

This commit is contained in:
danshihao
2023-03-08 14:32:49 +08:00
parent 8158d7bc25
commit e37d7c0c4e
+56 -37
View File
@@ -20,16 +20,18 @@
<div class="title">退货商品</div> <div class="title">退货商品</div>
<a-table <a-table
style="margin-bottom: 24px" style="margin-bottom: 24px"
:pagination='goodsPagination'
:columns="goodsColumns" :columns="goodsColumns"
:data="loadGoodsData"> :data-source="goodsData">
</a-table> </a-table>
<div class="title">退货进度</div> <div class="title">退货进度</div>
<a-table <a-table
style="margin-bottom: 24px" style="margin-bottom: 24px"
:pagination='schedulePagination'
:columns="scheduleColumns" :columns="scheduleColumns"
:data="loadScheduleData"> :data-source="scheduleData">
<template <template
slot="status" slot="status"
@@ -57,6 +59,7 @@ export default {
}, },
data () { data () {
return { return {
goodsPagination: {},
goodsColumns: [ goodsColumns: [
{ {
title: '商品编号', title: '商品编号',
@@ -92,8 +95,51 @@ export default {
align: 'right' align: 'right'
} }
], ],
// 加载数据方法 必须为 Promise 对象 goodsData: [],
loadGoodsData: () => {
schedulePagination: {},
scheduleColumns: [
{
title: '时间',
dataIndex: 'time',
key: 'time'
},
{
title: '当前进度',
dataIndex: 'rate',
key: 'rate'
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
scopedSlots: { customRender: 'status' }
},
{
title: '操作员ID',
dataIndex: 'operator',
key: 'operator'
},
{
title: '耗时',
dataIndex: 'cost',
key: 'cost'
}
],
scheduleData: []
}
},
created () {
this.initPageData()
},
methods: {
// 初始化页面数据
initPageData () {
this.loadGoodsData()
this.loadScheduleData()
},
// 加载退货商品表格
loadGoodsData () {
return new Promise(resolve => { return new Promise(resolve => {
resolve({ resolve({
data: [ data: [
@@ -136,39 +182,12 @@ export default {
totalCount: 10 totalCount: 10
}) })
}).then(res => { }).then(res => {
return res this.goodsData = res.data
this.goodsPagination = { ...res, data: undefined }
}) })
}, },
// 加载退货进度表格
scheduleColumns: [ loadScheduleData () {
{
title: '时间',
dataIndex: 'time',
key: 'time'
},
{
title: '当前进度',
dataIndex: 'rate',
key: 'rate'
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
scopedSlots: { customRender: 'status' }
},
{
title: '操作员ID',
dataIndex: 'operator',
key: 'operator'
},
{
title: '耗时',
dataIndex: 'cost',
key: 'cost'
}
],
loadScheduleData: () => {
return new Promise(resolve => { return new Promise(resolve => {
resolve({ resolve({
data: [ data: [
@@ -219,10 +238,10 @@ export default {
totalCount: 10 totalCount: 10
}) })
}).then(res => { }).then(res => {
return res this.scheduleData = res.data
this.schedulePagination = { ...res, data: undefined }
}) })
} }
}
}, },
filters: { filters: {
statusFilter (status) { statusFilter (status) {