import request from '@/utils/request';

export default {
  //列表
  list: async (params) => {
    const res = await request.get('/main/categoryparam/page', { params });
    if (res.data.code == 0) {
      return res.data.data;
    }
  },
  //详情
  getById: async (id) => {
    const res = await request.get(`/main/categoryparam/getById/${id}`);
    if (res.data.code == 0) {
      return res.data.data;
    }
  },
  //详情
  getCode: async () => {
    const res = await request.get(
      `/main/codemanage/getCode/process_parameters`
    );
    if (res.data.code == 0) {
      return res.data.data;
    }
  },
  //保存
  save: async (data) => {
    const res = await request.post('/main/categoryparam/save', data);

    if (res.data.code == 0) {
      return '保存' + res.data.message;
    }
  },
  //修改
  update: async (data) => {
    const res = await request.put('/main/categoryparam/update', data);
    if (res.data.code == 0) {
   
      return '修改' + res.data.message;
    }
  },
  //删除
  delete: async (data) => {
    const res = await request.delete('/main/categoryparam/delete', { data });
    if (res.data.code == 0) {
      return res.data.message;
    }
  },

    //详情
    getCategoryParam: async (categoryId) => {
      const res = await request.get(
        `/main/category/getCategoryParam/${categoryId}`
      );
      if (res.data.code == 0) {
        return res.data.data;
      }
    },
};

