index.ts 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import Vue from 'vue'
  2. import Vuex from 'vuex'
  3. // @ts-ignore
  4. import { queryfmapID, queryFloor } from '@/api/login.js'
  5. // @ts-ignore
  6. import { queryBrand } from '@/api/public.js'
  7. Vue.use(Vuex)
  8. export default new Vuex.Store({
  9. state: {
  10. ssoToken: 'admin:liujiandong',
  11. appTitle: '管理说明书', //顶部标题
  12. // ssoToken: null,
  13. // plazaId: '1000772', //项目Id 北京通州
  14. plazaId: '1000423', //项目Id 大连高新
  15. fmapID: '',
  16. haveFengMap: -1, //是否有蜂鸟地图的数据 -1为等待 0 为失败 1 为成功
  17. isMessage: true, //是否有发布的图
  18. bunkObj: {}, // 铺位名称
  19. floorsArr: [], //楼层数组
  20. categoryId: "", //系统类型
  21. smsxt: "", //设备设施系统编码
  22. // 事件类型字典
  23. objtypeDict: {
  24. 1: '重要维保',
  25. 3: '综合事项',
  26. 4: '重要维修',
  27. 5: '其他事项',
  28. },
  29. },
  30. getters: {
  31. ssoToken: (state) => state.ssoToken,
  32. appTitle: (state) => state.appTitle,
  33. plazaId: (state) => state.plazaId,
  34. fmapID: (state) => state.fmapID,
  35. haveFengMap: (state) => state.haveFengMap,
  36. isMessage: (state) => state.isMessage,
  37. bunkObj: (state) => state.bunkObj,
  38. objtypeDict: (state) => state.objtypeDict,
  39. floorsArr: (state) => state.floorsArr,
  40. categoryId: (state) => state.categoryId,
  41. smsxt: (state) => state.smsxt,
  42. },
  43. mutations: {
  44. SETSSOTOKEN(state, data) {
  45. state.ssoToken = data
  46. },
  47. SETAPPTITLE(state, data) {
  48. state.appTitle = data
  49. },
  50. SETPLAZAID(state, data) {
  51. state.plazaId = data
  52. },
  53. SETMAPID(state, data) {
  54. state.fmapID = data
  55. },
  56. SETHAVEFENGMAP(state, data) {
  57. state.haveFengMap = data
  58. },
  59. SETISMESSAGE(state, data) {
  60. state.isMessage = data
  61. },
  62. SETBUNKOBJ(state, data) {
  63. state.bunkObj = data
  64. },
  65. // 设置楼层列表
  66. SETFLOORS(state, data) {
  67. state.floorsArr = data
  68. },
  69. // 设置系统类型
  70. SETCATEGORYID(state, data) {
  71. state.categoryId = data
  72. },
  73. // 设置设备设施系统编码
  74. SETSMSXT(state, data) {
  75. state.smsxt = data
  76. },
  77. },
  78. actions: {
  79. async getfmapID(context) {
  80. await queryfmapID({
  81. mapId: context.state.plazaId,
  82. }).then((res) => {
  83. context.commit('SETMAPID', `${context.state.plazaId}_${res.mapVersion}`)
  84. })
  85. },
  86. async getBrand(context) {
  87. let data = {
  88. plazaId: `${context.state.plazaId}`,
  89. }
  90. await queryBrand({
  91. data,
  92. }).then((res) => {
  93. let obj = {}
  94. if (res.data.data) {
  95. let Data = res.data.data
  96. Data.forEach((i) => {
  97. obj[i.bunkdesc] = i
  98. })
  99. }
  100. context.commit('SETBUNKOBJ', obj)
  101. })
  102. },
  103. /**
  104. * 获取楼层列表
  105. * @param context
  106. */
  107. async getFloors(context) {
  108. await queryFloor({
  109. plazaId: context.state.plazaId,
  110. }).then((res: any) => {
  111. if (res.result == 'success') {
  112. context.commit('SETFLOORS', res.data)
  113. }
  114. })
  115. },
  116. },
  117. modules: {},
  118. })