123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <template>
- <el-card >
- <div slot="header" class="clearfix">
- <div class="box">
- <span class='shape'></span>
- <span>人事数据</span>
- </div>
- </div>
- <div class="wall" style="height:68px;" v-if="JSON.stringify(items) == '{}'">
- 暂无数据
- </div>
- <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"
- :extend="chartExtend"
- ></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
- },
- // DIMISSION_NUM: this.data['DIMISSION_NUM'] || {},
- computed: {
- items() {
- let obj = {}
- let arr = ["TEACHER_NUM","FULL_TIME_NUM","PART_TIME_NUM"]
- arr.forEach(str=>{
- if(this.data[str]){
- obj[str]=this.data[str]
- }
- })
- /**
- * {
- TEACHER_NUM: this.data['TEACHER_NUM'] || {},
- FULL_TIME_NUM: this.data['FULL_TIME_NUM'] || {},
- PART_TIME_NUM: this.data['PART_TIME_NUM'] || {},
- }
- */
- return obj
- },
- chartExtend() {
- return {
- tooltip: {
- axisPointer: {
- type: 'shadow',
- shadowStyle: {
- color: 'rgba(150,150,150,0.2)'
- }
- }
- }
- }
- },
- 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>
|