修改默认公司获取方式

This commit is contained in:
Iruka 2025-01-06 12:09:04 +08:00
parent 44e6fe9392
commit baa10fd1ef
2 changed files with 32 additions and 33 deletions

View File

@ -114,8 +114,12 @@
created() {
this.windowHeight = uni.getSystemInfoSync().windowHeight;
},
onLoad(){
this.getCompanyTree();
onLoad() {
let companyId = null;
if (getApp().ijs.land) {
companyId = getApp().ijs.land.companyGroup.companyId
}
this.getCompanyTree(companyId);
},
onShow() {
if (this.paging != null) {
@ -125,7 +129,7 @@
},
methods: {
/** 查询公司下拉树结构 */
getCompanyTree() {
getCompanyTree(companyId) {
const obj = {
status: 0,
delFlag: "0",
@ -136,9 +140,8 @@
.then(res => {
this.treeList = res.data;
if (this.treeList && this.treeList.length) {
let cache_companyId = uni.getStorageSync("app_companyId")
if (cache_companyId) {
this.defaultCheckedKeys = cache_companyId + "";
if (companyId) {
this.defaultCheckedKeys = companyId + "";
} else {
let companyList = this.treeList[0].children.filter(x => x.id != 100);
if (companyList && companyList.length) {
@ -206,9 +209,6 @@
handleTreeChange(values, currentItem) {
this.query.companyGroupIds = "";
this.companyGroupId = values;
if (!this.isFirst) {
uni.setStorageSync("app_companyId", this.companyGroupId)
}
this.isFirst = false;
this.selectCompanyObj = currentItem;
if (this.all) {

View File

@ -1,13 +1,13 @@
<template>
<view class="index-container" :style="{ height: `${windowHeight}px` }" @touchmove.stop.prevent="() => {}">
<z-paging class="paging" ref="paging" use-virtual-list @query="queryList" bg-color="#F3F3F3"
:loading-more-enabled="false">
<template #top>
<custom-nav-bar :left="true" title="用户管理">
<custom-nav-bar :left="true" title="用户管理">
<template v-slot:right>
<view class="fixed">
<view align="right" class="iconfont icon-jia icon" v-hasPermi="['system:user:add']" @click="onAdd"></view>
<view align="right" class="iconfont icon-jia icon" v-hasPermi="['system:user:add']"
@click="onAdd"></view>
</view>
</template>
</custom-nav-bar>
@ -37,8 +37,10 @@
<view class="user" @click="clickMore(item)">
<!--头像-->
<view>
<u--image :showLoading="true" shape="square" radius="5px"
:src="item.avatar ? item.avatar : ''" width="70px" height="70px"></u--image>
<u--image :showLoading="true" shape="square" radius="5px" width="70px" height="70px"
:src="item.avatar" v-if="item.avatar" />
<u--image :showLoading="true" shape="square" radius="5px" width="70px" height="70px"
src="../../../static/images/login/userAvatar.png" v-else />
</view>
<!--信息-->
<view class="user-info">
@ -56,7 +58,8 @@
</view>
<view class="info">
<view style="font-size: 15px; color: #939393; font-weight: bold">公司</view>
<u--text :text="item.companyGroup.companyFullName" v-if="item.companyGroup && item.companyGroup.companyFullName"></u--text>
<u--text :text="item.companyGroup.companyFullName"
v-if="item.companyGroup && item.companyGroup.companyFullName"></u--text>
</view>
</view>
<!--启用禁用标签-->
@ -120,7 +123,7 @@
export default {
data() {
return {
isFirst:true,
isFirst: true,
user: store.state.user.user,
defaultCheckedKeys: "",
list: [],
@ -145,8 +148,12 @@
created() {
this.windowHeight = uni.getSystemInfoSync().windowHeight;
},
onLoad(){
this.getCompanyTree();
onLoad() {
let companyId = null;
if (getApp().ijs.land) {
companyId = getApp().ijs.land.companyGroup.companyId
}
this.getCompanyTree(companyId);
},
onShow() {
if (this.paging != null) {
@ -174,7 +181,7 @@
},
methods: {
/** 查询公司下拉树结构 */
getCompanyTree() {
getCompanyTree(companyId) {
const obj = {
status: 0,
delFlag: "0",
@ -185,10 +192,9 @@
.then(res => {
this.treeList = res.data;
if (this.treeList && this.treeList.length) {
let cache_companyId = uni.getStorageSync("app_companyId")
if(cache_companyId){
this.defaultCheckedKeys = cache_companyId + "";
}else{
if (companyId) {
this.defaultCheckedKeys = companyId + "";
} else {
let companyList = this.treeList[0].children.filter(x => x.id != 100);
if (companyList && companyList.length) {
this.defaultCheckedKeys = companyList[0].id + "";
@ -229,7 +235,7 @@
plugin.modal.closeLoading()
})
},
onAdd(){
onAdd() {
if (!this.selectCompanyObj) {
plugin.modal.msgError("请选择要添加地块的公司")
return;
@ -256,9 +262,6 @@
handleTreeChange(values, currentItem) {
this.query.companyGroupIds = "";
this.companyGroupId = values;
if(!this.isFirst){
uni.setStorageSync("app_companyId", this.companyGroupId)
}
this.selectCompanyObj = currentItem;
if (this.all) {
this.getCompanyGroupIds();
@ -292,12 +295,8 @@
//#ifdef MP-WEIXIN
uni.makePhoneCall({
phoneNumber: phone,
fail: res => {
console.log(res)
},
success: res => {
console.log("success" + res)
}
fail: res => {},
success: res => {}
})
//#endif
})