Explorar o código

个案追踪下,条件选择中,下一步按钮增加检测必填项选择情况,并提示

yfb %!s(int64=2) %!d(string=hai) anos
pai
achega
e3fb40a740

+ 1 - 1
manifest.json

@@ -2,7 +2,7 @@
     "name" : "追踪方法学",
     "appid" : "__UNI__03C4C69",
     "description" : "",
-    "versionName" : "0.8.4",
+    "versionName" : "0.8.5",
     "versionCode" : 100,
     "transformPx" : false,
     "app-plus" : {

+ 2 - 2
pages/creatingSituations/components/condition.vue

@@ -47,9 +47,9 @@
 			}
 		},
 		methods: {
-			checkedHandle: function(conditionIds,conditions) {
+			checkedHandle: function(conditionIds,condition) {
 				this.myCommit('conditionIds', conditionIds);
-				this.myCommit('checkedItems', conditions);
+				this.myCommit('checkedItems', condition);
 			},
 			selectBtnHandle: function(depType) {
 				this.myCommit('depType', depType);

+ 26 - 14
pages/creatingSituations/components/conditionCard.vue

@@ -45,7 +45,8 @@
 				list: [],
 				childContainer: [],
 				selectedIds: [],
-				currentActTabGroupId: null,
+				currentActTabGroupId: null
+				,CheckConditionCard:[]
 			}
 		},
 		watch: {
@@ -92,7 +93,8 @@
 							...this.condition,
 							options: [],
 							conditionIds: [],
-							childContainer: []
+							childContainer: []
+							,CheckConditionCard:[] //add by yfb 20230515
 						}
 					});
 
@@ -103,7 +105,8 @@
 				this.list = this.condition.options;
 				this.selectedIds = this.condition.conditionIds;
 				this.childContainer = this.condition.childContainer;
-				this.results = this.conditionCard.checkResults;
+				this.results = this.conditionCard.checkResults;
+				this.CheckConditionCard=this.condition.CheckConditionCard;//add by yfb 20230515
 			}
 
 		},
@@ -173,12 +176,17 @@
 				})
 			},
 			tabClickHandle(item, index, isMulti, parts, parent) {
-				// console.log({item, index, isMulti, parts,parent});
-				// console.log({results:this.results});
+				  // console.log({item, index, isMulti, parts,parent});
+				  // console.log({results:this.results});
 				
 				const needCancelActiedItems = parts.filter(a => a.id != item.id);
 				const needCancelActiedIds = needCancelActiedItems.map(b => b.id);
 				const needCancelActiedcardIds = needCancelActiedItems.map(i => i.subOptionId);
+
+				//筛选选项所属卡片信息,即点击选项保存当前卡片信息  add by yfb 20230515
+				const ActionParents=this.CheckConditionCard.filter(item=>(item!=parent)&&(item.id!=needCancelActiedItems[0].subOptionId));
+				this.CheckConditionCard=[...ActionParents,parent];
+				/////////////////////
 
 				if (isMulti == 1) {
 					//isMulti == 1 单选
@@ -186,7 +194,7 @@
 					const leftActivedIds = this.selectedIds.filter(c => !(needCancelActiedIds.includes(c))); //去除非选中项
 
 					this.selectedIds = [...leftActivedIds, item.id];
-
+					
 					const parentSameIdIndex = this.results.findIndex(item => item.id == parent.id);
 
 					if (parentSameIdIndex != -1) {
@@ -215,17 +223,18 @@
 
 					this.results = [...filtedResults];
 
-
+
 
 				}
 
 				if (isMulti == 2) {
 					//isMulti == 2 多选
 					const index = this.selectedIds.findIndex(a => a == item.id);
-
+// console.log('index',index);
 					if (index != -1) {
 						//已选中
-						this.selectedIds = this.selectedIds.filter(a => a != item.id);
+						this.selectedIds = this.selectedIds.filter(a => a != item.id);
+						this.CheckConditionCard=this.CheckConditionCard.filter(a=>a.id!=item.subOptionId);// 多选项判断是否有子项内容  add by yfb 20230515
 					} else {
 						this.selectedIds = [...this.selectedIds, item.id];
 					}
@@ -235,7 +244,6 @@
 						value: item.name,
 						id: parent.id
 					}];
-
 				}
 
 
@@ -252,9 +260,12 @@
 					const filtedChildContainer = this.childContainer[index].list.filter(g => !(needDeleteChildIds.includes(
 						g.id)));
                     
-					
+					
+					
+					this.CheckConditionCard=[...this.CheckConditionCard,childs[0]];//选完带子项时,加载子项卡片信息 add by yfb 20230515
+					// console.log('CheckConditionCard',this.CheckConditionCard);
 					const positionIndex = childs.length>0?filtedChildContainer.findIndex(a => a.id == childs[0].id):-1;
-
+					
 					if (isMulti == 1) {
 						//单选
 						if (positionIndex == -1) {
@@ -307,10 +318,11 @@
 					key: 'condition',
 					data: {
 						...this.condition,
-						conditionIds: this.selectedIds
+						conditionIds: this.selectedIds,
+						CheckConditionCard:this.CheckConditionCard //保存选择数据  add by yfb 20230515
 					}
 				});
-
+// console.log('data_CheckConditionCard',this.condition.CheckConditionCard);
 				this.childContainer = this.sortFunc(this.childContainer);
 				
 				 //console.log('this.childContainer',this.childContainer);

+ 96 - 24
pages/creatingSituations/creatingSituations.vue

@@ -115,7 +115,8 @@
 			return {
 				isPlanSet: false, //自查督查负责人操作计划设置
 				saveType: 'POST',
-				editID: '',
+				editID: '',
+				errMsg:'',
 			}
 		},
 		computed: {
@@ -300,7 +301,8 @@
 			situationId,
 			themeName, //情境名
 			systemSituationType, //系统情境类型 0 个案 1 普通 2自查督查
-		}) {
+		}) {
+			this.errMsg='';
 			this.dispatch('getDictionary').then(res => {
 				//获取后处理pointset类型
 				let tmp= res.PointSet.map((item)=>{
@@ -656,7 +658,7 @@
 						case 1:
 						    if(this.theme.id == 0){
 								//创建个案情境
-								flage = this.errorHandle(this.condition.conditionIds.length >= this.conditionCard.requireds.length, 1);			
+								flage = this.conditionErrHandler(this.checkCondition(this.condition),1);			
 							}else{
 								flage = this.errorHandle(this.condition.conditionIds.length > 0, 1);
 							}
@@ -746,15 +748,7 @@
 			 * @param {Object} index 当前下标
 			 */
 			errorHandle: function(conditionflag, index) {
-				//add by yfb 20230214 检查子选项选择情况
-				if (!this.checkCondition(this.condition)){
-					uni.showModal({
-						title: '温馨提示',
-						content: `请先选择${this.options[1].hint}!`,
-						showCancel: false
-					});
-					return false;
-				}
+
 				if (conditionflag) {
 					return true;
 				} else {
@@ -765,6 +759,19 @@
 					});
 					return false;
 				}
+			},
+			conditionErrHandler:function (flag,index){
+				const results=this.checkCondition(this.condition);
+				//add by yfb 20230214 检查子选项选择情况
+				if (!results.funFlag){
+					uni.showModal({
+						title: '温馨提示',
+						content: `请先选择${this.options[1].hint},`+results.errMsg,
+						showCancel: false
+					});
+					return false;
+				}else
+					return true;
 			},
 			myCommit: function(key, data) {
 				this.$store.commit({
@@ -795,18 +802,83 @@
 					data: show
 				});
 			},
-			checkCondition:function(condition){
-				 //console.log('测试',condition);
-				// for(var i=0;i<condition.conditionIds.length;i++){
-				// 	// console.log('测试',condition.childContainer[i].list[0].id);
-				// 	let tempdata=condition.options.filter((item) => item. == condition.conditionIds[i]);
-				// 	console.log('选择项测试',tempdata);
-				// }
-				
-				let checklist=condition.options.filter(item=>item.child.length>1);
-				//console.log('带监测队列',checklist);
-				//checklist.
-				return true;
+			checkCondition:function(condition,msg){
+				//console.log('测试',condition);
+
+				let MasterTemp=condition.options.filter(item=>{
+					if (item.required==1){
+						let ichecked=false;
+						//遍历所有子选项,关联主卡片
+						let childCon=condition.childContainer.filter(cc=>{
+							// console.log('childCondition',cc);
+							// console.log('childid',cc.list[0].id);
+							// console.log('item',item.id);
+							//判断主卡片对应子项列表
+							if (item.id==cc.list[0].parentId){
+								let tmp=cc.list[0].child.filter(mi=>{
+									return condition.conditionIds.includes(mi.id);//记录的选项中是否是子项中
+								});
+								//判断子项是否在已选列表内,即已选项中存在当前主卡片选项
+								if (tmp.length>0)
+								{
+									ichecked=true;
+									return true;
+								}   
+							}
+						});
+						//console.log('childCon',childCon);
+						if (childCon.length<=0)
+						return true;
+					}
+				});
+				//判断主卡片
+				if (MasterTemp.length>0){
+					//console.log('123');
+					// this.errMsg=MasterTemp[0].name+'未选择!';
+					// return false;
+					return {
+						errMsg:MasterTemp[0].name+'未选择!',
+						funFlag:false,
+					}
+				}
+				
+				
+				//console.log('test_checkConditionCard',this.condition.CheckConditionCard);
+				//判断子选项,根据存储的卡片信息进行判断,正常情况不过滤,只返回第一个搜索出的未选择项卡片
+				const tmp=this.condition.CheckConditionCard.filter(cards=>{
+					//必填项检查
+					if (cards.required==1){
+						// console.log('cards',cards);
+						//查看该项下选项是否有选项
+						const childlist= cards.child.filter(a=>{
+							// console.log('child',a);
+							return this.condition.conditionIds.includes(a.id);
+						});
+						// console.log('childlist',childlist);
+						//返回未选择选项
+						return childlist.length<=0;
+					}
+				});
+				//console.log('tmp',tmp);
+				//因为返回未选择项,则未选项列表有数据则返回错误
+				if (tmp.length>0)
+				{
+					// this.errMsg=tmp[0].name+'未选择!';
+					// return false;
+					return {
+						errMsg:'['+tmp[0].name+']未选择!',
+						funFlag:false,
+					}
+				}
+				else {
+					// return true;
+					return {
+						errMsg:'',
+						funFlag:true,
+					}
+				}
+
+				//return true;
 			}
 		},
 		destroyed() {

+ 2 - 1
pages/creatingSituations/model.js

@@ -37,7 +37,8 @@ const initState = {
 		depType: 1, // 门急诊类型 1-门诊 2-急诊
 		defaultOpen: [], // 默认展开的项
 		checkedItems:[],//已勾选项,
-		childContainer:[],//卡片条件,展开的子项
+		childContainer:[],//卡片条件,展开的子项
+		checkConditionCard:[],//选择的卡片信息 add by yfb 20230515
 	},
 	checkRent: { // 查核组页面数据
 		list: [],

+ 1 - 1
pages/home/home.vue

@@ -107,7 +107,7 @@
 			return {
 				ifshowVersionInfo:false,
 				showJournal: false,
-				version: '0.8.4',
+				version: '0.8.5',
 				versionData: {
 					versionNo: '',
 					versionId: '',