guhongwei пре 4 година
родитељ
комит
2339ff8e01
1 измењених фајлова са 42 додато и 9 уклоњено
  1. 42 9
      src/views/superAdminCenter/patent/index.vue

+ 42 - 9
src/views/superAdminCenter/patent/index.vue

@@ -7,6 +7,7 @@
             <el-button type="primary" size="mini" @click="add">添加信息</el-button>
             <el-button type="primary" size="mini" @click="importBtn">导入数据</el-button>
             <el-button type="primary" size="mini" @click="importOut">导出数据</el-button>
+            <el-button type="primary" size="mini" @click="importView">查看导出数据结果</el-button>
             <el-button type="info" size="mini"> <el-link :underline="false" style="color:#fff" href="/数据模板.xlsx">数据模板下载</el-link></el-button>
           </el-col>
           <el-col :span="24" class="list">
@@ -58,7 +59,14 @@
             <el-button type="primary" size="mini" @click="back">返回</el-button>
           </el-col>
           <el-col :span="24" class="exportList">
-            <data-table :fields="exportfields" :opera="exportopera" :data="exportList" @bottom="bottomBtn" :usePage="false"></data-table>
+            <data-table
+              :fields="exportfields"
+              :opera="exportopera"
+              :data="exportList"
+              :total="exportTotal"
+              @bottom="bottomBtn"
+              @query="importView"
+            ></data-table>
           </el-col>
         </span>
       </el-col>
@@ -157,8 +165,26 @@ export default {
           method: 'bottom',
         },
       ],
-      exportfields: [{ label: '标题', prop: 'title' }],
+      exportfields: [
+        { label: '标题', prop: 'title' },
+        {
+          label: '导出数据时间',
+          prop: 'create_time',
+        },
+        {
+          label: '状态',
+          prop: 'status',
+          format: item => {
+            return item === '0' ? '未开始' : item === '1' ? '进行中' : item === '2' ? '完成' : '失败';
+          },
+        },
+        {
+          label: '进度(%)',
+          prop: 'progress',
+        },
+      ],
       exportList: [],
+      exportTotal: 0,
     };
   },
   async created() {
@@ -269,17 +295,24 @@ export default {
       // 创建任务
       let res = await this.importExport();
       if (this.$checkRes(res)) {
-        this.display = 'export';
-        // 查询任务列表
-        let arr = await this.importQuery();
-        if (this.$checkRes(arr)) {
-          this.$set(this, 'exportList', arr.data);
-        }
+        this.$message({
+          message: '导出任务创建成功',
+          type: 'success',
+        });
+      }
+    },
+    // 查看导出结果
+    async importView({ skip = 0, limit = 10, ...info } = {}) {
+      this.display = 'export';
+      let arr = await this.importQuery({ skip, limit, ...info });
+      if (this.$checkRes(arr)) {
+        this.$set(this, 'exportList', arr.data);
+        this.$set(this, 'exportTotal', arr.total);
       }
     },
     // 下载
     bottomBtn({ data }) {
-      console.log(data);
+      window.open(data.uri);
     },
   },
   computed: {