jinhui.wang

代码提交

......@@ -6,11 +6,11 @@
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }" v-loading="loading"
:cell-class-name="cellClassName" :header-cell-class-name="headerCellClassName" @sort-change="sortChange"
@select="tableSelect" @select-all="tableSelectAll" @select-change="SelectChange">
<!-- 选框 -->
<el-table-column v-if="selection" type="selection" :fixed="true" width="50" align="center"></el-table-column>
<!-- 选框 -->
<el-table-column v-if="selection" type="selection" width="50" align="center"></el-table-column>
<!-- 序号 -->
<el-table-column type="index" width="50" align="center"></el-table-column>
<template v-for="(item, index) in newHeader">
<el-table-column type="index" width="50" align="center" :index="indexAdd"></el-table-column>
<template v-for="(item, index) in headerData">
<!-- 自定义插槽 -->
<el-table-column v-if="item.slot" :prop="item.value" :label="item.name" :width="item.width" :align="item.align"
:fixed="item.fixed" :show-overflow-tooltip="showOverflowTooltip" :sortable="item.sorTable"
......@@ -28,10 +28,8 @@
:formatter="formatter" :key="index">
</el-table-column>
</template>
<!-- 末端插槽 -->
<slot name="optionColumn"></slot>
</el-table>
<!-- 分页 -->
<el-pagination :total="totalCount" :page-size.sync="limitSize" :current-page.sync="pageNum" :page-sizes="pageSizes"
background layout="prev, pager, next, jumper, ->, sizes, total" class="tablePagination" @size-change="sizeChange"
@next-click="nextClick" @prev-click="prevClick" @current-change="currentChange">
......@@ -47,8 +45,11 @@ export default {
props: {
//dom名称
tableName: { type: String, default: "tables" },
ductName: {
type: String,
default: ''
},
//表格数据
ductName: { type: String, default: null },
data: {
type: Array,
default() {
......@@ -165,9 +166,7 @@ export default {
inheritAttrs: false,
data() {
return {
newHeader: this.headerData,
selectTable: [],
checkDisabled: [],
pageNum: 1,
start: -1,
show: false,
......@@ -189,29 +188,22 @@ export default {
// },
};
},
created() {
this.newHeader.map((item) => {
this.checkDisabled.push(item.name);
});
},
watch: {
page() {
this.pageNum = this.page;
},
data() {
if (this.selection) {
this.data.forEach((item, index) => {
item.index = index;
});
}
this.$nextTick(() => {
this.$refs.tables.doLayout();
});
},
headerData(val, oldVal) {
this.newHeader = val;
},
},
methods: {
//数据长度切换
sizeChange(val) {
this.$emit("sizeChange", val);
},
......@@ -239,6 +231,12 @@ export default {
});
scrollTo(0, 800);
},
//连续序号
indexAdd(index) {
const page = this.pageNum // 当前页码
const pagesize = this.limitSize // 每页条数
return index + 1 + (page - 1) * pagesize
},
//表格多选,shift连续选择
tableSelect(selection, row) {
let end = row.index;
......@@ -343,6 +341,7 @@ export default {
let start = columnIndex - 1 === this.dragState.start ? `darg_start` : "";
return `${active} ${start}`;
},
cellClassName({ column, columnIndex }) {
return columnIndex - 1 === this.dragState.start ? `darg_start` : "";
},
......@@ -380,6 +379,31 @@ export default {
.el-table th {
padding: 0;
.virtual {
position: absolute;
display: block;
width: 0;
height: 0;
top: 0px;
left: 0px;
background: none;
border: none;
}
&.darg_active_left {
.virtual {
border-left: 2px dotted #666;
z-index: 99;
}
}
&.darg_active_right {
.virtual {
border-right: 2px dotted #666;
z-index: 99;
}
}
}
.thead-cell {
......