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.

499 lines
15 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. <template>
  2. <nav class="site-navbar" :class="'site-navbar--' + navbarLayoutType">
  3. <div class="site-navbar__header">
  4. <!-- @click="$router.push({ name: 'home' })"-->
  5. <h1 class="site-navbar__brand">
  6. <el-menu
  7. class="site-navbar__menu"
  8. mode="horizontal">
  9. <el-menu-item class="site-navbar__switch" index="0" @click="sidebarFold = !sidebarFold">
  10. <icon-svg name="zhedie"></icon-svg>
  11. </el-menu-item>
  12. </el-menu>
  13. <a class="site-navbar__brand-lg" href="javascript:;">{{ pageLanguage.XjSysManage }}</a>
  14. <a class="site-navbar__brand-mini" href="javascript:;">{{ pageLanguage.abbreviation }}</a>
  15. </h1>
  16. </div>
  17. <div class="site-navbar__body clearfix">
  18. <el-menu
  19. class="site-navbar__menu site-navbar__menu--right"
  20. mode="horizontal">
  21. <!-- <el-menu-item class="site-navbar__avatar" index="1">-->
  22. <!-- <span class="el-dropdown-link" @click="userSetting">-->
  23. <!-- <icon-svg name="editTable" style="width: 25px;height: 25px;margin-top: 5px"></icon-svg>-->
  24. <!-- </span>-->
  25. <!-- </el-menu-item>-->
  26. <el-menu-item class="site-navbar__avatar" index="0">
  27. <span @click="favoriteFunction()">
  28. <icon-svg :name="favorite?'xiangqufill':'xiangqu'" style="margin-top: 11px" class="sl-svg"></icon-svg>
  29. </span>
  30. </el-menu-item>
  31. <el-submenu index="3">
  32. <template slot="title">{{ pageLanguage.setting }}</template>
  33. <!-- <el-submenu index="2-1">-->
  34. <!-- <template slot="title">{{ pageLanguage.languageSetting }}</template>-->
  35. <!-- <el-menu-item index="2-1-1" :key="index" :value="item.languageCode" v-for="(item,index) in languageList "-->
  36. <!-- @click.native="switch_the_language(item.languageCode)">{{ item.languageName }}-->
  37. <!-- </el-menu-item>-->
  38. <!-- </el-submenu>-->
  39. <el-submenu index="2-2">
  40. <template slot="title">{{ pageLanguage.userSetting }}</template>
  41. <el-menu-item index="2-2-1" @click.native="updatePasswordHandle()">{{ pageLanguage.updatePassword }}</el-menu-item>
  42. <!-- <el-menu-item index="2-2-2" @click.native="updateLanguageHandle()">{{ pageLanguage.updateDefaultLanguage }}-->
  43. <!-- </el-menu-item>-->
  44. </el-submenu>
  45. <el-menu-item index="2-3" @click="$router.push({ name: 'theme' })">{{ pageLanguage.cssSetting }}</el-menu-item>
  46. <!-- <el-menu-item index="2-3" @click="revisionModal">{{ pageLanguage.revisionSetting }}</el-menu-item> -->
  47. <!-- <el-menu-item index="2-4" @click="printList()">{{ pageLanguage.printSetting }}</el-menu-item>-->
  48. </el-submenu>
  49. <el-menu-item class="site-navbar__avatar" index="4">
  50. <el-dropdown :show-timeout="0" placement="bottom">
  51. <span class="el-dropdown-link custom-avatar">
  52. <img src="~@/assets/img/xj.png" :alt="userName">{{ userName }}
  53. <!-- <img src="~@/assets/img/avatar.png" :alt="userName">{{ userName }}-->
  54. </span>
  55. <el-dropdown-menu slot="dropdown">
  56. <el-dropdown-item @click.native="logoutHandle()">退出</el-dropdown-item>
  57. </el-dropdown-menu>
  58. </el-dropdown>
  59. </el-menu-item>
  60. </el-menu>
  61. </div>
  62. <!-- 弹窗, 修改密码 -->
  63. <update-password v-if="updatePassowrdVisible" ref="updatePassowrd"></update-password>
  64. <!-- 弹窗, 修改默认语言 -->
  65. <update-language v-if="updateLanguageVisible" ref="updateLanguage"></update-language>
  66. <el-dialog append-to-body top="26vh" :show-close="false" :close-on-click-modal="true" v-drag :visible.sync="revisionModalFlag" width="335px">
  67. <div slot="title" style="text-align: center">
  68. <img src="~@/assets/img/xj.png" style="width: 115px;height: 45px;vertical-align: middle;object-fit: contain;">
  69. <!-- <img src="~@/assets/img/avatar.png" style="width: 115px;height: 45px;vertical-align: middle;object-fit: contain;">-->
  70. </div>
  71. <div style="display: flex;justify-content: space-between;">
  72. <div class="aaa">
  73. <div>开发商</div>
  74. <div>开发商邮箱</div>
  75. <div>更新时间</div>
  76. <div>版本</div>
  77. </div>
  78. <div style="text-align: right" class="aaa">
  79. <div>{{ revisionData.company }}</div>
  80. <div>{{ revisionData.installPath }}</div>
  81. <div>{{ revisionData.regDate }}</div>
  82. <div>{{ revisionData.revisionNo }}</div>
  83. </div>
  84. </div>
  85. <!-- <el-form :inline="true" label-position="top" style="margin-left: 7px;">-->
  86. <!-- <el-form-item label=" ">-->
  87. <!-- 开发商: {{ revisionData.company }}-->
  88. <!-- </el-form-item>-->
  89. <!-- </el-form>-->
  90. <!-- <el-form :inline="true" label-position="top" style="margin-left: 7px;">-->
  91. <!-- <el-form-item label=" ">-->
  92. <!-- 开发商邮箱: {{ revisionData.installPath }}-->
  93. <!-- </el-form-item>-->
  94. <!-- </el-form>-->
  95. <!-- <el-form :inline="true" label-position="top" style="margin-left: 7px;">-->
  96. <!-- <el-form-item label=" ">-->
  97. <!-- 版本: {{ revisionData.revisionNo }}-->
  98. <!-- </el-form-item>-->
  99. <!-- </el-form>-->
  100. </el-dialog>
  101. <!-- 动态列 -->
  102. <column v-if="visible" ref="column" @refreshData="getTableUserColumn" v-drag></column>
  103. </nav>
  104. </template>
  105. <script>
  106. import UpdatePassword from './main-navbar-update-password'
  107. import UpdateLanguage from './main-navbar-update-language'
  108. import {clearLoginInfo} from '@/utils'
  109. import column from "./modules/common/column";
  110. import {
  111. searchFunctionButtonList,
  112. saveButtonList,
  113. searchSysLanguage,
  114. getRevisionInformation, // 获取版本信息
  115. } from "@/api/sysLanguage.js"
  116. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  117. import {EventBus} from "../main";
  118. export default {
  119. inject: ['refresh'],
  120. data() {
  121. return {
  122. favorite: false,
  123. // 是否收藏
  124. visible: false,
  125. updatePassowrdVisible: false,
  126. updateLanguageVisible: false,
  127. helpFileVisible: false,
  128. printListVisible: false,
  129. message: this.$t('language.name'),
  130. languageList: [],
  131. pageLanguage: {
  132. XjSysManage: 'Xujie',
  133. abbreviation: 'Xujie',
  134. setting: '设置',
  135. languageSetting: '语言设置',
  136. userSetting: '用户设置',
  137. updatePassword: '修改密码',
  138. updateDefaultLanguage: '修改默认语言',
  139. cssSetting: '主题设置',
  140. printSetting: '打印设置',
  141. revisionSetting: '版本说明'
  142. },
  143. // 导出 end
  144. pageLanguageList: [
  145. {
  146. functionId: "systemInformation",
  147. languageValue: '旭捷管理系统',
  148. objectId: 'XjSysManage',
  149. objectType: "label",
  150. tableId: "systemInformation"
  151. },
  152. {
  153. functionId: "systemInformation",
  154. languageValue: '首页',
  155. objectId: 'homePage',
  156. objectType: "label",
  157. tableId: "systemInformation"
  158. },
  159. {
  160. functionId: "systemInformation",
  161. languageValue: 'Checkpoint',
  162. objectId: 'abbreviation',
  163. objectType: "label",
  164. tableId: "systemInformation"
  165. },
  166. {
  167. functionId: "systemInformation",
  168. languageValue: '设置',
  169. objectId: 'setting',
  170. objectType: "label",
  171. tableId: "systemInformation"
  172. },
  173. {
  174. functionId: "systemInformation",
  175. languageValue: '语言设置',
  176. objectId: 'languageSetting',
  177. objectType: "label",
  178. tableId: "systemInformation"
  179. },
  180. {
  181. functionId: "systemInformation",
  182. languageValue: '用户设置',
  183. objectId: 'userSetting',
  184. objectType: "label",
  185. tableId: "systemInformation"
  186. },
  187. {
  188. functionId: "systemInformation",
  189. languageValue: '修改密码',
  190. objectId: 'updatePassword',
  191. objectType: "label",
  192. tableId: "systemInformation"
  193. },
  194. {
  195. functionId: "systemInformation",
  196. languageValue: '修改用户语言',
  197. objectId: 'updateDefaultLanguage',
  198. objectType: "label",
  199. tableId: "systemInformation"
  200. },
  201. {
  202. functionId: "systemInformation",
  203. languageValue: '主题设置',
  204. objectId: 'cssSetting',
  205. objectType: "label",
  206. tableId: "systemInformation"
  207. },
  208. {
  209. functionId: "systemInformation",
  210. languageValue: '版本说明',
  211. objectId: 'revisionSetting',
  212. objectType: "label",
  213. tableId: "systemInformation"
  214. },
  215. {
  216. functionId: "systemInformation",
  217. languageValue: '打印设置',
  218. objectId: 'printSetting',
  219. objectType: "label",
  220. tableId: "systemInformation"
  221. }
  222. ],
  223. pending: {
  224. pendingReview: 0,
  225. pendingSum: 0,
  226. },
  227. queryToolReview: {
  228. site: this.$store.state.user.site,
  229. userId: this.$store.state.user.name,
  230. strUserId: this.$store.state.user.id,
  231. },
  232. toolReviewTimer: null,
  233. revisionData: {
  234. identityNo: '',
  235. company: '',
  236. regDate: '',
  237. serverName: '',
  238. revisionNo: '',
  239. installPath: '',
  240. registerNo: '',
  241. serialNo: '',
  242. registerMark: '',
  243. applicationName: '',
  244. customerIdentificationId: ''
  245. },
  246. revisionModalFlag: false
  247. }
  248. },
  249. watch: {
  250. pending: {
  251. deep: true,
  252. handler: function (newV, oldV) {
  253. this.pending.pendingSum = this.pending.pendingReview
  254. }
  255. },
  256. $route: {
  257. deep: true,
  258. handler: function (newV, oldV) {
  259. this.favoriteIsOk();
  260. }
  261. },
  262. },
  263. components: {
  264. UpdatePassword,
  265. UpdateLanguage,
  266. column,
  267. },
  268. computed: {
  269. navbarLayoutType: {
  270. get() {
  271. return this.$store.state.common.navbarLayoutType
  272. }
  273. },
  274. sidebarFold: {
  275. get() {
  276. return this.$store.state.common.sidebarFold
  277. },
  278. set(val) {
  279. this.$store.commit('common/updateSidebarFold', val)
  280. }
  281. },
  282. mainTabs: {
  283. get() {
  284. return this.$store.state.common.mainTabs
  285. },
  286. set(val) {
  287. this.$store.commit('common/updateMainTabs', val)
  288. }
  289. },
  290. userName: {
  291. get() {
  292. return this.$store.state.user.userDisplay
  293. }
  294. }
  295. },
  296. activated() {
  297. },
  298. mounted() {
  299. },
  300. methods: {
  301. // 查询版本信息
  302. revisionModal () {
  303. getRevisionInformation().then(({data}) => {
  304. if (data && data.code === 0) {
  305. this.revisionData = data.rows
  306. this.revisionModalFlag = true
  307. }
  308. })
  309. },
  310. // 打开页面设置
  311. userSetting() {
  312. this.visible = true;
  313. let queryTable = {
  314. userId: this.$store.state.user.name,
  315. functionId: this.$route.meta.menuId,
  316. languageCode: this.$i18n.locale,
  317. tableId: '',
  318. }
  319. this.$nextTick(() => {
  320. this.$refs.column.init(queryTable);
  321. })
  322. },
  323. getTableUserColumn() {
  324. this.$nextTick(() => {
  325. this.refresh()
  326. })
  327. },
  328. // 获取多语言列表
  329. getLanguageList() {
  330. searchSysLanguage({languageCode: this.$i18n.locale}).then(({data}) => {
  331. this.languageList = data.rows
  332. })
  333. },
  334. // 获取页面多语言数据
  335. getFunctionButtonList() {
  336. let queryButton = {
  337. functionId: 'systemInformation',
  338. tableId: 'systemInformation',
  339. languageCode: this.$i18n.locale,
  340. objectType: 'label'
  341. }
  342. searchFunctionButtonList(queryButton).then(({data}) => {
  343. if (data.code === 0) {
  344. this.pageLanguage = data.data
  345. }
  346. })
  347. },
  348. // 注3:增加语言切换函数
  349. switch_the_language(val) {
  350. localStorage.setItem('locale', val)
  351. location.reload()
  352. },
  353. // 修改密码
  354. updatePasswordHandle() {
  355. this.updatePassowrdVisible = true
  356. this.$nextTick(() => {
  357. this.$refs.updatePassowrd.init()
  358. })
  359. },
  360. // 修改用户默认语言
  361. updateLanguageHandle() {
  362. this.updateLanguageVisible = true
  363. this.$nextTick(() => {
  364. this.$refs.updateLanguage.init()
  365. })
  366. },
  367. // 退出
  368. logoutHandle() {
  369. this.$confirm(`确定进行[退出]操作?`, '提示', {
  370. confirmButtonText: '确定',
  371. cancelButtonText: '取消',
  372. type: 'warning'
  373. }).then(() => {
  374. this.$http({
  375. url: this.$http.adornUrl('/sys/logout'),
  376. method: 'post',
  377. data: this.$http.adornData()
  378. }).then(({data}) => {
  379. if (data && data.code === 0) {
  380. clearLoginInfo()
  381. this.$router.push({name: 'login'})
  382. }
  383. })
  384. }).catch(() => {
  385. })
  386. },
  387. //收藏夹功能 // 校验用户是否收藏
  388. favoriteIsOk() {
  389. let userFavorite = {
  390. userId: this.$store.state.user.id,
  391. languageCode: this.$i18n.locale
  392. }
  393. userFavoriteList(userFavorite).then(({data}) => {
  394. this.favorite = false
  395. for (let i = 0; i < data.list.length; i++) {
  396. if (!data.list[i]){
  397. continue
  398. }
  399. if(this.$route.meta.menuId==data.list[i].menuId){
  400. this.favorite = true
  401. // flag=true;
  402. }
  403. }
  404. })
  405. },
  406. // 收藏 OR 取消收藏
  407. favoriteFunction() {
  408. if(this.$route.meta.menuId==null||this.$route.meta.menuId==''){
  409. this.$message.error( '首页不需要收藏!')
  410. return false
  411. }
  412. let userFavorite = {
  413. userId: this.$store.state.user.id,
  414. functionId: this.$route.meta.menuId,
  415. }
  416. if (this.favorite) {
  417. // 取消收藏
  418. this.$confirm(`确定取消收藏`, '提示', {
  419. confirmButtonText: '确定',
  420. cancelButtonText: '取消',
  421. type: 'warning'
  422. }).then(() => {
  423. removeUserFavorite(userFavorite).then(({data}) => {
  424. this.$message.success(data.msg)
  425. this.favorite = false
  426. EventBus.$emit('updateFavoriteList');
  427. })
  428. })
  429. } else {
  430. // 收藏
  431. saveUserFavorite(userFavorite).then(({data}) => {
  432. this.$message.success(data.msg)
  433. this.favorite = true
  434. EventBus.$emit('updateFavoriteList');
  435. })
  436. }
  437. },
  438. },
  439. created() {
  440. //取消多语言
  441. // this.getLanguageList()
  442. // this.getFunctionButtonList()
  443. this.favoriteIsOk()
  444. }
  445. }
  446. </script>
  447. <style scoped lang="scss">
  448. .icon-svg {
  449. width: 2em;
  450. }
  451. .el-menu--collapse .el-menu .el-submenu, .el-menu--popup, .el-menu-item {
  452. min-width: 50px !important;
  453. }
  454. .site-navbar__brand-lg, .site-navbar__brand-mini {
  455. margin: 0 5px;
  456. color: #fff;
  457. margin-left: -45px;
  458. }
  459. .el-menu--horizontal > .el-menu-item {
  460. color: #3b4249;
  461. }
  462. .aaa div{
  463. margin-top: 10px;
  464. }
  465. .aaa {
  466. margin-bottom: 15px;
  467. }
  468. .custom-avatar img {
  469. width: 105px;
  470. height: 35px;
  471. }
  472. </style>