异步问题

This commit is contained in:
shijingjing
2022-07-26 12:02:32 +08:00
parent 048aa08ab1
commit dc9f38a5a5

View File

@@ -255,7 +255,7 @@ export default {
...mapState(['user']) ...mapState(['user'])
}, },
methods: { methods: {
...mapActions(['initOpenData', 'transCanvas']), ...mapActions(['initOpenData', 'transCanvas','selectEnterpriseContact']),
checkTime(index) { checkTime(index) {
if (index == 3) { if (index == 3) {
this.timeSelect = index; this.timeSelect = index;
@@ -563,25 +563,31 @@ export default {
}, },
}) })
.then((res) => { .then((res) => {
if(res?.data) { if (res.code ===0) {
let items = [], xData = [], yData = [] if(res.data && res.data.length) {
res.data.forEach((item) => { let items = [], xData = [], yData = []
const i = {type: 'departmentName', id: item.deptId, corpid: this.user.corpId} res.data.forEach((item) => {
items.push(i) const i = {type: 'departmentName', id: item.deptId, corpid: this.user.corpId}
yData.push(item.taskCount) items.push(i)
}) yData.push(item.taskCount)
this.initOpenData({canvas:true})
this.transCanvas(items).then((data) => {
// console.log(data.items,"data.items");
data.items.map((a) => {
xData.push(a.data)
console.log( xData)
}) })
// console.log(xData, yData, '111222'); console.log('111');
this.getColumnarEcharts(xData, yData)
}) this.initOpenData({canvas:true})
console.log('222');
setTimeout(() => {
this.transCanvas(items).then((data) => {
console.log("333");
data.items.map((a) => {
xData.push(a.data)
console.log( xData)
})
console.log('4444');
this.getColumnarEcharts(xData, yData)
})
},600)
}
} }
}); });
}, },
@@ -630,9 +636,7 @@ export default {
], ],
}); });
}, },
// 选择部门 // 选择部门
...mapActions(['selectEnterpriseContact']),
getDept() { getDept() {
this.selectEnterpriseContact({ this.selectEnterpriseContact({
fromDepartmentId: 0, fromDepartmentId: 0,