|
|
@@ -2,7 +2,7 @@
|
|
|
* 方案管理 mixin
|
|
|
* 负责:方案列表加载、子方案选择、模式切换时刷新方案
|
|
|
*/
|
|
|
-import { getCareList, getCareDetail } from '@/utils/api/care.js'
|
|
|
+import { getCareList, getCareDetail, getCustomPlanList, getCustomPlanDetail } from '@/utils/api/care.js'
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
@@ -36,28 +36,45 @@ export default {
|
|
|
|
|
|
/**
|
|
|
* 加载指定模式的方案列表
|
|
|
- * @param {Number} mode - 1专业 2自定义 3专家
|
|
|
+ * @param {Number} mode - 1专业 2自定义 3延年圣手
|
|
|
*/
|
|
|
async loadPlanList(mode) {
|
|
|
this.planLoading = true
|
|
|
try {
|
|
|
- // modeType映射为后端模式标识
|
|
|
- const modeMap = {
|
|
|
- 1: 'PROFESSIONAL',
|
|
|
- 2: 'CUSTOM',
|
|
|
- 3: 'EXPERT'
|
|
|
- }
|
|
|
- const res = await getCareList({ modeType: modeMap[mode] || '' })
|
|
|
- if (res && res.records) {
|
|
|
- this.planList = res.records.map(item => ({
|
|
|
- id: item.id,
|
|
|
- name: item.title || item.name || '未命名方案',
|
|
|
- description: item.description || item.remark || '',
|
|
|
- steps: item.stepCount || item.steps || 0,
|
|
|
- duration: item.totalDuration || 0
|
|
|
- }))
|
|
|
+ if (mode === 2) {
|
|
|
+ // 自定义模式 - 使用自定义方案列表接口
|
|
|
+ const res = await getCustomPlanList()
|
|
|
+ if (res && Array.isArray(res)) {
|
|
|
+ this.planList = res.map(item => ({
|
|
|
+ id: item.id,
|
|
|
+ name: item.name || '未命名方案',
|
|
|
+ description: item.description || '',
|
|
|
+ symptoms: item.symptoms || '',
|
|
|
+ status: item.status,
|
|
|
+ useCount: item.useCount || 0,
|
|
|
+ avgRating: item.avgRating
|
|
|
+ }))
|
|
|
+ } else {
|
|
|
+ this.planList = []
|
|
|
+ }
|
|
|
} else {
|
|
|
- this.planList = []
|
|
|
+ // 专业模式/延年圣手模式 - 使用原有调理方案列表接口
|
|
|
+ const modeMap = {
|
|
|
+ 1: 'PROFESSIONAL',
|
|
|
+ 3: 'EXPERT'
|
|
|
+ }
|
|
|
+ const res = await getCareList({ modeType: modeMap[mode] || '' })
|
|
|
+ if (res && res.records) {
|
|
|
+ this.planList = res.records.map(item => ({
|
|
|
+ id: item.id,
|
|
|
+ name: item.title || item.name || '未命名方案',
|
|
|
+ description: item.description || item.remark || '',
|
|
|
+ steps: item.stepCount || item.steps || 0,
|
|
|
+ duration: item.totalDuration || 0
|
|
|
+ }))
|
|
|
+ } else {
|
|
|
+ this.planList = []
|
|
|
+ }
|
|
|
}
|
|
|
} catch (e) {
|
|
|
console.error('加载方案列表失败', e)
|
|
|
@@ -84,16 +101,23 @@ export default {
|
|
|
|
|
|
/**
|
|
|
* 将方案数据应用到当前穴位配置
|
|
|
- * TODO: 后续对接方案详情接口,获取具体步骤和穴位坐标
|
|
|
*/
|
|
|
async _applyPlanToCase(plan) {
|
|
|
if (!plan || !plan.id) return
|
|
|
try {
|
|
|
- const res = await getCareDetail(plan.id)
|
|
|
+ let res
|
|
|
+ if (this.modeType === 2) {
|
|
|
+ // 自定义模式 - 使用自定义方案详情接口
|
|
|
+ res = await getCustomPlanDetail(plan.id)
|
|
|
+ } else {
|
|
|
+ res = await getCareDetail(plan.id)
|
|
|
+ }
|
|
|
if (res && res.steps) {
|
|
|
this.curCase = res.steps.map(step => ({
|
|
|
id: step.acupointId || step.id,
|
|
|
+ name: step.acupointName || '',
|
|
|
time: step.duration || 15,
|
|
|
+ temperature: step.temperature || 42,
|
|
|
_x: step.x || 0,
|
|
|
_y: step.y || 0
|
|
|
}))
|