index.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. import { get, put, putJ, postJ, deleteApi } from "@/utils/request";
  2. import Vue from "vue";
  3. // 列表
  4. export async function getList(data) {
  5. const res = await postJ(
  6. Vue.prototype.apiUrl + "/qms/quality_work_order/page",
  7. data,
  8. );
  9. if (res.code == 0) {
  10. return res.data;
  11. }
  12. return Promise.reject(new Error(res.message));
  13. }
  14. export async function getById(id) {
  15. const res = await get(
  16. Vue.prototype.apiUrl + `/qms/quality_work_order/getById/${id}`,
  17. );
  18. if (res.code == 0) {
  19. return res.data;
  20. }
  21. return Promise.reject(new Error(res.message));
  22. }
  23. // 获取详情 受托单
  24. export async function getRequestentrustById(id) {
  25. const res = await get(
  26. Vue.prototype.apiUrl + `/qms/requestentrust/getById/${id}`,
  27. );
  28. if (res.code == 0) {
  29. return res.data;
  30. }
  31. return Promise.reject(new Error(res.message));
  32. }
  33. // 获取详情 任务单
  34. export async function getTaskmonadById(id) {
  35. const res = await get(Vue.prototype.apiUrl + `/qms/taskmonad/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 update(data) {
  43. const res = await postJ(
  44. Vue.prototype.apiUrl + `/qms/quality_work_order/update`,
  45. data,
  46. );
  47. if (res.code == 0) {
  48. return res.message;
  49. }
  50. return Promise.reject(new Error(res.message));
  51. }
  52. //单个质检项保存
  53. export async function exeReportWorkBySingleTemplate(data) {
  54. const res = await postJ(
  55. Vue.prototype.apiUrl +
  56. `/qms/quality_work_order/exeReportWorkBySingleTemplate`,
  57. data,
  58. );
  59. if (res.code == 0) {
  60. return res.message;
  61. }
  62. return Promise.reject(new Error(res.message));
  63. }
  64. //单个质检项保存 任务
  65. export async function exeReportWorkBySingleTaskmonad(data) {
  66. const res = await postJ(
  67. Vue.prototype.apiUrl + `/qms/taskmonad/exeReportWorkBySingleTemplate`,
  68. data,
  69. );
  70. if (res.code == 0) {
  71. return res.message;
  72. }
  73. return Promise.reject(new Error(res.message));
  74. }
  75. //单个质检项保存 s受托
  76. export async function exeReportWorkBySingleRequestentrust(data) {
  77. const res = await postJ(
  78. Vue.prototype.apiUrl + `/qms/requestentrust/exeReportWorkBySingleTemplate`,
  79. data,
  80. );
  81. if (res.code == 0) {
  82. return res.message;
  83. }
  84. return Promise.reject(new Error(res.message));
  85. }
  86. // 查询工厂列表-分页
  87. export async function getFactoryarea(params) {
  88. const res = await get(
  89. Vue.prototype.apiUrl + `/main/factoryarea/page`,
  90. params,
  91. );
  92. if (res.code == 0) {
  93. return res.data;
  94. }
  95. return Promise.reject(new Error(res.message));
  96. }
  97. // 受托单列表
  98. export async function getRequestentrustList(params) {
  99. const res = await get(
  100. Vue.prototype.apiUrl + `/qms/requestentrust/page`,
  101. params,
  102. );
  103. if (res.code == 0) {
  104. return res.data;
  105. }
  106. return Promise.reject(new Error(res.message));
  107. }
  108. // 任务单列表
  109. export async function getTaskmonadList(params) {
  110. const res = await get(Vue.prototype.apiUrl + `/qms/taskmonad/page`, params);
  111. if (res.code == 0) {
  112. return res.data;
  113. }
  114. return Promise.reject(new Error(res.message));
  115. }
  116. // 报工校验
  117. export async function verificationQualityInspector(id) {
  118. const res = await postJ(
  119. Vue.prototype.apiUrl +
  120. `/qms/quality_work_order/verificationQualityInspector/${id}`,
  121. );
  122. return res.code;
  123. }
  124. //收样
  125. export async function sampleCollection(data) {
  126. const res = await putJ(
  127. Vue.prototype.apiUrl + `/qms/quality_work_order/sampleCollection`,
  128. data,
  129. );
  130. if (res.code == 0) {
  131. return res.data;
  132. }
  133. return Promise.reject(new Error(res.message));
  134. }
  135. //实验
  136. // 获取详情
  137. export async function getByIdExperiment(id) {
  138. const res = await get(Vue.prototype.apiUrl + `/qms/experiment/getById/${id}`);
  139. if (res.code == 0) {
  140. return res.data;
  141. }
  142. return Promise.reject(new Error(res.message));
  143. }
  144. // 保存
  145. export async function saveExperiment(data) {
  146. const res = await postJ(Vue.prototype.apiUrl + `/qms/experiment/save`, data);
  147. if (res.code == 0) {
  148. return res.message;
  149. }
  150. return Promise.reject(new Error(res.message));
  151. }
  152. // 修改
  153. export async function updateExperiment(data) {
  154. const res = await putJ(Vue.prototype.apiUrl + `/qms/experiment/update`, data);
  155. if (res.code == 0) {
  156. return res.message;
  157. }
  158. return Promise.reject(new Error(res.message));
  159. }
  160. // 检查质检工单是否可以请样
  161. export async function checkByQualityWorkOrderId(qualityWorkOrderId) {
  162. const res = await get(
  163. Vue.prototype.apiUrl +
  164. `/qms/samplingrecord/checkByQualityWorkOrderId/${qualityWorkOrderId}`,
  165. );
  166. if (res.code == 0) {
  167. return res.data;
  168. }
  169. return Promise.reject(new Error(res.message));
  170. }
  171. // 根据质检工单id获取清单列表
  172. export async function queryQualityInventory(data) {
  173. const res = await postJ(
  174. Vue.prototype.apiUrl + `/qms/quality_work_order/query_quality_inventory`,
  175. data,
  176. );
  177. if (res.code == 0) {
  178. return res.data;
  179. }
  180. return Promise.reject(new Error(res.message));
  181. }
  182. // 根据质检工单id获取质检样品列表
  183. export async function queryQualitySamplContent(data) {
  184. const res = await postJ(
  185. Vue.prototype.apiUrl +
  186. `/qms/quality_work_order/query_quality_sampl_content`,
  187. data,
  188. );
  189. if (res.code == 0) {
  190. return res.data;
  191. }
  192. return Promise.reject(new Error(res.message));
  193. }
  194. // 根据质检工单id获取方案内容
  195. export async function queryQualityTempleContent(data) {
  196. const res = await postJ(
  197. Vue.prototype.apiUrl +
  198. `/qms/quality_work_order/query_quality_temple_content`,
  199. data,
  200. );
  201. if (res.code == 0) {
  202. return res.data;
  203. }
  204. return Promise.reject(new Error(res.message));
  205. }
  206. // 报工
  207. export async function exeReportWork(data) {
  208. const res = await postJ(
  209. Vue.prototype.apiUrl + `/qms/quality_work_order/exeReportWork`,
  210. data,
  211. );
  212. if (res.code == 0) {
  213. return res.data;
  214. }
  215. return Promise.reject(new Error(res.message));
  216. }
  217. //转派
  218. export async function transferQualityWork(data) {
  219. const res = await postJ(
  220. Vue.prototype.apiUrl + `/qms/quality_work_order/transfer`,
  221. data,
  222. );
  223. if (res.code == 0) {
  224. return res.data;
  225. }
  226. return Promise.reject(new Error(res.message));
  227. }