code.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import request from '@/utils/request'
  2. // 代码生成已选数据表列表接口
  3. export function generateTable(params: any) {
  4. return request.get({ url: '/gen/list', params })
  5. }
  6. // 数据表列表接口
  7. export function dataTable(params: any) {
  8. return request.get({ url: '/gen/db', params })
  9. }
  10. // 数据表所有列表接口
  11. export function dataTableAll() {
  12. return request.get({ url: '/gen/dbAll' })
  13. }
  14. //表名查字段
  15. export function dataTableToColumn(params: any) {
  16. return request.get({ url: '/gen/dbColumn', params })
  17. }
  18. //选择要生成代码的数据表
  19. export function selectTable(params: any) {
  20. return request.post(
  21. { url: '/gen/importTable', params },
  22. {
  23. isParamsToData: false
  24. }
  25. )
  26. }
  27. // 已选择的数据表详情
  28. export function tableDetail(params: any) {
  29. return request.get({ url: '/gen/detail', params })
  30. }
  31. //同步字段
  32. export function syncColumn(params: any) {
  33. return request.post(
  34. { url: '/gen/syncTable', params },
  35. {
  36. isParamsToData: false
  37. }
  38. )
  39. }
  40. //删除已选择的数据表
  41. export function generateDelete(params: any) {
  42. return request.post({ url: '/gen/delTable', params })
  43. }
  44. //编辑已选表字段
  45. export function generateEdit(params: any) {
  46. return request.post({ url: '/gen/editTable', params })
  47. }
  48. //预览代码
  49. export function generatePreview(params: any) {
  50. return request.get({ url: '/gen/previewCode', params })
  51. }
  52. //生成代码
  53. export function generateCode(params: any) {
  54. return request.get({ url: '/gen/genCode', params })
  55. }
  56. //下载代码
  57. export function downloadCode(params: any) {
  58. return request.get(
  59. { responseType: 'blob', url: '/gen/downloadCode', params },
  60. {
  61. isTransformResponse: false
  62. }
  63. )
  64. }