| | |
| | | <view class="row" v-if="searchForm.reportType === 'inout'"><text class="l">出库数量</text><text class="r">{{ item.totalStockOut }}</text></view> |
| | | <view class="row"><text class="l">现在库存</text><text class="r highlight">{{ item.currentStock }}</text></view> |
| | | <view class="row" v-if="item.createBy"><text class="l">入库人</text><text class="r">{{ item.createBy }}</text></view> |
| | | <view class="row" v-if="item.currentWeight"><text class="l">现净重(吨)</text><text class="r">{{ item.currentWeight }}</text></view> |
| | | <view class="row" v-if="item.recordType"><text class="l">来源</text><text class="r">{{ getRecordType(item.recordType) }}</text></view> |
| | | </view> |
| | | </view> |
| | | <view class="load-more-wrap"> |
| | |
| | | <view v-else class="no-data">暂无数据</view> |
| | | </view> |
| | | |
| | | <up-popup :show="showDatePicker" mode="bottom" @close="showDatePicker = false"> |
| | | <up-datetime-picker |
| | | v-model="dateValue" |
| | | :mode="datePickerMode" |
| | | :show="showDatePicker" |
| | | @confirm="onDateConfirm" |
| | | @cancel="showDatePicker = false" |
| | | /> |
| | | </up-popup> |
| | | <up-datetime-picker |
| | | v-model="dateValue" |
| | | :mode="datePickerMode" |
| | | :show="showDatePicker" |
| | | @confirm="onDateConfirm" |
| | | @cancel="showDatePicker = false" |
| | | /> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | import { ref, reactive, toRefs, computed, watch } from 'vue' |
| | | import dayjs from 'dayjs' |
| | | import PageHeader from '@/components/PageHeader.vue' |
| | | import { formatDateToYMD } from '@/utils/ruoyi' |
| | | import { onShow } from '@dcloudio/uni-app' |
| | | import { |
| | | getStockInventoryReportList, |
| | | getStockInventoryInAndOutReportList |
| | | } from '@/api/inventoryManagement/stockInventory.js' |
| | | import {findAllQualifiedStockInRecordTypeOptions} from "@/api/basicData/enum"; |
| | | |
| | | const reportTypes = [ |
| | | { label: '日报', value: 'daily' }, |
| | |
| | | p.startMonth = searchForm.value.startMonth + '-01' |
| | | p.endMonth = searchForm.value.endMonth + '-01' |
| | | } else { |
| | | p.startDate = searchForm.value.startDate |
| | | p.endDate = searchForm.value.endDate |
| | | p.startMonth = searchForm.value.startDate |
| | | p.endMonth = searchForm.value.endDate |
| | | } |
| | | return p |
| | | } |
| | | |
| | | const stockRecordTypeOptions = ref([]) |
| | | |
| | | const getRecordType = (recordType) => { |
| | | return stockRecordTypeOptions.value.find(item => item.value === recordType)?.label || '' |
| | | } |
| | | |
| | | // 获取来源类型选项 |
| | | const fetchStockRecordTypeOptions = () => { |
| | | findAllQualifiedStockInRecordTypeOptions() |
| | | .then(res => { |
| | | stockRecordTypeOptions.value = res.data; |
| | | }) |
| | | } |
| | | |
| | | const getList = () => { |
| | |
| | | getList() |
| | | } |
| | | |
| | | const toPickerTimestamp = (val, target) => { |
| | | if (!val) return Date.now() |
| | | let parsed |
| | | if (target === 'startMonth' || target === 'endMonth') { |
| | | parsed = dayjs(`${val}-01`).valueOf() |
| | | } else { |
| | | parsed = dayjs(val).valueOf() |
| | | } |
| | | return Number.isNaN(parsed) ? Date.now() : parsed |
| | | } |
| | | |
| | | const formatPickerDate = (value, isMonth) => { |
| | | const parsed = dayjs(value) |
| | | if (!parsed.isValid()) return '' |
| | | return parsed.format(isMonth ? 'YYYY-MM' : 'YYYY-MM-DD') |
| | | } |
| | | |
| | | const openDatePicker = (target) => { |
| | | let val = '' |
| | | datePickerTarget.value = target |
| | |
| | | val = searchForm.value.endDate |
| | | break |
| | | } |
| | | dateValue.value = val ? new Date(val).getTime() : Date.now() |
| | | dateValue.value = toPickerTimestamp(val, target) |
| | | 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) |
| | | const str = formatPickerDate(e.value, isMonth) |
| | | if (!str) { |
| | | showDatePicker.value = false |
| | | uni.showToast({ title: '日期格式无效', icon: 'none' }) |
| | | return |
| | | } |
| | | |
| | | if (datePickerTarget.value === 'single') { |
| | | searchForm.value.singleDate = str |
| | |
| | | searchForm.value.singleDate = today.format('YYYY-MM-DD') |
| | | } |
| | | if (!searchForm.value.startMonth || !searchForm.value.endMonth) { |
| | | searchForm.value.startMonth = today.subtract(1, 'month').format('YYYY-MM') |
| | | searchForm.value.endMonth = today.format('YYYY-MM') |
| | | searchForm.value.startMonth = today.format('YYYY-MM') |
| | | searchForm.value.endMonth = today.add(1, 'month').format('YYYY-MM') |
| | | } |
| | | if (!searchForm.value.startDate || !searchForm.value.endDate) { |
| | | searchForm.value.endDate = today.format('YYYY-MM-DD') |
| | | searchForm.value.startDate = today.subtract(6, 'day').format('YYYY-MM-DD') |
| | | } |
| | | if (!datePickerTarget.value) { |
| | | dateValue.value = toPickerTimestamp(searchForm.value.singleDate, 'single') |
| | | } |
| | | } |
| | | |
| | |
| | | onShow(() => { |
| | | initDefaultDates() |
| | | handleQuery() |
| | | fetchStockRecordTypeOptions() |
| | | }) |
| | | |
| | | initDefaultDates() |
| | | |
| | | const goBack = () => uni.navigateBack() |
| | | </script> |
| | | |