فهرست منبع

导出数据最大范围为1个月

chenrui 4 سال پیش
والد
کامیت
f78ae280e4

+ 10 - 9
src/views/Service/PurchasedServiceList.vue

@@ -98,9 +98,6 @@
 <script>
 import moment from 'moment'
 import getDate from '@/libs/getDate.js'
-import {
-  completeDate
-} from '@/libs/tools.js'
 import {
   STable,
   VSelect
@@ -354,8 +351,6 @@ export default {
     // 导出
     handleExport () {
       const params = {
-        beginDate: this.queryParam.beginDate == null ? getDate.getRecentday().starttime : this.queryParam.beginDate,
-        endDate: this.queryParam.endDate == null ? getDate.getRecentday().endtime : this.queryParam.endDate,
         bundleName: this.queryParam.bundleName,
         number: this.queryParam.number,
         custMobile: this.queryParam.custMobile,
@@ -363,14 +358,20 @@ export default {
         salesChannelSettleStatus: this.queryParam.salesChannelSettleStatus,
         freeChoiceFlag: 1
       }
-      console.log(params)
+      if (this.queryOrderDate && this.queryOrderDate.length) {
+        params.beginDate = moment(this.queryOrderDate[0]).format('YYYY-MM-DD')
+        params.endDate = moment(this.queryOrderDate[1]).format('YYYY-MM-DD')
+      } else {
+        params.beginDate = ''
+        params.endDate = ''
+      }
       if (!params.beginDate && !params.endDate) {
         this.$message.error('请先选择需要导出的下单时间区间再进行导出!')
         return
       }
-      // 判断两个时间段是否相差m个月
-      if (!completeDate(params.beginDate, params.endDate, 3)) {
-        this.$message.error('单次最多只能导出3个月的数据,请缩小查询区间后再进行导出!')
+      // 判断两个时间段是否相差1个月  第二个参数指相差单位,第三个参数指是否返回浮点形式(小数)
+      if (moment(params.endDate).diff(moment(params.beginDate), 'months', true) > 1) {
+        this.$message.error('单次最多只能导出1个月的数据,请缩小查询区间后再进行导出!')
         return
       }
       this.loading = true

+ 10 - 6
src/views/SetmealSales/PurchasedSetmeal.vue

@@ -107,7 +107,6 @@
 <script>
 import { STable, VSelect } from '@/components'
 import getDate from '@/libs/getDate.js'
-import { completeDate } from '@/libs/tools.js'
 import moment from 'moment'
 import SetmealDetailModal from './SetmealDetailModal.vue'
 import { salesChannelList } from '@/api/FinancialManagement'
@@ -265,8 +264,6 @@ export default {
     // 导出
     handleExport () {
       const params = {
-        beginDate: this.searchForm.beginDate == null ? getDate.getToday().starttime : this.searchForm.beginDate,
-        endDate: this.searchForm.endDate == null ? getDate.getToday().endtime : this.searchForm.endDate,
         bundleName: this.searchForm.bundleName,
         number: this.searchForm.number,
         custMobile: this.searchForm.custMobile,
@@ -275,13 +272,20 @@ export default {
         dataSourceNo: this.searchForm.dataSourceNo,
         freeChoiceFlag: 0
       }
+      if (this.time && this.time.length) {
+        params.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
+        params.endDate = moment(this.time[1]).format('YYYY-MM-DD')
+      } else {
+        params.beginDate = ''
+        params.endDate = ''
+      }
       if (!params.beginDate && !params.endDate) {
         this.$message.error('请先选择需要导出的下单时间区间再进行导出!')
         return
       }
-      // 判断两个时间段是否相差m个月
-      if (!completeDate(params.beginDate, params.endDate, 3)) {
-        this.$message.error('单次最多只能导出3个月的数据,请缩小查询区间后再进行导出!')
+      // 判断两个时间段是否相差1个月  第二个参数指相差单位,第三个参数指是否返回浮点形式(小数)
+      if (moment(params.endDate).diff(moment(params.beginDate), 'months', true) > 1) {
+        this.$message.error('单次最多只能导出1个月的数据,请缩小查询区间后再进行导出!')
         return
       }
       this.loading = true

+ 10 - 5
src/views/SetmealSales/VerificationRecords.vue

@@ -86,7 +86,6 @@
 <script>
 import { STable, VSelect } from '@/components'
 import getDate from '@/libs/getDate.js'
-import { completeDate } from '@/libs/tools.js'
 import { getVerificationRecordsList, getVerificationRecordsListTotal, settlementRecordsExport, getStoreList } from '@/api/SetmealSales.js'
 import moment from 'moment'
 export default {
@@ -251,19 +250,25 @@ export default {
     // 导出
     handleExport () {
       const params = {
-        beginDate: this.searchForm.beginDate == null ? getDate.getToday().starttime : this.searchForm.beginDate,
-        endDate: this.searchForm.endDate == null ? getDate.getToday().endtime : this.searchForm.endDate,
         usedStoreId: this.searchForm.usedStoreId,
         orderNo: this.searchForm.orderNo,
         queryWord: this.searchForm.queryWord,
         bundName: this.searchForm.bundName
       }
+      if (this.time && this.time.length) {
+        params.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
+        params.endDate = moment(this.time[1]).format('YYYY-MM-DD')
+      } else {
+        params.beginDate = ''
+        params.endDate = ''
+      }
       if (!params.beginDate && !params.endDate) {
         this.$message.error('请先选择需要导出的核销时间段再进行导出!')
         return
       }
-      if (!completeDate(params.beginDate, params.endDate, 3)) {
-        this.$message.error('单次最多只能导出3个月的数据,请缩小查询区间后再进行导出!')
+      // 判断两个时间段是否相差1个月  第二个参数指相差单位,第三个参数指是否返回浮点形式(小数)
+      if (moment(params.endDate).diff(moment(params.beginDate), 'months', true) > 1) {
+        this.$message.error('单次最多只能导出1个月的数据,请缩小查询区间后再进行导出!')
         return
       }
       this.loading = true