guhongwei 4 gadi atpakaļ
vecāks
revīzija
edfb070095
2 mainītis faili ar 50 papildinājumiem un 22 dzēšanām
  1. 11 17
      src/store/patent/import.js
  2. 39 5
      src/views/superAdminCenter/patent/index.vue

+ 11 - 17
src/store/patent/import.js

@@ -4,34 +4,28 @@ import _ from 'lodash';
 Vue.use(Vuex);
 const api = {
   importInfo: `/api/market/patent/import`,
+  exportInfo: `/api/market/patent/export`,
+  missionInfo: `/api/mission`,
 };
 const state = () => ({});
 const mutations = {};
 
 const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.importInfo}`, {
-      skip,
-      limit,
-      ...info,
-    });
-    return res;
-  },
   async create({ commit }, payload) {
     const res = await this.$axios.$post(`${api.importInfo}`, payload);
     return res;
   },
-  async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.importInfo}/${payload}`);
+  async export({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.exportInfo}`, payload);
     return res;
   },
-  async update({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.importInfo}/update/${id}`, data);
-    return res;
-  },
-
-  async delete({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.importInfo}/${payload}`);
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.missionInfo}`, {
+      project: 'market',
+      skip,
+      limit,
+      ...info,
+    });
     return res;
   },
 };

+ 39 - 5
src/views/superAdminCenter/patent/index.vue

@@ -27,7 +27,7 @@
             </data-form>
           </el-col>
         </span>
-        <span v-else>
+        <span v-else-if="display == 'import'">
           <el-col :span="24" class="top">
             <el-button type="primary" size="mini" @click="back">返回</el-button>
           </el-col>
@@ -53,6 +53,14 @@
             </el-col>
           </el-col>
         </span>
+        <span v-else-if="display == 'export'">
+          <el-col :span="24" class="top">
+            <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>
+          </el-col>
+        </span>
       </el-col>
     </el-row>
   </div>
@@ -141,6 +149,16 @@ export default {
       fileForm: {},
       // 错误信息
       errorList: [],
+      // 任务列表
+      exportopera: [
+        {
+          label: '下载',
+          icon: 'el-icon-bottom',
+          method: 'bottom',
+        },
+      ],
+      exportfields: [{ label: '标题', prop: 'title' }],
+      exportList: [],
     };
   },
   async created() {
@@ -148,7 +166,7 @@ export default {
   },
   methods: {
     ...patent(['query', 'fetch', 'update', 'create', 'delete']),
-    ...patentImport({ importCreate: 'create' }),
+    ...patentImport({ importCreate: 'create', importExport: 'export', importQuery: 'query' }),
     // 查询列表
     async search({ skip = 0, limit = 10, ...info } = {}) {
       let res = await this.query({ skip, limit, ...info });
@@ -212,6 +230,7 @@ export default {
       this.form = {};
       this.fileForm = {};
       this.errorList = [];
+      this.exportList = [];
       this.display = 'list';
       this.search();
     },
@@ -223,9 +242,11 @@ export default {
     importBtn() {
       this.display = 'import';
     },
+    // 文件上传
     importSuccess({ type, data }) {
       if (data.uri) this.$set(this.fileForm, `uri`, data.uri);
     },
+    // 确认导入
     async importSubmit() {
       let data = this.fileForm;
       let res = await this.importCreate(data);
@@ -243,9 +264,22 @@ export default {
         this.back();
       }
     },
-    // 导出书卷
-    importOut() {
-      alert('导出数据');
+    // 导出数据
+    async importOut() {
+      // 创建任务
+      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);
+        }
+      }
+    },
+    // 下载
+    bottomBtn({ data }) {
+      console.log(data);
     },
   },
   computed: {