提交 2ed2496d authored 作者: matian's avatar matian

代码优化

上级 10ecd10e
...@@ -67,19 +67,7 @@ export default { ...@@ -67,19 +67,7 @@ export default {
// 上一步 // 上一步
handlePrev() { handlePrev() {
if (this.$refs.mailStepTwo.handleStepTwo()) { if (this.$refs.mailStepTwo.handleStepTwo()) {
const reports = { this.handleStep(2)
activeStep: this.activeStep,
type: 3,
commit_report: [
{ stepOneList: this.stepOneList },
{ form: this.stepTwoList },
{ time: this.time, time2: this.time2 }
]
}
cacheReport(this.$store.state.case.id, { reports: JSON.stringify(reports) }).then(res => {
this.caseId = res.data.id
this.activeStep--
})
} }
}, },
// 下一步 // 下一步
...@@ -107,7 +95,11 @@ export default { ...@@ -107,7 +95,11 @@ export default {
} }
cacheReport(this.$store.state.case.id, { reports: JSON.stringify(reports) }).then(res => { cacheReport(this.$store.state.case.id, { reports: JSON.stringify(reports) }).then(res => {
this.caseId = res.data.id this.caseId = res.data.id
this.activeStep++ if (val === 2) {
this.activeStep--
} else {
this.activeStep++
}
}) })
}, },
// 预览 // 预览
......
...@@ -70,20 +70,7 @@ export default { ...@@ -70,20 +70,7 @@ export default {
// 上一步 // 上一步
handlePrev() { handlePrev() {
if (this.$refs.mailStepTwo.handleStepTwo()) { if (this.$refs.mailStepTwo.handleStepTwo()) {
const reports = { this.handleStep(2)
activeStep: this.activeStep,
type: 2,
commit_report: [
{ stepOneList: this.stepOneList },
{ form: this.stepTwoList },
{ time: this.time, time2: this.time2 }
]
}
cacheReport(this.$store.state.case.id, { reports: JSON.stringify(reports) }).then(res => {
this.caseId = res.data.id
this.activeStep--
})
console.log(this.stepOneList, 'this.stepOneList')
} }
}, },
// 下一步 // 下一步
...@@ -99,6 +86,8 @@ export default { ...@@ -99,6 +86,8 @@ export default {
} }
} }
}, },
//
// 保存步骤信息
handleStep(val) { handleStep(val) {
const reports = { const reports = {
activeStep: parseInt(val), activeStep: parseInt(val),
...@@ -106,12 +95,16 @@ export default { ...@@ -106,12 +95,16 @@ export default {
commit_report: [ commit_report: [
{ stepOneList: this.stepOneList }, { stepOneList: this.stepOneList },
{ form: this.stepTwoList }, { form: this.stepTwoList },
{ time: this.times, time2: this.times2 } { time: this.time, time2: this.time2 }
] ]
} }
cacheReport(this.$store.state.case.id, { reports: JSON.stringify(reports) }).then(res => { cacheReport(this.$store.state.case.id, { reports: JSON.stringify(reports) }).then(res => {
this.caseId = res.data.id this.caseId = res.data.id
this.activeStep++ if (val === 2) {
this.activeStep--
} else {
this.activeStep++
}
}) })
}, },
// 预览 // 预览
...@@ -166,6 +159,7 @@ export default { ...@@ -166,6 +159,7 @@ export default {
if (this.$route.query.type) { if (this.$route.query.type) {
this.getReportDetail(this.$route.query.id) this.getReportDetail(this.$route.query.id)
} else { } else {
this.initStepList()
this.checkRecord() this.checkRecord()
} }
} }
......
...@@ -67,20 +67,7 @@ export default { ...@@ -67,20 +67,7 @@ export default {
// 上一步 // 上一步
handlePrev() { handlePrev() {
if (this.$refs.mailStepTwo.handleStepTwo()) { if (this.$refs.mailStepTwo.handleStepTwo()) {
const reports = { this.handleStep(2)
activeStep: this.activeStep,
type: 4,
commit_report: [
{ stepOneList: this.stepOneList },
{ form: this.stepTwoList },
{ time: this.time, time2: this.time2 }
]
}
cacheReport(this.$store.state.case.id, { reports: JSON.stringify(reports) }).then(res => {
this.caseId = res.data.id
this.activeStep--
})
console.log(this.stepOneList, 'this.stepOneList')
} }
}, },
// 下一步 // 下一步
...@@ -109,7 +96,11 @@ export default { ...@@ -109,7 +96,11 @@ export default {
} }
cacheReport(this.$store.state.case.id, { reports: JSON.stringify(reports) }).then(res => { cacheReport(this.$store.state.case.id, { reports: JSON.stringify(reports) }).then(res => {
this.caseId = res.data.id this.caseId = res.data.id
this.activeStep++ if (val === 2) {
this.activeStep--
} else {
this.activeStep++
}
}) })
}, },
// 预览 // 预览
......
...@@ -104,7 +104,6 @@ export default { ...@@ -104,7 +104,6 @@ export default {
const answerList = res.data.items.filter(item => item.type === 5) const answerList = res.data.items.filter(item => item.type === 5)
if (res.data.items.length && answerList.length) { if (res.data.items.length && answerList.length) {
this.activeStep = answerList[0].answer.activeStep this.activeStep = answerList[0].answer.activeStep
this.stepOneList = answerList[0].answer.commit_report[0].stepOneList this.stepOneList = answerList[0].answer.commit_report[0].stepOneList
} else { } else {
this.initStepList() this.initStepList()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论