deepchart后台管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
3.1 KiB

2 months ago
2 months ago
  1. <template>
  2. <div class="export-list-page">
  3. <!-- 页面标题 -->
  4. <h3 class="page-title">导出文件列表</h3>
  5. <!-- 表格 -->
  6. <el-table
  7. :data="exportList"
  8. stripe
  9. :header-cell-style="{ 'background-color':'#f8f9fa'}"
  10. style="width: 100%; margin-bottom: 16px;"
  11. >
  12. <el-table-column prop="file_name" label="文件名" align="center" header-align="center"/>
  13. <el-table-column prop="type" label="导出类型" align="center" header-align="center"/>
  14. <el-table-column label="状态" align="center" header-align="center" width="100">
  15. <template #default="scope">
  16. <el-tag :type="statusTypeMap[scope.row.status].type" size="small">
  17. {{ statusTypeMap[scope.row.status].label }}
  18. </el-tag>
  19. </template>
  20. </el-table-column>
  21. <el-table-column prop="created_at" label="创建时间" align="center" header-align="center"/>
  22. <el-table-column label="操作" align="center" header-align="center" width="120">
  23. <template #default="scope">
  24. <el-button
  25. type="primary"
  26. size="mini"
  27. :disabled="scope.row.status !== 2"
  28. @click="handleDownload(scope.row)"
  29. >
  30. 下载
  31. </el-button>
  32. </template>
  33. </el-table-column>
  34. </el-table>
  35. <!-- 统计信息 + 关闭按钮 -->
  36. <div class="page-footer">
  37. <span class="total-count"> {{ totalCount }} 条导出记录</span>
  38. <el-button type="text" @click="handleClose">关闭</el-button>
  39. </div>
  40. </div>
  41. </template>
  42. <script setup>
  43. import { ref, onMounted } from 'vue'
  44. import { useRouter } from 'vue-router';
  45. import { exportListApi } from '../../api/userPermissions'
  46. // 路由实例
  47. const router = useRouter();
  48. // 导出列表数据
  49. const exportList = ref([]);
  50. const totalCount = ref(0)
  51. // 状态映射配置
  52. const statusTypeMap = {
  53. 0: { type: 'danger', label: '执行失败' },
  54. 1: { type: 'primary', label: '执行中' },
  55. 2: { type: 'success', label: '执行成功' }
  56. };
  57. // 组件挂载
  58. onMounted(() => {
  59. exportListAll();
  60. });
  61. // 获取导出列表
  62. const exportListAll = async () => {
  63. try {
  64. const data = await exportListApi();
  65. exportList.value = data.list;
  66. totalCount.value = data.total;
  67. } catch (error) {
  68. exportList.value = [];
  69. }
  70. };
  71. // 下载按钮
  72. const handleDownload = (exportdata) => {
  73. if (!exportdata.download_url) return;
  74. const link = document.createElement('a');
  75. link.href = exportdata.download_url;
  76. link.style.display = 'none';
  77. document.body.appendChild(link);
  78. link.click();
  79. document.body.removeChild(link);
  80. };
  81. // 关闭按钮
  82. const handleClose = () => {
  83. router.push({
  84. path: "/userPermissions/market"
  85. });
  86. };
  87. </script>
  88. <style scoped>
  89. .export-list-page {
  90. padding: 20px;
  91. background: #fff;
  92. border-radius: 8px;
  93. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.08);
  94. }
  95. .page-title {
  96. margin: 0 0 20px 0;
  97. font-size: 16px;
  98. color: #141414;
  99. font-weight: 600;
  100. }
  101. .page-footer {
  102. display: flex;
  103. justify-content: space-between;
  104. align-items: center;
  105. color: #666;
  106. font-size: 14px;
  107. }
  108. .total-count {
  109. color: #888;
  110. }
  111. </style>