89 lines
2.5 KiB
JavaScript
89 lines
2.5 KiB
JavaScript
|
/**
|
|||
|
* 顶部header
|
|||
|
*/
|
|||
|
Vue.component("swiper-peixun", {
|
|||
|
template: `
|
|||
|
|
|||
|
<div class="quality-table">
|
|||
|
<div class="sjk-chart-line-title">
|
|||
|
<slot></slot>
|
|||
|
</div>
|
|||
|
<el-table ref="pxjy"
|
|||
|
:data="data.data"
|
|||
|
style="width: 100%"
|
|||
|
height="215px"
|
|||
|
@cell-mouse-enter="MouseEnter"
|
|||
|
@cell-mouse-leave="MouseLeave"
|
|||
|
class="elTable"
|
|||
|
:cell-class-name="tableRowClassName">
|
|||
|
<el-table-column type="index" width="50" label="序号"></el-table-column>
|
|||
|
<el-table-column :label="item.label" :width="item.width" v-for="item in data.label">
|
|||
|
<template slot-scope="scope">
|
|||
|
<div :class="item.active == true?'company-sjk-text':''">{{scope.row[item.data]}}</div>
|
|||
|
</template>
|
|||
|
</el-table-column>
|
|||
|
|
|||
|
</el-table>
|
|||
|
</div>
|
|||
|
`,
|
|||
|
props: {
|
|||
|
data: {
|
|||
|
type: Object,
|
|||
|
}
|
|||
|
},
|
|||
|
data() {
|
|||
|
return {
|
|||
|
//造价
|
|||
|
interval: '',
|
|||
|
}
|
|||
|
},
|
|||
|
mounted() {
|
|||
|
this.init()
|
|||
|
console.log(this.data)
|
|||
|
},
|
|||
|
methods: {
|
|||
|
init() {
|
|||
|
//培训时间
|
|||
|
this.interval = setInterval(this.scroll, 50);
|
|||
|
|
|||
|
},
|
|||
|
//隔行变色
|
|||
|
// 表格隔行变色
|
|||
|
tableRowClassName({row, rowIndex}) {
|
|||
|
if (rowIndex % 2 === 0) {
|
|||
|
return 'warning-row' //这是类名
|
|||
|
} else {
|
|||
|
return ''
|
|||
|
}
|
|||
|
},
|
|||
|
//左边信息表
|
|||
|
scroll() {
|
|||
|
let maxHeight = this.$refs.pxjy.$el.querySelectorAll('.el-table__body')[0].offsetHeight;
|
|||
|
let clientHeight = this.$refs.pxjy.bodyWrapper.clientHeight;
|
|||
|
if (Math.abs(this.$refs.pxjy.bodyWrapper.scrollTop - (maxHeight - clientHeight)) < 5) { //预留5像素误差
|
|||
|
this.$refs.pxjy.bodyWrapper.scrollTop = 0;
|
|||
|
} else {
|
|||
|
this.$refs.pxjy.bodyWrapper.scrollTop += 1;//32是每一行表格的高度,每秒滚一行
|
|||
|
}
|
|||
|
}
|
|||
|
,
|
|||
|
MouseEnter() {//鼠标移入停止滚动
|
|||
|
clearInterval(this.interval);
|
|||
|
}
|
|||
|
,
|
|||
|
MouseLeave() {//鼠标离开继续滚动
|
|||
|
this.interval = setInterval(this.scroll, 50);
|
|||
|
},
|
|||
|
onClickPoint(n) {
|
|||
|
this.btnNav = n;
|
|||
|
},
|
|||
|
|
|||
|
},
|
|||
|
watch:{
|
|||
|
data:function () {
|
|||
|
this.init()
|
|||
|
},
|
|||
|
},
|
|||
|
|
|||
|
})
|