|
@@ -11,6 +11,7 @@ import useReport from './hooks/useReport'
|
11
|
11
|
import useChart from './hooks/useChart'
|
12
|
12
|
// import '@/assets/css/iconfont.css'
|
13
|
13
|
import './index.scss'
|
|
14
|
+import { fillTime, cutDays, cutMonths } from './utils'
|
14
|
15
|
|
15
|
16
|
const statTypeDicts = [
|
16
|
17
|
{name: '按天', id: 'day'},
|
|
@@ -61,6 +62,14 @@ export default withLayout((props) => {
|
61
|
62
|
}
|
62
|
63
|
}
|
63
|
64
|
|
|
65
|
+ const SortChange = (e) => {
|
|
66
|
+ setStatType(e)
|
|
67
|
+ const num = e === 'month' ? 6 : 7
|
|
68
|
+ const now = new Date()
|
|
69
|
+ const startDate = e === 'month' ? cutMonths(now, num) : cutDays(now, num)
|
|
70
|
+ setReportDateRange([fillTime(startDate.toJSON().substring(0, 10), true), fillTime(now.toJSON().substring(0, 10), false)])
|
|
71
|
+ }
|
|
72
|
+
|
64
|
73
|
const [tp1 = {}, tp2 = {}, tp3 = {}] = rankList||[]
|
65
|
74
|
|
66
|
75
|
return (
|
|
@@ -166,7 +175,7 @@ export default withLayout((props) => {
|
166
|
175
|
<text className='iconfont icon-sanjiaoxingdown'></text>
|
167
|
176
|
</view>
|
168
|
177
|
<view className='Sort'>
|
169
|
|
- <Picker kv={['name', 'id']} dicts={statTypeDicts} value={statType} onChange={setStatType} />
|
|
178
|
+ <Picker kv={['name', 'id']} dicts={statTypeDicts} value={statType} onChange={SortChange} />
|
170
|
179
|
<text className='iconfont icon-sanjiaoxingdown'></text>
|
171
|
180
|
</view>
|
172
|
181
|
</view>
|