update Table

update Table
This commit is contained in:
梁灏 2016-11-29 16:29:52 +08:00
parent 97edb2eb3b
commit 6c99b9fe59
3 changed files with 20 additions and 12 deletions

View file

@ -68,13 +68,18 @@
style: Object, style: Object,
columns: Array, columns: Array,
objData: Object, objData: Object,
data: Array, // rebuildData
fixed: Boolean fixed: Boolean
}, },
computed: { computed: {
isSelectAll () { isSelectAll () {
let isSelectAll = true; let isSelectAll = true;
for (let i in this.objData) {
if (!this.objData[i]._isChecked) isSelectAll = false; for (let i = 0; i < this.data.length; i++) {
if (!this.objData[this.data[i]._index]._isChecked) {
isSelectAll = false;
break;
}
} }
return isSelectAll; return isSelectAll;

View file

@ -7,7 +7,8 @@
:prefix-cls="prefixCls" :prefix-cls="prefixCls"
:style="tableStyle" :style="tableStyle"
:columns="cloneColumns" :columns="cloneColumns"
:obj-data="objData"></table-head> :obj-data="objData"
:data="rebuildData"></table-head>
</div> </div>
<div :class="[prefixCls + '-body']" :style="bodyStyle" v-el:body @scroll="handleBodyScroll"> <div :class="[prefixCls + '-body']" :style="bodyStyle" v-el:body @scroll="handleBodyScroll">
<table-body <table-body
@ -25,7 +26,8 @@
:prefix-cls="prefixCls" :prefix-cls="prefixCls"
:style="fixedTableStyle" :style="fixedTableStyle"
:columns="leftFixedColumns" :columns="leftFixedColumns"
:obj-data="objData"></table-head> :obj-data="objData"
:data="rebuildData"></table-head>
</div> </div>
<div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" v-el:fixed-body> <div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" v-el:fixed-body>
<table-body <table-body
@ -44,7 +46,8 @@
:prefix-cls="prefixCls" :prefix-cls="prefixCls"
:style="fixedRightTableStyle" :style="fixedRightTableStyle"
:columns="rightFixedColumns" :columns="rightFixedColumns"
:obj-data="objData"></table-head> :obj-data="objData"
:data="rebuildData"></table-head>
</div> </div>
<div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" v-el:fixed-right-body> <div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" v-el:fixed-right-body>
<table-body <table-body
@ -282,9 +285,9 @@
this.$emit('on-selection-change', selection); this.$emit('on-selection-change', selection);
}, },
selectAll (status) { selectAll (status) {
for (let i in this.objData) { this.rebuildData.forEach((data) => {
this.objData[i]._isChecked = status; this.objData[data._index]._isChecked = status;
} });
const selection = this.getSelection(); const selection = this.getSelection();
if (status) { if (status) {

View file

@ -198,8 +198,8 @@
this.$Message.info(this.data[index].name); this.$Message.info(this.data[index].name);
}, },
current (newData, oldData) { current (newData, oldData) {
console.log(newData); // console.log(newData);
console.log(oldData); // console.log(oldData);
}, },
select (a,b){ select (a,b){
// console.log(a); // console.log(a);
@ -209,7 +209,7 @@
// console.log(a) // console.log(a)
}, },
sall (a) { sall (a) {
// console.log(a) console.log(a)
}, },
rowClsName (row, index) { rowClsName (row, index) {
if (index == 1) { if (index == 1) {
@ -238,7 +238,7 @@
// edit: false // edit: false
// }); // });
// this.data.splice(0, 1); // this.data.splice(0, 1);
this.columns.splice(2,1) // this.columns.splice(2,1)
}, 3000); }, 3000);
} }
} }