//下面是代码
getInfo() {
constuserInfo = JSON.parse(localStorage.getItem('user'))
if (userInfo.role === 3) {
//调取后台接口
selectExpertCount(userInfo.id).then(res => {
this.info = res.data.data
this.handleData(this.info)
})
}
},
handleData(info) {
// 诊断统计
for (var i = 0; i < info.mtc.length; i++) {
this.total_cg.push(this.info.mtc[i].cgtotal)
this.total_bd.push(this.info.mtc[i].bdtotal)
this.total_xb.push(this.info.mtc[i].xbtotal)
this.total_hz.push(this.info.mtc[i].hztotal)
}
this.total_cg.push(0)
this.total_bd.push(0)
this.total_xb.push(0)
this.total_hz.push(0)
// 大体取材统计
for (varj = 0; j < info.dtqc.length; j++) {
this.dtqc_total.push(info.dtqc[j].total)
}
// 顶部数据
for (var a = 0; a < info.ptc.length; a++) {
if (info.ptc[a].pathologyType === 7) {
Object.assign(this.cg, this.cg, info.ptc[a])
} else if (info.ptc[a].pathologyType === 8) {
Object.assign(this.xb, this.xb, info.ptc[a])
} else if (info.ptc[a].pathologyType === 9) {
Object.assign(this.bd, this.bd, info.ptc[a])
} else {
Object.assign(this.hz, this.hz, info.ptc[a])
}
}
// 受邀
for (varb\ = 0; b < info.intc.length; b++) {
if (info.intc[b].pathologyType === 7) {
this.cg.sy = info.ptc[b].sy
} else if (info.intc[b].pathologyType === 8) {
this.xb.sy = info.ptc[b].sy
} else if (info.intc[b].pathologyType === 9) {
this.bd.sy = info.intc[b].sy
} else {
this.cg.sy = info.intc[b].sy
}
}
},
你的this.cg是一个对象,你这样写vue是监听不到数据的变化的
需要使用
this.$set
方法,或者这样完全重新赋值才行