mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-09 09:56:43 +08:00
业绩排行优化
1. 机构相关变量名称修改 2. 按年筛选未生效问题修改 3. 增加注释
This commit is contained in:
@@ -139,8 +139,8 @@ export default {
|
||||
calculateTotal() {
|
||||
this.totals = []
|
||||
let columns = JSON.parse(JSON.stringify(this.columns))
|
||||
// 排除第一列(排名)
|
||||
columns.splice(0, 1)
|
||||
console.dir(columns)
|
||||
for (let column of columns) {
|
||||
let key = column.key
|
||||
let total = this.values.reduce((prevVal, currVal) => {
|
||||
@@ -199,8 +199,7 @@ export default {
|
||||
active: {
|
||||
handler(nv) {
|
||||
this.$emit('updateQueryCom', nv)
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
|
||||
@@ -23,17 +23,17 @@
|
||||
<!-- 筛选 -->
|
||||
<div class="classification">
|
||||
<span>机构名称: </span>
|
||||
<span @click="isProvinceConditionShow = true">
|
||||
<span>{{ provinceName }}</span>
|
||||
<span @click="isOrgLv2ConditionShow = true">
|
||||
<span>{{ OrgLv2Name }}</span>
|
||||
<van-icon name="arrow-down" />
|
||||
</span>
|
||||
<template v-if="isMoreConditionShow">
|
||||
<span @click="isCityConditionShow = true">
|
||||
<span>{{ cityName }}</span>
|
||||
<span @click="isOrgLv3ConditionShow = true">
|
||||
<span>{{ OrgLv4Name }}</span>
|
||||
<van-icon name="arrow-down" />
|
||||
</span>
|
||||
<span @click="isAreaConditionShow = true">
|
||||
<span>{{ areaName }}</span>
|
||||
<span @click="isOrgLv4ConditionShow = true">
|
||||
<span>{{ OrgLv3Name }}</span>
|
||||
<van-icon name="arrow-down" />
|
||||
</span>
|
||||
</template>
|
||||
@@ -44,7 +44,7 @@
|
||||
<Summarizing ref="summarizing" :typeIndex="typeIndex" />
|
||||
</van-tab>
|
||||
<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-tabs>
|
||||
</div>
|
||||
@@ -59,17 +59,17 @@
|
||||
<van-popup v-model="isTimeBarShow" position="bottom" :style="{ height: '40vh' }">
|
||||
<van-datetime-picker v-model="dayTimeCondition" type="datetime" :max-date="maxDate" @confirm="onDayTimeConditionConfirm" />
|
||||
</van-popup>
|
||||
<!-- 分公司筛选栏 -->
|
||||
<van-popup v-model="isProvinceConditionShow" position="bottom" :style="{ height: '40vh' }">
|
||||
<van-picker show-toolbar :columns="province" @confirm="onProvinceConditionConfirm" @cancel="isProvinceConditionShow = false" />
|
||||
<!-- 二级机构筛选栏 -->
|
||||
<van-popup v-model="isOrgLv2ConditionShow" position="bottom" :style="{ height: '40vh' }">
|
||||
<van-picker show-toolbar :columns="province" @confirm="onOrgLv2ConditionConfirm" @cancel="isOrgLv2ConditionShow = false" />
|
||||
</van-popup>
|
||||
<!-- 营业部筛选栏 -->
|
||||
<van-popup v-model="isCityConditionShow" position="bottom" :style="{ height: '40vh' }">
|
||||
<van-picker show-toolbar :columns="city" @confirm="onCityConditionConfirm" @cancel="isCityConditionShow = false" />
|
||||
<!-- 三级机构筛选栏 -->
|
||||
<van-popup v-model="isOrgLv3ConditionShow" position="bottom" :style="{ height: '40vh' }">
|
||||
<van-picker show-toolbar :columns="city" @confirm="onOrgLv3ConditionConfirm" @cancel="isOrgLv3ConditionShow = false" />
|
||||
</van-popup>
|
||||
<!-- 营业区筛选栏 -->
|
||||
<van-popup v-model="isAreaConditionShow" position="bottom" :style="{ height: '40vh' }">
|
||||
<van-picker show-toolbar :columns="area" @confirm="onAreaConditionConfirm" @cancel="isAreaConditionShow = false" />
|
||||
<!-- 四级机构筛选栏 -->
|
||||
<van-popup v-model="isOrgLv4ConditionShow" position="bottom" :style="{ height: '40vh' }">
|
||||
<van-picker show-toolbar :columns="area" @confirm="onOrgLv4ConditionConfirm" @cancel="isOrgLv4ConditionShow = false" />
|
||||
</van-popup>
|
||||
<!-- 日 -->
|
||||
<van-popup v-model="isDayConditionShow" position="bottom" :style="{ height: '40vh' }">
|
||||
@@ -131,12 +131,12 @@ export default {
|
||||
isSideBarShow: false,
|
||||
// 日期筛选是否显示
|
||||
isTimeBarShow: false,
|
||||
// 省筛选是否显示
|
||||
isProvinceConditionShow: false,
|
||||
// 市筛选是否显示
|
||||
isCityConditionShow: false,
|
||||
// 区筛选是否显示
|
||||
isAreaConditionShow: false,
|
||||
// 二级机构筛选是否显示
|
||||
isOrgLv2ConditionShow: false,
|
||||
// 三级机构筛选是否显示
|
||||
isOrgLv3ConditionShow: false,
|
||||
// 四级机构筛选是否显示
|
||||
isOrgLv4ConditionShow: false,
|
||||
// 日筛选是否显示
|
||||
isDayConditionShow: false,
|
||||
// 月筛选是否展示
|
||||
@@ -144,13 +144,13 @@ export default {
|
||||
// 年筛选是否显示
|
||||
isYearConditionShow: false,
|
||||
point,
|
||||
provinceName: '全国',
|
||||
cityName: '全部',
|
||||
areaName: '全部',
|
||||
provinceCode: 0,
|
||||
provinceObjs: [],
|
||||
cityCode: 0,
|
||||
cityObjs: [],
|
||||
OrgLv2Name: '全国',
|
||||
OrgLv4Name: '全部',
|
||||
OrgLv3Name: '全部',
|
||||
OrgLv2Code: 0,
|
||||
OrgLv2s: [],
|
||||
OrgLv3Code: 0,
|
||||
OrgLv3s: [],
|
||||
areaCode: 0,
|
||||
areaObjs: [],
|
||||
years: [],
|
||||
@@ -179,19 +179,19 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
isMoreConditionShow() {
|
||||
return this.provinceName !== '全国'
|
||||
return this.OrgLv2Name !== '全国'
|
||||
},
|
||||
province() {
|
||||
const name = ['全国']
|
||||
this.provinceObjs.forEach(item => {
|
||||
this.OrgLv2s.forEach(item => {
|
||||
name.push(item.name)
|
||||
})
|
||||
return name
|
||||
},
|
||||
city() {
|
||||
const city = ['全部']
|
||||
this.cityObjs.forEach(item => {
|
||||
if (item.upBranchCode === this.provinceCode) {
|
||||
this.OrgLv3s.forEach(item => {
|
||||
if (item.upBranchCode === this.OrgLv2Code) {
|
||||
city.push(item.name)
|
||||
}
|
||||
})
|
||||
@@ -200,7 +200,7 @@ export default {
|
||||
area() {
|
||||
const area = ['全部']
|
||||
this.areaObjs.forEach(item => {
|
||||
if (item.upBranchCode === this.cityCode) {
|
||||
if (item.upBranchCode === this.OrgLv3Code) {
|
||||
area.push(item.name)
|
||||
}
|
||||
})
|
||||
@@ -225,8 +225,8 @@ export default {
|
||||
async reset() {
|
||||
location.reload()
|
||||
},
|
||||
async getSetDate() {
|
||||
let result = await this.getSummarizingData()
|
||||
async setRankData() {
|
||||
let result = await this.getRankData()
|
||||
if (result.result === '0') {
|
||||
if (this.active === 0) {
|
||||
this.setSummarizingData(result)
|
||||
@@ -242,8 +242,8 @@ export default {
|
||||
this.reset()
|
||||
}
|
||||
},
|
||||
async dataTypeChange() {
|
||||
this.getSetDate()
|
||||
dataTypeChange() {
|
||||
this.setRankData()
|
||||
},
|
||||
setRightBtn() {
|
||||
setTimeout(() => {
|
||||
@@ -257,9 +257,6 @@ export default {
|
||||
}, 1000)
|
||||
window.appCallBack = this.appCallBack
|
||||
},
|
||||
updateData() {
|
||||
this.getSummarizingData()
|
||||
},
|
||||
async initData() {
|
||||
// 初始化年份筛选数据
|
||||
const currentYear = new Date().getFullYear()
|
||||
@@ -268,36 +265,24 @@ export default {
|
||||
this.years.unshift(year)
|
||||
}
|
||||
/**
|
||||
* 查询联动数据
|
||||
* manageCode, manageLv传空查全部
|
||||
* 查询机构下拉列表
|
||||
* manageCode, manageLv传空查全国所有二级机构
|
||||
**/
|
||||
// 查询分公司
|
||||
const res = await getComList({
|
||||
bussinessType: 'normal',
|
||||
manageCode: '',
|
||||
manageLv: ''
|
||||
})
|
||||
if (res.result === '0') {
|
||||
const firsts = res.content
|
||||
this.provinceObjs.push(...firsts)
|
||||
this.OrgLv2s.push(...res.content)
|
||||
} else {
|
||||
this.$toast(res.resultMessage)
|
||||
}
|
||||
// 查询默认数据
|
||||
const result = await this.getSummarizingData()
|
||||
if (result.result === '0') {
|
||||
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)
|
||||
}
|
||||
const result = await this.getRankData()
|
||||
this.setSummarizingData(result)
|
||||
},
|
||||
async getSummarizingData() {
|
||||
async getRankData() {
|
||||
let date = null
|
||||
switch (this.timeType) {
|
||||
case 0:
|
||||
@@ -318,79 +303,82 @@ export default {
|
||||
break
|
||||
}
|
||||
this.params.date = dateUtil.formatDate(date, 'yyyy-MM-dd')
|
||||
console.log('this.params :>> ', this.params)
|
||||
let result = await getComPerformance(this.params)
|
||||
return result
|
||||
},
|
||||
async onDayConditionConfirm() {
|
||||
// 按日筛选
|
||||
onDayConditionConfirm() {
|
||||
this.isDayConditionShow = false
|
||||
this.timeType = 0
|
||||
this.getSetDate()
|
||||
this.setRankData()
|
||||
},
|
||||
async onMonthConditionConfirm() {
|
||||
// 按月筛选
|
||||
onMonthConditionConfirm() {
|
||||
this.isMonthConditionShow = false
|
||||
this.timeType = 1
|
||||
this.getSetDate()
|
||||
this.setRankData()
|
||||
},
|
||||
async onYearConditionConfirm() {
|
||||
// 按年筛选
|
||||
onYearConditionConfirm(year) {
|
||||
this.yearCondition = year
|
||||
this.isYearConditionShow = false
|
||||
this.timeType = 2
|
||||
this.getSetDate()
|
||||
this.setRankData()
|
||||
},
|
||||
// 筛选分公司确认事件
|
||||
async onProvinceConditionConfirm(data) {
|
||||
this.isProvinceConditionShow = false
|
||||
let province = this.provinceObjs.find(item => item.name === data)
|
||||
if (province) {
|
||||
this.provinceCode = province.code
|
||||
this.params.manageCode = this.provinceCode
|
||||
// 筛选二级机构
|
||||
async onOrgLv2ConditionConfirm(data) {
|
||||
this.isOrgLv2ConditionShow = false
|
||||
let OrgLv2 = this.OrgLv2s.find(item => item.name === data)
|
||||
if (OrgLv2) {
|
||||
this.OrgLv2Code = OrgLv2.code
|
||||
this.params.manageCode = this.OrgLv2Code
|
||||
this.params.manageLv = '02'
|
||||
}
|
||||
if (data === '全国') {
|
||||
this.params.manageCode = '86'
|
||||
this.params.manageLv = '01'
|
||||
}
|
||||
this.provinceName = data
|
||||
this.cityName = '全部'
|
||||
this.areaName = '全部'
|
||||
// 查询全部支公司
|
||||
this.OrgLv2Name = data
|
||||
this.OrgLv4Name = '全部'
|
||||
this.OrgLv3Name = '全部'
|
||||
// 查询三级机构
|
||||
const res = await getComList({
|
||||
bussinessType: 'normal',
|
||||
manageCode: this.provinceCode,
|
||||
manageCode: this.OrgLv2Code,
|
||||
manageLv: '02'
|
||||
})
|
||||
const seconds = res.content
|
||||
this.cityObjs.push(...seconds)
|
||||
this.getSetDate()
|
||||
this.OrgLv3s.push(...res.content)
|
||||
this.setRankData()
|
||||
},
|
||||
// 筛选城市确认事件
|
||||
async onCityConditionConfirm(data) {
|
||||
this.isCityConditionShow = false
|
||||
this.cityName = data
|
||||
let city = this.cityObjs.find(item => item.name === data)
|
||||
if (city) {
|
||||
this.cityCode = city.code
|
||||
this.params.manageCode = this.cityCode
|
||||
// 筛选三级机构
|
||||
async onOrgLv3ConditionConfirm(data) {
|
||||
this.isOrgLv3ConditionShow = false
|
||||
this.OrgLv4Name = data
|
||||
let OrgLv3 = this.OrgLv3s.find(item => item.name === data)
|
||||
if (OrgLv3) {
|
||||
this.OrgLv3Code = OrgLv3.code
|
||||
this.params.manageCode = this.OrgLv3Code
|
||||
this.params.manageLv = '03'
|
||||
}
|
||||
if (data === '全部') {
|
||||
this.params.manageCode = this.provinceCode
|
||||
this.params.manageCode = this.OrgLv2Code
|
||||
this.params.manageLv = '02'
|
||||
}
|
||||
this.areaName = '全部'
|
||||
// 查询营业部
|
||||
this.OrgLv3Name = '全部'
|
||||
// 查询四级机构
|
||||
const res = await getComList({
|
||||
bussinessType: 'normal',
|
||||
manageCode: this.cityCode,
|
||||
manageCode: this.OrgLv3Code,
|
||||
manageLv: '03'
|
||||
})
|
||||
const thirds = res.content
|
||||
this.areaObjs.push(...thirds)
|
||||
this.getSetDate()
|
||||
this.areaObjs.push(...res.content)
|
||||
this.setRankData()
|
||||
},
|
||||
// 筛选地区确认事件
|
||||
async onAreaConditionConfirm(data) {
|
||||
this.isAreaConditionShow = false
|
||||
this.areaName = data
|
||||
// 筛选四级机构
|
||||
async onOrgLv4ConditionConfirm(data) {
|
||||
this.isOrgLv4ConditionShow = false
|
||||
this.OrgLv3Name = data
|
||||
let area = this.areaObjs.find(item => item.name === data)
|
||||
if (area) {
|
||||
this.areaCode = area.code
|
||||
@@ -398,10 +386,10 @@ export default {
|
||||
this.params.manageLv = '04'
|
||||
}
|
||||
if (data === '全部') {
|
||||
this.params.manageCode = this.cityCode
|
||||
this.params.manageCode = this.OrgLv3Code
|
||||
this.params.manageLv = '03'
|
||||
}
|
||||
this.getSetDate()
|
||||
this.setRankData()
|
||||
},
|
||||
// 筛选时间确认事件
|
||||
async onDayTimeConditionConfirm(time) {
|
||||
@@ -409,10 +397,10 @@ export default {
|
||||
this.timeType = 3
|
||||
this.timeCondition = dateUtil.formatDate(time, 'MM-dd HH:mm')
|
||||
this.params.date = ''
|
||||
this.getSetDate()
|
||||
this.setRankData()
|
||||
},
|
||||
// 切换数据类型事件
|
||||
async changeDataType(index) {
|
||||
changeDataType(index) {
|
||||
if (this.typeIndex === index) {
|
||||
this.isSideBarShow = false
|
||||
return
|
||||
@@ -460,7 +448,7 @@ export default {
|
||||
this.params.type = 'product'
|
||||
break
|
||||
}
|
||||
let result = await this.getSummarizingData()
|
||||
let result = await this.getRankData()
|
||||
this.$refs.organization.setTableData(result.content, this.params.type)
|
||||
},
|
||||
setSummarizingData(data) {
|
||||
@@ -479,6 +467,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
active(nv) {
|
||||
// nv = 0 查询汇总
|
||||
if (nv === 0) {
|
||||
this.params.type = 'all'
|
||||
} else {
|
||||
@@ -493,10 +482,13 @@ export default {
|
||||
this.params.type = 'product'
|
||||
break
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.updateQueryCom(this.$refs.organization.active)
|
||||
})
|
||||
}
|
||||
},
|
||||
async typeIndex() {
|
||||
this.getSetDate()
|
||||
this.setRankData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user