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.

399 lines
11 KiB

2 years ago
1 year ago
2 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" style="font-size: 13px">
  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:;"> <span style="display: inline-block;width: 20px"></span>{{ 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-submenu index="3">
  27. <template slot="title">{{ pageLanguage.setting }}</template>
  28. <el-submenu index="2-1" v-if="false">
  29. <template slot="title">{{ pageLanguage.languageSetting }}</template>
  30. <el-menu-item index="2-1-1" :key="index" :value="item.languageCode" v-for="(item,index) in languageList "
  31. @click.native="switch_the_language(item.languageCode)">{{ item.languageName }}
  32. </el-menu-item>
  33. </el-submenu>
  34. <el-submenu index="2-2">
  35. <template slot="title">{{ pageLanguage.userSetting }}</template>
  36. <el-menu-item index="2-2-1" @click.native="updatePasswordHandle()">{{ pageLanguage.updatePassword }}
  37. </el-menu-item>
  38. <!-- <el-menu-item index="2-2-2" @click.native="updateLanguageHandle()">{{ pageLanguage.updateDefaultLanguage }}-->
  39. <!-- </el-menu-item>-->
  40. </el-submenu>
  41. <!-- <el-menu-item index="2-3" @click="$router.push({ name: 'theme' })">{{ pageLanguage.cssSetting }}-->
  42. <!-- </el-menu-item>-->
  43. </el-submenu>
  44. <el-menu-item class="site-navbar__avatar" index="4">
  45. <el-dropdown :show-timeout="0" placement="bottom">
  46. <span class="el-dropdown-link">
  47. <img src="~@/assets/img/avatar.png" :alt="userName">{{ userName }}
  48. </span>
  49. <el-dropdown-menu slot="dropdown">
  50. <el-dropdown-item @click.native="logoutHandle()">{{ pageLanguage.logout }}</el-dropdown-item>
  51. </el-dropdown-menu>
  52. </el-dropdown>
  53. </el-menu-item>
  54. </el-menu>
  55. </div>
  56. <!-- 弹窗, 修改密码 -->
  57. <update-password v-if="updatePassowrdVisible" ref="updatePassowrd"></update-password>
  58. <!-- 弹窗, 修改默认语言 -->
  59. <update-language v-if="updateLanguageVisible" ref="updateLanguage"></update-language>
  60. <!-- 动态列 -->
  61. <column v-if="visible" ref="column" @refreshData="getTableUserColumn" v-drag></column>
  62. </nav>
  63. </template>
  64. <script>
  65. import UpdatePassword from './main-navbar-update-password'
  66. import UpdateLanguage from './main-navbar-update-language'
  67. import {clearLoginInfo} from '@/utils'
  68. import column from "./modules/common/column";
  69. import {
  70. searchFunctionButtonList,
  71. saveButtonList,
  72. searchSysLanguage,
  73. } from "@/api/sysLanguage.js"
  74. import {
  75. getReviewToolCount
  76. } from '@/api/purchaseorder/procurementReview.js'
  77. export default {
  78. inject: ['refresh'],
  79. data() {
  80. return {
  81. visible: false,
  82. updatePassowrdVisible: false,
  83. updateLanguageVisible: false,
  84. message: this.$t('language.name'),
  85. languageList: [],
  86. pageLanguage: {
  87. XjSysManage: 'Label Printing Platform',
  88. abbreviation: '旭捷',
  89. setting: '设置',
  90. languageSetting: '语言设置',
  91. userSetting: '用户设置',
  92. updatePassword: '修改密码',
  93. updateDefaultLanguage: '修改默认语言',
  94. cssSetting: '主提设置',
  95. logout: '退出',
  96. logoutMsg: '确定进行[退出]操作?',
  97. prompt: '提示',
  98. },
  99. pageButton:{
  100. confirmButton: '确认',
  101. cancelButton: '取消',
  102. },
  103. // 导出 end
  104. pageLanguageList: [
  105. {
  106. functionId: "systemInformation",
  107. languageValue: '旭捷管理系统',
  108. objectId: 'XjSysManage',
  109. objectType: "label",
  110. tableId: "systemInformation"
  111. },
  112. {
  113. functionId: "systemInformation",
  114. languageValue: 'Home',
  115. objectId: 'homePage',
  116. objectType: "label",
  117. tableId: "systemInformation"
  118. },
  119. {
  120. functionId: "systemInformation",
  121. languageValue: '旭捷',
  122. objectId: 'abbreviation',
  123. objectType: "label",
  124. tableId: "systemInformation"
  125. },
  126. {
  127. functionId: "systemInformation",
  128. languageValue: '设置',
  129. objectId: 'setting',
  130. objectType: "label",
  131. tableId: "systemInformation"
  132. },
  133. {
  134. functionId: "systemInformation",
  135. languageValue: '语言设置',
  136. objectId: 'languageSetting',
  137. objectType: "label",
  138. tableId: "systemInformation"
  139. },
  140. {
  141. functionId: "systemInformation",
  142. languageValue: '用户设置',
  143. objectId: 'userSetting',
  144. objectType: "label",
  145. tableId: "systemInformation"
  146. },
  147. {
  148. functionId: "systemInformation",
  149. languageValue: '修改密码',
  150. objectId: 'updatePassword',
  151. objectType: "label",
  152. tableId: "systemInformation"
  153. },
  154. {
  155. functionId: "systemInformation",
  156. languageValue: '修改用户语言',
  157. objectId: 'updateDefaultLanguage',
  158. objectType: "label",
  159. tableId: "systemInformation"
  160. },
  161. {
  162. functionId: "systemInformation",
  163. languageValue: '主题设置',
  164. objectId: 'cssSetting',
  165. objectType: "label",
  166. tableId: "systemInformation"
  167. },
  168. {
  169. functionId: "systemInformation",
  170. languageValue: '打印设置',
  171. objectId: 'printSetting',
  172. objectType: "label",
  173. tableId: "systemInformation"
  174. }
  175. ],
  176. pending: {
  177. pendingReview: 0,
  178. pendingSum: 0,
  179. },
  180. queryToolReview: {
  181. site: this.$store.state.user.site,
  182. userId: this.$store.state.user.name,
  183. strUserId: this.$store.state.user.id,
  184. },
  185. toolReviewTimer: null,
  186. }
  187. },
  188. watch: {
  189. pending: {
  190. deep: true,
  191. handler: function (newV, oldV) {
  192. this.pending.pendingSum = this.pending.pendingReview
  193. }
  194. },
  195. },
  196. components: {
  197. UpdatePassword,
  198. UpdateLanguage,
  199. column,
  200. },
  201. computed: {
  202. navbarLayoutType: {
  203. get() {
  204. return this.$store.state.common.navbarLayoutType
  205. }
  206. },
  207. sidebarFold: {
  208. get() {
  209. return this.$store.state.common.sidebarFold
  210. },
  211. set(val) {
  212. this.$store.commit('common/updateSidebarFold', val)
  213. }
  214. },
  215. mainTabs: {
  216. get() {
  217. return this.$store.state.common.mainTabs
  218. },
  219. set(val) {
  220. this.$store.commit('common/updateMainTabs', val)
  221. }
  222. },
  223. userName: {
  224. get() {
  225. return this.$store.state.user.userDisplay
  226. }
  227. }
  228. },
  229. activated() {
  230. },
  231. mounted() {
  232. //this.toolReviewTimer = setInterval(this.getReviewToolCount, 1000 * 60);
  233. },
  234. beforeDestroy() {
  235. clearInterval(this.toolReviewTimer);
  236. },
  237. methods: {
  238. // 打开页面设置
  239. userSetting() {
  240. this.visible = true;
  241. let queryTable = {
  242. userId: this.$store.state.user.name,
  243. functionId: this.$route.meta.menuId,
  244. languageCode: this.$i18n.locale,
  245. tableId: '',
  246. }
  247. this.$nextTick(() => {
  248. this.$refs.column.init(queryTable);
  249. })
  250. },
  251. getTableUserColumn() {
  252. this.$nextTick(() => {
  253. this.refresh()
  254. })
  255. },
  256. // 获取待审核的是工具申请单数量
  257. getReviewToolCount() {
  258. getReviewToolCount(this.queryToolReview).then(({data}) => {
  259. if (data.code == 0) {
  260. this.pending.pendingReview = data.data
  261. }
  262. })
  263. },
  264. // 打印机列表
  265. printList() {
  266. this.printListVisible = true;
  267. this.$nextTick(() => {
  268. this.$refs.userPrintList.init()
  269. })
  270. },
  271. // 帮助文档列表
  272. helpFileList() {
  273. let fileMappingDto = {
  274. fileId: '',
  275. fileType: '功能帮助文档',
  276. orderRef1: this.$route.meta.menuId,
  277. orderRef2: '',
  278. orderRef3: '',
  279. }
  280. this.helpFileVisible = true;
  281. this.$nextTick(() => {
  282. this.$refs.fileListView.init(fileMappingDto)
  283. })
  284. },
  285. // 获取多语言列表
  286. getLanguageList() {
  287. searchSysLanguage({languageCode: this.$i18n.locale}).then(({data}) => {
  288. this.languageList = data.rows
  289. })
  290. },
  291. // 获取页面多语言数据
  292. getFunctionLabelList() {
  293. let queryLabel = {
  294. functionId: 'systemInformation',
  295. tableId: 'systemInformation',
  296. languageCode: this.$i18n.locale,
  297. objectType: 'label'
  298. };
  299. searchFunctionButtonList(queryLabel).then(({data}) => {
  300. if (data.code === 0) {
  301. this.pageLanguage = data.data
  302. }
  303. })
  304. },
  305. // 获取页面多语言数据
  306. getFunctionButtonList() {
  307. let queryButton = {
  308. functionId: 'systemInformation',
  309. tableId: 'systemInformation',
  310. languageCode: this.$i18n.locale,
  311. objectType: 'button'
  312. };
  313. searchFunctionButtonList(queryButton).then(({data}) => {
  314. if (data.code === 0) {
  315. this.pageButton = data.data
  316. }
  317. })
  318. },
  319. // 注3:增加语言切换函数
  320. switch_the_language(val) {
  321. localStorage.setItem('locale', val)
  322. location.reload()
  323. },
  324. // 修改密码
  325. updatePasswordHandle() {
  326. this.updatePassowrdVisible = true
  327. this.$nextTick(() => {
  328. this.$refs.updatePassowrd.init()
  329. })
  330. },
  331. // 修改用户默认语言
  332. updateLanguageHandle() {
  333. this.updateLanguageVisible = true
  334. this.$nextTick(() => {
  335. this.$refs.updateLanguage.init()
  336. })
  337. },
  338. // 退出
  339. logoutHandle() {
  340. this.$confirm(this.pageLanguage.logoutMsg, this.pageLanguage.prompt, {
  341. confirmButtonText: this.pageButton.confirmButton,
  342. cancelButtonText: this.pageButton.cancelButton,
  343. type: 'warning'
  344. }).then(() => {
  345. this.$http({
  346. url: this.$http.adornUrl('/sys/logout'),
  347. method: 'post',
  348. data: this.$http.adornData()
  349. }).then(({data}) => {
  350. if (data && data.code === 0) {
  351. clearLoginInfo()
  352. this.$router.push({name: 'login'})
  353. }
  354. })
  355. }).catch(() => {
  356. })
  357. }
  358. },
  359. created() {
  360. this.getLanguageList()
  361. this.getFunctionButtonList();
  362. this.getFunctionLabelList();
  363. }
  364. }
  365. </script>
  366. <style lang="scss">
  367. .icon-svg {
  368. width: 2em;
  369. }
  370. .el-menu--collapse .el-menu .el-submenu, .el-menu--popup, .el-menu-item {
  371. min-width: 50px !important;
  372. }
  373. .site-navbar__brand-lg, .site-navbar__brand-mini {
  374. margin: 0 5px;
  375. color: #fff;
  376. margin-left: -45px;
  377. }
  378. .el-menu--horizontal > .el-menu-item {
  379. color: #3b4249;
  380. }
  381. </style>