import request from '@/utils/request';

export default {
  //列表
  list: async (params) => {
    const res = await request.get('/main/producestep/page', { params });
    if (res.data.code == 0) {
      return res.data.data;
    }
    return Promise.reject(new Error(res.data.message));
  },
  //列表
  save: async (data) => {
    const res = await request.post('/main/producestep/save', data);
    if (res.data.code == 0) {
      return res.data;
    }
    return Promise.reject(new Error(res.data.message));
  },
  //详情
  getById: async (id) => {
    const res = await request.get(`/main/producestep/getById/${id}`);
    if (res.data.code == 0) {
      return res.data.data;
    }
    return Promise.reject(new Error(res.data.message));
  },
  //删除
  delete: async (data) => {
    const res = await request.delete('/main/producestep/delete', { data });
    if (res.data.code == 0) {
      return res.data.message;
    }
  }
};
