mkl_power_box/components/amplify/Company/laowuyonggong/amplify-yjfx.js

153 lines
6.6 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

var vms = Vue.component("Company-amplify-yjfx", {
template: `
<div>
<div class="amplify-title-icon">
<img src="https://fileimg.makalu.cc/WEB_DBD5893450984E50AFF356EF44FF4139.png" @click="openAmplify">
</div>
<transition name="el-zoom-in-top">
<div class="amplify-fixed" v-show="show" style="display: none" @click="closeAmplifyAll">
<div class="amplify-max">
<div class="amplify-title">
<div>预警分析</div>
<div class="amplify-close" @click="closeAmplify"><i class="el-icon-close"></i></div>
</div>
<div class="amplify-content">
<!--内容区域-->
<div class="amplify-labour-warning-title">
<div class="amplify-labour-warning-img">
<div class="amplify-labour-warning-bgd">
<img src="/images/labour_warning_icon.png">
</div>
</div>
<div class="amplify-labour-warning-data">
<p>超龄人数</p>
<div class="amplify-labour-warning-number"><span v-html="clTotal"></span> 人</div>
</div>
<div class="amplify-labour-warning-data">
<p>连续15天未出勤</p>
<div class="amplify-labour-warning-number"><span v-html="qqTotal"></span> 人</div>
</div>
</div>
<div class="labour-warning-table" >
<el-table ref="warning" :data="warningTableData" height="358" :cell-style="cellStyle" :header-row-style="headerStyle" @cell-mouse-enter="warningMouseEnter" @cell-mouse-leave="warningMouseLeave" class="elTable">
<el-table-column type="index" label="序号" width="80"></el-table-column>
<el-table-column prop="projectName" label="项目名称" show-overflow-tooltip></el-table-column>
<el-table-column label="超龄人数" width="140" >
<template slot-scope="scope">
<div class="labour-warning-table-color" v-cloak>{{scope.row.overage}} </div>
</template>
</el-table-column>
<el-table-column label="缺勤15天" width="140">
<template slot-scope="scope">
<div class="labour-warning-table-color" v-cloak>{{scope.row.fifteenDays}} </div>
</template>
</el-table-column>
<el-table-column label="缺勤30天" width="140">
<template slot-scope="scope">
<div class="labour-warning-table-color" v-cloak>{{scope.row.thirtyDays}} </div>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</div>
</transition>
</div>
`,
props: {
},
data() {
return {
show:false,
//预警分析
warningInterval:'',
clTotal:0,
qqTotal:0,
warningTableData:[],
cellStyle:{
color:'#B6CFEF',
fontSize:'24px',
height:'64px',
},
headerStyle:{
color: '#B6CFEF',
fontSize: '20px',
height: '64px'
},
}
},
mounted(){
},
methods: {
openAmplify(){
this.show = true
this.getWarnList()
//预警分析
this.warningInterval = setInterval(this.warningScroll,50);
},
closeAmplify(){
this.show = false
},
closeAmplifyAll(e){
if(e.target.className == 'amplify-fixed'){
this.show = false
}
},
getWarnList(){
var that = this
axios.post("https://smz.makalu.cc/mkl/screenApi/getYichangData?token=00e650bb50854f54b146e83f73500ca8&deptId=123&typtDeptId="+JSON.parse(localStorage.getItem("data")).dept_id, {
}).then(res => {
var data = res.data.yichangData
var clTotal = 0;
var qqTotal = 0;
data.map(x => {
clTotal+=x.clnum;
qqTotal+=x.shiwuDay;
x.projectName = x.project_shorthand;
x.overage = x.clnum;
x.fifteenDays = x.shiwuDay;
x.thirtyDays = x.sanshiDay;
return x;
})
that.clTotal = clTotal;
that.qqTotal = qqTotal;
that.warningTableData = data;
}).catch(err => {
})
},
// 表格滚动 方法 --------- 开始
warningScroll(){
let maxHeight=this.$refs.warning.$el.querySelectorAll ('.el-table__body')[0].offsetHeight;
let clientHeight=this.$refs.warning.bodyWrapper.clientHeight;
if(Math.abs(this.$refs.warning.bodyWrapper.scrollTop-(maxHeight-clientHeight))<5){ //预留5像素误差
this.$refs.warning.bodyWrapper.scrollTop=0;
}else{
this.$refs.warning.bodyWrapper.scrollTop+= 1;//32是每一行表格的高度每秒滚一行
}
},
warningMouseEnter(){//鼠标移入停止滚动
clearInterval(this.warningInterval);
},
warningMouseLeave(){//鼠标离开继续滚动
this.warningInterval=setInterval(this.warningScroll,30);
},
// 表格滚动 方法 ------ 结束
},
watch:{
},
})