enterpriseproject.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import Vue from 'vue';
  2. import Vuex from 'vuex';
  3. import _ from 'lodash';
  4. Vue.use(Vuex);
  5. const api = {
  6. columnInfo: `/api/market/product`,
  7. };
  8. const state = () => ({});
  9. const mutations = {};
  10. const actions = {
  11. async query({ commit }, { skip = 0, limit, ...info } = {}) {
  12. const res = await this.$axios.$get(`${api.columnInfo}`, {
  13. skip,
  14. limit,
  15. ...info,
  16. });
  17. return res;
  18. },
  19. async create({ commit }, payload) {
  20. const res = await this.$axios.$post(`${api.columnInfo}`, payload);
  21. return res;
  22. },
  23. async fetch({ commit }, payload) {
  24. const res = await this.$axios.$get(`${api.columnInfo}/${payload}`);
  25. return res;
  26. },
  27. async newfetch({ commit }, payload) {
  28. const res = await this.$axios.$get(`${api.columnInfo}/newfetch/${payload}`);
  29. return res;
  30. },
  31. async newquery({ commit }, { skip = 0, limit, ...info } = {}) {
  32. const res = await this.$axios.$get(`${api.columnInfo}`, {
  33. skip,
  34. limit,
  35. ...info,
  36. });
  37. return res;
  38. },
  39. async update({ commit }, { id, ...data }) {
  40. const res = await this.$axios.$post(`${api.columnInfo}/update/${id}`, data);
  41. return res;
  42. },
  43. async delete({ commit }, payload) {
  44. const res = await this.$axios.$delete(`${api.columnInfo}/${payload}`);
  45. return res;
  46. },
  47. };
  48. export default {
  49. namespaced: true,
  50. state,
  51. mutations,
  52. actions,
  53. };