1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <template>
- <el-card header="人事数据">
- <statistic class="statistic" :cols="0">
- <statistic-item v-for="(item, key) in items" :key="key" :class="{active: active === key}" @click="active = key">
- <span>
- {{item.title}}
- <el-tooltip v-if="item.desc" :content="item.desc" :open-delay=".3" placement="top">
- <i style="margin-left: 5px;cursor: pointer;" class="el-icon-warning-outline"/>
- </el-tooltip>
- </span>
- <span>
- <count-to :endVal="item.percent"/>
- </span>
- </statistic-item>
- </statistic>
- <ve-histogram
- style="width: 100%;"
- height="350px"
- :data="chartData"
- :data-empty="dataEmpty"
- :data-zoom="dataZoom"
- ></ve-histogram>
- </el-card>
- </template>
- <script>
- import 'echarts/lib/component/dataZoom'
- import countTo from 'vue-count-to'
- import veHistogram from 'v-charts/lib/histogram.common'
- export default {
- props: ['data'],
- components: {
- 've-histogram': veHistogram,
- 'count-to': countTo
- },
- computed: {
- items() {
- return {
- TEACHER_NUM: this.data['TEACHER_NUM'] || {},
- FULL_TIME_NUM: this.data['FULL_TIME_NUM'] || {},
- PART_TIME_NUM: this.data['PART_TIME_NUM'] || {},
- DIMISSION_NUM: this.data['DIMISSION_NUM'] || {},
- }
- },
- dataZoom() {
- return [
- {
- type: 'slider',
- start: 60,
- end: 100
- }
- ]
- },
- chartData() {
- const values = Object.values(this.items)
- const months = {}
- for (const item of values) {
- for (const row of (item.indexMonthData || [])) {
- const key = this.$helpers.dayjs(row.month).format('YYYY-MM-DD')
- if (!months[key]) {
- months[key] = {
- '日期': key,
- }
- }
- months[key][item.title] = row.percent
- }
- }
- return {
- columns: ['日期', ...values.map(item => item.title)],
- rows: Object.values(months)
- }
- },
- dataEmpty() {
- return !this.chartData.rows.length
- },
- },
- data () {
- return {
- active: 'TEACHER_NUM',
- }
- },
- }
- </script>
- <style lang="less" scoped>
- // .statistic{
- // /deep/ .statistic-content{
- // cursor: pointer;
- // &.active > span{
- // color: #14928a !important;
- // }
- // }
- // }
- </style>
|