提交 c2c1e3ea authored 作者: lihuihui's avatar lihuihui
......@@ -40,7 +40,6 @@ export default {
} else {
if (['/user-study', '/market-tools'].includes(item.path)) {
const flag = await this.fetchWorkStatus()
console.log(flag)
if (flag) {
this.$router.push(item.path)
} else {
......
......@@ -20,6 +20,7 @@ import AppMenu from '@/components/base/AppMenu.vue'
import RoleSelect from '../components/RoleSelect.vue'
import Btn from '../components/Btn.vue'
import { selectRole } from '../api'
import { getWorkStatus } from '@/api/base.js'
export default {
components: { AppMenu, RoleSelect, Btn },
data() {
......@@ -51,10 +52,39 @@ export default {
}
},
methods: {
handleClick(item) {
if (!item.disabled.includes(this.role)) {
// handleClick(item) {
// if (!item.disabled.includes(this.role)) {
// this.$router.push(item.path)
// }
// },
async handleClick(item) {
if (this.role === 0) {
this.$message.error('请选择角色')
} else if (item.disabled.includes(this.role)) {
this.$message.error('您当前的角色禁止访问该页面')
} else {
if (['/user-study', '/market-tools'].includes(item.path)) {
const flag = await this.fetchWorkStatus()
if (flag) {
this.$router.push(item.path)
} else {
this.$message.error('请先完成产品分析报告,再进行' + item.label)
}
} else {
this.$router.push(item.path)
}
}
},
fetchWorkStatus() {
return new Promise((resolve) => {
getWorkStatus().then(res => {
if (res.code === 0 && res.data && res.data.case_status) {
resolve(true)
} else {
resolve(false)
}
}).catch(() => resolve(false))
})
},
menuSelect(item) {
this.$router.push(item.path)
......
......@@ -94,7 +94,16 @@ export default {
}
getChart(params).then(res => {
if (res.code === 0 && res.data && Array.isArray(res.data.chart)) {
this.options.series[0].data = res.data.chart.map(item => parseFloat(item.percent))
const list = JSON.parse(JSON.stringify(this.value.options))
list.forEach(item => {
const select = res.data.chart.find(it => it.option === parseFloat(item.tag))
if (select) {
item.value = parseFloat(select.percent)
} else {
item.value = 0
}
})
this.options.series[0].data = list.map(item => parseFloat(item.value))
this.echart.setOption(this.options)
}
})
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论