From 5636ee8eb5d1108668d0abf1e425268bde14922d Mon Sep 17 00:00:00 2001 From: hyingbo <1363390067@qq.com> Date: 星期一, 01 九月 2025 18:01:02 +0800 Subject: [PATCH] mdc首页开发 --- src/views/dashboard/Analysis.vue | 39 ++++++++++++++++++++++++++++++--------- 1 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/views/dashboard/Analysis.vue b/src/views/dashboard/Analysis.vue index 156fa95..f3a16fb 100644 --- a/src/views/dashboard/Analysis.vue +++ b/src/views/dashboard/Analysis.vue @@ -1,17 +1,25 @@ <template> - <Component :is="currentSignage" :userType="userType" :productionCode="productionCode" + <Component :is="currentSignage" + :userType="userType" + :productionCode="productionCode" :workshopSectionProductionCode="workshopSectionProductionCode" + v-if="[1,2,3,4].includes(userType)" > </Component> + <div v-else> <!-- 涓庣粍浠舵覆鏌撲簰鏂� --> + <img src="@/assets/index.png" style="width: 100%;height: 785px"> + </div> </template> <script> import signageApi from '@/api/signage' + import MdcManagerSignage from './mdcIndex/MdcManagerSignage.vue' import DncManagerSignage from './dncIndex/DncManagerSignage.vue' export default { name: "Analysis", components: { + MdcManagerSignage, DncManagerSignage }, data() { @@ -20,7 +28,7 @@ productionCode: '', branchFactoryProductionCode: '', workshopSectionProductionCode: '', - userType: '' + userType: '', } }, created() { @@ -28,20 +36,27 @@ }, methods: { showModuleByUserInfo() { - const id = JSON.parse(localStorage.getItem('pro__Login_Userinfo')).value.id + // 瀹夊叏澶勭悊锛氬厛鍒ゆ柇localStorage涓槸鍚﹀瓨鍦ㄧ敤鎴蜂俊鎭紝閬垮厤JSON.parse鎶ラ敊 + const userInfoStr = localStorage.getItem('pro__Login_Userinfo') + if (!userInfoStr) { + this.currentSignage = '' // 鏃犵敤鎴蜂俊鎭椂涓嶆覆鏌撶粍浠� + return + } + + const id = JSON.parse(userInfoStr).value.id signageApi.getUserByIdApi(id) .then(res => { - console.log("res", res.userType) - this.userType = res.userType + this.userType = res.userType // 璧嬪�煎悗鑷姩瑙﹀彂鏉′欢娓叉煋鍒ゆ柇 + // 鏍规嵁userType鍖归厤瀵瑰簲缁勪欢锛堟仮澶峜ase1鍜宑ase4鐨勯�昏緫锛� switch (this.userType) { // case 1: // //鍒�鍏风鐞� // this.currentSignage = 'EquipmentSignage' // break - // case 2: - // //mdc - // this.currentSignage = 'WorkshopSectionSignage' - // break + case 2: + // mdc + this.currentSignage = 'MdcManagerSignage' + break case 3: //dnc this.currentSignage = 'DncManagerSignage' @@ -55,6 +70,12 @@ break } }) + .catch(err => { + // 鎺ュ彛璇锋眰澶辫触鏃讹紝榛樿鏄剧ず鍥剧墖 + console.error('鑾峰彇鐢ㄦ埛绫诲瀷澶辫触锛�', err) + this.userType = '' + this.currentSignage = '' + }) } } } -- Gitblit v1.9.3