Commit 5b65462c by 胡悦

修改年份添加全部

1 parent 551a25c5
......@@ -54,7 +54,7 @@ function getBarLineOptions(obj) {
position: 'top',
color: '#fff',
formatter: (params) => {
return utils.numAddSymbol(params.value)
return params.value ? utils.numAddSymbol(params.value) : ''
}
},
itemStyle: {
......@@ -89,7 +89,7 @@ function getBarLineOptions(obj) {
position: 'top',
color: '#fff',
formatter: (params) => {
return utils.numAddSymbol(params.value)
return params.value ? utils.numAddSymbol(params.value) : ''
}
},
data: [],
......
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2023-07-05 15:11:53
* @LastEditors: huyue
* @LastEditTime: 2023-07-17 15:30:16
* @LastEditTime: 2023-07-17 18:18:37
-->
<template>
<div v-click-outside="handleClickOutside" @mouseleave="handleMouseLeave" v-show="isShow" class="select-box" :style="{'width': boxWidth}">
......
......@@ -3,19 +3,16 @@
* @Author: huyue
* @Date: 2023-07-05 10:35:43
* @LastEditors: huyue
* @LastEditTime: 2023-07-17 15:19:21
* @LastEditTime: 2023-07-17 18:13:20
-->
<template>
<div class="view-date">统计年份:
<div class="year-plugin">
<div class="year" @click.stop="switchYear">
{{$store.state.app.solarYear}}
{{$store.state.app.solarYear ? $store.state.app.solarYear : '全部'}}
<img class="arrow-down" src="@/assets/images/arrow-down.png" alt="">
</div>
<SelectBox :isShow="isShow" :defaultValue="defaultYear" @clickOutside="clickOutside" :dataList="dataList" :boxWidth="'8.61vw'" @selectVal="selectVal"></SelectBox>
<!-- <div v-show="isShow" class="select-year">
<div class="year-item" :class="year == item ? 'active' : ''" v-for="(item,index) in dataList" :key="index" @click.s="selectYear(item)">{{item}}</div>
</div> -->
<SelectBox :isShow="isShow" isObject :defaultValue="defaultYear" @clickOutside="clickOutside" :dataList="dataList" :boxWidth="'8.61vw'" @selectVal="selectVal"></SelectBox>
</div>
<span class="businessTime">
业务开始时间:{{businessTime ? new Date(businessTime).format('yyyy-MM-dd') : ''}}
......@@ -53,7 +50,7 @@ export default {
this.isShow = !this.isShow
},
selectVal(val) {
this.setSolarYear(val)
this.setSolarYear(val.value)
this.switchYear()
},
clickOutside() {
......
......@@ -10,7 +10,7 @@ const state = {
reportParams: {
reportType: 0 // 月表0,日表1
},
solarYear: '2023',
solarYear: '',
solarTime: '',
merchantRankingList: []
}
......
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2023-07-04 13:56:33
* @LastEditors: huyue
* @LastEditTime: 2023-07-17 15:50:17
* @LastEditTime: 2023-07-17 18:10:47
-->
<template>
<div class="view-content">
......@@ -30,7 +30,10 @@ export default {
data() {
return {
businessTime: '',
yearList: [],
yearList: [{
label: '全部',
value: ''
}],
defaultYear: ''
}
},
......@@ -43,9 +46,14 @@ export default {
methods: {
async getYears() {
const _data = await this.api.solar.getYears({})
this.yearList = _data.data.dataList[0].year.reverse().map(item => item + '')
this.defaultYear = this.yearList[0]
console.log(this.defaultYear)
const _yearList = _data.data.dataList[0].year.reverse()
_yearList.forEach(item => {
this.yearList.push({
label: item,
value: item + ''
})
})
this.defaultYear = this.yearList[0].value
}
}
}
......
......@@ -31,7 +31,10 @@ export default {
},
data() {
return {
yearList: [],
yearList: [{
label: '全部',
value: ''
}],
defaultYear: '',
isEmpty: false,
dataList: [],
......@@ -108,7 +111,7 @@ export default {
},
methods: {
async init() {
console.log(222);
console.log(222)
this.tabObject = this.$route.query
const { year } = this.$route.query
this.defaultYear = year
......@@ -191,8 +194,19 @@ export default {
},
// 获取年份数据参数门店id
async getYears(MerchantId) {
this.yearList = [{
label: '全部',
value: ''
}]
const _data = await this.api.solar.getYears({ MerchantId })
this.yearList = _data.data.dataList[0].year.reverse().map(item => item + '')
const _yearList = _data.data.dataList[0].year.reverse()
_yearList.forEach(item => {
this.yearList.push({
label: item,
value: item + ''
})
})
this.defaultYear = this.yearList[0].value
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!