dictionary.js 640 B

12345678910111213141516171819202122232425
  1. import Vue from 'vue';
  2. import Vuex from 'vuex';
  3. import _ from 'lodash';
  4. Vue.use(Vuex);
  5. const api = {
  6. dictionary: '/code/{type}/items', //type === xzqh:query:level(1/2);parent(无/code)
  7. };
  8. export const state = () => ({});
  9. export const mutations = {};
  10. export const actions = {
  11. // 字典表
  12. async dicOperation({ state }, type) {
  13. let result;
  14. if (!_.isObject(type)) {
  15. result = await this.$axios.$get(api.dictionary, { type: type });
  16. } else {
  17. let { level, parent } = type;
  18. result = await this.$axios.$get(api.dictionary, { type: 'xzqh' }, { level: level, parent: parent });
  19. }
  20. return result;
  21. },
  22. };