diff --git a/src/permission.js b/src/permission.js index 6c4d46dc..e915f903 100644 --- a/src/permission.js +++ b/src/permission.js @@ -56,19 +56,22 @@ router.beforeEach((to, from, next) => { isRelogin.show = true // 获取字典数据 add by 芋艿 store.dispatch('dict/loadDictDatas') + // 获取部门权限 + store.dispatch('GetLevel') // 判断当前用户是否已拉取完 user_info 信息 store.dispatch('GetInfo').then(userInfo => { isRelogin.show = false // 触发 GenerateRoutes 事件时,将 menus 菜单树传递进去 - store.dispatch('GenerateRoutes', userInfo.menus).then(accessRoutes => { + store.dispatch('GenerateRoutes', userInfo.menus).then(accessRoutes => { // 根据 roles 权限生成可访问的路由表 router.addRoutes(accessRoutes) // 动态添加可访问路由表 const defaultPath = findDefaultPathFromMenus(userInfo.menus) || '/' store.commit('permission/SET_DEFAULT_PATH', defaultPath) - if (to.path === '/' || to.matched.length === 0) { + // 仅当目标为根路径 '/' 时跳默认页;否则保持当前路径(含刷新场景),避免刷新被误判为“未匹配”而跳到默认页 + if (to.path === '/') { next({ path: defaultPath, replace: true }) } else { - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成,当前页刷新时保留 to 的路径 } }) }).catch(err => { diff --git a/src/router/index.js b/src/router/index.js index 986eaa64..9172891f 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -64,13 +64,13 @@ export const constantRoutes = [ component: (resolve) => require(["@/views/error/401"], resolve), hidden: true, }, - { - path: "/", - // component: () => import('@/views/choicePart'), - component: () => import("@/views/home"), - hidden: true, - meta: { requireToken: true }, - }, + // { + // path: "/", + // // component: () => import('@/views/choicePart'), + // component: () => import("@/views/home"), + // hidden: true, + // meta: { requireToken: true }, + // }, // { // path: "/operatingRevenue", // // component: () => import('@/views/choicePart'), diff --git a/src/store/getters.js b/src/store/getters.js index d99cd120..6dbb687d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -19,6 +19,8 @@ const getters = { sidebarRouters:state => state.permission.sidebarRouters, defaultPath: state => state.permission.defaultPath, // 数据字典 - dict_datas: state => state.dict.dictDatas + dict_datas: state => state.dict.dictDatas, + // 部门层级 + levelList: state => state.user.levelList } export default getters diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 2e4ce999..e7cbc592 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,5 +1,6 @@ import {login, logout, getInfo, socialLogin, smsLogin} from '@/api/login' import {setToken, removeToken} from '@/utils/auth' +import {getLevelStruc} from '@/api/cockpit' const user = { state: { @@ -7,7 +8,8 @@ const user = { name: '', avatar: '', roles: [], - permissions: [] + permissions: [], + levelList:[] }, mutations: { @@ -28,6 +30,9 @@ const user = { }, SET_PERMISSIONS: (state, permissions) => { state.permissions = permissions + }, + SET_LEVEL_LIST: (state, levelList) => { + state.levelList = levelList } }, @@ -122,7 +127,21 @@ const user = { }) }) }, - + // 获取层级 + GetLevel({ commit, state }) { + return new Promise((resolve, reject) => { + getLevelStruc().then(res => { + // 如果未加载到数据,则直接返回 + if (!res || !res.data) { + return; + } + commit('SET_LEVEL_LIST', res.data) + resolve() + }) + }).catch(error => { + reject(error) + }) + }, // 退出系统 LogOut({ commit, state }) { return new Promise((resolve, reject) => { diff --git a/src/views/home/components/changeBase.vue b/src/views/home/components/changeBase.vue index 8defd54f..2030f9f4 100644 --- a/src/views/home/components/changeBase.vue +++ b/src/views/home/components/changeBase.vue @@ -1,8 +1,8 @@ @@ -33,80 +33,69 @@ export default { props: { factory: { type: [String, Number], - default: 5, // 新映射中“宜兴”对应序号7 - validator: (val) => [5, 2, 7, 3, 8, 9, 10].includes(val) // 校验序号范围(匹配新的baseNameToIndexMap) + default: undefined, + validator: (val) => [5, 2, 7, 3, 8, 9, 10, 6].includes(val) // 校验序号范围(匹配新的baseNameToIndexMap) + } + }, + // 计算属性(响应式,levelList变化时会自动更新) + computed: { + buttonLevelList() { + // 核心:通过$store.getters获取定义的getter + let arr = [] + this.$store.getters.levelList.forEach(item => { + this.buttonList.forEach(item2 => { + if (item2.id === item.id) { + arr.push(item2) + } + }) + }) + this.activeButton = arr[0].id + return arr } }, data() { return { - activeButton: 5, // 初始化默认选中索引2(对应buttonList中的“宜兴”) - buttonList: ['合肥', '桐城', '宜兴', '自贡', '漳州', '洛阳', '秦皇岛', '宿迁'], // 匹配截图顺序 - imgMap: { - base: { - 合肥: baseHefei, - 桐城: baseTongcheng, - 宜兴: baseYixing, - 自贡: baseZigong, - 漳州: baseZhangzhou, - 洛阳: baseLuoyang, - 秦皇岛: baseQinhuangdao, - 宿迁: baseSuqian - }, - bgBase: { - 合肥: bgBaseHefei, - 桐城: bgBaseTongcheng, - 宜兴: bgBaseYixing, - 自贡: bgBaseZigong, - 漳州: bgBaseZhangzhou, - 洛阳: bgBaseLuoyang, - 秦皇岛: bgBaseQinhuangdao, - 宿迁: bgBaseSuqian - } - }, - baseNameToIndexMap: { // 新的名称→序号映射 - 宜兴: 7, - 漳州: 8, - 自贡: 3, - 桐城: 2, - 洛阳: 9, - 合肥: 5, - 秦皇岛: 10, // 补充 - 宿迁: 6 // 补充 - } + activeButton: undefined, + buttonList:[ + {id: 5, name: '合肥', img: baseHefei, bgImg: bgBaseHefei}, + {id: 2, name: '桐城', img: baseTongcheng, bgImg: bgBaseTongcheng}, + {id: 7, name: '宜兴', img: baseYixing, bgImg: bgBaseYixing}, + {id: 3, name: '自贡', img: baseZigong, bgImg: bgBaseZigong}, + {id: 8, name: '漳州', img: baseZhangzhou, bgImg: bgBaseZhangzhou}, + {id: 9, name: '洛阳', img: baseLuoyang, bgImg: bgBaseLuoyang}, + {id: 10, name: '秦皇岛', img: baseQinhuangdao, bgImg: bgBaseQinhuangdao}, + {id: 6, name: '宿迁', img: baseSuqian, bgImg: bgBaseSuqian} + ], }; }, watch: { // 监听父组件传递的factory变化,同步本地选中索引 factory: { handler(newVal) { - // 根据新的baseNameToIndexMap,找到对应的基地名称 - const targetName = Object.keys(this.baseNameToIndexMap).find(name => this.baseNameToIndexMap[name] === newVal); - // 根据名称找到buttonList中的索引 - const targetIndex = this.buttonList.indexOf(targetName); - // 合法索引则更新,否则默认选中宜兴 - this.activeButton = targetIndex > -1 ? targetIndex : 2; - console.log('当前选中基地:', this.buttonList[this.activeButton], '序号:', newVal); + console.log('watch factory=======================:', newVal); + if (newVal) { + this.activeButton = newVal; + } + // // 根据新的baseNameToIndexMap,找到对应的基地名称 + // const targetName = Object.keys(this.baseNameToIndexMap).find(name => this.baseNameToIndexMap[name] === newVal); + // // 根据名称找到buttonList中的索引 + // const targetIndex = this.buttonList.indexOf(targetName); + // // 合法索引则更新,否则默认选中宜兴 + // this.activeButton = targetIndex > -1 ? targetIndex : 2; + // console.log('当前选中基地:', this.buttonList[this.activeButton], '序号:', newVal); }, - immediate: true // 初始化立即执行 - }, - // 监听本地选中索引变化,向父组件发送事件 - activeButton(newVal) { - const selectedName = this.buttonList[newVal]; - const selectedIndex = this.baseNameToIndexMap[selectedName] || 5; // 默认返回宜兴的序号7 - this.$emit('baseChange', selectedIndex); + // immediate: true // 初始化立即执行 } }, methods: { - handleClick(index) { - this.activeButton = index; - }, - getIndexByName(name) { - return this.baseNameToIndexMap[name] || 5; + handleClick(id) { + this.activeButton = id; + this.$emit('baseChange', id); } }, mounted() { // 初始化时触发事件,传递默认选中的宜兴序号(7) - this.$emit('baseChange', 5); + // this.$emit('baseChange', 5); } }; diff --git a/src/views/home/expenseAnalysis/expenseAnalysisBase.vue b/src/views/home/expenseAnalysis/expenseAnalysisBase.vue index 30ea846b..01dc44be 100644 --- a/src/views/home/expenseAnalysis/expenseAnalysisBase.vue +++ b/src/views/home/expenseAnalysis/expenseAnalysisBase.vue @@ -114,6 +114,7 @@ export default { monthAnalysis: [], ytdAnalysis: [], trend: [], + factory:null }; }, @@ -185,7 +186,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/expenseAnalysisComponents/operatingLineBarSale.vue b/src/views/home/expenseAnalysisComponents/operatingLineBarSale.vue index d67621c1..d47b65f1 100644 --- a/src/views/home/expenseAnalysisComponents/operatingLineBarSale.vue +++ b/src/views/home/expenseAnalysisComponents/operatingLineBarSale.vue @@ -89,7 +89,9 @@ export default { const baseIndex = this.baseNameToIndexMap[itemName] || 0; console.log(`你点击了【${itemName}】(序号:${baseIndex})`); - + if (itemName === undefined) { + return; + } this.$router.push({ path: 'expenseAnalysisBase', query: { // 使用query传递参数(推荐),也可使用params diff --git a/src/views/home/fullCostAnalysis/fullCostAnalysisBase.vue b/src/views/home/fullCostAnalysis/fullCostAnalysisBase.vue index c35e288b..c73588ca 100644 --- a/src/views/home/fullCostAnalysis/fullCostAnalysisBase.vue +++ b/src/views/home/fullCostAnalysis/fullCostAnalysisBase.vue @@ -102,7 +102,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -174,7 +174,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/fullCostAnalysisComponents/operatingLineBarSale.vue b/src/views/home/fullCostAnalysisComponents/operatingLineBarSale.vue index b3a076ed..d85b10ea 100644 --- a/src/views/home/fullCostAnalysisComponents/operatingLineBarSale.vue +++ b/src/views/home/fullCostAnalysisComponents/operatingLineBarSale.vue @@ -91,7 +91,9 @@ export default { const baseIndex = this.baseNameToIndexMap[itemName] || 0; console.log(`你点击了【${itemName}】(序号:${baseIndex})`); - + if (itemName === undefined) { + return; + } // 路由跳转时携带序号(或名称+序号) this.$router.push({ path: 'fullCostAnalysisBase', diff --git a/src/views/home/grossMargin/grossMarginBase.vue b/src/views/home/grossMargin/grossMarginBase.vue index 113e70ff..9e6eb2cb 100644 --- a/src/views/home/grossMargin/grossMarginBase.vue +++ b/src/views/home/grossMargin/grossMarginBase.vue @@ -111,7 +111,7 @@ export default { dateData:{}, levelId:undefined, index: '毛利率', - factory: 1, + factory: null, monthData: {}, ytdData: {}, monthAnalysis: [], @@ -188,7 +188,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/grossMarginComponents/operatingLineBarSale.vue b/src/views/home/grossMarginComponents/operatingLineBarSale.vue index 9ac02be5..24dcfeac 100644 --- a/src/views/home/grossMarginComponents/operatingLineBarSale.vue +++ b/src/views/home/grossMarginComponents/operatingLineBarSale.vue @@ -102,7 +102,9 @@ export default { const baseIndex = this.baseNameToIndexMap[itemName] || 0; console.log(`你点击了【${itemName}】(序号:${baseIndex})`); - + if (itemName === undefined) { + return; + } // 路由跳转时携带序号(或名称+序号) this.$router.push({ path: 'grossMarginBase', diff --git a/src/views/home/inputOutputRatio/inputOutputRatioBase.vue b/src/views/home/inputOutputRatio/inputOutputRatioBase.vue index 37f80ffe..b552998e 100644 --- a/src/views/home/inputOutputRatio/inputOutputRatioBase.vue +++ b/src/views/home/inputOutputRatio/inputOutputRatioBase.vue @@ -104,7 +104,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, index: '加工成品率', monthData: undefined, @@ -184,7 +184,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/inputOutputRatioComponents/operatingLineBarSale.vue b/src/views/home/inputOutputRatioComponents/operatingLineBarSale.vue index aa285bba..c54ee4d9 100644 --- a/src/views/home/inputOutputRatioComponents/operatingLineBarSale.vue +++ b/src/views/home/inputOutputRatioComponents/operatingLineBarSale.vue @@ -90,7 +90,9 @@ export default { const baseIndex = this.baseNameToIndexMap[itemName] || 0; console.log(`你点击了【${itemName}】(序号:${baseIndex})`); - + if (itemName === undefined) { + return; + } // 路由跳转时携带序号(或名称+序号) this.$router.push({ diff --git a/src/views/home/netPriceAnalysis/netPriceAnalysisBase.vue b/src/views/home/netPriceAnalysis/netPriceAnalysisBase.vue index 00a551b2..fd68a19c 100644 --- a/src/views/home/netPriceAnalysis/netPriceAnalysisBase.vue +++ b/src/views/home/netPriceAnalysis/netPriceAnalysisBase.vue @@ -104,7 +104,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, relatedMon: {}, @@ -178,7 +178,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/netPriceAnalysisComponents/operatingLineBarSale.vue b/src/views/home/netPriceAnalysisComponents/operatingLineBarSale.vue index 1920bb2f..5f718035 100644 --- a/src/views/home/netPriceAnalysisComponents/operatingLineBarSale.vue +++ b/src/views/home/netPriceAnalysisComponents/operatingLineBarSale.vue @@ -90,7 +90,9 @@ export default { const baseIndex = this.baseNameToIndexMap[itemName] || 0; console.log(`你点击了【${itemName}】(序号:${baseIndex})`); - + if (itemName === undefined) { + return; + } // 路由跳转时携带序号(或名称+序号) this.$router.push({ path: 'netPriceAnalysisBase', diff --git a/src/views/home/operatingComponents/operatingLineBarSale.vue b/src/views/home/operatingComponents/operatingLineBarSale.vue index 7622fc09..f8678670 100644 --- a/src/views/home/operatingComponents/operatingLineBarSale.vue +++ b/src/views/home/operatingComponents/operatingLineBarSale.vue @@ -91,8 +91,9 @@ export default { const baseIndex = this.baseNameToIndexMap[itemName] || 0; console.log(`你点击了【${itemName}】(序号:${baseIndex})`); - - + if (itemName === undefined) { + return; + } // 路由跳转时携带序号(或名称+序号) this.$router.push({ path: 'operatingRevenueBase', diff --git a/src/views/home/operatingProfit/operatingProfitBase.vue b/src/views/home/operatingProfit/operatingProfitBase.vue index b5fa60ed..f9d8f11c 100644 --- a/src/views/home/operatingProfit/operatingProfitBase.vue +++ b/src/views/home/operatingProfit/operatingProfitBase.vue @@ -101,7 +101,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -174,7 +174,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/operatingProfitComponents/operatingLineBarSale.vue b/src/views/home/operatingProfitComponents/operatingLineBarSale.vue index dedbda2c..8177ddbd 100644 --- a/src/views/home/operatingProfitComponents/operatingLineBarSale.vue +++ b/src/views/home/operatingProfitComponents/operatingLineBarSale.vue @@ -91,6 +91,9 @@ export default { const baseIndex = this.baseNameToIndexMap[itemName] || 0; console.log(`你点击了【${itemName}】(序号:${baseIndex})`); + if (itemName === undefined) { + return; + } // 路由跳转时携带序号(或名称+序号) this.$router.push({ diff --git a/src/views/home/operatingRevenue/operatingRevenueBase.vue b/src/views/home/operatingRevenue/operatingRevenueBase.vue index e180b1b0..d66738b6 100644 --- a/src/views/home/operatingRevenue/operatingRevenueBase.vue +++ b/src/views/home/operatingRevenue/operatingRevenueBase.vue @@ -108,7 +108,7 @@ export default { beilv: 1, month:'', value: 100, - factory:0, + factory:null, dateData:{}, index: '营业收入', monthData: undefined, @@ -157,7 +157,7 @@ export default { transformOrigin: "left top", // overflow: hidden; }; - }, + } }, watch: { clientWidth(val) { @@ -188,7 +188,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } console.log('this.$route.query.dateData', this.$route.query.dateData); this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, diff --git a/src/views/home/operatingRevenueBase.vue b/src/views/home/operatingRevenueBase待删除.vue similarity index 100% rename from src/views/home/operatingRevenueBase.vue rename to src/views/home/operatingRevenueBase待删除.vue diff --git a/src/views/home/operatingRevenue.vue b/src/views/home/operatingRevenue待删除.vue similarity index 100% rename from src/views/home/operatingRevenue.vue rename to src/views/home/operatingRevenue待删除.vue diff --git a/src/views/home/procurementGainAnalysis/procurementGainAnalysisBase.vue b/src/views/home/procurementGainAnalysis/procurementGainAnalysisBase.vue index 0c7e44ea..1788f5e3 100644 --- a/src/views/home/procurementGainAnalysis/procurementGainAnalysisBase.vue +++ b/src/views/home/procurementGainAnalysis/procurementGainAnalysisBase.vue @@ -101,7 +101,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -173,7 +173,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/procurementGainAnalysisComponents/operatingLineBarSale.vue b/src/views/home/procurementGainAnalysisComponents/operatingLineBarSale.vue index f1600241..3e16488b 100644 --- a/src/views/home/procurementGainAnalysisComponents/operatingLineBarSale.vue +++ b/src/views/home/procurementGainAnalysisComponents/operatingLineBarSale.vue @@ -92,7 +92,9 @@ export default { const baseIndex = this.baseNameToIndexMap[itemName] || 0; console.log(`你点击了【${itemName}】(序号:${baseIndex})`); - + if (itemName === undefined) { + return; + } // 路由跳转时携带序号(或名称+序号) this.$router.push({ diff --git a/src/views/home/productionCostAnalysis/SIMFRMCostAnalysis.vue b/src/views/home/productionCostAnalysis/SIMFRMCostAnalysis.vue index 68cc1638..539eea45 100644 --- a/src/views/home/productionCostAnalysis/SIMFRMCostAnalysis.vue +++ b/src/views/home/productionCostAnalysis/SIMFRMCostAnalysis.vue @@ -102,7 +102,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -183,7 +183,13 @@ export default { })(); }; console.log(this.$route.query.name, 'name'); - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/combustible.vue b/src/views/home/productionCostAnalysis/combustible.vue index d8be00c2..c0e02f81 100644 --- a/src/views/home/productionCostAnalysis/combustible.vue +++ b/src/views/home/productionCostAnalysis/combustible.vue @@ -103,7 +103,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -183,7 +183,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/fuelCostAnalysis.vue b/src/views/home/productionCostAnalysis/fuelCostAnalysis.vue index 1bbd7622..ff3b4e91 100644 --- a/src/views/home/productionCostAnalysis/fuelCostAnalysis.vue +++ b/src/views/home/productionCostAnalysis/fuelCostAnalysis.vue @@ -102,7 +102,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -182,7 +182,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/mfgOverheadCostAnalysis.vue b/src/views/home/productionCostAnalysis/mfgOverheadCostAnalysis.vue index ea8fce53..7b9963b9 100644 --- a/src/views/home/productionCostAnalysis/mfgOverheadCostAnalysis.vue +++ b/src/views/home/productionCostAnalysis/mfgOverheadCostAnalysis.vue @@ -103,7 +103,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -183,7 +183,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/mfgOverheadSingleCostAnalysis.vue b/src/views/home/productionCostAnalysis/mfgOverheadSingleCostAnalysis.vue index 1a4f024e..930a5f13 100644 --- a/src/views/home/productionCostAnalysis/mfgOverheadSingleCostAnalysis.vue +++ b/src/views/home/productionCostAnalysis/mfgOverheadSingleCostAnalysis.vue @@ -88,7 +88,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -166,7 +166,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/originalSheetCostBase.vue b/src/views/home/productionCostAnalysis/originalSheetCostBase.vue index 5e5ff921..07d42398 100644 --- a/src/views/home/productionCostAnalysis/originalSheetCostBase.vue +++ b/src/views/home/productionCostAnalysis/originalSheetCostBase.vue @@ -103,7 +103,7 @@ export default { beilv: 1, month:'', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -184,7 +184,13 @@ export default { })(); }; console.log('this.$route.query.factory', this.$route.query.factory); - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/originalSheetLabor.vue b/src/views/home/productionCostAnalysis/originalSheetLabor.vue index e2e858f4..1b27a385 100644 --- a/src/views/home/productionCostAnalysis/originalSheetLabor.vue +++ b/src/views/home/productionCostAnalysis/originalSheetLabor.vue @@ -90,7 +90,7 @@ export default { beilv: 1, month:'', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -168,6 +168,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/osElectricityCostAnalysis.vue b/src/views/home/productionCostAnalysis/osElectricityCostAnalysis.vue index fa412a48..9533235f 100644 --- a/src/views/home/productionCostAnalysis/osElectricityCostAnalysis.vue +++ b/src/views/home/productionCostAnalysis/osElectricityCostAnalysis.vue @@ -102,7 +102,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -182,6 +182,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/procAuxMatCost.vue b/src/views/home/productionCostAnalysis/procAuxMatCost.vue index 37159f5b..7fbd4081 100644 --- a/src/views/home/productionCostAnalysis/procAuxMatCost.vue +++ b/src/views/home/productionCostAnalysis/procAuxMatCost.vue @@ -104,7 +104,7 @@ export default { timer: null, beilv: 1, month: '', - factory: 5, + factory: null, value: 100, dateData: {}, trendName: '加工燃料成本', @@ -184,7 +184,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/procMfgOverheadCost.vue b/src/views/home/productionCostAnalysis/procMfgOverheadCost.vue index e48d2afa..d3ff72ce 100644 --- a/src/views/home/productionCostAnalysis/procMfgOverheadCost.vue +++ b/src/views/home/productionCostAnalysis/procMfgOverheadCost.vue @@ -103,7 +103,7 @@ export default { beilv: 1, month:'', value: 100, - factory: 5, + factory: null, dateData: {}, trendName: '加工制造费用成本', monData: {}, @@ -176,7 +176,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/procPackMatCost.vue b/src/views/home/productionCostAnalysis/procPackMatCost.vue index ca8fe405..49ccd22c 100644 --- a/src/views/home/productionCostAnalysis/procPackMatCost.vue +++ b/src/views/home/productionCostAnalysis/procPackMatCost.vue @@ -90,7 +90,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -168,7 +168,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/processingCostAnalysisBase.vue b/src/views/home/productionCostAnalysis/processingCostAnalysisBase.vue index 78a533ae..1da1d061 100644 --- a/src/views/home/productionCostAnalysis/processingCostAnalysisBase.vue +++ b/src/views/home/productionCostAnalysis/processingCostAnalysisBase.vue @@ -103,7 +103,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -185,7 +185,13 @@ export default { }; console.log('this.$route.query.factory', this.$route.query.factory); - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/processingFuel.vue b/src/views/home/productionCostAnalysis/processingFuel.vue index f234646d..f4b9ea5f 100644 --- a/src/views/home/productionCostAnalysis/processingFuel.vue +++ b/src/views/home/productionCostAnalysis/processingFuel.vue @@ -103,7 +103,7 @@ export default { beilv: 1, month:'', value: 100, - factory: 5, + factory: null, dateData: {}, trendName: '加工燃料成本', monData: {}, @@ -176,7 +176,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/processingLabor.vue b/src/views/home/productionCostAnalysis/processingLabor.vue index 56dea56c..d396c2e3 100644 --- a/src/views/home/productionCostAnalysis/processingLabor.vue +++ b/src/views/home/productionCostAnalysis/processingLabor.vue @@ -90,7 +90,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -168,7 +168,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/productionCostAnalysisBase.vue b/src/views/home/productionCostAnalysis/productionCostAnalysisBase.vue index 9fdb4610..7be68af2 100644 --- a/src/views/home/productionCostAnalysis/productionCostAnalysisBase.vue +++ b/src/views/home/productionCostAnalysis/productionCostAnalysisBase.vue @@ -105,7 +105,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -179,7 +179,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/singleCombustible.vue b/src/views/home/productionCostAnalysis/singleCombustible.vue index 182b55ca..4f8825fc 100644 --- a/src/views/home/productionCostAnalysis/singleCombustible.vue +++ b/src/views/home/productionCostAnalysis/singleCombustible.vue @@ -102,7 +102,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -182,7 +182,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/singleProcAuxMatCost.vue b/src/views/home/productionCostAnalysis/singleProcAuxMatCost.vue index 32de2cd4..24bae2d2 100644 --- a/src/views/home/productionCostAnalysis/singleProcAuxMatCost.vue +++ b/src/views/home/productionCostAnalysis/singleProcAuxMatCost.vue @@ -102,7 +102,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -182,7 +182,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/singleProcMfgOverheadCost.vue b/src/views/home/productionCostAnalysis/singleProcMfgOverheadCost.vue index e591ffbd..78f3980a 100644 --- a/src/views/home/productionCostAnalysis/singleProcMfgOverheadCost.vue +++ b/src/views/home/productionCostAnalysis/singleProcMfgOverheadCost.vue @@ -88,7 +88,7 @@ export default { beilv: 1, month:'', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -160,7 +160,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysis/singleProcessingFuel.vue b/src/views/home/productionCostAnalysis/singleProcessingFuel.vue index 22667456..d9991696 100644 --- a/src/views/home/productionCostAnalysis/singleProcessingFuel.vue +++ b/src/views/home/productionCostAnalysis/singleProcessingFuel.vue @@ -102,7 +102,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -182,7 +182,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/productionCostAnalysisComponents/operatingLineBarSale.vue b/src/views/home/productionCostAnalysisComponents/operatingLineBarSale.vue index 33587d20..16bfdba6 100644 --- a/src/views/home/productionCostAnalysisComponents/operatingLineBarSale.vue +++ b/src/views/home/productionCostAnalysisComponents/operatingLineBarSale.vue @@ -90,7 +90,9 @@ export default { const baseIndex = this.baseNameToIndexMap[itemName] || 0; console.log(`你点击了【${itemName}】(序号:${baseIndex})`); - + if (itemName === undefined) { + return; + } // 路由跳转时携带序号(或名称+序号) this.$router.push({ diff --git a/src/views/home/productionCostAnalysisComponents/productionOperatingLineBarSale.vue b/src/views/home/productionCostAnalysisComponents/productionOperatingLineBarSale.vue index 73219aad..5967bbdd 100644 --- a/src/views/home/productionCostAnalysisComponents/productionOperatingLineBarSale.vue +++ b/src/views/home/productionCostAnalysisComponents/productionOperatingLineBarSale.vue @@ -98,7 +98,9 @@ export default { const baseIndex = this.baseNameToIndexMap[itemName] || 0; console.log(`你点击了【${itemName}】(序号:${baseIndex})`); - + if (itemName === undefined) { + return; + } // 路由跳转时携带序号(或名称+序号) this.$router.push({ path: this.baseUrl, diff --git a/src/views/home/rawSheetYield/rawSheetYieldBase.vue b/src/views/home/rawSheetYield/rawSheetYieldBase.vue index e710390f..e7822dca 100644 --- a/src/views/home/rawSheetYield/rawSheetYieldBase.vue +++ b/src/views/home/rawSheetYield/rawSheetYieldBase.vue @@ -107,7 +107,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, index: '原片成品率', monthData: undefined, @@ -187,7 +187,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/rawSheetYieldComponents/operatingLineBarSale.vue b/src/views/home/rawSheetYieldComponents/operatingLineBarSale.vue index 446e29c7..a4499519 100644 --- a/src/views/home/rawSheetYieldComponents/operatingLineBarSale.vue +++ b/src/views/home/rawSheetYieldComponents/operatingLineBarSale.vue @@ -87,7 +87,9 @@ export default { const baseIndex = this.baseNameToIndexMap[itemName] || 0; console.log(`你点击了【${itemName}】(序号:${baseIndex})`); - + if (itemName === undefined) { + return; + } // 路由跳转时携带序号(或名称+序号) this.$router.push({ diff --git a/src/views/home/salesVolumeAnalysis/doublePlatedBase.vue b/src/views/home/salesVolumeAnalysis/doublePlatedBase.vue index 12f003b3..3384e3c1 100644 --- a/src/views/home/salesVolumeAnalysis/doublePlatedBase.vue +++ b/src/views/home/salesVolumeAnalysis/doublePlatedBase.vue @@ -104,7 +104,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -178,7 +178,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/salesVolumeAnalysis/productionSalesBase.vue b/src/views/home/salesVolumeAnalysis/productionSalesBase.vue index 2266d501..6ccd8462 100644 --- a/src/views/home/salesVolumeAnalysis/productionSalesBase.vue +++ b/src/views/home/salesVolumeAnalysis/productionSalesBase.vue @@ -104,7 +104,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -178,7 +178,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/salesVolumeAnalysis/salesVolumeAnalysisBase.vue b/src/views/home/salesVolumeAnalysis/salesVolumeAnalysisBase.vue index f4438ac9..179f29eb 100644 --- a/src/views/home/salesVolumeAnalysis/salesVolumeAnalysisBase.vue +++ b/src/views/home/salesVolumeAnalysis/salesVolumeAnalysisBase.vue @@ -101,7 +101,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, totalData: {}, @@ -173,7 +173,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/salesVolumeAnalysisComponents/operatingLineBarSale.vue b/src/views/home/salesVolumeAnalysisComponents/operatingLineBarSale.vue index 10d64a1b..4a8c63af 100644 --- a/src/views/home/salesVolumeAnalysisComponents/operatingLineBarSale.vue +++ b/src/views/home/salesVolumeAnalysisComponents/operatingLineBarSale.vue @@ -90,7 +90,9 @@ export default { const baseIndex = this.baseNameToIndexMap[itemName] || 0; console.log(`你点击了【${itemName}】(序号:${baseIndex})`); - + if (itemName === undefined) { + return; + } // 路由跳转时携带序号(或名称+序号) this.$router.push({ diff --git a/src/views/home/totalProfit/totalProfitBase.vue b/src/views/home/totalProfit/totalProfitBase.vue index 9c9d8511..12a6b8d4 100644 --- a/src/views/home/totalProfit/totalProfitBase.vue +++ b/src/views/home/totalProfit/totalProfitBase.vue @@ -175,7 +175,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/totalProfitComponents/operatingLineBarSale.vue b/src/views/home/totalProfitComponents/operatingLineBarSale.vue index 5c0d26e5..18225462 100644 --- a/src/views/home/totalProfitComponents/operatingLineBarSale.vue +++ b/src/views/home/totalProfitComponents/operatingLineBarSale.vue @@ -87,7 +87,9 @@ export default { const baseIndex = this.baseNameToIndexMap[itemName] || 0; console.log(`你点击了【${itemName}】(序号:${baseIndex})`); - + if (itemName === undefined) { + return; + } // 路由跳转时携带序号(或名称+序号) this.$router.push({ diff --git a/src/views/home/unitPriceAnalysis/unitPriceAnalysisBase.vue b/src/views/home/unitPriceAnalysis/unitPriceAnalysisBase.vue index d549127d..e6d2b6ca 100644 --- a/src/views/home/unitPriceAnalysis/unitPriceAnalysisBase.vue +++ b/src/views/home/unitPriceAnalysis/unitPriceAnalysisBase.vue @@ -109,7 +109,7 @@ export default { beilv: 1, month: '', value: 100, - factory: 5, + factory: null, dateData: {}, monData: {}, relatedMon: {}, @@ -182,7 +182,13 @@ export default { this.beilv = _this.clientWidth / 1920; })(); }; - this.factory = this.$route.query.factory ? Number(this.$route.query.factory) : 5 + if(this.$route.query.factory){ + this.factory =Number(this.$route.query.factory) + }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) { + this.factory = this.$store.getters.levelList[0].id + }else{ + this.factory = this.$store.getters.levelList[1].id + } this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined }, methods: { diff --git a/src/views/home/unitPriceAnalysisComponents/operatingLineBarSale.vue b/src/views/home/unitPriceAnalysisComponents/operatingLineBarSale.vue index 4275930d..0d1267e9 100644 --- a/src/views/home/unitPriceAnalysisComponents/operatingLineBarSale.vue +++ b/src/views/home/unitPriceAnalysisComponents/operatingLineBarSale.vue @@ -89,7 +89,9 @@ export default { const baseIndex = this.baseNameToIndexMap[itemName] || 0; console.log(`你点击了【${itemName}】(序号:${baseIndex})`); - + if (itemName === undefined) { + return; + } // 路由跳转时携带序号(或名称+序号) this.$router.push({ diff --git a/src/views/login.vue b/src/views/login.vue index a58db422..2a03cf2e 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -297,7 +297,6 @@ export default { ) .then(() => { console.log(this.redirect, this.$route.query.redirect, 'this.redirect'); - this.$router.push({ path: this.redirect || '/' }).catch(() => { }); }) .catch(() => {