123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <!-- 收费员业绩 -->
- <template>
- <view class="performance">
- <template v-if="type === 'table'">
- <TableRanking :loading="loading" :title="title" :tableTh="tableTh" :tableData="tableData" @pageChange="pageChange"/>
- </template>
- <template v-else>
- <LineChart v-if="chartData.series[0].data.length" :chartData="chartData" :title="title" :opts="opts"/>
- <view class="empty" v-else>
- <u-empty></u-empty>
- </view>
- </template>
- </view>
- </template>
- <script>
- import TableRanking from '@/components/tableRanking.vue'
- import LineChart from '@/components/lineChart.vue'
- export default {
- components: {
- TableRanking,
- LineChart
- },
- props: {
- type: {
- type: String,
- default: 'table'
- },
- title: {
- type: String,
- default: ''
- },
- tableTh: {
- type: Array,
- default: () => [
- { width: 100, field: '工号', key: 'payeeNo' },
- { width: 100, field: '姓名', key: 'payeeName' },
- { width: 100, field: '收益(元)', key: 'amt' }
- ]
- },
- },
- data() {
- return {
- chartData: {
- categories: [],
- series: [{
- name: '',
- data: []
- }]
- },
- tableData: {
- current: 1,
- total: 0,
- list: []
- },
- reportType: '',
- queryDate: '',
- loading: false,
- opts: {
- enableScroll: true,
- xAxis: {
- rotateLabel: true,
- scrollShow: true,
- itemCount: 8
- },
- yAxis: {
- showTitle: true,
- splitNumber: 5,
- data: [{
- title: '元',
- titleOffsetY: -3
- }]
- },
- legend: {
- show: false
- },
- dataLabel: false,
- padding: [20, 10, 10, 10],
- extra: {
- column: {
- width: 20
- }
- }
- }
- }
- },
- methods: {
- getData({ reportType, queryDate }) {
- if (this.type === 'table') {
- this.tableData.current = 1
- this.getTableData({ reportType, queryDate })
- } else {
- this.getChartData({ reportType, queryDate })
- }
- },
- getTableData({ reportType, queryDate }) {
- this.loading = true
- uni.$u.api.operationalAnalysisApi.getTollCollectorPerformanceApi({
- pageNum: this.tableData.current,
- pageSize: 10,
- reportType,
- queryDate
- }).then(res => {
- if (res.code === 200) {
- this.tableData.list = res.rows
- this.tableData.total = res.total
- }
- this.loading = false
- }).catch(() => {
- this.loading = false
- })
- },
- getChartData({ reportType, queryDate }) {
- uni.$u.api.operationalAnalysisApi.getTollCollectorPerformanceApi({
- reportType,
- queryDate
- }).then(res => {
- if (res.code === 200) {
- if (res.rows && res.rows.length) {
- this.chartData.categories = res.rows.map(item => {
- return item.payeeName
- })
- this.chartData.series[0].data = res.rows.map(item => {
- return item.amt
- })
- } else {
- this.chartData.categories = []
- this.chartData.series[0].data = []
- }
- }
- })
- },
- pageChange(current) {
- this.tableData.current = current
- this.getTableData()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .performance {
- background-color: #fff;
- border-radius: 5px;
- .empty {
- padding: 15px;
- }
- }
- </style>
|