From e1a107321f7ca6bab29fa8cc15c2bc20894bad26 Mon Sep 17 00:00:00 2001 From: Vce Date: Sun, 14 Apr 2024 22:53:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20BUG=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/login/login.vue | 2 +- .../projectEnd/projectIndex/projectIndex.vue | 159 ++++++++++++------ 2 files changed, 112 insertions(+), 49 deletions(-) diff --git a/pages/login/login.vue b/pages/login/login.vue index f54832b7..cb88280c 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -140,7 +140,7 @@ uni.setStorageSync('account', e.detail.value.account); uni.setStorageSync('password', e.detail.value.password); uni.setStorageSync('userInfo', JSON.stringify(res.result)); - if (res.result.accountType == 5 || res.result.accountType == 6) { + if (res.result.accountType == 5 || res.result.accountType == 6 || res.result.accountType == 10) { if (res.result.styleType == 1) { uni.redirectTo({ url: '/pages/projectEnd/projectIndex/projectIndex' diff --git a/pages/projectEnd/projectIndex/projectIndex.vue b/pages/projectEnd/projectIndex/projectIndex.vue index a1afcfd2..527ca21f 100644 --- a/pages/projectEnd/projectIndex/projectIndex.vue +++ b/pages/projectEnd/projectIndex/projectIndex.vue @@ -1,7 +1,9 @@ @@ -208,6 +210,7 @@ }, onLoad() { var userInfo = JSON.parse(uni.getStorageSync('userInfo')) + let that = this; console.log('userInfo===========', userInfo) this.userInfo = userInfo this.accountType = userInfo.accountType @@ -217,18 +220,48 @@ console.log('上面的', arr) this.systemInfo = uni.getStorageSync('systemInfo') this.getSystemLogoConfig() - this.getAllModule(arr) if (this.accountType == 5 || this.accountType == 6) { this.searchsn = userInfo.sn this.getProjectDetail() + this.getAllModule(arr) + } else if(this.accountType == 10){ + this.sendRequest({ + url: 'xmgl/company/getTenantOrgTreeList', + data: { + userId: userInfo.userId, + }, + method: 'POST', + success(res) { + console.log(res,'777888') + if(res && res.result && res.result.length > 0){ + let responseData = res.result; + that.selectedDefaultProject(responseData[0]) + } + } + }) } else { this.projectDetail = JSON.parse(uni.getStorageSync('projectDetail')) this.loadWeather() + this.getAllModule(arr) } this.viewVersionInfo() }, onReady() {}, methods: { + // 默认选中第一个组织的第一个项目 + selectedDefaultProject(obj) { + if (obj.list && obj.list.length > 0) { + obj.list.map((item) => { + this.selectedDefaultProject(item); + }); + } else { + this.searchsn = obj.sn + console.log(obj.sn,888999) + this.getProjectDetail() + this.getAllModule([]) + uni.setStorageSync('userInfo',JSON.stringify({...this.userInfo,sn: obj.sn})) + } + }, viewVersionInfo() { console.log('进入页面调用'); //fix 避开检查更新 罗劲章 @@ -262,7 +295,7 @@ console.log('获取当前app应用版本号', that.versionNo); console.log('获取平台版本号', res2.result.versionNo); let jxjAppVersionNo = res2.result.versionNo - + if (res2.result && jxjAppVersionNo !== that.versionNo) { uni.showModal({ title: '版本更新', @@ -626,52 +659,82 @@ getAllModule(half) { console.log('half====', half) var that = this - this.sendRequest({ - url: 'xmgl/baseModule/list', - data: { - styleType: this.styType - }, - method: 'POST', - success(res) { - var all = res.result - all.forEach((element, index) => { - all[index].operation = false - half.forEach((element2) => { - if (element2.moduleId == element.moduleId) { - all[index].operation = true - all[index].menuList = element2.menuList - } - let newAll = all[index].menuList + if (this.accountType == 10) { + this.sendRequest({ + url: 'xmgl/baseModule/getModuleAndMenuList', + data: { + projectSn: this.searchsn, + userId: this.userInfo.userId, + moduleType: 2, + }, + method: 'POST', + success(res) { + if (res.success) { + var all = res.result.moduleList; + console.log("all", all); + all.forEach((element, index) => { + all[index].operation = false; + res.result.menuList.forEach((element2) => { + console.log(element2, 77888) + if (element2.moduleId == element.moduleId) { + all[index].operation = true; + } + }); + }); + console.log("all111", all); + that.list = all; + } + } + }) + } else { + this.sendRequest({ + url: 'xmgl/baseModule/list', + data: { + moduleType: 2, + styleType: this.styType + }, + method: 'POST', + success(res) { + var all = res.result + all.forEach((element, index) => { + all[index].operation = false + half.forEach((element2) => { + if (element2.moduleId == element.moduleId) { + all[index].operation = true + all[index].menuList = element2.menuList + } + let newAll = all[index].menuList + }) }) - }) - that.list = all - // this.list=newAppShow + that.list = all + // this.list=newAppShow - //添加报警提示模块 - console.log('用户列表', that.list) - // that.list.push({ - // operation:true, - // appName: "报警提示", - // appShow: 1, - // bigModuleIcon: "log_active2", - // disableModuleIcon: null, - // labelName: "报警提示", - // labelSortNum: "7", - // menuList: null, - // moduleDesc: "", - // moduleEquipment: 0, - // moduleIcon: "log_active", - // moduleIcon2: "log", - // moduleId: "41", - // moduleName: "报警提示", - // modulePath: "", - // moduleType: 2, - // plugin: "constructionLog", - // styleType: 1 - // }); - } - }) + //添加报警提示模块 + console.log('用户列表', that.list) + // that.list.push({ + // operation:true, + // appName: "报警提示", + // appShow: 1, + // bigModuleIcon: "log_active2", + // disableModuleIcon: null, + // labelName: "报警提示", + // labelSortNum: "7", + // menuList: null, + // moduleDesc: "", + // moduleEquipment: 0, + // moduleIcon: "log_active", + // moduleIcon2: "log", + // moduleId: "41", + // moduleName: "报警提示", + // modulePath: "", + // moduleType: 2, + // plugin: "constructionLog", + // styleType: 1 + // }); + } + }) + } } } }