城阳pc工作端前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

432 lines
10 KiB

4 years ago
<template>
3 years ago
<div>
<div v-if="showTitle"
class="m-title">
<img class="title_img"
src="@/assets/images/index/list-logo.png"
alt />
<div class="tip_title">{{titleName}}</div>
<div class="title_line"></div>
</div>
<div class="m-table">
3 years ago
<table class="g-table"
3 years ago
border="0"
cellspacing="0"
cellpadding="0">
3 years ago
3 years ago
<col :align="item.align"
:width="item.width"
:key="'col' + index"
v-for="(item, index) in colList" />
<thead>
3 years ago
<tr class="g-table-header">
<th class="g-table-header-th"
3 years ago
v-for="item in header"
:key="item">
{{ item }}
3 years ago
</th>
</tr>
</thead>
3 years ago
<!-- <el-scrollbar :style="{height:treeHeight}"
class="g-scrollar"> -->
<tbody v-if="!loading"
class="g-table-body">
<tr class="g-table-body-tr"
3 years ago
v-for="(value, index) in list"
:key="index"
@click="handleClickRow(index)">
<td class="td"
v-for="(item, indexs) in value"
:key="indexs">
<div v-if="typeof item === 'string' || typeof item === 'number'"
:title="item">
{{ item }}
</div>
<div v-if="typeof item === 'object' && item.type === 'img'">
<!-- <span>{{ item.type+ item.src}}</span> -->
<img style="width: 18px; height: 18px"
:src="item.src"
alt="" />
</div>
<div v-if="typeof item === 'object' && item && item.type == 'index'">
<img v-if="highlightTop3 && index == 0"
src="@/assets/img/shuju/top/1.png"
alt="" />
<img v-else-if="highlightTop3 && index == 1"
src="@/assets/img/shuju/top/2.png"
alt="" />
<img v-else-if="highlightTop3 && index == 2"
src="@/assets/img/shuju/top/3.png"
alt="" />
<span v-else>{{ index + 1 }}</span>
</div>
<a v-else-if="
3 years ago
typeof item === 'object' && item && item.type == 'operate'
"
3 years ago
v-for="btn in item.list"
:key="'operate' + index + btn"
@click.stop="handleClickBtn(index, btn)">{{ btn }}</a>
<a v-else-if="
3 years ago
typeof item === 'object' && item && item.type == 'people'
"
3 years ago
@click="handleClickPeople(item)">{{ item.name }}</a>
</td>
</tr>
</tbody>
3 years ago
<!-- </el-scrollbar> -->
3 years ago
</table>
<div class="table-status"
v-if="loading">
<screen-loading>加载中</screen-loading>
</div>
4 years ago
3 years ago
<div class="table-status"
v-if="list.length == 0 && !loading">
<div class="no-data">
<img src="@/assets/img/modules/visual/noData.png"
class="no-data-img" />
</div>
4 years ago
</div>
</div>
3 years ago
3 years ago
<div class="m-pagination">
<el-pagination :current-page="pageNo"
:page-size="pageSize"
background
:total="total"
layout="total">
</el-pagination>
<el-pagination :current-page="pageNo"
:page-size="pageSize"
background
:total="total"
layout="prev, pager, next, jumper, sizes"
@current-change="handlePageNoChange"
@size-change="handleSizeChange">
</el-pagination>
</div>
4 years ago
</div>
</template>
<script>
import ScreenLoading from "./loading";
3 years ago
import { mapGetters } from 'vuex'
4 years ago
export default {
name: "table",
components: {
ScreenLoading,
},
props: {
3 years ago
//是否显示标题,默认为true
showTitle: {
type: Boolean,
default: true
},
//列表标题名称
titleName: {
type: String,
default: "列表"
},
//各列对齐方式、宽度等属性
4 years ago
colList: {
type: Array,
default: () => {
return [
// {
// align: "center",
// width: "50%",
// },
];
},
},
3 years ago
//表头
4 years ago
header: {
type: Array,
required: false,
default: () => {
3 years ago
return [];
4 years ago
},
},
3 years ago
//每行数据
4 years ago
list: {
type: Array,
required: false,
default: () => {
3 years ago
return [];
4 years ago
},
},
3 years ago
//数据总数
total: {
type: Number,
default: 0
},
4 years ago
loading: {
type: Boolean,
default: true,
},
highlightTop3: {
type: Boolean,
default: false,
},
},
3 years ago
data () {
3 years ago
return {
pageSize: 10,
pageNo: 1,
};
4 years ago
},
watch: {},
3 years ago
computed: {
treeHeight () {
return this.$store.state.inIframe ? this.clientHeight - 300 + this.iframeHeight + 'px' : this.clientHeight - 300 + 'px'
},
treeWidth () {
return document.documentElement.clientWidth
},
4 years ago
3 years ago
...mapGetters(['clientHeight', 'iframeHeight'])
},
3 years ago
mounted () { },
4 years ago
3 years ago
created () { },
4 years ago
methods: {
3 years ago
//点击某一行
3 years ago
handleClickRow (index) {
3 years ago
this.$emit("handleClickRow", index);
},
3 years ago
handleClickBtn (index, type) {
4 years ago
this.$emit("operate", index, type);
},
3 years ago
handleClickPeople (item) {
this.$router.push({
path: `/main-shuju/visual-basicinfo-people/${item.uid}`,
});
},
3 years ago
handlePageNoChange (val) {
this.$emit("handlePageNoChange", val);
},
handleSizeChange (val) {
this.$emit("handleSizeChange", val);
},
4 years ago
},
};
</script>
<style lang="scss" scoped>
3 years ago
.m-title {
display: flex;
align-items: center;
// margin-left: 24px;
.title_img {
width: 17px;
height: 17px;
}
.tip_title {
margin-left: 8px;
font-size: 16px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #ffffff;
line-height: 22px;
}
.title_line {
margin-left: 8px;
width: 244px;
height: 1px;
background: linear-gradient(
270deg,
rgba(55, 198, 255, 0.1) 0%,
#1995ff 100%
);
}
}
4 years ago
.m-table {
3 years ago
margin-top: 9px;
3 years ago
width: 100%;
.g-table {
4 years ago
box-sizing: border-box;
width: 100%;
height: 100%;
border: none;
table-layout: fixed;
4 years ago
&-header {
width: 100%;
3 years ago
height: 56px;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
4 years ago
font-weight: 400;
3 years ago
color: rgba(255, 255, 255, 0.65);
line-height: 20px;
4 years ago
&-th {
3 years ago
text-align: left;
4 years ago
border: none;
3 years ago
padding: 18px 5px 18px 24px;
4 years ago
// width: calc(100% / 5);
}
}
&-body {
box-sizing: border-box;
width: 100%;
3 years ago
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
4 years ago
font-weight: 400;
color: #ffffff;
3 years ago
line-height: 20px;
4 years ago
&-tr {
box-sizing: border-box;
width: 100%;
3 years ago
min-height: 56px;
4 years ago
.td {
box-sizing: border-box;
3 years ago
text-align: left;
4 years ago
border: none;
3 years ago
padding: 18px 5px 18px 24px;
> div {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
word-wrap: normal;
}
4 years ago
a {
3 years ago
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
4 years ago
font-weight: 400;
3 years ago
color: #1a95ff;
line-height: 20px;
4 years ago
cursor: pointer;
}
}
}
3 years ago
&-tr:nth-child(2n-1) {
background: rgba(26, 149, 255, 0.15);
4 years ago
}
3 years ago
// &-tr:hover {
// background: url("../../../../assets/img/modules/visual/hover-bac.png")
// no-repeat center;
// background-size: 100% 100%;
// }
4 years ago
}
3 years ago
/deep/ .el-scrollbar__wrap {
width: 100% !important;
overflow-x: hidden !important;
}
}
.g-scrollar {
width: 100%;
4 years ago
}
.table-status {
position: relative;
height: 300px;
// 暂无数据
.no-data {
&-img {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
}
}
}
}
3 years ago
.m-pagination {
box-sizing: border-box;
3 years ago
margin-top: 24px;
3 years ago
width: 100%;
height: 40px;
display: flex;
justify-content: space-between;
/deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
3 years ago
color: #ffffff;
3 years ago
border-radius: 2px;
border: 1px solid rgba(26, 149, 255, 0.45);
3 years ago
background: #1a95ff;
3 years ago
}
/deep/ .el-pagination .el-pager li {
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
3 years ago
color: rgba(255, 255, 255, 0.65);
3 years ago
border-radius: 2px;
border: 1px solid rgba(26, 149, 255, 0.45);
3 years ago
background: #00023a;
3 years ago
}
/deep/ .el-pagination .btn-prev {
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: rgba(255, 255, 255, 0.65);
border-radius: 2px;
border: 1px solid rgba(26, 149, 255, 0.45);
background: #00023a;
}
/deep/ .el-pagination .btn-next {
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: rgba(255, 255, 255, 0.65);
border-radius: 2px;
border: 1px solid rgba(26, 149, 255, 0.45);
background: #00023a;
}
/deep/ .el-pagination__editor.el-input .el-input__inner {
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: rgba(255, 255, 255, 0.65);
border-radius: 2px;
border: 1px solid rgba(26, 149, 255, 0.45);
background: #00023a;
}
/deep/ .el-pagination .el-select .el-input .el-input__inner {
margin-left: 14px;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: rgba(255, 255, 255, 0.65);
border-radius: 2px;
border: 1px solid rgba(26, 149, 255, 0.45);
background: #00023a;
}
}
4 years ago
</style>