|
@@ -1,6 +1,6 @@
|
|
|
import config from '@config/index.js';
|
|
|
import {formatContinueDots,getLabelIndex,fullfillText,getIds} from '@utils/tools';
|
|
|
-
|
|
|
+import {Notify} from '@commonComp';
|
|
|
//插入病程变化模板
|
|
|
function insertPro(data,processModule){
|
|
|
let index;
|
|
@@ -63,7 +63,16 @@ export const setModule = (state,action)=>{
|
|
|
//插入病程变化
|
|
|
export const insertProcess = (state,action)=>{
|
|
|
const res = Object.assign({},state);
|
|
|
- let addSmoduleData = action.addSmoduleData;
|
|
|
+ let addSmoduleData = [];
|
|
|
+ if(res.currReadSonM.length>0){
|
|
|
+ addSmoduleData = JSON.parse(JSON.stringify(res.currReadSonM))
|
|
|
+ }else{
|
|
|
+ addSmoduleData = res.processModule.length>0?JSON.parse(JSON.stringify(res.processModule)):[];
|
|
|
+ }
|
|
|
+ if(addSmoduleData.length==0){//未匹配到子模板
|
|
|
+ Notify.info("未找到相关内容");
|
|
|
+ return
|
|
|
+ }
|
|
|
let data = res.data;
|
|
|
let newData = insertPro(data,addSmoduleData);
|
|
|
res.data = fullfillText(newData).newArr;
|
|
@@ -670,6 +679,7 @@ export const clearCurrentIll = (state,action)=>{
|
|
|
res.saveText = action.saveText;
|
|
|
res.selecteds = action.selecteds?action.selecteds:[];
|
|
|
res.symptomIds = action.symptomIds;
|
|
|
+ res.currReadSonM = action.currReadSonM||[];
|
|
|
if(action.editClear){
|
|
|
res.editClear = action.editClear;
|
|
|
}
|
|
@@ -887,21 +897,36 @@ export function setInputLabel(state,action){
|
|
|
// backspace删除
|
|
|
export function backspaceText(state,action){
|
|
|
let res = Object.assign({},state);
|
|
|
- const {delIndex,text} = action;
|
|
|
+ const {delIndex,text,flag} = action;
|
|
|
const data = res.data;
|
|
|
// if(data[delIndex-1].tagType==8 ||data[delIndex-1].flag&&data[delIndex-1].flag==3){
|
|
|
- // 前一个是文本标签或者子模板,只改变值
|
|
|
- if(data[delIndex-1].flag&&data[delIndex-1].flag==3){//子模板不删
|
|
|
- // data[delIndex].value = text;
|
|
|
- }else if(data[delIndex-1].tagType==8){
|
|
|
- data.splice(delIndex,1);
|
|
|
- res.selecteds.splice(delIndex,1); //杂音类样式选中状态对应
|
|
|
- res.saveText.splice(delIndex,1);
|
|
|
- }
|
|
|
- else{
|
|
|
- data.splice(delIndex-1,2);
|
|
|
- res.selecteds.splice(delIndex-1,2); //杂音类样式选中状态对应
|
|
|
- res.saveText.splice(delIndex-1,2);
|
|
|
+ if(flag == 'backsp'){
|
|
|
+ // 前一个是文本标签或者子模板,只改变值
|
|
|
+ if(data[delIndex-1].flag&&data[delIndex-1].flag==3){//子模板不删
|
|
|
+ // data[delIndex].value = text;
|
|
|
+ }else if(data[delIndex-1].tagType==8){
|
|
|
+ data.splice(delIndex,1);
|
|
|
+ res.selecteds.splice(delIndex,1); //杂音类样式选中状态对应
|
|
|
+ res.saveText.splice(delIndex,1);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ data.splice(delIndex-1,2);
|
|
|
+ res.selecteds.splice(delIndex-1,2);
|
|
|
+ res.saveText.splice(delIndex-1,2);
|
|
|
+ }
|
|
|
+ }else if(flag == 'del'){
|
|
|
+ if(data[delIndex+1] && data[delIndex+1].flag&&data[delIndex+1].flag==3){//子模板不删
|
|
|
+
|
|
|
+ }else if(data[delIndex+1] && data[delIndex+1].tagType==8){
|
|
|
+ data.splice(delIndex,1);
|
|
|
+ res.selecteds.splice(delIndex,1); //杂音类样式选中状态对应
|
|
|
+ res.saveText.splice(delIndex,1);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ data.splice(delIndex,2);
|
|
|
+ res.selecteds.splice(delIndex,2);
|
|
|
+ res.saveText.splice(delIndex,2);
|
|
|
+ }
|
|
|
}
|
|
|
// res.saveText = fullfillText(data).saveText;
|
|
|
res.update = Math.random();
|
|
@@ -911,7 +936,7 @@ export function backspaceText(state,action){
|
|
|
//删除后移除id
|
|
|
export function removeId(state,action){
|
|
|
let res = Object.assign({},state);
|
|
|
- const {index,text} = action;
|
|
|
+ const {index,text,flag} = action;
|
|
|
const data = res.data;
|
|
|
// const id = data[index].id;
|
|
|
const id = data[index].conceptId;
|
|
@@ -919,15 +944,28 @@ export function removeId(state,action){
|
|
|
if(ids.includes(id)){
|
|
|
ids.splice(ids.indexOf(id),1);
|
|
|
}
|
|
|
- if(!data[index].value && data[index-1].tagType==8){
|
|
|
- data.splice(index,1);
|
|
|
- res.saveText.splice(index,1);
|
|
|
+ if(flag == 'del'){
|
|
|
+ if(!data[index].value && data[index+1] && data[index+1].tagType==8){
|
|
|
+ data.splice(index,1);
|
|
|
+ res.saveText.splice(index,1);
|
|
|
+ }else{
|
|
|
+ data[index].id = "";
|
|
|
+ data[index].conceptId = "";
|
|
|
+ data[index].name = text;
|
|
|
+ data[index].value = text;
|
|
|
+ }
|
|
|
}else{
|
|
|
- data[index].id = "";
|
|
|
- data[index].conceptId = "";
|
|
|
- data[index].name = text;
|
|
|
- data[index].value = text;
|
|
|
+ if(!data[index].value && data[index-1].tagType==8){
|
|
|
+ data.splice(index,1);
|
|
|
+ res.saveText.splice(index,1);
|
|
|
+ }else{
|
|
|
+ data[index].id = "";
|
|
|
+ data[index].conceptId = "";
|
|
|
+ data[index].name = text;
|
|
|
+ data[index].value = text;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
res.update = Math.random();
|
|
|
return res;
|
|
|
}
|