|
|
@@ -2,7 +2,7 @@
|
|
|
* 方案管理 mixin
|
|
|
* 负责:方案列表加载、子方案选择、模式切换时刷新方案
|
|
|
*/
|
|
|
-import { getCareList, getCareDetail, getCustomPlanList, getCustomPlanDetail, deleteCustomPlan } from '@/utils/api/care.js'
|
|
|
+import { getCustomPlanList, getCustomPlanDetail, deleteCustomPlan, getProfessionalPlanList, getProfessionalPlanDetail, getMasterPlanList, getMasterPlanDetail } from '@/utils/api/care.js'
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
@@ -41,9 +41,10 @@ export default {
|
|
|
async loadPlanList(mode) {
|
|
|
this.planLoading = true
|
|
|
try {
|
|
|
+ let res
|
|
|
if (mode === 2) {
|
|
|
// 自定义模式 - 使用自定义方案列表接口
|
|
|
- const res = await getCustomPlanList()
|
|
|
+ res = await getCustomPlanList()
|
|
|
if (res && Array.isArray(res)) {
|
|
|
this.planList = res.map(item => ({
|
|
|
id: item.id,
|
|
|
@@ -57,24 +58,14 @@ export default {
|
|
|
} else {
|
|
|
this.planList = []
|
|
|
}
|
|
|
- } else {
|
|
|
- // 专业模式/延年圣手模式 - 使用原有调理方案列表接口
|
|
|
- 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 = []
|
|
|
- }
|
|
|
+ } else if (mode === 1) {
|
|
|
+ // 专业模式 - 使用专业模式方案列表接口
|
|
|
+ res = await getProfessionalPlanList()
|
|
|
+ this.planList = this._mapSystemPlanList(res)
|
|
|
+ } else if (mode === 3) {
|
|
|
+ // 延年圣手模式 - 使用延年圣手方案列表接口
|
|
|
+ res = await getMasterPlanList()
|
|
|
+ this.planList = this._mapSystemPlanList(res)
|
|
|
}
|
|
|
} catch (e) {
|
|
|
console.error('加载方案列表失败', e)
|
|
|
@@ -83,6 +74,30 @@ export default {
|
|
|
this.planLoading = false
|
|
|
},
|
|
|
|
|
|
+ /** 映射系统方案列表数据(专业模式/延年圣手模式通用) */
|
|
|
+ _mapSystemPlanList(res) {
|
|
|
+ if (res && Array.isArray(res)) {
|
|
|
+ return res.map(item => ({
|
|
|
+ id: item.id,
|
|
|
+ name: item.name || item.title || '未命名方案',
|
|
|
+ description: item.description || item.remark || '',
|
|
|
+ steps: item.stepCount || item.steps || 0,
|
|
|
+ duration: item.totalDuration || item.duration || 0
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ // 兼容分页结构
|
|
|
+ if (res && res.records) {
|
|
|
+ return res.records.map(item => ({
|
|
|
+ id: item.id,
|
|
|
+ name: item.name || item.title || '未命名方案',
|
|
|
+ description: item.description || item.remark || '',
|
|
|
+ steps: item.stepCount || item.steps || 0,
|
|
|
+ duration: item.totalDuration || item.duration || 0
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ return []
|
|
|
+ },
|
|
|
+
|
|
|
/** 打开方案选择弹窗 */
|
|
|
showPlanDrawer() {
|
|
|
if (this.planList.length === 0 && this.modeType !== 0) {
|
|
|
@@ -149,8 +164,12 @@ export default {
|
|
|
if (this.modeType === 2) {
|
|
|
// 自定义模式 - 使用自定义方案详情接口
|
|
|
res = await getCustomPlanDetail(plan.id)
|
|
|
- } else {
|
|
|
- res = await getCareDetail(plan.id)
|
|
|
+ } else if (this.modeType === 1) {
|
|
|
+ // 专业模式 - 使用专业模式方案详情接口
|
|
|
+ res = await getProfessionalPlanDetail(plan.id)
|
|
|
+ } else if (this.modeType === 3) {
|
|
|
+ // 延年圣手模式 - 使用延年圣手方案详情接口
|
|
|
+ res = await getMasterPlanDetail(plan.id)
|
|
|
}
|
|
|
if (res && res.steps) {
|
|
|
this.curCase = res.steps.map(step => ({
|