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.

388 lines
12 KiB

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