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

116 lines
4.7 KiB
JavaScript
Raw Normal View History

2024-11-19 00:17:04 +08:00
var vms = Vue.component("Company-amplify-rydqfb", {
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-idle-list">
<el-table style="width: 100%" ref="wgzp" :data="tableData" height="460" :row-style="rowStyle" @cell-mouse-enter="MouseEnter" @cell-mouse-leave="MouseLeave" class="elTable">
<el-table-column type="index" width="80">
<template slot-scope="scope">
<div :class="scope.$index < 3 ? 'idle-list-color':''" v-cloak>{{scope.$index + 1}} </div>
</template></el-table-column>
<el-table-column prop="name" label="省份" width="240" show-overflow-tooltip>
<template slot-scope="scope">
<div v-cloak>{{scope.row.name}} </div>
</template>
</el-table-column>
<el-table-column prop="percent" label="占比" >
<template slot-scope="scope">
<idle-list-chart :prop="Number(scope.row.percent)" :color="scope.$index < 3 ? '#f05e35':'#6ab9fe'" :width="350" :height="80"></idle-list-chart>
</template>
</el-table-column>
<el-table-column prop="value" label="人数" width="120" align="center">
<template slot-scope="scope">
<div v-cloak>{{scope.row.value}} </div>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</div>
</transition>
</div>
`,
props: {
},
data() {
return {
show:false,
tableData:[],
rowStyle:{
color:'#B6CFEF',
fontSize:'16px',
height:'54px'
},
}
},
mounted(){
},
methods: {
openAmplify(){
this.show = true
this.getAreaData()
//人员地区分布 自动滚动
this.interval = setInterval(this.scroll,50);
},
closeAmplify(){
this.show = false
},
closeAmplifyAll(e){
if(e.target.className == 'amplify-fixed'){
this.show = false
}
},
//人员地区分布
getAreaData(){
var that = this
axios.post("https://smz.makalu.cc/mkl/screenApi/getAreaData?token=00e650bb50854f54b146e83f73500ca8&deptId=123&typtDeptId="+JSON.parse(localStorage.getItem("data")).dept_id, {
}).then(res => {
that.tableData = res.data.areaDataList;
}).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:{
},
})