Commit 25616c35 by 前端

fixed

1 parent b5c40703
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:43:46
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-31 10:28:51
* @LastEditTime: 2022-10-31 17:25:12
* @FilePath: \dj-data-view\src\components\barChart.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -12,6 +12,16 @@
</div>
</template>
<script>
const ValueAnalysis = [
{ name: 'gendev', label: '一般发展', order: 6 },
{ name: 'genrecall', label: '一般召回', order: 7 },
{ name: 'gensave', label: '一般挽留', order: 8 },
{ name: 'genval', label: '一般价值', order: 5 },
{ name: 'majordev', label: '重要发展', order: 2 },
{ name: 'majorrecall', label: '重要召回', order: 3 },
{ name: 'majorsave', label: '重要挽留', order: 4 },
{ name: 'majorval', label: '重要价值', order: 1 }
]
import datas from '@/utils/data'
import * as echarts from 'echarts'
import utils from '../utils/util'
......@@ -85,7 +95,9 @@ export default {
dataIndex: 0
},
timer: null,
currentData: {}
currentData: {
dataIndex: 0
}
}
},
// created() {
......@@ -102,20 +114,19 @@ export default {
const { rotate, analysisList } = this
const obj = {
rotate,
analysisList
analysisList,
ValueAnalysis
}
this.lineOptions = this.revese ? getBarReverseOptions(obj) : getBarOptions(obj)
this.chartBindEvent()
},
deep: true,
immediate: true
deep: true
}
},
mounted() {
console.log(this.areaList, 999)
this.lineDom = document.getElementById(this.domId)
this[this.domId] = echarts.init(this.lineDom)
this.chartBindEvent()
// this.chartBindEvent()
},
methods: {
chartBindEvent() {
......@@ -125,18 +136,34 @@ export default {
this[this.domId].getZr().on(
'mousemove',
utils.debounce(params => {
clearInterval(this.timer)
this.timer = null
const pointInPixel = [params.offsetX, params.offsetY]
const pointInGrid = this[this.domId].convertFromPixel({ seriesIndex: 0 }, pointInPixel)
const yIndex = pointInGrid[1]
this.currentData = {
dataIndex: yIndex
}
this.$bus.$emit('drawChart', yIndex)
this.chartAction(yIndex)
}, 500)
)
this[this.domId].on('globalout', () => {
this.chartAction(this.currentData.dataIndex)
})
this[this.domId].getZr().on(
'mouseout',
utils.debounce(() => {
if (!this.timer) {
this.timer = setInterval(this.setInter, 5000)
}
}, 500)
)
this.timer = setInterval(this.setInter, 5000)
},
setInter() {
if (this.currentData.dataIndex == 0) {
this.currentData.dataIndex = 7
} else {
this.currentData.dataIndex--
}
this.chartAction(this.currentData.dataIndex)
},
chartAction(index = 7) {
this[this.domId].dispatchAction({
......@@ -144,6 +171,7 @@ export default {
seriesIndex: 0,
dataIndex: index
})
this.$bus.$emit('drawChart', index)
}
}
}
......
......@@ -2,14 +2,14 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:46:24
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-31 09:38:47
* @LastEditTime: 2022-10-31 16:41:32
* @FilePath: \dj-data-view\src\components\barOptions.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import utils from '../utils/util'
function getBarOptions(obj) {
console.log(obj)
const { analysisList, rotate } = obj
const num = analysisList.map(item => item.num)
const num = analysisList.map(item => item.ratio * 100)
console.log(num)
const name = analysisList.map(item => item.name)
var options = {
......@@ -17,8 +17,7 @@ function getBarOptions(obj) {
type: 'category',
axisLabel: {
color: '#fff',
fontSize: '0.75em',
rotate
fontSize: '0.72em'
},
splitLine: {
show: false
......@@ -34,24 +33,23 @@ function getBarOptions(obj) {
grid: {
left: '8%',
right: '6%',
top: '3%',
bottom: obj.rotate ? '4%' : '12%',
top: '6%',
bottom: '4%',
// bottom: obj.rotate ? '4%' : '12%',
containLabel: true
},
yAxis: {
nameGap: 30,
type: 'value',
splitLine: {
show: false
},
axisLabel: {
show: false
},
splitLine: {
lineStyle: {
color: '#2F314F'
}
},
axisLabel: {
color: '#fff',
fontSize: '0.75em',
formatter: '{value}%'
},
splitNumber: 4
},
series: [
......@@ -69,8 +67,17 @@ function getBarOptions(obj) {
return options
}
function getBarReverseOptions(obj) {
const { analysisList } = obj
const value = Object.values(analysisList)
const { analysisList, ValueAnalysis } = obj
// const value = Object.values(analysisList)
const entries = Object.entries(analysisList)
ValueAnalysis.forEach(sis => {
entries.forEach(key => {
if (sis.name == key[0]) {
sis.value = key[1]
}
})
})
const value = utils.deepClone(ValueAnalysis).sort((a, b) => b.order - a.order)
var options = {
tooltip: {
trigger: 'axis',
......@@ -104,7 +111,7 @@ function getBarReverseOptions(obj) {
axisLine: {
show: false
},
data: ['一般发展', '一般价值', '一般挽留', '重要挽留', '重要价值', '重要发展', '重要保持', '一般保持'].reverse()
data: value.map(item => item.label)
},
grid: {
left: '15%',
......@@ -146,7 +153,7 @@ function getBarReverseOptions(obj) {
}
}
},
data: value
data: value.map(item => item.value)
}
]
}
......@@ -170,7 +177,7 @@ function getLineOptions(obj) {
borderRadius: 4,
textStyle: {
color: 'rgba(255,255,255,1)',
fontSize: 14
fontSize: 10
},
formatter: function (item) {
return `${name}:${item[0].value}`
......@@ -264,15 +271,16 @@ function lineAndBarOptions(list) {
}
},
padding: 5,
borderWidth: 0.5,
borderWidth: 1,
backgroundColor: 'rgba(35, 45, 152, 1)',
borderRadius: 4,
textStyle: {
color: 'rgba(255,255,255,1)',
fontSize: 14
fontSize: 10
},
formatter: function (item) {
return `门店数:${item[0].value}<br>新增数:${item[1].value}`
const items = list[item[0].dataIndex]
return `当月总门店数:${item[0].value}<br>当月新增:${item[1].value}<br>上月总门店数:${items.yesterdaytotalNum}<br>上月月新增:${items.yesterdayincreNum}`
}
},
xAxis: [
......@@ -312,7 +320,7 @@ function lineAndBarOptions(list) {
}
},
axisLabel: {
color: '#fff',
color: '#FFD241',
fontSize: '0.8em'
},
splitNumber: 4
......@@ -327,7 +335,7 @@ function lineAndBarOptions(list) {
}
},
axisLabel: {
color: '#fff',
color: '#769EFF',
fontSize: '0.8em'
},
splitNumber: 4
......@@ -335,16 +343,6 @@ function lineAndBarOptions(list) {
],
series: [
{
name: 'bar',
type: 'bar',
symbol: 'circle',
backgroundStyle: {
color: '#6578FF'
},
barWidth: '30%',
data: increNum
},
{
name: 'line',
type: 'line',
symbol: 'circle',
......@@ -374,8 +372,18 @@ function lineAndBarOptions(list) {
]
}
},
yAxisIndex: 1,
data: totalNum
},
{
name: 'bar',
type: 'bar',
symbol: 'circle',
backgroundStyle: {
color: '#6578FF'
},
yAxisIndex: 1,
barWidth: '30%',
data: increNum
}
]
}
......
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2022-06-23 17:38:33
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-25 10:38:15
* @LastEditTime: 2022-10-31 16:36:33
*/
const DefaultData = {
defaultLineHeight: '17.32',
......
......@@ -73,7 +73,7 @@ const getQuery = name => {
/** 三个数字加一个逗号 */
const numAddSymbol = val => {
return (val + '').replace(/\B(?=(?:\d{3})+\b)/g, ',')
return val ? (val + '').replace(/\B(?=(?:\d{3})+\b)/g, ',') : 0
}
// 获取当前时间
......@@ -111,6 +111,27 @@ const setChartFontSize = fontSize => {
if (!clientWidth) return fontSize
return (fontSize * clientWidth) / 1440
}
const deepClone = obj => {
// Handle the 3 simple types, and null or undefined or function
if (obj == null || typeof obj !== 'object') return obj
// Handle Date
if (obj instanceof Date) {
const copy = new Date()
copy.setTime(obj.getTime())
return copy
}
// Handle Array or Object
if ((obj instanceof Array) | (obj instanceof Object)) {
const copy = obj instanceof Array ? [] : {}
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) {
copy[attr] = deepClone(obj[attr])
}
}
return copy
}
throw new Error("Unable to clone obj! Its type isn't supported.")
}
const utils = {
getParams,
getQuery,
......@@ -122,7 +143,8 @@ const utils = {
getNDate,
getNMonth,
debounce,
setChartFontSize
setChartFontSize,
deepClone
}
Object.keys(utils).map(key => {
......
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-27 11:18:27
* @LastEditTime: 2022-10-31 17:28:49
* @FilePath: \dj-data-view\src\views\saas\business.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -29,7 +29,7 @@ export default {
data() {
return {
businessNum: {},
categoryData:[],
categoryData: []
}
},
mounted() {
......@@ -43,7 +43,7 @@ export default {
this.api.sass.getSaasValueaddedTransformationOverview().then(res => {
if (res.code == 0) {
this.businessNum = res.data.dataList[0]
this.categoryData = [
this.categoryData = [
{
name: '权益类',
value: this.businessNum.equity
......@@ -68,7 +68,7 @@ export default {
.business-wrap {
height: 13.9vh;
margin-bottom: 0.98vh;
margin-top: 0.98vh;
margin-top: 0.98vh;
.business-data {
margin-right: 4px;
// margin-top: 0.98vh;
......
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-27 13:33:57
* @LastEditTime: 2022-10-31 10:47:45
* @FilePath: \dj-data-view\src\views\saas\business.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -49,7 +49,7 @@ export default {
},
methods: {
toFixNum(val) {
return this.numAddSymbol(Number(val).toFixed(2))
return this.numAddSymbol(Math.round(Number(val)))
}
}
}
......
......@@ -8,7 +8,7 @@
<div :class="['content-item', 'flex-around', info.pd ? info.pd : '']" v-for="(info, index) in infoList" :key="index">
<div class="content-title">{{ info.title }}</div>
<template v-for="(data, ids) in info.dataList">
<div v-if="ids != 3" :class="['content-number', 'num-' + ids]" :key="ids">
<div v-if="ids != 2" :class="['content-number', 'num-' + ids]" :key="ids">
{{ index == 0 ? numAddSymbol(data(smartClueData)) : index == 1 ? numAddSymbol(data(merchantData)) : numAddSymbol(data(smartData)) }}
</div>
<div v-else :class="['content-number', 'num-' + ids]" :key="ids">
......@@ -60,7 +60,12 @@ export default {
merchantData: '', //门店会员的权益
smartData: '', // 智慧车管线索订阅
smartClueData: '', //智慧门店线索订阅
titleList: [{ text: '订阅门店',width: '2.78vw' }, { text: '线索订阅门店数(累计)', width: '3.82vw' }, { text: '活跃使用门店', width: '4.95vw' }, { text: '留存率', width: '4.29vw' }],
titleList: [
{ text: '订阅门店', width: '2.78vw' },
{ text: '线索订阅门店数(累计)', width: '3.82vw' },
{ text: '活跃使用门店', width: '4.95vw' },
{ text: '留存率', width: '4.29vw' }
],
infoList: [
{
title: '智慧门店线索订阅',
......@@ -104,7 +109,7 @@ export default {
},
methods: {
toFixNum(val) {
return (val * 100).toFixed(0) + '%'
return (val * 100).toFixed(1) + '%'
},
getMerchantData() {
this.api.sass.getMerchantData().then(res => {
......
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-31 10:16:04
* @LastEditTime: 2022-10-31 10:47:10
* @FilePath: \dj-data-view\src\views\saas\project.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -15,7 +15,7 @@
</div>
<div class="project-right flex">
<div class="project-content-item">
<div class="project-content-desc">累计展业门店数</div>
<div class="project-content-desc">展业门店数</div>
<div class="project-content-num">{{ item.totalNum }}</div>
</div>
<div class="project-content-item">
......@@ -57,7 +57,7 @@ export default {
return (val * 100).toFixed(2) + '%'
},
toFixNum(val) {
return this.numAddSymbol(val.toFixed(2))
return this.numAddSymbol(Math.round(val))
},
getBusinessType() {
this.api.sass.getBusinessType().then(res => {
......@@ -104,16 +104,16 @@ export default {
flex: 1;
.project-content-item {
&:first-child {
width: 27%;
width: 22%;
}
&:nth-child(2) {
width: 15%;
width: 16%;
}
&:nth-child(3) {
width: 15%;
width: 16%;
}
&:nth-child(4) {
width: 15%;
width: 17%;
}
&:nth-child(5) {
width: 28%;
......
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-27 15:17:26
* @LastEditTime: 2022-10-31 13:52:49
* @FilePath: \dj-data-view\src\views\user\analyse.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -23,7 +23,7 @@ export default {
name: 'Analyse',
data() {
return {
analysisList: ''
analysisList: {}
}
},
mounted() {
......
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-27 17:28:40
* @LastEditTime: 2022-10-31 14:03:19
* @FilePath: \dj-data-view\src\views\user\area.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-27 17:28:13
* @LastEditTime: 2022-10-31 14:03:21
* @FilePath: \dj-data-view\src\views\user\brand.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......
<template>
<div class="user-tab flex">
<template v-for="(tab, index) in userData">
<div class="tab-item" :key="index" @click="getTrend(tab.view, tab.text)">
<div :class="['tab-item', { active: selectIndex == index }]" :key="index" @click="getTrend(tab.view, tab.text)">
<div class="tab-title">{{ tab.text }}</div>
<div class="tab-count text-linear">{{ numAddSymbol(dataList[tab.value]) }}</div>
<div class="tab-increase flex-between">
......@@ -14,43 +14,45 @@
</template>
<script>
const TEXT_VIEW = [
{
text: '用户数',
value: 'totalnum',
key: 'increnum',
view: 'total'
},
{
text: '企微客户数',
value: 'totalwechatnum',
key: 'increwechatnum',
view: 'wechat'
},
{
text: '企微群数',
value: 'totalwechatgroupnum',
key: 'increwechatgroupnum',
view: 'wechatgroup'
},
{
text: '小程序',
value: 'totalappletnum',
key: 'increappletnum',
view: 'applet'
},
{
text: '个微客户数',
value: 'totalsinglewechantnum',
key: 'incresinglewechantnum',
view: 'individual'
}
]
export default {
name: 'UserTab',
data() {
return {
dataList: {},
userData: [
{
text: '用户数',
value: 'totalnum',
key: 'increnum',
view: 'total'
},
{
text: '企微客户数',
value: 'totalwechatnum',
key: 'increwechatnum',
view: 'wechat'
},
{
text: '企微群数',
value: 'totalwechatgroupnum',
key: 'increwechatgroupnum',
view: 'wechatgroup'
},
{
text: '小程序',
value: 'totalappletnum',
key: 'increappletnum',
view: 'applet'
},
{
text: '个微客户数',
value: 'totalsinglewechantnum',
key: 'incresinglewechantnum',
view: 'individual'
}
]
userData: TEXT_VIEW,
selectIndex: 0
}
},
async created() {
......@@ -67,6 +69,9 @@ export default {
},
getTrend(queryItem, name) {
const selectIndex = TEXT_VIEW.findIndex(item => item.text == name)
if (selectIndex > 2) return
this.selectIndex = selectIndex
const params = { req: { queryItem } }
this.api.user.getTrend(params).then(res => {
if (res.code == 0) {
......@@ -94,6 +99,23 @@ export default {
margin-right: 0.28vw;
padding: 0.28vh 0;
box-sizing: border-box;
&.active {
border: 1px solid #6578ff;
position: relative;
&::after {
content: '';
position: absolute;
bottom: -4px;
left: 50%;
height: 6px;
width: 6px;
margin-left: -3px;
background: #0b0e31;
border-bottom: 1px solid #6578ff;
border-right: 1px solid #6578ff;
transform: rotate(45deg);
}
}
.tab-title {
font-weight: 400;
font-size: 12px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!