|
@@ -1,33 +1,141 @@
|
|
|
<template>
|
|
|
- <div class="pa-3 white">
|
|
|
- <el-tabs v-model="activeName">
|
|
|
- <el-tab-pane label="分布图" name="first">
|
|
|
- <performanceAnalysis></performanceAnalysis>
|
|
|
- </el-tab-pane>
|
|
|
- <el-tab-pane label="趋势图" name="second">
|
|
|
- <AnalysisPage :search-api="getSalaryStatistics" :search-config="searchConfig" :value-fn="valueFn"></AnalysisPage>
|
|
|
- </el-tab-pane>
|
|
|
- </el-tabs>
|
|
|
+ <div class="pa-3 white fullscreen border-box">
|
|
|
+ <el-tabs v-model="activeName" class="fullscreen">
|
|
|
+ <el-tab-pane label="分布图" name="first" class="fullscreen">
|
|
|
+ <StatisticsList ref="first" :apis="firstApis" :search-items="firstSearchConfig"></StatisticsList>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="趋势图" name="second" class="fullscreen">
|
|
|
+ <StatisticsList ref="second" :apis="apis" :search-items="searchConfig"></StatisticsList>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
- getSalaryStatistics
|
|
|
+ getSalaryStatistics,
|
|
|
+ getPayrollStatistics
|
|
|
} from '@/api/salary'
|
|
|
-import AnalysisPage from '@/components/Analysis'
|
|
|
-import performanceAnalysis from './performanceAnalysis'
|
|
|
+import {
|
|
|
+ dateFormat
|
|
|
+} from '@/utils/date'
|
|
|
+import StatisticsList from '@/components/StatisticsList'
|
|
|
+import { mapGetters } from 'vuex'
|
|
|
export default {
|
|
|
name: 'trendStatistics',
|
|
|
components: {
|
|
|
- AnalysisPage,
|
|
|
- performanceAnalysis
|
|
|
+ StatisticsList
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
- activeName: 'first',
|
|
|
- getSalaryStatistics,
|
|
|
- searchConfig: [
|
|
|
+ firstSearchConfig: [
|
|
|
+ {
|
|
|
+ label: '月份',
|
|
|
+ prop: 'month',
|
|
|
+ type: 'datePicker',
|
|
|
+ options: {
|
|
|
+ clearable: false,
|
|
|
+ type: 'month',
|
|
|
+ format: 'yyyy-MM',
|
|
|
+ valueFormat: 'yyyy-MM',
|
|
|
+ placeholder: '选择月份'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '维度',
|
|
|
+ prop: 'type',
|
|
|
+ type: 'select',
|
|
|
+ options: {
|
|
|
+ clearable: false,
|
|
|
+ items: [
|
|
|
+ { label: '绩效', value: 0 },
|
|
|
+ { label: '加班工资', value: 1 },
|
|
|
+ // { label: '通讯补贴', value: 2 },
|
|
|
+ // { label: '午餐费补贴', value: 3 },
|
|
|
+ { label: '网讯稿酬', value: 4 }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '类型',
|
|
|
+ prop: 'avge',
|
|
|
+ type: 'select',
|
|
|
+ options: {
|
|
|
+ clearable: false,
|
|
|
+ items: [
|
|
|
+ { label: '总计', value: false },
|
|
|
+ { label: '平均值', value: true }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ firstApis: [
|
|
|
+ (query) => {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ getPayrollStatistics(query).then(resolve).catch(reject)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ apis: [
|
|
|
+ (query) => {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ const { month, ...obj } = query
|
|
|
+ const param = {
|
|
|
+ ...obj,
|
|
|
+ avge: true
|
|
|
+ }
|
|
|
+ if (month && month.length) {
|
|
|
+ Object.assign(param, {
|
|
|
+ startDate: month[0],
|
|
|
+ endDate: month[1]
|
|
|
+ })
|
|
|
+ }
|
|
|
+ getSalaryStatistics(param).then(resolve).catch(reject)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ (query) => {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ const { month, ...obj } = query
|
|
|
+ const param = {
|
|
|
+ ...obj,
|
|
|
+ avge: false
|
|
|
+ }
|
|
|
+ if (month && month.length) {
|
|
|
+ Object.assign(param, {
|
|
|
+ startDate: month[0],
|
|
|
+ endDate: month[1]
|
|
|
+ })
|
|
|
+ }
|
|
|
+ getSalaryStatistics(param).then(resolve).catch(reject)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ activeName: 'first'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(['organizationTree']),
|
|
|
+ searchConfig () {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ label: '上级机构',
|
|
|
+ type: 'cascader',
|
|
|
+ prop: 'parentOrganizationNo',
|
|
|
+ options: {
|
|
|
+ filterable: true,
|
|
|
+ clearable: false,
|
|
|
+ placeholder: '请选择上级机构',
|
|
|
+ options: this.organizationTree,
|
|
|
+ showAllLevels: false,
|
|
|
+ props: {
|
|
|
+ emitPath: false,
|
|
|
+ checkStrictly: true,
|
|
|
+ value: 'organizationNo',
|
|
|
+ label: 'organizationName',
|
|
|
+ children: 'child'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
{
|
|
|
label: '时间范围',
|
|
|
type: 'datePicker',
|
|
@@ -43,22 +151,53 @@ export default {
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
- methods: {
|
|
|
- valueFn (data) {
|
|
|
- const { month, ...obj } = data
|
|
|
- if (!month || !month.length) {
|
|
|
- return obj
|
|
|
- }
|
|
|
- return {
|
|
|
- ...obj,
|
|
|
- startDate: month[0],
|
|
|
- endDate: month[1]
|
|
|
- }
|
|
|
- }
|
|
|
+ mounted () {
|
|
|
+ // const clientHeight = this.$refs.first.$refs.main.clientHeight
|
|
|
+ this.$refs.first.onSetValue({
|
|
|
+ month: dateFormat('YYYY-mm', new Date()),
|
|
|
+ type: 0,
|
|
|
+ avge: false
|
|
|
+ })
|
|
|
+ this.$refs.first.onInit(items => {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ items.forEach(ele => {
|
|
|
+ ele.option.series.forEach((item) => {
|
|
|
+ Object.assign(item, {
|
|
|
+ label: {
|
|
|
+ show: true,
|
|
|
+ formatter: (v) => {
|
|
|
+ return ` ${v.name}:${v.value} 元`
|
|
|
+ }
|
|
|
+ },
|
|
|
+ breadcrumb: {
|
|
|
+ show: true,
|
|
|
+ left: 'left',
|
|
|
+ top: 'top'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.$nextTick(() => {
|
|
|
+ const clientHeight = this.$refs.first.$refs.main.clientHeight
|
|
|
+ items.forEach(ele => {
|
|
|
+ ele.height = clientHeight - 61 - 40 - 2
|
|
|
+ })
|
|
|
+ resolve()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ this.$refs.second.onSetValue({
|
|
|
+ parentOrganizationNo: this.organizationTree[0].organizationNo
|
|
|
+ })
|
|
|
+ this.$refs.second.onInit()
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-
|
|
|
+::v-deep .el-tabs__content {
|
|
|
+ height: calc(100% - 55px);
|
|
|
+ overflow: visible;
|
|
|
+}
|
|
|
</style>
|