certificate.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import request from '@/utils/request'
  2. const baseUrl = import.meta.env.VITE_APP_PRODUCTION_API
  3. import { download, downloadPdf } from '@/utils/request'
  4. // 查询合格证列表
  5. export function listCertificate(query) {
  6. return request({
  7. url: baseUrl + '/business/certificate/list',
  8. method: 'get',
  9. params: query
  10. })
  11. }
  12. // 查询合格证详细
  13. export function getCertificate(id) {
  14. return request({
  15. url: baseUrl + '/business/certificate/' + id,
  16. method: 'get'
  17. })
  18. }
  19. // 新增合格证
  20. export function addCertificate(data) {
  21. return request({
  22. url: baseUrl + '/business/certificate',
  23. method: 'post',
  24. data: data
  25. })
  26. }
  27. // 修改合格证
  28. export function updateCertificate(data) {
  29. return request({
  30. url: baseUrl + '/business/certificate',
  31. method: 'put',
  32. data: data
  33. })
  34. }
  35. // 删除合格证
  36. export function delCertificate(id) {
  37. return request({
  38. url: baseUrl + '/business/certificate/' + id,
  39. method: 'delete'
  40. })
  41. }
  42. export function generateQrCode(data) {
  43. return request({
  44. url: baseUrl + '/business/certificate/generate',
  45. method: 'post',
  46. data: data
  47. })
  48. }
  49. export function printPdf(data) {
  50. downloadPdf(
  51. baseUrl + "/business/certificate/printPdf",
  52. {
  53. ...data
  54. },
  55. `合格证_${new Date().getTime()}.pdf`
  56. )
  57. }