业绩排行优化

1. 机构相关变量名称修改
2. 按年筛选未生效问题修改
3. 增加注释
This commit is contained in:
mengxiaolong
2021-01-21 14:40:15 +08:00
parent 1724dcec26
commit f3f2872406
2 changed files with 99 additions and 108 deletions

View File

@@ -139,8 +139,8 @@ export default {
calculateTotal() { calculateTotal() {
this.totals = [] this.totals = []
let columns = JSON.parse(JSON.stringify(this.columns)) let columns = JSON.parse(JSON.stringify(this.columns))
// 排除第一列(排名)
columns.splice(0, 1) columns.splice(0, 1)
console.dir(columns)
for (let column of columns) { for (let column of columns) {
let key = column.key let key = column.key
let total = this.values.reduce((prevVal, currVal) => { let total = this.values.reduce((prevVal, currVal) => {
@@ -199,8 +199,7 @@ export default {
active: { active: {
handler(nv) { handler(nv) {
this.$emit('updateQueryCom', nv) this.$emit('updateQueryCom', nv)
}, }
immediate: true
} }
}, },
filters: { filters: {

View File

@@ -23,17 +23,17 @@
<!-- 筛选 --> <!-- 筛选 -->
<div class="classification"> <div class="classification">
<span>机构名称: </span> <span>机构名称: </span>
<span @click="isProvinceConditionShow = true"> <span @click="isOrgLv2ConditionShow = true">
<span>{{ provinceName }}</span> <span>{{ OrgLv2Name }}</span>
<van-icon name="arrow-down" /> <van-icon name="arrow-down" />
</span> </span>
<template v-if="isMoreConditionShow"> <template v-if="isMoreConditionShow">
<span @click="isCityConditionShow = true"> <span @click="isOrgLv3ConditionShow = true">
<span>{{ cityName }}</span> <span>{{ OrgLv4Name }}</span>
<van-icon name="arrow-down" /> <van-icon name="arrow-down" />
</span> </span>
<span @click="isAreaConditionShow = true"> <span @click="isOrgLv4ConditionShow = true">
<span>{{ areaName }}</span> <span>{{ OrgLv3Name }}</span>
<van-icon name="arrow-down" /> <van-icon name="arrow-down" />
</span> </span>
</template> </template>
@@ -44,7 +44,7 @@
<Summarizing ref="summarizing" :typeIndex="typeIndex" /> <Summarizing ref="summarizing" :typeIndex="typeIndex" />
</van-tab> </van-tab>
<van-tab title="分机构"> <van-tab title="分机构">
<Organization ref="organization" :dataType.sync="typeIndex" :timeType.sync="timeType" @updateQueryCom="updateQueryCom" @updateData="updateData" /> <Organization ref="organization" :dataType.sync="typeIndex" :timeType.sync="timeType" @updateQueryCom="updateQueryCom" />
</van-tab> </van-tab>
</van-tabs> </van-tabs>
</div> </div>
@@ -59,17 +59,17 @@
<van-popup v-model="isTimeBarShow" position="bottom" :style="{ height: '40vh' }"> <van-popup v-model="isTimeBarShow" position="bottom" :style="{ height: '40vh' }">
<van-datetime-picker v-model="dayTimeCondition" type="datetime" :max-date="maxDate" @confirm="onDayTimeConditionConfirm" /> <van-datetime-picker v-model="dayTimeCondition" type="datetime" :max-date="maxDate" @confirm="onDayTimeConditionConfirm" />
</van-popup> </van-popup>
<!-- 分公司筛选栏 --> <!-- 二级机构筛选栏 -->
<van-popup v-model="isProvinceConditionShow" position="bottom" :style="{ height: '40vh' }"> <van-popup v-model="isOrgLv2ConditionShow" position="bottom" :style="{ height: '40vh' }">
<van-picker show-toolbar :columns="province" @confirm="onProvinceConditionConfirm" @cancel="isProvinceConditionShow = false" /> <van-picker show-toolbar :columns="province" @confirm="onOrgLv2ConditionConfirm" @cancel="isOrgLv2ConditionShow = false" />
</van-popup> </van-popup>
<!-- 营业部筛选栏 --> <!-- 三级机构筛选栏 -->
<van-popup v-model="isCityConditionShow" position="bottom" :style="{ height: '40vh' }"> <van-popup v-model="isOrgLv3ConditionShow" position="bottom" :style="{ height: '40vh' }">
<van-picker show-toolbar :columns="city" @confirm="onCityConditionConfirm" @cancel="isCityConditionShow = false" /> <van-picker show-toolbar :columns="city" @confirm="onOrgLv3ConditionConfirm" @cancel="isOrgLv3ConditionShow = false" />
</van-popup> </van-popup>
<!-- 营业区筛选栏 --> <!-- 四级机构筛选栏 -->
<van-popup v-model="isAreaConditionShow" position="bottom" :style="{ height: '40vh' }"> <van-popup v-model="isOrgLv4ConditionShow" position="bottom" :style="{ height: '40vh' }">
<van-picker show-toolbar :columns="area" @confirm="onAreaConditionConfirm" @cancel="isAreaConditionShow = false" /> <van-picker show-toolbar :columns="area" @confirm="onOrgLv4ConditionConfirm" @cancel="isOrgLv4ConditionShow = false" />
</van-popup> </van-popup>
<!-- --> <!-- -->
<van-popup v-model="isDayConditionShow" position="bottom" :style="{ height: '40vh' }"> <van-popup v-model="isDayConditionShow" position="bottom" :style="{ height: '40vh' }">
@@ -131,12 +131,12 @@ export default {
isSideBarShow: false, isSideBarShow: false,
// 日期筛选是否显示 // 日期筛选是否显示
isTimeBarShow: false, isTimeBarShow: false,
// 筛选是否显示 // 二级机构筛选是否显示
isProvinceConditionShow: false, isOrgLv2ConditionShow: false,
// 筛选是否显示 // 三级机构筛选是否显示
isCityConditionShow: false, isOrgLv3ConditionShow: false,
// 筛选是否显示 // 四级机构筛选是否显示
isAreaConditionShow: false, isOrgLv4ConditionShow: false,
// 日筛选是否显示 // 日筛选是否显示
isDayConditionShow: false, isDayConditionShow: false,
// 月筛选是否展示 // 月筛选是否展示
@@ -144,13 +144,13 @@ export default {
// 年筛选是否显示 // 年筛选是否显示
isYearConditionShow: false, isYearConditionShow: false,
point, point,
provinceName: '全国', OrgLv2Name: '全国',
cityName: '全部', OrgLv4Name: '全部',
areaName: '全部', OrgLv3Name: '全部',
provinceCode: 0, OrgLv2Code: 0,
provinceObjs: [], OrgLv2s: [],
cityCode: 0, OrgLv3Code: 0,
cityObjs: [], OrgLv3s: [],
areaCode: 0, areaCode: 0,
areaObjs: [], areaObjs: [],
years: [], years: [],
@@ -179,19 +179,19 @@ export default {
}, },
computed: { computed: {
isMoreConditionShow() { isMoreConditionShow() {
return this.provinceName !== '全国' return this.OrgLv2Name !== '全国'
}, },
province() { province() {
const name = ['全国'] const name = ['全国']
this.provinceObjs.forEach(item => { this.OrgLv2s.forEach(item => {
name.push(item.name) name.push(item.name)
}) })
return name return name
}, },
city() { city() {
const city = ['全部'] const city = ['全部']
this.cityObjs.forEach(item => { this.OrgLv3s.forEach(item => {
if (item.upBranchCode === this.provinceCode) { if (item.upBranchCode === this.OrgLv2Code) {
city.push(item.name) city.push(item.name)
} }
}) })
@@ -200,7 +200,7 @@ export default {
area() { area() {
const area = ['全部'] const area = ['全部']
this.areaObjs.forEach(item => { this.areaObjs.forEach(item => {
if (item.upBranchCode === this.cityCode) { if (item.upBranchCode === this.OrgLv3Code) {
area.push(item.name) area.push(item.name)
} }
}) })
@@ -225,8 +225,8 @@ export default {
async reset() { async reset() {
location.reload() location.reload()
}, },
async getSetDate() { async setRankData() {
let result = await this.getSummarizingData() let result = await this.getRankData()
if (result.result === '0') { if (result.result === '0') {
if (this.active === 0) { if (this.active === 0) {
this.setSummarizingData(result) this.setSummarizingData(result)
@@ -242,8 +242,8 @@ export default {
this.reset() this.reset()
} }
}, },
async dataTypeChange() { dataTypeChange() {
this.getSetDate() this.setRankData()
}, },
setRightBtn() { setRightBtn() {
setTimeout(() => { setTimeout(() => {
@@ -257,9 +257,6 @@ export default {
}, 1000) }, 1000)
window.appCallBack = this.appCallBack window.appCallBack = this.appCallBack
}, },
updateData() {
this.getSummarizingData()
},
async initData() { async initData() {
// 初始化年份筛选数据 // 初始化年份筛选数据
const currentYear = new Date().getFullYear() const currentYear = new Date().getFullYear()
@@ -268,36 +265,24 @@ export default {
this.years.unshift(year) this.years.unshift(year)
} }
/** /**
* 查询联动数据 * 查询机构下拉列表
* manageCode, manageLv传空查全 * manageCode, manageLv传空查全国所有二级机构
**/ **/
// 查询分公司
const res = await getComList({ const res = await getComList({
bussinessType: 'normal', bussinessType: 'normal',
manageCode: '', manageCode: '',
manageLv: '' manageLv: ''
}) })
if (res.result === '0') { if (res.result === '0') {
const firsts = res.content this.OrgLv2s.push(...res.content)
this.provinceObjs.push(...firsts)
} else { } else {
this.$toast(res.resultMessage) this.$toast(res.resultMessage)
} }
// 查询默认数据 // 查询默认数据
const result = await this.getSummarizingData() const result = await this.getRankData()
if (result.result === '0') { this.setSummarizingData(result)
const preDTO = result.content.preDTO ? result.content.preDTO : {}
const rlDTO = result.content.rlDTO ? result.content.rlDTO : {}
const productDTO = result.content.productDTO ? result.content.productDTO : {}
// 汇总业绩显示
this.$refs.summarizing.setPerformance(preDTO)
this.$refs.summarizing.setProducts(productDTO)
this.$refs.summarizing.setManpower(rlDTO)
} else {
this.$toast(result.resultMessage)
}
}, },
async getSummarizingData() { async getRankData() {
let date = null let date = null
switch (this.timeType) { switch (this.timeType) {
case 0: case 0:
@@ -318,79 +303,82 @@ export default {
break break
} }
this.params.date = dateUtil.formatDate(date, 'yyyy-MM-dd') this.params.date = dateUtil.formatDate(date, 'yyyy-MM-dd')
console.log('this.params :>> ', this.params)
let result = await getComPerformance(this.params) let result = await getComPerformance(this.params)
return result return result
}, },
async onDayConditionConfirm() { // 按日筛选
onDayConditionConfirm() {
this.isDayConditionShow = false this.isDayConditionShow = false
this.timeType = 0 this.timeType = 0
this.getSetDate() this.setRankData()
}, },
async onMonthConditionConfirm() { // 按月筛选
onMonthConditionConfirm() {
this.isMonthConditionShow = false this.isMonthConditionShow = false
this.timeType = 1 this.timeType = 1
this.getSetDate() this.setRankData()
}, },
async onYearConditionConfirm() { // 按年筛选
onYearConditionConfirm(year) {
this.yearCondition = year
this.isYearConditionShow = false this.isYearConditionShow = false
this.timeType = 2 this.timeType = 2
this.getSetDate() this.setRankData()
}, },
// 筛选分公司确认事件 // 筛选二级机构
async onProvinceConditionConfirm(data) { async onOrgLv2ConditionConfirm(data) {
this.isProvinceConditionShow = false this.isOrgLv2ConditionShow = false
let province = this.provinceObjs.find(item => item.name === data) let OrgLv2 = this.OrgLv2s.find(item => item.name === data)
if (province) { if (OrgLv2) {
this.provinceCode = province.code this.OrgLv2Code = OrgLv2.code
this.params.manageCode = this.provinceCode this.params.manageCode = this.OrgLv2Code
this.params.manageLv = '02' this.params.manageLv = '02'
} }
if (data === '全国') { if (data === '全国') {
this.params.manageCode = '86' this.params.manageCode = '86'
this.params.manageLv = '01' this.params.manageLv = '01'
} }
this.provinceName = data this.OrgLv2Name = data
this.cityName = '全部' this.OrgLv4Name = '全部'
this.areaName = '全部' this.OrgLv3Name = '全部'
// 查询全部支公司 // 查询三级机构
const res = await getComList({ const res = await getComList({
bussinessType: 'normal', bussinessType: 'normal',
manageCode: this.provinceCode, manageCode: this.OrgLv2Code,
manageLv: '02' manageLv: '02'
}) })
const seconds = res.content this.OrgLv3s.push(...res.content)
this.cityObjs.push(...seconds) this.setRankData()
this.getSetDate()
}, },
// 筛选城市确认事件 // 筛选三级机构
async onCityConditionConfirm(data) { async onOrgLv3ConditionConfirm(data) {
this.isCityConditionShow = false this.isOrgLv3ConditionShow = false
this.cityName = data this.OrgLv4Name = data
let city = this.cityObjs.find(item => item.name === data) let OrgLv3 = this.OrgLv3s.find(item => item.name === data)
if (city) { if (OrgLv3) {
this.cityCode = city.code this.OrgLv3Code = OrgLv3.code
this.params.manageCode = this.cityCode this.params.manageCode = this.OrgLv3Code
this.params.manageLv = '03' this.params.manageLv = '03'
} }
if (data === '全部') { if (data === '全部') {
this.params.manageCode = this.provinceCode this.params.manageCode = this.OrgLv2Code
this.params.manageLv = '02' this.params.manageLv = '02'
} }
this.areaName = '全部' this.OrgLv3Name = '全部'
// 查询营业部 // 查询四级机构
const res = await getComList({ const res = await getComList({
bussinessType: 'normal', bussinessType: 'normal',
manageCode: this.cityCode, manageCode: this.OrgLv3Code,
manageLv: '03' manageLv: '03'
}) })
const thirds = res.content this.areaObjs.push(...res.content)
this.areaObjs.push(...thirds) this.setRankData()
this.getSetDate()
}, },
// 筛选地区确认事件 // 筛选四级机构
async onAreaConditionConfirm(data) { async onOrgLv4ConditionConfirm(data) {
this.isAreaConditionShow = false this.isOrgLv4ConditionShow = false
this.areaName = data this.OrgLv3Name = data
let area = this.areaObjs.find(item => item.name === data) let area = this.areaObjs.find(item => item.name === data)
if (area) { if (area) {
this.areaCode = area.code this.areaCode = area.code
@@ -398,10 +386,10 @@ export default {
this.params.manageLv = '04' this.params.manageLv = '04'
} }
if (data === '全部') { if (data === '全部') {
this.params.manageCode = this.cityCode this.params.manageCode = this.OrgLv3Code
this.params.manageLv = '03' this.params.manageLv = '03'
} }
this.getSetDate() this.setRankData()
}, },
// 筛选时间确认事件 // 筛选时间确认事件
async onDayTimeConditionConfirm(time) { async onDayTimeConditionConfirm(time) {
@@ -409,10 +397,10 @@ export default {
this.timeType = 3 this.timeType = 3
this.timeCondition = dateUtil.formatDate(time, 'MM-dd HH:mm') this.timeCondition = dateUtil.formatDate(time, 'MM-dd HH:mm')
this.params.date = '' this.params.date = ''
this.getSetDate() this.setRankData()
}, },
// 切换数据类型事件 // 切换数据类型事件
async changeDataType(index) { changeDataType(index) {
if (this.typeIndex === index) { if (this.typeIndex === index) {
this.isSideBarShow = false this.isSideBarShow = false
return return
@@ -460,7 +448,7 @@ export default {
this.params.type = 'product' this.params.type = 'product'
break break
} }
let result = await this.getSummarizingData() let result = await this.getRankData()
this.$refs.organization.setTableData(result.content, this.params.type) this.$refs.organization.setTableData(result.content, this.params.type)
}, },
setSummarizingData(data) { setSummarizingData(data) {
@@ -479,6 +467,7 @@ export default {
}, },
watch: { watch: {
active(nv) { active(nv) {
// nv = 0 查询汇总
if (nv === 0) { if (nv === 0) {
this.params.type = 'all' this.params.type = 'all'
} else { } else {
@@ -493,10 +482,13 @@ export default {
this.params.type = 'product' this.params.type = 'product'
break break
} }
this.$nextTick(() => {
this.updateQueryCom(this.$refs.organization.active)
})
} }
}, },
async typeIndex() { async typeIndex() {
this.getSetDate() this.setRankData()
} }
} }
} }