|
|
@@ -162,7 +162,8 @@ export default {
|
|
|
taskSubmitted: false,
|
|
|
taskSubmittedCount: 0,
|
|
|
healthStatus: null,
|
|
|
- dietPrefs: null
|
|
|
+ dietPrefs: null,
|
|
|
+ autoExecute: false
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -179,8 +180,17 @@ export default {
|
|
|
this.selectedMemberIds = this.initialMemberIds.slice()
|
|
|
}
|
|
|
this.subjectId = options.subjectId || ''
|
|
|
+ this.autoExecute = options.autoExecute === '1'
|
|
|
+ this.loadFamilyReports()
|
|
|
this.loadExecutors()
|
|
|
this.loadHealthContext()
|
|
|
+ // 自动出方案模式:等待异步加载完成后执行
|
|
|
+ if (this.autoExecute) {
|
|
|
+ var self = this
|
|
|
+ setTimeout(function() {
|
|
|
+ self.doAutoExecuteFlow()
|
|
|
+ }, 2500)
|
|
|
+ }
|
|
|
},
|
|
|
onShow: function() {
|
|
|
this.loadHealthContext()
|
|
|
@@ -263,6 +273,14 @@ export default {
|
|
|
sixMonthsAgo.setMonth(sixMonthsAgo.getMonth() - 6)
|
|
|
return d.getTime() < sixMonthsAgo.getTime()
|
|
|
},
|
|
|
+ doAutoExecuteFlow: function() {
|
|
|
+ if (this.selectedMemberIds.length === 0) return
|
|
|
+ // 自动填充默认目标(菌群报告场景)
|
|
|
+ if (!this.userGoal || this.userGoal.trim().length === 0) {
|
|
|
+ this.userGoal = '基于菌群检测报告的个性化健康管理方案'
|
|
|
+ }
|
|
|
+ this.doGeneratePlan()
|
|
|
+ },
|
|
|
doGeneratePlan: function() {
|
|
|
var self = this
|
|
|
self.loading = true
|
|
|
@@ -284,6 +302,10 @@ export default {
|
|
|
self.planContent = answer
|
|
|
self.parseTasksFromPlan(answer)
|
|
|
self.step = 3
|
|
|
+ // 自动出方案模式:方案生成后自动提交任务
|
|
|
+ if (self.autoExecute && self.parsedTasks.length > 0) {
|
|
|
+ setTimeout(function() { self.submitTasks() }, 500)
|
|
|
+ }
|
|
|
} else {
|
|
|
uni.showToast({ title: '生成失败,请重试', icon: 'none' })
|
|
|
}
|