index.ts 690 B

12345678910111213141516171819202122232425262728293031
  1. import Vue from 'vue'
  2. import Vuex from 'vuex'
  3. import { getGraphElementType } from "@/api/editer.js"
  4. Vue.use(Vuex)
  5. export default new Vuex.Store({
  6. state: {
  7. GraphCategoryIds: ['NTXT'], //系统类型
  8. TypeIdToGraphElement:{}, //typeid到图例元素的映射
  9. },
  10. mutations: {
  11. TypeIdToGraphElement(state,data){
  12. if (data.length) {
  13. state.TypeIdToGraphElement = {}
  14. data.forEach(t => {
  15. state.TypeIdToGraphElement[t.Id] = t;
  16. })
  17. }
  18. }
  19. },
  20. actions: {
  21. getElementType({ commit }, params) {
  22. getGraphElementType(params).then(res => {
  23. commit('TypeIdToGraphElement',res.Content)
  24. })
  25. }
  26. },
  27. modules: {
  28. }
  29. })