|
@@ -33,7 +33,8 @@
|
|
|
style
|
|
|
:header-cell-style="{ background: '#EDEEF0', color: '#444' }"
|
|
|
tooltip-effect="dark"
|
|
|
- @selection-change="handleSelectionChange"
|
|
|
+ @select="onTableSelect"
|
|
|
+ @select-all="onTableSelectALL"
|
|
|
max-height="300px"
|
|
|
>
|
|
|
<el-table-column
|
|
@@ -103,7 +104,7 @@ export default {
|
|
|
search: "",
|
|
|
subjectId: null,
|
|
|
},
|
|
|
- selectList: this.chioseList
|
|
|
+ selectList: this.chioseList || []
|
|
|
};
|
|
|
},
|
|
|
async mounted() {
|
|
@@ -149,18 +150,42 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- handleSelectionChange(val) {
|
|
|
- if(this.loading) return
|
|
|
- this.selectList = val;
|
|
|
+ // 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();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ onTableSelectALL(val) {
|
|
|
+ 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();
|
|
|
+
|
|
|
+
|
|
|
+ let inIdList = rows.map((group) => {
|
|
|
+ return group.userId;
|
|
|
+ });
|
|
|
+ const isAdd = inIdList.indexOf(row.userId) === -1 ? false : true
|
|
|
+
|
|
|
+ if(isAdd) {
|
|
|
+ if(idList.indexOf(row.userId) === -1) {
|
|
|
+ this.selectList.push(row)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(idList.indexOf(row.userId) !== -1) {
|
|
|
+ this.selectList.splice(idList.indexOf(row.userId), 1)
|
|
|
}
|
|
|
}
|
|
|
},
|