var vms = Vue.component("Company-amplify-fljjsqk", {
template: `
No.{{i + 1}}
{{item.name}}
{{item.total}} {{item.unit}}
(
{{item.yesMonitor}} {{item.unit}} /
{{item.notMonitor}} {{item.unit}}
)
`,
props: {
businessdata:{
type:Object
}
},
data() {
return {
show:false,
infoNav:0,
height:380,
forData:[],
number:3,
interval: '',
index:0,
}
},
mounted(){
console.log(this.businessdata)
},
methods: {
openAmplify(){
this.show = true
this.getClassifyBarData()
},
closeAmplify(){
this.show = false
},
closeAmplifyAll(e){
if(e.target.className == 'amplify-fixed'){
this.show = false
}
},
//当日预警信息
onWarningInfoNav(n){
this.infoNav = n
this.forData = this.classifyBarData[n];
},
//分类及工时情况
getClassifyBarData(){
axios.post(this.businessdata.requestUrl+"getClassifyWorks?deptId="+this.businessdata.deptId+"&projectId="+this.businessdata.projectIdStr, {
}).then(res => {
this.classifyBarData = [res.data.data.num,res.data.data.dayWorkTime,res.data.data.monthWorkTime];
this.forData = this.classifyBarData[0];
this.getData()
}).catch(err => {
})
},
getData(){
var data = this.forData
var max = 0;
for(let i = 0;i {
x.yesWidth = (Number(x.yesMonitor) / max ) * 100
x.notWidth = (Number(x.notMonitor) / max ) * 100
return x
})
this.forData = data
this.$refs.process.scrollTop = 0
this.index = 0
this.interval = setInterval(this.scroll, 3000);
},
scroll() {
let offsetHeight = this.$refs.process.querySelectorAll('.amplify-process-for')[0].offsetHeight;
if(this.index == this.forData.length - this.number){
this.index = 0
}else{
this.index += 1
}
$(this.$refs.process).animate({scrollTop:(offsetHeight * this.index)+'px'})
},
MouseEnter() {//鼠标移入停止滚动
clearInterval(this.interval);
},
MouseLeave() {//鼠标离开继续滚动
this.interval = setInterval(this.scroll, 3000);
},
},
watch:{
forData: function (n,o) {
this.getData()
},
},
})