Browse Source

销售线索导出

qymljy 2 năm trước cách đây
mục cha
commit
7a4542b709
2 tập tin đã thay đổi với 53 bổ sung2 xóa
  1. 11 2
      src/SManagement/orderclue/index.vue
  2. 42 0
      src/components/export_file/index3.vue

+ 11 - 2
src/SManagement/orderclue/index.vue

@@ -10,6 +10,8 @@
       tableName="orderclueList"
       idName="sat_orderclueid"
       :autoQuery="false"
+      :isExport="false"
+      @listData="reList"
       :specialKey="[{key:'leader',value:'name'}]"
       :apiId="{query:20221101094502,del:''}"
       :options="options"
@@ -17,6 +19,7 @@
       @checkboxCallBack="checkboxCallBack"
     >
       <div slot="titleRight" >
+        <exportFile :param="param" fileName="销售线索"></exportFile>
         <changeSite class="inline-16" v-if="tool.checkAuth($route.name,'changeSite')" :selectList="selectList" @onSuccess="$refs.list.listData($refs.list.param.content.pageNumber = 1)"></changeSite>
       </div>
     <template #custom>
@@ -108,9 +111,11 @@
 
 <script>
 import changeSite from '@/HManagement/clueManage/clue_private/modules/changeSite.vue'
+import exportFile from '@/components/export_file/index3'
 export default {
   components:{
-    changeSite
+    changeSite,
+    exportFile
   },
   data () {
     return {
@@ -127,7 +132,8 @@ export default {
       tradefields:[],
       selectList:[],
       tagData:[],
-      tag:''
+      tag:'',
+      param:{}
     }
   },
   provide() {
@@ -153,6 +159,9 @@ export default {
 
   },
   methods:{
+    reList(){
+      this.param = this.$refs.list.param
+    },
     async getTeamList () {
       let res = await this.$api.requested({
         /*"classname": "sale.team.team",

+ 42 - 0
src/components/export_file/index3.vue

@@ -0,0 +1,42 @@
+<template>
+  <el-button type="primary" size="small" @click="exportData" plain>导 出</el-button>
+</template>
+
+<script>
+export default {
+  props:['param','type','columns','columnsIndex','fileName','dataid'],
+  data(){
+    return{
+      columnsData:[]
+    }
+  },
+  methods:{
+    async exportData(){
+      console.log(this.param,'param22')
+      this.param.content.isExport = 1
+      this.param.content.isAll = 1
+      /*导出数据*/
+      const res = await this.$api.requested(this.param)
+      this.downFile(res.data[0].url,this.fileName)
+      this.param.content.isExport = 0
+      this.param.content.isAll = 0
+    },
+    downFile(url, fileName) {
+      console.log(url,'url')
+      const x = new XMLHttpRequest()
+      x.open('GET', url, true)
+      x.responseType = 'blob'
+      x.onload = function() {
+        const url = window.URL.createObjectURL(x.response)
+        const a = document.createElement('a')
+        a.href = url
+        a.download = fileName
+        a.click()
+      }
+      x.send()
+    }
+  }
+}
+</script>
+<style>
+</style>