ソースを参照

fix:订单新增导出

刘恒 1 年間 前
コミット
65b9c32405
2 ファイル変更180 行追加14 行削除
  1. 169 14
      src/pages/quote/quote.vue
  2. 11 0
      src/services/quote.js

+ 169 - 14
src/pages/quote/quote.vue

@@ -154,12 +154,25 @@
             box-sizing: border-box;
           "
         >
+          <a-button
+            type="primary"
+            @click="openDialog"
+            style="margin-right: 15px"
+            >任务列表</a-button
+          >
+
           <a-button
             type="primary"
             @click="exportExcel"
             style="margin-right: 15px"
             >导出</a-button
           >
+          <a-button
+            type="primary"
+            @click="bigOrderCountUpload"
+            style="margin-right: 15px"
+            >明细导出</a-button
+          >
 
           <a-button type="primary" @click="getList">查询</a-button>
         </div>
@@ -181,13 +194,45 @@
         </standard-table>
       </div>
     </div>
+    <a-modal
+      title="任务列表"
+      :visible="visible"
+      @cancel="handleCancel"
+      @ok="handleCancel"
+      :width="800"
+    >
+      <standard-table
+        bordered
+        :columns="columns1"
+        :dataSource="taskTableList"
+        :pagination="taskPagination"
+        @change="onTaskChange"
+        :loading="taskLoading"
+      >
+        <div slot="operation" slot-scope="{ record }">
+          <a-button
+            v-show="record.status == 'complete'"
+            type="link"
+            @click="exportQuoteExcel(record.uploadUrl)"
+            >下载</a-button
+          >
+        </div>
+        <div slot="status" slot-scope="{ text }">
+          {{ text == "complete" ? "已完成" : "进行中" }}
+        </div>
+        <div slot="type" slot-scope="{ text }">
+          {{ text == "0" ? "明细" : "列表" }}
+        </div>
+      </standard-table>
+    </a-modal>
   </div>
 </template>
-        
+
 <script>
 import StandardTable from "@/components/table/StandardTable";
 // import mixin from "../../minins/mixin";
 import tree from "@/components/tree/tree";
+
 import moment from "moment";
 
 const columns = [
@@ -222,6 +267,40 @@ const columns = [
   },
 ];
 
+const columns1 = [
+  // { title: "被保人姓名", dataIndex: "insureinfoName" },
+  // { title: "被保人电话", dataIndex: "insureinfoMobile" },
+
+  {
+    title: "创建时间",
+    dataIndex: "createTime",
+  },
+  {
+    title: "开始时间",
+    dataIndex: "createdAt",
+  },
+  {
+    title: "完成时间",
+    dataIndex: "completedAt",
+  },
+  {
+    title: "状态",
+    dataIndex: "status",
+    scopedSlots: { customRender: "status" },
+  },
+  {
+    title: "类型",
+    dataIndex: "type",
+    scopedSlots: { customRender: "type" },
+  },
+
+  {
+    title: "操作",
+    dataIndex: "uploadUrl",
+    scopedSlots: { customRender: "operation" },
+  },
+];
+
 export default {
   components: {
     StandardTable,
@@ -256,6 +335,16 @@ export default {
         showSizeChanger: true, //是否可以改变pagesize
         showTotal: (total) => `共 ${total} 条数据`,
       },
+      taskPagination: {
+        current: 1,
+        defaultPageSize: 10,
+        total: 0,
+        pagesize0ptions: ["10", "20", "30", "50", "100"],
+        hideOnSinglePage: false,
+        showQuickJumper: true, //
+        showSizeChanger: true, //是否可以改变pagesize
+        showTotal: (total) => `共 ${total} 条数据`,
+      },
       loading: false,
       wholeList: [],
       provinceList: [],
@@ -272,6 +361,11 @@ export default {
       yearOpen: false,
       process: process.env.VUE_APP_API_BASE_URL,
       startTime: "",
+      showTask: false,
+      visible: false,
+      taskTableList: [],
+      taskLoading: false,
+      columns1,
     };
   },
   mounted() {
@@ -280,6 +374,30 @@ export default {
     // }, 1000);
   },
   methods: {
+    openDialog() {
+      this.visible = true;
+
+      this.getTaskList();
+    },
+    getTaskList() {
+      this.taskLoading = true;
+      this.$API.quote
+        .queryPage({
+          pageNum: this.taskPagination.current,
+          pageSize: this.taskPagination.defaultPageSize,
+        })
+        .then((res) => {
+          if (res.data.code === 200) {
+            this.taskLoading = false;
+            this.taskTableList = [...res.data.data.content];
+            this.taskPagination.total = res.data.data.totalSize;
+          }
+        });
+    },
+
+    handleCancel() {
+      this.visible = false;
+    },
     onCalendarChange(values) {
       this.startTime = values[0];
       let startTime = moment(values[0]);
@@ -291,6 +409,41 @@ export default {
       }
       // this.getList();
     },
+    exportQuoteExcel(excelUrl) {
+      let url = this.process + excelUrl; // 3.创建一个临时的url指向blob对象
+      let a = document.createElement("a");
+      a.href = url;
+      a.download = "导出文件.xlsx";
+      a.click();
+      window.URL.revokeObjectURL(url);
+    },
+    bigOrderCountUpload() {
+      this.$API.quote
+        .bigOrderCountUpload({
+          ...this.formState,
+          beginDate: this.formState.time.length
+            ? this.formState.time[0]
+            : undefined,
+          endDate: this.formState.time.length
+            ? this.formState.time[1]
+            : undefined,
+          deptId: this.deptId,
+        })
+        .then((res) => {
+          if (res.data.code === 200) {
+            this.$message.success("操作成功,请耐心等待");
+            this.showTask = true;
+            this.getTaskList();
+
+            // let url = this.process + excelUrl; // 3.创建一个临时的url指向blob对象
+            // let a = document.createElement("a");
+            // a.href = url;
+            // a.download = "导出文件.xlsx";
+            // a.click();
+            // window.URL.revokeObjectURL(url);
+          }
+        });
+    },
     disabledDate(current) {
       // console.log(current);
       // if (!this.startDate) {
@@ -338,17 +491,9 @@ export default {
           ...this.formState,
           deptId: this.deptId,
         })
-        .then((res) => {
-          if (res.data.code == 200) {
-            let url = this.process + res.data.data; // 3.创建一个临时的url指向blob对象
-            let a = document.createElement("a");
-            a.href = url;
-            a.download = "导出文件.xlsx";
-            a.click();
-            window.URL.revokeObjectURL(url);
-          } else {
-            this.$message.error(res.msg);
-          }
+        .then(() => {
+          this.$message.success("操作成功,请耐心等待");
+          this.showTask = true;
         });
     },
 
@@ -435,10 +580,20 @@ export default {
       };
       this.getVerification();
     },
+    onTaskChange(pagination, filters, sorter, { currentDataSource }) {
+      // this.$message.info('表格状态改变了')
+      console.log(pagination, filters, sorter, { currentDataSource });
+      this.taskPagination = {
+        current: pagination.current,
+        defaultPageSize: pagination.pageSize,
+        total: pagination.total,
+      };
+      this.getTaskList();
+    },
   },
 };
 </script>
-<style lang='less' scoped>
+<style lang="less" scoped>
 .quote {
   display: flex;
   > div:first-child {
@@ -555,4 +710,4 @@ export default {
     }
   }
 }
-</style>
+</style>

+ 11 - 0
src/services/quote.js

@@ -29,6 +29,15 @@ export async function quotationDetailsExcel(data) {
   return request("/quoteCount/quotationDetailsExcel", METHOD.POST, data);
 }
 
+//大订单分批导出列表
+export async function queryPage(data) {
+  return request("/fnc/importKztAsync/queryPage", METHOD.POST, data);
+}
+//大订单分明细导出
+export async function bigOrderCountUpload(data) {
+  return request("/upload/bigOrderCountUpload", METHOD.POST, data);
+}
+
 // /quoteCount/quotationDetailsExcel
 
 export default {
@@ -38,4 +47,6 @@ export default {
   getBigOrderMount,
   exportList,
   quotationDetailsExcel,
+  queryPage,
+  bigOrderCountUpload,
 };