123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587 |
- <template>
- <div class="top-nav">
- <!-- <div class="nav-logo">
- <img :src="require(`../../../assets/logo/logo.png`)" alt="">
- </div>
- <el-menu class="navbar" mode="horizontal">
- <div>
- <span> {{this.$store.getters.xt_user.org.org_name}}
- </span>
- </div>
- <div class="system-nav">
- <div class="system-nav-menu active">
- <a>
- <span><i class="icon iconfont icon-jiankangshuidi"></i> 血透管理</span>
- </a>
- </div>
- <div class="system-nav-menu" v-if="this.$store.getters.xt_user.cdm_role_exist">
- <a :href="CDMWebsit()">
- <span><i class="icon iconfont icon-manbing-xuanzhong"></i> 慢病管理</span>
- </a>
- </div>
- <div class="system-nav-menu" v-if="this.$store.getters.xt_user.scrm_role_exist">
- <a :href="SCRMWebsit()">
- <span><i class="iconfont icon-pengyou"></i> SCRM</span>
- </a>
- </div>
- <div class="system-nav-menu" v-if="this.$store.getters.xt_user.mall_role_exist">
- <a :href="MircoMallWebsit()">
- <span><i class="icon iconfont icon-service_fill"></i> 微商城</span>
- </a>
- </div>
-
- <div class="system-nav-menu">
- <a :href="APPManageWebsit()">
- <span><i class="icon iconfont icon-suoyou"></i> 应用</span>
- </a>
- </div>
- </div>
-
- <div class="right-menu">
- <el-dropdown class="avatar-container right-menu-item" trigger="click" @command="handleCommand">
- <div class="avatar-wrapper">
- <img class="user-avatar" :src="avater">
- <span class="user-title">{{ this.$store.getters.xt_user.user.user_name }}</span>
- <i class="el-icon-caret-bottom"></i>
- </div>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item command="modifyUserInfoAction">
- 个人信息
- </el-dropdown-item>
- <el-dropdown-item command="modifyOrgInfoAction">
- 机构信息
- </el-dropdown-item>
- <el-dropdown-item divided command="logout">
- {{$t('navbar.logOut')}}
-
- </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
-
- <modify-user-info-dialog ref="modify_user_info_dialog"></modify-user-info-dialog>
- <modify-org-info-dialog ref="modify_org_info_dialog"></modify-org-info-dialog>
-
- </div>
- </el-menu>-->
- <div style="display:flex;align-items: center;">
- <div class="nav-logo">
- <img :src="require(`../../../assets/logo/logo2.png`)" alt="">
- </div>
- <div class="dropdownBox">
- <el-dropdown trigger="click" @command="handleOrgCommand">
- <span class="el-dropdown-link">
- {{ org_name }}
- <i class="el-icon-arrow-down el-icon--right"></i>
- </span>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item
- v-for="(item, index) in orgs"
- :key="index"
- :command="item.id"
- >{{ item.org_name }}</el-dropdown-item
- >
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- </div>
- <div class="navRight">
- <!-- <el-input placeholder="搜索患者透析号/姓名/首拼" prefix-icon="el-icon-search" v-model="input2"></el-input>
- <div style="color: #b2b2b3;">通知中心</div> -->
- <div class="right-menu">
- <el-dropdown
- class="avatar-container right-menu-item"
- trigger="click"
- @command="handleCommand"
- >
- <div class="avatar-wrapper">
- <img class="user-avatar" :src="avater" />
- <span class="user-title">{{
- this.$store.getters.xt_user.user.user_name
- }}</span>
- <i class="el-icon-caret-bottom"></i>
- </div>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item command="modifyUserInfoAction"
- >个人信息</el-dropdown-item
- >
- <el-dropdown-item
- command="modifyOrgInfoAction"
- v-if="is_super_admin === 1"
- >机构信息</el-dropdown-item
- >
- <el-dropdown-item divided command="logout">{{
- $t("navbar.logOut")
- }}</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
-
- <modify-user-info-dialog
- ref="modify_user_info_dialog"
- ></modify-user-info-dialog>
- <modify-org-info-dialog
- ref="modify_org_info_dialog"
- ></modify-org-info-dialog>
- </div>
- <div>
- <i class="el-icon-question"></i>
- <a href="https://sso.kuyicloud.com/help" target="_blank">帮助中心</a>
- </div>
- </div>
- </div>
- </template>
-
- <script>
- import axios from 'axios'
- import { mapGetters } from "vuex";
- // import Breadcrumb from "@/components/Breadcrumb";
- // import Hamburger from "@/components/Hamburger";
- import Screenfull from "@/components/Screenfull";
- import ModifyUserInfoDialog from "@/xt_pages/home/modify_user_info_dialog";
- import ModifyOrgInfoDialog from "@/xt_pages/home/modifyOrgInfoDialog";
- import { getFiledConfigList, setFiledConfigList } from "@/utils/data_config"; // getConfigList from sessionStorage
- import {
- getAdminUserInfoCache,
- cacheAdminUserInfo,
- removeAdminUserInfoCache
- } from "@/utils/admin_info_cache";
- import { getOrgs, changeOrg } from "@/api/config";
- export default {
- inject: ["reload"],
- data() {
- return {
- orgs: [],
- org_id: this.$store.getters.xt_user.org.id,
- org_name: this.$store.getters.xt_user.org.org_name,
- is_super_admin: 0
- // scrm_role_exist: $store.getters.xt_user.scrm_role_exist
- };
- },
- components: {
- Screenfull,
- ModifyUserInfoDialog,
- ModifyOrgInfoDialog
- },
- computed: {
- ...mapGetters(["sidebar"]),
- avater: function() {
- var avatar = this.$store.getters.xt_user.user.avatar;
- return avatar.length > 0
- ? avatar
- : require("../../../assets/home/userData.png");
- },
- websocket() {
- return this.$store.state.user.websocket;
- }
- },
- methods: {
- handleOrgCommand(org_id) {
- let params = {
- org_id: org_id
- };
- changeOrg(params)
- .then(response => {
- if (response.data.state === 1) {
- // window.location.reload()
-
- this.$message.success("切换成功");
- let data = response.data.data;
- this.org_id = data.org.id;
- this.org_name = data.org.org_name;
-
- // this.$store.dispatch("ModifyAdminUserOrgInfo", {
- // user: data.user,
- // cur_org_id: data.current_org_id,
- // cur_app_id: data.current_app_id,
- // org: data.org,
- // subscibe: data.subscibe,
- // template_info: data.template_info,
- // scrm_role_exist: data.scrm_role_exist,
- // cdm_role_exist: data.cdm_role_exist,
- // mall_role_exist: data.mall_role_exist
- // });
- //
- // this.$store.dispatch("ModifyUrlInfo", {
- // urlfors: data.urlfors
- // });
- //
- // this.$store.dispatch("ModifyFiled", {
- // fileds: data.fileds
- // });
-
- // setFiledConfigList(JSON.stringify(data.fileds));
- // cacheAdminUserInfo(JSON.stringify(data));
-
- window.location.reload();
-
- // this.$store
- // .dispatch(
- // "xt_GenerateRoutes",
- // this.$store.getters.current_role_urls
- // )
- // .then(() => {
- // this.$store.dispatch("VerifyConfigList").then(() => {
- // // alert('token 验证成功')
- // // console.log(this.$store.getters.xt_permission.addRouters)
- // this.$router.addRoutes(
- // this.$store.getters.xt_permission.addRouters
- // ); // 动态添加可访问路由表
- // // next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
- // // this.$router.replace({ path: '/' })
- // // this.$router.go(0)
- // // this.reload()
- // });
- // });
- } else {
- this.$message.success(response.data.msg);
- }
- })
- .catch(e => {
- // this.$message.success("网络异常")
- });
- },
-
- handleCommand(command) {
- switch (command) {
- case "modifyUserInfoAction":
- this.modifyUserInfoAction();
- break;
- case "modifyOrgInfoAction":
- this.modifyOrgInfoAction();
- break;
- case "logout":
- this.logout();
- break;
- }
- },
- logout() {
- this.$store.dispatch("FrontendLogout");
- window.location.href = process.env.BASE_API + "/logout";
- },
- modifyOrgInfoAction() {
- // this.$refs.modify_org_info_dialog.show()
- this.$router.push("/orginfo");
- return false;
- },
- modifyUserInfoAction() {
- this.$refs.modify_user_info_dialog.show();
- },
- myServe() {
- this.$router.push("/service");
- return false;
- },
- SCRMWebsit() {
- return process.env.SRCM_HOST;
- },
- MircoMallWebsit() {
- return process.env.MIRCO_MALL_HOST;
- },
- CDMWebsit() {
- return process.env.CDM_HOST;
- },
- APPManageWebsit() {
- return (
- process.env.SSO_HOST +
- "/org/admin/apps?org=" +
- this.$store.getters.xt_user.org_id
- );
- },
- getToken(orgId,adminUserId){
- axios.get('/api/index/gettoken/'+ orgId + '/'+ adminUserId
- ).then((res) => {
- console.log('res',res.data)
-
- if(res.data.code == 0){
- let token = res.data.data.token
- localStorage.setItem("token",token)
- let http = 'wss://socket.sgjyun.com?token='
- // let http = 'ws://socket.szjkhd.com?token='//测试
- console.log(this.$store.state.user.websocket)
- this.$store.state.user.websocket = new ReconnectingWebSocket(
- http + token
- );
- this.$store.state.user.websocket.timeoutInterval = 3000;
- setInterval(() => {
- if (navigator.onLine == false) {
- this.showWsErr = true;
- this.wsErrMsg = "网络已断开,请检查网络后重新打开页面";
- console.log('navigator',navigator)
- } else if (
- navigator.onLine == true &&
- this.websocket.readyState == 1
- ) {
- this.showWsErr = false;
- }
- this.websocket.send("1");
- }, 55000);
- }
-
- }).catch(error => {
- // window.location.href = error.response.data.redirect;
- });
- }
- },
-
- created() {
- getOrgs().then(response => {
- if (response.data.state === 1) {
- this.orgs = response.data.data.orgs;
- console.log("org", this.orgs);
- var creator = response.data.data.creator;
- console.log("creator", creator);
- var admin = response.data.data.admin;
- console.log("admin", admin);
- this.is_super_admin = admin.is_super_admin;
- for (let i = 0; i < this.orgs.length; i++) {
- if (this.orgs[i].id == this.org_id) {
- this.org_name = this.orgs[i].org_name;
- }
- }
- localStorage.setItem("org_id",creator.org_id);
- sessionStorage.setItem("org_id",creator.org_id);
- sessionStorage.setItem("admin_user_id",creator.admin_user_id);
- this.getToken(creator.org_id,creator.admin_user_id)
- }
- });
- },
- };
- </script>
-
- <style rel="stylesheet/scss" lang="scss" scoped>
- .top-nav {
- background: #fff;
- position: fixed;
- top: 0;
- left: 0px;
- right: 0;
- z-index: 1000;
- height: 50px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- color: #000;
- .dropdownBox {
- margin-left: 10px;
- }
- .navRight {
- display: flex;
- align-items: center;
- justify-content: space-between;
- min-width: 200px;
- margin-right: 10px;
- font-size: 14px;
- .right-menu {
- float: right;
- height: 100%;
- z-index: 99999;
- color: #000;
- & :focus {
- outline: none;
- }
-
- .right-menu-item {
- display: inline-block;
- margin: 0 8px;
-
- .iconfont {
- font-size: 18px;
- }
- }
- .screenfull {
- height: 20px;
- }
-
- .international {
- vertical-align: top;
- }
-
- .theme-switch {
- vertical-align: 15px;
- }
-
- .avatar-container {
- margin-right: 10px;
-
- .avatar-wrapper {
- cursor: pointer;
- margin-top: 3px;
- display: flex;
- align-items: center;
- justify-content: center;
-
- .user-avatar {
- width: 40px;
- height: 40px;
- border-radius: 50%;
- object-fit: cover;
- object-position: center;
- }
-
- .user-title {
- margin: 0 8px;
- font-size: 14px;
- color: #000;
- }
-
- .el-icon-caret-bottom {
- font-size: 12px;
- color: #000;
- }
- }
- }
- }
- }
-
- .nav-logo {
- width: 140px;
- display: flex;
- align-items: center;
- // height: 60px;
- text-align: center;
- justify-content: center;
- // padding: 10px 0;
- box-sizing: border-box;
- float: left;
-
- img {
- display: inline-block;
- width: 100px;
- }
- }
- .navbar {
- border-radius: 0px !important;
- display: flex;
- justify-content: space-between;
- width: calc(100% - 180px);
- align-items: center;
- color: #fff;
- border: none;
- background: #409eff;
- float: left;
-
- .breadcrumb-container {
- float: left;
- }
-
- .errLog-container {
- display: inline-block;
- vertical-align: top;
- }
-
- .right-menu {
- float: right;
- height: 100%;
- z-index: 99999;
-
- & :focus {
- outline: none;
- }
-
- .right-menu-item {
- display: inline-block;
- margin: 0 8px;
-
- .iconfont {
- font-size: 18px;
- }
- }
- .screenfull {
- height: 20px;
- }
-
- .international {
- vertical-align: top;
- }
-
- .theme-switch {
- vertical-align: 15px;
- }
-
- .avatar-container {
- margin-right: 10px;
-
- .avatar-wrapper {
- cursor: pointer;
- margin-top: 3px;
- display: flex;
- align-items: center;
- justify-content: center;
-
- .user-avatar {
- width: 40px;
- height: 40px;
- border-radius: 50%;
- object-fit: cover;
- object-position: center;
- }
-
- .user-title {
- margin: 0 8px;
- font-size: 14px;
- color: #000;
- }
-
- .el-icon-caret-bottom {
- font-size: 12px;
- color: #000;
- }
- }
- }
- }
- }
- .system-nav {
- .system-nav-menu {
- float: left;
- height: 60px;
- line-height: 60px;
- padding: 0 25px;
-
- a {
- font-size: 15px;
-
- .iconfont {
- font-size: 18px;
- }
- }
- }
- .active {
- background: #3090eb;
- border-left: 1px #5fabf7 solid;
- border-right: 1px #5fabf7 solid;
- }
- }
- .el-menu::after,
- .el-menu::before {
- width: 1px;
- height: 1px;
- position: absolute;
- top: 0;
- left: 0;
- }
- }
- .el-dropdown-menu {
- z-index: 9999 !important;
- }
-
- .v-modal {
- z-index: 9999 !important;
- }
- </style>
-
- <style lang="scss">
- .navRight {
- .el-input {
- width: 250px;
- }
- .el-input__inner {
- border-radius: 30px;
- background: #f5f7fa;
- }
- }
- .dropdownBox {
- .el-dropdown-link {
- font-size: 14px;
- color: #000;
- }
- }
- </style>
|