Commit 1b2d77fa by luyt

fix:排查解决多级表头切换数据属性读取不到问题

1 parent 25732172
This diff could not be displayed because it is too large.
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</GLDialog> --> </GLDialog> -->
<hr /> <hr />
<h3>el-table调整</h3> <h3>el-table调整</h3>
<GLTable ref="liveRoomRef" :tableParams="tableParams" :tableData="tableData" max-height="250"> <GLTable ref="liveRoomRef" :tableParams="tableParams" :tableData="tableData" :tableTotal="100" max-height="250">
<span slot="shareImgUrl" slot-scope="scope"> <span slot="shareImgUrl" slot-scope="scope">
<img class="img-60" :src="scope.scope.shareImgUrl" /> <img class="img-60" :src="scope.scope.shareImgUrl" />
</span> </span>
...@@ -176,11 +176,11 @@ export default { ...@@ -176,11 +176,11 @@ export default {
}, },
{ {
label: '直播状态', label: '直播状态',
prop: 'liveStatus', // prop: 'liveStatus',
width: '80', width: '80',
formatter: cellValue => { // formatter: cellValue => {
return 111 // return 111
}, // },
children: [ children: [
{ {
label: '直播状态1', label: '直播状态1',
...@@ -277,47 +277,82 @@ export default { ...@@ -277,47 +277,82 @@ export default {
liveStatus3: '132', liveStatus3: '132',
liveStatus4: '789', liveStatus4: '789',
name1: '123', name1: '123',
name2: '123' name2: '123',
aiveStatus3:'123',
yiveStatus4:'123',
civeStatus3:'123',
diveStatus4:'123',
kiveStatus4:'123',
}, },
{ {
name: '王小虎王小虎王小虎王王小虎王小虎王小虎王王小虎王小虎王小虎王王小虎王小虎王小虎王小虎王小虎王王小虎王小虎王小虎王', name: '王小虎王小虎王小虎王王小虎王小虎王小虎王王小虎王小虎王小虎王王小虎王小虎王小虎王小虎王小虎王王小虎王小虎王小虎王',
liveStatus3: '132', liveStatus3: '132',
liveStatus4: '789', liveStatus4: '789',
name1: '123', name1: '123',
name2: '123' name2: '123',
aiveStatus3:'123',
yiveStatus4:'123',
civeStatus3:'123',
diveStatus4:'123',
kiveStatus4:'123',
}, },
{ {
name: '_____________', name: '_____________',
name1: '123', name1: '123',
name2: '123' name2: '123',
aiveStatus3:'123',
yiveStatus4:'123',
civeStatus3:'123',
diveStatus4:'123',
kiveStatus4:'123',
}, },
{ {
name: '王小虎王小虎王小虎王', name: '王小虎王小虎王小虎王',
liveStatus3: '132', liveStatus3: '132',
liveStatus4: '789', liveStatus4: '789',
name1: '123', name1: '123',
name2: '123' name2: '123',
aiveStatus3:'123',
yiveStatus4:'123',
civeStatus3:'123',
diveStatus4:'123',
kiveStatus4:'123',
}, },
{ {
name: '王小虎王小虎王小虎王王小虎王小虎王小虎王', name: '王小虎王小虎王小虎王王小虎王小虎王小虎王',
liveStatus3: '132', liveStatus3: '132',
liveStatus4: '789', liveStatus4: '789',
name1: '123', name1: '123',
name2: '123' name2: '123',
aiveStatus3:'123',
yiveStatus4:'123',
civeStatus3:'123',
diveStatus4:'123',
kiveStatus4:'123',
}, },
{ {
name: '王小虎', name: '王小虎',
liveStatus3: '132', liveStatus3: '132',
liveStatus4: '789', liveStatus4: '789',
name1: '123', name1: '123',
name2: '123' name2: '123',
aiveStatus3:'123',
yiveStatus4:'123',
civeStatus3:'123',
diveStatus4:'123',
kiveStatus4:'123',
}, },
{ {
name: '王小虎王小虎王小虎王', name: '王小虎王小虎王小虎王',
liveStatus3: '132', liveStatus3: '132',
liveStatus4: '789', liveStatus4: '789',
name1: '123', name1: '123',
name2: '123' name2: '123',
aiveStatus3:'123',
yiveStatus4:'123',
civeStatus3:'123',
diveStatus4:'123',
kiveStatus4:'123',
} }
], ],
gridData: [ gridData: [
...@@ -643,6 +678,221 @@ export default { ...@@ -643,6 +678,221 @@ export default {
] ]
} }
}, },
mounted(){
//测试改变 tableColumns
setTimeout(() => {
// this.$refs.liveRoomRef.componentKey = Date.now()
// console.log('测试改变 tableColumns')
this.tableParams.tableColumns = [
{
label: '最近开播',
prop: 'time',
width: '180',
formatter: cellValue => {
return cellValue.startTime + '-' + cellValue.endTime
},
columnattrs: {},
columnlisteners: {}
},
{
label: '直播间名称',
prop: 'name',
line: 1,
width: 90
// children:[
// {
// label: '直播间名称1',
// prop: 'name1',
// line: 1,
// },
// {
// label: '直播间名称2',
// prop: 'name2',
// line: 1,
// },
// ]
},
{
label: '房间号',
prop: 'roomId'
},
{
label: '主播',
prop: 'anchorName',
line: 1
},
{
label: '直播间图片',
prop: 'shareImgUrl',
line: 1,
width:150,
addHtml: 'shareImgUrl'
},
{
label: '直播状态',
prop: 'liveStatus',
// width: '80',
formatter: cellValue => {
return 111
},
children: [
{
label: '直播状态1',
prop: 'liveStatus1',
line: 1,
// addHtml: 'shareImgUrl',
children: [
{
label: '直播状态1-1',
prop: 'aiveStatus3',
line: 1,
width: '200',
// addHtml: 'shareImgUrl'
},
{
label: '直播状态1-2',
prop: 'yiveStatus4',
line: 1,
width: '200',
// addHtml: 'shareImgUrl'
},
{
label: '直播状态1-3',
prop: 'civeStatus3',
line: 1,
width: '200',
// addHtml: 'shareImgUrl'
},
{
label: '直播状态1-4',
prop: 'diveStatus4',
line: 1,
width: '200',
// addHtml: 'shareImgUrl'
},
{
label: '直播状态1-5',
prop: 'kiveStatus4',
line: 1,
width: '200',
// addHtml: 'shareImgUrl'
}
]
},
{
label: '直播状态2',
prop: 'liveStatus2',
// line: 1,
// addHtml: 'shareImgUrl',
children: [
{
label: '直播状态2-1',
prop: 'liveStatus3',
line: 1,
width: '200',
// addHtml: 'shareImgUrl'
},
{
label: '直播状态2-2',
prop: 'kiveStatus3',
line: 1,
width: '200',
// addHtml: 'shareImgUrl'
}
]
},
]
}
]
this.$refs.liveRoomRef.componentKey = Date.now()
// //测试表格数据异步
// this.tableData = [
// {
// name: '王小虎王小虎王小虎王',
// liveStatus3: '132',
// liveStatus4: '789',
// name1: '123',
// name2: '123',
// aiveStatus3:'123',
// yiveStatus4:'123',
// civeStatus3:'123',
// diveStatus4:'123',
// kiveStatus4:'123',
// },
// {
// name: '王小虎王小虎王小虎王王小虎王小虎王小虎王王小虎王小虎王小虎王王小虎王小虎王小虎王小虎王小虎王王小虎王小虎王小虎王',
// liveStatus3: '132',
// liveStatus4: '789',
// name1: '123',
// name2: '123',
// aiveStatus3:'123',
// yiveStatus4:'123',
// civeStatus3:'123',
// diveStatus4:'123',
// kiveStatus4:'123',
// },
// {
// name: '_____________',
// name1: '123',
// name2: '123',
// aiveStatus3:'123',
// yiveStatus4:'123',
// civeStatus3:'123',
// diveStatus4:'123',
// kiveStatus4:'123',
// },
// {
// name: '王小虎王小虎王小虎王',
// liveStatus3: '132',
// liveStatus4: '789',
// name1: '123',
// name2: '123',
// aiveStatus3:'123',
// yiveStatus4:'123',
// civeStatus3:'123',
// diveStatus4:'123',
// kiveStatus4:'123',
// },
// {
// name: '王小虎王小虎王小虎王王小虎王小虎王小虎王',
// liveStatus3: '132',
// liveStatus4: '789',
// name1: '123',
// name2: '123',
// aiveStatus3:'123',
// yiveStatus4:'123',
// civeStatus3:'123',
// diveStatus4:'123',
// kiveStatus4:'123',
// },
// {
// name: '王小虎',
// liveStatus3: '132',
// liveStatus4: '789',
// name1: '123',
// name2: '123',
// aiveStatus3:'123',
// yiveStatus4:'123',
// civeStatus3:'123',
// diveStatus4:'123',
// kiveStatus4:'123',
// },
// {
// name: '王小虎王小虎王小虎王',
// liveStatus3: '132',
// liveStatus4: '789',
// name1: '123',
// name2: '123',
// aiveStatus3:'123',
// yiveStatus4:'123',
// civeStatus3:'123',
// diveStatus4:'123',
// kiveStatus4:'123',
// }
// ]
},3000)
},
methods: { methods: {
subscribe(child) { subscribe(child) {
child.call('push', { src: this.src }) child.call('push', { src: this.src })
......
...@@ -268,6 +268,10 @@ export default { ...@@ -268,6 +268,10 @@ export default {
watch: { watch: {
customHeadShowList(val) { customHeadShowList(val) {
this.isCustomHead && this.findShowHeadCol() this.isCustomHead && this.findShowHeadCol()
},
'tableParams.tableColumns'(newVal,oldVal) {
// console.log('newVal',newVal)
this.tableColumns = newVal
} }
// data: { // data: {
// immediate: true, // immediate: true,
...@@ -427,15 +431,24 @@ export default { ...@@ -427,15 +431,24 @@ export default {
// 页码 // 页码
this.page[this.pageConf.pageNum] = value this.page[this.pageConf.pageNum] = value
this.getListApi ? this.refreshTable(false, false) : this.$emit('refreshTable', this.page) this.getListApi ? this.refreshTable(false, false) : this.$emit('refreshTable', this.page)
}
}, },
//原table mounted要做的要做的事情
mounted() { tableInit(){
this.isCustomHead ? this.findShowHeadCol() : (this.tableColumns = this.tableParams.tableColumns) this.isCustomHead ? this.findShowHeadCol() : (this.tableColumns = this.tableParams.tableColumns)
this.page = {} this.page = {}
this.page[this.pageConf.pageSize] = this.pageSizes[0] this.page[this.pageConf.pageSize] = this.pageSizes[0]
this.page[this.pageConf.pageNum] = 1 this.page[this.pageConf.pageNum] = 1
this.getListApi && this.refreshTable() this.getListApi && this.refreshTable()
setTimeout(() => {
// console.log('123456doLayout')
this.$refs[this.tableParams.mutiSelectName + 'MutiTable'].doLayout()
}, 100)
}
},
mounted() {
this.tableInit()
// 注册事件 -- 防抖 // 注册事件 -- 防抖
window.onresize = () => { window.onresize = () => {
if (!this.bAntiShike) { if (!this.bAntiShike) {
...@@ -447,11 +460,6 @@ export default { ...@@ -447,11 +460,6 @@ export default {
}, 300) }, 300)
} }
} }
//
setTimeout(() => {
// console.log('123456doLayout')
this.$refs[this.tableParams.mutiSelectName + 'MutiTable'].doLayout()
}, 100)
}, },
beforeDestroy() { beforeDestroy() {
// 事件注销 // 事件注销
......
...@@ -76,7 +76,7 @@ export default { ...@@ -76,7 +76,7 @@ export default {
}, },
components: { components: {
GlSubTableColumn GlSubTableColumn
} },
// created(){ // created(){
// // console.log('data',this.data) // // console.log('data',this.data)
// } // }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!