|
@@ -8,18 +8,19 @@
|
|
|
ref="ruleForm"
|
|
|
class="form-model-con"
|
|
|
layout="inline"
|
|
|
- :rules="rules"
|
|
|
:model="queryParam">
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :md="6" :sm="24">
|
|
|
- <a-form-model-item label="月份" prop="beginDate">
|
|
|
- <a-month-picker
|
|
|
+ <a-form-model-item label="月份" required>
|
|
|
+ <a-range-picker
|
|
|
id="customerCountList-monthBox"
|
|
|
class="monthBox"
|
|
|
- :disabled-date="disabledDate"
|
|
|
+ :placeholder="['开始月份', '结束月份']"
|
|
|
+ format="YYYY-MM"
|
|
|
v-model="monthVal"
|
|
|
- placeholder="请选择月份"
|
|
|
- @change="onChangeMonth" />
|
|
|
+ :mode="mode"
|
|
|
+ @panelChange="handlePanelChange"
|
|
|
+ />
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24">
|
|
@@ -144,11 +145,12 @@ export default {
|
|
|
advanced: true, // 高级搜索 展开/关闭
|
|
|
tableHeight: 0, // 表格高度
|
|
|
exportLoading: false, // 导出按钮加载状态
|
|
|
- monthVal: moment().format('YYYY-MM'), // 初始化月份值
|
|
|
+ monthVal: [moment().format('YYYY-MM'), moment().format('YYYY-MM')], // 初始化月份值
|
|
|
+ mode: ['month', 'month'],
|
|
|
// 查询条件
|
|
|
queryParam: {
|
|
|
- beginDate: moment().startOf('month').format('YYYY-MM-DD') + ' 00:00:00', // 月份开始时间
|
|
|
- endDate: moment().endOf('month').format('YYYY-MM-DD') + ' 23:59:59', // 月份结束时间
|
|
|
+ beginDate: '', // 月份开始时间
|
|
|
+ endDate: '', // 月份结束时间
|
|
|
dealerLevel: undefined, // 客户等级
|
|
|
dealerSn: undefined, // 客户sn
|
|
|
dealerName: undefined, // 客户名称
|
|
@@ -164,13 +166,17 @@ export default {
|
|
|
},
|
|
|
columns: [], // 表格 列数据
|
|
|
totalData: null, // 合计
|
|
|
- rules: {
|
|
|
- 'beginDate': [{ required: true, message: '请选择查询月份', trigger: 'change' }]
|
|
|
- },
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
|
this.disabled = true
|
|
|
this.spinning = true
|
|
|
+ if (this.monthVal) {
|
|
|
+ this.queryParam.beginDate = this.getMonthRange(this.monthVal[0]).firstDay
|
|
|
+ this.queryParam.endDate = this.getMonthRange(this.monthVal[1]).lastDay
|
|
|
+ } else {
|
|
|
+ this.queryParam.beginDate = undefined
|
|
|
+ this.queryParam.endDate = undefined
|
|
|
+ }
|
|
|
const params = Object.assign(parameter, this.queryParam)
|
|
|
// 获取列表数据 有分页
|
|
|
return salesStatsDealerList(params).then(res => {
|
|
@@ -203,20 +209,9 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- // 选择月份 禁用选择当月以后日期
|
|
|
- disabledDate (current) {
|
|
|
- return current && current >= moment().endOf('day')
|
|
|
- },
|
|
|
- // 选择月份 change
|
|
|
- onChangeMonth (date, dateString) {
|
|
|
- this.monthVal = dateString
|
|
|
- if (date && dateString != '') {
|
|
|
- this.queryParam.beginDate = this.getMonthRange(dateString).firstDay
|
|
|
- this.queryParam.endDate = this.getMonthRange(dateString).lastDay
|
|
|
- } else {
|
|
|
- this.queryParam.beginDate = undefined
|
|
|
- this.queryParam.endDate = undefined
|
|
|
- }
|
|
|
+ handlePanelChange (value, mode) {
|
|
|
+ this.monthVal = value
|
|
|
+ this.mode = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]]
|
|
|
},
|
|
|
// 获取指定月份 第一天和最后一天
|
|
|
getMonthRange (targetMonth) {
|
|
@@ -255,15 +250,12 @@ export default {
|
|
|
},
|
|
|
// 查询
|
|
|
handleSearch () {
|
|
|
- const _this = this
|
|
|
- this.$refs.ruleForm.validate(valid => {
|
|
|
- if (valid) {
|
|
|
- _this.$refs.table.refresh(true)
|
|
|
- } else {
|
|
|
- _this.$message.error('请选择查询月份')
|
|
|
- return false
|
|
|
- }
|
|
|
- })
|
|
|
+ const date = this.monthVal
|
|
|
+ if (date && date[0] && date[1]) {
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ } else {
|
|
|
+ this.$message.error('请选择查询月份')
|
|
|
+ }
|
|
|
},
|
|
|
// 客户名称 change
|
|
|
custChange (val) {
|
|
@@ -299,9 +291,9 @@ export default {
|
|
|
},
|
|
|
// 重置
|
|
|
resetSearchForm () {
|
|
|
- this.queryParam.beginDate = moment().startOf('month').format('YYYY-MM-DD') + ' 00:00:00'
|
|
|
- this.queryParam.endDate = moment().endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
|
|
|
- this.monthVal = moment().format('YYYY-MM')
|
|
|
+ this.queryParam.beginDate = ''
|
|
|
+ this.queryParam.endDate = ''
|
|
|
+ this.monthVal = [moment().format('YYYY-MM'), moment().format('YYYY-MM')]
|
|
|
this.queryParam.provinceSn = undefined
|
|
|
this.queryParam.citySn = undefined
|
|
|
this.queryParam.districtSn = undefined
|