| | |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 时间选择区域已去除,使用默认日期逻辑 --> |
| | | <!-- 时间选择区域 --> |
| | | <view class="search-section"> |
| | | <!-- 日报:选择年月日 --> |
| | | <view v-if="searchForm.reportType === 'daily'" class="search-row"> |
| | | <view class="date-picker" @click="openDatePicker('single')"> |
| | | <text>{{ searchForm.singleDate || '请选择日期' }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 月报:选择年月 --> |
| | | <view v-else-if="searchForm.reportType === 'monthly'" class="search-row"> |
| | | <view class="date-picker" @click="openDatePicker('startMonth')"> |
| | | <text>{{ searchForm.startMonth || '请选择开始月份' }}</text> |
| | | </view> |
| | | ~ |
| | | <view class="date-picker" @click="openDatePicker('endMonth')"> |
| | | <text>{{ searchForm.endMonth || '请选择结束月份' }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 进出存:选择年月日时间范围 --> |
| | | <view v-else-if="searchForm.reportType === 'inout'" class="search-row"> |
| | | <view class="date-picker" @click="openDatePicker('startDate')"> |
| | | <text>{{ searchForm.startDate || '请选择开始日期' }}</text> |
| | | </view> |
| | | ~ |
| | | <view class="date-picker" @click="openDatePicker('endDate')"> |
| | | <text>{{ searchForm.endDate || '请选择结束日期' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 列表 + 滚动分页 --> |
| | | <view class="list-section"> |
| | |
| | | <up-datetime-picker |
| | | v-model="dateValue" |
| | | :mode="datePickerMode" |
| | | :show="showDatePicker" |
| | | @confirm="onDateConfirm" |
| | | @cancel="showDatePicker = false" |
| | | /> |
| | |
| | | import dayjs from 'dayjs' |
| | | import PageHeader from '@/components/PageHeader.vue' |
| | | import { formatDateToYMD } from '@/utils/ruoyi' |
| | | import { onShow, onReachBottom } from '@dcloudio/uni-app' |
| | | import { onShow } from '@dcloudio/uni-app' |
| | | import { |
| | | getStockInventoryReportList, |
| | | getStockInventoryInAndOutReportList |
| | |
| | | startMonth: '', |
| | | endMonth: '', |
| | | startDate: '', |
| | | endDate: '' |
| | | endDate: '', |
| | | } |
| | | }) |
| | | |
| | | const { searchForm } = toRefs(data) |
| | | |
| | | const datePickerMode = computed(() => { |
| | | if (datePickerTarget.value === 'startMonth' || datePickerTarget.value === 'endMonth') return 'month' |
| | | if (datePickerTarget.value === 'startMonth' || datePickerTarget.value === 'endMonth') return 'year-month' |
| | | return 'date' |
| | | }) |
| | | |
| | |
| | | if (searchForm.value.reportType === 'daily') { |
| | | p.reportDate = searchForm.value.singleDate |
| | | } else if (searchForm.value.reportType === 'monthly') { |
| | | p.startMonth = searchForm.value.startMonth |
| | | p.endMonth = searchForm.value.endMonth |
| | | } else if (searchForm.value.reportType === 'monthly') { |
| | | p.startMonth = searchForm.value.startMonth |
| | | p.endMonth = searchForm.value.endMonth |
| | | p.startMonth = searchForm.value.startMonth + '-01' |
| | | p.endMonth = searchForm.value.endMonth + '-01' |
| | | } else { |
| | | p.startDate = searchForm.value.startDate |
| | | p.endDate = searchForm.value.endDate |
| | |
| | | } |
| | | |
| | | const openDatePicker = (target) => { |
| | | datePickerTarget.value = target |
| | | let val = '' |
| | | if (target === 'single') val = searchForm.value.singleDate |
| | | else if (target === 'startMonth') val = searchForm.value.startMonth |
| | | else if (target === 'endMonth') val = searchForm.value.endMonth |
| | | datePickerTarget.value = target |
| | | switch (target) { |
| | | case 'single': |
| | | val = searchForm.value.singleDate |
| | | break |
| | | case 'startMonth': |
| | | val = searchForm.value.startMonth |
| | | break |
| | | case 'endMonth': |
| | | val = searchForm.value.endMonth |
| | | break |
| | | case 'startDate': |
| | | val = searchForm.value.startDate |
| | | break |
| | | case 'endDate': |
| | | val = searchForm.value.endDate |
| | | break |
| | | } |
| | | dateValue.value = val ? new Date(val).getTime() : Date.now() |
| | | showDatePicker.value = true |
| | | } |
| | |
| | | const onDateConfirm = (e) => { |
| | | const isMonth = datePickerTarget.value === 'startMonth' || datePickerTarget.value === 'endMonth' |
| | | const str = isMonth ? dayjs(e.value).format('YYYY-MM') : formatDateToYMD(e.value) |
| | | if (datePickerTarget.value === 'single') searchForm.value.singleDate = str |
| | | else if (datePickerTarget.value === 'startMonth') searchForm.value.startMonth = str |
| | | else if (datePickerTarget.value === 'endMonth') searchForm.value.endMonth = str |
| | | showDatePicker.value = false |
| | | handleQuery() |
| | | |
| | | if (datePickerTarget.value === 'single') { |
| | | searchForm.value.singleDate = str |
| | | showDatePicker.value = false |
| | | handleQuery() |
| | | } else if (datePickerTarget.value === 'startMonth') { |
| | | searchForm.value.startMonth = str |
| | | showDatePicker.value = false |
| | | setTimeout(() => { |
| | | openDatePicker('endMonth') |
| | | }, 300) |
| | | } else if (datePickerTarget.value === 'endMonth') { |
| | | searchForm.value.endMonth = str |
| | | showDatePicker.value = false |
| | | handleQuery() |
| | | } else if (datePickerTarget.value === 'startDate') { |
| | | searchForm.value.startDate = str |
| | | showDatePicker.value = false |
| | | // 确认开始日期后,打开结束日期选择框 |
| | | setTimeout(() => { |
| | | openDatePicker('endDate') |
| | | }, 300) |
| | | } else if (datePickerTarget.value === 'endDate') { |
| | | searchForm.value.endDate = str |
| | | showDatePicker.value = false |
| | | handleQuery() |
| | | } |
| | | } |
| | | |
| | | // 初始化:日报默认今天,月报默认本月,进出存默认最近7天 |
| | |
| | | searchForm.value.singleDate = today.format('YYYY-MM-DD') |
| | | } |
| | | if (!searchForm.value.startMonth || !searchForm.value.endMonth) { |
| | | const startOfMonth = today.startOf('month').format('YYYY-MM-DD') |
| | | const endOfMonth = today.endOf('month').format('YYYY-MM-DD') |
| | | searchForm.value.startMonth = startOfMonth |
| | | searchForm.value.endMonth = endOfMonth |
| | | searchForm.value.startMonth = today.subtract(1, 'month').format('YYYY-MM') |
| | | searchForm.value.endMonth = today.format('YYYY-MM') |
| | | } |
| | | if (!searchForm.value.startDate || !searchForm.value.endDate) { |
| | | searchForm.value.endDate = today.format('YYYY-MM-DD') |
| | |
| | | .card-body .l { color: #666; } .card-body .r { color: #333; } .card-body .r.highlight { color: #2979ff; font-weight: 500; } |
| | | .no-data { text-align: center; padding: 60rpx 0; color: #999; font-size: 28rpx; } |
| | | .load-more-wrap { padding: 24rpx 0 8rpx; } |
| | | </style> |
| | | </style> |