فهرست منبع

Merge remote-tracking branch 'origin/dev5.3.4' into dev/new1

zhouna 5 سال پیش
والد
کامیت
bd1d022fe7
2فایلهای تغییر یافته به همراه22 افزوده شده و 24 حذف شده
  1. 6 0
      src/components/ScaleTable/index.less
  2. 16 24
      src/components/SpreadDrop/index.jsx

+ 6 - 0
src/components/ScaleTable/index.less

@@ -1,6 +1,12 @@
 @import "~@less/mixin.less";
 .tableBox{
   // height: 690px;
+  -webkit-touch-callout: none;
+  -webkit-user-select: none;
+  -khtml-user-select: none;
+  -moz-user-select: none;
+  -ms-user-select: none;
+  user-select: none;
   overflow-y: auto;
   padding: 30px;
   h1{

+ 16 - 24
src/components/SpreadDrop/index.jsx

@@ -171,7 +171,8 @@ class SpreadDrop extends Component{
   getInitExclu(){
     const {defaulted,data,value} = this.props;
     let excluId = '',excName='';
-    if(defaulted&&value===undefined){
+    let showDefaulted = this.ifDefault();
+    if(showDefaulted&&defaulted&&value===undefined){
       const it = data[0];
       excluId = it.exclusionType===1?it.questionDetailList[0].id:'';
       excName = it.exclusionType===1?it.questionDetailList[0].name:'';
@@ -201,8 +202,6 @@ class SpreadDrop extends Component{
     this.setState({
       nones:'',
       exists:[],
-      //existsName:{},
-      //withsName:{},
       withs:[],
       noneIds:[],
       noneOn:false,
@@ -282,11 +281,8 @@ class SpreadDrop extends Component{
     if(+item.code===1){     //操作“伴”类型
       this.setState({
         withOn:!withOn,
-        // withs:withOn?[]:[...withs,id],     //取消“伴”选中,伴随症状全部取消选中    
-        // withs:withOn?[]:[...withs,{id:item.id,name:name}],
         withs:withOn?[]:withs,
         ban:withOn?{}:{id:id,name:name,value:name},
-        //withsName:withOn?"":withsName+name,     //取消“伴”选中,伴随症状全部取消选中
         nowOn:withOn?(noneOn?'none':''):'with'
       });
       return;
@@ -329,10 +325,8 @@ class SpreadDrop extends Component{
         nones += name+'、';
         noneIds.push(id);
       }else if(nowOn=='with'){
-        // withs.push({id:id,name:name,questionId:item.questionId});
         withs.push({id:id,name:name,questionId:item.questionId,conceptId:item.conceptId});
       }else{
-        // exists.push({id:id,name:name,listIndex,questionId:item.questionId});
         exists.push({id:id,name:name,listIndex,questionId:item.questionId,conceptId:item.conceptId});
       }
     }
@@ -347,23 +341,26 @@ class SpreadDrop extends Component{
     });
   }
   getClass(){
-    const {isImports,show,value,isExtBlue} = this.props;
+    const {isImports,show,value,isExtBlue,defaulted} = this.props;
     const blueBorder = this.state.editable?style['blue-border']:'';
     const orgBorder = isImports&&!value?style['orange-border']:'';
     const ext = isExtBlue?style['ext']:'';
+    let showDefaulted = this.ifDefault();
     if(show){
       $(this.$div.current).addClass(style['borderd']);
     }else{
       $(this.$div.current).removeClass(style['borderd']);
     }
-    if(value){
+    if(value||(showDefaulted&&value===undefined&&defaulted)){
       return classNames(style['selected-tag'],blueBorder,setFontColorSize());
-    }else{
-
     }
-    return classNames(style['tag'],orgBorder,ext,setFontColorSize(1));
+    return classNames(style['tag'],orgBorder,ext,setFontColorSize());
+  }
+  ifDefault(){
+    const {type,otherDefault,curDefault} = this.props;
+    const showDefaulted = (type=='2'&&curDefault)||(type=='3'&&otherDefault);
+    return showDefaulted;
   }
-
   componentDidMount(){
     if(isIE()){
       $(this.$div.current).onIe8Input(function(e){
@@ -371,16 +368,11 @@ class SpreadDrop extends Component{
       },this);
     }
   }
-  /*componentWillReceiveProps(nextProps){
-    const {setHighter} = this.props;
-    if(!nextProps.show){console.log(22)
-      setHighter&&setHighter(48);
-    }
-  }*/
   render(){
-    const {placeholder,value,show,data,order,type,tagType,ikey,pos,defaulted} = this.props;
+    const {placeholder,value,show,data,order,type,tagType,pos,defaulted,showVal} = this.props;
     const {tmpDom,left} = this.state;
-    const clickIndx = ikey.split('-')[1];//展开下拉的index
+    let showDefaulted = this.ifDefault();
+    let showV = showDefaulted&&value===undefined?showVal:value;       //未选中过值时展示默认选中
     if(!show&&tmpDom){
       $(tmpDom).parent().prev().attr({"contentEditable":true})
     }
@@ -398,8 +390,8 @@ class SpreadDrop extends Component{
         onBlur={this.handleBlur}
         onInput={this.onChange}
         onkeydown={handleEnter}
-        >{value||placeholder}</div>
-          <ListItems parDiv={this.$list} defaulted={defaulted} pos={pos} data={data} order={order} left={left} boxMark={type} tagType={tagType}
+        >{showV||placeholder}</div>
+          <ListItems parDiv={this.$list} defaulted={showDefaulted&&defaulted} pos={pos} data={data} order={order} left={left} boxMark={type} tagType={tagType}
              show={show} handleSelect={this.handleSelect} handleConfirm={this.handleConfirm} handleClear={this.handleClear} {...this.state}></ListItems>
       </div>
   }