|
@@ -33,6 +33,7 @@
|
|
|
style
|
|
|
:header-cell-style="{ background: '#EDEEF0', color: '#444' }"
|
|
|
tooltip-effect="dark"
|
|
|
+ @handleSelectionChange="handleSelectionChange"
|
|
|
@select="onTableSelect"
|
|
|
@select-all="onTableSelectALL"
|
|
|
max-height="300px"
|
|
@@ -150,23 +151,47 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- // handleSelectionChange(val) {
|
|
|
- // if(this.loading) return
|
|
|
- // this.selectList = val;
|
|
|
- // },
|
|
|
- // onTableSelect(rows, row) {
|
|
|
- // let idList = this.selectList.map((group) => {
|
|
|
- // return group.userId;
|
|
|
- // });
|
|
|
- // if (idList.indexOf(row.userId) != -1) {
|
|
|
- // this.selectList.splice(idList.indexOf(row.userId), 1);
|
|
|
- // if (this.selectList.length <= 0) {
|
|
|
- // this.clearCom();
|
|
|
- // }
|
|
|
- // }
|
|
|
- // },
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ console.log(val, 'handleSelectionChange')
|
|
|
+ },
|
|
|
onTableSelectALL(val) {
|
|
|
- this.selectList = val
|
|
|
+ const list = this.list || []
|
|
|
+
|
|
|
+ if(val.length > 0) {
|
|
|
+ const sIds = this.selectList.map((item) => {
|
|
|
+ return item.userId
|
|
|
+ })
|
|
|
+ val.forEach((item) => {
|
|
|
+ if(sIds.indexOf(item.userId) == -1) {
|
|
|
+ this.selectList.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ const ids = list.map((item) => {
|
|
|
+ return item.userId
|
|
|
+ })
|
|
|
+
|
|
|
+ const sIds = this.selectList.map((item) => {
|
|
|
+ return item.userId
|
|
|
+ })
|
|
|
+
|
|
|
+ const removeIds = []
|
|
|
+ ids.forEach((item) => {
|
|
|
+ if(sIds.indexOf(item) !== -1) {
|
|
|
+ removeIds.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ console.log(ids, sIds, 'sids', removeIds)
|
|
|
+ const temp = []
|
|
|
+ this.selectList.forEach((item) => {
|
|
|
+ if(removeIds.indexOf(item.userId) === -1) {
|
|
|
+ temp.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ this.selectList = temp
|
|
|
+ }
|
|
|
},
|
|
|
onTableSelect(rows, row) {
|
|
|
let idList = this.selectList.map((group) => {
|