|
|
@@ -294,10 +294,12 @@
|
|
|
<el-col :span="8">
|
|
|
<el-form-item :label="'侧别'" :prop="`steps.${index}.side`" :rules="stepRules.side">
|
|
|
<el-select v-model="step.side" placeholder="侧别" style="width:100%">
|
|
|
- <el-option label="中心" :value="1" />
|
|
|
- <el-option label="左侧" :value="2" />
|
|
|
- <el-option label="右侧" :value="3" />
|
|
|
- <el-option label="双侧" :value="4" />
|
|
|
+ <el-option
|
|
|
+ v-for="opt in getSideOptions(step.acupointId)"
|
|
|
+ :key="opt.value"
|
|
|
+ :label="opt.label"
|
|
|
+ :value="opt.value"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -656,12 +658,44 @@ const stepRules = {
|
|
|
techniqueId: [{ required: true, message: '请选择艾灸手法', trigger: 'change' }]
|
|
|
}
|
|
|
|
|
|
+const allSideOptions = [
|
|
|
+ { label: '中心', value: 1 },
|
|
|
+ { label: '左侧', value: 2 },
|
|
|
+ { label: '右侧', value: 3 },
|
|
|
+ { label: '双侧', value: 4 }
|
|
|
+]
|
|
|
+
|
|
|
+/**
|
|
|
+ * 根据穴位的单/双穴属性返回可选的侧别选项
|
|
|
+ * - 单穴:只能选"中心"
|
|
|
+ * - 双穴:不能选"中心"(左侧/右侧/双侧)
|
|
|
+ */
|
|
|
+function getSideOptions(acupointId) {
|
|
|
+ if (!acupointId) return allSideOptions
|
|
|
+ const found = acupointOptions.value.find(a => a.id === acupointId)
|
|
|
+ if (!found || !found.singleDouble) return allSideOptions
|
|
|
+ if (found.singleDouble.includes('单')) {
|
|
|
+ return allSideOptions.filter(opt => opt.value === 1)
|
|
|
+ }
|
|
|
+ if (found.singleDouble.includes('双')) {
|
|
|
+ return allSideOptions.filter(opt => opt.value !== 1)
|
|
|
+ }
|
|
|
+ return allSideOptions
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
- * 穴位选择变更:同步填充 acupointName
|
|
|
+ * 穴位选择变更:同步填充 acupointName,并根据单/双穴自动调整侧别
|
|
|
*/
|
|
|
function onAcupointChange(id, index) {
|
|
|
const found = acupointOptions.value.find(a => a.id === id)
|
|
|
formData.steps[index].acupointName = found ? found.name : ''
|
|
|
+ if (found && found.singleDouble) {
|
|
|
+ if (found.singleDouble.includes('单') && formData.steps[index].side !== 1) {
|
|
|
+ formData.steps[index].side = 1
|
|
|
+ } else if (found.singleDouble.includes('双') && formData.steps[index].side === 1) {
|
|
|
+ formData.steps[index].side = 4
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|