|
@@ -2,7 +2,7 @@
|
|
|
<table class="com-table">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
- <th v-for="(col, index) of data.column" :key="index" :class="{ light: col.is_light }" :style="{ width: col.width , display : col.display }" @click="onSort(col)">
|
|
|
+ <th v-for="(col, index) of data.column" :key="index" :class="{ light: col.is_light }" :style="{ width: col.width }" @click="onSort(col)">
|
|
|
{{ col.name }}
|
|
|
</th>
|
|
|
</tr>
|
|
@@ -13,18 +13,18 @@
|
|
|
<td
|
|
|
v-for="(col, i) of data.column"
|
|
|
:key="i"
|
|
|
- :style="{ width: col.width , display : col.display}"
|
|
|
+ :style="{ width: col.width ,cursor:col.cursor}"
|
|
|
:class="{ light: hoverRow == row || hoverCol == col, num: col.is_num, 'always-light': col.is_light || row.is_light }"
|
|
|
@mouseenter="hover(row, col)"
|
|
|
@mouseleave="leave()"
|
|
|
>
|
|
|
- <component :is="col.type ? col.type : 'div'" v-bind="col.props" v-html="template(col, row[col.field])" @click="onClick(col, row)"> </component>
|
|
|
+ <component :is="col.type ? col.type : 'span'" v-bind="col.props" v-html="template(col, row[col.field])" @click="onClick(col, row)"> </component>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<slot name="tr"></slot>
|
|
|
</tbody>
|
|
|
</el-scrollbar>
|
|
|
- <el-pagination class="mg-t-8" v-if="pageable" @current-change="handleCurrentChange" :current-page="currentPage4" :page-size="pageSize" layout="total, prev, pager, next, jumper" :total="data.total"> </el-pagination>
|
|
|
+ <el-pagination class="mg-t-8" v-if="pageable" @current-change="handleCurrentChange" :current-page="currentPage" :page-size="pageSize" :total="data.total" v-bind="elPaggingProps"> </el-pagination>
|
|
|
</table>
|
|
|
</template>
|
|
|
|
|
@@ -71,6 +71,11 @@ export default {
|
|
|
type: Boolean,
|
|
|
default: true,
|
|
|
},
|
|
|
+ // 列高亮
|
|
|
+ showColHover: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
+ },
|
|
|
canScroll: {
|
|
|
type: Boolean,
|
|
|
default: true,
|
|
@@ -83,6 +88,16 @@ export default {
|
|
|
type: String,
|
|
|
default: "",
|
|
|
},
|
|
|
+ // 新增 支持 pagging 组件
|
|
|
+ elPaggingProps: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {
|
|
|
+ return {
|
|
|
+ layout: "total, sizes, prev, pager, next, jumper",
|
|
|
+ // "page-sizes": [100, 200, 300, 400],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ },
|
|
|
},
|
|
|
// 自定义事件
|
|
|
emits: {
|
|
@@ -173,7 +188,7 @@ export default {
|
|
|
hover(row, col) {
|
|
|
if (this.showHover) {
|
|
|
this.hoverRow = row;
|
|
|
- this.hoverCol = col;
|
|
|
+ if (this.showColHover) this.hoverCol = col;
|
|
|
}
|
|
|
},
|
|
|
leave() {
|
|
@@ -209,104 +224,5 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style lang="less">
|
|
|
-@titleGray: #9ca5a8;
|
|
|
-@rowGray: #606769;
|
|
|
-@darkBack: #536268;
|
|
|
-.com-table {
|
|
|
- width: 100%;
|
|
|
- border-collapse: collapse;
|
|
|
-
|
|
|
- thead {
|
|
|
- tr {
|
|
|
- display: table;
|
|
|
- table-layout: fixed;
|
|
|
- width: 100%;
|
|
|
-
|
|
|
- th {
|
|
|
- background-color: fade(@darkBack, 20%);
|
|
|
- height: 30px;
|
|
|
- line-height: 30px;
|
|
|
- color: @titleGray;
|
|
|
- font-weight: 400;
|
|
|
- font-size: @fontsize-s;
|
|
|
- position: sticky;
|
|
|
- top: 0;
|
|
|
- cursor: pointer;
|
|
|
-
|
|
|
- &.light,
|
|
|
- &.always-light {
|
|
|
- color: @green;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- tbody {
|
|
|
- display: block;
|
|
|
-
|
|
|
- tr {
|
|
|
- display: table;
|
|
|
- table-layout: fixed;
|
|
|
- width: 100%;
|
|
|
-
|
|
|
- &:nth-child(2n) {
|
|
|
- background-color: fade(@rowGray, 20%);
|
|
|
- }
|
|
|
-
|
|
|
- td {
|
|
|
- padding: 0.556vh 0;
|
|
|
- color: @rowGray;
|
|
|
- text-align: center;
|
|
|
- font-size: @fontsize-s;
|
|
|
- overflow: hidden; //隐藏文字
|
|
|
- text-overflow: ellipsis; //显示 ...
|
|
|
- white-space: nowrap; //不换行
|
|
|
-
|
|
|
- &.light,
|
|
|
- &.always-light {
|
|
|
- color: @green !important;
|
|
|
- }
|
|
|
-
|
|
|
- &.num {
|
|
|
- font-family: "Bicubik";
|
|
|
- font-weight: 400;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .el-pagination {
|
|
|
- color: @gray;
|
|
|
- .el-pagination__total {
|
|
|
- color: @gray;
|
|
|
- }
|
|
|
-
|
|
|
- button {
|
|
|
- &.btn-next,
|
|
|
- &.btn-prev {
|
|
|
- background: center center no-repeat fade(@gray, 20);
|
|
|
- color: @gray-l;
|
|
|
- }
|
|
|
- &:disabled {
|
|
|
- color: @gray-l;
|
|
|
- background-color: fade(@gray, 20);
|
|
|
- cursor: not-allowed;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .el-pager li {
|
|
|
- color: @gray-l;
|
|
|
- background: fade(@gray, 20);
|
|
|
- &.active {
|
|
|
- color: @green;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .el-input__inner {
|
|
|
- color: @gray-l;
|
|
|
- background: fade(@gray, 20);
|
|
|
- border: 1px solid fade(@gray, 20);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
</style>
|
|
|
+
|