Selaa lähdekoodia

复制血压代码优化

zhouna 5 vuotta sitten
vanhempi
commit
9f2aab9f1b
1 muutettua tiedostoa jossa 4 lisäystä ja 2 poistoa
  1. 4 2
      src/utils/utils.js

+ 4 - 2
src/utils/utils.js

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