wzz пре 3 недеља
родитељ
комит
e5711f657a
3 измењених фајлова са 17 додато и 14 уклоњено
  1. 6 10
      src/pages/selfCenter/info.vue
  2. 5 3
      src/pages/sickForm/history.vue
  3. 6 1
      src/pages/sickForm/historyDetail.vue

+ 6 - 10
src/pages/selfCenter/info.vue

@@ -109,16 +109,12 @@ export default {
 	     const res = await request('user', 'get_case_info', { openId: currentOpenId() })
 	     if (res.code === 200) {
             this.baseFormData = res.data;
-			this.baseFormData.sex = Number(this.baseFormData.sex);
-			this.baseFormData.common_hand = Number(this.baseFormData.common_hand);
-			this.baseFormData.doctor_id = Number(this.baseFormData.doctor_id);
-			this.baseFormData.education = Number(this.baseFormData.education);
-			this.baseFormData.hospital_id = Number(this.baseFormData.hospital_id);
-			this.baseFormData.marriage = Number(this.baseFormData.marriage);
-			this.baseFormData.nation = Number(this.baseFormData.nation);
-			this.baseFormData.profession = Number(this.baseFormData.profession);
-			this.baseFormData.type = Number(this.baseFormData.type);
-			this.baseFormData.house = Number(this.baseFormData.house);
+			// 后台没填过的选择类字段存的是字符串 "0"(或者字段压根不存在),选项列表都是从 value:1 开始编号,
+			// 统一兜底成 1,否则这几个只读下拉会显示空白(跟 history.vue 是同一套处理)
+			['sex','common_hand','doctor_id','education','hospital_id','marriage','nation','profession','type','house'].forEach((key)=>{
+				if (!this.baseFormData[key] || this.baseFormData[key] == '0') this.baseFormData[key] = 1
+				this.baseFormData[key] = Number(this.baseFormData[key])
+			})
 			this.getUserSelect();
 	     }
 	   },

+ 5 - 3
src/pages/sickForm/history.vue

@@ -409,9 +409,11 @@ export default {
 	     const res = await request('user', 'get_case_info', { openId: currentOpenId(), doctor_id: docId || 0 })
 	     if (res.code === 200) {
             this.baseFormData = res.data;
-			// 后台没填过职业时存的是字符串 "0"(跟 age/sex 是同一套"0 代表未填"的约定),
-			// "0" 在 JS 里是真值不会被 !this.baseFormData.profession 判断到,要单独处理
-			if (!this.baseFormData.profession || this.baseFormData.profession == '0') this.baseFormData.profession = 1
+			// 后台没填过的选择类字段存的是字符串 "0"(或者字段压根不存在),跟 age/sex 是同一套"0 代表未填"的约定,
+			// "0"/undefined 在 JS 里判真值容易漏判,选项列表都是从 value:1 开始编号,统一兜底成 1,否则选择器会显示空白
+			['profession','nation','education','marriage','house','common_hand','type','hospital_id','doctor_id'].forEach((key)=>{
+				if (!this.baseFormData[key] || this.baseFormData[key] == '0') this.baseFormData[key] = 1
+			})
 			// 老病历记录没有工作地点字段时后台返回 null,uni-easyinput 绑定 null 初始值会导致输入内容同步不到 baseFormData,提前归一化成空字符串
 			if (this.baseFormData.work_address == null || this.baseFormData.work_address == undefined) this.baseFormData.work_address = ''
 			this.unitValue = this.baseFormData.days.substr(-1);

+ 6 - 1
src/pages/sickForm/historyDetail.vue

@@ -330,7 +330,12 @@ export default {
    },
    judgeHaveContent(result){
 	   if(result){
-		   result = result
+		   // 修复:其他题目已有答案时,原来这里直接原样返回,完全没处理"头痛的时间"(id=205),
+		   // 会导致这道题的答案静默丢失,不会提交给后端。补上和 else 分支一致的拼接方式。
+		   let headacheItem = this.sickHisList.find((item)=>{ return item.id == 205 })
+		   if(headacheItem){
+			   result = headacheItem.id + ':' + this.headache + this.unitSubmit + ';' + result
+		   }
 	   }else {
 		   this.sickHisList.forEach((item)=>{
 			  if (item.id == 205){