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.

474 lines
15 KiB

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
3 years ago
3 years ago
3 years 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
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
  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="2">-->
  30. <!-- <span style=" color: #909399;" @click="helpFileList()">-->
  31. <!-- 帮助-->
  32. <!-- &lt;!&ndash; <icon-svg name="help" style="width: 25px;height: 25px;margin-top: 5px"></icon-svg>&ndash;&gt;-->
  33. <!-- </span>-->
  34. <!-- </el-menu-item>-->
  35. <el-submenu index="3">
  36. <template slot="title">{{ pageLanguage.setting }}</template>
  37. <el-submenu index="2-1">
  38. <template slot="title">{{ pageLanguage.languageSetting }}</template>
  39. <el-menu-item index="2-1-1" :key="index" :value="item.languageCode" v-for="(item,index) in languageList "
  40. @click.native="switch_the_language(item.languageCode)">{{ item.languageName }}
  41. </el-menu-item>
  42. </el-submenu>
  43. <el-submenu index="2-2">
  44. <template slot="title">{{ pageLanguage.userSetting }}</template>
  45. <el-menu-item index="2-2-1" @click.native="updatePasswordHandle()">{{ pageLanguage.updatePassword }}</el-menu-item>
  46. <!-- <el-menu-item index="2-2-2" @click.native="updateLanguageHandle()">{{ pageLanguage.updateDefaultLanguage }}-->
  47. <!-- </el-menu-item>-->
  48. </el-submenu>
  49. <el-menu-item index="2-3" @click="$router.push({ name: 'theme' })">{{ pageLanguage.cssSetting }}</el-menu-item>
  50. <el-menu-item index="2-3" @click="revisionModal">{{ pageLanguage.revisionSetting }}</el-menu-item>
  51. <!-- <el-menu-item index="2-4" @click="printList()">{{ pageLanguage.printSetting }}</el-menu-item>-->
  52. </el-submenu>
  53. <el-menu-item class="site-navbar__avatar" index="4">
  54. <el-dropdown :show-timeout="0" placement="bottom">
  55. <span class="el-dropdown-link">
  56. <img src="~@/assets/img/ckp.png" :alt="userName">{{ userName }}
  57. <!-- <img src="~@/assets/img/avatar.png" :alt="userName">{{ userName }}-->
  58. </span>
  59. <el-dropdown-menu slot="dropdown">
  60. <el-dropdown-item @click.native="logoutHandle()">退出</el-dropdown-item>
  61. </el-dropdown-menu>
  62. </el-dropdown>
  63. </el-menu-item>
  64. </el-menu>
  65. </div>
  66. <!-- 弹窗, 修改密码 -->
  67. <update-password v-if="updatePassowrdVisible" ref="updatePassowrd"></update-password>
  68. <!-- 弹窗, 修改默认语言 -->
  69. <update-language v-if="updateLanguageVisible" ref="updateLanguage"></update-language>
  70. <!-- 文件列表 -->
  71. <FileListView ref="fileListView" v-if="helpFileVisible"></FileListView>
  72. <el-dialog append-to-body top="26vh" :show-close="false" :close-on-click-modal="true" v-drag :visible.sync="revisionModalFlag" width="335px">
  73. <div slot="title" style="text-align: center">
  74. <img src="~@/assets/img/ckp.png" style="width: 115px;height: 45px;vertical-align: middle;object-fit: contain;">
  75. <!-- <img src="~@/assets/img/avatar.png" style="width: 115px;height: 45px;vertical-align: middle;object-fit: contain;">-->
  76. </div>
  77. <div style="display: flex;justify-content: space-between;">
  78. <div class="aaa">
  79. <div>开发商</div>
  80. <div>开发商邮箱</div>
  81. <div>更新时间</div>
  82. <div>版本</div>
  83. </div>
  84. <div style="text-align: right" class="aaa">
  85. <div>{{ revisionData.company }}</div>
  86. <div>{{ revisionData.installPath }}</div>
  87. <div>{{ revisionData.regDate }}</div>
  88. <div>{{ revisionData.revisionNo }}</div>
  89. </div>
  90. </div>
  91. <!-- <el-form :inline="true" label-position="top" style="margin-left: 7px;">-->
  92. <!-- <el-form-item label=" ">-->
  93. <!-- 开发商: {{ revisionData.company }}-->
  94. <!-- </el-form-item>-->
  95. <!-- </el-form>-->
  96. <!-- <el-form :inline="true" label-position="top" style="margin-left: 7px;">-->
  97. <!-- <el-form-item label=" ">-->
  98. <!-- 开发商邮箱: {{ revisionData.installPath }}-->
  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.revisionNo }}-->
  104. <!-- </el-form-item>-->
  105. <!-- </el-form>-->
  106. </el-dialog>
  107. <!-- 动态列 -->
  108. <column v-if="visible" ref="column" @refreshData="getTableUserColumn" v-drag></column>
  109. </nav>
  110. </template>
  111. <script>
  112. import UpdatePassword from './main-navbar-update-password'
  113. import UpdateLanguage from './main-navbar-update-language'
  114. import {clearLoginInfo} from '@/utils'
  115. import FileListView from './modules/common/file-list-view'
  116. import column from "./modules/common/column";
  117. import {
  118. searchFunctionButtonList,
  119. saveButtonList,
  120. searchSysLanguage,
  121. getRevisionInformation, // 获取版本信息
  122. } from "@/api/sysLanguage.js"
  123. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  124. export default {
  125. inject: ['refresh'],
  126. data() {
  127. return {
  128. // 是否收藏
  129. visible: false,
  130. updatePassowrdVisible: false,
  131. updateLanguageVisible: false,
  132. helpFileVisible: false,
  133. printListVisible: false,
  134. message: this.$t('language.name'),
  135. languageList: [],
  136. pageLanguage: {
  137. XjSysManage: '旭捷管理系统',
  138. abbreviation: '旭捷',
  139. setting: '设置',
  140. languageSetting: '语言设置',
  141. userSetting: '用户设置',
  142. updatePassword: '修改密码',
  143. updateDefaultLanguage: '修改默认语言',
  144. cssSetting: '主题设置',
  145. printSetting: '打印设置',
  146. revisionSetting: '版本说明'
  147. },
  148. // 导出 end
  149. pageLanguageList: [
  150. {
  151. functionId: "systemInformation",
  152. languageValue: '旭捷管理系统',
  153. objectId: 'XjSysManage',
  154. objectType: "label",
  155. tableId: "systemInformation"
  156. },
  157. {
  158. functionId: "systemInformation",
  159. languageValue: '首页',
  160. objectId: 'homePage',
  161. objectType: "label",
  162. tableId: "systemInformation"
  163. },
  164. {
  165. functionId: "systemInformation",
  166. languageValue: '旭捷',
  167. objectId: 'abbreviation',
  168. objectType: "label",
  169. tableId: "systemInformation"
  170. },
  171. {
  172. functionId: "systemInformation",
  173. languageValue: '设置',
  174. objectId: 'setting',
  175. objectType: "label",
  176. tableId: "systemInformation"
  177. },
  178. {
  179. functionId: "systemInformation",
  180. languageValue: '语言设置',
  181. objectId: 'languageSetting',
  182. objectType: "label",
  183. tableId: "systemInformation"
  184. },
  185. {
  186. functionId: "systemInformation",
  187. languageValue: '用户设置',
  188. objectId: 'userSetting',
  189. objectType: "label",
  190. tableId: "systemInformation"
  191. },
  192. {
  193. functionId: "systemInformation",
  194. languageValue: '修改密码',
  195. objectId: 'updatePassword',
  196. objectType: "label",
  197. tableId: "systemInformation"
  198. },
  199. {
  200. functionId: "systemInformation",
  201. languageValue: '修改用户语言',
  202. objectId: 'updateDefaultLanguage',
  203. objectType: "label",
  204. tableId: "systemInformation"
  205. },
  206. {
  207. functionId: "systemInformation",
  208. languageValue: '主题设置',
  209. objectId: 'cssSetting',
  210. objectType: "label",
  211. tableId: "systemInformation"
  212. },
  213. {
  214. functionId: "systemInformation",
  215. languageValue: '版本说明',
  216. objectId: 'revisionSetting',
  217. objectType: "label",
  218. tableId: "systemInformation"
  219. },
  220. {
  221. functionId: "systemInformation",
  222. languageValue: '打印设置',
  223. objectId: 'printSetting',
  224. objectType: "label",
  225. tableId: "systemInformation"
  226. }
  227. ],
  228. pending: {
  229. pendingReview: 0,
  230. pendingSum: 0,
  231. },
  232. queryToolReview: {
  233. site: this.$store.state.user.site,
  234. userId: this.$store.state.user.name,
  235. strUserId: this.$store.state.user.id,
  236. },
  237. toolReviewTimer: null,
  238. revisionData: {
  239. identityNo: '',
  240. company: '',
  241. regDate: '',
  242. serverName: '',
  243. revisionNo: '',
  244. installPath: '',
  245. registerNo: '',
  246. serialNo: '',
  247. registerMark: '',
  248. applicationName: '',
  249. customerIdentificationId: ''
  250. },
  251. revisionModalFlag: false
  252. }
  253. },
  254. watch: {
  255. pending: {
  256. deep: true,
  257. handler: function (newV, oldV) {
  258. this.pending.pendingSum = this.pending.pendingReview
  259. }
  260. },
  261. },
  262. components: {
  263. UpdatePassword,
  264. UpdateLanguage,
  265. FileListView,
  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. helpFileList() {
  330. let fileMappingDto = {
  331. fileId: '',
  332. fileType: '功能帮助文档',
  333. orderRef1: this.$route.meta.menuId,
  334. orderRef2: '',
  335. orderRef3: '',
  336. }
  337. this.helpFileVisible = true;
  338. this.$nextTick(() => {
  339. this.$refs.fileListView.init(fileMappingDto)
  340. })
  341. },
  342. // 获取多语言列表
  343. getLanguageList() {
  344. searchSysLanguage({languageCode: this.$i18n.locale}).then(({data}) => {
  345. this.languageList = data.rows
  346. })
  347. },
  348. // 获取页面多语言数据
  349. getFunctionButtonList() {
  350. let queryButton = {
  351. functionId: 'systemInformation',
  352. tableId: 'systemInformation',
  353. languageCode: this.$i18n.locale,
  354. objectType: 'label'
  355. }
  356. searchFunctionButtonList(queryButton).then(({data}) => {
  357. if (data.code === 0) {
  358. this.pageLanguage = data.data
  359. }
  360. })
  361. },
  362. // 注3:增加语言切换函数
  363. switch_the_language(val) {
  364. localStorage.setItem('locale', val)
  365. location.reload()
  366. },
  367. // 修改密码
  368. updatePasswordHandle() {
  369. this.updatePassowrdVisible = true
  370. this.$nextTick(() => {
  371. this.$refs.updatePassowrd.init()
  372. })
  373. },
  374. // 修改用户默认语言
  375. updateLanguageHandle() {
  376. this.updateLanguageVisible = true
  377. this.$nextTick(() => {
  378. this.$refs.updateLanguage.init()
  379. })
  380. },
  381. // 退出
  382. logoutHandle() {
  383. this.$confirm(`确定进行[退出]操作?`, '提示', {
  384. confirmButtonText: '确定',
  385. cancelButtonText: '取消',
  386. type: 'warning'
  387. }).then(() => {
  388. this.$http({
  389. url: this.$http.adornUrl('/sys/logout'),
  390. method: 'post',
  391. data: this.$http.adornData()
  392. }).then(({data}) => {
  393. if (data && data.code === 0) {
  394. clearLoginInfo()
  395. this.$router.push({name: 'login'})
  396. }
  397. })
  398. }).catch(() => {
  399. })
  400. },
  401. //收藏 OR 取消收藏
  402. favoriteFunction() {
  403. let userFavorite = {
  404. userId: this.$store.state.user.id,
  405. functionId: this.$route.meta.menuId,
  406. }
  407. if (this.$store.state.user.favorite) {
  408. // 取消收藏
  409. this.$confirm(`确定取消收藏`, '提示', {
  410. confirmButtonText: '确定',
  411. cancelButtonText: '取消',
  412. type: 'warning'
  413. }).then(() => {
  414. removeUserFavorite(userFavorite).then(({data}) => {
  415. this.$message.success(data.msg)
  416. this.$store.state.user.favorite = false
  417. })
  418. })
  419. } else {
  420. // 收藏
  421. saveUserFavorite(userFavorite).then(({data}) => {
  422. this.$message.success(data.msg)
  423. this.$store.state.user.favorite = true
  424. })
  425. }
  426. }
  427. },
  428. created() {
  429. this.getLanguageList()
  430. this.getFunctionButtonList()
  431. }
  432. }
  433. </script>
  434. <style lang="scss">
  435. .icon-svg {
  436. width: 2em;
  437. }
  438. .el-menu--collapse .el-menu .el-submenu, .el-menu--popup, .el-menu-item {
  439. min-width: 50px !important;
  440. }
  441. .site-navbar__brand-lg, .site-navbar__brand-mini {
  442. margin: 0 5px;
  443. color: #fff;
  444. margin-left: -45px;
  445. }
  446. .el-menu--horizontal > .el-menu-item {
  447. color: #3b4249;
  448. }
  449. .aaa div{
  450. margin-top: 10px;
  451. }
  452. .aaa {
  453. margin-bottom: 15px;
  454. }
  455. </style>