Bläddra i källkod

fix:新增导出功能

刘恒 1 år sedan
förälder
incheckning
f1ed6098fc
5 ändrade filer med 126 tillägg och 95 borttagningar
  1. 2 2
      .env.development
  2. 30 3
      src/pages/quote/smallorders/quote.vue
  3. 32 23
      src/pages/task/channel.vue
  4. 22 15
      src/services/quote.js
  5. 40 52
      src/services/task.js

+ 2 - 2
.env.development

@@ -1,4 +1,4 @@
-VUE_APP_API_BASE_URL='https://test.baoxianzhanggui.com/web-api'
+VUE_APP_API_BASE_URL='http://192.168.5.26:8080'
 VUE_APP_BASE_URL='https://test.baoxianzhanggui.com'
 #VUE_APP_API_BASE_URL='https://test.baoxianzhanggui.com/web-api'
 #VUE_APP_BASE_URL='https://test.baoxianzhanggui.com'
@@ -15,4 +15,4 @@ VUE_APP_BASE_URL='https://test.baoxianzhanggui.com'
 #  VUE_APP_API_BASE_URL= 'http://192.168.0.103:8080'                 #//霍续亮 
 
 NODE_ENV='development'
-VUE_APP_ENV='development'
+VUE_APP_ENV='development'

+ 30 - 3
src/pages/quote/smallorders/quote.vue

@@ -60,6 +60,9 @@
           </div>
         </div>
       </div>
+      <div style="padding: 10px; display: flex; justify-content: flex-end">
+        <a-button type="primary" @click="exportList">导出</a-button>
+      </div>
       <standard-table
         bordered
         :columns="columns"
@@ -79,7 +82,7 @@
     </div>
   </div>
 </template>
-        
+
 <script>
 import StandardTable from "@/components/table/StandardTable";
 // import mixin from "../../minins/mixin";
@@ -206,6 +209,7 @@ export default {
         { title: "Tree Node", key: "2", isLeaf: true },
       ],
       deptId: undefined,
+      process: process.env.VUE_APP_API_BASE_URL,
     };
   },
   mounted() {
@@ -214,6 +218,29 @@ export default {
     // }, 1000);
   },
   methods: {
+    exportList() {
+      this.$API.quote
+        .quotationDetailsExcel({
+          // pageNum: this.pagination.current,
+          // pageSize: this.pagination.defaultPageSize,
+          dateType: this.formState.dateType,
+          beginDate: this.formState.beginDate,
+          endDate: this.formState.endDate,
+          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);
+          }
+        });
+    },
     chooseTree(val) {
       this.deptId = val;
       this.getVerification();
@@ -298,7 +325,7 @@ export default {
   },
 };
 </script>
-<style lang='less' scoped>
+<style lang="less" scoped>
 .quote {
   display: flex;
   > div:first-child {
@@ -369,4 +396,4 @@ export default {
     }
   }
 }
-</style>
+</style>

+ 32 - 23
src/pages/task/channel.vue

@@ -95,24 +95,11 @@
             </a-cascader>
           </a-form-item>
         </a-form>
-        <!-- <a-form-item label="管理人" :labelCol="{ span: 5 }" :colon="false">
-          <a-select
-            style="width: 300px"
-            placeholder="请选择"
-            v-model="formState.leaderId"
-            allowClear
-            show-search
-            :filter-option="filterOption"
+        <a-form-item label="" :labelCol="{ span: 5 }" :colon="false">
+          <a-button type="primary" @click="ordersDetailsExcel"
+            >明细导出</a-button
           >
-            <a-select-option
-              v-for="item in manageList"
-              :key="item.id"
-              :value="item.id"
-            >
-              {{ item.name }}
-            </a-select-option>
-          </a-select>
-        </a-form-item> -->
+        </a-form-item>
       </div>
     </div>
     <div style="width: 100%">
@@ -268,8 +255,8 @@
     </a-drawer>
   </div>
 </template>
-  
-  <script>
+
+<script>
 import StandardTable from "@/components/table/StandardTable";
 import fromRow from "@/components/form/FormRow";
 import mixin from "../../minins/mixin";
@@ -512,6 +499,27 @@ export default {
     // }, 1000);
   },
   methods: {
+    ordersDetailsExcel() {
+      let from = { ...this.formState };
+      delete from.time;
+      this.$API.task
+        .ordersDetailsExcel({
+          ...from,
+          leaderId: this.formState.leaderId[this.formState.leaderId.length - 1],
+        })
+        .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);
+          }
+        });
+    },
     filter(inputValue, path) {
       return path.some(
         (option) =>
@@ -566,10 +574,11 @@ export default {
       this.visible = false;
     },
     exportList() {
-      delete this.formState.time;
+      let from = { ...this.formState };
+      delete from.time;
       this.$API.task
         .exportChannelList({
-          ...this.formState,
+          ...from,
           leaderId: this.formState.leaderId[this.formState.leaderId.length - 1],
         })
         .then((res) => {
@@ -643,7 +652,7 @@ export default {
   },
 };
 </script>
-  <style lang='less' scoped>
+<style lang="less" scoped>
 .back-line-main {
   display: flex;
   flex-direction: column;
@@ -757,4 +766,4 @@ dl {
     justify-content: space-between;
   }
 }
-</style>
+</style>

+ 22 - 15
src/services/quote.js

@@ -1,34 +1,41 @@
-
-import { request, METHOD, } from '@/utils/request'
+import { request, METHOD } from "@/utils/request";
 
 //获取报价次数列表
 export async function getQuoteList(data) {
-    return request("/quoteCount/queryCompanyQutationCountDataPage", METHOD.POST, data)
+  return request(
+    "/quoteCount/queryCompanyQutationCountDataPage",
+    METHOD.POST,
+    data
+  );
 }
 //获取代理人树
 export async function getAgentTree(data) {
-    return request("/userStatistics/agentTreeStructure", METHOD.POST, data)
+  return request("/userStatistics/agentTreeStructure", METHOD.POST, data);
 }
 //获取大订单
 export async function getBigOrderList(data) {
-    return request("/companyDataReport/querOrdersDataPage", METHOD.POST, data)
+  return request("/companyDataReport/querOrdersDataPage", METHOD.POST, data);
 }
 //获取大订单总计
 export async function getBigOrderMount(data) {
-    return request("/companyDataReport/querOrdersamountTo", METHOD.POST, data)
+  return request("/companyDataReport/querOrdersamountTo", METHOD.POST, data);
 }
 //大订单导出
 export async function exportList(data) {
-    return request("/companyDataReport/largeOrdersExcel", METHOD.POST, data)
+  return request("/companyDataReport/largeOrdersExcel", METHOD.POST, data);
+}
+//小订单导出
+export async function quotationDetailsExcel(data) {
+  return request("/quoteCount/quotationDetailsExcel", METHOD.POST, data);
 }
 
-
-
+// /quoteCount/quotationDetailsExcel
 
 export default {
-    getQuoteList,
-    getAgentTree,
-    getBigOrderList,
-    getBigOrderMount,
-    exportList
-}
+  getQuoteList,
+  getAgentTree,
+  getBigOrderList,
+  getBigOrderMount,
+  exportList,
+  quotationDetailsExcel,
+};

+ 40 - 52
src/services/task.js

@@ -1,91 +1,79 @@
-
-
-import { request, METHOD, } from '@/utils/request'
+import { request, METHOD } from "@/utils/request";
 
 //获取协议列表
 export async function getTaskStatistics(data) {
-    return request("/taskStatistics/queryPage", METHOD.POST, data)
+  return request("/taskStatistics/queryPage", METHOD.POST, data);
 }
 //获取保险公司列表
 export async function getCompanyList(data) {
-    return request("/taskStatistics/insuranceCompanyQueryPage", METHOD.POST, data)
+  return request(
+    "/taskStatistics/insuranceCompanyQueryPage",
+    METHOD.POST,
+    data
+  );
 }
 //获取代理人列表
 export async function getAgentList(data) {
-    return request("/taskStatistics/agentStatisticsQueryPage", METHOD.POST, data)
+  return request("/taskStatistics/agentStatisticsQueryPage", METHOD.POST, data);
 }
 //导出渠道数据
 export async function exportChannelList(data) {
-    return request("/taskStatistics/channelExcel", METHOD.POST, data,
-        {
-            responseType: 'blob'
-        }
-    )
+  return request("/taskStatistics/channelExcel", METHOD.POST, data, {
+    responseType: "blob",
+  });
 }
 //导出代理人数据
 export async function exportAgentlList(data) {
-    return request("/taskStatistics/agentExcel", METHOD.POST, data,
-        {
-            responseType: 'blob'
-        }
-    )
+  return request("/taskStatistics/agentExcel", METHOD.POST, data, {
+    responseType: "blob",
+  });
+}
+export async function ordersDetailsExcel(data) {
+  return request("/taskStatistics/ordersDetailsExcel", METHOD.POST, data, {
+    responseType: "blob",
+  });
 }
 
 //导出保险公司数据
 export async function exportInsurancelList(data) {
-    return request("/taskStatistics/insuranceCompanyExcel", METHOD.POST, data,
-        {
-            responseType: 'blob'
-        }
-    )
+  return request("/taskStatistics/insuranceCompanyExcel", METHOD.POST, data, {
+    responseType: "blob",
+  });
 }
 //渠道代理人详情
 export async function getChannelAgentDetails(data) {
-    return request("/taskStatistics/channelAgentDetails", METHOD.POST, data,
-
-    )
+  return request("/taskStatistics/channelAgentDetails", METHOD.POST, data);
 }
 
 //电销数据
 export async function getQueryPageElectric(data) {
-    return request("/taskStatistics/queryPageElectric", METHOD.POST, data,
-
-    )
+  return request("/taskStatistics/queryPageElectric", METHOD.POST, data);
 }
 //提现任务
 export async function getWithdrawalTask(data) {
-    return request("/withdrawalTask/queryPage", METHOD.POST, data,
-
-    )
+  return request("/withdrawalTask/queryPage", METHOD.POST, data);
 }
 //提现任务合计
 export async function getWithdrawalDrawal(data) {
-    return request("/withdrawalTask/countWithdrawal", METHOD.POST, data,
-
-    )
+  return request("/withdrawalTask/countWithdrawal", METHOD.POST, data);
 }
 // /withdrawalTask/countWithdrawal
 
 export async function exportElectricList(data) {
-    return request("/taskStatistics/electricExcel", METHOD.POST, data,
-
-    )
+  return request("/taskStatistics/electricExcel", METHOD.POST, data);
 }
 
-
-
-
-
 export default {
-    getTaskStatistics,
-    getCompanyList,
-    getAgentList,
-    exportChannelList,
-    exportAgentlList,
-    exportInsurancelList,
-    getChannelAgentDetails,
-    getQueryPageElectric,
-    getWithdrawalTask,
-    getWithdrawalDrawal,
-    exportElectricList
-}
+  getTaskStatistics,
+  getCompanyList,
+  getAgentList,
+  exportChannelList,
+  exportAgentlList,
+  exportInsurancelList,
+  getChannelAgentDetails,
+  getQueryPageElectric,
+  getWithdrawalTask,
+  getWithdrawalDrawal,
+  exportElectricList,
+  ordersDetailsExcel,
+};