ykzz-app/pages/aqjc/jcsjTable.vue

115 lines
2.7 KiB
Vue

<template>
<div class="table_div" :style="{display:'block',width:name == '结构缝开度'? 500:730 ,overflowX:'scroll'}">
<div class="table_cur">
<table >
<tr>
<th v-for="(cols,i) in columns" :key="i" :style="getStyle(cols)">
{{ cols.title }}
</th>
</tr>
<!-- style="max-height: 480px; overflow-y: auto" -->
<!-- <view>{{JSON.stringify(data)}}</view> -->
<div class="scroll-table" >
<tr v-for="(item, index) in data" :key="index">
<td v-for="(col,i) in columns" :key="i" style="width:100px;text-align:center;">
{{item[col.key] }}
</td>
</tr>
</div>
<div style="height:180px"></div>
</table>
</div>
</div>
</template>
<script>
import moment from "moment"
export default {
props:{
columns:{
type:Array,
default:[],
},
data:{
type:Array,
default:[],
},
name:{
type:String,
default:'',
},
newCol:{
type:Array,
default:[],
}
},
computed:{
// newList(){
// if(this.tableData.length){
// return this.tableData.map(item => ({...item,tm:moment(item.tm).format("MM-DD HH:mm")}))
// }
// }
},
methods:{
getStyle(row){
return {
width:"100px"
}
}
}
}
</script>
<style lang="scss" scoped>
.table_div {
height: 100%;
max-width: calc(100% - 0px);
max-height: calc(100vh);
flex: 1;
padding-top: 0px;
overflow-x: scroll;
}
/*table样式*/
.table_cur {
width: 100%;
empty-cells: show;
border-collapse: collapse;
font-size: 14px;
}
.scroll-table{
height: calc(100vh - 180px);
overflow-y: auto;
// overflow-x: auto;
width:'100%'
}
.table_cur tr {
display: flex;
line-height: 90rpx;
// overflow-x: auto;
}
.table_cur th {
height: 85rpx;
color: #3399ef;
background: #e1f3ff;
font-size: 14px;
// font-weight: bold;
padding: 0px 10px;
box-sizing: border-box;
white-space: nowrap;
text-align: center !important;
}
.table_cur td {
height: 65rpx;
// border-bottom: 1px solid #d8ddeb;
font-size: 14px;
color: #2f4056;
padding: 0 10px;
box-sizing: border-box;
white-space: nowrap;
text-align: center !important;
}
/*table样式 end*/
</style>