Browse Source

修改bug

chenrui 9 months ago
parent
commit
c1d3b996b0

+ 19 - 25
src/views/reportData/tireFeeReport/monthQueryList.vue

@@ -12,7 +12,7 @@
           :model="queryParam">
           :model="queryParam">
           <a-row :gutter="15">
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
             <a-col :md="6" :sm="24">
-              <a-form-model-item label="查询月份" prop="beginDate">
+              <a-form-model-item label="查询月份" prop="queryDate">
                 <a-month-picker
                 <a-month-picker
                   id="monthQueryList-monthBox"
                   id="monthQueryList-monthBox"
                   class="monthBox"
                   class="monthBox"
@@ -168,8 +168,7 @@ export default {
       //  查询条件
       //  查询条件
       queryParam: {
       queryParam: {
         queryType: 'month', // 轮胎月度费用报表
         queryType: 'month', // 轮胎月度费用报表
-        beginDate: this.getMonthDetailDay().firstDay, // 开始时间
-        endDate: this.getMonthDetailDay().lastDay, // 结束时间
+        queryDate: moment().format('YYYYMM'), // 选择月份
 
 
         dealerLevel: undefined, // 客户等级
         dealerLevel: undefined, // 客户等级
         customSn: undefined, // 客户sn
         customSn: undefined, // 客户sn
@@ -191,7 +190,7 @@ export default {
       },
       },
       totalData: null, // 合计
       totalData: null, // 合计
       rules: {
       rules: {
-        'beginDate': [{ required: true, message: '请选择查询月份', trigger: 'change' }]
+        'queryDate': [{ required: true, message: '请选择查询月份', trigger: 'change' }]
       },
       },
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
       loadData: parameter => {
@@ -255,19 +254,19 @@ export default {
   },
   },
   methods: {
   methods: {
     // 根据月份获取第一天和最后一天
     // 根据月份获取第一天和最后一天
-    getMonthDetailDay (dateInfo) {
-      let nowDate = ''
-      if (!dateInfo) {
-        nowDate = moment().format('YYYY-MM')
-      } else {
-        nowDate = dateInfo
-      }
-      // 月份的第一天
-      const firstDayOfMonth = moment(nowDate).format('YYYY-MM-DD') + ' 00:00:00'
-      // 月份的最后一天
-      const lastDayOfMonth = moment(nowDate).endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
-      return { firstDay: firstDayOfMonth, lastDay: lastDayOfMonth }
-    },
+    // getMonthDetailDay (dateInfo) {
+    //   let nowDate = ''
+    //   if (!dateInfo) {
+    //     nowDate = moment().format('YYYY-MM')
+    //   } else {
+    //     nowDate = dateInfo
+    //   }
+    //   // 月份的第一天
+    //   const firstDayOfMonth = moment(nowDate).format('YYYY-MM-DD') + ' 00:00:00'
+    //   // 月份的最后一天
+    //   const lastDayOfMonth = moment(nowDate).endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
+    //   return { firstDay: firstDayOfMonth, lastDay: lastDayOfMonth }
+    // },
     // 选择月份  禁用选择当月以后日期
     // 选择月份  禁用选择当月以后日期
     disabledDate (current) {
     disabledDate (current) {
       return current && current >= moment().endOf('day')
       return current && current >= moment().endOf('day')
@@ -276,12 +275,9 @@ export default {
     onChangeMonth (date, dateString) {
     onChangeMonth (date, dateString) {
       this.monthVal = dateString
       this.monthVal = dateString
       if (date && dateString != '') {
       if (date && dateString != '') {
-        const timeObj = this.getMonthDetailDay(dateString)
-        this.queryParam.beginDate = timeObj.firstDay
-        this.queryParam.endDate = timeObj.lastDay
+        this.queryParam.queryDate = dateString.replace('-', '')
       } else {
       } else {
-        this.queryParam.beginDate = void 0
-        this.queryParam.endDate = void 0
+        this.queryParam.queryDate = void 0
       }
       }
     },
     },
     // 查询
     // 查询
@@ -330,10 +326,8 @@ export default {
     //  重置
     //  重置
     resetSearchForm () {
     resetSearchForm () {
       this.queryParam.queryType = 'month'
       this.queryParam.queryType = 'month'
-      const timeObj = this.getMonthDetailDay()
       this.monthVal = moment().format('YYYY-MM')
       this.monthVal = moment().format('YYYY-MM')
-      this.queryParam.beginDate = timeObj.firstDay // 开始时间
-      this.queryParam.endDate = timeObj.lastDay// 结束时间
+      this.queryParam.queryDate = moment().format('YYYYMM')
       this.queryParam.dealerEntity.provinceSn = undefined
       this.queryParam.dealerEntity.provinceSn = undefined
       this.queryParam.dealerEntity.citySn = undefined
       this.queryParam.dealerEntity.citySn = undefined
       this.queryParam.dealerEntity.districtSn = undefined
       this.queryParam.dealerEntity.districtSn = undefined

+ 17 - 20
src/views/reportData/tireFeeReport/quarterQueryList.vue

@@ -113,7 +113,6 @@
 import { commonMixin } from '@/utils/mixin'
 import { commonMixin } from '@/utils/mixin'
 import { hdExportExcel } from '@/libs/exportExcel'
 import { hdExportExcel } from '@/libs/exportExcel'
 import moment from 'moment'
 import moment from 'moment'
-import getDate from '@/libs/getDate.js'
 // 组件
 // 组件
 import { STable, VSelect } from '@/components'
 import { STable, VSelect } from '@/components'
 import quarterDate from '@/views/common/quarterDate.vue'
 import quarterDate from '@/views/common/quarterDate.vue'
@@ -139,8 +138,7 @@ export default {
       queryParam: {
       queryParam: {
         time: [], // 日期
         time: [], // 日期
         queryType: 'quarter', // 轮胎季度费用报表
         queryType: 'quarter', // 轮胎季度费用报表
-        beginDate: undefined, // 开始时间
-        endDate: undefined, // 结束时间
+        queryDate: undefined, // 选择年份+季度
         dealerLevel: undefined, // 客户级别
         dealerLevel: undefined, // 客户级别
         subareaArea: {
         subareaArea: {
           subareaSn: '', // 区域
           subareaSn: '', // 区域
@@ -217,20 +215,20 @@ export default {
   methods: {
   methods: {
     // 获取季度默认值
     // 获取季度默认值
     getQuarterVal () {
     getQuarterVal () {
-      // 获取今年的季度
-      const thisQuarter = moment().quarter()
-      // 获取去年年份
-      const lastYear = moment().subtract(1, 'years').format('YYYY')
-      this.queryParam.time = [lastYear, thisQuarter]
-      const valStr = getDate.getQuarterByYear(lastYear, thisQuarter)
-      if (valStr && Object.keys(valStr).length > 0) {
-        this.queryParam.beginDate = valStr.start
-        this.queryParam.endDate = valStr.end
+      // 获取上个月是今年的第几季度
+      const lastQuarter = moment().subtract(1, 'month').quarter()
+      // 获取今年年份
+      const thisYear = moment().year()
+      this.queryParam.time = [thisYear, lastQuarter]
+      if (this.queryParam.time.length > 0) {
+        this.queryParam.queryDate = thisYear + '0' + lastQuarter
       }
       }
     },
     },
     // 查询
     // 查询
     handleSearch () {
     handleSearch () {
       const _this = this
       const _this = this
+      console.log('1111111111111111:', _this.queryParam)
+      console.log('2222222222222222:', _this.queryParam.queryDate)
       this.$refs.ruleForm.validate(valid => {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
         if (valid) {
           _this.$refs.table.refresh(true)
           _this.$refs.table.refresh(true)
@@ -264,12 +262,10 @@ export default {
     //  日期选择  change
     //  日期选择  change
     dateChange (date, valStr) {
     dateChange (date, valStr) {
       this.queryParam.time = date[0] && date[1] ? date : []
       this.queryParam.time = date[0] && date[1] ? date : []
-      if (valStr && Object.keys(valStr).length > 0) {
-        this.queryParam.beginDate = valStr.start
-        this.queryParam.endDate = valStr.end
+      if (date && date.length > 0) {
+        this.queryParam.queryDate = date[0] + '0' + date[1]
       } else {
       } else {
-        this.queryParam.beginDate = ''
-        this.queryParam.endDate = ''
+        this.queryParam.queryDate = ''
       }
       }
     },
     },
     // 区域分区  change
     // 区域分区  change
@@ -279,10 +275,8 @@ export default {
     },
     },
     //  重置
     //  重置
     resetSearchForm () {
     resetSearchForm () {
+      // this.$refs.quarterDate.resetDate()
       this.queryParam.queryType = 'quarter'
       this.queryParam.queryType = 'quarter'
-      this.queryParam.time = []
-      this.queryParam.beginDate = ''
-      this.queryParam.endDate = ''
       this.queryParam.dealerEntity.provinceSn = undefined
       this.queryParam.dealerEntity.provinceSn = undefined
       this.queryParam.dealerEntity.citySn = undefined
       this.queryParam.dealerEntity.citySn = undefined
       this.queryParam.dealerEntity.districtSn = undefined
       this.queryParam.dealerEntity.districtSn = undefined
@@ -296,6 +290,9 @@ export default {
       if (this.advanced) {
       if (this.advanced) {
         this.$refs.dealerSubareaScopeList.resetForm()
         this.$refs.dealerSubareaScopeList.resetForm()
       }
       }
+      this.getQuarterVal()
+      console.log('1111111111111111:', this.queryParam.time)
+      console.log('2222222222222222:', this.queryParam.queryDate)
       this.totalData = null
       this.totalData = null
       this.$refs.areaList.clearData()
       this.$refs.areaList.clearData()
       this.$refs.table.clearTable()
       this.$refs.table.clearTable()

+ 7 - 14
src/views/reportData/tireFeeReport/yearQueryList.vue

@@ -12,12 +12,12 @@
           :model="queryParam">
           :model="queryParam">
           <a-row :gutter="15">
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
             <a-col :md="6" :sm="24">
-              <a-form-model-item label="查询年份" prop="beginDate">
+              <a-form-model-item label="查询年份" prop="queryDate">
                 <a-select
                 <a-select
                   id="yearQueryList-time"
                   id="yearQueryList-time"
                   style="width: 100%"
                   style="width: 100%"
                   placeholder="请选择年份"
                   placeholder="请选择年份"
-                  :value="currYear"
+                  :value="queryParam.queryDate"
                   @change="changeYear"
                   @change="changeYear"
                   allowClear>
                   allowClear>
                   <a-select-option v-for="item in years" :value="item" :key="item">
                   <a-select-option v-for="item in years" :value="item" :key="item">
@@ -144,12 +144,10 @@ export default {
       exportLoading: false, // 导出按钮加载状态
       exportLoading: false, // 导出按钮加载状态
       showExport: false, // 导出弹窗
       showExport: false, // 导出弹窗
       toYears: new Date().getFullYear(), // 今年
       toYears: new Date().getFullYear(), // 今年
-      currYear: moment().subtract(1, 'years').format('YYYY'), // 查询年份
       //  查询条件
       //  查询条件
       queryParam: {
       queryParam: {
         queryType: 'year', // 轮胎年度费用报表
         queryType: 'year', // 轮胎年度费用报表
-        beginDate: moment().subtract(1, 'years').format('YYYY') + '-01-31 00:00:00', // 开始时间
-        endDate: moment().subtract(1, 'years').format('YYYY') + '-12-31 23:59:59', // 结束时间
+        queryDate: moment().subtract(1, 'years').format('YYYY'), // 选择年份
         dealerLevel: undefined, // 客户等级
         dealerLevel: undefined, // 客户等级
         customSn: undefined, // 客户sn
         customSn: undefined, // 客户sn
         subareaArea: {
         subareaArea: {
@@ -168,7 +166,7 @@ export default {
       yearInfo: '',
       yearInfo: '',
       showOutDetail: false, // 出库明细弹窗
       showOutDetail: false, // 出库明细弹窗
       rules: {
       rules: {
-        'beginDate': [{ required: true, message: '请选择查询年份', trigger: 'change' }]
+        'queryDate': [{ required: true, message: '请选择查询年份', trigger: 'change' }]
       },
       },
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
       loadData: parameter => {
@@ -237,13 +235,10 @@ export default {
     // 选择查询年份  change
     // 选择查询年份  change
     changeYear (val) {
     changeYear (val) {
       if (!val) {
       if (!val) {
-        this.queryParam.beginDate = ''
-        this.queryParam.endDate = ''
+        this.queryParam.queryDate = void 0
       } else {
       } else {
-        this.queryParam.beginDate = val + '-01-31 00:00:00'
-        this.queryParam.endDate = val + '-12-31 23:59:59'
+        this.queryParam.queryDate = val
       }
       }
-      this.currYear = val
     },
     },
     // 查询
     // 查询
     handleSearch () {
     handleSearch () {
@@ -287,9 +282,7 @@ export default {
     resetSearchForm () {
     resetSearchForm () {
       this.queryParam.queryType = 'year'
       this.queryParam.queryType = 'year'
       const lastYear = moment().subtract(1, 'years').format('YYYY')
       const lastYear = moment().subtract(1, 'years').format('YYYY')
-      this.currYear = lastYear
-      this.queryParam.beginDate = lastYear + '-01-31 00:00:00'
-      this.queryParam.endDate = lastYear + '-12-31 23:59:59'
+      this.queryParam.queryDate = lastYear
       this.queryParam.dealerEntity.provinceSn = undefined
       this.queryParam.dealerEntity.provinceSn = undefined
       this.queryParam.dealerEntity.citySn = undefined
       this.queryParam.dealerEntity.citySn = undefined
       this.queryParam.dealerEntity.districtSn = undefined
       this.queryParam.dealerEntity.districtSn = undefined