lrf402788946 4 yıl önce
ebeveyn
işleme
93fb2571c6

+ 5 - 0
src/router/index.js

@@ -170,6 +170,11 @@ export default new Router({
           component: () => import('../views/patent/detail.vue'),
           meta: { title: 'e专利信息管理' },
         },
+        {
+          path: '/patent/result',
+          component: () => import('../views/patent/result.vue'),
+          meta: { title: 'e专利导出结果' },
+        },
         // 调研调查
         {
           path: '/investigation',

+ 3 - 0
src/store/index.js

@@ -44,6 +44,8 @@ import projectsolic from '@common/src/store/projectsolic';
 import category from '@common/src/store/category';
 import code from '@common/src/store/code';
 import place from '@common/src/store/place';
+// 任务
+import mission from '@common/src/store/mission';
 Vue.use(Vuex);
 
 export default new Vuex.Store({
@@ -74,5 +76,6 @@ export default new Vuex.Store({
     category,
     code,
     place,
+    mission,
   },
 });

+ 12 - 1
src/views/patent/index.vue

@@ -3,6 +3,8 @@
     <el-row>
       <el-col :span="24" class="main">
         <el-col :span="24" class="top">
+          <el-button type="primary" size="mini" @click="toExport">导出</el-button>
+          <el-button type="primary" size="mini" @click="toResult">查看导出结果</el-button>
           <el-button type="primary" size="mini" @click="add">添加</el-button>
         </el-col>
         <el-col :span="24" class="down">
@@ -52,7 +54,7 @@ export default {
     await this.search();
   },
   methods: {
-    ...patent(['query', 'fetch', 'create', 'update', 'delete']),
+    ...patent(['query', 'fetch', 'create', 'update', 'delete', 'import', 'export']),
     async search({ skip = 0, limit = 10, ...info } = {}) {
       let res = await this.query({ skip, limit, ...info });
       if (this.$checkRes(res)) {
@@ -79,6 +81,15 @@ export default {
     add() {
       this.$router.push({ path: '/patent/detail' });
     },
+    // 导出
+    async toExport() {
+      const res = await this.export();
+      this.$checkRes(res, '正在导出,详情请点击"查看导出结果"进行查看', res.errmsg || '导出失败');
+    },
+    // 查看导出结果
+    async toResult() {
+      this.$router.push({ path: '/patent/result' });
+    },
   },
   computed: {
     ...mapState(['user']),

+ 67 - 0
src/views/patent/result.vue

@@ -0,0 +1,67 @@
+<template>
+  <div id="result">
+    <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @download="toDownload"></data-table>
+  </div>
+</template>
+
+<script>
+import dataTable from '@common/src/components/frame/filter-page-table.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: mission } = createNamespacedHelpers('mission');
+
+export default {
+  name: 'result',
+  props: {},
+  components: { dataTable },
+  data: function() {
+    return {
+      list: [],
+      total: 0,
+      opera: [
+        {
+          label: '下载',
+          method: 'download',
+          display: i => i.status === '2',
+        },
+      ],
+      fields: [
+        { label: '标题', prop: 'title' },
+        { label: '导出数据时间', prop: 'create_time' },
+        {
+          label: '状态',
+          prop: 'status',
+          format: i => (i == '0' ? '未开始' : i == '1' ? '进行中' : i == '2' ? '导出完成' : i == '3' ? '导出失败' : '未知状态'),
+        },
+        { label: '进度', prop: 'progress' },
+      ],
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...mission(['query']),
+    async search({ skip = 0, limit = 10 } = {}) {
+      const res = await this.query({ skip, limit });
+      if (this.$checkRes(res)) {
+        this.$set(this, 'list', res.data);
+        this.$set(this, 'total', res.total);
+      }
+    },
+    toDownload({ data }) {
+      console.log(data);
+    },
+  },
+  computed: {
+    ...mapState(['user', 'menuParams']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped></style>