From bc5cab0770963c2ae0f54cbceadb5cc42780879a Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期二, 24 三月 2026 14:20:52 +0800
Subject: [PATCH] fix: 仓储物流日期筛选有问题,耗材物料没有日期筛选框
---
src/pages/consumablesLogistics/stockReport/index.vue | 79 ++++++++++++++++++++++++++++++++-------
src/pages/qualityManagement/nonconformingManagement/index.vue | 14 +++---
2 files changed, 71 insertions(+), 22 deletions(-)
diff --git a/src/pages/consumablesLogistics/stockReport/index.vue b/src/pages/consumablesLogistics/stockReport/index.vue
index b596f21..8dc324f 100644
--- a/src/pages/consumablesLogistics/stockReport/index.vue
+++ b/src/pages/consumablesLogistics/stockReport/index.vue
@@ -12,6 +12,37 @@
<text>{{ t.label }}</text>
</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">
<view class="section-header">
<text class="table-title">{{ tableTitle }}</text>
@@ -47,6 +78,7 @@
<up-datetime-picker
v-model="dateValue"
:mode="datePickerMode"
+ :show="showDatePicker"
@confirm="onDateConfirm"
@cancel="showDatePicker = false"
/>
@@ -88,7 +120,7 @@
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";
});
@@ -106,11 +138,8 @@
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 ? `${searchForm.value.startMonth}-01` : "";
+ p.endMonth = searchForm.value.endMonth ? `${searchForm.value.endMonth}-01` : "";
} else {
p.startDate = searchForm.value.startDate;
p.endDate = searchForm.value.endDate;
@@ -184,6 +213,8 @@
if (target === "single") val = searchForm.value.singleDate;
else if (target === "startMonth") val = searchForm.value.startMonth;
else if (target === "endMonth") val = searchForm.value.endMonth;
+ else if (target === "startDate") val = searchForm.value.startDate;
+ else if (target === "endDate") val = searchForm.value.endDate;
dateValue.value = val ? new Date(val).getTime() : Date.now();
showDatePicker.value = true;
};
@@ -191,11 +222,31 @@
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();
+ }
};
const initDefaultDates = () => {
@@ -204,10 +255,8 @@
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.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");
diff --git a/src/pages/qualityManagement/nonconformingManagement/index.vue b/src/pages/qualityManagement/nonconformingManagement/index.vue
index 13b65c3..ca100c8 100644
--- a/src/pages/qualityManagement/nonconformingManagement/index.vue
+++ b/src/pages/qualityManagement/nonconformingManagement/index.vue
@@ -54,7 +54,7 @@
</view>
<view class="card-actions">
<view class="btn-link btn-link-primary" v-if="item.inspectState == 0" @click.stop="openDealDialog(item)">澶勭悊</view>
- <view class="btn-link btn-link-plain" v-if="item.inspectState == 0 && hasNonconformingEdit" @click.stop="openForm('edit', item)">缂栬緫</view>
+ <view class="btn-link btn-link-plain" v-if="hasNonconformingEdit" @click.stop="openForm('edit', item)">缂栬緫</view>
<view class="btn-link btn-link-warn" v-if="hasNonconformingCancel" @click.stop="handleDelete(item)">鍒犻櫎</view>
</view>
</view>
@@ -136,7 +136,7 @@
<up-datetime-picker
:show="showEntryStartPicker"
v-model="entryStartValue"
- mode="date"
+ mode="year-month"
@confirm="confirmEntryStart"
@cancel="showEntryStartPicker = false"
/>
@@ -144,7 +144,7 @@
<up-datetime-picker
:show="showEntryEndPicker"
v-model="entryEndValue"
- mode="date"
+ mode="year-month"
@confirm="confirmEntryEnd"
@cancel="showEntryEndPicker = false"
/>
@@ -306,19 +306,19 @@
};
const openDateRange = () => {
- entryStartValue.value = searchForm.entryDateStart ? dayjs(searchForm.entryDateStart, 'YYYY-MM-DD').valueOf() : Date.now()
+ entryStartValue.value = searchForm.entryDateStart ? dayjs(searchForm.entryDateStart).valueOf() : Date.now()
showEntryStartPicker.value = true
}
const confirmEntryStart = (e) => {
const ts = e?.value ?? entryStartValue.value
- searchForm.entryDateStart = dayjs(ts).format('YYYY-MM-DD')
+ searchForm.entryDateStart = `${dayjs(ts).format('YYYY-MM')}-01`
showEntryStartPicker.value = false
- entryEndValue.value = searchForm.entryDateEnd ? dayjs(searchForm.entryDateEnd, 'YYYY-MM-DD').valueOf() : Date.now()
+ entryEndValue.value = searchForm.entryDateEnd ? dayjs(searchForm.entryDateEnd).valueOf() : Date.now()
showEntryEndPicker.value = true
}
const confirmEntryEnd = (e) => {
const ts = e?.value ?? entryEndValue.value
- searchForm.entryDateEnd = dayjs(ts).format('YYYY-MM-DD')
+ searchForm.entryDateEnd = `${dayjs(ts).format('YYYY-MM')}-01`
showEntryEndPicker.value = false
handleQuery()
}
--
Gitblit v1.9.3