123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <template>
- <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" :value-fn="valueFn"></StatisticsList>
- </el-tab-pane>
- </el-tabs>
- </div>
- </template>
- <script>
- import StatisticsList from '@/components/StatisticsList'
- import { getCustomerClaimStatistics, getSalaryProductStatistics } from '@/api/salary'
- import { dateFormat } from '@/utils/date'
- export default {
- name: 'claimStatistics',
- components: {
- StatisticsList
- },
- data () {
- return {
- firstApis: [
- (query) => {
- return new Promise((resolve, reject) => {
- getCustomerClaimStatistics(query).then(resolve).catch(reject)
- })
- }
- ],
- firstSearchConfig: [
- {
- label: '月份',
- prop: 'month',
- type: 'datePicker',
- options: {
- placeholder: '请选择月份',
- clearable: false,
- type: 'month',
- valueFormat: 'yyyy-MM',
- format: 'yyyy 年 MM 月'
- }
- }
- ],
- apis: [
- (query) => {
- return new Promise((resolve, reject) => {
- const { month } = query
- const param = {}
- if (month && month.length) {
- Object.assign(param, {
- startDate: month[0],
- endDate: month[1]
- })
- }
- getSalaryProductStatistics(param).then(resolve).catch(reject)
- })
- }
- ],
- searchConfig: [{
- label: '时间范围',
- type: 'datePicker',
- prop: 'month',
- options: {
- rangeSeparator: '至',
- startPlaceholder: '开始时间',
- endPlaceholder: '结束时间',
- valueFormat: 'yyyy-MM-dd',
- type: 'daterange'
- }
- }],
- activeName: 'first'
- }
- },
- mounted () {
- this.$refs.first.onSetValue({
- month: dateFormat('YYYY-mm', new Date())
- })
- 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.onInit()
- }
- }
- </script>
- <style lang="scss" scoped>
- ::v-deep .el-tabs__content {
- height: calc(100% - 55px);
- overflow: visible;
- }
- </style>
|