index.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import { get, postJ, deleteApi } from "@/utils/request";
  2. import Vue from "vue";
  3. // 质检报告列表
  4. export async function getReportList(data) {
  5. const res = await get(
  6. Vue.prototype.apiUrl + "/qms/quality_work_order/pageByReport",
  7. data,
  8. );
  9. if (res.code == 0) {
  10. return res.data;
  11. }
  12. return Promise.reject(new Error(res.message));
  13. }
  14. // 检测报告基本信息
  15. export async function queryInspectionReportData({ id, type }) {
  16. const res = await get(
  17. Vue.prototype.apiUrl +
  18. `/qms/quality_work_order/queryInspectionReportData/${id}`,
  19. { type },
  20. );
  21. if (res.code == 0) {
  22. return res.data;
  23. }
  24. return Promise.reject(new Error(res.message));
  25. }
  26. // 检测报告检测项列表信息
  27. export async function queryInspectionReportList({ id, type }) {
  28. const res = await get(
  29. Vue.prototype.apiUrl +
  30. `/qms/quality_work_order/queryInspectionReportList/${id}`,
  31. { type },
  32. );
  33. if (res.code == 0) {
  34. return res.data;
  35. }
  36. return Promise.reject(new Error(res.message));
  37. }
  38. // 生成/修改检测报告
  39. export async function generateReport(data) {
  40. const res = await postJ(
  41. Vue.prototype.apiUrl + "/qms/quality_work_order/generateReport",
  42. data,
  43. );
  44. if (res.code == 0) {
  45. return res.data;
  46. }
  47. return Promise.reject(new Error(res.message));
  48. }
  49. // 报表模板分页查询(质检工单生成报告时选择模板)
  50. export async function getQmsReportTemplatePageList(params) {
  51. const res = await get(
  52. Vue.prototype.apiUrl + "/main/qmsreporttemplate/page",
  53. params,
  54. );
  55. if (res.code == 0) {
  56. return res.data;
  57. }
  58. return Promise.reject(new Error(res.message));
  59. }
  60. // 生成编码(报告单号)
  61. export async function getCode(code) {
  62. const res = await get(
  63. Vue.prototype.apiUrl + `/main/codemanage/getCode/${code}`,
  64. );
  65. if (res.code == 0) {
  66. return res.data;
  67. }
  68. return Promise.reject(new Error(res.message));
  69. }
  70. // 删除检测报告
  71. export async function deleteReport(id) {
  72. const res = await deleteApi(
  73. Vue.prototype.apiUrl + `/qms/quality_work_order/deleteReport/${id}`,
  74. );
  75. if (res.code == 0) {
  76. return res.data;
  77. }
  78. return Promise.reject(new Error(res.message));
  79. }
  80. /**
  81. * 不合格品台账列表
  82. */
  83. export async function getList(data) {
  84. let par = new URLSearchParams(data);
  85. const res = await get(
  86. Vue.prototype.apiUrl + `/qms/unqualifiedproducts/page?` + par,
  87. );
  88. if (res.code == 0) {
  89. return res.data;
  90. }
  91. return Promise.reject(new Error(res.message));
  92. }
  93. // 详情页面
  94. export async function getById(id) {
  95. const res = await get(
  96. Vue.prototype.apiUrl + `/qms/unqualifiedproducts/getById/${id}`,
  97. );
  98. if (res.code == 0) {
  99. return res.data;
  100. }
  101. return Promise.reject(new Error(res.message));
  102. }