Browse Source

提交一下

1
mo 4 năm trước cách đây
mục cha
commit
5b1994744c
1 tập tin đã thay đổi với 16 bổ sung15 xóa
  1. 16 15
      src/views/categroyManager/productSystem/memberSet.vue

+ 16 - 15
src/views/categroyManager/productSystem/memberSet.vue

@@ -215,7 +215,7 @@
               node-key="id"
               @check="onTreeCheck"
               :filter-node-method="filterNode"
-              ref="tree"
+              ref="trees"
               highlight-current
               :default-checked-keys="checkList"
               :props="defaultProps"
@@ -313,7 +313,7 @@ export default {
         icon: "",
         into: "",
       }),
-        this.$refs.tree.setCheckedNodes([]);
+        this.$refs.trees.setCheckedNodes([]);
       this.onTreeCheck();
       this.$refs[ruleForm].resetFields();
     },
@@ -346,8 +346,8 @@ export default {
     onSubmit() {
       this.$refs.ruleForm.validate(async (flag) => {
         if (flag) {
-          let tempIds = this.$refs.tree.getCheckedKeys();
-          let halfIds = this.$refs.tree.getHalfCheckedKeys();
+          let tempIds = this.$refs.trees.getCheckedKeys();
+          let halfIds = this.$refs.trees.getHalfCheckedKeys();
           let allIds = [...tempIds, ...halfIds];
           if (this.pageType == "update") {
             try {
@@ -379,13 +379,13 @@ export default {
       if (val) {
         // 先去掉半选
         this.isIndeterminate = false;
-        this.$refs.tree.setCheckedNodes(this.treeData);
+        this.$refs.trees.setCheckedNodes(this.treeData);
       } else {
-        this.$refs.tree.setCheckedNodes([]);
+        this.$refs.trees.setCheckedNodes([]);
       }
     },
     onTreeCheck() {
-      let checkTree = this.$refs.tree.getCheckedKeys();
+      let checkTree = this.$refs.trees.getCheckedKeys();
       this.checkAll = checkTree.length >= this.slideCount;
       this.isIndeterminate =
         checkTree.length > 0 && checkTree.length < this.slideCount;
@@ -395,12 +395,12 @@ export default {
       return data.label.indexOf(value) !== -1;
     },
     seachRoles() {
-      this.$refs.tree.filter(this.seachRoleValue);
+      this.$refs.trees.filter(this.seachRoleValue);
     },
     onReSetRole() {
       this.seachRoleValue = "";
       // this.data = this.setTableData(this.silderList);
-      this.$refs.tree.filter(this.seachRoleValue);
+      this.$refs.trees.filter(this.seachRoleValue);
       // console.log(this.data);
     },
     setTableData(result, disabled) {
@@ -426,6 +426,7 @@ export default {
       return list;
     },
     async resetMember(row, type) {
+       this.branchStatus = true;
     await  this.resetTree(row);
       if (type) {
         this.title = "修改会员等级";
@@ -440,7 +441,7 @@ export default {
         this.slideCount = 0;
         this.treeData = await this.setTableData(this.silderList, this.addDisabled);
       }
-      this.branchStatus = true;
+
     },
     //递归获取到所有的为子级的ID
     getParent(checkIds, data) {
@@ -474,20 +475,20 @@ export default {
         this.form = { ...res.data };
 
         this.checkAll =
-          res.data.memberPrivilegesItemIdList.length >= this.slideCount;
+          res.data.memberPrivilegesItemIdList?.length >= this.slideCount || false;
         // 反写树的值
         this.isIndeterminate =
-          res.data.memberPrivilegesItemIdList.length > 0 &&
-          res.data.memberPrivilegesItemIdList.length < this.slideCount;
+          res.data.memberPrivilegesItemIdList?.length > 0 &&
+          res.data.memberPrivilegesItemIdList?.length < this.slideCount;
 
         this.checkList = res.data.memberPrivilegesItemIdList;
         let tSplice = this.getParent(
-          res.data.memberPrivilegesItemIdList,
+          res.data.memberPrivilegesItemIdList||[],
           this.treeData
         );
         this.checkList = tSplice;
         this.$nextTick(() => {
-          this.$refs.tree.setCheckedKeys(this.checkList);
+          this.$refs.trees.setCheckedKeys(this.checkList);
         });
       } catch (e) {
         console.log(e);