Commit ed80ed39 by Sendya

1. fixed analysis

2. updated radar
parent de0e1421
......@@ -11,40 +11,6 @@
</template>
<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 = {
dataKey: 'item',
line: null,
......@@ -68,12 +34,22 @@
}
}
const scale = [
{
dataKey: 'score',
min: 0,
max: 80
}, {
dataKey: 'user',
alias: '类型'
}
]
export default {
name: 'Radar',
props: ['data'],
data () {
return {
sourceData,
data,
axis1Opts,
axis2Opts,
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 = [
},
{
path: '/404',
component: () => import('../views/404')
component: () => import(/* webpackChunkName: "fail" */ '../views/exception/404')
},
{
path: '/',
component: Layout,
redirect: '/login',
name: '首页',
hidden: true,
children: []
hidden: true
}
]
......@@ -235,9 +234,14 @@ export const asyncRouterMap = [
]
},
{
path: '/my',
path: '/settings',
component: () => import('../views/user/Index'),
name: 'my',
name: 'settings',
hidden: true,
meta: { title: '用户设置', icon: 'profile' }
},
{
path: '*', redirect: '/404', hidden: true
}
]
\ No newline at end of file
......@@ -89,7 +89,7 @@
<a-tab-pane loading="true" tab="销售额" key="1">
<a-row>
<a-col :xl="16" :lg="12" :md="12" :sm="24" :xs="24">
<bar title="销售额趋势" />
<bar title="销售额排行" />
</a-col>
<a-col :xl="8" :lg="12" :md="12" :sm="24" :xs="24">
<rank-list title="门店销售排行榜" :list="rankList"/>
......
......@@ -27,11 +27,14 @@
<div>
<a-card-grid :key="i" v-for="(item, i) in projects">
<a-card :bordered="false" :body-style="{ padding: 0 }">
<a-card-meta :description="item.description">
<a-card-meta>
<div slot="title" class="card-title">
<a-avatar size="small" :src="item.cover"/>
<a>{{ item.title }}</a>
</div>
<div slot="description" class="card-description">
{{ item.description }}
</div>
</a-card-meta>
<div class="project-item">
<a href="/#/">科学搬砖组</a>
......@@ -71,9 +74,10 @@
<a-button size="small" type="primary" ghost icon="plus">添加</a-button>
</div>
</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;">
<radar :data="axisData" :scale="scale" :axis1Opts="axis1Opts" :axis2Opts="axis2Opts" />
<!-- :scale="scale" :axis1Opts="axis1Opts" :axis2Opts="axis2Opts" -->
<radar :data="radarData" />
</div>
</a-card>
<a-card :loading="loading" title="团队" :bordered="false">
......@@ -200,16 +204,22 @@
})
},
initRadar() {
const dv = new DataSet.View().source(this.axisData)
this.radarLoading = true
this.$http.get('/workplace/radar')
.then(res => {
dv.transform({
type: 'flod',
fields: ['a', 'b', 'c'],
key: 'user',
value: 'score'
})
const dv = new DataSet.View().source(res.result)
dv.transform({
type: 'fold',
fields: ['个人', '团队', '部门'],
key: 'user',
value: 'score'
})
this.radarData = dv.rows
this.radarData = dv.rows
this.radarLoading = false
})
}
}
}
......@@ -217,6 +227,7 @@
<style lang="scss" scoped>
.project-list {
.card-title {
font-size: 0;
......@@ -234,6 +245,12 @@
}
}
}
.card-description {
color: rgba(0, 0, 0, 0.45);
height: 44px;
line-height: 22px;
overflow: hidden;
}
.project-item {
display: flex;
margin-top: 8px;
......@@ -256,12 +273,7 @@
float: right;
}
}
.ant-card-meta-description {
color: rgba(0, 0, 0, 0.45);
height: 44px;
line-height: 22px;
overflow: hidden;
}
}
.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