|
@@ -104,8 +104,9 @@
|
|
:default-expanded-keys="ids"
|
|
:default-expanded-keys="ids"
|
|
highlight-current
|
|
highlight-current
|
|
:show-checkbox="!IS_ASSIGN_TEACHER"
|
|
:show-checkbox="!IS_ASSIGN_TEACHER"
|
|
|
|
+ :check-strictly="true"
|
|
@node-click="handleNodeClick"
|
|
@node-click="handleNodeClick"
|
|
- @check-change="checkChange"
|
|
|
|
|
|
+ @check="checkChange"
|
|
><span
|
|
><span
|
|
slot-scope="{ data }"
|
|
slot-scope="{ data }"
|
|
:class="{ 'node-level-one': !data.parentId }"
|
|
:class="{ 'node-level-one': !data.parentId }"
|
|
@@ -320,8 +321,47 @@ export default {
|
|
this.showMoveButtton = false;
|
|
this.showMoveButtton = false;
|
|
this.curProperty = Object.assign({}, object);
|
|
this.curProperty = Object.assign({}, object);
|
|
},
|
|
},
|
|
- checkChange() {
|
|
|
|
- this.multipleSelection = this.$refs.PropertyTree.getCheckedKeys();
|
|
|
|
|
|
+ checkChange(data, { checkedKeys }) {
|
|
|
|
+ const checked = checkedKeys.includes(data.id);
|
|
|
|
+
|
|
|
|
+ if (!data.propertyList || !data.propertyList.length) {
|
|
|
|
+ this.multipleSelection = this.$refs.PropertyTree.getCheckedKeys();
|
|
|
|
+ if (checked) return;
|
|
|
|
+
|
|
|
|
+ this.multipleSelection = this.multipleSelection.filter(
|
|
|
|
+ (id) => id !== data.parentId
|
|
|
|
+ );
|
|
|
|
+ this.$refs.PropertyTree.setCheckedKeys(this.multipleSelection);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let propsIds = [];
|
|
|
|
+ const getPropIds = (propertyList) => {
|
|
|
|
+ if (!propertyList || !propertyList.length) return;
|
|
|
|
+ propertyList.forEach((item) => {
|
|
|
|
+ propsIds.push(item.id);
|
|
|
|
+ if (item.propertyList) getPropIds(item.propertyList);
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ if (data.propertyList && data.propertyList.length) {
|
|
|
|
+ getPropIds(data.propertyList);
|
|
|
|
+ if (checked) {
|
|
|
|
+ let checkedKeys = this.$refs.PropertyTree.getCheckedKeys();
|
|
|
|
+ checkedKeys.push(...propsIds);
|
|
|
|
+ const idSet = new Set(checkedKeys);
|
|
|
|
+ this.multipleSelection = Array.from(idSet);
|
|
|
|
+ this.$refs.PropertyTree.setCheckedKeys(this.multipleSelection);
|
|
|
|
+ } else {
|
|
|
|
+ let checkedKeys = this.$refs.PropertyTree.getCheckedKeys();
|
|
|
|
+ this.multipleSelection = checkedKeys.filter(
|
|
|
|
+ (item) => !propsIds.includes(item)
|
|
|
|
+ );
|
|
|
|
+ this.$refs.PropertyTree.setCheckedKeys(this.multipleSelection);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.multipleSelection = this.$refs.PropertyTree.getCheckedKeys();
|
|
|
|
+ }
|
|
},
|
|
},
|
|
//查询所有课程
|
|
//查询所有课程
|
|
getCourses(query) {
|
|
getCourses(query) {
|