import Vue from 'vue'
var vms = Vue.component("amplify-sgbzgf", {
template: `
`,
props: {
projectId:{
type:Number
},
label:{
type:String
}
},
data() {
return {
show:false,
height:515,
data:{
label: [
{
label: '序号',
width: '50',
color:'',
type:'',
type_color:'',
data: 'sort'
},
{
label: '标准名称',
width: '',
color:'#50a2eb',
type:'',
type_color:'',
data: 'bianName'
},
{
label: '编号',
width: '',
color:'',
type:'',
type_color:'',
data: 'bianNum'
},
],
data: [],
},
}
},
mounted(){
this.interval = setInterval(this.scroll, 50);
},
methods: {
openAmplify(){
this.show = true
this.getBiaoZhun()
},
closeAmplify(){
this.show = false
},
closeAmplifyAll(e){
if(e.target.className == 'amplify-fixed'){
this.show = false
}
},
//施工标准规范
getBiaoZhun() {
let that = this
axios.post("/system/standardinfo/list?projectId="+this.projectId, {
projectId:this.projectId
}).then(res => {
res = res.data.rows
let result = res.map((item,index)=>{
return {
sort:(index + 1),
bianName:item.standardName,
bianNum:item.standardNum
}
})
that.data.data = result
})
},
//左边信息表
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;
},
// 表格隔行变色
tableRowClassName({row, rowIndex}) {
if (rowIndex % 2 === 0) {
return 'warning-row' //这是类名
} else {
return ''
}
},
},
watch:{
projectId:function (n,o) {
this.openAmplify()
}
},
})