zhangtao
laozt 1 year ago
parent e5a5d6e87d
commit 9d1823eda5

@ -8,6 +8,7 @@
<script>
import ThemePicker from "@/components/ThemePicker";
import { xzTree } from "@/api/yingji/keyEnterprise.js";
export default {
name: "App",
@ -27,6 +28,12 @@ export default {
},
};
},
created () {
//
xzTree().then((res) => {
localStorage.setItem("TREE_DATA",JSON.stringify(res.data))
});
},
};
</script>
<style scoped>

@ -24,30 +24,28 @@ router.beforeEach((to, from, next) => {
if (store.getters.roles.length === 0) {
isRelogin.show = true;
// 判断当前用户是否已拉取完user_info信息
store
.dispatch("GetInfo")
.then((res) => {
isRelogin.show = false;
store.dispatch("GenerateRoutes").then((accessRoutes) => {
// 根据roles权限生成可访问的路由表
// console.log(res);
router.addRoutes(accessRoutes); // 动态添加可访问路由表
//刷新之后,要去的路由肯定是自己已经保存过的新路由
let refresh = "";
if (store.state.user.new1.indexOf(to.path) != -1) {
refresh = to.path;
}
// console.log(to.path);
//进入添加的第一个路由
next({ path: refresh || res[0].path });
});
})
.catch((err) => {
store.dispatch("LogOut").then(() => {
Message.error(err);
next({ path: "/" });
});
store.dispatch("GetInfo").then((res) => {
isRelogin.show = false;
store.dispatch("GenerateRoutes").then((accessRoutes) => {
// 根据roles权限生成可访问的路由表
// console.log(res);
router.addRoutes(accessRoutes); // 动态添加可访问路由表
//刷新之后,要去的路由肯定是自己已经保存过的新路由
let refresh = "";
if (store.state.user.new1.indexOf(to.path) != -1) {
refresh = to.path;
}
// console.log(to.path);
//进入添加的第一个路由
next({ path: refresh || res[0].path });
});
});
// .catch((err) => {
// store.dispatch("LogOut").then(() => {
// Message.error(err);
// next({ path: "/" });
// });
// });
} else {
if (
store.state.user.old1.indexOf(to.path) != -1 &&

@ -108,10 +108,13 @@ service.interceptors.response.use(
password: "admin@123Jichuang",
})
.then((res) => {
next("/home");
location.href = "/home";
});
} else {
location.href = "/login?redirect=%2Findex";
//token过期重新登录跳转路由不需要提示
store.dispatch("LogOut").then(() => {
location.href = "/login?redirect=%2Findex";
});
}
// if (!isRelogin.show) {

@ -577,9 +577,10 @@ export default {
//
async open(item, dept) {
this.dialogVisible = true;
// this.dept = dept
let data = await this.$api.yingji.tree();
this.district = data.data;
// let data = await this.$api.yingji.tree();
// this.district = data.data;
let treeData = JSON.parse(localStorage.getItem("TREE_DATA"))
this.district = treeData
this.commentData(this.district, dept);
this.bPlanEnterprise();
this.filtrate();

@ -198,8 +198,9 @@ export default {
},
//
xzList() {
xzTree().then((res) => {
res.data.forEach((value, index) => {
// xzTree().then((res) => {
let treeData = JSON.parse(localStorage.getItem("TREE_DATA"))
treeData.forEach((value, index) => {
this.areaData.push({
value: value.subdistrict,
label: value.institutionName,
@ -214,7 +215,7 @@ export default {
});
}
});
});
// });
},
//
componendDistrict(district) {

@ -260,8 +260,10 @@ export default {
}
},
async getDistrict(){
let data = await this.$api.yingji.tree();
this.district = data.data;
// let data = await this.$api.yingji.tree();
// this.district = data.data;
let treeData = JSON.parse(localStorage.getItem("TREE_DATA"))
this.district = treeData
},
//
componendDistrict(district){

@ -123,7 +123,7 @@ export default {
watch: {
$route: {
handler: function (route) {
console.log(route);
// console.log(route);
this.redirect = route.query && route.query.redirect;
},
immediate: true,

@ -54,9 +54,10 @@ export default {
},
methods: {
xzList() {
xzTree().then((res) => {
// xzTree().then((res) => {
if (this.dept.parentId == 0 || this.dept.leader == "admin") {
res.data.forEach((value, index) => {
let treeData = JSON.parse(localStorage.getItem("TREE_DATA"))
treeData.forEach((value, index) => {
this.compartment.push({
value: value.subdistrict,
label: value.institutionName,
@ -73,7 +74,7 @@ export default {
});
}
this.$emit("quhuadizhi", this.compartment);
});
// });
},
getData(e) {
if (!this.none) {

@ -475,9 +475,12 @@ export default {
},
},
async created() {
let data = await this.$api.yingji.tree();
this.myDistrict = data.data;
this.commentData(data.data, this.dept);
// let data = await this.$api.yingji.tree();
// this.myDistrict = data.data;
let treeData = JSON.parse(localStorage.getItem("TREE_DATA"))
this.myDistrict = treeData
this.commentData(treeData, this.dept);
if (this.dept.ancestors.split(",").length == 1) {
this.getList(this.pages);
}

Loading…
Cancel
Save