fix
This commit is contained in:
parent
85cac37bda
commit
64701c2ab2
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="staff-archives-charts">
|
<div class="staff-archives-charts" >
|
||||||
<div class="staff-archives-title">{{title}}</div>
|
<div class="staff-archives-title">{{title}}</div>
|
||||||
<div :id="aId" :data="dataInfo" class="chart-box" style="height: 300px"></div>
|
<div :id="aId" :data="dataInfo" class="chart-box" style="height: 300px" @click="jump"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -25,17 +25,25 @@
|
|||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
clickAble: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.initChartBar()
|
this.initChartBar()
|
||||||
},
|
},
|
||||||
watch: { // 监听到数据然后赋值
|
watch: {
|
||||||
dataInfo () {
|
dataInfo () {
|
||||||
this.initChartBar()
|
this.initChartBar()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
jump: function (e) {
|
||||||
|
if (this.clickAble) {
|
||||||
|
console.log('跳转')
|
||||||
|
} else {
|
||||||
|
this.clickAble = true
|
||||||
|
}
|
||||||
|
},
|
||||||
initChartBar () {
|
initChartBar () {
|
||||||
var staffTotal = this.dataInfo.total
|
var staffTotal = this.dataInfo.total
|
||||||
var option = {
|
var option = {
|
||||||
@ -56,9 +64,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 图例
|
// 图例
|
||||||
legend: {
|
/* legend: {
|
||||||
data: ['人数']
|
data: ['人数']
|
||||||
},
|
}, */
|
||||||
// x轴
|
// x轴
|
||||||
xAxis: {
|
xAxis: {
|
||||||
name: '等级',
|
name: '等级',
|
||||||
@ -95,6 +103,10 @@
|
|||||||
var echarts = require('echarts')
|
var echarts = require('echarts')
|
||||||
this.chartBar = echarts.init(document.getElementById(this.aId))
|
this.chartBar = echarts.init(document.getElementById(this.aId))
|
||||||
this.chartBar.setOption(option)
|
this.chartBar.setOption(option)
|
||||||
|
this.chartBar.on('click', function (param) {
|
||||||
|
this.clickAble = false
|
||||||
|
console.log(param)
|
||||||
|
}.bind(this))
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
this.chartBar.resize()
|
this.chartBar.resize()
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,115 +0,0 @@
|
|||||||
<!-- -->
|
|
||||||
<template>
|
|
||||||
<div class="result-own-charts">
|
|
||||||
<el-row :gutter="20">
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-card>
|
|
||||||
<div id="J_chartLineBox" class="chart-box"></div>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import echarts from 'echarts'
|
|
||||||
export default {
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
chartLine: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted () {
|
|
||||||
this.initChartLine()
|
|
||||||
},
|
|
||||||
activated () {
|
|
||||||
// 由于给echart添加了resize事件, 在组件激活时需要重新resize绘画一次, 否则出现空白bug
|
|
||||||
if (this.chartLine) {
|
|
||||||
this.chartLine.resize()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 折线图
|
|
||||||
initChartLine () {
|
|
||||||
var option = {
|
|
||||||
'title': {
|
|
||||||
'text': '成长曲线分析'
|
|
||||||
},
|
|
||||||
'tooltip': {
|
|
||||||
'trigger': 'axis'
|
|
||||||
},
|
|
||||||
'legend': {
|
|
||||||
'data': [ '邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎' ]
|
|
||||||
},
|
|
||||||
'grid': {
|
|
||||||
'left': '3%',
|
|
||||||
'right': '4%',
|
|
||||||
'bottom': '3%',
|
|
||||||
'containLabel': true
|
|
||||||
},
|
|
||||||
'toolbox': {
|
|
||||||
'feature': {
|
|
||||||
'saveAsImage': { }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'xAxis': {
|
|
||||||
'type': 'category',
|
|
||||||
'boundaryGap': false,
|
|
||||||
'data': [ '周一', '周二', '周三', '周四', '周五', '周六', '周日' ]
|
|
||||||
},
|
|
||||||
'yAxis': {
|
|
||||||
'type': 'value'
|
|
||||||
},
|
|
||||||
'series': [
|
|
||||||
{
|
|
||||||
'name': '邮件营销',
|
|
||||||
'type': 'line',
|
|
||||||
'data': [ 120, 132, 101, 134, 90, 230, 210 ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': '联盟广告',
|
|
||||||
'type': 'line',
|
|
||||||
'data': [ 220, 182, 191, 234, 290, 330, 310 ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': '视频广告',
|
|
||||||
'type': 'line',
|
|
||||||
'data': [ 150, 232, 201, 154, 190, 330, 410 ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': '直接访问',
|
|
||||||
'type': 'line',
|
|
||||||
'data': [ 320, 332, 301, 334, 390, 330, 320 ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': '搜索引擎',
|
|
||||||
'type': 'line',
|
|
||||||
'data': [ 820, 10, 901, 934, 1290, 1330, 1320 ]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
this.chartLine = echarts.init(document.getElementById('J_chartLineBox'))
|
|
||||||
this.chartLine.setOption(option)
|
|
||||||
window.addEventListener('resize', () => {
|
|
||||||
this.chartLine.resize()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
|
||||||
.result-own-charts {
|
|
||||||
> .el-row {
|
|
||||||
margin-top: -10px;
|
|
||||||
margin-bottom: -10px;
|
|
||||||
.el-col {
|
|
||||||
padding-top: 10px;
|
|
||||||
padding-bottom: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.chart-box {
|
|
||||||
min-height: 400px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,170 +0,0 @@
|
|||||||
<!-- -->
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<div class="staff-archives-title">条件筛选</div>
|
|
||||||
<el-form :inline="true" :model="formInline" class="demo-form-inline staff-archives-form">
|
|
||||||
<el-form-item label="选择部门">
|
|
||||||
<el-input
|
|
||||||
placeholder="请选择部门"
|
|
||||||
@focus="isChoose=true"
|
|
||||||
readonly
|
|
||||||
:value="formInline.departmentName"
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item :label="`选择时间段`">
|
|
||||||
<el-date-picker
|
|
||||||
v-model="formInline.value"
|
|
||||||
type="daterange"
|
|
||||||
align="right"
|
|
||||||
value-format="yyyy-MM-dd"
|
|
||||||
range-separator="至"
|
|
||||||
start-placeholder="开始日期"
|
|
||||||
end-placeholder="结束日期"
|
|
||||||
@change="changeData"
|
|
||||||
></el-date-picker>
|
|
||||||
<div>
|
|
||||||
<el-button
|
|
||||||
v-for="i in Datalist"
|
|
||||||
:key="i.Month"
|
|
||||||
:type="index==i.Month?'primary':'info'"
|
|
||||||
size="mini"
|
|
||||||
@click="handleChangeData(i)"
|
|
||||||
>{{i.title}}</el-button>
|
|
||||||
</div>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" @click="onSubmit">查询</el-button>
|
|
||||||
<el-button type="primary" @click="restValue">重置</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
<el-dialog title="选择部门" :visible.sync="isChoose" width="30%">
|
|
||||||
<el-tree :data="menuList" :props="defaultProps" @node-click="handleNodeClick">
|
|
||||||
<span class="custom-tree-node" slot-scope="{ node, data }">
|
|
||||||
<span>{{ data.departmentName }}</span>
|
|
||||||
<span>({{ data.memberCount }})人</span>
|
|
||||||
</span>
|
|
||||||
</el-tree>
|
|
||||||
<span slot="footer" class="dialog-footer">
|
|
||||||
<el-button size="mini" @click="isChoose = false">取 消</el-button>
|
|
||||||
<el-button type="primary" size="mini" @click="onsumbit">确 定</el-button>
|
|
||||||
</span>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { apiOrganizationList } from '@/api/api_staff'
|
|
||||||
import { getDataForMonth } from '@/utils'
|
|
||||||
export default {
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
Datalist: [{
|
|
||||||
Month: 6,
|
|
||||||
title: '近六个月'
|
|
||||||
}, {
|
|
||||||
Month: 12,
|
|
||||||
title: '近一年'
|
|
||||||
}],
|
|
||||||
index: null,
|
|
||||||
title: null,
|
|
||||||
value2: [],
|
|
||||||
isChooseObj: {},
|
|
||||||
isChoose: false,
|
|
||||||
menuList: [],
|
|
||||||
defaultProps: {
|
|
||||||
children: 'list',
|
|
||||||
label: 'name'
|
|
||||||
},
|
|
||||||
formInline: {
|
|
||||||
value: []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {},
|
|
||||||
beforeMount () { },
|
|
||||||
created () {
|
|
||||||
this.handleGetMenuList()
|
|
||||||
this.handleChangeData({
|
|
||||||
Month: 3,
|
|
||||||
title: '近三个月'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
mounted () { },
|
|
||||||
methods: {
|
|
||||||
async handleChangeData (data) {
|
|
||||||
this.index = data.Month
|
|
||||||
this.title = data.title
|
|
||||||
let dataList = getDataForMonth(data.Month)
|
|
||||||
this.formInline.value = dataList
|
|
||||||
this.formInline.beginDate = dataList[0]
|
|
||||||
this.formInline.endDate = dataList[1]
|
|
||||||
this.onSubmit()
|
|
||||||
},
|
|
||||||
changeData (data) {
|
|
||||||
this.index = null
|
|
||||||
this.title = null
|
|
||||||
this.formInline.beginDate = data[0]
|
|
||||||
this.formInline.endDate = data[1]
|
|
||||||
},
|
|
||||||
// 获取侧边架构列表
|
|
||||||
async handleGetMenuList () {
|
|
||||||
let result = await apiOrganizationList()
|
|
||||||
this.menuList = result
|
|
||||||
},
|
|
||||||
onSubmit () {
|
|
||||||
let obj = {
|
|
||||||
departmentId: this.formInline.departmentId,
|
|
||||||
beginDate: this.formInline.beginDate,
|
|
||||||
endDate: this.formInline.endDate
|
|
||||||
}
|
|
||||||
let monthLetter = {
|
|
||||||
index: this.index,
|
|
||||||
title: this.title
|
|
||||||
}
|
|
||||||
this.$emit('submit', obj, monthLetter)
|
|
||||||
},
|
|
||||||
restValue () {
|
|
||||||
this.formInline = {}
|
|
||||||
this.index = null
|
|
||||||
this.title = null
|
|
||||||
},
|
|
||||||
onsumbit () {
|
|
||||||
this.formInline = Object.assign({}, this.formInline, this.isChooseObj)
|
|
||||||
this.isChoose = false
|
|
||||||
},
|
|
||||||
handleNodeClick (a, b) {
|
|
||||||
this.isChooseObj = {
|
|
||||||
departmentId: a.departmentId,
|
|
||||||
departmentName: a.departmentName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {}
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang='scss'>
|
|
||||||
.el-range-separator {
|
|
||||||
width: 7% !important;
|
|
||||||
}
|
|
||||||
.el-input__icon {
|
|
||||||
transition: all 0.5s;
|
|
||||||
}
|
|
||||||
.staff-archives-choose {
|
|
||||||
margin: 2px;
|
|
||||||
height: 200px;
|
|
||||||
overflow: auto;
|
|
||||||
transition: all 0.3s;
|
|
||||||
position: relative;
|
|
||||||
border: 1px solid #dcdfe6;
|
|
||||||
}
|
|
||||||
.staff-archives-choose1 {
|
|
||||||
height: 0px;
|
|
||||||
opacity: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,90 +0,0 @@
|
|||||||
<!-- -->
|
|
||||||
<template>
|
|
||||||
<div class="report-archives">
|
|
||||||
<el-main :loding="true">
|
|
||||||
<el-card>
|
|
||||||
<query-form @submit="submit" />
|
|
||||||
</el-card>
|
|
||||||
<div class="result-own-charts">
|
|
||||||
<el-card v-if="dataInfo.genderDistribution">
|
|
||||||
<chart-form :dataInfo="dataInfo.genderDistribution" title="成长曲线分析" />
|
|
||||||
</el-card>
|
|
||||||
</div>
|
|
||||||
</el-main>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import chartForm from './componments/chart-form'
|
|
||||||
import queryForm from './componments/query-form'
|
|
||||||
|
|
||||||
import { apiEmployeessItuation } from '@/api/api_staff'
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
chartForm,
|
|
||||||
queryForm
|
|
||||||
},
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
monthLetter: {},
|
|
||||||
dataInfo: {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {},
|
|
||||||
beforeMount () { },
|
|
||||||
mounted () {
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
async handleGetEmployeessItuation (data = {}) {
|
|
||||||
const loading = this.$loading({
|
|
||||||
lock: true,
|
|
||||||
text: 'Loading',
|
|
||||||
spinner: 'el-icon-loading',
|
|
||||||
background: 'rgba(0, 0, 0, 0.7)'
|
|
||||||
})
|
|
||||||
let result = await apiEmployeessItuation(data)
|
|
||||||
setTimeout(() => {
|
|
||||||
loading.close()
|
|
||||||
}, 500)
|
|
||||||
if (result.code === 0) {
|
|
||||||
this.dataInfo = result.data
|
|
||||||
} else {
|
|
||||||
this.$message.error(result.mgs)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
submit (data, monthLetter) {
|
|
||||||
this.monthLetter = monthLetter
|
|
||||||
this.handleGetEmployeessItuation(data)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {}
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style >
|
|
||||||
.el-card {
|
|
||||||
margin: 0 0 7px 0 !important;
|
|
||||||
}
|
|
||||||
.report-archives {
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.staff-archives-title {
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
.staff-archives-form {
|
|
||||||
margin: 20px 0 0 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<style lang="scss">
|
|
||||||
.result-own-charts {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: space-between;
|
|
||||||
> div {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
Loading…
x
Reference in New Issue
Block a user