|
@@ -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">
|
|
@@ -56,7 +57,7 @@
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-model-item label="客服">
|
|
|
- <customerService ref="customerName" id="customerCountList-customerName" v-model="queryParam.kfSn"></customerService>
|
|
|
+ <customerService ref="customerName" id="customerCountList-customerName" v-model="queryParam.subareaArea.kfSn"></customerService>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
</template>
|
|
@@ -132,11 +133,21 @@ import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
|
|
|
import BizUser from '@/views/common/bizUser.js'
|
|
|
import customerService from '@/views/common/customerService.vue'
|
|
|
// 接口
|
|
|
-import { salesStatsDealerList, salesStatsDealerTitle, salesStatsDealerCount, salesStatsDealerExport } from '@/api/reportData'
|
|
|
+import { salesStatsDealerList, salesStatsDealerCount, salesStatsDealerExport } from '@/api/reportData'
|
|
|
export default {
|
|
|
name: 'CustomerCountList',
|
|
|
mixins: [commonMixin],
|
|
|
components: { STable, VSelect, subarea, AreaList, dealerSubareaScopeList, BizUser, customerService },
|
|
|
+ props: {
|
|
|
+ removeReportFlag: {
|
|
|
+ type: [String, Number],
|
|
|
+ default: '0'
|
|
|
+ },
|
|
|
+ tableTitle: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {}
|
|
|
+ }
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
spinning: false,
|
|
@@ -144,13 +155,14 @@ 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
|
|
|
+ dealerSnOwner: undefined, // 客户sn
|
|
|
dealerName: undefined, // 客户名称
|
|
|
provinceSn: undefined, // 省
|
|
|
citySn: undefined, // 市
|
|
@@ -158,20 +170,25 @@ export default {
|
|
|
subareaArea: {
|
|
|
subareaSn: '', // 区域
|
|
|
subareaAreaSn: '', // 分区
|
|
|
- bizUserSn: undefined// 区域负责人
|
|
|
- },
|
|
|
- kfSn: undefined// 客服
|
|
|
+ bizUserSn: undefined, // 区域负责人
|
|
|
+ kfSn: undefined// 客服
|
|
|
+ }
|
|
|
},
|
|
|
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)
|
|
|
+ params.removeReportFlag = this.removeReportFlag
|
|
|
// 获取列表数据 有分页
|
|
|
return salesStatsDealerList(params).then(res => {
|
|
|
let data
|
|
@@ -203,20 +220,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) {
|
|
@@ -229,16 +235,16 @@ export default {
|
|
|
// 获取表头
|
|
|
async getTableTitle () {
|
|
|
const _this = this
|
|
|
- const tableTitle = await salesStatsDealerTitle().then(res => res.data)
|
|
|
- this.columns = tableTitle.list
|
|
|
- this.countLabel = tableTitle.count
|
|
|
+ this.columns = _this.tableTitle.list
|
|
|
+ this.countLabel = _this.tableTitle.count
|
|
|
this.columns.map(item => {
|
|
|
- item.titleNum = item.title
|
|
|
- let mw = 20
|
|
|
- if (item.customRender == 'amount') {
|
|
|
- mw = 15
|
|
|
+ const mw = item.type == 'amount' ? 15 : 17
|
|
|
+ const textLen = typeof item.title === 'string' ? item.title.length : item.txtLen
|
|
|
+ const w = textLen * mw
|
|
|
+ const tw = w <= 80 ? mw * 5 : w
|
|
|
+ if (item.type == 'amount') {
|
|
|
if (item.colour && item.colour === 'red') {
|
|
|
- item.title = <span style="color:red;">{item.titleNum}</span>
|
|
|
+ item.title = <span style="color:red;">{ item.title }</span>
|
|
|
item.customRender = (text) => { return <span style="color:red;">{(text || text == 0) ? _this.toThousands(text) : '--'}</span> }
|
|
|
} else {
|
|
|
item.customRender = function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
|
|
@@ -246,8 +252,6 @@ export default {
|
|
|
} else {
|
|
|
item.customRender = function (text) { return text || '--' }
|
|
|
}
|
|
|
- const w = item.titleNum.length * mw
|
|
|
- const tw = w <= 80 ? mw * 5 : w
|
|
|
item.width = tw + 'px'
|
|
|
this.tableWidth = this.tableWidth + tw
|
|
|
})
|
|
@@ -255,20 +259,17 @@ 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) {
|
|
|
this.queryParam.dealerName = val.name
|
|
|
- this.queryParam.dealerSn = val.key
|
|
|
+ this.queryParam.dealerSnOwner = val.key
|
|
|
},
|
|
|
// 统计
|
|
|
getCount (params) {
|
|
@@ -299,18 +300,19 @@ 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
|
|
|
this.queryParam.dealerName = undefined
|
|
|
- this.queryParam.dealerSn = undefined
|
|
|
+ this.queryParam.dealerSnOwner = undefined
|
|
|
this.queryParam.bizUserSn = undefined
|
|
|
this.queryParam.subareaArea.subareaSn = ''
|
|
|
this.queryParam.subareaArea.subareaAreaSn = ''
|
|
|
this.queryParam.subareaArea.bizUserSn = undefined
|
|
|
+ this.queryParam.subareaArea.kfSn = undefined
|
|
|
this.queryParam.dealerLevel = undefined
|
|
|
if (this.advanced) {
|
|
|
this.$refs.subarea.clearData()
|
|
@@ -337,9 +339,10 @@ export default {
|
|
|
exportList () {
|
|
|
const _this = this
|
|
|
const params = JSON.parse(JSON.stringify(_this.queryParam))
|
|
|
+ params.removeReportFlag = this.removeReportFlag
|
|
|
_this.exportLoading = true
|
|
|
_this.spinning = true
|
|
|
- hdExportExcel(salesStatsDealerExport, params, '开单统计报表(客户)', function () {
|
|
|
+ hdExportExcel(salesStatsDealerExport, params, this.removeReportFlag == 0 ? '开单统计报表(客户)' : '未统计销售退货(客户)', function () {
|
|
|
_this.exportLoading = false
|
|
|
_this.spinning = false
|
|
|
})
|
|
@@ -349,6 +352,7 @@ export default {
|
|
|
this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
this.setTableH()
|
|
|
this.resetSearchForm()
|
|
|
+ this.getTableTitle()
|
|
|
})
|
|
|
},
|
|
|
// 计算表格高度
|
|
@@ -360,14 +364,12 @@ export default {
|
|
|
mounted () {
|
|
|
if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
|
|
|
this.pageInit()
|
|
|
- this.getTableTitle()
|
|
|
}
|
|
|
},
|
|
|
activated () {
|
|
|
// 如果是新页签打开,则重置当前页面
|
|
|
if (this.$store.state.app.isNewTab) {
|
|
|
this.pageInit()
|
|
|
- this.getTableTitle()
|
|
|
}
|
|
|
}
|
|
|
}
|