Merge branch 'feature/个险业绩排行优化' into dev

# Conflicts:
#	src/assets/js/utils/request.js
#	src/views/ebiz/institutionalPerform/UnderOffice.vue
This commit is contained in:
mengxiaolong
2020-11-05 09:18:49 +08:00
5 changed files with 1103 additions and 522 deletions

View File

@@ -9,3 +9,21 @@ export function branchOfficeApi(data) {
data
})
}
// 个险业绩排行优化: 机构查询
export function getComList(data) {
return request({
url: getUrl('/data/performance/getComList', 1),
method: 'post',
data
})
}
// 个险业绩排行优化: 业绩查询
export function getComPerformance(data) {
return request({
url: getUrl('/data/performance/getComPerformance', 1),
method: 'post',
data
})
}

View File

@@ -2,8 +2,8 @@ import axios from 'axios'
import AESTools from '@/assets/js/utils/cryptoJsUtil'
import configApp from '@/config'
import { Dialog, Toast } from 'vant'
import dateUtil from "@/assets/js/utils/date-utils";
import MD5 from 'js-md5';
import dateUtil from '@/assets/js/utils/date-utils'
import MD5 from 'js-md5'
import CacheUtils from '@/assets/js/utils/cacheUtils'
let proposal = [
@@ -82,8 +82,6 @@ let productStore = [
'/customer/shop/getShareList' //查询分享轨迹(转发记录)
]
// 卡单
let cardList = []
//续期管理
let renewalManage = [
'/renewal/getRenewalList' //续期列表查询
@@ -95,6 +93,8 @@ let preserve = [
'/edor/policy/policyList', //保单列表
'/edor/edor/queryEdorList' //保全进度查询
]
// 个险业绩排行优化
let performanceRanking = ['/data/performance/getComList', '/data/performance/getComPerformance']
let whiteList = [
'/customer/agent/getCustomersList',
@@ -104,9 +104,10 @@ let whiteList = [
...claims,
...survey,
...manpower,
...renewalManage,
...preserve,
...productStore
...productStore,
...renewalManage,
...performanceRanking
]
// 创建axios实例
@@ -116,84 +117,89 @@ const service = axios.create({
// request拦截器
service.interceptors.request.use(
config => {
let relativePath = config.url && config.url.split(configApp.API_VERSION)[1]
console.log(config.url.split(configApp.API_VERSION)[0])
if (whiteList.includes(relativePath)) {
Toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……'
})
}
/**
* 请求拦截处理(待添加 判断走统一网关处理)
*/
if(config.url && /api\/$/.test(config.url.split(configApp.API_VERSION)[0])){
if(!config.data || config.data == null){
config.data = {}
}
if(!!config.data && config.data != null){
let encrypt = AESTools.AESEncrypt(JSON.stringify(config.data),configApp.REQ_PWD)
console.log("[调用请求加密服务][请求地址:"+config.url+"][加密前报文:]",JSON.stringify(config.data))
config.data = {"data": encrypt }
console.log("[调用请求加密服务][请求地址:"+config.url+"][加密后报文:]",config.data)
}
}
config.headers['token'] = CacheUtils.getLocItem('token')
// 添加请时间戳
let timeStr = new Date().getTime() + '';
config.headers['timeStr'] = timeStr;
config.headers['signature'] = MD5(timeStr + CacheUtils.getLocItem('token'));
// config.headers['token'] = `f0003a753d1d492083248f723ab1b6e9`//TEST测试专用
return config
},
error => {
// Do something with request error
Promise.reject(error)
config => {
let relativePath = config.url && config.url.split(configApp.API_VERSION)[1]
console.log(config.url.split(configApp.API_VERSION)[0])
if (whiteList.includes(relativePath)) {
Toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……'
})
}
/**
* 请求拦截处理(待添加 判断走统一网关处理)
*/
if (config.url && /api\/$/.test(config.url.split(configApp.API_VERSION)[0])) {
if (!config.data || config.data == null) {
config.data = {}
}
if (!!config.data && config.data != null) {
let encrypt = AESTools.AESEncrypt(JSON.stringify(config.data), configApp.REQ_PWD)
console.log('[调用请求加密服务][请求地址:' + config.url + '][加密前报文:]', JSON.stringify(config.data))
config.data = { data: encrypt }
console.log('[调用请求加密服务][请求地址:' + config.url + '][加密后报文:]', config.data)
}
}
config.headers['token'] = CacheUtils.getLocItem('token')
// 添加请时间戳
let timeStr = new Date().getTime() + ''
config.headers['timeStr'] = timeStr
config.headers['signature'] = MD5(timeStr + CacheUtils.getLocItem('token'))
// config.headers['token'] = `f0003a753d1d492083248f723ab1b6e9`//TEST测试专用
return config
},
error => {
// Do something with request error
Promise.reject(error)
}
)
// respone拦截器
service.interceptors.response.use(
response => {
console.log(response)
console.log('----------------')
let res = response.data
if(response.config.url && response.headers['content-type'].match(/application\/json/) && /api\/$/.test(response.config.url.split(configApp.API_VERSION)[0])){
if(res.response){// 正常情況返回必有response 节点
console.log("[调用请求解密服务][请求地址:"+response.config.url+"][解密前报文:]",JSON.stringify(res.response))
res = JSON.parse(AESTools.AESDecrypt(res.response,configApp.REQ_PWD))
console.log("[调用请求解密服务][请求地址:"+response.config.url+"][解密后报文:]",res)
}
response => {
console.log(response)
console.log('----------------')
let res = response.data
if (
response.config.url &&
response.headers['content-type'].match(/application\/json/) &&
/api\/$/.test(response.config.url.split(configApp.API_VERSION)[0])
) {
if (res.response) {
// 正常情況返回必有response 节点
console.log('[调用请求解密服务][请求地址:' + response.config.url + '][解密前报文:]', JSON.stringify(res.response))
res = JSON.parse(AESTools.AESDecrypt(res.response, configApp.REQ_PWD))
console.log('[调用请求解密服务][请求地址:' + response.config.url + '][解密后报文:]', res)
}
Toast.clear()
if (res.code != 0) {
if (res.code == 10001 || res.code == 10002) {
Dialog.confirm({
confirmButtonText: '重新登录',
message: '你已被登出,可以取消继续留在该页面,或者重新登录'
}).then(() => {
//eslint-disable-next-line
EWebBridge.webCallAppInJs('bridge', {
flag: 'login'
})
})
} else {
//Toast.fail(res.msg)
}
return Promise.reject(res)
} else {
return res.content
}
},
error => {
Toast.clear()
console.log('err' + error) // for debug
//Toast.fail(error.message)
return Promise.reject(error)
}
Toast.clear()
if (res.code != 0) {
if (res.code == 10001 || res.code == 10002) {
Dialog.confirm({
confirmButtonText: '重新登录',
message: '你已被登出,可以取消继续留在该页面,或者重新登录'
}).then(() => {
//eslint-disable-next-line
EWebBridge.webCallAppInJs('bridge', {
flag: 'login'
})
})
} else {
//Toast.fail(res.msg)
}
return Promise.reject(res)
} else {
return res.content
}
},
error => {
Toast.clear()
console.log('err' + error) // for debug
//Toast.fail(error.message)
return Promise.reject(error)
}
)
export default service

View File

@@ -0,0 +1,227 @@
<template>
<div>
<van-tabs v-model="active">
<van-tab title="中心支公司"></van-tab>
<van-tab title="营销服务部"></van-tab>
<van-tab title="下辖营业区"></van-tab>
</van-tabs>
<div class="table-wrapper">
<table class="myTable mb30" cellspacing="0" cellpadding="0">
<tr>
<th class="sticky">排名</th>
<th v-for="(column, index) in columns" :key="index">
{{ column.name }}
</th>
</tr>
<tr v-for="(value, index) in values" :key="index">
<td class="sticky">{{ index + 1 }}</td>
<td v-for="(key, i) in needGettingKey" :key="i">{{ value[key] | blankFilter }}</td>
</tr>
<tr v-if="values.length === 0">
<td :colspan="columns.length + 1">暂无数据</td>
</tr>
</table>
</div>
</div>
</template>
<script>
import { Tab, Tabs } from 'vant'
export default {
name: 'Organization',
components: {
[Tab.name]: Tab,
[Tabs.name]: Tabs
},
props: {
dataType: {
// 0: 业绩, 1: 人力, 2: 产品
type: Number,
default: 0
},
timeType: {
type: Number,
default: 0
}
},
computed: {
dataTypeName() {
switch (this.dataType) {
case 0:
case 1:
return '机构'
case 2:
return '产品'
default:
return '-'
}
},
// 获取需要显示的列名称
columns() {
if (this.dataType === 0) {
switch (this.timeType) {
case 0:
return this.tableColumns[this.dataType][0]
case 1:
return this.tableColumns[this.dataType][1]
case 2:
if (this.active <= 1) {
return this.tableColumns[this.dataType][2]
} else {
return this.tableColumns[this.dataType][3]
}
default:
return []
}
} else {
return this.tableColumns[this.dataType]
}
},
needGettingKey() {
let keys = []
this.columns.forEach(element => {
keys.push(element.key)
})
return keys
}
},
data() {
return {
active: 0,
tableColumns: [
[
[
{ name: '机构', key: 'name' },
{ name: '预收标保', key: 'ysbb' },
{ name: '预收件数', key: 'ysjs' },
{ name: '承保标保', key: 'bzbf' },
{ name: '承保件数', key: 'cbjs' }
],
[
{ name: '机构', key: 'name' },
{ name: '预收标保', key: 'ysbb' },
{ name: '预收件数', key: 'ysjs' },
{ name: '承保标保', key: 'bzbf' },
{ name: '承保件数', key: 'cbjs' },
{ name: '承保同比', key: 'cbtb' },
{ name: '承保环比', key: 'cbhb' }
],
[
{ name: '机构', key: 'name' },
{ name: '承保标保', key: 'bzbf' },
{ name: '标保目标', key: 'bbmb' },
{ name: '标保目标达成率', key: 'bbmbdcl' },
{ name: '差距', key: 'cj' }
],
[
{ name: '机构', key: 'name' },
{ name: '承保标保', key: 'bzbf' }
]
],
[
{ name: '机构', key: 'name' },
{ name: '合格人力', key: 'hgrl' },
{ name: '桂冠人力', key: 'ggrl' },
{ name: '桂冠正式会员', key: 'gghy' },
{ name: '双冠人力', key: 'sgrl' },
{ name: '新增人力', key: 'xzrl' }
],
[
{ name: '机构', key: 'name' },
{ name: '总保费', key: 'zbf' },
{ name: '承保标保', key: 'bzbf' },
{ name: '承保件数', key: 'cbjs' },
{ name: '保费占比', key: 'bfzb' }
]
],
values: []
}
},
methods: {
setTableData(data, type) {
switch (type) {
case 'prem':
this.values = data.list ? data.list : []
break
case 'active':
this.values = data.listRL ? data.listRL : []
break
case 'product':
this.values = data.productDTO ? data.productDTO : []
break
}
}
},
watch: {
active: {
handler(nv) {
this.$emit('updateQueryCom', nv)
},
immediate: true
}
},
filters: {
blankFilter(val) {
return val ? val : '-'
}
}
}
</script>
<style lang="scss" scoped>
$border: 1px solid #ccc;
$bgRed: #f03;
$white: #fff;
::v-deep .van-tabs__wrap {
padding: 10px;
}
::v-deep .van-tabs__nav {
border-radius: 5px;
border: 1px solid #e4e4e4;
padding-bottom: 0;
}
::v-deep .van-tabs__line {
bottom: 0;
}
::v-deep .van-tab--active {
font-size: 16px;
font-weight: bolder;
transition: all 0.1s ease;
}
.table-wrapper {
overflow: auto;
padding: 0 10px;
}
.myTable {
text-align: center;
min-width: 180vw;
border-top: $border;
border-left: $border;
border-right: $border;
}
.myTable td,
.myTable th {
font-size: 14px;
padding: 10px 0;
border-bottom: $border;
border-collapse: collapse;
background-color: $white;
}
.myTable th {
background-color: $bgRed;
border: none;
color: $white;
}
.sticky {
position: sticky;
left: -10px;
}
</style>

View File

@@ -0,0 +1,217 @@
<template>
<div class="summarize">
<div class="data-section">
<span ref="performance" class="title">
业绩
</span>
<div class="table-wrapper">
<table class="myTable" cellspacing="0" cellpadding="0">
<tr>
<th>机构业绩</th>
<th>达成</th>
</tr>
<tr>
<td>预收标保</td>
<td>{{ performance.ysbb | unitFilter(1) | blankFilter }}</td>
</tr>
<tr>
<td>预收件数</td>
<td>{{ performance.ysjs | unitFilter(2) | blankFilter }}</td>
</tr>
<tr>
<td>承保标保</td>
<td>{{ performance.bzbf | unitFilter(1) | blankFilter }}</td>
</tr>
<tr>
<td>承保件数</td>
<td>{{ performance.cbjs | unitFilter(2) | blankFilter }}</td>
</tr>
</table>
</div>
</div>
<div class="data-section">
<span ref="manpower" class="title">
人力
</span>
<div class="table-wrapper">
<table class="myTable" cellspacing="0" cellpadding="0">
<tr>
<th>活动人力</th>
<th>达成()</th>
</tr>
<tr>
<td>合格人力</td>
<td>{{ manpower.hgrl | blankFilter }}</td>
</tr>
<tr>
<td>桂冠人力</td>
<td>{{ manpower.ggrl | blankFilter }}</td>
</tr>
<tr>
<td>桂冠正式会员</td>
<td>{{ manpower.ggrl | blankFilter }}</td>
</tr>
<tr>
<td>双冠人力</td>
<td>{{ manpower.sgrl | blankFilter }}</td>
</tr>
<tr>
<td>新增人力</td>
<td>{{ manpower.xzrl | blankFilter }}</td>
</tr>
</table>
</div>
</div>
<div class="data-section">
<span ref="production" class="title">
产品
</span>
<div class="table-wrapper">
<table class="myTable" style="min-width: 140vw;" cellspacing="0" cellpadding="0">
<tr>
<th class="sticky">产品名称</th>
<th>承保标保(万元)</th>
<th>承保件数()</th>
<th>保费占比(%)</th>
</tr>
<tr v-for="(product, index) in products" :key="index">
<td class="sticky">{{ product.productName }}</td>
<td>{{ product.cbbb | blankFilter }}</td>
<td>{{ product.cbItems | blankFilter }}</td>
<td>{{ product.percent | blankFilter }}</td>
</tr>
<tr v-if="products.length === 0">
<td colspan="4">暂无数据</td>
</tr>
</table>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'Summarizing',
props: {
typeIndex: {
type: Number,
default: 0
}
},
data() {
return {
performance: {},
manpower: {},
products: []
}
},
methods: {
setManpower(data) {
this.manpower = data
},
setPerformance(data) {
this.performance = data
},
setProducts(data) {
this.products = data
let allPrice = this.products.reduce((prevVal, currVal) => {
return prevVal + Number(currVal.cbbb)
}, 0)
this.products.map(product => {
product.percent = ((product.cbbb / allPrice) * 100).toFixed(2)
return product
})
}
},
watch: {
typeIndex(nv) {
const scroll = {
behavior: 'smooth',
block: 'start'
}
switch (nv) {
case 0:
this.$refs.performance.scrollIntoView(scroll)
break
case 1:
this.$refs.manpower.scrollIntoView(scroll)
break
case 2:
this.$refs.production.scrollIntoView(scroll)
break
}
}
},
filters: {
blankFilter(val) {
return val ? val : '-'
},
unitFilter(val, unit) {
if (!val) {
return ''
}
// 1: 万元, 2: 件数
switch (unit) {
case 1:
return `${val} (万元)`
case 2:
return `${val} (件)`
}
}
}
}
</script>
<style lang="scss" scoped>
$border: 1px solid #ccc;
$bgRed: #f03;
$white: #fff;
.summarize {
padding-bottom: 30px;
}
.data-section {
.title {
display: inline-block;
background-color: $bgRed;
color: $white;
padding: 5px 20px;
margin: 15px 0;
border-radius: 0 10px 10px 0;
}
}
.table-wrapper {
overflow: auto;
padding: 0 5px;
}
.myTable {
text-align: center;
width: 100%;
border-top: $border;
border-left: $border;
border-right: $border;
}
.myTable td,
.myTable th {
padding: 10px 0;
border-bottom: $border;
border-collapse: collapse;
background-color: $white;
}
.myTable th {
background-color: $bgRed;
border: none;
color: $white;
}
.sticky {
width: 180px;
position: sticky;
left: -5px;
}
</style>

File diff suppressed because it is too large Load Diff