|
@@ -49,7 +49,7 @@
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
</template>
|
|
|
- <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
<a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="allocateBillList-refresh">查询</a-button>
|
|
|
<a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="allocateBillList-reset">重置</a-button>
|
|
|
<a-button
|
|
@@ -192,40 +192,26 @@ export default {
|
|
|
methods: {
|
|
|
// 不可选日期
|
|
|
disabledDate (current) {
|
|
|
- const tYearVs = moment().subtract(2, 'years') // 两年前 负值
|
|
|
+ // 最早可倒推选择两年数据,最晚为今天
|
|
|
+ const minYearVs = moment().subtract(2, 'years') // 两年前 负值
|
|
|
+ const maxYearVs = moment().endOf('day') // 今天,包含今天
|
|
|
// 限制最多只能查一年区间的数据
|
|
|
- // if (this.selectPriceDate) {
|
|
|
- // const yearVs = moment(this.selectPriceDate, 'YYYY-MM-DD').subtract(1, 'years') // 去年 负值
|
|
|
- // const yearSVs = moment(this.selectPriceDate, 'YYYY-MM-DD').add(1, 'years') // 明年 正值
|
|
|
- // // 判断两个时间段是否相差m年 第二个参数指相差单位,第三个参数指是否返回浮点形式(小数)
|
|
|
- // // console.log(tYearVs.diff(yearVs, 'days'), '---------比小') // 负
|
|
|
- // // console.log(yearSVs.diff(moment(), 'days'), '---------比大') // 正
|
|
|
- // // const beginDate = tYearVs.diff(yearVs, 'days') > 0 ? yearVs : tYearVs
|
|
|
- // // const endDate = moment().diff(yearSVs, 'days') > 0 ? yearSVs : moment()
|
|
|
- // // return current && current.valueOf() > beginDate || current && current.valueOf() < endDate
|
|
|
- // // console.log(moment().diff(tYearVs, 'days'), '---------两年前和今天相差天数')
|
|
|
- // // console.log(moment().diff(yearVs, 'days'), '---------去年和今天相差天数')
|
|
|
- // const tDiffV = moment().diff(tYearVs, 'days') // 两年前和今天相差天数
|
|
|
- // const oDiffV = moment().diff(yearVs, 'days') // 去年和今天相差天数
|
|
|
- // // console.log(tDiffV, '+++相差比值', oDiffV)
|
|
|
- // const beginDate = tDiffV > oDiffV ? tYearVs : yearVs
|
|
|
- // const endDate = moment().diff(yearSVs, 'days') > 0 ? yearSVs : moment()
|
|
|
- // return current && current.valueOf() > beginDate.valueOf() || current && current.valueOf() < endDate.valueOf()
|
|
|
- // } else {
|
|
|
- return current && current.valueOf() > Date.now() || current && current.valueOf() < tYearVs
|
|
|
- // }
|
|
|
+ if (this.selectPriceDate) {
|
|
|
+ const oMinYearVs = moment(this.selectPriceDate, 'YYYY-MM-DD').subtract(1, 'years') // 当前选中开始日期前推一年
|
|
|
+ const oMaxYearVs = moment(this.selectPriceDate, 'YYYY-MM-DD').add(1, 'years') // 当前选中开始日期后推一年
|
|
|
+ // 判断两个时间段是否相差m天 第二个参数指相差单位,第三个参数指是否返回浮点形式(小数)
|
|
|
+ const beginDate = minYearVs.diff(oMinYearVs, 'days') > 0 ? minYearVs : oMinYearVs // 若当前选中开始日期前推一年超出最多倒推两年数据时,则以两年为标准
|
|
|
+ const endDate = maxYearVs.diff(oMaxYearVs, 'days') > 0 ? oMaxYearVs : maxYearVs // 若当前选中开始日期后推一年超出今天时,则以今天为标准
|
|
|
+ return current && current < beginDate || current && current > endDate
|
|
|
+ } else {
|
|
|
+ return current && current > maxYearVs || current && current < minYearVs
|
|
|
+ }
|
|
|
},
|
|
|
// 日期 change
|
|
|
dateChange (date, dateStrings) {
|
|
|
this.selectPriceDate = ''
|
|
|
- console.log('--------change', date, dateStrings)
|
|
|
- // // 判断两个时间段是否相差m年 第二个参数指相差单位,第三个参数指是否返回浮点形式(小数)
|
|
|
- // if (moment(dateStrings[0]).diff(moment(dateStrings[1]), 'years', true) > 1) {
|
|
|
- // this.$message.error('仅支持导出最多3个月的数据,请先修改收取时间再进行导出!')
|
|
|
- // }
|
|
|
},
|
|
|
dateCalendarChange (date, dateStrings) {
|
|
|
- console.log('--------calendar', date, dateStrings)
|
|
|
this.selectPriceDate = date[0]
|
|
|
},
|
|
|
// 重置
|