index.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // 抽样记录
  2. import {
  3. get,
  4. put,
  5. postJ,putJ,
  6. deleteApi
  7. } from "@/utils/request";
  8. import Vue from "vue";
  9. // 分页
  10. export async function samplingRecordsPage(params) {
  11. const res = await get(Vue.prototype.apiUrl + `/qms/samplingrecord/page`, params);
  12. if (res.code == 0) {
  13. return res.data;
  14. }
  15. return Promise.reject(new Error(res.message));
  16. }
  17. // 取样新建/修改
  18. export async function samplingrecordSave(data) {
  19. const res = await postJ(Vue.prototype.apiUrl + `/qms/samplingrecord/save`, data);
  20. if (res.code == 0) {
  21. return res.data;
  22. }
  23. return Promise.reject(new Error(res.message));
  24. }
  25. // 取样新建/修改
  26. export async function samplingrecordUpdate(data) {
  27. const res = await putJ(Vue.prototype.apiUrl + `/qms/samplingrecord/update`, data);
  28. if (res.code == 0) {
  29. return res.data;
  30. }
  31. return Promise.reject(new Error(res.message));
  32. }
  33. // 详情
  34. export async function getById(id) {
  35. const res = await get(Vue.prototype.apiUrl + `/qms/samplingrecord/getById/${id}`);
  36. if (res.code == 0) {
  37. return res.data;
  38. }
  39. return Promise.reject(new Error(res.message));
  40. }
  41. // 作废
  42. export async function listCancel(data) {
  43. const res = await putJ(Vue.prototype.apiUrl + `/qms/samplingrecord/cancel`, data);
  44. if (res.code == 0) {
  45. return res.data;
  46. }
  47. return Promise.reject(new Error(res.message));
  48. }