From ecdac8a738f254db2b2ea28cbe3248f7a6a7eb2b Mon Sep 17 00:00:00 2001
From: mrzcc <121184950@qq.com>
Date: 星期五, 06 三月 2020 16:18:27 +0800
Subject: [PATCH] 优化采购申请组件
---
WebService/src/main/resources/components/pageFramePackage/menu/menu.js | 142 +++++++++++++++++++++++++++--------------------
1 files changed, 82 insertions(+), 60 deletions(-)
diff --git a/WebService/src/main/resources/components/pageFramePackage/menu/menu.js b/WebService/src/main/resources/components/pageFramePackage/menu/menu.js
index 8814c25..1602430 100644
--- a/WebService/src/main/resources/components/pageFramePackage/menu/menu.js
+++ b/WebService/src/main/resources/components/pageFramePackage/menu/menu.js
@@ -1,92 +1,114 @@
/**
- 鑿滃崟 澶勭悊
-**/
-(function(vc){
+ 鑿滃崟 澶勭悊
+ **/
+(function (vc) {
var vm = new Vue({
- el:'#menu-nav',
- data:{
- menus:[]
- },
- mounted:function(){
- this.getMenus();
- },
- methods:{
- getMenus:function(){
+ el: '#menu-nav',
+ data: {
+ menus: [],
+ logo: '',
+ },
+ mounted: function () {
+ this._initSysInfo();
+ this.getMenus();
+ },
+ methods: {
+ _initSysInfo: function () {
+ var sysInfo = vc.getData("_sysInfo");
+ if (sysInfo == null) {
+ this.logo = "HC";
+ return;
+ }
+ this.logo = sysInfo.logo;
+ },
+ _gotoIndex:function(){
+ vc.jumpToPage("/")
+ },
+ getMenus: function () {
var _tmpMenus = vc.getMenus();
//娴忚鍣ㄧ紦瀛樹腑鑳借幏鍙栧埌
- if(_tmpMenus != null && _tmpMenus != undefined){
+ if (_tmpMenus != null && _tmpMenus != undefined) {
this.miniMenu();
this.menus = _tmpMenus;
- return ;
+ return;
}
- var param = {
- params:{
- msg:this.message
+ var param = {
+ params: {
+ msg: this.message
}
- }
- //鍙戦�乬et璇锋眰
- vc.http.get('menu',
- 'getMenus',
- param,
- function(json,res){
- var _menus = JSON.parse(json);
- if(_menus == null || _menus.length == 0){
- return ;
- }
- _menus.sort(function(a,b){
- return a.seq - b.seq
- });
- var _currentMenusId = vc.getCurrentMenu() == null?_menus[0].id:vc.getCurrentMenu();
- vm.menus = vm.refreshMenuActive(_menus,_currentMenusId);
- vc.setMenus(vm.menus);
- vm.miniMenu();
- },function(errInfo,error){
- console.log('璇锋眰澶辫触澶勭悊');
- }
- );
- },
- refreshMenuActive:function(jsonArray,_id){
- for(var menuIndex =0 ; menuIndex < jsonArray.length;menuIndex ++){
+ }
+ //鍙戦�乬et璇锋眰
+ vc.http.get('menu',
+ 'getMenus',
+ param,
+ function (json, res) {
+ var _menus = JSON.parse(json);
+ if (_menus == null || _menus.length == 0) {
+ return;
+ }
+ _menus.sort(function (a, b) {
+ return a.seq - b.seq
+ });
+ var _currentMenusId = vc.getCurrentMenu() == null ? _menus[0].id : vc.getCurrentMenu();
+ vm.menus = vm.refreshMenuActive(_menus, _currentMenusId);
+ vc.setMenus(vm.menus);
+ vm.miniMenu();
+ }, function (errInfo, error) {
+ console.log('璇锋眰澶辫触澶勭悊');
+ }
+ );
+ },
+ refreshMenuActive: function (jsonArray, _id) {
+ for (var menuIndex = 0; menuIndex < jsonArray.length; menuIndex++) {
- if(jsonArray[menuIndex].hasOwnProperty('childs')){
+ if (jsonArray[menuIndex].hasOwnProperty('childs')) {
var _childs = jsonArray[menuIndex].childs;
- _childs.sort(function(_child,_newChild){
+ _childs.sort(function (_child, _newChild) {
return _child.seq - _newChild.seq
});
jsonArray[menuIndex].childs = _childs;
}
- if(_id === jsonArray[menuIndex].id){
- if(jsonArray[menuIndex].active === true){
+ if (_id === jsonArray[menuIndex].id) {
+ if (jsonArray[menuIndex].active === true) {
//濡傛灉褰撳墠鏈韩鏄墦寮�鐘舵�侊紝璇存槑 闇�瑕佸叧闂�
- jsonArray[menuIndex].active=false;
- continue;
+ jsonArray[menuIndex].active = false;
+ continue;
}
- jsonArray[menuIndex].active=true;
+ jsonArray[menuIndex].active = true;
continue;
}
- jsonArray[menuIndex].active=false;
+ jsonArray[menuIndex].active = false;
}
-
- return jsonArray;
- },
- switchMenu:function(_id){
+ return jsonArray;
+ },
+ switchMenu: function (_id) {
//璁剧疆鑿滃崟ID
vc.setCurrentMenu(_id);
- vm.menus = vm.refreshMenuActive(vm.menus,_id);
+ vm.menus = vm.refreshMenuActive(vm.menus, _id);
vc.setMenus(vm.menus);
- },
- miniMenu:function(){
- $("body").toggleClass("mini-navbar");
- //SmoothlyMenu();
- }
+ },
+ miniMenu: function () {
- },
+ //鑿滃崟榛樿涓烘墦寮�鏂瑰紡
+ if(!vc.notNull(vc.getMenuState())){
+ vc.setMenuState('ON');
+ }
+
+ if (vc.notNull(vc.getMenuState()) && vc.getMenuState() == 'ON') {
+ return;
+ }
+
+ $("body").toggleClass("mini-navbar");
+ vc.setMenuState('OFF');
+ }
+
+ },
});
--
Gitblit v1.8.0