Export.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-admin 企业快速开发的saas管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace app\adminapi\controller\sys;
  12. use app\dict\sys\ExportDict;
  13. use app\service\admin\sys\ExportService;
  14. use core\base\BaseAdminController;
  15. use think\Response;
  16. class Export extends BaseAdminController
  17. {
  18. /**
  19. * 报表导出列表
  20. * @return Response
  21. */
  22. public function lists()
  23. {
  24. $data = $this->request->params([
  25. ['export_key', ''],
  26. ['export_status', ''],
  27. ['create_time', []],
  28. ]);
  29. $res = (new ExportService())->getPage($data);
  30. return success($res);
  31. }
  32. /**
  33. * 报表导出
  34. * @param string $export_type
  35. * @return Response
  36. */
  37. public function export(string $export_type){
  38. $where = $this->request->param();
  39. return success(data: (new ExportService())->exportData($export_type, $where));
  40. }
  41. /**
  42. * 检查导出数据源是否为空
  43. * @param string $export_type
  44. * @return Response
  45. */
  46. public function check(string $export_type){
  47. $where = $this->request->param();
  48. $check = (new ExportService())->checkExportData($export_type, $where);
  49. return success($check ? 'SUCCESS' : 'EXPORT_NO_DATA', $check);
  50. }
  51. /**
  52. * 报表删除
  53. * @param $id
  54. * @return Response
  55. */
  56. public function del($id)
  57. {
  58. $res = (new ExportService())->deleteExport($id);
  59. return success('DELETE_SUCCESS');
  60. }
  61. /**
  62. * 获取导出状态列表
  63. */
  64. public function getExportStatus()
  65. {
  66. return success((new ExportDict())->getStatus());
  67. }
  68. /**
  69. * 获取导出数据类型列表
  70. * @param string $app_type
  71. * @return Response
  72. */
  73. public function getExportDataType(string $app_type){
  74. return success((new ExportService())->getExportDataType($app_type));
  75. }
  76. }