| | |
| | | </view> |
| | | |
| | | <view v-if="currentRange === 'custom'" class="date-bar"> |
| | | <view class="date-item" @click="showStartDatePicker = true"> |
| | | <view class="date-item" @click="openStartDatePicker"> |
| | | <text :class="startDate ? 'date-text' : 'date-placeholder'">{{ formatPickerDate(startDate) || '开始时间' }}</text> |
| | | </view> |
| | | <text class="date-separator">-</text> |
| | | <view class="date-item" @click="showEndDatePicker = true"> |
| | | <view class="date-item" @click="openEndDatePicker"> |
| | | <text :class="endDate ? 'date-text' : 'date-placeholder'">{{ formatPickerDate(endDate) || '结束时间' }}</text> |
| | | </view> |
| | | </view> |
| | |
| | | <u-datetime-picker |
| | | :show="showStartDatePicker" |
| | | mode="date" |
| | | v-model="startDate" |
| | | v-model="startDateValue" |
| | | @confirm="onStartDateConfirm" |
| | | @cancel="showStartDatePicker = false" |
| | | placeholder="选择开始日期" |
| | | value-format="YYYY-MM-DD" |
| | | ></u-datetime-picker> |
| | | |
| | | <!-- 结束日期选择器 --> |
| | | <u-datetime-picker |
| | | :show="showEndDatePicker" |
| | | mode="date" |
| | | v-model="endDate" |
| | | v-model="endDateValue" |
| | | @confirm="onEndDateConfirm" |
| | | @cancel="showEndDatePicker = false" |
| | | placeholder="选择结束日期" |
| | | value-format="YYYY-MM-DD" |
| | | ></u-datetime-picker> |
| | | </view> |
| | | |
| | |
| | | currentRange: 'today', |
| | | startDate: '', |
| | | endDate: '', |
| | | startDateValue: '', |
| | | endDateValue: '', |
| | | showStartDatePicker: false, |
| | | showEndDatePicker: false, |
| | | minEndDate: '', |
| | |
| | | legend: { |
| | | show: true, |
| | | position: "right", |
| | | lineHeight: 25 |
| | | lineHeight: 25, |
| | | format: (name, value) => { |
| | | return name + ' ' + value |
| | | } |
| | | }, |
| | | title: { |
| | | show: false, |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | openStartDatePicker() { |
| | | this.startDateValue = this.startDate || this.formatDate(new Date()); |
| | | this.showStartDatePicker = true; |
| | | }, |
| | | openEndDatePicker() { |
| | | this.endDateValue = this.endDate || this.formatDate(new Date()); |
| | | this.showEndDatePicker = true; |
| | | }, |
| | | formatDate(date) { |
| | | return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`; |
| | | }, |
| | |
| | | }; |
| | | |
| | | this.selectedLuggageText = ''; |
| | | this.opts.title.name = ''; |
| | | this.opts.subtitle.name = ''; |
| | | this.opts = { |
| | | ...this.opts, |
| | | legend: { |
| | | ...this.opts.legend, |
| | | format: (name) => { |
| | | const currentItem = this.luggageDistribution.find(item => item.name === name); |
| | | return currentItem ? `${currentItem.name} ${currentItem.percent}%` : name; |
| | | } |
| | | }, |
| | | title: { |
| | | ...this.opts.title, |
| | | name: '' |
| | | }, |
| | | subtitle: { |
| | | ...this.opts.subtitle, |
| | | name: '' |
| | | } |
| | | }; |
| | | }, |
| | | onRingChartClick(e) { |
| | | const currentIndex = e && typeof e.currentIndex === 'number' ? e.currentIndex : -1; |
| | |
| | | }); |
| | | }, |
| | | onStartDateConfirm(e) { |
| | | const nextStartDate = this.formatPickerDate(e.value); |
| | | const nextStartDate = this.formatPickerDate((e && e.value) || this.startDateValue); |
| | | |
| | | if (this.isStartDateAfterEndDate(nextStartDate, this.endDate)) { |
| | | this.startDate = ''; |
| | | this.startDateValue = this.formatDate(new Date()); |
| | | this.showStartDatePicker = false; |
| | | uni.showToast({ title: '开始日期不能大于截止日期', icon: 'none' }); |
| | | return; |
| | | } |
| | | |
| | | this.startDate = nextStartDate; |
| | | this.startDateValue = nextStartDate; |
| | | this.showStartDatePicker = false; |
| | | this.minEndDate = nextStartDate ? new Date(nextStartDate).getTime() : ''; |
| | | |
| | |
| | | } |
| | | }, |
| | | onEndDateConfirm(e) { |
| | | const nextEndDate = this.formatPickerDate(e.value); |
| | | const nextEndDate = this.formatPickerDate((e && e.value) || this.endDateValue); |
| | | |
| | | if (this.isStartDateAfterEndDate(this.startDate, nextEndDate)) { |
| | | this.endDate = ''; |
| | | this.endDateValue = this.formatDate(new Date()); |
| | | this.showEndDatePicker = false; |
| | | uni.showToast({ title: '截止日期不能小于开始日期', icon: 'none' }); |
| | | return; |
| | | } |
| | | |
| | | this.endDate = nextEndDate; |
| | | this.endDateValue = nextEndDate; |
| | | this.showEndDatePicker = false; |
| | | |
| | | if (this.startDate) { |