1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- // 机构画像
- import Vue from 'vue'
- const chartMixin = {
- data() {
- const currentDate = this.getDate({
- format: true
- })
- return {
- date: currentDate,
- timeList: [
- { label: '全年', current: 3 },
- { label: '半年', current: 2 },
- { label: '月', current: 1 },
- { label: '日', current: 0 }
- ]
- }
- },
- computed: {
- startDate() {
- return this.getDate('start')
- },
- endDate() {
- return this.getDate('end')
- }
- },
- methods: {
- bindStartDateChange(event,type) {
- //开始时间
- console.log('开始时间==>', event.detail.value)
- this.params.startTime = event.detail.value
- this.userClubPortrait(type)
- },
- bindEndDateChange(event,type) {
- //结束时间
- console.log('结束时间==>', event.detail.value)
- this.params.endTime = event.detail.value
- this.userClubPortrait(type)
- },
- getDate(type) {
- const date = new Date()
- let year = date.getFullYear()
- let month = date.getMonth() + 1
- let day = date.getDate()
- if (type === 'start') {
- year = year - 1
- } else if (type === 'end') {
- year = year + 1
- }
- month = month > 9 ? month : '0' + month
- day = day > 9 ? day : '0' + day
- return `${year}-${month}-${day}`
- }
- }
- }
- export default chartMixin
|