|
@@ -1,4 +1,4 @@
|
|
-import {getLabelIndex,fullfillText,getIds,resetTagtype} from '@utils/tools.js';
|
|
|
|
|
|
+import {getLabelIndex,fullfillText,getIds,resetTagtype,storageLocal} from '@utils/tools.js';
|
|
import config from '@config/index.js';
|
|
import config from '@config/index.js';
|
|
import {Notify} from '@commonComp';
|
|
import {Notify} from '@commonComp';
|
|
|
|
|
|
@@ -109,15 +109,47 @@ export const insertMain = (state,action) => {
|
|
const id = action.item.ids;
|
|
const id = action.item.ids;
|
|
const conceptId = action.item.conceptId;
|
|
const conceptId = action.item.conceptId;
|
|
let data = JSON.parse(JSON.stringify(res.moduleData));
|
|
let data = JSON.parse(JSON.stringify(res.moduleData));
|
|
|
|
+
|
|
|
|
+ // 存到本地
|
|
|
|
+ // >5直接截取替换,<5需要判断是否有重复的--双重遍历
|
|
|
|
+ const mainSymp = storageLocal.get('mainSymp');
|
|
|
|
+ if(items.length<5){
|
|
|
|
+ if(mainSymp){
|
|
|
|
+ let localArr = JSON.parse(mainSymp);
|
|
|
|
+ let sympArr = JSON.parse(JSON.stringify(localArr));
|
|
|
|
+ let num = -1;
|
|
|
|
+ for(let k=0; k<localArr.length; k++){//判断是否已存在
|
|
|
|
+ for(let j=0; j<items.length; j++){
|
|
|
|
+ if(localArr[k].conceptId==items[j].conceptId){
|
|
|
|
+ num++
|
|
|
|
+ sympArr.splice(k-num,1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ let newArr = sympArr.concat(items);
|
|
|
|
+ if(newArr.length>5){
|
|
|
|
+ storageLocal.set('mainSymp',newArr.slice(newArr.length-5,));
|
|
|
|
+ }else{
|
|
|
|
+ storageLocal.set('mainSymp',newArr);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ storageLocal.set('mainSymp',items);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ let seleArr = items.slice(items.length-5,);//展示后5个
|
|
|
|
+ storageLocal.set('mainSymp',seleArr);
|
|
|
|
+ }
|
|
|
|
+
|
|
if(items.length>1){
|
|
if(items.length>1){
|
|
for(let i=1; i<items.length; i++){
|
|
for(let i=1; i<items.length; i++){
|
|
items[i].name = '、'+items[i].name;
|
|
items[i].name = '、'+items[i].name;
|
|
- items[i].value = '、'+items[i].value;
|
|
|
|
- }
|
|
|
|
|
|
+ // items[i].value = '、'+items[i].value;
|
|
|
|
+ items[i].value = items[i].value?'、'+items[i].value:items[i].name;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
let obj = [];
|
|
let obj = [];
|
|
for(let i=0; i<items.length; i++){
|
|
for(let i=0; i<items.length; i++){
|
|
- obj.push({id:items[i].questionId,name:items[i].name,value:items[i].name,tagType:config.tagType,exist:1,conceptId:items[i].conceptId});
|
|
|
|
|
|
+ obj.push({id:items[i].questionId||items[i].id,name:items[i].name,value:items[i].name,tagType:config.tagType,exist:1,conceptId:items[i].conceptId});
|
|
}
|
|
}
|
|
let inserIndx = null;
|
|
let inserIndx = null;
|
|
data.map((it,i)=>{
|
|
data.map((it,i)=>{
|
|
@@ -163,6 +195,43 @@ export const confirm = (state,action) =>{
|
|
let arr = res.data;
|
|
let arr = res.data;
|
|
let saveText = JSON.parse(JSON.stringify(res.saveText));
|
|
let saveText = JSON.parse(JSON.stringify(res.saveText));
|
|
const {exists,withs,ikey,withsName,existsName,ban} = action.data;
|
|
const {exists,withs,ikey,withsName,existsName,ban} = action.data;
|
|
|
|
+ // 存到本地
|
|
|
|
+ // >5直接截取替换,<5需要判断是否有重复的--双重遍历
|
|
|
|
+ const items = exists.concat(withs);
|
|
|
|
+ const mainSymp = storageLocal.get('mainSymp');
|
|
|
|
+ if(items.length<5){
|
|
|
|
+ if(mainSymp){
|
|
|
|
+ let localArr = JSON.parse(mainSymp);
|
|
|
|
+ let sympArr = JSON.parse(JSON.stringify(localArr));
|
|
|
|
+ let num = -1;
|
|
|
|
+ for(let k=0; k<localArr.length; k++){//判断是否已存在
|
|
|
|
+ for(let j=0; j<items.length; j++){
|
|
|
|
+ items[j].exist = 1;
|
|
|
|
+ if(localArr[k].conceptId==items[j].conceptId){
|
|
|
|
+ num++
|
|
|
|
+ sympArr.splice(k-num,1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ let newArr = sympArr.concat(items);
|
|
|
|
+ if(newArr.length>5){
|
|
|
|
+ storageLocal.set('mainSymp',newArr.slice(newArr.length-5,));
|
|
|
|
+ }else{
|
|
|
|
+ storageLocal.set('mainSymp',newArr);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }else{
|
|
|
|
+ storageLocal.set('mainSymp',items);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ // let seleArr = items.slice(0,5);
|
|
|
|
+ let seleArr = items.slice(items.length-5,);//展示后5个
|
|
|
|
+ for(let n=0; n<seleArr.length; n++){
|
|
|
|
+ seleArr[n].exist = 1;//将伴随都改成主症状
|
|
|
|
+ }
|
|
|
|
+ storageLocal.set('mainSymp',seleArr);
|
|
|
|
+ }
|
|
|
|
+
|
|
let banText = JSON.stringify(ban) == "{}" ? '':{id:ban.id,name:ban.name,value:ban.name,tagType:config.tagType};
|
|
let banText = JSON.stringify(ban) == "{}" ? '':{id:ban.id,name:ban.name,value:ban.name,tagType:config.tagType};
|
|
let length = exists.length;
|
|
let length = exists.length;
|
|
let existConpId = [];
|
|
let existConpId = [];
|
|
@@ -338,6 +407,30 @@ export const insertSearch = (state,action)=>{
|
|
let span = action.span;
|
|
let span = action.span;
|
|
let text = {id:id,name:searchData,value:searchData,tagType:config.tagType,conceptId:ids};
|
|
let text = {id:id,name:searchData,value:searchData,tagType:config.tagType,conceptId:ids};
|
|
const emptySpan = JSON.parse(config.textLabel);
|
|
const emptySpan = JSON.parse(config.textLabel);
|
|
|
|
+
|
|
|
|
+ // 存到本地
|
|
|
|
+ const mainSymp = storageLocal.get('mainSymp');
|
|
|
|
+ let items = JSON.parse(JSON.stringify(action.info));
|
|
|
|
+ if(mainSymp){
|
|
|
|
+ let localArr = JSON.parse(mainSymp);
|
|
|
|
+ let sympArr = JSON.parse(JSON.stringify(localArr));
|
|
|
|
+ for(let k=0; k<localArr.length; k++){//判断是否已存在
|
|
|
|
+ if(localArr[k].conceptId==items.conceptId){
|
|
|
|
+ sympArr.splice(k,1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ sympArr.push(items);
|
|
|
|
+ if(sympArr.length>5){
|
|
|
|
+ storageLocal.set('mainSymp',sympArr.slice(sympArr.length-5,));
|
|
|
|
+ }else{
|
|
|
|
+ storageLocal.set('mainSymp',sympArr);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ let arr = [];
|
|
|
|
+ arr.push(items);
|
|
|
|
+ storageLocal.set('mainSymp',arr);
|
|
|
|
+ }
|
|
|
|
+
|
|
if(data.length==0){
|
|
if(data.length==0){
|
|
let inserIndx = null;
|
|
let inserIndx = null;
|
|
moduleData.map((it,i)=>{
|
|
moduleData.map((it,i)=>{
|