|
@@ -73,10 +73,11 @@ export const setData = (state,action) =>{
|
|
objToArr.push(mainLabelModule[m]);
|
|
objToArr.push(mainLabelModule[m]);
|
|
}
|
|
}
|
|
// 过滤掉没有mapping的数据
|
|
// 过滤掉没有mapping的数据
|
|
- let mainLabelModuleArr = objToArr.filter((item)=>{
|
|
|
|
|
|
+ let mainLabelModuleArr = objToArr;
|
|
|
|
+ /*let mainLabelModuleArr = objToArr.filter((item)=>{
|
|
return item.questionMapping.length>0;
|
|
return item.questionMapping.length>0;
|
|
- })
|
|
|
|
- console.log(444,mainLabelModuleArr);
|
|
|
|
|
|
+ })*/
|
|
|
|
+
|
|
if (useEmpty) {
|
|
if (useEmpty) {
|
|
res.data = res.emptyData;
|
|
res.data = res.emptyData;
|
|
} else {
|
|
} else {
|
|
@@ -122,19 +123,23 @@ export const setData = (state,action) =>{
|
|
let newMainCopy = JSON.parse(JSON.stringify(mainCopy));
|
|
let newMainCopy = JSON.parse(JSON.stringify(mainCopy));
|
|
let ind = 0;
|
|
let ind = 0;
|
|
let insertInd = 0;
|
|
let insertInd = 0;
|
|
- let preLength = 0;
|
|
|
|
|
|
+ // let preLength = 0;
|
|
|
|
+ let lengArr=[];
|
|
for(let k=0; k <mainCopy.length;k++){
|
|
for(let k=0; k <mainCopy.length;k++){
|
|
mainLabelModuleArr.map((v,i)=>{
|
|
mainLabelModuleArr.map((v,i)=>{
|
|
if(mainCopy[k].id==v.id){
|
|
if(mainCopy[k].id==v.id){
|
|
ind++;
|
|
ind++;
|
|
- // newMainCopy.splice(k+1,0,...v.questionMapping);
|
|
|
|
let items = v.questionMapping.filter((item)=>{
|
|
let items = v.questionMapping.filter((item)=>{
|
|
return item.symptomType==0||item.symptomType==1;
|
|
return item.symptomType==0||item.symptomType==1;
|
|
- })
|
|
|
|
- if(ind==1){
|
|
|
|
|
|
+ })
|
|
|
|
+ lengArr[k] = items.length; //每一个主诉尾巴长度
|
|
|
|
+ /*if(ind==1){
|
|
preLength = items.length;
|
|
preLength = items.length;
|
|
}else{
|
|
}else{
|
|
insertInd += preLength;
|
|
insertInd += preLength;
|
|
|
|
+ }*/
|
|
|
|
+ if(ind>1){
|
|
|
|
+ insertInd += lengArr[k-1];
|
|
}
|
|
}
|
|
newMainCopy.splice(k+insertInd+1,0,...items);
|
|
newMainCopy.splice(k+insertInd+1,0,...items);
|
|
}
|
|
}
|
|
@@ -145,7 +150,8 @@ export const setData = (state,action) =>{
|
|
if(withs.length>0){
|
|
if(withs.length>0){
|
|
let withInd = 0;
|
|
let withInd = 0;
|
|
let withInsertInd = 0;
|
|
let withInsertInd = 0;
|
|
- let withPreLength = 0;
|
|
|
|
|
|
+ // let withPreLength = 0;
|
|
|
|
+ let withLengArr=[];
|
|
for(let d=0; d <withs.length;d++){
|
|
for(let d=0; d <withs.length;d++){
|
|
mainLabelModuleArr.map((v,i)=>{
|
|
mainLabelModuleArr.map((v,i)=>{
|
|
if(withs[d].id==v.id){
|
|
if(withs[d].id==v.id){
|
|
@@ -153,10 +159,14 @@ export const setData = (state,action) =>{
|
|
let items = v.questionMapping.filter((item)=>{
|
|
let items = v.questionMapping.filter((item)=>{
|
|
return item.symptomType==0||item.symptomType==2;
|
|
return item.symptomType==0||item.symptomType==2;
|
|
})
|
|
})
|
|
- if(withInd==1){
|
|
|
|
|
|
+ /*if(withInd==1){
|
|
withPreLength = items.length;
|
|
withPreLength = items.length;
|
|
}else{
|
|
}else{
|
|
withInsertInd += withPreLength;
|
|
withInsertInd += withPreLength;
|
|
|
|
+ }*/
|
|
|
|
+ withLengArr[d] = items.length;
|
|
|
|
+ if(withInd>1){
|
|
|
|
+ withInsertInd += withLengArr[d-1];
|
|
}
|
|
}
|
|
newWiths.splice(d+withInsertInd+1,0,...items);
|
|
newWiths.splice(d+withInsertInd+1,0,...items);
|
|
}
|
|
}
|
|
@@ -223,11 +233,11 @@ export const confirm = (state,action) =>{
|
|
|
|
|
|
// 无 不用展开
|
|
// 无 不用展开
|
|
let lengthN = withsArr.length - length1;
|
|
let lengthN = withsArr.length - length1;
|
|
- let noneArr = JSON.parse(JSON.stringify(withsArr));
|
|
|
|
- const nonesName = nones.slice(0,nones.length-1)+',';
|
|
|
|
- const noneObj = Object.assign({},JSON.parse(config.textLabel),{name:nonesName,value:nonesName});
|
|
|
|
- const none = nones?noneObj:'';
|
|
|
|
- if(nones){
|
|
|
|
|
|
+ let noneArr = JSON.parse(JSON.stringify(withsArr));
|
|
|
|
+ if(nones.length>1){//只点无不上去
|
|
|
|
+ const nonesName = nones.slice(0,nones.length-1)+',';
|
|
|
|
+ const noneObj = Object.assign({},JSON.parse(config.textLabel),{name:nonesName,value:nonesName});
|
|
|
|
+ const none = nones?noneObj:'';
|
|
noneArr.splice(parseInt(ikey)+lengthN,0,none);
|
|
noneArr.splice(parseInt(ikey)+lengthN,0,none);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -259,7 +269,7 @@ export function setNumberValue(state,action){
|
|
const param = action.params;
|
|
const param = action.params;
|
|
const index = param.ikey;
|
|
const index = param.ikey;
|
|
let labelInx = getLabelIndex(index);
|
|
let labelInx = getLabelIndex(index);
|
|
- const subInx = index.substr(-1,1);
|
|
|
|
|
|
+ const subInx = index.substr(index.length-1);
|
|
let item = res.data[labelInx];
|
|
let item = res.data[labelInx];
|
|
if(+item.tagType===1){
|
|
if(+item.tagType===1){
|
|
item.value = param.text;
|
|
item.value = param.text;
|
|
@@ -284,7 +294,7 @@ export function setRadioValue(state,action){
|
|
let res = Object.assign({},state);
|
|
let res = Object.assign({},state);
|
|
const {ikey,id,text} = action;
|
|
const {ikey,id,text} = action;
|
|
let labelInx = getLabelIndex(ikey);
|
|
let labelInx = getLabelIndex(ikey);
|
|
- const subInx = ikey.substr(-1,1);
|
|
|
|
|
|
+ const subInx = ikey.substr(ikey.length-1);
|
|
let item = res.data[labelInx];
|
|
let item = res.data[labelInx];
|
|
if(typeof text != 'string'){ //需要展开项--有无治疗类型
|
|
if(typeof text != 'string'){ //需要展开项--有无治疗类型
|
|
const len = +item.copyType === 0?1:0;
|
|
const len = +item.copyType === 0?1:0;
|
|
@@ -303,6 +313,11 @@ export function setRadioValue(state,action){
|
|
});
|
|
});
|
|
}else{
|
|
}else{
|
|
item.questionMapping[subInx].value = text;
|
|
item.questionMapping[subInx].value = text;
|
|
|
|
+ /*if(item.questionMapping[subInx].controlType==1){//例如:有无治疗-未经治疗
|
|
|
|
+ item.value = text;
|
|
|
|
+ }else{
|
|
|
|
+ item.questionMapping[subInx].value = text;
|
|
|
|
+ }*/
|
|
let hasValue = false;
|
|
let hasValue = false;
|
|
const sub = item.questionMapping.map((it)=>{
|
|
const sub = item.questionMapping.map((it)=>{
|
|
//添加选中状态
|
|
//添加选中状态
|
|
@@ -371,9 +386,10 @@ export const bigDataSymptom = (state,action) => {
|
|
const index = action.info.ikey;
|
|
const index = action.info.ikey;
|
|
let labelInx = getLabelIndex(index);
|
|
let labelInx = getLabelIndex(index);
|
|
// 添加症状 暂时剔除没有id、questionMapping字段的数据
|
|
// 添加症状 暂时剔除没有id、questionMapping字段的数据
|
|
- let pushDataList = action.data.filter(function(item){
|
|
|
|
|
|
+ let pushDataList = action.data;
|
|
|
|
+ /*let pushDataList = action.data.filter(function(item){
|
|
return item.id
|
|
return item.id
|
|
- });
|
|
|
|
|
|
+ });*/
|
|
let dataList = inlineDatas[labelInx].questionMapping;
|
|
let dataList = inlineDatas[labelInx].questionMapping;
|
|
for(let k=0; k<dataList.length; k++){
|
|
for(let k=0; k<dataList.length; k++){
|
|
if(dataList[k].controlType == 99){
|
|
if(dataList[k].controlType == 99){
|
|
@@ -482,4 +498,19 @@ export function setInputLabel(state,action){
|
|
res.saveText[i] = prefix+text+suffix;
|
|
res.saveText[i] = prefix+text+suffix;
|
|
res.update = Math.random();
|
|
res.update = Math.random();
|
|
return res;
|
|
return res;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// backspace删除
|
|
|
|
+export function backspaceText(state,action){
|
|
|
|
+ let res = Object.assign({},state);
|
|
|
|
+ const {delIndex} = action;
|
|
|
|
+ const data = res.data;
|
|
|
|
+ if(data[delIndex-1].tagType==8 ||data[delIndex-1].flag&&data[delIndex-1].flag==3){
|
|
|
|
+ // 前一个是文本标签或者子模板 不做处理
|
|
|
|
+ }else{
|
|
|
|
+ data.splice(delIndex-1,2);
|
|
|
|
+ }
|
|
|
|
+ res.saveText = fullfillText(data).saveText;
|
|
|
|
+ res.update = Math.random();
|
|
|
|
+ return res;
|
|
}
|
|
}
|