123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <!-- 欠费分析 -->
- <template>
- <view class="arrears">
- <view class="arrears-line">
- <LineChart v-if="chartData.series[0].data.length" :chartData="chartData" :title="title" :opts="opts"/>
- <view class="empty" v-else>
- <u-empty></u-empty>
- </view>
- </view>
- </view>
- </template>
- <script>
- import LineChart from '@/components/lineChart.vue'
- export default {
- components: {
- LineChart
- },
- props: {
- title: {
- type: String,
- default: ''
- },
- opts: {
- type: Object,
- default: () => {
- return {
- xAxis: {
- rotateLabel: false,
- labelCount: 6
- },
- yAxis: {
- showTitle: true,
- splitNumber: 5,
- data: [{
- title: '元',
- titleOffsetY: -5
- }]
- },
- legend: {
- show: false
- },
- dataLabel: false,
- extra: {
- column: {
- width: 20
- }
- }
- }
- }
- }
- },
- data() {
- return {
- chartData: {
- categories: [],
- series: [{
- name: '',
- data: []
- }]
- }
- }
- },
- methods: {
- getData({ reportType, queryDate }) {
- this.reportType = reportType
- this.queryDate = queryDate
- this.getArrearsData()
- },
- getArrearsData() {
- uni.$u.api.operationalAnalysisApi.getArrearsDataApi({
- reportType: this.reportType,
- queryDate: this.queryDate
- }).then(res => {
- console.log(res)
- if (res.code === 200) {
- if (res.data.itemList && res.data.itemList.length) {
- this.chartData.categories = res.data.itemList.map(item => {
- return item.statisTime
- })
- this.chartData.series[0].data = res.data.itemList.map(item => {
- return item.amt
- })
- } else {
- this.chartData.categories = []
- this.chartData.series[0].data = []
- }
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .arrears {
- background-color: #fff;
- border-radius: 5px;
- .empty {
- padding: 15px;
- }
- }
- </style>
|