Commit 6c99b9fe5918506af4cbb5938856f110488b4210

Authored by 梁灏
1 parent 97edb2eb

update Table

update Table
src/components/table/table-head.vue
@@ -68,13 +68,18 @@ @@ -68,13 +68,18 @@
68 style: Object, 68 style: Object,
69 columns: Array, 69 columns: Array,
70 objData: Object, 70 objData: Object,
  71 + data: Array, // rebuildData
71 fixed: Boolean 72 fixed: Boolean
72 }, 73 },
73 computed: { 74 computed: {
74 isSelectAll () { 75 isSelectAll () {
75 let isSelectAll = true; 76 let isSelectAll = true;
76 - for (let i in this.objData) {  
77 - if (!this.objData[i]._isChecked) isSelectAll = false; 77 +
  78 + for (let i = 0; i < this.data.length; i++) {
  79 + if (!this.objData[this.data[i]._index]._isChecked) {
  80 + isSelectAll = false;
  81 + break;
  82 + }
78 } 83 }
79 84
80 return isSelectAll; 85 return isSelectAll;
src/components/table/table.vue
@@ -7,7 +7,8 @@ @@ -7,7 +7,8 @@
7 :prefix-cls="prefixCls" 7 :prefix-cls="prefixCls"
8 :style="tableStyle" 8 :style="tableStyle"
9 :columns="cloneColumns" 9 :columns="cloneColumns"
10 - :obj-data="objData"></table-head> 10 + :obj-data="objData"
  11 + :data="rebuildData"></table-head>
11 </div> 12 </div>
12 <div :class="[prefixCls + '-body']" :style="bodyStyle" v-el:body @scroll="handleBodyScroll"> 13 <div :class="[prefixCls + '-body']" :style="bodyStyle" v-el:body @scroll="handleBodyScroll">
13 <table-body 14 <table-body
@@ -25,7 +26,8 @@ @@ -25,7 +26,8 @@
25 :prefix-cls="prefixCls" 26 :prefix-cls="prefixCls"
26 :style="fixedTableStyle" 27 :style="fixedTableStyle"
27 :columns="leftFixedColumns" 28 :columns="leftFixedColumns"
28 - :obj-data="objData"></table-head> 29 + :obj-data="objData"
  30 + :data="rebuildData"></table-head>
29 </div> 31 </div>
30 <div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" v-el:fixed-body> 32 <div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" v-el:fixed-body>
31 <table-body 33 <table-body
@@ -44,7 +46,8 @@ @@ -44,7 +46,8 @@
44 :prefix-cls="prefixCls" 46 :prefix-cls="prefixCls"
45 :style="fixedRightTableStyle" 47 :style="fixedRightTableStyle"
46 :columns="rightFixedColumns" 48 :columns="rightFixedColumns"
47 - :obj-data="objData"></table-head> 49 + :obj-data="objData"
  50 + :data="rebuildData"></table-head>
48 </div> 51 </div>
49 <div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" v-el:fixed-right-body> 52 <div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" v-el:fixed-right-body>
50 <table-body 53 <table-body
@@ -282,9 +285,9 @@ @@ -282,9 +285,9 @@
282 this.$emit('on-selection-change', selection); 285 this.$emit('on-selection-change', selection);
283 }, 286 },
284 selectAll (status) { 287 selectAll (status) {
285 - for (let i in this.objData) {  
286 - this.objData[i]._isChecked = status;  
287 - } 288 + this.rebuildData.forEach((data) => {
  289 + this.objData[data._index]._isChecked = status;
  290 + });
288 291
289 const selection = this.getSelection(); 292 const selection = this.getSelection();
290 if (status) { 293 if (status) {
test/routers/table.vue
@@ -198,8 +198,8 @@ @@ -198,8 +198,8 @@
198 this.$Message.info(this.data[index].name); 198 this.$Message.info(this.data[index].name);
199 }, 199 },
200 current (newData, oldData) { 200 current (newData, oldData) {
201 - console.log(newData);  
202 - console.log(oldData); 201 +// console.log(newData);
  202 +// console.log(oldData);
203 }, 203 },
204 select (a,b){ 204 select (a,b){
205 // console.log(a); 205 // console.log(a);
@@ -209,7 +209,7 @@ @@ -209,7 +209,7 @@
209 // console.log(a) 209 // console.log(a)
210 }, 210 },
211 sall (a) { 211 sall (a) {
212 -// console.log(a) 212 + console.log(a)
213 }, 213 },
214 rowClsName (row, index) { 214 rowClsName (row, index) {
215 if (index == 1) { 215 if (index == 1) {
@@ -238,7 +238,7 @@ @@ -238,7 +238,7 @@
238 // edit: false 238 // edit: false
239 // }); 239 // });
240 // this.data.splice(0, 1); 240 // this.data.splice(0, 1);
241 - this.columns.splice(2,1) 241 +// this.columns.splice(2,1)
242 }, 3000); 242 }, 3000);
243 } 243 }
244 } 244 }