Bläddra i källkod

单选默认值显示bug修改2709

zhouna 5 år sedan
förälder
incheckning
da0f045f3a
3 ändrade filer med 6 tillägg och 4 borttagningar
  1. 3 2
      src/components/RadioDrop/index.jsx
  2. 2 1
      src/containers/eleType.js
  3. 1 1
      src/utils/utils.js

+ 3 - 2
src/components/RadioDrop/index.jsx

@@ -101,10 +101,11 @@ class RadioDrop extends Component{
     });
   }
   componentDidMount(){    //默认值选中
-    const {data,ikey,handleSelect,hideTag,mainSaveText,value,boxMark,readDefault,confDefault} = this.props;
+    const {data,ikey,handleSelect,hideTag,mainSaveText,value,boxMark,readDefault,confDefault,isGeneray} = this.props;
     const showDefault = readDefault===-1||readDefault===undefined?confDefault:readDefault;
+    const configed =  (+showDefault===1&&isGeneray)||!isGeneray;      //是一般情况且设置默认值显示或者不是一般情况
     const selected = data.find((it)=>{
-      return it.selected === undefined&&+showDefault===1&&+it.defaultSelect===1;
+      return it.selected === undefined&&+it.defaultSelect===1&&configed;
     });
     if(boxMark!=1&&!hideTag&&selected){
       // const text = selected.labelPrefix+selected.name+selected.labelSuffix;

+ 2 - 1
src/containers/eleType.js

@@ -31,7 +31,8 @@ export function singleRadio(params){
       const list = data.questionDetailList&&data.questionDetailList.length>0?data.questionDetailList:data.questionMapping;
       return <RadioDrop data={custom&&custom.length?[...custom,...list]:list}
                         placeholder={data.name}
-                        isExtBlue={data.specFlag===4?true:false}
+                        isGeneray={+data.selFlag===1}
+                        isExtBlue={+data.specFlag===4?true:false}
                         show={showArr&&showArr[showInx]}
                         value = {data.value}
                         boxMark={boxMark}

+ 1 - 1
src/utils/utils.js

@@ -169,7 +169,7 @@ export function addLabelItem(state,action,boxMark){
   const item = JSON.parse(data);
   const textL = JSON.parse(config.textLabel);
   //查体添加的自由文本标签需要逗号,且要设置隐藏状态
-  const textLabel = boxMark==='4'?Object.assign({},textL,{showInCheck:item.showInCheck,name:','}):textL;console.log(textLabel)
+  const textLabel = boxMark==='4'?Object.assign({},textL,{showInCheck:item.showInCheck,name:','}):textL;
   //使用Object.assign({},data)拷贝操作时复制项和原项会同步修改
   if(!data) return res;
   res.data.splice(+i+2,0,item,textLabel);