123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378 |
- <!-- 运营分析 -->
- <template>
- <view class="operation">
- <view class="operation-header">
- <view class="operation-header-left" @click="typePicker = true">
- <u-icon name="arrow-down" color="#000" size="15"></u-icon>
- <text>{{ currentType.text }}</text>
- </view>
- <view class="operation-header-right">
- <view class="tab">
- <view class="tab-item" v-for="(item, index) in tabList" :key="index"
- :class="{'active': tabCur === item.value}" @click="tabClick(item)">{{ item.label }}</view>
- </view>
- </view>
- </view>
- <view class="operation-main">
- <template v-if="currentType.value === 1">
- <RevenueAnalysis ref="revenueAnalysis" :type="currentType.type" :title="title"/>
- </template>
- <template v-else-if="currentType.value === 2">
- <RevenueAnalysis ref="revenueAnalysis" :type="currentType.type" :title="title"/>
- </template>
- <template v-else-if="currentType.value === 3">
- <RevenueRanking ref="revenueRanking" :title="title"/>
- </template>
- <template v-else-if="currentType.value === 4">
- <TrafficFlow ref="trafficFlow" :title="title"/>
- </template>
- <template v-else-if="currentType.value === 5">
- <TollCollectorPerformance ref="tollCollectorPerformance" type="table" :title="title"/>
- </template>
- <template v-else-if="currentType.value === 6">
- <TollCollectorPerformance ref="tollCollectorPerformance" type="line" :title="title"/>
- </template>
- <template v-else-if="currentType.value === 7">
- <SectionAnalysis ref="sectionAnalysis" :title="title"/>
- </template>
- <template v-else-if="currentType.value === 8">
- <ArrearsAnalysis :chartData="currentType.data" :title="title"/>
- </template>
- <template v-else-if="currentType.value === 9">
- <IncomeAnalysis :chartData="currentType.data" :title="title"/>
- </template>
- <template v-else-if="currentType.value === 10">
- <PaymentMethod :chartData="currentType.data" :title="title"/>
- </template>
- <template v-else-if="currentType.value === 11">
- <SourceOfPayment :chartData="currentType.data" :title="title"/>
- </template>
- </view>
- <!-- 分析类型 -->
- <u-picker :show="typePicker" :columns="typeList" @confirm="typeConfirm" @cancel="typePicker = false"></u-picker>
- <!-- 年 -->
- <u-picker :show="yearPicker" :columns="yearList" :defaultIndex="defaultYear" @confirm="yearConfirm"
- @cancel="yearPicker = false"></u-picker>
- <!-- 月 -->
- <u-picker :show="monthPicker" :columns="monthList" :defaultIndex="defaultMonth" @confirm="monthConfirm"
- @cancel="monthPicker = false"></u-picker>
- <!-- 日 -->
- <u-picker :show="dayPicker" :columns="dayList" :defaultIndex="defaultDay" @confirm="dayConfirm"
- @cancel="dayPicker = false"></u-picker>
- </view>
- </template>
- <script>
- import RevenueAnalysis from './components/revenueAnalysis.vue'
- import RevenueRanking from './components/revenueRanking.vue'
- import TrafficFlow from './components/trafficFlow.vue'
- import TollCollectorPerformance from './components/tollCollectorPerformance.vue'
- import SectionAnalysis from './components/sectionAnalysis.vue'
- import ArrearsAnalysis from './components/arrearsAnalysis.vue'
- import IncomeAnalysis from './components/incomeAnalysis.vue'
- import SourceOfPayment from './components/sourceOfPayment.vue'
- import PaymentMethod from './components/paymentMethod.vue'
- export default {
- components: {
- RevenueAnalysis,
- RevenueRanking,
- TrafficFlow,
- TollCollectorPerformance,
- SectionAnalysis,
- ArrearsAnalysis,
- IncomeAnalysis,
- SourceOfPayment,
- PaymentMethod
- },
- data() {
- return {
- tabList: [{
- label: '年',
- value: 2
- },
- {
- label: '月',
- value: 1
- },
- {
- label: '日',
- value: 0
- }
- ],
- tabCur: 2,
- // 参数
- params: {
- reportType: 2,
- queryDate: ''
- },
- // 类型
- typePicker: false,
- currentType: {},
- typeList: [
- [{
- text: '营收分析(折线)',
- value: 1,
- type: 'line',
- key: 'revenueAnalysis'
- },
- {
- text: '营收分析(柱状)',
- value: 2,
- type: 'column',
- key: 'revenueAnalysis'
- },
- {
- text: '路段/停车场营收排行',
- value: 3,
- key: 'revenueRanking'
- },
- {
- text: '车流量分析',
- value: 4,
- key: 'trafficFlow'
- },
- {
- text: '收费员业绩排行',
- value: 5,
- key: 'tollCollectorPerformance'
- },
- {
- text: '收费员业绩分析',
- value: 6,
- key: 'tollCollectorPerformance'
- },
- {
- text: '路段分析',
- value: 7,
- key: 'sectionAnalysis'
- },
- {
- text: '欠费分析',
- value: 8,
- data: {
- categories: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
- series: [{
- name: '',
- data: [10, 10, 20, 30, 40, 0, 0, 0, 0, 0, 0, 0]
- }]
- }
- },
- {
- text: '收入分析',
- value: 9,
- data: {
- categories: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
- series: [{
- name: '',
- data: [10, 10, 20, 30, 40, 0, 0, 0, 0, 0, 0, 0]
- }]
- }
- },
- {
- text: '支付方式占比',
- value: 10,
- data: {
- series: [{
- data: [{
- "name": "一班",
- "value": 50
- },
- {
- "name": "二班",
- "value": 30
- },
- {
- "name": "三班",
- "value": 20
- },
- {
- "name": "四班",
- "value": 18
- },
- {
- "name": "五班",
- "value": 8
- }
- ]
- }]
- }
- },
- {
- text: '支付来源分析',
- value: 11,
- data: {
- categories: [1, 2, 3, 4, 5],
- series: [{
- name: '',
- data: [10, 10, 20, 30, 40]
- }]
- }
- }
- ]
- ],
- title: '',
- // 年
- yearPicker: false,
- yearList: this.getYearList(),
- defaultYear: [4],
- currentYear: '',
- yearObj: {},
- // 月
- monthPicker: false,
- monthList: this.getMonthList(),
- defaultMonth: [],
- currentMonth: '01',
- monthObj: {},
- // 日
- dayPicker: false,
- dayList: this.getDayList(),
- defaultDay: [],
- currentDay: '01',
- dayObj: {}
- }
- },
- onShow() {
- this.currentType = this.typeList[0][0]
- this.defaultSetVal();
- },
- methods: {
- defaultSetVal() {
- this.currentYear = this.yearList[0][4].value
- this.title = this.yearList[0][4].text
- this.yearObj = this.yearList[0][4]
- this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`
- setTimeout(() => {
- this.$refs[this.currentType.key].getData(this.params)
- }, 500)
- },
- getYearList() {
- const date = new Date()
- const year = date.getFullYear();
- const list = [
- []
- ]
- for (let i = year - 4; i < year + 1; i++) {
- const obj = {
- text: String(i),
- value: String(i)
- }
- list[0].push(obj)
- }
- return list
- },
- getMonthList() {
- const date = new Date()
- const month = date.getMonth()
- const list = [
- []
- ]
- for (let i = 1; i < 13; i++) {
- const obj = {
- text: String(i),
- value: String(i)
- }
- if (i < 10) {
- obj.text = '0' + i
- obj.value = '0' + i
- }
- list[0].push(obj)
- }
- setTimeout(() => {
- this.defaultMonth = [month]
- }, 1000)
- return list
- },
- getDayList() {
- const date = new Date()
- const year = date.getFullYear()
- const month = date.getMonth()
- const day = date.getDate()
- const dayLen = (new Date(year, month, 0)).getDate()
- const list = [
- []
- ]
- for (let i = 1; i < dayLen + 1; i++) {
- const obj = {
- text: String(i),
- value: String(i)
- }
- if (i < 10) {
- obj.text = '0' + i
- obj.value = '0' + i
- }
- list[0].push(obj)
- }
- setTimeout(() => {
- this.defaultDay = [day - 1]
- }, 1000)
- return list
- },
- /**
- * 点击tab
- * @param {Object} item
- */
- tabClick(item) {
- this.tabCur = item.value
- switch (item.value) {
- case 0:
- this.dayPicker = true
- break
- case 1:
- this.monthPicker = true
- break
- case 2:
- this.yearPicker = true
- break
- }
- this.params.reportType = this.tabCur
- },
- /**
- * 选择器确认
- * @param {Object} e
- */
- typeConfirm(e) {
- this.currentType = e.value[0]
- this.typePicker = false
- },
- yearConfirm(e) {
- this.defaultYear = [e.indexs[0]]
- this.title = e.value[0].text
- this.currentYear = e.value[0].value
- this.yearObj = e.value[0]
- this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`
- this.$refs[this.currentType.key].getData(this.params)
- this.yearPicker = false
- },
- monthConfirm(e) {
- this.defaultMonth = [e.indexs[0]]
- this.currentMonth = e.value[0].value
- this.monthObj = e.value[0]
- this.title = `${this.yearObj.text}-${this.monthObj.text}`
- this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`
- this.$refs[this.currentType.key].getData(this.params)
- this.monthPicker = false
- },
- dayConfirm(e) {
- this.defaultDay = [e.indexs[0]]
- this.title = e.value[0].text
- this.currentDay = e.value[0].value
- this.dayObj = e.value[0]
- this.title = `${this.yearObj.text}-${this.monthObj.text}-${this.dayObj.text}`
- this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`
- this.$refs[this.currentType.key].getData(this.params)
- this.dayPicker = false
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- background-color: #1767F2;
- min-height: calc(100vh - 44px);
- }
- </style>
- <style lang="scss" scoped>
- @import './operationalAnalysis.scss';
- </style>
|