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

View File

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