表格样式跟职站一致

dev_2022-04-07
yujialong 3 years ago
parent d01a53ff85
commit 8112e3d675
  1. 47
      src/styles/common.scss
  2. 42
      src/views/Data.vue
  3. 45
      src/views/Preview.vue

@ -25,4 +25,51 @@ input::-moz-input-placeholder {
} }
input::-ms-input-placeholder { input::-ms-input-placeholder {
color: #333; color: #333;
}
body .cus-table.el-table {
border-radius: 4px;
th{
background-color: #E8F0FF !important;
.cell{
color: #222326;
font-size: 12px;
font-weight: normal;
.el-checkbox{
&:before{
opacity: 1;
}
}
}
}
th, td{
padding: 10px 0;
border-bottom-color: #E1E6F2;
}
&.el-table--striped .el-table__body tr.el-table__row--striped td{
background-color: #FAFBFF !important;
}
.el-button--text{
padding: 0;
}
}
.pagination {
margin: 20px 0;
text-align: center;
button,.number,.more,.el-input__inner{
min-width: 32px !important;
height: 32px !important;
line-height: 32px;
color: #333 !important;
background-color: transparent !important;
border: 1px solid #ccc !important;
border-radius: 2px !important;
}
button i{
color: #333;
}
.active{
color: #fff !important;
background-color: #007eff!important;
}
} }

@ -1,5 +1,5 @@
<template> <template>
<div class="wrap"> <div class="wrap" v-loading="loading">
<div class="inner"> <div class="inner">
<el-page-header @back="$router.back()" content="我的数据"></el-page-header> <el-page-header @back="$router.back()" content="我的数据"></el-page-header>
<div class="tool"> <div class="tool">
@ -12,7 +12,7 @@
</div> </div>
</div> </div>
<el-table :data="list" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange"> <el-table :data="list" class="cus-table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="80" align="center"></el-table-column> <el-table-column type="selection" width="80" align="center"></el-table-column>
<el-table-column type="index" label="序号" width="55" align="center"></el-table-column> <el-table-column type="index" label="序号" width="55" align="center"></el-table-column>
<el-table-column prop="fileName" label="文件名称" align="center" show-overflow-tooltip></el-table-column> <el-table-column prop="fileName" label="文件名称" align="center" show-overflow-tooltip></el-table-column>
@ -50,6 +50,7 @@ export default {
data() { data() {
return { return {
token: util.getCookie('token'), token: util.getCookie('token'),
loading: false,
list: [], list: [],
multipleSelection: [], multipleSelection: [],
keyword: '', keyword: '',
@ -66,6 +67,9 @@ export default {
},500) },500)
} }
}, },
created() {
this.loading = true
},
mounted(){ mounted(){
this.getData() this.getData()
}, },
@ -76,7 +80,10 @@ export default {
const { data } = res const { data } = res
this.list = data.records this.list = data.records
this.total = data.total this.total = data.total
}).catch(res => {}) this.loading = false
}).catch(res => {
this.loading = false
})
}, },
// //
initData() { initData() {
@ -186,38 +193,9 @@ export default {
.action { .action {
display: inline-flex; display: inline-flex;
} }
/deep/.el-table {
.el-table__cell {
padding: 10px 0;
}
th.el-table__cell {
& > .cell {
color: #fff;
}
}
}
.copy { .copy {
margin-left: 5px; margin-left: 5px;
cursor: pointer; cursor: pointer;
} }
.pagination {
margin: 20px 0;
text-align: center;
button,.number,.more,.el-input__inner{
min-width: 32px !important;
height: 32px !important;
line-height: 32px;
color: #333 !important;
background-color: transparent !important;
border: 1px solid #ccc !important;
border-radius: 2px !important;
}
button i{
color: #333;
}
.active{
color: #fff !important;
}
}
} }
</style> </style>

@ -2,7 +2,7 @@
<div class="wrap"> <div class="wrap">
<div class="inner"> <div class="inner">
<el-page-header @back="$router.back()" content="excel预览" style="margin-bottom: 20px"></el-page-header> <el-page-header @back="$router.back()" content="excel预览" style="margin-bottom: 20px"></el-page-header>
<el-table :data="list" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange"> <el-table :data="list" class="cus-table" ref="table" stripe header-align="center" v-loading="loading" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="80" align="center"></el-table-column> <el-table-column type="selection" width="80" align="center"></el-table-column>
<el-table-column type="index" label="序号" width="55" align="center"></el-table-column> <el-table-column type="index" label="序号" width="55" align="center"></el-table-column>
<el-table-column v-for="(item,index) in list[0]" :prop="index" :key="index" :label="index" align="center"></el-table-column> <el-table-column v-for="(item,index) in list[0]" :prop="index" :key="index" :label="index" align="center"></el-table-column>
@ -15,7 +15,7 @@ export default {
data() { data() {
return { return {
path: this.$route.query.path, path: this.$route.query.path,
thead: [], loading: false,
list: [], list: [],
multipleSelection: [] multipleSelection: []
}; };
@ -26,15 +26,12 @@ export default {
methods: { methods: {
// //
getData() { getData() {
this.loading = true
this.$post(`${this.api.lookExcel}?excelUrl=${this.path}`).then(res => { this.$post(`${this.api.lookExcel}?excelUrl=${this.path}`).then(res => {
const { data } = res const { data } = res
const thead = []
if (data.length) { if (data.length) {
const item = data[0]
for (const i in item) {
i && thead.push(i)
}
const result = [] const result = []
//
data.map(e => { data.map(e => {
let valid = false let valid = false
for (const i in e) { for (const i in e) {
@ -45,11 +42,12 @@ export default {
} }
valid && result.push(e) valid && result.push(e)
}) })
this.thead = thead
this.list = result this.list = result
this.loading = false
} }
}).catch(res => { }).catch(res => {
this.loading = false
// excel
window.open('https://view.officeapps.live.com/op/view.aspx?src=' + this.path) window.open('https://view.officeapps.live.com/op/view.aspx?src=' + this.path)
this.$router.back() this.$router.back()
}) })
@ -77,38 +75,9 @@ export default {
.action { .action {
display: inline-flex; display: inline-flex;
} }
/deep/.el-table {
.el-table__cell {
padding: 10px 0;
}
th.el-table__cell {
& > .cell {
color: #fff;
}
}
}
.copy { .copy {
margin-left: 5px; margin-left: 5px;
cursor: pointer; cursor: pointer;
} }
.pagination {
margin: 20px 0;
text-align: center;
button,.number,.more,.el-input__inner{
min-width: 32px !important;
height: 32px !important;
line-height: 32px;
color: #333 !important;
background-color: transparent !important;
border: 1px solid #ccc !important;
border-radius: 2px !important;
}
button i{
color: #333;
}
.active{
color: #fff !important;
}
}
} }
</style> </style>
Loading…
Cancel
Save