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.

376 lines
12 KiB

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