106 lines
4.1 KiB
JavaScript
106 lines
4.1 KiB
JavaScript
var vms = Vue.component("amplify-cjdwfb", {
|
||
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">
|
||
<!--内容区域-->
|
||
<el-table ref="seeUnit" :data="seeUnitData" height="500" :row-style="rowStyle" :header-row-style="headerStyle"
|
||
@cell-mouse-enter="seeUnitMouseEnter" @cell-mouse-leave="seeUnitMouseLeave"
|
||
class="elTable">
|
||
<el-table-column align="center" type="index" label="序号" width="120"></el-table-column>
|
||
<el-table-column align="center" prop="unitName" label="参建单位"
|
||
show-overflow-tooltip></el-table-column>
|
||
<el-table-column align="center" :label="showTitle" width="200" prop="rs"></el-table-column>
|
||
</el-table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</transition>
|
||
</div>
|
||
`,
|
||
props: {
|
||
|
||
},
|
||
data() {
|
||
return {
|
||
//参见单位分布
|
||
seeUnitData: [],
|
||
seeUnitInterval: '',
|
||
show:false,
|
||
rowStyle: {
|
||
color: '#B6CFEF',
|
||
fontSize: '24px',
|
||
height: '64px'
|
||
},
|
||
headerStyle:{
|
||
color: '#B6CFEF',
|
||
fontSize: '24px',
|
||
height: '64px'
|
||
},
|
||
showTitle: ""
|
||
}
|
||
},
|
||
mounted(){
|
||
this.seeUnitInterval = setInterval(this.seeUnitScroll, 50);
|
||
},
|
||
methods: {
|
||
openAmplify(){
|
||
this.show = true
|
||
this.getUnitPeopleNum()
|
||
},
|
||
closeAmplify(){
|
||
this.show = false
|
||
},
|
||
closeAmplifyAll(e){
|
||
if(e.target.className == 'amplify-fixed'){
|
||
this.show = false
|
||
}
|
||
},
|
||
getUnitPeopleNum() {
|
||
axios.post("https://smz.makalu.cc/mkl/screenApi/getCqUnitPeopleNum?token=" + JSON.parse(localStorage.getItem("data")).smz_token + "&deptId=123&typtDeptId=" + JSON.parse(localStorage.getItem("data")).dept_id + "&typtProjectId=" + JSON.parse(localStorage.getItem("data")).id, {}).then(res => {
|
||
if (res.data.state == "OK") {
|
||
let n = 0
|
||
for(let da of res.data.data){
|
||
n += da.rs
|
||
}
|
||
this.showTitle = "人数(" + n +")"
|
||
this.seeUnitData = res.data.data
|
||
} else {
|
||
this.seeUnitData = [];
|
||
}
|
||
}).catch(err => {
|
||
})
|
||
},
|
||
seeUnitScroll() {
|
||
let maxHeight = this.$refs.seeUnit.$el.querySelectorAll('.el-table__body')[0].offsetHeight;
|
||
let clientHeight = this.$refs.seeUnit.bodyWrapper.clientHeight;
|
||
if (Math.abs(this.$refs.seeUnit.bodyWrapper.scrollTop - (maxHeight - clientHeight)) < 5) { //预留5像素误差
|
||
this.$refs.seeUnit.bodyWrapper.scrollTop = 0;
|
||
} else {
|
||
this.$refs.seeUnit.bodyWrapper.scrollTop += 1;//32是每一行表格的高度,每秒滚一行
|
||
}
|
||
},
|
||
seeUnitMouseEnter() {//鼠标移入停止滚动
|
||
clearInterval(this.seeUnitInterval);
|
||
},
|
||
seeUnitMouseLeave() {//鼠标离开继续滚动
|
||
this.seeUnitInterval = setInterval(this.seeUnitScroll, 50);
|
||
}
|
||
},
|
||
watch:{
|
||
|
||
},
|
||
|
||
})
|
||
|
||
|