This commit is contained in:
Iruka 2024-11-29 15:09:39 +08:00
commit 96a78290ff
2 changed files with 54 additions and 8 deletions

View File

@ -91,9 +91,12 @@
} from "@/utils/permission"
import store from "@/store"
import plugin from "@/plugins"
import constant from "@/utils/constant.js"
export default {
data() {
return {
isFirst:true,
user: store.state.user.user,
windowHeight: null,
defaultCheckedKeys: "",
paging: null,
@ -122,16 +125,26 @@
methods: {
/** 查询公司下拉树结构 */
getCompanyTree() {
const obj = {
status: 0,
delFlag: "0",
companyTypes: [1, 2, 3],
}
store
.dispatch("companyTreeSelect", null)
.dispatch("companyTreeSelect", obj)
.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{
let companyList = this.treeList[0].children.filter(x => x.id != 100);
if (companyList && companyList.length) {
this.defaultCheckedKeys = companyList[0].id + "";
}
}
}
})
.catch(error => {
plugin.modal.msgError(error)
@ -192,6 +205,10 @@
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) {
this.getCompanyGroupIds();
@ -227,6 +244,13 @@
this.query.companyGroupIds += this.companyGroupId;
}
this.getListData();
},
//
setStorage(type, data) {
uni.setStorageSync(type, {
userId: this.user.userId,
data: data,
});
}
}
}

View File

@ -119,6 +119,8 @@
export default {
data() {
return {
isFirst:true,
user: store.state.user.user,
defaultCheckedKeys: "",
list: [],
windowHeight: null,
@ -170,16 +172,26 @@
methods: {
/** 查询公司下拉树结构 */
getCompanyTree() {
const obj = {
status: 0,
delFlag: "0",
companyTypes: [1, 2, 3],
}
store
.dispatch("companyTreeSelect", null)
.dispatch("companyTreeSelect", obj)
.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{
let companyList = this.treeList[0].children.filter(x => x.id != 100);
if (companyList && companyList.length) {
this.defaultCheckedKeys = companyList[0].id + "";
}
}
}
})
.catch(error => {
plugin.modal.msgError(error)
@ -241,6 +253,9 @@
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();
@ -339,6 +354,13 @@
this.query.companyGroupIds += this.companyGroupId;
}
this.queryList();
},
//
setStorage(type, data) {
uni.setStorageSync(type, {
userId: this.user.userId,
data: data,
});
}
}
}