165 lines
5.9 KiB
JavaScript
165 lines
5.9 KiB
JavaScript
import Vue from 'vue'
|
||
|
||
var vms = Vue.component("amplify-sgbzgf", {
|
||
template: `
|
||
<div>
|
||
<div class="amplify-title-icon">
|
||
<img src="http://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 v-cloak>{{label}}</div>
|
||
<div class="amplify-close" @click="closeAmplify"><i class="el-icon-close"></i></div>
|
||
</div>
|
||
<div class="amplify-content">
|
||
<!--内容区域-->
|
||
<div class="quality-table">
|
||
<el-table ref="pxjy"
|
||
:data="data.data"
|
||
style="width: 100%"
|
||
:height="height+'px'"
|
||
@cell-mouse-enter="MouseEnter"
|
||
@cell-mouse-leave="MouseLeave"
|
||
class="elTable"
|
||
:cell-class-name="tableRowClassName"
|
||
>
|
||
<el-table-column :label="item.label" :width="item.width" v-for="item in data.label" show-overflow-tooltip>
|
||
<template slot-scope="scope">
|
||
<div v-if="item.type==''" :style="{'color':item.color}">{{scope.row[item.data]}}</div>
|
||
<div v-if="item.type=='img'" style="padding-top: 3px;">
|
||
<el-image style="width: 40px; height: 40px" :src="scope.row[item.data]" fit="cover"
|
||
></el-image>
|
||
</div>
|
||
<div v-if="item.type=='state'">
|
||
<div :style="{'color':scope.row[item.type_color]}">{{scope.row[item.data]}}</div>
|
||
</div>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</transition>
|
||
</div>
|
||
`,
|
||
props: {
|
||
projectId:{
|
||
type:Number
|
||
},
|
||
label:{
|
||
type:String
|
||
}
|
||
|
||
},
|
||
data() {
|
||
return {
|
||
show:false,
|
||
height:515,
|
||
data:{
|
||
label: [
|
||
{
|
||
label: '序号',
|
||
width: '50',
|
||
color:'',
|
||
type:'',
|
||
type_color:'',
|
||
data: 'sort'
|
||
},
|
||
{
|
||
label: '标准名称',
|
||
width: '',
|
||
color:'#50a2eb',
|
||
type:'',
|
||
type_color:'',
|
||
data: 'bianName'
|
||
},
|
||
{
|
||
label: '编号',
|
||
width: '',
|
||
color:'',
|
||
type:'',
|
||
type_color:'',
|
||
data: 'bianNum'
|
||
},
|
||
],
|
||
data: [],
|
||
},
|
||
}
|
||
},
|
||
mounted(){
|
||
this.interval = setInterval(this.scroll, 50);
|
||
},
|
||
methods: {
|
||
openAmplify(){
|
||
this.show = true
|
||
this.getBiaoZhun()
|
||
},
|
||
closeAmplify(){
|
||
this.show = false
|
||
},
|
||
closeAmplifyAll(e){
|
||
if(e.target.className == 'amplify-fixed'){
|
||
this.show = false
|
||
}
|
||
},
|
||
//施工标准规范
|
||
getBiaoZhun() {
|
||
let that = this
|
||
axios.post("/system/standardinfo/list?projectId="+this.projectId, {
|
||
projectId:this.projectId
|
||
}).then(res => {
|
||
res = res.data.rows
|
||
let result = res.map((item,index)=>{
|
||
return {
|
||
sort:(index + 1),
|
||
bianName:item.standardName,
|
||
bianNum:item.standardNum
|
||
}
|
||
})
|
||
|
||
that.data.data = result
|
||
})
|
||
},
|
||
//左边信息表
|
||
scroll() {
|
||
let maxHeight = this.$refs.pxjy.$el.querySelectorAll('.el-table__body')[0].offsetHeight;
|
||
let clientHeight = this.$refs.pxjy.bodyWrapper.clientHeight;
|
||
if (Math.abs(this.$refs.pxjy.bodyWrapper.scrollTop - (maxHeight - clientHeight)) < 5) { //预留5像素误差
|
||
this.$refs.pxjy.bodyWrapper.scrollTop = 0;
|
||
} else {
|
||
this.$refs.pxjy.bodyWrapper.scrollTop += 1;//32是每一行表格的高度,每秒滚一行
|
||
}
|
||
}
|
||
,
|
||
MouseEnter() {//鼠标移入停止滚动
|
||
clearInterval(this.interval);
|
||
}
|
||
,
|
||
MouseLeave() {//鼠标离开继续滚动
|
||
this.interval = setInterval(this.scroll, 50);
|
||
},
|
||
onClickPoint(n) {
|
||
this.btnNav = n;
|
||
},
|
||
// 表格隔行变色
|
||
tableRowClassName({row, rowIndex}) {
|
||
if (rowIndex % 2 === 0) {
|
||
return 'warning-row' //这是类名
|
||
} else {
|
||
return ''
|
||
}
|
||
},
|
||
},
|
||
watch:{
|
||
projectId:function (n,o) {
|
||
this.openAmplify()
|
||
}
|
||
},
|
||
|
||
})
|
||
|
||
|