Ver código fonte

添加症状微处理

liucf 6 anos atrás
pai
commit
d74701c14c

+ 1 - 1
src/components/SpreadDrop/index.jsx

@@ -250,7 +250,7 @@ class SpreadDrop extends Component{
         // withs:withOn?[]:[...withs,id],     //取消“伴”选中,伴随症状全部取消选中    
         // withs:withOn?[]:[...withs,{id:item.id,name:name}],
         withs:withOn?[]:withs,
-        ban:withOn?{}:{id:id,name:name},
+        ban:withOn?{}:{id:id,name:name,value:name},
         //withsName:withOn?"":withsName+name,     //取消“伴”选中,伴随症状全部取消选中
         nowOn:withOn?(noneOn?'none':''):'with'
       });

+ 14 - 1
src/containers/SpreadDrop.js

@@ -53,6 +53,20 @@ function mainSuitModule(dispatch,store,params){
     Notify.info(config.limitText);
     return
   }
+  // 给主症状伴随添加exists字段
+  if(exists.length>0){
+    for(let k=0; k<exists.length; k++){
+      exists[k].value=exists[k].name;
+      exists[k].exist=1;
+    }
+  }
+  if(withs.length>0){
+    for(let n=0; n<withs.length; n++){
+      withs[n].value=withs[n].name;
+      withs[n].exist=2;
+    }
+  }
+  console.log(88,withs,exists);
   // let existsName = getNames(exists);
   // let withsName = getNames(withs);
   const copExists = JSON.parse(JSON.stringify(exists));
@@ -78,7 +92,6 @@ function mainSuitModule(dispatch,store,params){
     if(banIndex==-1){
       num = 1;
     }
-    console.log(11,exists,mainSlice);
     // ikey前的data里没有exist=1的数据,则existNum=1
     if(exists.length>0){
       for(let i=0; i<mainSlice.length; i++){

+ 88 - 0
src/mock/chronicTable.js

@@ -0,0 +1,88 @@
+module.exports = {
+  data:{
+    "title":[
+        {
+            "name":"临床体格检查",
+            "column":"name"
+        },
+        {
+            "name":"临床症状",
+            "column":"detailName"
+        },
+        {
+            "name":"得分",
+            "column":"score"
+        },
+        {
+            "name":"推荐选项",
+            "column":""
+        }
+    ],
+    "result":[
+        {
+            "min":0,
+            "max":6,
+            "text":"无"
+        },
+        {
+            "min":7,
+            "max":12,
+            "text":"轻度"
+        },
+        {
+            "min":13,
+            "max":29,
+            "text":"中度"
+        },
+        {
+            "min":30,
+            "max":46,
+            "text":"重度"
+        }
+    ],
+    "details":[
+        {
+            "name":"右拇指振动觉",
+            "type":"1:radio,2:checkbox.....",
+            "details":[
+                {
+                    "detailName":"正常",
+                    "score":0,
+                    "state":"0:未选中,1-选中"
+                },
+                {
+                    "detailName":"减退",
+                    "score":1,
+                    "state":0
+                },
+                {
+                    "detailName":"消失",
+                    "score":2,
+                    "state":1
+                }
+            ]
+        },
+        {
+            "name":"左拇指振动觉",
+            "type":"1:radio,2:checkbox.....",
+            "details":[
+                {
+                    "detailName":"正常",
+                    "score":0,
+                    "state":"0:未选中,1-选中"
+                },
+                {
+                    "detailName":"减退",
+                    "score":1,
+                    "state":0
+                },
+                {
+                    "detailName":"消失",
+                    "score":2,
+                    "state":1
+                }
+            ]
+        }
+    ]
+  }
+}

+ 22 - 1
src/store/actions/mainSuit.js

@@ -177,6 +177,24 @@ export const confirm = (state,action) =>{
   if(forwardId){
     text = saveText.slice(forwardId,labelIndx);
     let index = text.indexOf('伴');
+    /*let sliceArr = arr.slice(forwardId,labelIndx);
+    let newSliceArr = JSON.parse(JSON.stringify(sliceArr));
+    let banIndex;
+    console.log(55,sliceArr);
+    for(let k=0; k<sliceArr.length;k++){
+      if(sliceArr[k].value&&sliceArr[k].value.indexOf('伴')>-1){
+        banIndex = k;
+      }
+    }
+    console.log(66,banIndex);
+    if(banIndex){//有伴
+      if(exists.length > 0){
+        Array.prototype.splice.apply(arr, [banIndex-1,0,...exists]);
+      }
+    }else{
+
+    }*/
+
     if(index==-1){//没有伴,直接插入ikey前
       if(exists.length > 0){
         let withsAddP = addPoint(exists,1);
@@ -384,19 +402,22 @@ export const insertSearch = (state,action)=>{
     if(index < 1){//前
       if(data[focusIndex].value==searchStr){//为空标签则替换
         res.data.splice(focusIndex,1,nText);
+        res.saveText.splice(focusIndex,1,searchData);
       }else{
         res.data.splice(focusIndex,0,nText);
+        res.saveText.splice(focusIndex,0,searchData);
         res.data[focusIndex+1].value = value;
         res.saveText[focusIndex+1] = value;
       }  
     }else{
       res.data.splice(focusIndex+1,0,nText);
+      res.saveText.splice(focusIndex+1,0,searchData);
       res.data[focusIndex].value = value;
     }
     span.current.innerText?(span.current.innerText = value):(span.current.innerHTML=value);
     res.mainIds.push(id);
   }
-  res.saveText = fullfillText(res.data).saveText;
+  // console.log(456,res,action);
   res.update=Math.random();
   return res;
 }