Przeglądaj źródła

feat: 订单数据统计 - 离线导出

zhengxy 1 rok temu
rodzic
commit
858107de88

+ 2 - 0
project/src/assets/config/interface_api.js

@@ -295,6 +295,8 @@ var api = {
295 295
   dataBoard_uptime: "/api/dataCube/uptime", // 数据更新时间
296 296
   dataBoard_orderData_orderList: "/api/order/orderList", // 订单数据统计 - 列表
297 297
   dataBoard_orderData_orderExport: "/api/order/orderExport", // 订单数据统计 - 列表 - 导出
298
+  dataBoard_orderData_orderExportOffline: "/api/order/orderExportOffline", // 订单数据统计 - 列表 - 离线导出
299
+  dataBoard_orderExportList: "/api/order/orderExportList", // 离线导出 - 任务列表
298 300
   dataBoard_operator_accountDataSummary: "/api/operate/accountDataSummary", // 运营端数据 - 运营公众号数据 - 汇总
299 301
   dataBoard_operator_accountData: "/api/operate/accountData", // 运营端数据 - 运营公众号数据 - 列表
300 302
   dataBoard_operator_data: "/api/operate/data", // 运营端数据 - 运营数据 - 列表

+ 107 - 0
project/src/components/dataBoard/exportOffline.vue

@@ -0,0 +1,107 @@
1
+<template>
2
+  <div v-loading="loading" class="exportOffline-wrap">
3
+    <el-table :height="height" :data="tableList" tooltip-effect="dark" style="width: 100%;">
4
+      <el-table-column label="名称" prop="index_name" min-width="300" align="left" />
5
+      <el-table-column width="20" />
6
+      <el-table-column label="导出链接" min-width="300" align="left">
7
+        <template slot-scope="{ row }">
8
+          <div v-if="row.status == 1" class="c-FFB055">待处理</div>
9
+          <div v-else-if="row.status == 2" class="c-448AFF">导出链接生成中,请稍候</div>
10
+          <div v-else-if="row.status == 3 && row.file_url" class="c-00B38A pointer" @click="handleDownload(row.file_url)">{{ row.file_url }}</div>
11
+          <div v-else> - </div>
12
+        </template>
13
+      </el-table-column>
14
+      <el-table-column label="创建时间" prop="created_at" width="160" align="center" />
15
+      <el-table-column label="操作人" prop="operator_name" width="200" align="center" />
16
+      <el-table-column label="操作" width="100" align="center">
17
+        <template slot-scope="{ row }">
18
+          <el-button
19
+            size="mini"
20
+            :type="(row.status != 3 || !row.file_url) ? 'info' : 'primary'"
21
+            :disabled="row.status != 3 || !row.file_url"
22
+            @click="handleDownload(row.file_url)"
23
+          >下载</el-button>
24
+        </template>
25
+      </el-table-column>
26
+    </el-table>
27
+    <div class="pagination" v-show="pagination.total > 0">
28
+      <el-pagination background :current-page="pagination.page" @current-change="handleCurrentChange" layout="prev, pager, next" :page-count="Number(pagination.pages)" />
29
+    </div>
30
+  </div>
31
+</template>
32
+<script>
33
+export default {
34
+  name: 'exportOffline',
35
+  data () {
36
+    return {
37
+      height: '',
38
+      loading: false,
39
+      pagination: {
40
+        page: 1,
41
+        page_size: 20,
42
+        pages: 0,
43
+        total: 0,
44
+      },
45
+      // filter: {
46
+      //   keyword: '',
47
+      // },
48
+      tableList: [],
49
+    }
50
+  },
51
+  created () {
52
+    this.height = document.documentElement.clientHeight - 150
53
+    this.handleGetList()
54
+  },
55
+  methods: {
56
+    // 获取列表数据
57
+    async handleGetList() {
58
+      try {
59
+        this.loading = true
60
+        const url = `${this.URL.BASEURL}${this.URL.dataBoard_orderExportList}`
61
+        const params = {
62
+          page: this.pagination.page,
63
+          page_size: this.pagination.page_size,
64
+        }
65
+        const { data: res = {} } = await this.$axios.get(url, { params })
66
+        if (res && res.errno == 0 && Array.isArray(res.rst.data)) {
67
+          this.tableList = res.rst.data;
68
+          this.pagination.total = res.rst.pageInfo.total;
69
+          this.pagination.pages = res.rst.pageInfo.pages;
70
+        } else if (res.errno != 4002) {
71
+          this.$message.warning(res.err)
72
+          this.tableList = [];
73
+          this.pagination.total = 0;
74
+          this.pagination.pages = 0;
75
+        }
76
+      } catch (error) {
77
+        console.log(error)
78
+        this.tableList = [];
79
+        this.pagination.total = 0;
80
+        this.pagination.pages = 0;
81
+      } finally {
82
+        this.loading = false
83
+      }
84
+    },
85
+    // 监听当前页数变化
86
+    handleCurrentChange(currentPage) {
87
+      this.pagination.page = currentPage
88
+      this.handleGetList()
89
+    },
90
+    // 执行下载
91
+    handleDownload(url) {
92
+      const a = document.createElement("a");
93
+      a.style.display = "none";
94
+      a.href = url;
95
+      document.body.appendChild(a);
96
+      a.click();
97
+      document.body.removeChild(a);
98
+    }
99
+  }
100
+}
101
+</script>
102
+<style lang="scss" scoped>
103
+.screenBox {
104
+  background: #fff;
105
+  padding: 5px 20px;
106
+}
107
+</style>

Plik diff jest za duży
+ 65 - 20
project/src/components/dataBoard/orderData.vue


+ 13 - 0
project/src/router/allRouter.js

@@ -79,6 +79,8 @@ const officialAccount = () => import(/* webpackChunkName: 'officialAccount' */ '
79 79
 const recharge = () => import(/* webpackChunkName: 'recharge' */ '@/components/dataBoard/recharge.vue')
80 80
 // 数据看板 - 客服数据统计
81 81
 const customerStaff = () => import(/* webpackChunkName: 'customerStaff' */ '@/components/dataBoard/customerStaff/index.vue')
82
+// 数据看板 - 导出列表(离线导出任务列表)
83
+const exportOffline = () => import(/* webpackChunkName: 'exportOffline' */ '@/components/dataBoard/exportOffline.vue')
82 84
 
83 85
 // 平台账号管理
84 86
 const accountManage = () => import(/* webpackChunkName: 'accountManage' */ '@/components/manage/accountManage/accountManage.vue')
@@ -668,6 +670,17 @@ export var allRouter = [
668 670
         }
669 671
       },
670 672
       {
673
+        path: 'exportOffline',
674
+        name: 'exportOffline',
675
+        component: exportOffline,
676
+        meta: {
677
+          keepAlive: false,
678
+          isLogin: true,
679
+          title: '导出列表',
680
+          isData: true
681
+        }
682
+      },
683
+      {
671 684
         path: 'thePublic',
672 685
         name: 'thePublic',
673 686
         component: thePublic,