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.

545 lines
16 KiB

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