|
@@ -1,5 +1,6 @@
|
|
import config from '@config/index.js';
|
|
import config from '@config/index.js';
|
|
-import {formatContinueDots,getLabelIndex,checkFullfillText,handleLocalDelTag,shiftLocalDelTag} from '@utils/tools.js';
|
|
|
|
|
|
+import {formatContinueDots,getLabelIndex,handleLocalDelTag,checkFullfillText} from '@utils/tools.js';
|
|
|
|
+import {shiftLocalDelTag} from "../../utils/tools";
|
|
|
|
|
|
export function preSetCheckbody(state,action) {
|
|
export function preSetCheckbody(state,action) {
|
|
let res = Object.assign({},state);
|
|
let res = Object.assign({},state);
|
|
@@ -36,16 +37,16 @@ export const confirm = (state,action) =>{
|
|
const items = [...exists||[],...withs||[]];
|
|
const items = [...exists||[],...withs||[]];
|
|
if((!exists||!withs||items.length==0)&&!nones&&!exclusion){ //取消无殊的选中,空白提交
|
|
if((!exists||!withs||items.length==0)&&!nones&&!exclusion){ //取消无殊的选中,空白提交
|
|
arr[ikey].value = '';
|
|
arr[ikey].value = '';
|
|
|
|
+ arr[ikey].selecteds = {};
|
|
res.saveText[ikey] = '';
|
|
res.saveText[ikey] = '';
|
|
- res.selecteds.splice(ikey,1);
|
|
|
|
res.update=Math.random();
|
|
res.update=Math.random();
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
//选中互斥项
|
|
//选中互斥项
|
|
if(exclusion){
|
|
if(exclusion){
|
|
arr[ikey].value = excluName;
|
|
arr[ikey].value = excluName;
|
|
|
|
+ arr[ikey].selecteds = action.data;
|
|
res.saveText[ikey] = excluName;
|
|
res.saveText[ikey] = excluName;
|
|
- res.selecteds[ikey] = action.data;
|
|
|
|
res.update=Math.random();
|
|
res.update=Math.random();
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
@@ -59,7 +60,6 @@ export const confirm = (state,action) =>{
|
|
if(items.length==0&&nones){
|
|
if(items.length==0&&nones){
|
|
arr[ikey-1].value = newPreText;
|
|
arr[ikey-1].value = newPreText;
|
|
res.saveText[ikey-1] = newPreText;
|
|
res.saveText[ikey-1] = newPreText;
|
|
- res.selecteds[ikey] = null; //无殊选中状态遗留bug修改
|
|
|
|
res.update=Math.random();
|
|
res.update=Math.random();
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
@@ -81,32 +81,6 @@ export const confirm = (state,action) =>{
|
|
return res;
|
|
return res;
|
|
};
|
|
};
|
|
|
|
|
|
-//复制标签(如血压)事件
|
|
|
|
-export function addLabelItem(state,action){
|
|
|
|
- let res = Object.assign({},state);
|
|
|
|
- const {data,i} = action;
|
|
|
|
- const textLabel = Object.assign({},JSON.parse(config._textLabel),{showInCheck:JSON.parse(data).showInCheck});
|
|
|
|
- //使用Object.assign({},data)拷贝操作时复制项和原项会同步修改
|
|
|
|
- if(!data) return res;
|
|
|
|
- res.data.splice(+i+2,0,JSON.parse(data),textLabel);
|
|
|
|
- res.saveText.splice(+i+2,0,'','');
|
|
|
|
- res.selecteds.splice(+i+2,0,null,null);
|
|
|
|
- res.update = Math.random();
|
|
|
|
- return res;
|
|
|
|
-}
|
|
|
|
-//自由文本
|
|
|
|
-export function setCheckText(state,action) {
|
|
|
|
- let res = Object.assign({},state);
|
|
|
|
- const {i,text} = action;
|
|
|
|
- if(res.data[i]){
|
|
|
|
- res.data[i].value=text;
|
|
|
|
- //res.data[i].name=''; //默认显示的文字
|
|
|
|
- }
|
|
|
|
- res.saveText[i] = text;
|
|
|
|
- res.update = Math.random();
|
|
|
|
- return res;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
//多选文字,如杂音
|
|
//多选文字,如杂音
|
|
export function setCheckBoxValue(state,action) {
|
|
export function setCheckBoxValue(state,action) {
|
|
let res = Object.assign({},state);
|
|
let res = Object.assign({},state);
|
|
@@ -118,7 +92,7 @@ export function setCheckBoxValue(state,action) {
|
|
showText = showText.substr(0,showText.length-1);
|
|
showText = showText.substr(0,showText.length-1);
|
|
}
|
|
}
|
|
res.data[labelInx].value = showText;
|
|
res.data[labelInx].value = showText;
|
|
- res.selecteds[labelInx] = action.data;
|
|
|
|
|
|
+ res.data[labelInx].selecteds = action.data;
|
|
res.saveText = checkFullfillText(res.data).saveText;
|
|
res.saveText = checkFullfillText(res.data).saveText;
|
|
res.update = Math.random();
|
|
res.update = Math.random();
|
|
return res;
|
|
return res;
|
|
@@ -156,13 +130,9 @@ export function insertLabelData(state,action){
|
|
if(searchInEnd){
|
|
if(searchInEnd){
|
|
res.data.splice(index,1,pText,...spreadLabels,text);
|
|
res.data.splice(index,1,pText,...spreadLabels,text);
|
|
res.saveText = checkFullfillText(res.data).saveText;
|
|
res.saveText = checkFullfillText(res.data).saveText;
|
|
- //res.saveText.splice(index,1,newText,'','');
|
|
|
|
- res.selecteds.splice(index,1,null,...new Array(spreadLabels.length).fill(null),null);
|
|
|
|
}else{
|
|
}else{
|
|
res.data.splice(index,1,text,...spreadLabels,pText);
|
|
res.data.splice(index,1,text,...spreadLabels,pText);
|
|
res.saveText = checkFullfillText(res.data).saveText;
|
|
res.saveText = checkFullfillText(res.data).saveText;
|
|
- //res.saveText.splice(index,1,'','',newText);
|
|
|
|
- res.selecteds.splice(index,1,null,...new Array(spreadLabels.length).fill(null),null);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}else{
|
|
}else{
|
|
@@ -170,11 +140,9 @@ export function insertLabelData(state,action){
|
|
if(searchInEnd){
|
|
if(searchInEnd){
|
|
res.data.splice(index+1,0,spreadLabels,text);
|
|
res.data.splice(index+1,0,spreadLabels,text);
|
|
res.saveText.splice(index+1,0,'','');
|
|
res.saveText.splice(index+1,0,'','');
|
|
- res.selecteds.splice(index+1,0,null,null);
|
|
|
|
}else{
|
|
}else{
|
|
res.data.splice(index,0,text,spreadLabels);
|
|
res.data.splice(index,0,text,spreadLabels);
|
|
res.saveText.splice(index,0,'','');
|
|
res.saveText.splice(index,0,'','');
|
|
- res.selecteds.splice(index,0,null,null);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
res.searchData = []; //选中清空搜索内容(即关闭搜索弹窗)
|
|
res.searchData = []; //选中清空搜索内容(即关闭搜索弹窗)
|
|
@@ -233,7 +201,6 @@ export const changeLabelVal = (state,action)=>{//双击标签输入改变值
|
|
const num = nextIsDot?2:1;
|
|
const num = nextIsDot?2:1;
|
|
handleLocalDelTag('4',index,res.data[index]);
|
|
handleLocalDelTag('4',index,res.data[index]);
|
|
res.data.splice(index,num);
|
|
res.data.splice(index,num);
|
|
- res.selecteds.splice(index,num);//杂音类样式选中状态对应
|
|
|
|
res.saveText = checkFullfillText(res.data).saveText;
|
|
res.saveText = checkFullfillText(res.data).saveText;
|
|
}
|
|
}
|
|
res.update = Math.random();
|
|
res.update = Math.random();
|
|
@@ -250,7 +217,6 @@ export function clearCheckBody(state,action){ //清空
|
|
res.preData = [];
|
|
res.preData = [];
|
|
res.saveText = action.saveText;
|
|
res.saveText = action.saveText;
|
|
res.isEmpty = action.isEmpty;
|
|
res.isEmpty = action.isEmpty;
|
|
- res.selecteds = action.selecteds?action.selecteds:[];
|
|
|
|
if(action.flg){res.showAll = true}
|
|
if(action.flg){res.showAll = true}
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
@@ -260,39 +226,40 @@ export function backspaceText(state,action){
|
|
let res = Object.assign({},state);
|
|
let res = Object.assign({},state);
|
|
const {delIndex,flag} = action;
|
|
const {delIndex,flag} = action;
|
|
const data = res.data;
|
|
const data = res.data;
|
|
|
|
+ let inx = delIndex-1; //要删除的(非文本)标签的index
|
|
if(flag == 'backsp'){
|
|
if(flag == 'backsp'){
|
|
// 前一个是文本标签或者子模板,只改变值
|
|
// 前一个是文本标签或者子模板,只改变值
|
|
- if(data[delIndex-1].flag&&data[delIndex-1].flag==3){//子模板不删
|
|
|
|
|
|
+ if(data[inx].flag&&data[inx].flag==3){//子模板不删
|
|
// data[delIndex].value = text;
|
|
// data[delIndex].value = text;
|
|
- }else if(data[delIndex-1].tagType==8){
|
|
|
|
|
|
+ }else if(data[inx].tagType==8){
|
|
data.splice(delIndex,1);
|
|
data.splice(delIndex,1);
|
|
- res.selecteds.splice(delIndex,1); //杂音类样式选中状态对应
|
|
|
|
res.saveText.splice(delIndex,1);
|
|
res.saveText.splice(delIndex,1);
|
|
- }
|
|
|
|
- else{
|
|
|
|
- handleLocalDelTag(4,delIndex-1,data[delIndex-1]);
|
|
|
|
- data.splice(delIndex-1,2);
|
|
|
|
- res.selecteds.splice(delIndex-1,2);
|
|
|
|
- res.saveText.splice(delIndex-1,2);
|
|
|
|
|
|
+ }else{
|
|
|
|
+ handleLocalDelTag(4,inx,data[inx]);
|
|
|
|
+ let n = ''
|
|
|
|
+ if(action.text==' '){
|
|
|
|
+ n = 2
|
|
|
|
+ }else if(action.text.length>0&&(config.punctuationReg.test(action.text))){
|
|
|
|
+ n = 1
|
|
|
|
+ }else{
|
|
|
|
+ n = 2
|
|
|
|
+ }
|
|
|
|
+ data.splice(inx,n);
|
|
|
|
+ res.saveText.splice(inx,n);
|
|
}
|
|
}
|
|
}else if(flag == 'del'){
|
|
}else if(flag == 'del'){
|
|
- if(data[delIndex+1] && data[delIndex+1].flag&&data[delIndex+1].flag==3){//子模板不删
|
|
|
|
|
|
+ inx = delIndex+1;
|
|
|
|
+ if(!data[inx]||(data[inx] && data[inx].flag&&data[inx].flag==3)){//子模板不删
|
|
|
|
|
|
- }else if(data[delIndex+1] && data[delIndex+1].tagType==8){
|
|
|
|
|
|
+ }else if(data[inx] && data[inx].tagType==8){
|
|
data.splice(delIndex,1);
|
|
data.splice(delIndex,1);
|
|
- res.selecteds.splice(delIndex,1); //杂音类样式选中状态对应
|
|
|
|
res.saveText.splice(delIndex,1);
|
|
res.saveText.splice(delIndex,1);
|
|
- }else if(!data[delIndex+1]){//最后一个文本标签不删除
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- else{
|
|
|
|
- handleLocalDelTag(4,delIndex,data[delIndex+1]);
|
|
|
|
|
|
+ }else{
|
|
|
|
+ handleLocalDelTag(4,delIndex,data[inx]);
|
|
data.splice(delIndex,2);
|
|
data.splice(delIndex,2);
|
|
- res.selecteds.splice(delIndex,2);
|
|
|
|
res.saveText.splice(delIndex,2);
|
|
res.saveText.splice(delIndex,2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // res.saveText = fullfillText(data).saveText;
|
|
|
|
res.update = Math.random();
|
|
res.update = Math.random();
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
@@ -307,6 +274,7 @@ export function multipleComfirn(state,action){
|
|
let item = data[ikey].questionMapping;
|
|
let item = data[ikey].questionMapping;
|
|
let arr=[];
|
|
let arr=[];
|
|
item[index].value = seleData;
|
|
item[index].value = seleData;
|
|
|
|
+ item[index].selecteds = action.data;
|
|
item.map((it)=>{
|
|
item.map((it)=>{
|
|
if(it.value){
|
|
if(it.value){
|
|
arr.push(it.labelPrefix+it.value+it.labelSuffix);
|
|
arr.push(it.labelPrefix+it.value+it.labelSuffix);
|
|
@@ -314,12 +282,11 @@ export function multipleComfirn(state,action){
|
|
});
|
|
});
|
|
res.saveText[ikey] = arr.join("");
|
|
res.saveText[ikey] = arr.join("");
|
|
res.update = Math.random();
|
|
res.update = Math.random();
|
|
- res.selecteds[ikey] = {[index]:action.data};
|
|
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
data[ikey].value = seleData;
|
|
data[ikey].value = seleData;
|
|
|
|
+ data[ikey].selecteds = action.data;
|
|
res.saveText[ikey] = seleData;
|
|
res.saveText[ikey] = seleData;
|
|
- res.selecteds[ikey] = action.data;
|
|
|
|
res.update = Math.random();
|
|
res.update = Math.random();
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
@@ -346,14 +313,20 @@ export function setImportCheckbodyLabel(state,action) {
|
|
res.update = Math.random();
|
|
res.update = Math.random();
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
|
|
+
|
|
//恢复已删除的标签
|
|
//恢复已删除的标签
|
|
export function recoveTag(state,action) {
|
|
export function recoveTag(state,action) {
|
|
let res = Object.assign({},state);
|
|
let res = Object.assign({},state);
|
|
let arr = [...res.data];
|
|
let arr = [...res.data];
|
|
- const text = Object.assign({showInCheck:action.data.showInCheck},JSON.parse(config.textLabel));
|
|
|
|
- arr.splice(action.index,0,action.data,text);
|
|
|
|
- res.data = checkFullfillText(arr).newArr;
|
|
|
|
- res.saveText = checkFullfillText(arr).saveText;
|
|
|
|
|
|
+ arr.splice(action.index,0,action.data);
|
|
|
|
+ const dataArr = checkFullfillText(arr);
|
|
|
|
+ let nextLabel = dataArr.newArr[(+action.index)+1];
|
|
|
|
+ //展开收起状态
|
|
|
|
+ if(nextLabel.tagType==8){
|
|
|
|
+ nextLabel.showInCheck=action.data.showInCheck;
|
|
|
|
+ }
|
|
|
|
+ res.data = dataArr.newArr;
|
|
|
|
+ res.saveText = dataArr.saveText;
|
|
shiftLocalDelTag();
|
|
shiftLocalDelTag();
|
|
res.update = Math.random();
|
|
res.update = Math.random();
|
|
return res;
|
|
return res;
|