提交 3534d9a2 authored 作者: lihuihui's avatar lihuihui
......@@ -54,6 +54,7 @@
</template>
<script>
import { getProdRecords, getUserRecords, getToolRecords } from '../api'
import { selectCase } from '@/api/base'
export default {
data() {
return {
......@@ -78,15 +79,14 @@ export default {
page: 1,
limit: 10,
tableIndex: 1
},
navMap: {
1: '/product-analysis/report',
2: '/product-analysis/result',
3: '/user-study',
4: '/market-tools/tool'
}
}
},
computed: {
case() {
return this.$store.state.case
}
},
created() {
this.tabActive = this.$route.query.type
this.fetchProdRecords()
......@@ -97,21 +97,17 @@ export default {
handleTabClick() {
},
handleClick(val) {
switch (this.tabActive) {
case '1':
if (val.is_complete === 1) {
this.$router.push({ path: '/product-analysis/report', query: { id: val.id } })
} else this.$router.push({ path: '/product-analysis/result', query: { id: val.id } })
break
case '2':
const type = val.is_complete === 1 ? '3' : '1'
this.$router.push({ path: '/user-study', query: { id: val.id, type } })
break
case '3':
const _type = val.is_complete === 1 ? '1' : '0'
this.$router.push({ path: '/market-tools/tool', query: { id: val.id, type: _type } })
break
if (this.case.id === val.case_info.id) {
this.handleNav(val)
return
}
this.$confirm('此操作将会切换当前选定的案例,确认继续执行?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.fetchSelectCase(val)
})
},
fetchProdRecords() {
const params = {
......@@ -151,6 +147,31 @@ export default {
this.tool.total = res.data.total
}
})
},
fetchSelectCase(val) {
selectCase(val.case_info.id).then(res => {
if (res.code === 0) {
this.$store.commit('setCase', val.case_info)
this.handleNav(val)
}
})
},
handleNav(val) {
switch (this.tabActive) {
case '1':
let path = '/product-analysis/report'
if (val.is_complete === 1) path = '/product-analysis/result'
this.$router.push({ path, query: { id: val.id } })
break
case '2':
const type = val.is_complete === 1 ? '3' : '1'
this.$router.push({ path: '/user-study', query: { id: val.id, type } })
break
case '3':
const _type = val.is_complete === 1 ? '1' : '0'
this.$router.push({ path: '/market-tools/tool', query: { id: val.id, type: _type } })
break
}
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论