|
@@ -121,6 +121,13 @@ function getTextLabel(id,name,flag){
|
|
|
return {id:id,name:name,value:name,tagType:config.tagType,exist:flag};
|
|
|
}
|
|
|
|
|
|
+function addPoint(data,num){//给伴随添加顿号
|
|
|
+ for(let i=num; i<data.length; i++){
|
|
|
+ data[i].name = '、'+ data[i].name;
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+}
|
|
|
+
|
|
|
//多选标签选中确定处理
|
|
|
export const confirm = (state,action) =>{
|
|
|
const res = Object.assign({},state);
|
|
@@ -141,7 +148,8 @@ export const confirm = (state,action) =>{
|
|
|
let forwardId;
|
|
|
let text;
|
|
|
for(let n=labelIndx-1; n>0; n--){
|
|
|
- if(arr[n].id==8){
|
|
|
+ // if(arr[n].id==8){
|
|
|
+ if(arr[n].flag && arr[n].flag==1){//添加症状打标flag=1
|
|
|
forwardId = n;
|
|
|
continue;
|
|
|
}
|
|
@@ -151,14 +159,16 @@ export const confirm = (state,action) =>{
|
|
|
let index = text.indexOf('伴');
|
|
|
if(index==-1){//没有伴,直接插入ikey前
|
|
|
if(exists.length > 0){
|
|
|
- for(let i=0; i<exists.length; i++){
|
|
|
+ let withsAddP = addPoint(exists,1);
|
|
|
+ for(let i=0; i<withsAddP.length; i++){
|
|
|
let pos = labelIndx + i;
|
|
|
- arr.splice(pos,0,getTextLabel(exists[i].id,exists[i].name,1));
|
|
|
- res.saveText[pos] = exists[i].name;
|
|
|
+ arr.splice(pos,0,getTextLabel(withsAddP[i].id,withsAddP[i].name,1));
|
|
|
+ res.saveText[pos] = withsAddP[i].name;
|
|
|
}
|
|
|
}
|
|
|
if(withs.length > 0){
|
|
|
- let newWiths = JSON.parse(JSON.stringify(withs));
|
|
|
+ let withsAddP = addPoint(withs,1);
|
|
|
+ let newWiths = JSON.parse(JSON.stringify(withsAddP));
|
|
|
if(banText){
|
|
|
newWiths.unshift(banText);
|
|
|
}
|
|
@@ -172,17 +182,18 @@ export const confirm = (state,action) =>{
|
|
|
if(exists.length > 0){
|
|
|
for(let i=0; i<exists.length; i++){
|
|
|
let pos = index + i;
|
|
|
- arr.splice(pos,0,getTextLabel(exists[i].id,exists[i].name,1));
|
|
|
+ arr.splice(pos,0,getTextLabel(exists[i].id,'、'+exists[i].name,1));
|
|
|
res.saveText[pos] = exists[i].name;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(withs.length>0){//有伴插到ikey前既可
|
|
|
- for(let j=0; j<withs.length; j++){
|
|
|
+ if(withs.length>0){//有伴插到ikey前既可
|
|
|
+ let withsAddP = addPoint(withs,0);
|
|
|
+ for(let j=0; j<withsAddP.length; j++){
|
|
|
// let withsPos = labelIndx + j;
|
|
|
let withsPos = labelIndx +length + j;
|
|
|
- arr.splice(withsPos,0,getTextLabel(withs[j].id,withs[j].name,2));
|
|
|
- res.saveText[withsPos] = withs[j].name;
|
|
|
+ arr.splice(withsPos,0,getTextLabel(withsAddP[j].id,withsAddP[j].name,2));
|
|
|
+ res.saveText[withsPos] = withsAddP[j].name;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -193,12 +204,16 @@ export const confirm = (state,action) =>{
|
|
|
if(exists.length > 0){
|
|
|
for(let i=0; i<exists.length; i++){
|
|
|
let pos = labelIndx + i;
|
|
|
- arr.splice(pos,0,getTextLabel(exists[i].id,exists[i].name,1));
|
|
|
+ arr.splice(pos,0,getTextLabel(exists[i].id,'、'+exists[i].name,1));
|
|
|
res.saveText[pos] = exists[i].name;
|
|
|
}
|
|
|
}
|
|
|
if(withs.length > 0){
|
|
|
- let newWiths = JSON.parse(JSON.stringify(withs));
|
|
|
+ /*for(let k=1; k<withs.length; k++){
|
|
|
+ withs[k].name = '、'+ withs[k].name;
|
|
|
+ }*/
|
|
|
+ let withsAddP = addPoint(withs,1);
|
|
|
+ let newWiths = JSON.parse(JSON.stringify(withsAddP));
|
|
|
if(banText){
|
|
|
newWiths.unshift(banText);
|
|
|
}
|
|
@@ -212,17 +227,18 @@ export const confirm = (state,action) =>{
|
|
|
if(exists.length > 0){
|
|
|
for(let i=0; i<exists.length; i++){
|
|
|
let pos = index + i;
|
|
|
- arr.splice(pos,0,getTextLabel(exists[i].id,exists[i].name,1));
|
|
|
+ arr.splice(pos,0,getTextLabel(exists[i].id,'、'+exists[i].name,1));
|
|
|
res.saveText[pos] = exists[i].name;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(withs.length>0){//有伴插到ikey前既可
|
|
|
- for(let j=0; j<withs.length; j++){
|
|
|
+ if(withs.length>0){//有伴插到ikey前既可
|
|
|
+ let withsAddP = addPoint(withs,0);
|
|
|
+ for(let j=0; j<withsAddP.length; j++){
|
|
|
// let withsPos = labelIndx + j;
|
|
|
let withsPos = labelIndx +length + j;
|
|
|
- arr.splice(withsPos,0,getTextLabel(withs[j].id,withs[j].name,2));
|
|
|
- res.saveText[withsPos] = withs[j].name;
|
|
|
+ arr.splice(withsPos,0,getTextLabel(withsAddP[j].id,withsAddP[j].name,2));
|
|
|
+ res.saveText[withsPos] = withsAddP[j].name;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -231,7 +247,7 @@ export const confirm = (state,action) =>{
|
|
|
|
|
|
res.data = arr;
|
|
|
res.saveText = fullfillText(arr).saveText;
|
|
|
- res.update=Math.random();
|
|
|
+ res.update=Math.random();console.log(789,res);
|
|
|
return res;
|
|
|
};
|
|
|
|
|
@@ -346,10 +362,15 @@ export const insertSearch = (state,action)=>{
|
|
|
const value = innerText.replace(searchStr,"");
|
|
|
let index = innerText.indexOf(searchStr);
|
|
|
if(index < 1){//前
|
|
|
- res.data.splice(focusIndex,0,nText);
|
|
|
- res.saveText.splice(focusIndex,0,searchData);
|
|
|
- res.data[focusIndex+1].value = value;
|
|
|
- res.saveText[focusIndex+1] = value;
|
|
|
+ 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);
|
|
@@ -641,6 +662,22 @@ export function multipleComfirn(state,action){
|
|
|
data[ikey].value = seleData;
|
|
|
res.saveText[ikey] = seleData;
|
|
|
res.selecteds[ikey] = action.data;
|
|
|
- res.update = Math.random();console.log(123,action,res);
|
|
|
+ res.update = Math.random();
|
|
|
+ return res;
|
|
|
+}
|
|
|
+
|
|
|
+export function delSingleLable(state,action){
|
|
|
+ let res = Object.assign({},state);
|
|
|
+ const {index} = action;
|
|
|
+ let data = res.data;
|
|
|
+ // 前一个不是文本标签 并且不是子模板,则删除
|
|
|
+ if(data[index-1].flag&&data[index-1].flag==3){
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(data[index-1].tagType != 8){
|
|
|
+ data.splice(index-1,1);
|
|
|
+ res.saveText.splice(index-1,1);
|
|
|
+ }
|
|
|
+ res.update = Math.random();
|
|
|
return res;
|
|
|
}
|