优化一下这个js方法 saleNavPageurlkey const roleCn = unigetStorageSyncuserInfo let viewMy = thiscurrentRolePowersalesdatasRangefilteritem = itemchecked viewMy = viewMylength == 2 3 view
saleNavPage({url,key}){ const userInfo = uni.getStorageSync('userInfo') const roleCn = userInfo.roleCn const salesPower = this.currentRolePower['sales'] const viewMy = salesPower.datasRange.filter(item => item.checked) .map(item => item.value) .sort() .join('') === '12' ? 3 : (viewMy[0]?.value || '') // // 1我 2员工 3全部 const activeTabKey = viewMy === 1 ? 1 : viewMy === 2 || viewMy === 3 ? 2 : '' const employeeViewMy = viewMy === 3 || viewMy === '' ? 3 : viewMy
// 时间类型
const timeType = salesPower.timeRange.filter(item => item.checked)[0].value
if(key === 'customerVisitNum'){ //客户拜访
url && uni.navigateTo({
url:`${url}?followupType=3&timeType=${timeType}&employeeViewMy=${employeeViewMy}`
})
}else if(key === 'technicalExchangeNum'){ //技术交流
url && uni.navigateTo({
url:`${url}?followupType=1&timeType=${timeType}&employeeViewMy=${employeeViewMy}`
})
}else if(key === 'liveDemonstrationNum'){ //现场演示
url && uni.navigateTo({
url:`${url}?followupType=2&timeType=${timeType}&employeeViewMy=${employeeViewMy}`
})
}else if(key === 'workPlanDay' || key === 'workPlanWeekly' ){
url && uni.navigateTo({
url:`${url}?activeTabKey=${activeTabKey}`
})
}else if(key === 'curCustomerNum'){
url && uni.navigateTo({
url:`${url}?employeeViewMy=${employeeViewMy}`
})
}
// 当前客户联系人
else if(key === 'currentCustomerLink'){
url && uni.navigateTo({
url:`${url}?&timeType=${timeType}&employeeViewMy=${employeeViewMy}`
})
}
// 新建客户联系人
else if(key === 'createCustomerLink'){
const resKey = uni.getStorageInfoSync();
resKey.keys.forEach(item => {
if (item.indexOf('selectLinkManDept') !== -1) {
uni.removeStorageSync(`${item}`);
}
if (item.indexOf('selectUnitObj') !== -1) {
uni.removeStorageSync(`${item}`);
}
})
const value = uni.getStorageSync("USERGRID")
const authKey = value.filter(item => item.authKey === "linkAdd")
if (authKey.length > 0) {
uni.navigateTo({
url: "/pages/tabbar/tabbar-unitmanage/addLinkMan?type=2"
})
} else {
uni.showToast({
title: "您的权限不足,无法操作"
})
}
}
else{
url && uni.navigateTo({url })
}
},
原文地址: https://www.cveoy.top/t/topic/Xjh 著作权归作者所有。请勿转载和采集!