import request from '@/utils/request';

export default {
  //列表
  list: async (params) => {
    const res = await request.get('/main/producetask/page', { params });
    if (res.data.code == 0) {
      return res.data.data;
    }
  },
  //获取工艺所属参数列表
  paramList: async (params) => {
    const res = await request.get('/main/producetask/param/page', { params });
    if (res.data.code == 0) {
      return res.data.data;
    }
  },
  //保存工艺所属参数列表
  paramSave: async (data) => {
    const res = await request.post('/main/producetask/param/save', data);
    if (res.data.code == 0) {
      return res.data.message;
    }
  },
  //详情
  getById: async (id) => {
    const res = await request.get(`/main/producetask/getById/${id}`);
    if (res.data.code == 0) {
      return res.data.data;
    }
  },
  //详情
  getCode: async () => {
    const res = await request.get(
      `/main/codemanage/getCode/process_management`
    );
    if (res.data.code == 0) {
      return res.data.data;
    }
  },
  //保存
  save: async (data) => {
    const res = await request.post('/main/producetask/save', data);
    if (res.data.code == 0) {
      return res.data;
    }
  },
  //删除
  delete: async (data) => {
    const res = await request.delete('/main/producetask/delete', { data });
    if (res.data.code == 0) {
      return res.data.message;
    }
  }
};
