Pārlūkot izejas kodu

自定义方案双侧穴位显示bug修复

liyuliangjiazai 4 mēneši atpakaļ
vecāks
revīzija
e97e8bf349
1 mainītis faili ar 32 papildinājumiem un 12 dzēšanām
  1. 32 12
      code/ajyApp/pages/device/acupointEdit/acupointEdit.vue

+ 32 - 12
code/ajyApp/pages/device/acupointEdit/acupointEdit.vue

@@ -91,13 +91,9 @@
 						<text class="form-label">侧别</text>
 						<view class="tags-row">
 							<view 
-								class="tag-item" 
-								v-for="item in sideOptions" 
-								:key="item"
-								:class="{'tag-item-active': editForm.side === item}"
-								@click="editForm.side = item"
+								class="tag-item tag-item-active" 
 							>
-								{{item}}
+								{{editForm.side}}
 							</view>
 						</view>
 					</view>
@@ -212,7 +208,7 @@ export default {
 				temperature: 45,
 				duration: 15
 			},
-			sideOptions: ['双侧', '中心', '左侧', '右侧'],
+			sideOptions: [ '中心', '左侧', '右侧'],
 			methodOptions: ['温和灸', '雀啄灸', '回旋灸'],
 			
 			scrollTop: 0,
@@ -439,17 +435,41 @@ export default {
 
 		/** 将方案步骤参数回填到穴位列表 */
 		applyStepsToAcupoints(steps) {
-			const sideMap = { 1: '中心', 2: '左侧', 3: '右侧', 4: '双侧' }
+			const sideMap = { 1: '中心', 2: '左侧', 3: '右侧' }
 			const techniqueMap = { '2': '温和灸', '4': '回旋灸', '3': '雀啄灸' }
+			// step.side数字值到acupointSide英文值的映射
+			const sideToAcupointSide = { 1: 'center', 2: 'left', 3: 'right' }
+			
 			steps.forEach(step => {
-				const point = this.acupointList.find(p => p.acupointId === step.acupointId)
-				if (point) {
+				let matchedPoints = []
+				
+				if (step.side === 4) {
+					// 双侧:匹配同acupointId的所有穴位(左右两侧都标记)
+					matchedPoints = this.acupointList.filter(p => String(p.acupointId) === String(step.acupointId))
+				} else {
+					// 单侧:优先通过acupointId + acupointSide精确匹配
+					const targetSide = sideToAcupointSide[step.side]
+					const point = this.acupointList.find(p =>
+						String(p.acupointId) === String(step.acupointId) && p.acupointSide === targetSide
+					)
+					if (point) {
+						matchedPoints = [point]
+					} else {
+						// 兜底:仅按acupointId匹配未被回填过的穴位
+						const fallback = this.acupointList.find(p =>
+							String(p.acupointId) === String(step.acupointId) && !p._inPlan
+						)
+						if (fallback) matchedPoints = [fallback]
+					}
+				}
+				
+				matchedPoints.forEach(point => {
 					point.customSide = sideMap[step.side] || '中心'
 					point.method = techniqueMap[step.techniqueId] || '温和灸'
 					point.temperature = step.temperature || 45
 					point.duration = step.duration || 15
 					point._inPlan = true
-				}
+				})
 			})
 		},
 
@@ -490,7 +510,7 @@ export default {
 
 			this.saving = true
 			try {
-				const sideMap = { '中心': 1, '左侧': 2, '右侧': 3, '双侧': 4 }
+				const sideMap = { '中心': 1, '左侧': 2, '右侧': 3}
 				const techniqueMap = { '温和灸': '2', '回旋灸': '4', '雀啄灸': '3' }
 				const steps = this.buildSteps()