Commit 37f6ddde by 前端

Merge branch 'v1.0.0' into 'master'

V1.0.0

See merge request !3
2 parents 5e3770bb b291aab1
Showing 114 changed files with 4187 additions and 0 deletions
> 1%
last 2 versions
# http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
NODE_ENV='development'
# must start with VUE_APP_
VUE_APP_ENV = 'development'
NODE_ENV='production'
# must start with VUE_APP_
VUE_APP_ENV = 'production'
\ No newline at end of file
NODE_ENV='production'
# must start with VUE_APP_
VUE_APP_ENV = 'staging'
build/*.js
src/assets
src/config
public
dist
module.exports = {
root: true,
env: {
node: true
},
extends: ['plugin:vue/essential', 'eslint:recommended'],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'vue/max-attributes-per-line': [
2,
{
singleline: 10,
multiline: {
max: 1,
allowFirstLine: false
}
}
],
'vue/singleline-html-element-content-newline': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/name-property-casing': ['error', 'PascalCase'],
'vue/no-v-html': 'off',
'accessor-pairs': 2,
'arrow-spacing': [
2,
{
before: true,
after: true
}
],
'block-spacing': [2, 'always'],
'brace-style': [
2,
'1tbs',
{
allowSingleLine: true
}
],
camelcase: [
0,
{
properties: 'always'
}
],
'comma-dangle': [2, 'never'],
'comma-spacing': [
2,
{
before: false,
after: true
}
],
'comma-style': [2, 'last'],
'constructor-super': 2,
curly: [2, 'multi-line'],
'dot-location': [2, 'property'],
'eol-last': 2,
eqeqeq: ['error', 'always', { null: 'ignore' }],
'generator-star-spacing': [
2,
{
before: true,
after: true
}
],
'handle-callback-err': [2, '^(err|error)$'],
indent: [
2,
2,
{
SwitchCase: 1
}
],
'jsx-quotes': [2, 'prefer-single'],
'key-spacing': [
2,
{
beforeColon: false,
afterColon: true
}
],
'keyword-spacing': [
2,
{
before: true,
after: true
}
],
'new-cap': [
2,
{
newIsCap: true,
capIsNew: false
}
],
'new-parens': 2,
'no-array-constructor': 2,
'no-caller': 2,
'no-console': 'off',
'no-class-assign': 2,
'no-cond-assign': 2,
'no-const-assign': 2,
'no-control-regex': 0,
'no-delete-var': 2,
'no-dupe-args': 2,
'no-dupe-class-members': 2,
'no-dupe-keys': 2,
'no-duplicate-case': 2,
'no-empty-character-class': 2,
'no-empty-pattern': 2,
'no-eval': 2,
'no-ex-assign': 2,
'no-extend-native': 2,
'no-extra-bind': 2,
'no-extra-boolean-cast': 2,
'no-extra-parens': [2, 'functions'],
'no-fallthrough': 2,
'no-floating-decimal': 2,
'no-func-assign': 2,
'no-implied-eval': 2,
'no-inner-declarations': [2, 'functions'],
'no-invalid-regexp': 2,
'no-irregular-whitespace': 2,
'no-iterator': 2,
'no-label-var': 2,
'no-labels': [
2,
{
allowLoop: false,
allowSwitch: false
}
],
'no-lone-blocks': 2,
'no-mixed-spaces-and-tabs': 2,
'no-multi-spaces': 2,
'no-multi-str': 2,
'no-multiple-empty-lines': [
2,
{
max: 1
}
],
'no-native-reassign': 2,
'no-negated-in-lhs': 2,
'no-new-object': 2,
'no-new-require': 2,
'no-new-symbol': 2,
'no-new-wrappers': 2,
'no-obj-calls': 2,
'no-octal': 2,
'no-octal-escape': 2,
'no-path-concat': 2,
'no-proto': 2,
'no-redeclare': 2,
'no-regex-spaces': 2,
'no-return-assign': [2, 'except-parens'],
'no-self-assign': 2,
'no-self-compare': 2,
'no-sequences': 2,
'no-shadow-restricted-names': 2,
'no-spaced-func': 2,
'no-sparse-arrays': 2,
'no-this-before-super': 2,
'no-throw-literal': 2,
'no-trailing-spaces': 2,
'no-undef': 2,
'no-undef-init': 2,
'no-unexpected-multiline': 2,
'no-unmodified-loop-condition': 2,
'no-unneeded-ternary': [
2,
{
defaultAssignment: false
}
],
'no-unreachable': 2,
'no-unsafe-finally': 2,
'no-unused-vars': [
2,
{
vars: 'all',
args: 'none'
}
],
'no-useless-call': 2,
'no-useless-computed-key': 2,
'no-useless-constructor': 2,
'no-useless-escape': 0,
'no-whitespace-before-property': 2,
'no-with': 2,
'one-var': [
2,
{
initialized: 'never'
}
],
'operator-linebreak': [
2,
'after',
{
overrides: {
'?': 'before',
':': 'before'
}
}
],
'padded-blocks': [2, 'never'],
quotes: [
2,
'single',
{
avoidEscape: true,
allowTemplateLiterals: true
}
],
semi: [2, 'never'],
'semi-spacing': [
2,
{
before: false,
after: true
}
],
'space-before-blocks': [2, 'always'],
'space-before-function-paren': [2, 'never'],
'space-in-parens': [2, 'never'],
'space-infix-ops': 2,
'space-unary-ops': [
2,
{
words: true,
nonwords: false
}
],
'spaced-comment': [
2,
'always',
{
markers: ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
}
],
'template-curly-spacing': [2, 'never'],
'use-isnan': 2,
'valid-typeof': 2,
'wrap-iife': [2, 'any'],
'yield-star-spacing': [2, 'both'],
yoda: [2, 'never'],
'prefer-const': 2,
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'object-curly-spacing': [
2,
'always',
{
objectsInObjects: false
}
],
'array-bracket-spacing': [2, 'never']
}
}
.DS_Store
node_modules
/dist
/docs
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
package-lock.json
yarn.lock
\ No newline at end of file
// https://github.com/michael-ciniawsky/postcss-load-config
module.exports = {
plugins: {
autoprefixer: {
overrideBrowserslist: ['Android 4.1', 'iOS 7.1', 'Chrome > 31', 'ff > 31', 'ie >= 8']
},
// 'postcss-pxtorem': {
// rootValue: 37.5,
// propList: ['*'],
// selectorBlackList: ['van-','ignore','ign-','.hairlines']
// },
'postcss-px-to-viewport': {
viewportWidth: 1440, // 视窗的宽度,对应的是我们设计稿的宽度,一般是750
unitPrecision: 3, // 指定`px`转换为视窗单位值的小数位数(很多时候无法整除)
viewportUnit: 'vw', // 指定需要转换成的视窗单位,建议使用vw
selectorBlackList: ['.ignore', '.hairlines', 'ign-'], // 指定不转换为视窗单位的类,可以自定义,可以无限添加,建议定义一至两个通用的类名
minPixelValue: 1, // 小于或等于`1px`不转换为视窗单位,你也可以设置为你想要的值
mediaQuery: false // 允许在媒体查询中转换`px`
}
}
}
\ No newline at end of file
{
"printWidth": 200,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "none",
"semi": false,
"wrap_line_length": 120,
"wrap_attributes": "auto",
"proseWrap": "always",
"arrowParens": "avoid",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "ignore",
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"jsxBracketSameLine": true,
"files.insertFinalNewline": true,
"useTabs": false,
"eslintIntegration": true,
"overrides": [
{
"files": ".prettierrc",
"options": {
"parser": "json"
}
}
],
"endOfLine": "auto"
}
File mode changed
// 获取 VUE_APP_ENV 非 NODE_ENV,测试环境依然 console
const IS_PROD = ['production', 'prod'].includes(process.env.VUE_APP_ENV)
const plugins = [
[
'import',
{
libraryName: 'vant',
libraryDirectory: 'es',
style: true
},
'vant'
]
]
// 去除 console.log
if (IS_PROD) {
plugins.push('transform-remove-console')
}
module.exports = {
presets: [['@vue/cli-plugin-babel/preset', { useBuiltIns: 'usage', corejs: 3 }]],
plugins
}
{
"name": "gh-hall",
"version": "1.0.0",
"description": "GH Hall By Work WeChat",
"author": "limin <limin.mail@qq.com>",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"stage": "vue-cli-service build --mode staging",
"lint": "vue-cli-service lint --fix",
"dev": "npm run serve"
},
"dependencies": {
"autoprefixer": "^8.0.0",
"core-js": "^3.6.4",
"dayjs": "^1.10.5",
"echarts": "^5.3.3",
"lib-flexible": "^0.3.2",
"postcss-loader": "^6.2.0",
"sha1": "^1.1.1",
"storejs": "^1.1.0",
"vconsole": "^3.7.0",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vuex": "^3.4.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"babel-plugin-import": "^1.13.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"node-sass": "^4.14.1",
"postcss-px-to-viewport": "^1.1.1",
"postcss-pxtorem": "^5.1.1",
"sass-loader": "^8.0.2",
"script-ext-html-webpack-plugin": "^2.1.4",
"vue-loader": "^15.9.8",
"vue-template-compiler": "^2.6.11",
"webpack-bundle-analyzer": "^3.8.0"
}
}
No preview for this file type
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no,viewport-fit=cover">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
<% } %>
<title>
<%= webpackConfig.name %>
</title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= webpackConfig.name %> doesn't work properly without JavaScript enabled. Please enable it
to continue.</strong>
</noscript>
<div id="app"></div>
<!-- 使用CDN加速的JS文件,配置在vue.config.js下 -->
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
<!-- built files will be auto injected -->
</body>
</html>
<template>
<div id="app">
<router-view />
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style lang="scss"></style>
/*
* @Descripttion:API 统一外部调用入口
* @version: 1.0.0
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: huyue
* @LastEditTime: 2022-06-28 15:12:48
*/
const modulesFiles = require.context('./modules', true, /\.js$/)
const modules = modulesFiles.keys().reduce((modules, modulePath) => {
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
const value = modulesFiles(modulePath)
modules[moduleName] = value.default
return modules
}, {})
export default modules
// window.$HTTP
export default {
/**获取品牌名称*/
getBrandList () {
return window.$HTTP.get('brand/getBrandName', {
req: {
queryTime: window.vm.getCurrentDate()
}
})
}
}
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-27 09:43:15
* @FilePath: \dj-data-view\src\api\modules\customer.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
// 获取企业客户总览数据
const getEnterpriseOverview = params => {
return window.$HTTP.get('enterpriseCustomer/getEnterpriseOverview', params)
}
// 获取门店区域/品牌/类型
const getEnterpriseDistribution = params => {
return window.$HTTP.get('enterpriseCustomer/getEnterpriseDistribution', params)
}
// 获取企业客户数据近12个月趋势图(包括:总客户数、新增客户数)
const getEnterpriseOverviewTrend = params => {
return window.$HTTP.get('enterpriseCustomer/getEnterpriseOverviewTrend', params)
}
export default {
getEnterpriseOverview,
getEnterpriseDistribution,
getEnterpriseOverviewTrend
}
// 当月进行中门店--区域(省份_地图)分布(参数:新车洽谈/新车交付/0~12个月/12个月以上)
const getMerchantInProgressThisMonth = params => {
return window.$HTTP.get('saasValueaddedTransformation/getMerchantInProgressThisMonth', params)
}
export default {
getMerchantInProgressThisMonth,
}
// window.$HTTP
export default {
/** 获取品牌---总体模块信息(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus 的基础数据 和 前五排行/后五排行 ) */
getBrandOverallbase(req) {
return window.$HTTP.get('brand/overallbase', { req })
},
/* 获取品牌---总体模块趋势图指标(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus) */
getBrandOveralltrend(req) {
return window.$HTTP.get('brand/overalltrend', { req })
},
/* 获取门店总体相关信息 */
getMerchantOverallbase(req) {
return window.$HTTP.get('merchant/overallbase', { req })
},
/* 获取门店---总体模块趋势图指标(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus) */
getMerchantOveralltrend(req) {
return window.$HTTP.get('merchant/overalltrend', { req })
},
/**
* 获取接入门店数
*/
getMerchantNum(req) {
return window.$HTTP.get('brand/getMerchantNum', { req })
}
}
/*
* @Description: 获取品牌销售相关信息
* @Author: huyue
* @Date: 2022-06-28 14:58:30
* @LastEditors: huyue
* @LastEditTime: 2022-06-30 14:27:04
*/
// 集团相关
// 获取品牌销售模块其他相关信息
const getSales = params => {
return window.$HTTP.get('brand/saleothers', params)
}
// 获取品牌销售转化总数居
const saleTotal = params => {
return window.$HTTP.get('brand/saletotal', params)
}
// 获取品牌销售转化信息
const saleTrans = params => {
return window.$HTTP.get('brand/saleTrans', params)
}
// 获取品牌客流转化趋势
const saleTransTrend = params => {
return window.$HTTP.get('brand/saleTransTrend', params)
}
// 门店相关
// 获取门店销售转化总数据
const storeTotal = params => {
return window.$HTTP.get('merchant/saletotal', params)
}
// 获取门店销售转化相关信息
const storeSaleTrans = params => {
return window.$HTTP.get('merchant/saleTrans', params)
}
// 获取门店销售相关信息
const getMerchantSales = params => {
return window.$HTTP.get('merchant/sale', params)
}
// 获取门店客流转化趋势
const storeTransTrend = params => {
return window.$HTTP.get('merchant/saleTransTrend', params)
}
export default {
getSales,
saleTotal,
saleTrans,
storeTotal,
storeSaleTrans,
getMerchantSales,
saleTransTrend,
storeTransTrend
}
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-27 10:20:25
* @FilePath: \dj-data-view\src\api\modules\customer.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
// 新车洽谈、新车交付、0~12个月、12个月以上(累计展业门店数、当年新增、转化率、客单价、产值)
const getBusinessType = params => {
return window.$HTTP.get('saasValueaddedTransformation/getBusinessType', params)
}
// 已展业省份--区域(省份_地图)分布(参数:新车洽谈/新车交付/0~12个月/12个月以上)
const getDevelopedProvinces = params => {
return window.$HTTP.get('saasValueaddedTransformation/getDevelopedProvinces', params)
}
// 当月进行中门店--区域(省份_地图)分布(参数:新车洽谈/新车交付/0~12个月/12个月以上)
const getMerchantInProgressThisMonth = params => {
return window.$HTTP.get('saasValueaddedTransformation/getMerchantInProgressThisMonth', params)
}
// 当月进行中门店--区域(省份_地图)分布(参数:新车洽谈/新车交付/0~12个月/12个月以上)
const getSaasValueaddedTransformationOverview = params => {
return window.$HTTP.get('saasValueaddedTransformation/getSaasValueaddedTransformationOverview', params)
}
// 门店会员的权益
const getMerchantData = params => {
return window.$HTTP.get('saasSubscription/getMerchantMemberEquity', params)
}
// 智慧车管线索订阅
const getSmartData = params => {
return window.$HTTP.get('saasSubscription/getSmartCarManageClueSubscription', params)
}
// 智慧门店线索订阅
const getSmartClueData = params => {
return window.$HTTP.get('saasSubscription/getSmartMerchantClueSubscription', params)
}
export default {
getBusinessType,
getDevelopedProvinces,
getMerchantInProgressThisMonth,
getSaasValueaddedTransformationOverview,
getMerchantData,
getSmartData,
getSmartClueData
}
/*
* @Description: 售后数据
* @Author: huyue
* @Date: 2022-06-28 16:55:48
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-27 15:23:24
*/
// 私域用户池总览数据
const getoverview = params => {
return window.$HTTP.get('/privateDomainUserPool/getoverview', params)
}
// 客户年龄分布/车价占比/购车年限分布/里程分布
const getDistribution = params => {
return window.$HTTP.get('privateDomainUserPool/getDistribution', params)
}
// 用户数、企微客户数、企微群数、小程序、个微客户数 趋势图
const getTrend = params => {
return window.$HTTP.get('privateDomainUserPool/getTrend', params)
}
const getCustomerValueAnalysis = params => {
return window.$HTTP.get('privateDomainUserPool/getCustomerValueAnalysis', params)
}
const getValueDistribution = params => {
return window.$HTTP.get('privateDomainUserPool/getValueDistribution', params)
}
// // 获取品牌售后其他信息
// const aftersaleother = params => {
// return window.$HTTP.get('brand/aftersaleother', params)
// }
// // 获取门店品牌售后其他信息
// const afterMerchantSaleother = params => {
// return window.$HTTP.get('merchant/aftersaleother', params)
// }
export default { getoverview, getDistribution, getTrend, getCustomerValueAnalysis, getValueDistribution }
class Request {
DOMAIN = '/dev'
constructor(_request_) {
this.DOMAIN = _request_ ? _request_.baseURL : this.DOMAIN
}
get (url, params, returnAll) {
return this.request('GET', url, params, returnAll)
}
post (url, params, returnAll) {
return this.request('POST', url, params, returnAll)
}
request (method, url, params, returnAll) {
var requestConfig = {
headers: {
// 'Content-Type': method == 'GET' ? 'application/json' : 'application/x-www-form-urlencoded; charset=UTF-8'
'Content-Type': 'application/json'
},
method
}
if (method === 'GET') {
var paramsArray = []
params&&Object.keys(params.req).forEach(key => paramsArray.push('req.' + key + '=' + params.req[key]))
if (url.search(/\?/) === -1) {
url += '?' + paramsArray.join('&')
} else {
url += '&' + paramsArray.join('&')
}
}
if (method === 'POST') {
Object.defineProperty(requestConfig, 'body', {
value: JSON.stringify(params)
})
}
return window
.fetch(this.DOMAIN + `/${url}`, requestConfig)
.then(res => {
return res.json()
})
// .catch(error => {
// alert(error)
// })
}
}
export default Request
@import './normalize.scss';
@font-face {
font-family: 'PingFangSC-Regular';
src: url('../font/PingFang-Regular.ttf');
}
html,
body .app {
color: #333333;
font-family: 'PingFangSC-Regular', Arial, Helvetica, 'STHeiti STXihei', 'Microsoft YaHei', Tohoma, sans-serif;
background-color: #fff;
-webkit-overflow-scrolling: touch;
height: 100%;
// overflow: hidden;
--themeColor: #3975c6;
}
img {
width: 100%;
height: 100%;
vertical-align: top;
}
.flex {
display: flex;
align-items: center;
}
.flex-around {
display: flex;
align-items: center;
justify-content: space-around;
}
.flex-between {
display: flex;
align-items: center;
justify-content: space-between;
}
.flex-column {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.text-two-line {
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.x-center {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
.y-center {
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.box-center {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.user-select {
user-select: none;
}
.pointer {
cursor: pointer;
}
.box {
background: #0b0e31;
// overflow: hidden;
}
.inline {
display: inline-block;
}
.title {
font-size: 0.75vw;
font-weight: 400;
font-size: 11px;
color: #ffffff;
user-select: none;
box-sizing: border-box;
height: 2.07vh;
margin-top: 4px;
}
.title-icon {
display: flex;
align-items: center;
.icon {
display: inline-block;
width: 18px;
height: 10px;
margin-right: 4px;
background-image: url(../images/icon.png);
}
}
.container {
height: 8.54vh;
margin: 8px 6px 8px 8px;
}
.user-container{
height:6.1vh;
margin: 5px 6px 5px 6px;
}
.empty {
display: flex;
width: 100%;
height: calc(100% - 4.1vh);
align-items: center;
justify-content: center;
img {
max-width: 20vh;
height: 9.5vh;
}
}
.text-linear {
background: linear-gradient(top, #b4bdff, #7e8eff);
color: transparent;
-webkit-background-clip: text;
}
.user-box {
height: 9.51vh;
width:11.18vw;
margin-right: 0.28vw;
margin-bottom: 0.28vw;
background: #0b0e31;
}
No preview for this file type
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-26 16:56:49
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-26 16:57:02
* @FilePath: \dj-data-view\src\bus.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import Vue from 'vue'
// export default new Vue()
const Bus = new Vue()
export default Bus
<template>
<div class="legend">
<div class="legend-item flex" v-for="(item, index) in dataList" :key="index">
<div class="icon" :style="{ background: colors[index] }"></div>
<div class="item-content">{{ item.name }}</div>
</div>
</div>
</template>
<script>
export default {
name: 'Legend',
data() {
return {
dataList: this.list
}
},
props: {
list: {
type: Array,
default: () => []
},
colors: {
type: Array,
default: () => ['#FF6E76', '#7CFFB2', ' #FDF006', '#4FA0FF', '#EB6001', '#BF98FF', '#BF98FF', '#58D9F9']
}
},
watch: {
list(val) {
this.dataList = val
}
},
mounted() {},
methods: {}
}
</script>
<style lang="scss" scoped>
.legend {
display: flex;
align-items: center;
flex-wrap: wrap;
width: 7.7vw;
height: 8.54vh;
margin-left: 0.42vw;
.legend-item {
width: 3.68vw;
height: 2.44vh;
background: #0d133b;
align-items: center;
font-size: 7px;
color: #fff;
box-sizing: border-box;
margin: 2px 2px 2px 0;
white-space: nowrap;
.item-content {
width: 2.5vw;
overflow: hidden;
}
.icon {
width: 5px;
height: 5px;
background: #bf98ff;
border-radius: 50%;
margin: 4px;
}
}
}
</style>
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:43:46
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-28 14:53:22
* @FilePath: \dj-data-view\src\components\barChart.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="line-box">
<div :id="domId" class="line-chart" :style="{ height: boxHeight }"></div>
</div>
</template>
<script>
import datas from '@/utils/data'
import * as echarts from 'echarts'
import { getLineOptions } from './options'
export default {
name: 'lineChart',
props: {
domId: {
type: String,
default: 'line-chart'
},
revese: {
type: Boolean,
default: false
},
boxHeight: {
type: String,
default: '12.83vh'
},
storeOrBrandTxt: {
type: String,
default: '品牌'
},
privateList: {
type: [Object, Array],
default: () => {}
},
// 0-月表;1-日表
queryType: {
type: Number,
default: 0
},
tooltipFormatterObj: {
type: Array,
default: () => {
return [
{
label: '数量',
attrName: 'num'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
]
}
}
},
data() {
return {
directionTimer: datas.DefaultData.directionTimer,
delayTimer: datas.DefaultData.delayTimer,
rankFlag: 'top',
lineOptions: [],
rankList: [],
echartsLine: '',
moveAttr: {
// speed: 900,
seriesIndex: 0,
dataIndex: 0
},
timer: null
}
},
watch: {
privateList: {
handler() {
this.lineOptions = getLineOptions(this.privateList)
this.chartBindEvent()
},
deep: true
}
},
mounted() {
this.lineDom = document.getElementById(this.domId)
this[this.domId] = echarts.init(this.lineDom)
},
methods: {
chartBindEvent() {
this[this.domId].setOption(this.lineOptions)
}
}
}
</script>
<style lang="scss" scoped>
.line-box {
height: 100%;
color: #ffffff;
.txt-orange {
color: #eb6001;
}
.line-chart {
width: 100%;
}
}
</style>
<template>
<div class="marquee-box" ref="marqueeBox">
<span class="marquee" ref="marqueeText" :style="[{ transition: `all ${move ? speed : 0}s linear` }, { left: target }]">{{ text }}</span>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'Marquee',
props: {
text: String,
direction: {
type: Number,
default: 5000
},
delay: {
type: Number,
default: 1000
}
},
data () {
return {
move: false,
valueWidth: 0,
target: 0,
boxWidth: 0,
speed: 0
}
},
watch:{
'text'(n){
if(n)setTimeout(() => {
let { marqueeBox, marqueeText } = this.$refs
if (!marqueeBox) return
let boxWidth = marqueeBox.offsetWidth,
valueWidth = marqueeText.offsetWidth
this.valueWidth = valueWidth
this.boxWidth = boxWidth
if (boxWidth - 10 <= valueWidth) this.run(valueWidth)
}, this.delay)
}
},
mounted () {
},
methods: {
run () {
let { valueWidth, direction } = this
this.target = `-${valueWidth}px`
this.move = true
this.speed = direction / 1000
setTimeout(() => {
this.again()
}, direction)
},
again () {
let { boxWidth, valueWidth, direction } = this
this.move = false
this.target = `${boxWidth}px`
setTimeout(() => {
this.speed = direction * (boxWidth / valueWidth).toFixed(2) / 1000
this.move = true
this.reset()
}, 500)
},
reset () {
let awaitTime = (this.speed + 2) * this.delay
this.target = 0
setTimeout(() => {
this.run()
}, awaitTime)
}
}
}
</script>
<style scoped lang="scss">
.marquee-box {
width: 100%;
height: 100%;
overflow: hidden;
position: relative;
.marquee {
position: absolute;
white-space: nowrap;
display: flex;
align-items: center;
}
.move {
transform: translateX(-100%);
}
}
</style>
<template>
<div class="pie-box">
<div :id="id" :style="{ height: height }" class="pie-chart"></div>
<!-- <div class="center-content" :style="{ fontSize: size }">
<div :class="[id, 'center-content-num', 'center-content-num-color']"></div>
</div> -->
<!-- <div class="content-desc">
<div class="content-desc-icon" :style="{ background: descColor }"></div>
{{ numDesc }}
</div> -->
</div>
</template>
<script>
import * as echarts from 'echarts'
export default {
name: 'PieChart',
props: {
id: {
type: String,
default: ''
},
keys: {
type: Array,
default: () => ['name', 'value']
},
height: {
type: String,
default: '8.54vh'
},
list: {
type: Array,
default: () => []
},
radius: {
type: Array,
default: () => ['60%', '89%']
},
colors: {
type: Array,
default: () => ['#FF6E76', '#7CFFB2', ' #FDF006', '#4FA0FF', '#EB6001', '#BF98FF', '#58D9F9']
},
size: {
type: String,
default: '0.6vw'
}
},
data() {
return {
option: '',
echartsPie: '',
mTime: '',
viewData: [],
text: '',
subtext: '',
currentIndex: -1,
mainValue: 0,
numDesc: '',
descColor: ''
}
},
watch: {
list: {
handler(newVal) {
if (newVal.length > 0) {
this.initData()
this.$nextTick(() => {
this.draw()
})
}
},
immediate: true
}
},
mounted() {
},
methods: {
//初始化数据
initData() {
let { list, keys } = this
this.viewData = []
list.forEach(item => {
this.viewData.push({
name: item[keys[0]],
value: item[keys[1]]
})
})
},
draw() {
if (this.mTime) clearInterval(this.mTime)
this.echartsPie = echarts.init(document.getElementById(this.id))
window.addEventListener('resize', () => {
this.echartsPie.resize()
})
// 指定图表的配置项和数据
this.option = {
// tooltip: {
// trigger: 'item'
// },
color: this.colors,
series: [
{
name: '客户年龄分布',
type: 'pie',
radius: this.radius,
center: ['50%', '50%'],
avoidLabelOverlap: false,
label: {
normal: {
show: false,
position: 'center'
},
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: this.size,
fontWeight: 'bold',
color:'#fff',
formatter: '{d}%'
}
},
labelLine: {
show: false
},
data: this.viewData,
minAngle: 30
}
]
}
this.echartsPie.clear()
this.mainValue = 0
this.numDesc = ''
this.echartsPie.setOption(this.option)
this.pieActive()
this.mTime = setInterval(this.pieActive, 15000)
// 鼠标划出
this.echartsPie.on('mouseout', () => {
if (this.mTime) clearInterval(this.mTime)
this.mTime = setInterval(this.pieActive, 15000)
})
this.echartsPie.on('mouseover', data => {
this.mainValue = data.data.value
this.numDesc = data.data.name
this.descColor = data.color
// 停止定时器,清除之前的高亮
clearInterval(this.mTime)
this.currentIndex = data.dataIndex
this.highlightPie()
this.emitEvent(data.data)
})
},
// 事件触发
emitEvent(data) {
this.echartsPie.setOption(this.option)
this.$emit('pieAction', data)
},
highlightPie() {
// 取消所有高亮并高亮当前图形
// 遍历饼图数据,取消所有图形的高亮效果
for (var idx in this.option.series[0].data)
this.echartsPie.dispatchAction({
type: 'downplay',
seriesIndex: 0,
dataIndex: idx
})
// 高亮当前图形
this.echartsPie.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: this.currentIndex
})
this.descColor = this.option.color[this.currentIndex]
},
//高亮
pieActive() {
const dataLen = this.option.series[0].data.length
this.currentIndex = (this.currentIndex + 1) % dataLen
this.highlightPie()
this.emitEvent(this.viewData[this.currentIndex])
}
}
}
</script>
<style lang="scss" scoped>
.pie-box {
// background: #262525;
position: relative;
flex: 1;
.center-content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
max-width: 40%;
&-num-color {
color: #fff;
}
&-num {
// overflow: hidden;
// text-overflow: ellipsis;
// white-space: nowrap;
// font-size: 0.6vw;
--step: 0;
counter-reset: count var(--step);
z-index: var(--step);
transition: --step 0.5s;
&::before {
content: counter(count);
}
}
&-desc {
font-size: 0.5vw;
color: #606266;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
animation: rotateIn 3s infinite;
}
}
.content-desc {
display: flex;
align-items: center;
font-size: 8px;
color: #c8c8c8;
text-align: center;
font-weight: 400;
position: absolute;
top: 91%;
left: 50%;
transform: translateX(-50%);
text-align: center;
height: 14px !important;
white-space: nowrap;
&-icon {
width: 8px;
height: 4px;
border-radius: 2px;
margin-right: 4px;
}
}
}
@property --step {
syntax: '<integer>';
inherits: false;
initial-value: 15;
}
@keyframes rotateIn {
from {
transform: rotateY(0turn);
}
to {
transform: rotateY(-1turn);
}
}
</style>
<!--
* @Description:
* @Author: huyue
* @Date: 2022-06-28 15:20:14
* @LastEditors: huyue
* @LastEditTime: 2022-07-08 19:03:36
-->
<template>
<div class="ranking-container">
<div class="ranking-title">{{ this.$store.state.app.reportParams.brand ? '门店' : '品牌' }}排名</div>
<div class="ranking">
<div class="brand flex" v-for="(item, index) in brandList" :key="index">
<span class="brand-num">{{ index + 1 }}</span>
<marquee class="marquee" :direction="directionTimer" :delay="delayTimer" :text="item" />
</div>
</div>
</div>
</template>
<script>
export default {
name: 'RanKing',
props: {
list: {
type: Array,
default: () => []
}
},
watch: {
list: {
handler(newVal) {
this.brandList = newVal
}
}
},
data() {
return {
delayTimer: 3000,
directionTimer: 3000,
brandList: this.list,
isBrandName: false
}
}
}
</script>
<style lang="scss" scoped>
.ranking-container {
flex: 1;
margin-left: 0.6vw;
box-sizing: border-box;
height: 12.7vh;
background: #262525;
.ranking-title {
background: rgba(53, 53, 53, 0.6);
font-size: 0.694vw;
color: #eb6001;
font-weight: 400;
padding: 0.4vh 0 0.4vh 20%;
box-sizing: border-box;
}
.ranking {
font-size: 0.694vw;
color: #ffffff;
letter-spacing: 0;
font-weight: 400;
padding: 0.2vh 0 0.3vh 8px;
.brand {
// line-height: 1.9vh;
height: 1.9vh;
display: flex;
align-items: center;
.brand-num {
color: #606266;
margin-right: 0.6vw;
display: inline-block;
width: 0.3vw;
text-align: center;
}
.marquee {
width: 80%;
height: 1.9vh;
font-weight: 400;
}
}
}
}
</style>
<template>
<div class="number-box flex">
<template v-if="numList.length">
<template v-for="(i,index) in numList">
<div :key="index">
{{i}}
</div>
<template v-if="index != numList.length - 1">,</template>
</template>
</template>
<template v-else>
<div
class="transition-number"
:id="idKey"
>
</div>
</template>
<slot name="suffix"></slot>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'TransitionNumber',
props: {
num: [String, Number],
idKey: String,
split: Boolean
},
data () {
return {
numList: []
}
},
watch: {
num (n) {
this.numList = []
setTimeout(() => {
if (n > 0) {
document.querySelector(`#${this.idKey}`).style = `--step:${n}`
setTimeout(() => {
this.numList = this.setPrice(n)
}, 1000)
} else document.querySelector(`#${this.idKey}`).style = `--step:0`
}, 200)
}
},
mounted () {
},
methods: {
setPrice (price) {
let number = (price.toString() || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
return number.split(',')
}
}
}
</script>
<style scoped lang='scss'>
.number-box {
}
.transition-number {
color: inherit;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
--step: 0;
counter-reset: count var(--step);
z-index: var(--step);
transition: --step 1s;
font-size: inherit;
&::before {
content: counter(count);
}
}
@property --step {
syntax: '<integer>';
inherits: false;
initial-value: 15;
}
</style>
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-26 10:22:41
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-27 14:30:38
* @FilePath: \dj-data-view\src\components\ViewChart.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="view-chart flex">
<div class="line-chart">
<line-chart domId="sumChart" boxHeight="17.54vh" :privateList="privateList"></line-chart>
</div>
<div class="pie-chart">
<Age></Age>
<Price></Price>
<BuyCar></BuyCar>
<Mileage></Mileage>
</div>
</div>
</template>
<script type="text/ecmascript-6">
import * as echarts from 'echarts'
import datas from '../utils/data'
import Age from '../views/user/age.vue'
import Price from '../views/user/price'
import BuyCar from '../views/user/buyCar'
import Mileage from '../views/user/mileage'
import { userMixin } from '../mixins/index'
export default {
name: 'ViewChart',
mixins: [userMixin],
components: {
Age,
Price,
BuyCar,
Mileage
},
data() {
return {
privateList: []
}
},
created() {
this.getDistribution()
},
mounted() {
this.$bus.$on('drawPrivateChart', data => {
this.privateList = data
})
},
methods: {}
}
</script>
<style scoped lang="scss">
.view-chart {
height: 19.51vh;
margin: 0.98vh 0;
.line-chart {
width: 26.25vw;
height: 100%;
background: #0b0e31;
margin-right: 0.56vw;
}
.pie-chart {
width: 23.28vw;
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
}
}
</style>
<template>
<div class="ViewContainer">
<div class="ViewContainer-title">
<slot name="title" />
</div>
<div class="ViewContainer-body">
<slot name="content" />
</div>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'ViewContainer',
props: {
},
data () {
return {
}
},
mounted () { },
methods: {}
}
</script>
<style scoped lang='scss'>
.ViewContainer {
width: 100vw;
height: 100vh;
&-title {
height: 6.1vh;
width:100%;
background-image: url('../assets/images/bg-title.jpg');
background-repeat: no-repeat;
background-size:cover;
}
&-body {
height: 93.9vh;
}
}
</style>
\ No newline at end of file
<template>
<div class="content">
<view-content-left />
<view-content-right />
</div>
</template>
<script>
export default {
name: 'ViewContent',
props: {
},
data () {
return {
}
},
methods: {
}
}
</script>
<style scoped lang='scss'>
.content {
width: 100%;
height: 100%;
box-sizing: border-box;
position: relative;
padding: 1.46vh 24px 1.95vh;
gap: 0 16px;
display: flex;
justify-content: space-between;
> div {
height: 100%;
}
}
</style>
<template>
<div class="left">
<div class="top">
<view-sub-title title="企业客户总览" />
<view-tabs />
<view-surface />
<view-pie-group>
<div slot="1"><Area :height="defaultHeight"></Area></div>
<div slot="2"><Brand :height="defaultHeight"></Brand></div>
<div slot="3"><Store :height="defaultHeight"></Store></div>
</view-pie-group>
</div>
<div class="bottom">
<view-sub-title title="SaaS订阅业务总览" />
<OverSize></OverSize>
</div>
</div>
</template>
<script type="text/ecmascript-6">
import datas from '../utils/data'
import Area from '../views/customer/area'
import Store from '../views/customer/store'
import Brand from '../views/customer/brand'
import OverSize from '../views/saas/overview.vue'
import { clientMixin } from '../mixins/index'
export default {
name: 'ViewContentLeft',
mixins: [clientMixin],
components: {
Area,
Store,
Brand,
OverSize
},
data() {
return {
defaultHeight: datas.DefaultData.defaultPieHeight
}
},
created() {
this.getClientData()
},
mounted() {},
methods: {}
}
</script>
<style scoped lang="scss">
.left {
display: flex;
flex-direction: column;
width: 43.89vw;
overflow: hidden;
.top {
height: 50.49vh;
width: 100%;
background-image: url('../assets/images/bg-1.png');
background-repeat: no-repeat;
background-size: 100% 100%;
padding: 0 16px;
box-sizing: border-box;
}
.bottom {
// height: calc(41% - 16px);
height: 38.05vh;
margin-top: auto;
background-image: url('../assets/images/bg-2.png');
background-repeat: no-repeat;
background-size: 100% 100%;
padding: 0 16px;
box-sizing: border-box;
}
}
</style>
<!--
* @Description:
* @Author: huyue
* @Date: 2022-06-23 10:52:23
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-28 09:34:04
-->
<template>
<div class="right">
<div class="top">
<view-sub-title title="SaaS+增值转化业务" />
<Business></Business>
<Project></Project>
</div>
<div class="bottom">
<view-sub-title title="私域用户池总览" />
<UserTab></UserTab>
<view-chart></view-chart>
<view-line-group>
<div slot="1"><Analyse :height="defaultHeight"></Analyse></div>
<div slot="2"><Brand :height="defaultHeight" :brandList="brandList"></Brand></div>
<div slot="3"><Area :height="defaultHeight" :areaList="areaList"></Area></div>
</view-line-group>
</div>
</div>
</template>
<script type="text/ecmascript-6">
const queryItem = ['Importantvalue', 'Importantdevelopments', 'Importantrecall', 'Importantretention', 'Generalvalue', 'Generaldevelopments', 'Generalrecall','Generalretention']
import datas from '../utils/data'
import Business from '../views/saas/business'
import Project from '../views/saas/project'
import Analyse from '../views/user/analyse'
import Brand from '../views/user/brand'
import Area from '../views/user/area'
import UserTab from '../views/user/usertab'
export default {
name: 'ViewContentRight',
components: {
Business,
Project,
Analyse,
Brand,
Area,
UserTab
},
data() {
return {
defaultHeight: datas.DefaultData.defaultLineHeight,
brandList: [],
areaList: []
}
},
mounted() {
this.getValueDistribution(7);
this.$bus.$on('drawChart', data => {
this.getValueDistribution(data)
})
},
methods: {
getValueDistribution(itemKey) {
const params = {
req: {
queryItem: queryItem[7-itemKey]
}
}
this.api.user.getValueDistribution(params).then(res => {
if(res.code ==0) {
this.areaList = res.data.dataList[0].rankDistributions
this.brandList = res.data.dataList[1].rankDistributions
}
})
}
}
}
</script>
<style scoped lang="scss">
.right {
width: 51.67vw;
display: flex;
flex-direction: column;
.top {
height: 33.41vh;
background-image: url('../assets/images/bg-3.png');
background-repeat: no-repeat;
background-size: 100% 100%;
padding: 0 16px;
box-sizing: border-box;
}
.bottom {
height: 55.12vh;
margin-top: auto;
background-image: url('../assets/images/bg-4.png');
background-repeat: no-repeat;
background-size: 100% 100%;
padding: 0 16px;
box-sizing: border-box;
}
}
</style>
<!--
* @Description: 一行两个一组
* @Author: huyue
* @Date: 2022-06-23 11:28:03
* @LastEditors: huyue
* @LastEditTime: 2022-06-24 14:57:41
-->
<template>
<div class="line-group">
<template v-for="(i, index) in items">
<div class="box" :key="index" :style="[{ height: height }, { 'margin-bottom': hideMargin ? 0 : '1vh' }]">
<slot :name="i"></slot>
</div>
</template>
</div>
</template>
<script type="text/ecmascript-6">
import datas from '../utils/data'
export default {
name: 'ViewLineGroup',
props: {
height: {
type: String,
default: datas.DefaultData.defaultLineHeight + 'vh'
},
hideMargin: Boolean
},
data() {
return {
items: [1, 2, 3]
}
},
mounted() {},
methods: {}
}
</script>
<style scoped lang="scss">
.line-group {
display: flex;
gap: 0 4px;
}
</style>
<template>
<div class="pie-group">
<template v-for="(i, index) in items">
<div class="box" :key="index">
<slot :name="i"></slot>
</div>
</template>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'ViewPieGroup',
props: {},
data() {
return {
items: [1, 2, 3]
}
},
mounted() {
},
methods: {
}
}
</script>
<style scoped lang="scss">
.pie-group {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 0 8px;
.box {
height:13.05vh;
}
}
</style>
<template>
<div class="sub-title user-select">
<div class="text">{{ title }}</div>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'ViewSubTitle',
props: ['title'],
data() {
return {}
},
mounted() {},
methods: {}
}
</script>
<style scoped lang='scss'>
.sub-title {
width:11.88vw;
height: 2.93vh;
font-size: 12px;
margin-top: 8px;
margin-left:-12px;
background-image: url('../assets/images/title.png');
background-repeat: no-repeat;
background-size: 100% 100%;
.text {
color: #ffffff;
-webkit-background-clip: text;
margin-left: 2.36vw;
line-height: 2.93vh ;
}
}
</style>
\ No newline at end of file
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-27 10:58:34
* @FilePath: \dj-data-view\src\components\ViewSurface.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="surface box">
<line-bar domId="surfaceChart" boxHeight="19.5vh" :dataList="dataList"></line-bar>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'ViewSurface',
data() {
return {
dataList: []
}
},
mounted() {
this.getEnterpriseOverviewTrend()
},
methods: {
getEnterpriseOverviewTrend() {
this.api.customer.getEnterpriseOverviewTrend().then(res => {
if(res.code == 0){
this.dataList = res.data.dataList
}
})
}
}
}
</script>
<style scoped lang="scss">
.surface {
height: 21.46vh;
margin-bottom: 0.98vh;
}
</style>
<template>
<div class="tabs flex box">
<div class="tab" v-for="item in tabs" :key="item.key">
<div class="tab-title">{{ item.title }}</div>
<div v-if="item.key != 'retention'" class="tab-text text-linear">{{ numAddSymbol(dataList[item.key]) }}</div>
<div v-else class="tab-text text-linear">{{ toFixNum(dataList[item.key]) }}</div>
</div>
</div>
</template>
<script type="text/ecmascript-6">
import * as echarts from 'echarts'
export default {
name: 'ViewTabs',
data() {
return {
dataList: {},
tabs: [
{
title: '总门店数',
key: 'totalNum'
},
{
title: '当年新增',
key: 'incrNum'
},
{
title: '留存率',
key: 'retention'
},
// {
// title: '单店产值',
// key: 'outputValue'
// }
]
}
},
created() {
this.getEnterpriseOverview()
},
methods: {
toFixNum(val) {
return (val * 100).toFixed(1) + '%'
},
getEnterpriseOverview() {
this.api.customer.getEnterpriseOverview().then(res => {
if (res.code == 0) {
this.dataList = res.data.dataList[0]
}
})
}
}
}
</script>
<style scoped lang="scss">
.tabs {
margin: 0.98vh 0 0.98vh 0;
padding: 20px 1.67vw;
height: 6.95vh;
width: 100%;
box-sizing: border-box;
justify-content: space-between;
.tab {
// padding: 2vh 0;
.tab-title {
font-weight: 400;
font-size: 12px;
color: #e8e8e8;
}
.tab-text {
font-weight: 700;
font-size: 24px;
line-height: 30px;
}
}
}
</style>
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-28 13:41:25
* @FilePath: \dj-data-view\src\components\ViewTitle.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="content flex">
<div class="logo user-select">
<img style="height: 3.17vh" src="@/assets/images/logo.png" alt="logo" />
</div>
<div class="view-title user-select">嘀加智慧门店运营看板</div>
<div class="time">
<div class="top flex">
<img src="@/assets/images/time.png" class="icon" />
<div class="now">{{ now }}</div>
</div>
</div>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'ViewTitle',
data() {
return {
now: new Date().format('yyyy-MM-dd hh:mm:ss')
}
},
mounted() {
this.timer()
},
methods: {
timer() {
setInterval(() => {
this.now = new Date().format('yyyy-MM-dd hh:mm:ss')
}, 1e3)
}
}
}
</script>
<style scoped lang="scss">
.content {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 0 42px 0 76px;
justify-content: space-between;
.view-title {
font-weight: 600;
font-size: 24px;
color: #ffffff;
letter-spacing: 8px;
text-align: center;
}
.time {
text-align: right;
font-size: 14px;
color: #ffffff;
.top {
justify-content: flex-end;
.now {
width: 9.3vw;
}
}
.icon {
width: 14px;
height: 14px;
margin-right: 8px;
}
}
}
</style>
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:43:46
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @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
-->
<template>
<div class="line-box">
<div :id="domId" class="line-chart" :style="{ height: boxHeight }"></div>
</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'
import { getBarOptions, getBarReverseOptions } from './options'
export default {
name: 'barChart',
props: {
domId: {
type: String,
default: 'line-chart'
},
rotate: {
type: Number,
default: 0
},
revese: {
type: Boolean,
default: false
},
boxHeight: {
type: String,
default: '13.83vh'
},
storeOrBrandTxt: {
type: String,
default: '品牌'
},
analysisList: {
type: [Array, Object],
default: () => []
},
// 0-月表;1-日表
queryType: {
type: Number,
default: 0
},
tooltipFormatterObj: {
type: Array,
default: () => {
return [
{
label: '数量',
attrName: 'num'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
]
}
}
},
data() {
return {
directionTimer: datas.DefaultData.directionTimer,
delayTimer: datas.DefaultData.delayTimer,
rankFlag: 'top',
lineOptions: [],
rankList: [],
areaList2: this.areaList,
echartsLine: '',
moveAttr: {
// speed: 900,
seriesIndex: 0,
dataIndex: 0
},
timer: null,
currentData: {
dataIndex: 0
}
}
},
// created() {
// const { rotate, analysisList } = this
// const obj = {
// rotate,
// analysisList
// }
// this.lineOptions = this.revese ? getBarReverseOptions(obj) : getBarOptions(obj)
// },
watch: {
analysisList: {
handler() {
const { rotate, analysisList } = this
const obj = {
rotate,
analysisList,
ValueAnalysis
}
this.lineOptions = this.revese ? getBarReverseOptions(obj) : getBarOptions(obj)
this.chartBindEvent()
},
deep: true
}
},
mounted() {
this.lineDom = document.getElementById(this.domId)
this[this.domId] = echarts.init(this.lineDom)
// this.chartBindEvent()
},
methods: {
chartBindEvent() {
this[this.domId].setOption(this.lineOptions)
if (this.revese === false) return
this.chartAction()
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.chartAction(yIndex)
}, 500)
)
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({
type: 'showTip',
seriesIndex: 0,
dataIndex: index
})
this.$bus.$emit('drawChart', index)
}
}
}
</script>
<style lang="scss" scoped>
.line-box {
height: 100%;
color: #ffffff;
.txt-orange {
color: #eb6001;
}
.line-chart {
width: 100%;
}
}
</style>
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-08 19:20:13
* @LastEditors: limin
* @LastEditTime: 2021-06-25 18:09:28
*/
import Vue from 'vue'
const componentsFiles = require.context(`./`, true, /.vue$/)
componentsFiles.keys().forEach(path => {
const component = componentsFiles(path).default
Vue.component(component.name, component)
})
\ No newline at end of file
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:43:46
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-27 11:30:04
* @FilePath: \dj-data-view\src\components\barChart.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="line-box">
<div :id="domId" class="line-chart" :style="{ height: boxHeight }"></div>
</div>
</template>
<script>
import datas from '@/utils/data'
import * as echarts from 'echarts'
import { lineAndBarOptions } from './options'
export default {
name: 'lineBar',
props: {
domId: {
type: String,
default: 'line-chart'
},
revese: {
type: Boolean,
default: false
},
boxHeight: {
type: String,
default: '13.83vh'
},
storeOrBrandTxt: {
type: String,
default: '品牌'
},
dataList: {
type: Array,
default: () => []
},
// 0-月表;1-日表
queryType: {
type: Number,
default: 0
},
tooltipFormatterObj: {
type: Array,
default: () => {
return [
{
label: '数量',
attrName: 'num'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
]
}
}
},
data() {
return {
directionTimer: datas.DefaultData.directionTimer,
delayTimer: datas.DefaultData.delayTimer,
rankFlag: 'top',
lineOptions: [],
rankList: [],
echartsLine: '',
moveAttr: {
// speed: 900,
seriesIndex: 0,
dataIndex: 0
},
timer: null
}
},
watch: {
dataList: {
handler() {
this.lineOptions = lineAndBarOptions(this.dataList)
this.chartBindEvent()
},
deep: true
}
},
mounted() {
this.lineDom = document.getElementById(this.domId)
this[this.domId] = echarts.init(this.lineDom)
},
methods: {
chartBindEvent() {
// window.addEventListener('resize', () => {
// this[this.domId].resize()
// })
this[this.domId].setOption(this.lineOptions)
}
}
}
</script>
<style lang="scss" scoped>
.line-box {
height: 100%;
color: #ffffff;
.txt-orange {
color: #eb6001;
}
.line-chart {
width: 100%;
}
}
</style>
function getLineOptions(obj) {
const { tooltipFormatter } = obj
var lineOptions = {
tooltip: {
trigger: 'axis',
borderWidth: 0,
backgroundColor: 'rgba(68,68,68,0.80)',
textStyle: {
color: 'rgba(255,255,255,0.6)',
fontSize: '1.5px'
},
formatter: tooltipFormatter || '',
confine: true
},
grid: {
left: '3%',
right: '4%',
top: '10%',
bottom: '10%',
containLabel: true
},
xAxis: {
type: 'category',
axisLabel: {
color: '#606266',
fontSize: '0.8em'
},
data: []
},
yAxis: {
type: 'value',
splitLine: {
lineStyle: {
color: 'rgba(96,98,102,0.2)'
}
},
splitNumber: 4
},
series: [
{
type: 'line',
symbol: 'circle',
itemStyle: {
color: '#F5AA01'
},
// 平滑曲线
smooth: true,
showSymbol: false,
// 折线背景色
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: 'rgba(254, 84, 0, 0.3)'
},
{
offset: 1,
color: 'rgba(254, 84, 0, 0.01)'
}
]
}
},
data: []
}
]
}
return lineOptions
}
export default getLineOptions
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:46:24
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @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) {
const { analysisList, rotate } = obj
const num = analysisList.map(item => item.ratio * 100)
console.log(num)
const name = analysisList.map(item => item.name)
var options = {
xAxis: {
type: 'category',
axisLabel: {
color: '#fff',
fontSize: '0.72em'
},
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
show: false
},
data: name
},
grid: {
left: '6%',
right: '6%',
top: '6%',
bottom: '4%',
// bottom: obj.rotate ? '4%' : '12%',
containLabel: true
},
yAxis: {
type: 'value',
splitLine: {
lineStyle: {
color: '#2F314F'
}
},
axisLabel: {
color: '#fff',
fontSize: '0.75em',
formatter: '{value}%'
},
splitNumber: 4
},
series: [
{
type: 'bar',
symbol: 'circle',
backgroundStyle: {
color: '#6578FF'
},
barWidth: '35%',
data: num
}
]
}
return options
}
function getBarReverseOptions(obj) {
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',
showContent: false,
axisPointer: {
type: 'shadow',
shadowStyle: {
color: 'rgba(210, 210, 210, 0.2)'
}
},
borderWidth: 0,
backgroundColor: 'rgba(68,68,68,0.80)',
confine: true,
textStyle: {
color: '#ffffff',
fontSize: 8
}
},
yAxis: {
type: 'category',
axisLabel: {
color: '#ccc',
fontSize: '0.8em'
},
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
show: false
},
data: value.map(item => item.label)
},
grid: {
left: '8%',
right: '0%',
top: '0%',
bottom: '0%',
containLabel: true
},
xAxis: {
nameGap: 30,
type: 'value',
splitLine: {
show: false
},
axisLabel: {
show: false
},
splitNumber: 4
},
series: [
{
type: 'bar',
symbol: 'circle',
backgroundStyle: {
color: '#6578FF'
},
itemStyle: {
normal: {
label: {
show: true,
position: 'center',
textStyle: {
fontSize: 10,
color: '#fff',
height: 16,
padding: [0, 2, 2, 4],
lineHeight: 16
}
}
}
},
data: value.map(item => item.value)
}
]
}
return options
}
function getLineOptions(obj) {
const { dataList, name } = obj
const statDate = dataList.map(item => item.statDate)
const num = dataList.map(item => item.num)
var options = {
tooltip: {
trigger: 'axis',
axisPointer: {
lineStyle: {
type: 'solid'
}
},
padding: 5,
borderWidth: 0.5,
backgroundColor: 'rgba(35, 45, 152, 1)',
borderRadius: 4,
textStyle: {
color: 'rgba(255,255,255,1)',
fontSize: 10
},
formatter: function (item) {
return `${name}:${item[0].value}`
}
},
xAxis: {
type: 'category',
axisLabel: {
color: '#fff',
fontSize: '0.7em',
rotate: 30
},
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
show: false
},
data: statDate
},
grid: {
left: '6%',
right: '6%',
top: '14%',
bottom: '3%',
containLabel: true
},
yAxis: {
nameGap: 30,
type: 'value',
splitLine: {
lineStyle: {
color: '#2F314F'
}
},
axisLabel: {
color: '#ccc',
fontSize: '0.7em'
},
splitNumber: 4
},
series: [
{
type: 'line',
symbol: 'circle',
itemStyle: {
color: '#F5AA01'
},
// 平滑曲线
smooth: true,
showSymbol: false,
// 折线背景色
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: 'rgba(254, 84, 0, 0.3)'
},
{
offset: 1,
color: 'rgba(254, 84, 0, 0.01)'
}
]
}
},
data: num
}
]
}
return options
}
function lineAndBarOptions(list) {
const statDate = list.map(item => item.statDate)
const totalNum = list.map(item => item.totalNum)
const increNum = list.map(item => item.increNum)
var options = {
tooltip: {
trigger: 'axis',
axisPointer: {
lineStyle: {
type: 'solid'
}
},
padding: 5,
borderWidth: 1,
backgroundColor: 'rgba(35, 45, 152, 1)',
borderRadius: 4,
textStyle: {
color: 'rgba(255,255,255,1)',
fontSize: 10
},
formatter: function (item) {
const items = list[item[0].dataIndex]
return `当月总门店数:${item[0].value}<br>当月新增:${item[1].value}<br>上月总门店数:${items.yesterdaytotalNum}<br>上月月新增:${items.yesterdayincreNum}`
}
},
xAxis: [
{
type: 'category',
axisLabel: {
color: '#fff',
fontSize: '0.8em'
},
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
show: false
},
data: statDate
}
],
grid: {
left: '3%',
right: '6%',
top: '6%',
bottom: '0%',
containLabel: true
},
yAxis: [
{
name: 'bar',
nameGap: 30,
type: 'value',
splitLine: {
lineStyle: {
color: '#2F314F'
}
},
axisLabel: {
color: '#FFD241',
fontSize: '0.8em'
},
splitNumber: 4
},
{
name: 'line',
nameGap: 30,
type: 'value',
splitLine: {
lineStyle: {
color: '#2F314F'
}
},
axisLabel: {
color: '#769EFF',
fontSize: '0.8em'
},
splitNumber: 4
}
],
series: [
{
name: 'line',
type: 'line',
symbol: 'circle',
itemStyle: {
color: '#F5AA01'
},
// 平滑曲线
smooth: true,
showSymbol: false,
// 折线背景色
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: 'rgba(254, 84, 0, 0.3)'
},
{
offset: 1,
color: 'rgba(254, 84, 0, 0.01)'
}
]
}
},
data: totalNum
},
{
name: 'bar',
type: 'bar',
symbol: 'circle',
backgroundStyle: {
color: '#6578FF'
},
yAxisIndex: 1,
barWidth: '30%',
data: increNum
}
]
}
return options
}
export { getBarReverseOptions, getBarOptions, lineAndBarOptions, getLineOptions }
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-08 16:55:43
*/
// 根据环境引入不同配置 process.env.VUE_APP_ENV
const environment = process.env.VUE_APP_ENV || 'production'
let config = require('./env.' + environment)
module.exports = config
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: huyue
* @LastEditTime: 2022-07-11 11:01:00
*/
// 本地环境配置
module.exports = {
envVersion: 'trial',
title: '嘀加智慧门店',
request: {
// baseURL: 'http://192.168.3.126:8081', // 本地测试项目地址,
baseURL: 'http://192.168.1.152/:8080', // 本地开发项目地址,
// baseURL: 'http://192.168.1.158:9996',
// baseURL: 'http://192.168.1.152:8081',
// baseURL: 'http://bi-view.beta.glsx.com.cn',
// 设置超时时间
timeout: 180000,
// 携带凭证
withCredentials: true,
// 返回数据类型
responseType: 'json'
},
response: {
data_key: 'data',
message_key: 'message',
code_key: 'code',
code_success_value: '0',
errId_logout_value: '21',
logout_function: 'reLogin',
code_message_map: {}
},
}
module.exports = {
title: '嘀加智慧门店',
request: {
// baseURL: 'http://ghwx.cgacar.com/scrm-wechat' // 生产
baseURL: 'http://bi-view.beta.glsx.com.cn' // 生产
// baseURL: 'http://cim.chinagrandauto.com' // 生产
},
APPID: 'xxx',
APPSECRET: 'xxx',
cdn: 'https://www.xxx.cn/static'
}
\ No newline at end of file
module.exports = {
title: '嘀加智慧门店',
request: {
baseURL: 'http://xxxxx' // 项目地址
},
APPID: 'xxx',
APPSECRET: 'xxx',
cdn: 'https://www.xxx.cn/static'
}
\ No newline at end of file
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-30 11:23:25
*/
// 根据环境引入不同配置 process.env.VUE_APP_ENV
let config = require('./conf.js')
let timeout = 30000 //超时时间
export const fetchConfig = function (isEnv = true) {
if (isEnv) {
let { request } = config
Object.assign(request, { timeout })
return Promise.resolve(config)
}
/**测试mock */ return window.fetch('https://oss-config.dev.glsx.com.cn/mock/6352681802322627d6b83e8c/dj-data-view/config', {}).then(res => res.json())
// return window.fetch('https://oss-config.test.glsx.com.cn/mock/62cbf569f5137cf37678b828/data-view/config', {}).then(res => res.json())
}
export const cfg = {
install(vue, config) {
vue.prototype.$config = config
}
}
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-26 16:57:27
*/
// 兼容 IE
// https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#babelpolyfill
// import 'core-js/stable'
// import 'regenerator-runtime/runtime'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import api from './api'
import Request from './api/request'
import { fetchConfig, cfg } from '@/config'
import '@/assets/css/index.scss'
import './utils/util'
import 'components'
import * as echarts from 'echarts'
import dialog from './plugins/dialog'
import Bus from '../src/bus' //这是我的路径,正确引用你们的路径
Vue.prototype.$bus = Bus
Vue.prototype.$echarts = echarts
Vue.prototype.to = function (name, params) {
if (name === -1) {
router.go(-1)
return
}
router.push({ name, params })
}
// 移动端适配 rem
// import 'lib-flexible/flexible.js'
Vue.config.productionTip = false
Vue.use(dialog)
const isMock = ['prod', 'production'].includes(process.env.NODE_ENV)
fetchConfig(!isMock).then(res => {
// 从配置服务器获取动态配置
// 设置 js中可以访问 $cdn
Vue.use(cfg)
// if (res.vconsole) new VConsole()
window.$HTTP = new Request(res.request)
// window.$HTTP = new Request()
Vue.prototype.api = api
window.vm = new Vue({
el: '#app',
router,
store,
render: h => h(App)
})
})
export default {
watch: {
watchReportParams: {
immediate: true,
handler(newval) {
this && this.init && this.init(newval)
}
}
},
computed: {
watchReportParams() {
return this.$store.state.app.reportParams
}
}
}
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-27 09:44:37
* @FilePath: \dj-data-view\src\mixins\clientMixin.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
export default {
data() {
return {
areaData: [],
brandData: [],
storeData: []
}
},
methods: {
getClientData() {
console.log(22)
this.api.customer.getEnterpriseDistribution().then(res => {
if (res.code == 0) {
res.data.dataList.forEach(item => {
if (item.queryitem == '区域排名') this.areaData = item.rankDistributions
if (item.queryitem == '品牌分布') this.brandData = item.rankDistributions
if (item.queryitem == '门店类型') this.storeData = item.rankDistributions
this.$bus.$emit('clientData', {
areaData: this.areaData,
brandData: this.brandData,
storeData: this.storeData
})
})
}
})
}
}
}
import changeMixin from './changeMixin'
import clientMixin from './clientMixin'
import salesMixin from './salesMixin'
import userMixin from './userMixin'
export {
changeMixin,
clientMixin,
salesMixin,
userMixin
}
\ No newline at end of file
import { changeMixin } from './index'
export default {
data() {
return {
salesData: [],
brandList: [],
typeRanking: '',
isBrand: false,
brandName: ''
}
},
mixins: [changeMixin],
created() {
// this.getSalesData()
},
methods: {
getSalesData() {
let salesApi = !this.isBrand ? 'getSales' : 'getMerchantSales'
const params = {
req: {
queryItem: this.type,
queryTime: this.getCurrentDate(),
queryType: this.watchReportParams.reportType
}
}
if (this.isBrand) params.req.brandName = this.brandName
this.api.sales[salesApi](params).then(res => {
this.salesData = []
this.typeRanking = ''
this.brandList = []
if (res.data.dataList.length > 0) {
let typeNum = JSON.parse(res.data.dataList[0].typeNum)
Object.keys(typeNum).forEach((item, index) => {
this.salesData.push({
name: item,
value: typeNum[item]
})
})
this.typeRanking = JSON.parse(res.data.dataList[0].typeRanking)
}
})
},
init(newVal) {
this.isBrand = false
if (newVal.brand) {
this.isBrand = true
this.brandName = newVal.brand.name
}
this.getSalesData()
},
pieAction(data) {
this.brandList = []
let array = this.typeRanking && this.typeRanking[data.name]
if (array&&array.length > 0) {
for (let i of array) {
this.brandList.push(i && Object.keys(i)[0])
}
}
}
}
}
export default {
data() {
return {
ageData: [],
priceData: [],
buyCarData: [],
mileageData: []
}
},
methods: {
getDistribution() {
this.api.user.getDistribution().then(res => {
if (res.code == 0) {
res.data.dataList.forEach(item => {
if (item.queryitem == '年龄') this.ageData = item.distribution
if (item.queryitem == '车价') this.priceData = item.distribution
if (item.queryitem == '购车年限') this.buyCarData = item.distribution
if (item.queryitem == '里程') this.mileageData = item.distribution
this.$bus.$emit('userData', {
ageData: this.ageData,
priceData: this.priceData,
buyCarData: this.buyCarData,
mileageData: this.mileageData
})
})
}
})
}
}
}
<template>
<div class="mask" v-if="isShow">
<div class="dialog-wrap">
<div class="dialog">
<div class="dialog-title">
客户价值分析
<div class="close" @click="closeHandle">
<img src="@/assets/images/close.png" />
</div>
</div>
<div class="dialog-content flex">
<div class="content-top axis">
<img src="@/assets/images/axis.png" />
</div>
<div class="content-top bg">
<div class="content-top-title">
<img class="title-icon" src="@/assets/images/title-icon.png" />
<div class="title">客户价值</div>
<img class="title-icon" src="@/assets/images/title-icon.png" />
</div>
<div class="content-info">
重要价值:R高、F高、M高
<br />
重要发展:R高、F低、M高
<br />
重要召回:R低、F高、M高
<br />
重要挽留:R低、F低、M高
<br />
一般价值:R高、F高、M低
<br />
一般发展:R高、F低、M低
<br />
一般召回:R低、F高、M低
<br />
一般挽留:R低、F低、M低
</div>
</div>
<div class="content-bottom bg">
<div class="title">售后客户价值模型</div>
<div>
R=最近一次和上一次到店间隔时间
<br />
F=一年内到店频次
<br />
M=一年内售后工单金额
</div>
</div>
<div class="content-bottom bg">
<div class="title">当前逻辑</div>
<div>
6个月内(高)< R ≤ 超6个月(低) <br />
2次以内(低)≤ F <超2次(高)
<br />
3000元 (低)≤ M <超 3000元(高)
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'my-dialog',
data() {
return {
msg: '',
isShow: true
}
},
methods: {
handleBtn(index) {
if (this.btns[index].onPress) {
this.btns[index].onPress()
}
this.isShow = false
},
closeHandle() {
this.$el.parentElement.removeChild(this.$el)
}
}
}
</script>
<style lang="scss" scoped>
.mask {
width: 100%;
height: 100%;
position: fixed;
z-index: 99;
left: 0px;
top: 0px;
background: rgba(0, 0, 0, 0.8);
}
.dialog-wrap {
width: 61.11vw;
height: 73.29vh;
position: absolute;
z-index: 1;
left: 50%;
top: 50%;
background-image: url('../../assets/images/bg-5.png');
background-repeat: no-repeat;
background-size: 100% 100%;
transform: translate(-50%, -50%);
border-radius: 5px;
padding: 3.9vh 3.67vw;
box-sizing: border-box;
.close {
width: 20px;
height: 20px;
position: absolute;
right: -330px;
top: -5px;
cursor: pointer;
}
.dialog-title {
width: 13.19vw;
height: 4.39vh;
background-image: url('../../assets/images/title-dialog.png');
background-repeat: no-repeat;
background-size: 100% 100%;
text-align: center;
font-size: 20px;
color: #ffffff;
margin: 0 auto;
position: relative;
line-height: 4.39vh;
}
.dialog-content {
flex-wrap: wrap;
justify-content: space-between;
margin-top: 3.5vh;
.axis {
width: 26.88vw;
height: 34.97vh;
margin-right: 1.25vw;
img {
height: 100%;
}
}
.content-top-title {
width: 10vw;
margin: 7px auto;
display: flex;
align-items: center;
height: 2.68vh;
.title-icon {
width: 21px;
height: 7px;
}
.title {
font-weight: 500;
font-size: 16px;
color: #ffffff;
margin: 0 10px;
height: 2.68vh;
line-height: 2.68vh;
}
}
.content-info {
font-weight: 400;
font-size: 14px;
color: #ffffff;
margin: 0 auto;
text-align: center;
}
}
.content-top {
width: 25.14vw;
height: 27.93vh;
margin-bottom: 4.45vh;
}
.content-bottom {
width: 25.14vw;
height: 14.88vh;
font-weight: 400;
font-size: 14px;
color: #ffffff;
padding: 1.2vh 1.39vw;
box-sizing: border-box;
.title {
font-weight: 600;
font-size: 16px;
margin-bottom: 8px;
height: 2.68vh;
}
}
.bg {
background: #090e38;
border: 2px solid #07116f;
box-shadow: inset 0 0 20px 0 #1b008c;
}
}
</style>
\ No newline at end of file
import Dialog from './dialog';
export default {
install(Vue) {
let DialogObj=Vue.extend(Dialog);
Vue.prototype.$Dialog=function () {
// const div = document.createElement('div')
// document.body.appendChild(div)
// let DialogInit = new DialogObj().$mount(div)
let DialogInit=new DialogObj().$mount();
document.body.appendChild(DialogInit.$el);
}
}
}
\ No newline at end of file
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-09 17:11:43
*/
import router from './router'
import { keeps } from './routes'
export const keepAlives = keeps
export default router
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-09 10:59:50
* @LastEditors: limin
* @LastEditTime: 2021-06-29 14:51:39
*/
import Vue from 'vue'
import Router from 'vue-router'
import routes from './routes'
// hack router push callback
const originalPush = Router.prototype.push
Router.prototype.push = function push (location, onResolve, onReject) {
if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
return originalPush.call(this, location).catch(err => err)
}
Vue.use(Router)
const router = createRouter()
function createRouter () {
return new Router({
// mode: 'history', // 如果是 history模式 需要配置vue.config.js publicPath
base: process.env.BASE_URL,
scrollBehavior: function (to, from, savedPosition) {
return savedPosition || { x: 0, y: 0 }
},
routes
})
}
// http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-main/
router.beforeEach((to, from, next) => {
next()
})
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter () {
const newRouter = createRouter()
router.matcher = newRouter.matcher // reset router
}
export default router
\ No newline at end of file
const pages = [
{
name: 'home',
meta: {
isTab: true,
keepAlive: true,
backgroundColor: '#F7F7F7'
},
children: [
]
},
{
name: 'map',
meta: {
keepAlive: true,
backgroundColor: '#F7F7F7'
}
}
]
const keepAlives = []
const setChildren = (e, parent) => {
let arr = []
e.children.map(child => {
const { children, meta } = child
let url = `${parent}/${child.name}`
let name = url.replace(/\//g, '.')
let route = {
path: `/${url}`,
name,
meta: meta || {},
component: resolve => require([`views/${url}.vue`], resolve)
}
if (meta && meta.keepAlive) keepAlives.push(name)
if (children) route.children = setChildren(child, url)
arr.push(route)
})
return arr
}
const getPages = _ => {
let router = {
path: '/',
name: 'home',
redirect: '/home',
component: resolve => require([`views/home.vue`], resolve)
}
router.children = pages.map(e => {
let name = `${e.name}`
let route = {
path: `/${name}`,
name,
meta: e.meta || {},
component: resolve => require([`views/${name}/index.vue`], resolve)
}
if (e.children) route.children = setChildren(e, name)
if (e.meta && e.meta.keepAlive) keepAlives.push(name)
return route
})
return [router]
}
export const keeps = keepAlives
export default getPages()
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-20 12:49:54
* @FilePath: \gh-hall\src\store\getters.js
*/
const getters = {
app: state => state.app
}
export default getters
import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import app from './modules/app'
// import createPersistedState from "vuex-persistedstate"
Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
app
},
getters
// plugins: [createPersistedState({
// //指定存储模式
// storage: window.sessionStorage
// })]
})
export default store
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-07-06 12:02:21
*/
const state = {
reportParams: {
reportType: 0 //月表0,日表1
}
}
const mutations = {
SET_PAGE_META (state, meta) {
state.pageMeta = meta
},
}
const actions = {
// 设置name
setUserInfo ({ commit }, user) {
commit('SET_USER_INFO', user)
},
}
export default {
state,
mutations,
actions
}
/*
* @Description: 公共数据
* @Author: huyue
* @Date: 2022-06-23 17:38:33
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-31 16:36:33
*/
const DefaultData = {
defaultLineHeight: '17.32',
defaultPieHeight: '13.05',
directionTimer: 3000,
delayTimer: 3000
}
const Customer = {
age: {
name: '年龄区间',
value: [
{ name: '未知', value: 0 },
{ name: '18~25', value: 1 },
{ name: '26~30', value: 2 },
{ name: '31~35', value: 3 },
{ name: '36~40', value: 4 },
{ name: '41~45', value: 5 },
{ name: '46~50', value: 6 },
{ name: '50+', value: 7 }
]
},
sex: {
name: '性别',
value: [
{ name: '未知', value: 0 },
{ name: '男', value: 1 },
{ name: '女', value: 2 }
]
},
carPeriod: {
name: '购车年限',
value: [
{ name: '未知', value: 0 },
{ name: '1年内', value: 0 },
{ name: '1年', value: 0 },
{ name: '2年', value: 0 },
{ name: '3年', value: 0 },
{ name: '4年', value: 0 },
{ name: '5年', value: 0 },
{ name: '5年+', value: 0 }
]
},
enterCategory: {
name: '进店类型',
value: [
{ name: '展厅客户', value: 15 },
{ name: '网电客户', value: 16 },
{ name: '其他客户', value: 17 }
]
},
infoFrom: {
name: '信息来源',
value: [
{ name: '自然进店', value: 25 },
{ name: '报纸', value: 26 },
{ name: '电台', value: 27 },
{ name: '网络', value: 28 },
{ name: '朋友介绍', value: 31 },
{ name: '广告牌', value: 32 },
{ name: '车展', value: 35 },
{ name: '其他', value: 36 }
]
},
level: {
name: '客户级别',
value: [
{ name: 'H(一周內)', value: 37 },
{ name: 'A(半个月內)', value: 38 },
{ name: 'B(1个月内)', value: 39 },
{ name: 'C(3个月内)', value: 40 },
{ name: 'N(3个月后 )', value: 41 },
{ name: 'F(战败)', value: 42 },
{ name: 'O(订车)', value: 43 }
]
},
valueType: {
name: '价值类型',
value: [
{ name: '重要价值', value: 1 },
{ name: '重要发展', value: 2 },
{ name: '重要召回', value: 3 },
{ name: '重要挽留', value: 4 },
{ name: '一般价值', value: 5 },
{ name: '一般发展', value: 6 },
{ name: '一般召回', value: 7 },
{ name: '一般挽留', value: 8 }
]
}
}
export default Object.freeze({
DefaultData,
Customer
})
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-20 12:49:11
*/
import util from './util'
export { util }
\ No newline at end of file
import Vue from 'vue'
import { Toast, Dialog } from 'vant'
/**
* 日期格式化
* let time = new Date().format('yyyy-MM-dd hh:mm:ss')
*/
Date.prototype.format = function (fmt) {
let o = {
'M+': this.getMonth() + 1, //月份
'd+': this.getDate(), //日
'h+': this.getHours(), //小时
'm+': this.getMinutes(), //分
's+': this.getSeconds(), //秒
//季度
'q+': Math.floor((this.getMonth() + 3) / 3),
S: this.getMilliseconds() //毫秒
}
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) {
fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
}
}
return fmt
}
const throttle = (fn, gapTime) => {
if (gapTime == null || gapTime == undefined) {
gapTime = 1500
}
let _lastTime = null
return function () {
let _nowTime = +new Date()
if (_nowTime - _lastTime > gapTime || !_lastTime) {
fn.apply(this, arguments)
_lastTime = _nowTime
}
}
}
/**num:要转换的数值,fixed:精确几位小数 */
const decimal = (num, fixed) => {
let pow = Math.pow(10, fixed)
return Math.round(num * pow) / pow
}
const toTop = () => {
let bodySrcollTop = document.body.scrollTop
if (bodySrcollTop !== 0) {
document.body.scrollTop = 0
return
}
let docSrcollTop = document.documentElement.scrollTop
if (docSrcollTop !== 0) {
document.documentElement.scrollTop = 0
}
}
const getParams = () => {
return window.vm.$route.params
}
const getQuery = name => {
let [url, paramsList] = window.location.href.split('?')
if (!paramsList) return name ? null : {}
let param = paramsList.split('&')
let obj = {}
param.map(e => {
let [key, value] = e.split('=')
obj[key] = value
})
return name ? obj[name] : obj
}
/** 三个数字加一个逗号 */
const numAddSymbol = val => {
return val ? (val + '').replace(/\B(?=(?:\d{3})+\b)/g, ',') : 0
}
// 获取当前时间
const getCurrentDate = (fmt = 'yyyy-MM-dd') => {
return new Date().format(fmt)
}
/** 获取前/后n天
* 负数:今天前n天
* 正数:今天后n天
*/
const getNDate = (n, fmt = 'yyyy-MM-dd') => {
return new Date(new Date().setDate(new Date().getDate() + n)).format(fmt)
}
/** 获取前/后n月
* 负数:今天前n月
* 正数:今天后n月
*/
const getNMonth = (n, fmt = 'yyyy-MM-dd') => {
return new Date(new Date().setMonth(new Date().getMonth() + n)).format(fmt)
}
const debounce = function (func, wait = 200) {
let timeout
return function (event) {
clearTimeout(timeout)
timeout = setTimeout(() => {
func.call(this, event)
}, wait)
}
}
const setChartFontSize = fontSize => {
let clientWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
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,
throttle,
decimal,
toTop,
numAddSymbol,
getCurrentDate,
getNDate,
getNMonth,
debounce,
setChartFontSize,
deepClone
}
Object.keys(utils).map(key => {
Vue.prototype[key] = utils[key]
})
export default utils
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-26 17:13:06
* @FilePath: \dj-data-view\src\views\customer\area.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>区域分布</span>
</div>
<div class="container flex">
<pie-chart :id="chart.id" :list="areaData" :keys="chart.keys"></pie-chart>
<Legend :list="areaData"></Legend>
</div>
</div>
</template>
<script>
export default {
name: 'Area',
data() {
return {
chart: {
id: 'area',
keys: ['name', 'num']
},
areaData: []
}
},
created() {
this.$bus.$on('clientData', data => {
this.areaData = data.areaData
})
}
}
</script>
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>品牌分布</span>
</div>
<div class="container flex">
<pie-chart :id="chart.id" :list="brandData" :keys="chart.keys"></pie-chart>
<Legend :list="brandData"></Legend>
</div>
</div>
</template>
<script>
export default {
name: 'Brand',
data() {
return {
type: 'gender',
chart: {
id: 'brand',
keys: ['name', 'num']
},
brandData: []
}
},
created() {
this.$bus.$on('clientData', data => {
this.brandData = data.brandData
})
}
}
</script>
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>门店类型</span>
</div>
<div class="container flex">
<pie-chart :id="chart.id" :list="storeData" :keys="chart.keys"></pie-chart>
<Legend :list="storeData" :colors="chart.colors"></Legend>
</div>
</div>
</template>
<script>
export default {
name: 'Store',
data() {
return {
chart: {
id: 'store',
keys: ['name', 'num'],
colors: ['#4FA0FF', '#7CFFB2', '#FDF006', '#EB6001']
},
storeData: []
}
},
created() {
this.$bus.$on('clientData', data => {
this.storeData = data.storeData
})
}
}
</script>
<!-- home -->
<template>
<div class="data-view-container">
<transition name="fade">
<keep-alive v-if="$route.meta.keepAlive">
<router-view></router-view>
</keep-alive>
</transition>
<transition name="fade">
<router-view v-if="!$route.meta.keepAlive"></router-view>
</transition>
</div>
</template>
<script>
export default {
data () {
return {
}
},
mounted () { },
methods: {}
}
</script>
<style lang="scss" scoped>
.data-view-container{
background: #090E2B;
}
</style>
<template>
<div class="layout">
<view-container>
<template #title>
<view-title>
</view-title>
</template>
<template #content>
<view-content></view-content>
</template>
</view-container>
</div>
</template>
<script>
export default {
name: '',
data () {
return {}
},
mounted () { },
methods: {
}
}
</script>
<style lang="scss" scoped>
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!