|
@@ -69,17 +69,6 @@ export default {
|
|
|
leftTreeNoData: false
|
|
|
};
|
|
|
},
|
|
|
- watch: {
|
|
|
- applyTypeOption: {
|
|
|
- handler(newName) {
|
|
|
- if (newName.length > 100) {
|
|
|
- this.$message.error('最多不能超过100个');
|
|
|
- this.applyTypeOption = newName.splice(0, 99);
|
|
|
- }
|
|
|
- },
|
|
|
- immediate: true
|
|
|
- }
|
|
|
- },
|
|
|
mounted() {
|
|
|
this.getAccountId();
|
|
|
},
|
|
@@ -168,9 +157,15 @@ export default {
|
|
|
this.autoExpandParent = false;
|
|
|
},
|
|
|
onCheck(checkedKeys) {
|
|
|
- this.checkedKeys = checkedKeys;
|
|
|
this.nodes(this.treeData, checkedKeys);
|
|
|
this.applyTypeOption = [...this.selectRightData];
|
|
|
+ const changeSelectData = [...this.selectRightData].map(item => item.key);
|
|
|
+ if (this.applyTypeOption.length > 100) {
|
|
|
+ const lastOptionKey = this.applyTypeOption[99].key;
|
|
|
+ const lastIndex = changeSelectData.findIndex(item => item === lastOptionKey);
|
|
|
+ this.checkedKeys = changeSelectData.slice(0, lastIndex + 1);
|
|
|
+ this.applyTypeOption = [...this.selectRightData].slice(0, 100);
|
|
|
+ }
|
|
|
this.$emit('applyType', this.applyTypeOption);
|
|
|
},
|
|
|
nodes(data, checkedKeys) {
|
|
@@ -178,7 +173,7 @@ export default {
|
|
|
if (item.children) {
|
|
|
this.nodes(item.children, checkedKeys);
|
|
|
}
|
|
|
- else {
|
|
|
+ else {
|
|
|
if (checkedKeys.indexOf(item.key) !== -1) {
|
|
|
this.selectRightData.add(item);
|
|
|
}
|