index.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. import Vue from 'vue';
  2. import Vuex from 'vuex';
  3. import axios from 'axios'
  4. import api from '../api/api'
  5. import tool from '../utils/tool'
  6. Vue.use(Vuex);
  7. export default new Vuex.Store({
  8. state: {
  9. pageOnlyRead:false,
  10. loading:false,
  11. siteinfo:{
  12. attinfos:[]
  13. },
  14. deplist:[],
  15. sys_options:[],
  16. shortcutlist:[],
  17. active_modules:{},
  18. checks:[],
  19. dataToForm:{}
  20. },
  21. getters: {
  22. siteinfo:state => state.siteinfo,
  23. loading:state => state.loading,
  24. deplist:state => state.deplist,
  25. sys_options:state => state.sys_options,
  26. pageOnlyRead:state => state.pageOnlyRead,
  27. shortcutlist:state => state.shortcutlist,
  28. active_modules:state => state.active_modules,
  29. checks:state => state.checks,
  30. dataToForm:state => state.dataToForm
  31. },
  32. mutations: {
  33. setSiteInfo(state,res) {
  34. state.siteinfo = res.data
  35. },
  36. setDeplist (state,res) {
  37. state.deplist = res
  38. },
  39. setSelectList (state,res) {
  40. state.sys_options = res.data
  41. },
  42. setUsershortcuts (state,param) {
  43. state.shortcutlist = [...param]
  44. },
  45. pageOnlyRead (state,bool) {
  46. state.pageOnlyRead = bool
  47. },
  48. checkClass (state,id) {
  49. state.checks.push(id)
  50. state.checks = [...new Set(state.checks)]
  51. },
  52. uncheckClass (state,id) {
  53. state.checks = state.checks.filter(e=>{
  54. return e !== id
  55. })
  56. },
  57. sendDataToForm (state,data) {
  58. state.dataToForm = data
  59. },
  60. },
  61. actions: {
  62. // 系统选项分类查询
  63. optiontypeselect ({commit}, param) {
  64. return new Promise(async (reslove,reject)=>{
  65. let obj = {
  66. "classname": "sysmanage.develop.optiontype.optiontype",
  67. "method": "optiontypeselect",
  68. "content": {
  69. "pageNumber": 1,
  70. "pageSize": 1000,
  71. "typename": param,
  72. "parameter": {
  73. }
  74. }
  75. }
  76. const res = await api.requested(obj)
  77. commit('setSelectList',res)
  78. reslove(res)
  79. })
  80. },
  81. // 查询站点信息
  82. async querySiteInfo ({commit}, param) {
  83. const res = await api.requested(param)
  84. commit('setSiteInfo',res)
  85. },
  86. // 创建下载记录
  87. async createdownlog ({commit}, param) {
  88. let obj = {
  89. "classname": "system.attachment.Attachment",
  90. "method": "createdownlog",
  91. "content": {
  92. "linksid": param.linksid,
  93. "attachmentid":param.attachmentid
  94. }
  95. }
  96. const res = await api.requested(obj)
  97. },
  98. // 存储部门列表数据
  99. setDeplistData ({commit}, param) {
  100. commit('setDeplist',param)
  101. },
  102. // 设置快捷栏
  103. async setUsershortcuts ({commit}, param) {
  104. const res = await api.requested({
  105. "classname": "sysmanage.develop.userauthforweb.userauth",
  106. "method": "query_usershortcuts",
  107. "content": {
  108. }
  109. })
  110. let data = JSON.parse(sessionStorage.getItem('module_info'))
  111. let modules = []
  112. data.forEach(mod => {
  113. modules = modules.concat(mod.modules)
  114. });
  115. let arr = []
  116. res.data.forEach(e=>{
  117. modules.forEach(mod=>{
  118. if (mod.systemmoduleid === e.systemmoduleid) {
  119. mod.issystem = e.issystem
  120. arr.push(mod)
  121. }
  122. })
  123. })
  124. commit('setUsershortcuts',arr)
  125. },
  126. // 查询标签数据
  127. async queryTagList ({commit}, param) {
  128. return new Promise(async (reslove,reject)=>{
  129. let obj = {
  130. "id": 20220929085401,
  131. "content": {
  132. "ownertable":param.table,
  133. "ownerid":param.id
  134. }
  135. }
  136. const res = await api.requested(obj)
  137. reslove(res.data)
  138. })
  139. },
  140. // 设置权限状态
  141. pageOnlyRead ({commit}, bool) {
  142. commit('pageOnlyRead',bool)
  143. },
  144. checkClass ({commit}, id) {
  145. commit('checkClass',id)
  146. },
  147. uncheckClass ({commit}, id) {
  148. commit('uncheckClass',id)
  149. },
  150. // 主文件向Form中的组件传值
  151. sendDataToForm ({commit}, data) {
  152. commit('sendDataToForm',data)
  153. },
  154. },
  155. modules: {
  156. },
  157. });