|
@@ -2,39 +2,120 @@
|
|
|
<div class="container">
|
|
|
<h3 style="text-align: center;color:#ffffff;margin-bottom: 5px;margin-top:35px">数据导航</h3>
|
|
|
|
|
|
- <div class="wrapper" v-for="route in routes" :key="route.label">
|
|
|
+ <div class="wrapper" v-for="route in permissionRoutes" :key="route.label">
|
|
|
<el-button type="info" plain @click="goRouter($event,route.link)">{{route.label}}
|
|
|
<i class="el-icon-right"></i>
|
|
|
</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
+
|
|
|
<script>
|
|
|
+import { getOpenid, getParameterByName, removeOpenid, setOpenid } from "../utils/auth";
|
|
|
+import userRequest from "@/api/index";
|
|
|
+
|
|
|
export default {
|
|
|
data(){
|
|
|
return {
|
|
|
+ isShow: [],
|
|
|
+ state: { message: '', error: false, loading: false },
|
|
|
routes:[
|
|
|
- { label:'6.业务公司业绩报表', link: '/?path=newResults'},
|
|
|
- { label:'8.结算订单业绩报表', link: '/?path=newEarningReport'},
|
|
|
- { label:'2.利润看板', link: '/?path=report'},
|
|
|
- { label:'3.应收账款', link: '/?path=accountsReceivable'},
|
|
|
- { label:'4.订单情况', link: '/?path=newReport'},
|
|
|
- { label:'5.发货情况', link: '/?path=stock'},
|
|
|
- { label:'7.库存情况', link:'?path=newStock'},
|
|
|
- { label:'1.业绩报表(2023版)', link: '/?path=results'},
|
|
|
- // { label: '测试', link: '/?path=newResultInfo'},
|
|
|
- { label: '业务公司订单统计', link: '/?path=newReporting' }
|
|
|
+ { label:'6.业务公司业绩报表', link: '/?path=newResults', permission: '6'},
|
|
|
+ { label:'8.结算订单业绩报表', link: '/?path=newEarningReport', permission: '8'},
|
|
|
+ { label:'2.利润看板', link: '/?path=report', permission: '2' },
|
|
|
+ { label:'3.应收账款', link: '/?path=accountsReceivable', permission: '3'},
|
|
|
+ { label:'4.订单情况', link: '/?path=newReport', permission: '4'},
|
|
|
+ { label:'5.发货情况', link: '/?path=stock', permission: '5'},
|
|
|
+ { label:'7.库存情况', link:'?path=newStock', permission: '7'},
|
|
|
+ { label:'1.业绩报表(2023版)', link: '/?path=results', permission: '1'},
|
|
|
+ { label: '业务公司订单统计', link: '/?path=newReporting', permission: '9' }
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
- mounted(){
|
|
|
+ computed: {
|
|
|
+ permissionRoutes(){
|
|
|
+ return this.routes.filter(route => this.isShow.includes(route.permission) || this.isShow.includes(Number(route.permission)))
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
document.title = "数据导航"
|
|
|
+
|
|
|
+ if (!getParameterByName('code')) {
|
|
|
+ this.login()
|
|
|
+ } else {
|
|
|
+ this.requestUserinfo()
|
|
|
+ }
|
|
|
},
|
|
|
methods:{
|
|
|
goRouter(e,link){
|
|
|
e.stopPropagation()
|
|
|
window.open(link)
|
|
|
- }
|
|
|
+ },
|
|
|
+ async requestUserinfo() {
|
|
|
+ this.state.loading = true;
|
|
|
+ const openid = getOpenid()
|
|
|
+ const code = getParameterByName('code')
|
|
|
+ const result = await userRequest.userinfo({ ...( openid ? { openid } : { code }) })
|
|
|
+ // const result = {
|
|
|
+ // "code": 0,
|
|
|
+ // "message": "获取成功",
|
|
|
+ // "data": {
|
|
|
+ // "id": "1",
|
|
|
+ // "openid": "oOpc26KiZFBKIm7SB8knFGvov1qg",
|
|
|
+ // "mobile": "",
|
|
|
+ // "gender": "0",
|
|
|
+ // "nickname": "雪寒",
|
|
|
+ // "avatar": "",
|
|
|
+ // "subscribe_time": "2022-12-21 15:52:14",
|
|
|
+ // "addr": "\/\/",
|
|
|
+ // "status": "1",
|
|
|
+ // "is_show": ["1", "2", "7"],
|
|
|
+ // "companyArr": [{
|
|
|
+ // "companyNo": "GS2302231125079621",
|
|
|
+ // "companyName": "北京百辰荣达国际科贸有限公司",
|
|
|
+ // "info": [1, 2]
|
|
|
+ // }, {
|
|
|
+ // "companyNo": "GS2302231323386950",
|
|
|
+ // "companyName": "北京泓源广诚国际商贸有限公司",
|
|
|
+ // "info": [1, 2]
|
|
|
+ // }, {
|
|
|
+ // "companyNo": "GS2304031312553746",
|
|
|
+ // "companyName": "北京锦兴弘昌科技有限公司",
|
|
|
+ // "info": [1, 2]
|
|
|
+ // }, {
|
|
|
+ // "companyNo": "GS2302231124114965",
|
|
|
+ // "companyName": "北京普润心堂商贸有限公司",
|
|
|
+ // "info": [1, 2]
|
|
|
+ // }, {
|
|
|
+ // "companyNo": "GS2203161855277894",
|
|
|
+ // "companyName": "北京万宇恒通国际科贸有限公司",
|
|
|
+ // "info": [1, 2]
|
|
|
+ // }],
|
|
|
+ // "addtime": "2023-04-10 18:11:07",
|
|
|
+ // "updatetime": "2023-05-09 16:22:33"
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ this.state.loading = false
|
|
|
+ switch (Number(result.code)) {
|
|
|
+ case 0:
|
|
|
+ this.isShow = result.data.is_show
|
|
|
+ setOpenid(result.data.openid)
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ this.state.error = true
|
|
|
+ this.state.message = result.message
|
|
|
+ openid && removeOpenid()
|
|
|
+ break
|
|
|
+ }
|
|
|
+ },
|
|
|
+ login() {
|
|
|
+ const redirect_url = encodeURIComponent('http://stat.caixiao365.com/accountsReceivable')
|
|
|
+ var state = 'wx_' + Math.random().toString(36).substr(2, 15)
|
|
|
+ const scope = 'snsapi_userinfo'
|
|
|
+ const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${config.appId}&redirect_uri=${redirect_url}&response_type=code&scope=${scope}&state=${state}#wechat_redirect`
|
|
|
+ window.location.href = url
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|