2
3
فهرست منبع

前后端: 供方信息查询不再用前端导出,改用后台导出。

baichengfei 4 سال پیش
والد
کامیت
bee3bd69ed

+ 8 - 0
src/dashoo.cn/frontend_web/src/api/oilsupplier/select.js

@@ -7,6 +7,14 @@ export default {
       data: formdata
     })
   },
+  exportCompanyList (params, formData, myAxios) {
+    return myAxios({
+      url: '/select/export-company-list',
+      method: 'post',
+      params: params,
+      data: formData
+    })
+  },
   getbaseinfo (params, myAxios) {
     return myAxios({
       url: '/select/getbaseinfo',

+ 44 - 25
src/dashoo.cn/frontend_web/src/pages/select/companyselect/index.vue

@@ -90,6 +90,7 @@
         height="calc(100vh - 243px)"
         style="width: 100%"
         @sort-change="orderby"
+        @selection-change="onSelect"
         highlight-current-row
         stripe
       >
@@ -1332,6 +1333,7 @@ export default {
   },
   data () {
     return {
+      selectedCertIdList: '',
       showBackReason: false,
       backReasonList: [],
       TypeCode: '',
@@ -1860,34 +1862,51 @@ export default {
       countstr = countstr.replace(/\,\"districts\"\:\[\]/g, '')
       this.countryoptions = JSON.parse(countstr)
     },
+    onSelect (e) {
+      var list = []
+      e.map((item, index) => {
+        list.push(item.CertId)
+      })
+      this.selectedCertIdList = String(list)
+    },
     exportExcel () {
-      /* generate workbook object from table */
-      // 解决elementUi为通过一个隐藏一个显示来实现交互效果,而创建的两个tableDom,导致导出数据重复
-      let fix = document.querySelector('.el-table__fixed')
-      let wb
-      if (fix) {
-        wb = XLSX.utils.table_to_book(document.querySelector('#rebateSetTable').removeChild(fix))
-        document.querySelector('#rebateSetTable').appendChild(fix)
-      } else {
-        wb = XLSX.utils.table_to_book(
-          document.querySelector('#rebateSetTable')
-        )
+      this.loading = true
+      let myCreateOn = []
+      // 解析时间
+      if (this.CreateOn != null && this.CreateOn.length === 2) {
+        this.CreateOn[1].setHours(23)
+        this.CreateOn[1].setMinutes(59)
+        this.CreateOn[1].setSeconds(59)
+        myCreateOn.push(this.formatDateTime(this.CreateOn[0]))
+        myCreateOn.push(this.formatDateTime(this.CreateOn[1]))
       }
-      /* get binary string as output */
-      let wbOut = XLSX.write(wb, {
-        bookType: 'xlsx',
-        bookSST: true,
-        type: 'array'
-      })
-      try {
-        FileSaver.saveAs(
-          new Blob([wbOut], { type: 'application/octet-stream' }),
-          'SupplierSituation.xlsx'
-        )
-      } catch (e) {
-        if (typeof console !== 'undefined') console.log(e, wbOut)
+      let params = {
+        _size: this.size,
+        _currentPage: this.currentPage,
+        Order: this.Column.Order,
+        Prop: this.Column.Prop,
+        SetupTime: this.SetupTime,
+        CreateOn: myCreateOn.join(','),
+        CheckUId: this.auditorg,
+        // InFlag: this.InFlag,
+        OperType: this.OperType,
+        Grade: this.Grade,
+        FullId: this.selectDept,
+        selectedCertIdList: this.selectedCertIdList
       }
-      return wbOut
+      api.exportCompanyList(params, this.searchForm, this.$axios).then(res => {
+        this.loading = false
+        let docurl = res.data
+        // 内网服务器专用
+        if (process.client && docurl.indexOf('upfile') === 0) {
+          const myDomain = window.location.host
+          location.href = 'http://' + myDomain + '/' + docurl
+        } else {
+          location.href = 'http://' + docurl
+        }
+      }).catch(err => {
+        console.error(err)
+      })
     },
     // 导出到Word文件
     toWord (val) {