You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

392 lines
12 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <template>
  2. <el-menu class="navbar" mode="horizontal">
  3. <hamburger class="hamburger-container" :toggleClick="toggleSideBar" :isActive="sidebar.opened"></hamburger>
  4. <!--<breadcrumb class="breadcrumb-container"></breadcrumb>-->
  5. <top-modules class="modules-container"></top-modules>
  6. <div class="right-menu">
  7. <!--
  8. <div class="hidden-sm-and-down" style="float:left;display:flex;align-items: center;height:100%;">
  9. <el-tooltip v-if="workShop.locationName" class="item" effect="dark" :content="workShop.branchId+' '+workShop.shopId+' '+workShop.locationId" placement="top-start">
  10. <el-tag>{{workShop.branchName}} {{workShop.locationName}}</el-tag>
  11. </el-tooltip>
  12. <el-tooltip v-else class="item" effect="dark" :content="workShop.branchId+' '+workShop.deptid" placement="top-start">
  13. <el-tag>{{workShop.branchName}} {{workShop.deptName}}</el-tag>
  14. </el-tooltip>
  15. <el-button @click="showSelectShopMethod" type="primary" v-if="workShop.isSuperAdmin||workShop.isPlatFormAdmin">切换商户</el-button>
  16. </div>
  17. -->
  18. <error-log v-if="false" class="errLog-container right-menu-item hidden-sm-and-down"></error-log>
  19. <screenfull v-if="false" class="screenfull right-menu-item"></screenfull>
  20. <lang-select v-if="false" class="international right-menu-item hidden-sm-and-down"></lang-select>
  21. <el-tooltip v-if="false" class="hidden-sm-and-down" effect="dark" :content="$t('navbar.theme')" placement="bottom">
  22. <theme-picker class="theme-switch right-menu-item"></theme-picker>
  23. </el-tooltip>
  24. <UserInfo />
  25. <!-- <el-dropdown class="avatar-container right-menu-item hidden-sm-and-down" trigger="hover" @command="handleCommand">
  26. <div class="avatar-wrapper">
  27. <img v-if="userInfo && userInfo.headimgurl && userInfo.headimgurl!=null && userInfo.headimgurl!=='' " class="user-avatar" :src="userInfo.headimgurl">
  28. <img v-else class="user-avatar" src="../../../assets/image/user_img.gif">
  29. <span class="username">{{getTimeStatus}}<b>{{userInfo.username}}</b></span>
  30. <i class="el-icon-caret-bottom"></i>
  31. </div>
  32. <el-dropdown-menu slot="dropdown" style="width:400px;">
  33. <el-dropdown-item divided command="updateUserInfo">
  34. <div>用户名{{userInfo.username}}
  35. <el-button style="float:right;" type="text" icon="el-icon-setting">账户设置</el-button>
  36. </div>
  37. </el-dropdown-item>
  38. <el-dropdown-item divided>
  39. 公司{{userInfo.branchName}}
  40. </el-dropdown-item>
  41. <el-dropdown-item divided>
  42. <div style="height:250px;">
  43. <el-row v-for="(item ,index) in deptPostsTree" :label="item.deptName" :key="index">
  44. 部门{{item.deptName}}
  45. <br>
  46. 岗位
  47. <div v-if="item.children!=null && item.children.length>0" style="padding-left:40px;">
  48. <el-row v-for="(post,idx) in item.children" :key="idx">
  49. {{post.postName}}
  50. </el-row>
  51. </div>
  52. </el-row>
  53. </div>
  54. </el-dropdown-item>
  55. <el-dropdown-item v-if="false" divided>
  56. <div style=" overflow-x:auto; height:250px;">
  57. 商户及门店 <el-form>
  58. <el-form-item label-width="300" v-for="item in shopLocationsTree" :label="item.shopName" :key="item.shopId">
  59. <el-row v-for="location in item.locations" :key="location.locationId">
  60. <el-col :span="24"><el-tag>{{location.locationName}}</el-tag><i v-if="location.locationId==userInfo.locationId" class="el-icon-check"></i>
  61. </el-col>
  62. </el-row>
  63. <el-row v-if="item.locations==null || item.locations.length<=0">
  64. <el-col :span="24"><el-tag> 无门店或者我不是该商户的门店管理员</el-tag> </el-col>
  65. </el-row>
  66. </el-form-item>
  67. </el-form>
  68. </div>
  69. </el-dropdown-item>
  70. <el-dropdown-item divided>
  71. <div style=" overflow-x:auto; height:150px;">
  72. 我拥有的角色
  73. <el-row style="padding-left:40px;" v-for="role in roles" :key="role.roleid">
  74. <span v-if="role.roleid.indexOf('SCOPE')<0">{{role.rolename}}</span>
  75. </el-row>
  76. </div>
  77. </el-dropdown-item>
  78. </el-dropdown-menu>
  79. </el-dropdown> -->
  80. <!-- <div class="notice">
  81. <i class="el-icon-bell"></i>
  82. <span>未读消息(3)</span>
  83. </div> -->
  84. <div class="notice">
  85. <notice-msg-bar class="avatar-container hidden-sm-and-down" ></notice-msg-bar>
  86. </div>
  87. <!--喇叭标记-->
  88. <!-- <el-link class="logout hidden-sm-and-down" @click="goToIndex" icon="el-icon-s-home">
  89. <span style="font-size: 17px">首页</span>
  90. </el-link> -->
  91. <div class="logout">
  92. <el-button size="mini" type="primary" round @click="logout">退出</el-button>
  93. </div>
  94. </div>
  95. </el-menu>
  96. </template>
  97. <script>
  98. import { mapGetters } from 'vuex'
  99. import Breadcrumb from '@/components/Breadcrumb'
  100. import TopModules from '@/components/TopModules'
  101. import Hamburger from '@/components/Hamburger'
  102. import ErrorLog from '@/components/ErrorLog'
  103. import Screenfull from '@/components/Screenfull'
  104. import LangSelect from '@/components/LangSelect'
  105. import ThemePicker from '@/components/ThemePicker'
  106. import NoticeMsgBar from '@/components/NoticeMsgBar'
  107. import UserInfo from './UserInfo'
  108. import dayjs from 'dayjs'
  109. //import selectShopLocationBySysDept from '@/views/mdp/app/selectShopLocationBySysDept/selectShopLocationBySysDept';
  110. export default {
  111. components: {
  112. Breadcrumb,
  113. Hamburger,
  114. ErrorLog,
  115. Screenfull,
  116. LangSelect,
  117. ThemePicker,
  118. TopModules,
  119. NoticeMsgBar,
  120. UserInfo
  121. },
  122. data:function(){
  123. return {
  124. selectShopVisible: false,
  125. postChecked:''
  126. }
  127. },
  128. computed: {
  129. screenWidth: function() {
  130. return screen.width;
  131. },
  132. ...mapGetters([
  133. 'sidebar',
  134. 'userInfo',
  135. 'roles',
  136. 'myPosts',
  137. 'myLocations',
  138. 'myShops',
  139. 'workShop'
  140. ]),
  141. 'deptPostsTree':function(){
  142. var deptPostsTree=[]
  143. if(this.myPosts==null ||this.myPosts.length<=0){
  144. return deptPostsTree
  145. }
  146. var checkedPostId=this.myPosts.length>0?this.myPosts[0].postId:''
  147. this.postChecked=checkedPostId
  148. this.myPosts.forEach(post=>{
  149. if(post.postId==checkedPostId){
  150. post.checked='1'
  151. }
  152. var deptPostArray=deptPostsTree.filter(dp=>dp.deptid==post.deptid)
  153. if(deptPostArray!=null && deptPostArray.length>0){
  154. if(deptPostArray[0].children && deptPostArray[0].children.length>0){
  155. if(!deptPostArray[0].children.some(i=>i.postId==post.postId)){
  156. deptPostArray[0].children.push(post)
  157. }
  158. }else{
  159. deptPostArray[0].children=[]
  160. deptPostArray[0].children.push(post)
  161. }
  162. }else{
  163. let deptPostsNode={deptid:post.deptid,deptName:post.deptName}
  164. deptPostsNode.children=[post]
  165. deptPostsTree.push(deptPostsNode)
  166. }
  167. })
  168. return deptPostsTree
  169. },
  170. 'shopLocationsTree':function(){
  171. let myShops=this.myShops;
  172. if(myShops==null||myShops.length<=0){
  173. return []
  174. }
  175. let myLocations=this.myLocations;
  176. myShops.forEach(shop=>{
  177. shop.locations=[];
  178. if(shop.shopId==this.userInfo.shopId){
  179. shop.checked=true
  180. }
  181. if(myLocations!=null && myLocations.length>0){
  182. myLocations.forEach(l=>{
  183. if(l.shopId==shop.shopId){
  184. if(l.locationId==this.userInfo.locationId){
  185. l.checked=true
  186. }
  187. shop.locations.push(l)
  188. }
  189. })
  190. }
  191. })
  192. return myShops
  193. },
  194. getTimeStatus() {
  195. let hour = dayjs().hour();
  196. let msg = '早上好';
  197. if(hour >= 13 || hour <= 18) {
  198. msg = '下午好';
  199. }else if (hour >= 19 || hour <= 24){
  200. msg = '晚上好';
  201. }
  202. return msg;
  203. }
  204. },
  205. methods: {
  206. toggleSideBar(toOpen) {
  207. this.$store.dispatch('toggleSideBar', toOpen)
  208. },
  209. logout() {
  210. this.$store.dispatch('LogOut').then(() => {
  211. //location.reload()// In order to re-instantiate the vue-router object to avoid bugs
  212. //this.$router.replace({path:'/login'})
  213. location.replace('/'+process.env.CONTEXT+'/'+process.env.VERSION+'/');
  214. })
  215. },
  216. showSelectShopMethod() {
  217. this.selectShopVisible = true;
  218. },
  219. sureMethod(row) {
  220. this.selectShopVisible = false;
  221. this.workShop.shopId=row.shopId;
  222. this.workShop.branchId=row.branchId;
  223. this.workShop.branchName=row.sysBranchName;
  224. this.workShop.locationId=row.id;
  225. this.workShop.deptid=row.deptid;
  226. this.workShop.locationName=row.businessName;
  227. this.$store.commit('SET_WORK_SHOP',this.workShop);
  228. },
  229. jumpToOtherSystem(name) {
  230. let href = window.location.protocol + "//" + window.location.host + "/" + name + "/" + process.env.VERSION;
  231. if(name=='im'){
  232. href=window.location.protocol + "//" + window.location.host + "/" + name + "/" + process.env.VERSION+"/#/mdp/im/messages/messageChat";
  233. }
  234. console.log(href);
  235. window.open(href, '_blank');
  236. NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it
  237. },
  238. handleCommand(command){
  239. if(command=='updateUserInfo'){
  240. this.$router.push({path:'/updateUserInfo'})
  241. }
  242. },
  243. goToIndex(){
  244. this.$router.push({path:'/'})
  245. }
  246. },
  247. mounted() {
  248. if (screen.width <= 500) {
  249. this.toggleSideBar(false);
  250. } else {
  251. this.toggleSideBar(true);
  252. }
  253. }
  254. }
  255. </script>
  256. <style rel="stylesheet/scss" lang="scss" scoped>
  257. @import './iconfont.css';
  258. .navbar {
  259. height: 50px;
  260. border-radius: 0px !important;
  261. display: flex;
  262. flex-direction: row;
  263. align-items: center;
  264. flex-wrap: nowrap;
  265. background-color: #fff;
  266. position: -webkit-sticky;
  267. position: sticky;
  268. top: 0;
  269. z-index: 99;
  270. .hamburger-container {
  271. line-height: 58px;
  272. height: 50px;
  273. float: left;
  274. padding: 0 10px;
  275. margin-right: 24px;
  276. color: #9D9D9E !important;
  277. }
  278. .modules-container {
  279. display: flex;
  280. flex-direction: row;
  281. align-items: center;
  282. flex: 1;
  283. height: 50px;
  284. padding: 0 10px;
  285. }
  286. .breadcrumb-container{
  287. float: left;
  288. }
  289. .errLog-container {
  290. display: inline-block;
  291. vertical-align: top;
  292. }
  293. .right-menu {
  294. display: flex;
  295. flex-direction: row;
  296. align-items: center;
  297. &:focus{
  298. outline: none;
  299. }
  300. .logout{
  301. display: flex;
  302. align-items: center;
  303. height: 50px;
  304. color: #fff;
  305. font-size: 30px;
  306. margin-right: 28px;
  307. }
  308. .avatar-container {
  309. height: 50px;
  310. display: flex;
  311. align-items: center;
  312. .avatar-wrapper {
  313. cursor: pointer;
  314. display: flex;
  315. flex-direction: row;
  316. align-items: center;
  317. .user-avatar {
  318. height: 34px;
  319. width: 34px;
  320. border-radius: 50%;
  321. margin-right: 12px;
  322. }
  323. .username{
  324. color: #7D7D7D;
  325. font-size: 18px;
  326. margin-right: 2px;
  327. }
  328. .el-icon-caret-bottom {
  329. font-size: 22px;
  330. }
  331. }
  332. }
  333. .notice {
  334. display: flex;
  335. flex-direction: row;
  336. align-items: center;
  337. margin: 0 18px;
  338. color: #827E7E;
  339. font-size: 16px;
  340. }
  341. }
  342. }
  343. .iconfont {
  344. position: relative
  345. }
  346. .itemt:hover{
  347. cursor: pointer;
  348. color: rgb(52, 152, 219);
  349. }
  350. .big{
  351. display:flex;
  352. flex-direction:column;
  353. align-items:center;
  354. margin-right: 20px;
  355. }
  356. </style>