globalData.vue 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div>
  3. <!-- 该组件用于加载一些全局数据,在布局组件 AppMain.vue 中加载,放在根路径是为了便于查找 -->
  4. </div>
  5. </template>
  6. <script>
  7. import { getIp } from '@/utils'
  8. import { getTicketPrintModelList, getReceiptPrintModel } from '@/api/printModal'
  9. import whitePaper from '@/pages/systemSetting/printManage/vertical'
  10. import defaultSmallTicket from '@/pages/systemSetting/smallTicket/defaultTemp'
  11. export default {
  12. created () {
  13. getIp()
  14. // 获取打印模板
  15. // this.getReceiptPrintModel()
  16. // this.getTicketPrintModelList()
  17. this.$store.dispatch('setTravelAgencyType')
  18. // 获取所有票种列表
  19. this.$store.dispatch('getTicketTypeList')
  20. this.$store.dispatch('setCustomerType')
  21. // 设置全局 支付方式
  22. this.$store.dispatch('getPayChannel')
  23. // 获取票种分类
  24. // this.$store.dispatch('getTicketCategory')
  25. // 获取售票员列表
  26. this.$store.dispatch('getSalesList')
  27. // 获取自助机列表
  28. this.$store.dispatch('getTermDevices')
  29. // getMyAccount
  30. this.$store.dispatch('getMyAccount')
  31. // 获取销售渠道
  32. this.$store.dispatch('getSaleChannel')
  33. this.$store.dispatch('getSystemConfigList')
  34. // 获取旅行社列表
  35. // this.$store.dispatch('getAgencyList')
  36. // 获取景点列表
  37. this.$store.dispatch('getScenicList')
  38. // 获取账号信息
  39. // this.$store.dispatch('getAccount')
  40. // 获取场次信息
  41. // this.$store.dispatch('getBatchConfigList')
  42. },
  43. methods: {
  44. // 提前设置打印模板
  45. getTicketPrintModelList () {
  46. const params = {
  47. pageNum: 0,
  48. pageSize: -1,
  49. name: '',
  50. content: ''
  51. }
  52. getTicketPrintModelList(params).then(res => {
  53. const list = res.data.records
  54. let id = this.$localStore.get('defaultTemplate')
  55. let target = list.find(i => i.id === id)
  56. // 设置当前打印模板
  57. this.$store.commit('SET_PRINT_TEMPLATE', target ? JSON.parse(target.content) : whitePaper)
  58. // 设置打印模板列表
  59. list.length > 0 && this.$store.commit('SET_PRINT_TEMPLATE_LIST', list)
  60. })
  61. },
  62. getReceiptPrintModel () {
  63. getReceiptPrintModel().then(res => {
  64. let id = this.$localStore.get('defaultSmallTicketTemplate')
  65. const list = res.data.records
  66. let target = list.find(i => i.id === id)
  67. // 设置当前打印模板
  68. target && this.$store.commit('SET_SMALL_TICKET_TEMPLATE', target ? JSON.parse(target.content) : defaultSmallTicket)
  69. // 设置打印模板列表
  70. list.length > 0 && this.$store.commit('SET_SMALL_TICKET_TEMPLATE_LIST', res.list)
  71. })
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. </style>