This commit is contained in:
杜建超 2020-09-14 17:42:09 +08:00
parent 8fed6dedb7
commit 0084219f25
12 changed files with 715 additions and 80 deletions

View File

@ -63,9 +63,9 @@ const webpackConfig = merge(baseWebpackConfig, {
// see https://github.com/ampedandwired/html-webpack-plugin // see https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
filename: process.env.NODE_ENV === 'testing' filename: process.env.NODE_ENV === 'testing'
? 'index.html' ? 'own.vue.html'
: config.build.index, : config.build.index,
template: 'index.html', template: 'own.vue.html',
inject: true, inject: true,
minify: { minify: {
removeComments: true, removeComments: true,

View File

@ -46,7 +46,7 @@ gulp.task('replace:version', ['create:versionCatalog'], function () {
// 合并${versionPath}/static/config/[index-${env}, init].js 至 ${distPath}/config/index.js // 合并${versionPath}/static/config/[index-${env}, init].js 至 ${distPath}/config/index.js
gulp.task('concat:config', ['replace:version'], function () { gulp.task('concat:config', ['replace:version'], function () {
return gulp.src([`${versionPath}/static/config/index-${env}.js`, `${versionPath}/static/config/init.js`]) return gulp.src([`${versionPath}/static/config/index-${env}.js`, `${versionPath}/static/config/init.js`])
.pipe($.concat('index.js')) .pipe($.concat('own.vue.js'))
.pipe(gulp.dest(`${distPath}/config/`)) .pipe(gulp.dest(`${distPath}/config/`))
}); });

View File

@ -0,0 +1,93 @@
<!-- -->
<template>
<div class="staff-archives-charts">
<div class="staff-archives-title">{{title}}</div>
<div>
<ve-ring
height="300px"
:data="dataInfo"
:extend="color.length>0?Object.assign({},chartExtend,{color}):chartExtend"
:settings="chartSettings"
></ve-ring>
</div>
</div>
</template>
<script>
export default {
props: {
dataInfo: {
type: Object,
default: () => {
return {}
}
},
title: {
type: String,
default: () => '分布'
},
color: {
type: Array,
default: () => []
}
},
data () {
return {
chartExtend: {
legend: {
x: 'center',
y: '80%',
show: true
},
series: {
center: ['50%', '40%'],
itemStyle: {
borderWidth: 2, // border
borderColor: '#fff'
}
}
},
chartData: {
columns: ['分类', '数量', '占比'],
rows: [
{ '分类': '0-3年', '数量': '50', '占比': '10%' },
{ '分类': '3-5年', '数量': '80', '占比': '10%' },
{ '分类': '5-8年', '数量': '58', '占比': '10%' },
{ '分类': '8-10年', '数量': '58', '占比': '10%' }
]
},
chartSettings: {
radius: ['60px', '80px'],
itemStyle: {
textAlign: 'center'
},
label: {
formatter: params => {
return `{a|${params.data.name}\n${params.data.value}人}`
},
rich: {
a: {
color: '#ccc',
textAlign: 'center'
}
}
}
}
}
},
computed: {},
beforeMount () { },
mounted () { },
methods: {},
watch: {}
}
</script>
<style lang='scss' scoped>
.staff-archives-charts {
// width: 50%;
}
</style>

View File

@ -0,0 +1,141 @@
<!-- -->
<template>
<div>
<div class="staff-archives-title">条件筛选</div>
<el-form :inline="true" class="demo-form-inline staff-archives-form">
<el-form-item :label="`选择月份`">
<el-date-picker
type="month"
placeholder="选择月份"
v-model="applyMonth"
@change="changeApplyMonth"
>
</el-date-picker>
</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>
</div>
</template>
<script>
import { apiOrganizationList } from '@/api/api_staff'
import { getDataForMonth } from '@/utils'
export default {
data () {
return {
applyMonth: '',
defaultVal: '',
defaultValYear: '',
defaultValMon: '',
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
},
//
changeApplyMonth (val) {
this.defaultVal = val.getFullYear() + '-' + (val.getMonth() + 1) + '-' + '1'
this.defaultValYear = val.getFullYear()
this.defaultValMon = val.getMonth() + 1
console.log(this.defaultVal)
},
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>

View File

@ -0,0 +1,99 @@
<!-- -->
<template>
<div class="staff-archives">
<el-main :loding="true">
<el-card>
<query-form @submit="submit" />
</el-card>
<div class="staff-archives-chart">
<el-card v-if="dataInfo.genderDistribution">
<chart-form :dataInfo="dataInfo.genderDistribution" title="月初目标" />
</el-card>
<el-card v-if="dataInfo.ageDistribution">
<chart-form :dataInfo="dataInfo.ageDistribution" title="月末结果" />
</el-card>
<el-card v-if="dataInfo.jobSeniorityDistribution">
<chart-form :dataInfo="dataInfo.jobSeniorityDistribution" title="月末人员等级" />
</el-card>
<el-card v-if="dataInfo.educationDistribution">
<chart-form :dataInfo="dataInfo.educationDistribution" 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;
}
.staff-archives {
overflow: hidden;
}
.staff-archives-title {
font-size: 18px;
font-weight: 700;
}
.staff-archives-form {
margin: 20px 0 0 0;
}
</style>
<style lang="scss">
.staff-archives-chart {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
> div {
width: 49.6%;
}
}
</style>

View File

@ -18,7 +18,7 @@
<el-button <el-button
v-for="i in Datalist" v-for="i in Datalist"
:key="i.Month" :key="i.Month"
:type="index==i.Month?'primary':'info'" :type="own==i.Month?'primary':'info'"
size="mini" size="mini"
@click="handleChangeData(i)" @click="handleChangeData(i)"
>{{ i.title }} >{{ i.title }}

View File

@ -56,7 +56,7 @@
<el-button <el-button
v-for="i in Datalist" v-for="i in Datalist"
:key="i.Month" :key="i.Month"
:type="index==i.Month?'primary':'info'" :type="own==i.Month?'primary':'info'"
size="mini" size="mini"
@click="handleChangeData(i)" @click="handleChangeData(i)"
>{{ i.title }} >{{ i.title }}

View File

@ -0,0 +1,115 @@
<!-- -->
<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 () {
// echartresize, 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>

View File

@ -0,0 +1,170 @@
<!-- -->
<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>

View File

@ -1,73 +0,0 @@
<template>
<div>
<!-- echarts容器 -->
<el-row>
<el-col :span="12">
<!-- Elemenet组件 阴影卡片 -->
<el-card shadow="always">
<div class="echarts-trend" style="width: 700px;height:500px;"></div>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
// ECharts
import echarts from 'echarts'
import {apiGetOwnResult} from '@/api/api_report'
export default {
data () {
return {
data: [],
option: {
name: '用户访问趋势',
type: 'line',
data: []
}
}
},
//
async mounted () {
// domecharts
let myChart = echarts.init(document.querySelector('.echarts-trend'))
//
myChart.setOption({
title: {
text: '成长曲线分析'
},
tooltip: {},
xAxis: {
data: this.data
},
yAxis: {},
series: [this.option]
})
},
activated () {
this.getOwnResult
},
methods: {
getOwnResult () {
apiGetOwnResult({
'startTime': '',
'endTime': ''
}).then(data => {
if (data && data.code === 0) {
this.data = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,90 @@
<!-- -->
<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>

View File

@ -13,7 +13,7 @@
<span class="staff-archives-bule">{{dataInfo.managementRate}}%</span> <span class="staff-archives-bule">{{dataInfo.managementRate}}%</span>
</div> </div>
<div class="staff-archives-content"> <div class="staff-archives-content">
<span class="staff-archives-yellow" v-if="monthLetter.index">{{monthLetter.title}}</span>新入职员工 <span class="staff-archives-yellow" v-if="monthLetter.own">{{monthLetter.title}}</span>新入职员工
<span class="staff-archives-bule">{{dataInfo.newStaffCount}}</span>离职员工 <span class="staff-archives-bule">{{dataInfo.newStaffCount}}</span>离职员工
<span class="staff-archives-bule">{{dataInfo.leaveStaffCount}}</span>离职率为 <span class="staff-archives-bule">{{dataInfo.leaveStaffCount}}</span>离职率为
<span class="staff-archives-bule">{{dataInfo.leaveRate}}%</span> <span class="staff-archives-bule">{{dataInfo.leaveRate}}%</span>
@ -69,4 +69,4 @@ export default {
font-size: 28px; font-size: 28px;
} }
} }
</style> </style>