<template> <div class="app-container"> <el-row> <el-form :model="query" :inline="true" label-width="auto"> <el-form-item label="开始日期"> <el-date-picker v-model="query.beginDate" type="date" value-format="yyyy-MM-dd" placeholder="选择开始日期"/> </el-form-item> <el-form-item label="结束日期"> <el-date-picker v-model="query.endDate" type="date" value-format="yyyy-MM-dd" placeholder="选择结束日期"/> </el-form-item> <el-button type="primary" icon="el-icon-edit">统计</el-button> <el-button type="primary" icon="el-icon-refresh-right" @click="clearDate">清空</el-button> <el-button type="primary" icon="el-icon-document">报表</el-button> </el-form> </el-row> <el-row> <el-tabs v-model="activeName" type="card" @tab-click="handleClick"> <el-tab-pane name="list"> <span slot="label"><i class="el-icon-s-fold"/> 列表模式</span> <dept-access-list :list="list"/> </el-tab-pane> <el-tab-pane name="chart"> <span slot="label"><i class="el-icon-s-data"/> 图表模式</span> <dept-access-chart :list="list"/> </el-tab-pane> </el-tabs> <el-button type="text" class="rule-button" @click="dialogVisible = true">考核规则</el-button> </el-row> <el-dialog :visible.sync="dialogVisible" :append-to-body="true" :close-on-click-modal="false" title="考核规则" width="70%" > <access-rule/> </el-dialog> </div> </template> <script> import DeptAccessList from './deptAccessList' import DeptAccessChart from './deptAccessChart' import AccessRule from './accessRule' export default { name: 'DeptAccess', components: { DeptAccessList, DeptAccessChart, AccessRule }, data() { return { activeName: 'list', // 默认tab dialogVisible: false, query: { beginDate: '', endDate: '' }, list: [ { deptName: '城管监察二大队', lastCarryOver: 2, shouldProcess: 166, totalShouldProcess: 168, process: 166, returnJob: 1, sumary: 100.03 }, { deptName: '渣土站', lastCarryOver: 0, shouldProcess: 21, totalShouldProcess: 21, process: 21, returnJob: 1, sumary: 99.39 } ] } }, mounted() { }, methods: { clearDate() { this.query.beginDate = '' this.query.endDate = '' }, handleClick(tab, event) { this.activeName = tab.name if (tab.name === 'chart') { setTimeout(() => { tab.$children[0].chart.resize() }, 50) } } } } </script> <style scoped> .rule-button{ position: absolute; top: 0; right: 10px; /* color: red; */ } </style>