mkl_power_box/components/amplify/jixieguanli/amplify-dkgk.js

141 lines
5.7 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("amplify-dkgk", {
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-warning-info">
<div class="amplify-warning-info-title">
<div :class="abnormalNav==0?'active':''" @click="onAbnormalNav(0)">位置异常</div>
<div :class="abnormalNav==1?'active':''" @click="onAbnormalNav(1)">工时异常</div>
<div :class="abnormalNav==2?'active':''" @click="onAbnormalNav(2)">操作证到期</div>
</div>
<!--表格数据-->
<div class="amplify-warning-info-table">
<el-table ref="wgzp" :data="showTableData" height="460" :header-row-style="headerRow" :row-style="rowStyle" @cell-mouse-enter="MouseEnter" @cell-mouse-leave="MouseLeave" class="elTable">
<el-table-column v-for="st in showTableTile" :prop="st.value" :label="st.name" width="200" show-overflow-tooltip></el-table-column>
</el-table>
</div>
</div>
</div>
</div>
</div>
</transition>
</div>
`,
props: {
},
data() {
return {
show:false,
//打卡管控提示
abnormalNav:0,
//打卡管控提示 表格数据
interval:'',
intervalOne:'',
rowStyle:{
color:'#ffffff',
fontSize:'24px',
height:'64px'
},
tableData:[],
tableTile:[],
showTableData:[],
showTableTile: [],
headerRow:{
fontSize: '20px'
}
}
},
mounted(){
// //打卡管控提示 自动滚动
this.interval = setInterval(this.scroll,50);
},
methods: {
openAmplify(){
this.show = true
this.getClockInException()
},
closeAmplify(){
this.show = false
},
closeAmplifyAll(e){
if(e.target.className == 'amplify-fixed'){
this.show = false
}
},
//打卡管控提示
onAbnormalNav(n){
this.abnormalNav = n;
this.showTableData = this.tableData[n];
this.showTableTile = this.tableTile[n];
},
//打卡管控提示
getClockInException(){
axios.post(requestUrl+"getClockInException?deptId="+deptId+"&projectId="+JSON.parse(localStorage.getItem("data")).jzgj+"&pageSize=50", {
}).then(res => {
this.tableData = [
res.data.data.signExceptionList,
res.data.data.workTimeExceptionList,
res.data.data.certExceptionList
]
this.tableTile = [
[{name:"项目名称",value:"projectName"},{name:"姓名",value:"userName"},{name:"打卡设备",value:"deviceName"},{name:"打卡时间",value:"dataTime"}],
[{name:"项目名称",value:"projectName"},{name:"设备名称",value:"deviceName"},{name:"异常原因",value:"errorReason"},{name:"打卡时间",value:"date"}],
[{name:"项目名称",value:"projectAbbreviation"},{name:"姓名",value:"certificateName"},{name:"过期天数",value:"date"},{name:"到期时间",value:"validityDate"}]
];
let num = 0;
if(res.data.data.signExceptionList.length > 0){
num = 0;
}else if(res.data.data.workTimeExceptionList.length > 0){
num = 1;
}else if(res.data.data.certExceptionList.length >0){
num = 2
}else{
num = 0;
}
this.abnormalNav = num;
this.showTableData = this.tableData[num];
this.showTableTile = this.tableTile[num];
}).catch(err => {
})
},
// 表格滚动 方法 --------- 开始
scroll(){
let maxHeight=this.$refs.wgzp.$el.querySelectorAll ('.el-table__body')[0].offsetHeight;
let clientHeight=this.$refs.wgzp.bodyWrapper.clientHeight;
if(Math.abs(this.$refs.wgzp.bodyWrapper.scrollTop-(maxHeight-clientHeight))<5){ //预留5像素误差
this.$refs.wgzp.bodyWrapper.scrollTop=0;
}else{
this.$refs.wgzp.bodyWrapper.scrollTop+= 1;//32是每一行表格的高度每秒滚一行
}
},
MouseEnter(){//鼠标移入停止滚动
clearInterval(this.interval);
},
MouseLeave(){//鼠标离开继续滚动
this.interval=setInterval(this.scroll,30);
},
// 表格滚动 方法 ------ 结束
},
watch:{
},
})