Commit ed80ed39 by Sendya

1. fixed analysis

2. updated radar
parent de0e1421
...@@ -11,40 +11,6 @@ ...@@ -11,40 +11,6 @@
</template> </template>
<script> <script>
const DataSet = require('@antv/data-set')
const sourceData = [
{item: '引用', a: 70, b: 30, c: 40},
{item: '口碑', a: 60, b: 70, c: 40},
{item: '产量', a: 50, b: 60, c: 40},
{item: '贡献', a: 40, b: 50, c: 40},
{item: '热度', a: 60, b: 70, c: 40},
{item: '引用', a: 70, b: 50, c: 40}
]
const dv = new DataSet.View().source(sourceData)
dv.transform({
type: 'fold',
fields: ['a', 'b', 'c'],
key: 'user',
value: 'score'
})
const scale = [
{
dataKey: 'score',
min: 0,
max: 80
},/* {
dataKey: 'user',
type: 'cat',
values: ['个人', '团队', '部门'],
alias: '类型'
}*/
]
const data = dv.rows
const axis1Opts = { const axis1Opts = {
dataKey: 'item', dataKey: 'item',
line: null, line: null,
...@@ -68,12 +34,22 @@ ...@@ -68,12 +34,22 @@
} }
} }
const scale = [
{
dataKey: 'score',
min: 0,
max: 80
}, {
dataKey: 'user',
alias: '类型'
}
]
export default { export default {
name: 'Radar', name: 'Radar',
props: ['data'],
data () { data () {
return { return {
sourceData,
data,
axis1Opts, axis1Opts,
axis2Opts, axis2Opts,
scale scale
......
<template>
<div :style="{ padding: '0 0 32px 32px' }">
<h4 :style="{ marginBottom: '20px' }">{{ title }}</h4>
<v-chart
height="254"
:data="data"
:scale="scale"
:forceFit="true"
:padding="['auto', 'auto', '40', '50']">
<v-tooltip />
<v-axis />
<v-bar position="x*y"/>
</v-chart>
</div>
</template>
<script>
const tooltip = [
'x*y',
(x, y) => ({
name: x,
value: y
})
]
const scale = [{
dataKey: 'x',
title: '日期(天)',
alias: '日期(天)',
min: 2
}, {
dataKey: 'y',
title: '流量(Gb)',
alias: '流量(Gb)',
min: 1
}]
export default {
name: "Bar",
props: ['title'],
data () {
return {
data: [],
scale,
tooltip
}
},
created () {
this.getMonthBar()
},
methods: {
getMonthBar() {
this.$http.get('/analysis/month-bar')
.then(res => {
this.data = res.result
})
}
}
}
</script>
\ No newline at end of file
...@@ -28,15 +28,14 @@ export const constantRouterMap = [ ...@@ -28,15 +28,14 @@ export const constantRouterMap = [
}, },
{ {
path: '/404', path: '/404',
component: () => import('../views/404') component: () => import(/* webpackChunkName: "fail" */ '../views/exception/404')
}, },
{ {
path: '/', path: '/',
component: Layout, component: Layout,
redirect: '/login', redirect: '/login',
name: '首页', name: '首页',
hidden: true, hidden: true
children: []
} }
] ]
...@@ -235,9 +234,14 @@ export const asyncRouterMap = [ ...@@ -235,9 +234,14 @@ export const asyncRouterMap = [
] ]
}, },
{ {
path: '/my', path: '/settings',
component: () => import('../views/user/Index'), component: () => import('../views/user/Index'),
name: 'my', name: 'settings',
hidden: true,
meta: { title: '用户设置', icon: 'profile' } meta: { title: '用户设置', icon: 'profile' }
},
{
path: '*', redirect: '/404', hidden: true
} }
] ]
\ No newline at end of file
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
<a-tab-pane loading="true" tab="销售额" key="1"> <a-tab-pane loading="true" tab="销售额" key="1">
<a-row> <a-row>
<a-col :xl="16" :lg="12" :md="12" :sm="24" :xs="24"> <a-col :xl="16" :lg="12" :md="12" :sm="24" :xs="24">
<bar title="销售额趋势" /> <bar title="销售额排行" />
</a-col> </a-col>
<a-col :xl="8" :lg="12" :md="12" :sm="24" :xs="24"> <a-col :xl="8" :lg="12" :md="12" :sm="24" :xs="24">
<rank-list title="门店销售排行榜" :list="rankList"/> <rank-list title="门店销售排行榜" :list="rankList"/>
......
...@@ -27,11 +27,14 @@ ...@@ -27,11 +27,14 @@
<div> <div>
<a-card-grid :key="i" v-for="(item, i) in projects"> <a-card-grid :key="i" v-for="(item, i) in projects">
<a-card :bordered="false" :body-style="{ padding: 0 }"> <a-card :bordered="false" :body-style="{ padding: 0 }">
<a-card-meta :description="item.description"> <a-card-meta>
<div slot="title" class="card-title"> <div slot="title" class="card-title">
<a-avatar size="small" :src="item.cover"/> <a-avatar size="small" :src="item.cover"/>
<a>{{ item.title }}</a> <a>{{ item.title }}</a>
</div> </div>
<div slot="description" class="card-description">
{{ item.description }}
</div>
</a-card-meta> </a-card-meta>
<div class="project-item"> <div class="project-item">
<a href="/#/">科学搬砖组</a> <a href="/#/">科学搬砖组</a>
...@@ -71,9 +74,10 @@ ...@@ -71,9 +74,10 @@
<a-button size="small" type="primary" ghost icon="plus">添加</a-button> <a-button size="small" type="primary" ghost icon="plus">添加</a-button>
</div> </div>
</a-card> </a-card>
<a-card title="XX 指数" style="margin-bottom: 24px" :loading="loading" :bordered="false" :body-style="{ padding: 0 }"> <a-card title="XX 指数" style="margin-bottom: 24px" :loading="radarLoading" :bordered="false" :body-style="{ padding: 0 }">
<div style="min-height: 400px;"> <div style="min-height: 400px;">
<radar :data="axisData" :scale="scale" :axis1Opts="axis1Opts" :axis2Opts="axis2Opts" /> <!-- :scale="scale" :axis1Opts="axis1Opts" :axis2Opts="axis2Opts" -->
<radar :data="radarData" />
</div> </div>
</a-card> </a-card>
<a-card :loading="loading" title="团队" :bordered="false"> <a-card :loading="loading" title="团队" :bordered="false">
...@@ -200,16 +204,22 @@ ...@@ -200,16 +204,22 @@
}) })
}, },
initRadar() { initRadar() {
const dv = new DataSet.View().source(this.axisData) this.radarLoading = true
this.$http.get('/workplace/radar')
.then(res => {
dv.transform({ const dv = new DataSet.View().source(res.result)
type: 'flod', dv.transform({
fields: ['a', 'b', 'c'], type: 'fold',
key: 'user', fields: ['个人', '团队', '部门'],
value: 'score' key: 'user',
}) value: 'score'
})
this.radarData = dv.rows this.radarData = dv.rows
this.radarLoading = false
})
} }
} }
} }
...@@ -217,6 +227,7 @@ ...@@ -217,6 +227,7 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.project-list { .project-list {
.card-title { .card-title {
font-size: 0; font-size: 0;
...@@ -234,6 +245,12 @@ ...@@ -234,6 +245,12 @@
} }
} }
} }
.card-description {
color: rgba(0, 0, 0, 0.45);
height: 44px;
line-height: 22px;
overflow: hidden;
}
.project-item { .project-item {
display: flex; display: flex;
margin-top: 8px; margin-top: 8px;
...@@ -256,12 +273,7 @@ ...@@ -256,12 +273,7 @@
float: right; float: right;
} }
} }
.ant-card-meta-description {
color: rgba(0, 0, 0, 0.45);
height: 44px;
line-height: 22px;
overflow: hidden;
}
} }
.item-group { .item-group {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment