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.

521 lines
16 KiB

3 years ago
3 years ago
1 year ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1 year ago
3 years ago
1 year ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1 year ago
3 years ago
3 years ago
3 years ago
3 years ago
1 year ago
3 years ago
1 year ago
3 years ago
1 year ago
3 years ago
1 year ago
3 years ago
1 year ago
3 years ago
1 year ago
3 years ago
1 year ago
3 years ago
3 years ago
3 years 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. <!-- <span @click="favoriteFunction()">-->
  22. <!-- <icon-svg :name="this.$store.state.user.favorite?'xiangqufill':'xiangqu'" ></icon-svg>-->
  23. <!-- </span>-->
  24. <el-menu-item class="site-navbar__avatar" index="1">
  25. <span class="el-dropdown-link" @click="userSetting">
  26. <icon-svg name="editTable" style="width: 25px;height: 25px;margin-top: 5px"></icon-svg>
  27. </span>
  28. </el-menu-item>
  29. <el-menu-item class="site-navbar__avatar" index="0">
  30. <span @click="favoriteFunction()">
  31. <icon-svg :name="favorite?'xiangqufill':'xiangqu'" style="margin-top: 11px" class="sl-svg"></icon-svg>
  32. </span>
  33. </el-menu-item>
  34. <!-- <el-menu-item class="site-navbar__avatar" index="2">-->
  35. <!-- <span style=" color: #909399;" @click="helpFileList()">-->
  36. <!-- 帮助-->
  37. <!-- &lt;!&ndash; <icon-svg name="help" style="width: 25px;height: 25px;margin-top: 5px"></icon-svg>&ndash;&gt;-->
  38. <!-- </span>-->
  39. <!-- </el-menu-item>-->
  40. <el-submenu index="3">
  41. <template slot="title">{{ pageLanguage.setting }}</template>
  42. <el-submenu index="2-1">
  43. <template slot="title">{{ pageLanguage.languageSetting }}</template>
  44. <el-menu-item index="2-1-1" :key="index" :value="item.languageCode" v-for="(item,index) in languageList "
  45. @click.native="switch_the_language(item.languageCode)">{{ item.languageName }}
  46. </el-menu-item>
  47. </el-submenu>
  48. <el-submenu index="2-2">
  49. <template slot="title">{{ pageLanguage.userSetting }}</template>
  50. <el-menu-item index="2-2-1" @click.native="updatePasswordHandle()">{{ pageLanguage.updatePassword }}</el-menu-item>
  51. <!-- <el-menu-item index="2-2-2" @click.native="updateLanguageHandle()">{{ pageLanguage.updateDefaultLanguage }}-->
  52. <!-- </el-menu-item>-->
  53. </el-submenu>
  54. <el-menu-item index="2-3" @click="$router.push({ name: 'theme' })">{{ pageLanguage.cssSetting }}</el-menu-item>
  55. <el-menu-item index="2-3" @click="revisionModal">{{ pageLanguage.revisionSetting }}</el-menu-item>
  56. <!-- <el-menu-item index="2-4" @click="printList()">{{ pageLanguage.printSetting }}</el-menu-item>-->
  57. </el-submenu>
  58. <el-menu-item class="site-navbar__avatar" index="4">
  59. <el-dropdown :show-timeout="0" placement="bottom">
  60. <span class="el-dropdown-link custom-avatar">
  61. <img src="~@/assets/img/ckp.png" :alt="userName">{{ userName }}
  62. <!-- <img src="~@/assets/img/avatar.png" :alt="userName">{{ userName }}-->
  63. </span>
  64. <el-dropdown-menu slot="dropdown">
  65. <el-dropdown-item @click.native="logoutHandle()">退出</el-dropdown-item>
  66. </el-dropdown-menu>
  67. </el-dropdown>
  68. </el-menu-item>
  69. </el-menu>
  70. </div>
  71. <!-- 弹窗, 修改密码 -->
  72. <update-password v-if="updatePassowrdVisible" ref="updatePassowrd"></update-password>
  73. <!-- 弹窗, 修改默认语言 -->
  74. <update-language v-if="updateLanguageVisible" ref="updateLanguage"></update-language>
  75. <!-- 文件列表 -->
  76. <FileListView ref="fileListView" v-if="helpFileVisible"></FileListView>
  77. <el-dialog append-to-body top="26vh" :show-close="false" :close-on-click-modal="true" v-drag :visible.sync="revisionModalFlag" width="335px">
  78. <div slot="title" style="text-align: center">
  79. <img src="~@/assets/img/ckp.png" style="width: 115px;height: 45px;vertical-align: middle;object-fit: contain;">
  80. <!-- <img src="~@/assets/img/avatar.png" style="width: 115px;height: 45px;vertical-align: middle;object-fit: contain;">-->
  81. </div>
  82. <div style="display: flex;justify-content: space-between;">
  83. <div class="aaa">
  84. <div>开发商</div>
  85. <div>开发商邮箱</div>
  86. <div>更新时间</div>
  87. <div>版本</div>
  88. </div>
  89. <div style="text-align: right" class="aaa">
  90. <div>{{ revisionData.company }}</div>
  91. <div>{{ revisionData.installPath }}</div>
  92. <div>{{ revisionData.regDate }}</div>
  93. <div>{{ revisionData.revisionNo }}</div>
  94. </div>
  95. </div>
  96. <!-- <el-form :inline="true" label-position="top" style="margin-left: 7px;">-->
  97. <!-- <el-form-item label=" ">-->
  98. <!-- 开发商: {{ revisionData.company }}-->
  99. <!-- </el-form-item>-->
  100. <!-- </el-form>-->
  101. <!-- <el-form :inline="true" label-position="top" style="margin-left: 7px;">-->
  102. <!-- <el-form-item label=" ">-->
  103. <!-- 开发商邮箱: {{ revisionData.installPath }}-->
  104. <!-- </el-form-item>-->
  105. <!-- </el-form>-->
  106. <!-- <el-form :inline="true" label-position="top" style="margin-left: 7px;">-->
  107. <!-- <el-form-item label=" ">-->
  108. <!-- 版本: {{ revisionData.revisionNo }}-->
  109. <!-- </el-form-item>-->
  110. <!-- </el-form>-->
  111. </el-dialog>
  112. <!-- 动态列 -->
  113. <column v-if="visible" ref="column" @refreshData="getTableUserColumn" v-drag></column>
  114. </nav>
  115. </template>
  116. <script>
  117. import UpdatePassword from './main-navbar-update-password'
  118. import UpdateLanguage from './main-navbar-update-language'
  119. import {clearLoginInfo} from '@/utils'
  120. import FileListView from './modules/common/file-list-view'
  121. import column from "./modules/common/column";
  122. import {
  123. searchFunctionButtonList,
  124. saveButtonList,
  125. searchSysLanguage,
  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. searchSysLanguage({languageCode: this.$i18n.locale}).then(({data}) => {
  358. this.languageList = data.rows
  359. })
  360. },
  361. // 获取页面多语言数据
  362. getFunctionButtonList() {
  363. let queryButton = {
  364. functionId: 'systemInformation',
  365. tableId: 'systemInformation',
  366. languageCode: this.$i18n.locale,
  367. objectType: 'label'
  368. }
  369. searchFunctionButtonList(queryButton).then(({data}) => {
  370. if (data.code === 0) {
  371. this.pageLanguage = data.data
  372. }
  373. })
  374. },
  375. // 注3:增加语言切换函数
  376. switch_the_language(val) {
  377. localStorage.setItem('locale', val)
  378. location.reload()
  379. },
  380. // 修改密码
  381. updatePasswordHandle() {
  382. this.updatePassowrdVisible = true
  383. this.$nextTick(() => {
  384. this.$refs.updatePassowrd.init()
  385. })
  386. },
  387. // 修改用户默认语言
  388. updateLanguageHandle() {
  389. this.updateLanguageVisible = true
  390. this.$nextTick(() => {
  391. this.$refs.updateLanguage.init()
  392. })
  393. },
  394. // 退出
  395. logoutHandle() {
  396. this.$confirm(`确定进行[退出]操作?`, '提示', {
  397. confirmButtonText: '确定',
  398. cancelButtonText: '取消',
  399. type: 'warning'
  400. }).then(() => {
  401. this.$http({
  402. url: this.$http.adornUrl('/sys/logout'),
  403. method: 'post',
  404. data: this.$http.adornData()
  405. }).then(({data}) => {
  406. if (data && data.code === 0) {
  407. clearLoginInfo()
  408. this.$router.push({name: 'login'})
  409. }
  410. })
  411. }).catch(() => {
  412. })
  413. },
  414. //收藏夹功能 // 校验用户是否收藏
  415. favoriteIsOk() {
  416. let userFavorite = {
  417. userId: this.$store.state.user.id,
  418. languageCode: this.$i18n.locale
  419. }
  420. userFavoriteList(userFavorite).then(({data}) => {
  421. this.favorite = false
  422. for (let i = 0; i < data.list.length; i++) {
  423. if (!data.list[i]){
  424. continue
  425. }
  426. if(this.$route.meta.menuId==data.list[i].menuId){
  427. this.favorite = true
  428. // flag=true;
  429. }
  430. }
  431. })
  432. },
  433. // 收藏 OR 取消收藏
  434. favoriteFunction() {
  435. if(this.$route.meta.menuId==null||this.$route.meta.menuId==''){
  436. this.$message.error( '首页不需要收藏!')
  437. return false
  438. }
  439. let userFavorite = {
  440. userId: this.$store.state.user.id,
  441. functionId: this.$route.meta.menuId,
  442. }
  443. if (this.favorite) {
  444. // 取消收藏
  445. this.$confirm(`确定取消收藏`, '提示', {
  446. confirmButtonText: '确定',
  447. cancelButtonText: '取消',
  448. type: 'warning'
  449. }).then(() => {
  450. removeUserFavorite(userFavorite).then(({data}) => {
  451. this.$message.success(data.msg)
  452. this.favorite = false
  453. EventBus.$emit('updateFavoriteList');
  454. })
  455. })
  456. } else {
  457. // 收藏
  458. saveUserFavorite(userFavorite).then(({data}) => {
  459. this.$message.success(data.msg)
  460. this.favorite = true
  461. EventBus.$emit('updateFavoriteList');
  462. })
  463. }
  464. },
  465. },
  466. created() {
  467. this.getLanguageList()
  468. this.getFunctionButtonList()
  469. this.favoriteIsOk()
  470. }
  471. }
  472. </script>
  473. <style scoped lang="scss">
  474. .icon-svg {
  475. width: 2em;
  476. }
  477. .el-menu--collapse .el-menu .el-submenu, .el-menu--popup, .el-menu-item {
  478. min-width: 50px !important;
  479. }
  480. .site-navbar__brand-lg, .site-navbar__brand-mini {
  481. margin: 0 5px;
  482. color: #fff;
  483. margin-left: -45px;
  484. }
  485. .el-menu--horizontal > .el-menu-item {
  486. color: #3b4249;
  487. }
  488. .aaa div{
  489. margin-top: 10px;
  490. }
  491. .aaa {
  492. margin-bottom: 15px;
  493. }
  494. .custom-avatar img {
  495. width: 105px;
  496. height: 35px;
  497. }
  498. </style>