Browse Source

互斥项已选可操作1441

zhouna 6 years atrás
parent
commit
c00f7babe2
1 changed files with 12 additions and 3 deletions
  1. 12 3
      src/components/SpreadDrop/index.jsx

+ 12 - 3
src/components/SpreadDrop/index.jsx

@@ -229,9 +229,15 @@ class SpreadDrop extends Component{
     const linkStr = joint||'';
     const name = item.name+linkStr;
     if(isExclu){      //操作“互斥项”
-      if([...noneIds,...exists,...withs].length>0){     //已选非互斥项,互斥项不可操作
+      if([...noneIds,...exists,...withs].length>0){     //已选非互斥项,清空已选项,选中该互斥项
+        this.clearState();
+        this.setState({
+          exclusion:id,
+          excluName:name
+        });
         return;
       }
+      //未选中互斥项,直接选中该互斥项
       let temp = '';
       if(exclusion==''){
         temp = id;
@@ -262,8 +268,11 @@ class SpreadDrop extends Component{
       }
       return;
     }
-    if(exclusion!==''){     //互斥项被选中,其他不可操作
-      return;
+    if(exclusion!==''){     //互斥项已选中,清空互斥项
+      this.setState({
+        exclusion:'',
+        excluName:''
+      });
     }
     if(+item.code===1){     //操作“伴”类型
       this.setState({