zhgdyun/src/components/account.vue

538 lines
17 KiB
Vue
Raw Normal View History

2022-06-08 14:51:11 +08:00
<template>
<div class="header-btn">
<el-popover
placement="bottom"
width="234"
trigger="click"
class="popover"
@show="sendMsg"
@hide="sendMsg2"
>
<div class="accountBox">
2024-05-22 19:48:09 +08:00
<div
class="flex2 accountInfo"
v-show="$store.state.userInfo.accountType != 1"
>
2022-06-08 14:51:11 +08:00
<!-- <i class="el-icon-user-solid"></i> -->
2024-05-22 19:48:09 +08:00
<el-image
v-if="$store.state.userInfo.avatar"
:src="$store.state.FILEURL + $store.state.userInfo.avatar"
style="width: 40px;height: 40px;border-radius: 50%;"
>
<div slot="error" class="image-slot">
<el-avatar
size="large"
icon="el-icon-user-solid"
></el-avatar>
</div>
</el-image>
2024-05-22 17:25:30 +08:00
<el-avatar size="large" icon="el-icon-user-solid" v-else></el-avatar>
2023-03-13 10:59:36 +08:00
<div style="margin-left: 10px">
2022-06-08 14:51:11 +08:00
<p>{{ $store.state.userInfo.companyName }}</p>
<!-- 横琴和鹤洲不需要客服电话-->
2023-03-13 10:59:36 +08:00
<p v-if="projectType == 'common' || projectType == 'zjsj'">
客服电话{{ $store.state.userInfo.customerServicePhone }}
</p>
<p
2023-03-13 10:59:36 +08:00
v-if="
projectType == 'hengqin' &&
2024-05-22 19:48:09 +08:00
$store.state.currentProDetail != null
2023-03-13 10:59:36 +08:00
"
>
入场码{{ $store.state.currentProDetail.placeCode }}
</p>
2022-06-08 14:51:11 +08:00
</div>
</div>
<!-- <div class="flex2" style="margin-top:20px">
2022-06-08 14:51:11 +08:00
客服电话{{$store.state.userInfo.customerServicePhone}}
</div> -->
2024-05-22 19:48:09 +08:00
<div
class="flex2 wrap"
v-if="![1, 11].includes($store.state.userInfo.accountType)"
>
2022-06-08 14:51:11 +08:00
<!-- <div class="width_100">
<img src="@/assets/images/sjzx.png" width="15px" height="15px" />
<span>数据中心</span>
</div>-->
2022-06-20 13:36:29 +08:00
<!-- 企业前台 -->
<div
2022-06-20 13:36:29 +08:00
class="width_100"
@click="goto5()"
2023-03-13 10:59:36 +08:00
v-if="
$route.path.indexOf('/firm/projectManage') == -1 &&
2024-05-22 19:48:09 +08:00
![5, 6, 10].includes($store.state.userInfo.accountType)
2023-03-13 10:59:36 +08:00
"
:title="enterpriseFront"
>
2024-04-11 19:15:19 +08:00
<!-- <img src="@/assets/images/xmht.png" width="15px" height="15px" /> -->
2024-05-22 19:48:09 +08:00
<img
src="@/assets/images/headerImg/companyIcon1.png"
width="15px"
height="15px"
/>
2023-03-13 10:59:36 +08:00
<span>{{ enterpriseFront }}</span>
</div>
2022-06-20 13:36:29 +08:00
<!-- // 企业后台 -->
2022-06-08 14:51:11 +08:00
<div
class="width_100"
@click="goto2"
v-if="
2023-03-13 10:59:36 +08:00
$route.path.indexOf('/companyAdmin/companyDiagram') == -1 &&
2024-05-22 19:48:09 +08:00
![5, 6, 10].includes($store.state.userInfo.accountType)
2022-06-08 14:51:11 +08:00
"
:title="enterpriseBackground"
2022-06-08 14:51:11 +08:00
>
2024-04-11 19:15:19 +08:00
<!-- <img src="@/assets/images/yyht.png" width="15px" height="15px" /> -->
2024-05-22 19:48:09 +08:00
<img
src="@/assets/images/headerImg/companyIcon2.png"
width="15px"
height="15px"
/>
2022-06-08 14:51:11 +08:00
<!-- <span>{{$t('message.companyDiagram.operatingCenter')}}</span> -->
<!-- <span>企业后台</span> -->
<span>{{ enterpriseBackground }}</span>
2022-06-08 14:51:11 +08:00
</div>
<!-- 项目后台 -->
<div
class="width_100"
@click="goProjectBackstage"
v-if="
2023-07-27 18:28:05 +08:00
$route.path.indexOf('/projectIndex') == -1 &&
2024-05-22 19:48:09 +08:00
$store.state.userInfo.enterProjectBackType === 0
"
:title="projectBackground"
>
2024-04-11 19:15:19 +08:00
<!-- <img src="@/assets/images/xmht.png" width="15px" height="15px" /> -->
2024-05-22 19:48:09 +08:00
<img
src="@/assets/images/headerImg/projectIcon1.png"
width="15px"
height="15px"
/>
<!-- $t("message.companyDiagram.projectBackEnd") -->
<span>{{ projectBackground }} </span>
</div>
<!-- 设备中台 -->
2022-06-08 14:51:11 +08:00
<div
class="width_100"
@click="goDevcenter"
2023-03-13 10:59:36 +08:00
v-if="
seeEquipment === 0 &&
2024-05-22 19:48:09 +08:00
$route.path.indexOf('/equipmentCenterIndx') == -1
"
:title="equipmentChina"
>
2024-04-11 19:15:19 +08:00
<!-- <img src="@/assets/images/xmht.png" width="15px" height="15px" /> -->
2024-05-22 19:48:09 +08:00
<img
src="@/assets/images/headerImg/equipIcon1.png"
width="15px"
height="15px"
/>
<!-- <span>{{ $t("message.companyDiagram.devCenter") }}</span> -->
2023-03-13 10:59:36 +08:00
<span>{{ equipmentChina }}</span>
</div>
<!-- <div
2022-06-08 14:51:11 +08:00
class="width_100"
@click="goto4"
v-if="
($store.state.userInfo.accountType == 5 ||
$store.state.userInfo.accountType == 6) &&
seeEquipment == 0&&$store.state.userInfo.styleType != 2
"
>
<img src="@/assets/images/sbzt.png" width="15px" height="15px" />
<span>{{ $t("message.companyDiagram.devCenter") }}</span>
</div>-->
<!-- // 资料中心 -->
<div
class="width_100"
@click="goto3"
2024-05-22 19:48:09 +08:00
v-if="dataCenter1 != 1"
:title="dataCenter"
>
2024-04-11 19:15:19 +08:00
<!-- <img src="@/assets/images/zlzx.png" width="15px" height="15px" /> -->
2024-05-22 19:48:09 +08:00
<img
src="@/assets/images/headerImg/documentIcon1.png"
width="15px"
height="15px"
/>
<!-- <span>{{ $t("message.docManage.fileCenter") }}</span> -->
<span>{{ dataCenter }}</span>
2022-06-08 14:51:11 +08:00
</div>
2024-02-29 19:28:07 +08:00
<!-- 项目前台 -->
<div
class="width_100"
@click="goto6()"
v-if="
$route.path.indexOf('/firm/projectManage') == -1 &&
2024-05-22 19:48:09 +08:00
$store.state.userInfo.systemLogoConfig.isShowProjectFront == 1 &&
[5, 6].includes($store.state.userInfo.accountType)
2024-02-29 19:28:07 +08:00
"
:title="projectFront"
>
<img src="@/assets/images/xmht.png" width="15px" height="15px" />
<span>{{ projectFront }}</span>
</div>
2022-06-08 14:51:11 +08:00
</div>
2024-03-21 19:30:54 +08:00
<div class="flex2 logout">
2024-04-02 19:59:07 +08:00
<span @click="loginOut">{{ $t("message.login.logout") }}</span>
<span @click="updatePw">修改密码</span>
2023-03-13 10:59:36 +08:00
</div>
2022-06-08 14:51:11 +08:00
</div>
<span slot="reference" class="flex3">
<div style="margin-right: 8px">
2023-03-13 10:59:36 +08:00
<p class="color_fff" style="margin-bottom: 0">
{{ $store.state.userInfo.account }}
</p>
2022-06-08 14:51:11 +08:00
<!-- <p class="color_fff">{{$store.state.ACCOUNTTYPE[$store.state.userInfo.accountType-1]}}</p> -->
2023-03-13 10:59:36 +08:00
<p class="color_fff" v-if="COMPANY == 'hengtong'">
2023-03-13 17:56:46 +08:00
<!-- {{ $store.state.userInfo.menuAuthority.roleName }} -->
公司管理员
2023-03-13 10:59:36 +08:00
</p>
<p class="color_fff" v-else>
{{ headerConfiguration }}
2022-06-08 14:51:11 +08:00
</p>
</div>
<i class="el-icon-arrow-down" style="color: #fff"></i>
</span>
</el-popover>
</div>
</template>
<script>
export default {
data() {
return {
2023-03-13 10:59:36 +08:00
COMPANY: COMPANY,
2024-04-02 19:59:07 +08:00
projectType: "",
loginData: "",
dataCenter1: "",
seeEquipment: "",
projectBackground: "项目后台",
enterpriseBackground: "企业后台",
headerConfiguration: "公司管理员", //标头配置
enterpriseFront: "企业前台", //企业前台
equipmentChina: "设备中台", //设备中台
dataCenter: "资料中心", //资料中心
projectFront: "项目前台", //项目前台
};
2022-06-08 14:51:11 +08:00
},
2023-07-27 18:28:05 +08:00
watch: {
userInfo(newValue) {
// console.log('新值',newValue);
2024-04-02 19:59:07 +08:00
this.seeEquipment = newValue.seeEquipment;
2023-07-27 18:28:05 +08:00
},
},
computed: {
userInfo() {
return this.$store.state.userInfo;
},
},
created() {
2024-04-02 19:59:07 +08:00
this.projectType = PROJECT_TYPE;
this.loginData = JSON.parse(localStorage.getItem("systemInfo"));
this.seeEquipment = this.$store.state.userInfo.seeEquipment;
console.log("seeEquipment------", this.seeEquipment);
console.log(" this.loginData===================", this.loginData);
if (this.loginData.headerConfiguration != "") {
this.headerConfiguration = this.loginData.headerConfiguration;
2022-07-21 14:21:23 +08:00
}
2024-04-02 19:59:07 +08:00
if (this.loginData.projectBackground != "") {
this.projectBackground = this.loginData.projectBackground;
2022-07-21 14:21:23 +08:00
}
2024-04-02 19:59:07 +08:00
if (this.loginData.enterpriseBackground != "") {
this.enterpriseBackground = this.loginData.enterpriseBackground;
2022-07-21 14:21:23 +08:00
}
2024-04-02 19:59:07 +08:00
if (this.loginData.equipmentChina != "") {
this.equipmentChina = this.loginData.equipmentChina;
2022-07-21 14:21:23 +08:00
}
2024-04-02 19:59:07 +08:00
if (this.loginData.dataCenter != "") {
this.dataCenter = this.loginData.dataCenter;
2023-07-12 15:26:10 +08:00
}
2024-04-02 19:59:07 +08:00
if (this.loginData.enterpriseFront != "") {
this.enterpriseFront = this.loginData.enterpriseFront;
2022-07-21 14:21:23 +08:00
}
2024-05-22 19:48:09 +08:00
if (this.loginData.projectFront != "") {
this.projectFront = this.loginData.projectFront;
2024-03-22 14:25:48 +08:00
}
2023-07-27 18:28:05 +08:00
},
mounted() {
2024-04-02 19:59:07 +08:00
console.log("this.$store.state.userInfo", this.$store.state.userInfo);
// console.log('项目后台',this.projectBackground)
// console.log('企业后台',this.enterpriseBackground)
2022-06-08 14:51:11 +08:00
},
methods: {
2024-04-02 19:59:07 +08:00
// 修改密码
updatePw() {
this.$router.push({
path: "/userCenter/userConfig",
});
},
2022-06-08 14:51:11 +08:00
sendMsg2() {
2024-04-02 19:59:07 +08:00
this.$EventBus.$emit("controlVideoShowOrHide", "show");
2022-06-08 14:51:11 +08:00
},
sendMsg() {
2024-04-02 19:59:07 +08:00
this.$EventBus.$emit("controlVideoShowOrHide", "hide");
2022-06-08 14:51:11 +08:00
},
goto2() {
2024-04-02 19:59:07 +08:00
let menuList = [];
var half = this.$store.state.userInfo.menuAuthority.moduleList;
2023-03-13 10:59:36 +08:00
half.forEach((element) => {
2022-06-08 14:51:11 +08:00
if (element.moduleType == 3) {
2024-04-02 19:59:07 +08:00
menuList.push(element);
2022-06-08 14:51:11 +08:00
}
2024-04-02 19:59:07 +08:00
});
2022-06-08 14:51:11 +08:00
if (menuList.length > 0) {
2024-04-02 19:59:07 +08:00
this.$store.commit("setIsShowBackIndex", false);
2022-06-08 14:51:11 +08:00
// let routeUrl = this.$router.resolve({
// path: menuList[0].modulePath,
// });
2024-04-02 19:59:07 +08:00
var url = window.location.href;
let routeUrl = "";
2022-06-08 14:51:11 +08:00
// 判断当前页面是不是设备中台
2024-04-02 19:59:07 +08:00
if (url.indexOf("equipmentCenter.html") != -1) {
window.open("/#" + menuList[0].modulePath, "_self");
2022-06-08 14:51:11 +08:00
// 南昌项目打开的是/index.html#/ 的页面
2024-04-02 19:59:07 +08:00
if (COMPANY == "nanchang") {
window.open("/index.html#" + menuList[0].modulePath, "_self");
} else {
2024-04-02 19:59:07 +08:00
window.open("/#" + menuList[0].modulePath, "_self");
2022-06-08 14:51:11 +08:00
}
} else {
routeUrl = this.$router.resolve({
2024-04-02 19:59:07 +08:00
path: menuList[0].modulePath,
});
2022-06-08 14:51:11 +08:00
}
2024-04-02 19:59:07 +08:00
window.open(routeUrl.href, "_self");
window._paq.push(["trackEvent", "点击", "企业后台", "进入企业后台"]);
2022-06-08 14:51:11 +08:00
} else {
2024-04-02 19:59:07 +08:00
this.$message.warning("您没有企业后台的权限!");
2022-06-08 14:51:11 +08:00
}
},
goto3() {
// this.$router.push('/fileCenter')
// let routeUrl = this.$router.resolve({
// path: "/fileCenter",
// });
2024-04-02 19:59:07 +08:00
var url = window.location.href;
let routeUrl = "";
2022-06-08 14:51:11 +08:00
// 判断当前页面是不是设备中台
2024-04-02 19:59:07 +08:00
if (url.indexOf("equipmentCenter.html") != -1) {
2022-06-08 14:51:11 +08:00
// 南昌项目打开的是/index.html#/ 的页面
2024-04-02 19:59:07 +08:00
if (COMPANY == "nanchang") {
window.open("/index.html#/fileCenter", "_self");
} else {
2024-04-02 19:59:07 +08:00
window.open("/#/fileCenter", "_self");
2022-06-08 14:51:11 +08:00
}
} else {
routeUrl = this.$router.resolve({
2024-04-02 19:59:07 +08:00
path: "/fileCenter",
});
2022-06-08 14:51:11 +08:00
}
2024-04-02 19:59:07 +08:00
window.open(routeUrl.href, "_self");
window._paq.push(["trackEvent", "点击", "资料中心", "进入资料中心"]);
2022-06-08 14:51:11 +08:00
},
goto4() {
2024-04-02 19:59:07 +08:00
window.open("/equipmentCenter.html#/equipmentCenterIndx", "_blank");
2022-06-08 14:51:11 +08:00
},
goto5() {
2024-04-02 19:59:07 +08:00
window.open("/index.html#/firm/projectManage", "_self");
},
2024-02-29 19:28:07 +08:00
goto6() {
2024-04-02 19:59:07 +08:00
window.open("/index.html#/firm/projectFront", "_self");
2024-02-29 19:28:07 +08:00
},
2022-06-08 14:51:11 +08:00
loginOut() {
2024-04-02 19:59:07 +08:00
this.$store.currentProDetail = {};
// this.$store.commit('setUserInfo', null)
2024-04-02 19:59:07 +08:00
this.$store.commit("setMapBackArr", []);
this.$store.commit("setMoudle", null);
this.$store.commit("setProDetail", null);
2024-04-23 20:03:49 +08:00
this.$store.commit("setProjectSn", "");
2024-04-20 19:07:58 +08:00
this.$store.commit("setGroupTreeList", []);
2024-04-11 19:15:19 +08:00
this.$store.commit("setSelectedGroupSn", null);
2024-04-02 19:59:07 +08:00
window.localStorage.removeItem("isIframe");
window.localStorage.removeItem("soundList");
2022-06-08 14:51:11 +08:00
let json = {
2024-04-02 19:59:07 +08:00
name: "工作站",
id: 1,
2024-04-02 19:59:07 +08:00
url: "/projectV2/taskList",
menuList: [
{
id: 100000,
2024-04-02 19:59:07 +08:00
menuName: "任务清单",
path: "/projectV2/taskList",
},
{
id: 100001,
2024-04-02 19:59:07 +08:00
menuName: "通知公告",
path: "/projectV2/noticeList",
},
{
id: 100002,
2024-04-02 19:59:07 +08:00
menuName: "工作日程",
path: "/projectV2/workerSchedule",
},
],
};
this.$store.commit("setCurModule", json);
2022-07-22 20:00:46 +08:00
// sessionStorage.clear();
2022-06-08 14:51:11 +08:00
// this.$router.push('/login')
2024-04-02 19:59:07 +08:00
if (COMPANY == "nanchang") {
window.open("/index.html#/login", "_self");
} else {
//企业退出拼接sn
2024-04-02 19:59:07 +08:00
const baseUrl = "/#"; // 设置新的登录地址的基础URL
const query =
"?&headquartersSn=" + this.$store.state.userInfo.headquartersSn; // 设置要拼接的参数
const loginUrl = `${baseUrl}/login${query}`; // 拼接登录地址
2024-04-02 19:59:07 +08:00
console.log(this.$route.path.indexOf("/projectIndex") == 0, "退出登录");
window.open(loginUrl, "_self");
2024-01-24 18:40:54 +08:00
// this.$router.go();
// if( this.$route.path.indexOf('/projectIndex') == 0 ) {
// this.$router.go();
// }
2022-06-08 14:51:11 +08:00
}
// this.$router.push('/')
2024-04-02 19:59:07 +08:00
window._paq.push(["trackEvent", "点击", "退出登录", "退出登录"]);
2022-06-08 14:51:11 +08:00
},
//去项目后台
goProjectBackstage() {
2024-04-02 19:59:07 +08:00
var url = window.location.href;
let routeUrl = "";
let type = this.$store.state.userInfo.accountType;
2022-06-08 14:51:11 +08:00
// 判断当前页面是不是设备中台
2024-04-02 19:59:07 +08:00
if (url.indexOf("equipmentCenter.html") != -1) {
2022-06-08 14:51:11 +08:00
// 南昌项目打开的是/index.html#/ 的页面
2024-04-02 19:59:07 +08:00
if (COMPANY == "nanchang") {
window.open("/index.html#/projectList", "_self");
} else {
2024-04-02 19:59:07 +08:00
window.open("/#/projectList", "_self");
2022-06-08 14:51:11 +08:00
}
}
2024-04-11 19:15:19 +08:00
if (type == 5 || type == 6 || type == 10) {
2024-04-02 19:59:07 +08:00
window.open("/index.html#/projectIndex", "_self");
} else {
2022-06-08 14:51:11 +08:00
routeUrl = this.$router.resolve({
2024-04-02 19:59:07 +08:00
path: "/projectList",
});
2022-06-08 14:51:11 +08:00
}
2024-04-02 19:59:07 +08:00
window.open(routeUrl.href, "_self");
window._paq.push(["trackEvent", "点击", "项目后台", "进入项目后台"]);
2022-06-08 14:51:11 +08:00
},
//去设备中台
goDevcenter(value) {
2024-04-02 19:59:07 +08:00
let routeUrl = "";
let type = this.$store.state.userInfo.accountType;
// this.$store.commit("setProjectSn", value.projectSn);
2024-04-13 22:51:12 +08:00
if (type == 5 || type == 6 || type == 10) {
2024-04-02 19:59:07 +08:00
window.open("/equipmentCenter.html#/equipmentCenterIndx", "_self");
window._paq.push(["trackEvent", "点击", "设备中台", "进入设备中台"]);
} else {
routeUrl = this.$router.resolve({
2024-04-02 19:59:07 +08:00
path: "/projectList",
});
// routeUrl = this.$router.resolve({
// path: '/equipmentCenterIndx'
// })
2024-04-02 19:59:07 +08:00
window.open(routeUrl.href, "_self");
}
2024-04-02 19:59:07 +08:00
},
2022-06-20 13:36:29 +08:00
// 去设备中台
// goDevcenter(){
// window.open('/equipmentCenter.html#/equipmentCenterIndx', "_self");
// var url = window.location.href;
// let routeUrl = '';
// // 判断当前页面是不是设备中台
// if (url.indexOf("equipmentCenter.html") != -1) {
// // 南昌项目打开的是/index.html#/ 的页面
// if(COMPANY == 'nanchang') {
// window.open("/index.html#/equipmentCenterIndx", "_self");
// }else{
// window.open("/#/equipmentCenterIndx", "_self");
// }
// } else {
// routeUrl = this.$router.resolve({
// path: "/equipmentCenterIndx",
// });
// }
// window.open(routeUrl.href, "_self");
// window._paq.push(['trackEvent', '点击', '设备中台','进入设备中台' ])
// }
2024-04-02 19:59:07 +08:00
},
};
2022-06-08 14:51:11 +08:00
</script>
<style lang="less" scoped>
.accountBox {
padding: 10px 10px 0;
}
2024-05-22 19:48:09 +08:00
.accountInfo {
2024-04-11 19:15:19 +08:00
margin-bottom: 17px;
}
2022-06-08 14:51:11 +08:00
.logout {
2024-03-21 19:30:54 +08:00
justify-content: space-around;
2022-06-08 14:51:11 +08:00
cursor: pointer;
2024-04-02 19:59:07 +08:00
color: #4a8ef7;
2024-04-11 19:15:19 +08:00
border-top: 1px solid rgba(47, 57, 92, 0.1);
padding-top: 10px;
2024-03-21 19:30:54 +08:00
// &:hover {
// color: @--color-primary;
// }
2022-06-08 14:51:11 +08:00
}
.flex2 {
display: flex;
align-items: center;
.width_100:nth-child(2n) {
justify-content: flex-end;
}
}
.flex3 {
display: flex;
align-items: center;
justify-content: space-between;
}
// .el-icon-user-solid {
// font-size: 40px;
// margin-right: 15px;
// margin-top: -1px;
// }
.wrap {
flex-wrap: wrap;
border-top: 1px solid rgba(47, 57, 92, 0.1);
padding-top: 10px;
}
.width_100 {
width: 105px;
display: inline-flex;
align-items: center;
margin-bottom: 14px;
cursor: pointer;
span {
width: 80px;
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
2022-06-08 14:51:11 +08:00
img,
i {
margin-right: 7px;
}
&:hover {
color: @--color-primary;
}
}
.color_fff {
font-family: PingFangSC-Medium;
font-size: 11px;
color: #ffffff;
letter-spacing: 0;
}
</style>
<style>
.el-popover {
2022-06-08 14:51:11 +08:00
box-sizing: content-box !important;
}
2024-04-02 19:59:07 +08:00
</style>