From e83b458dad9bf8fcd98e889cf3cf234481014183 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期三, 21 十月 2026 01:24:11 +0800
Subject: [PATCH] feat: 添加产品规格筛选功能,优化查询表单默认值和布局
---
src/views/procurementManagement/procurementReport/index.vue | 93 +++++++++++++++++++-----------
src/views/salesManagement/indicatorStats/index.vue | 20 +-----
src/views/collaborativeApproval/notificationManagement/meetIndex/index.vue | 14 ++--
3 files changed, 68 insertions(+), 59 deletions(-)
diff --git a/src/views/collaborativeApproval/notificationManagement/meetIndex/index.vue b/src/views/collaborativeApproval/notificationManagement/meetIndex/index.vue
index 235faa3..0f02410 100644
--- a/src/views/collaborativeApproval/notificationManagement/meetIndex/index.vue
+++ b/src/views/collaborativeApproval/notificationManagement/meetIndex/index.vue
@@ -96,7 +96,8 @@
// 鏌ヨ琛ㄥ崟
const queryForm = reactive({
- meetingDate: dayjs().format('YYYY-MM-DD')
+ // 榛樿鏌ユ湰鍛ㄤ竴锛堝懆渚嬩細鏃ユ湡锛夛紝閬垮厤涓�杩涢〉闈㈠氨鏄┖鐪嬫澘
+ meetingDate: dayjs().day(1).format('YYYY-MM-DD')
})
let loading = ref(false)
// 鏃堕棿娈碉紙浠ュ崐灏忔椂涓洪棿闅旓級
@@ -208,24 +209,23 @@
// 鏌ヨ鎸夐挳鎿嶄綔
const handleSearch = async () => {
loading.value = true
- let resp = await getMeetingUseList({...queryForm})
+ // 鍚庣鎸� date 瀛楁杩囨护锛屽繀椤绘妸閫夋嫨鍣ㄤ笂鐨� meetingDate 浼犳垚 date
+ let resp = await getMeetingUseList({ date: queryForm.meetingDate })
roomUsage.value = resp.data
loading.value = false
}
// 閲嶇疆鎼滅储琛ㄥ崟
const resetSearch = () => {
- queryForm.date = dayjs().format('YYYY-MM-DD')
+ queryForm.meetingDate = dayjs().day(1).format('YYYY-MM-DD')
+ handleSearch()
}
// 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
onMounted(() => {
// 鍒濆鍖栨椂闂存Ы
initTimeSlots()
-
- // 榛樿鏌ヨ浠婂ぉ鐨勬暟鎹�
- const today = new Date()
- queryForm.date = today.toISOString().split('T')[0]
+ // 榛樿鏌ヨ鏈懆涓�鐨勪細璁浣跨敤鎯呭喌
handleSearch()
})
</script>
diff --git a/src/views/procurementManagement/procurementReport/index.vue b/src/views/procurementManagement/procurementReport/index.vue
index 37ca1f8..e491a08 100644
--- a/src/views/procurementManagement/procurementReport/index.vue
+++ b/src/views/procurementManagement/procurementReport/index.vue
@@ -25,6 +25,22 @@
style="width: 200px"
/>
</el-form-item>
+ <el-form-item label="浜у搧瑙勬牸锛�">
+ <el-select
+ v-model="searchForm.specificationModel"
+ placeholder="璇烽�夋嫨浜у搧瑙勬牸"
+ clearable
+ filterable
+ style="width: 200px"
+ >
+ <el-option
+ v-for="m in modelOptions"
+ :key="m.value"
+ :label="m.label"
+ :value="m.value"
+ />
+ </el-select>
+ </el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch" :loading="loading">
鏌ヨ
@@ -92,11 +108,15 @@
// 鎼滅储琛ㄥ崟
const searchForm = reactive({
dateRange: [],
- productCategory: ''
+ productCategory: '',
+ specificationModel: ''
})
// 浜у搧绫诲埆鏍戦�夐」
const productOptions = ref([])
+
+// 浜у搧瑙勬牸閫夐」锛堟寜鎶ヨ〃瀹為檯鍑虹幇鐨勮鏍煎姩鎬佺敓鎴愶級
+const modelOptions = ref([])
// 缁熻鏁版嵁
const businessSummaryStats = ref({
@@ -234,53 +254,55 @@
try {
loading.value = true
const params = {}
-
+
// 鏃堕棿鑼冨洿
if (searchForm.dateRange && searchForm.dateRange.length === 2) {
params.entryDateStart = searchForm.dateRange[0]
params.entryDateEnd = searchForm.dateRange[1]
}
-
- // 浜у搧绫诲埆
+
+ // 浜у搧澶х被
if (searchForm.productCategory) {
const categoryName = findNodeLabelById(productOptions.value, searchForm.productCategory)
if (categoryName) {
params.productCategory = categoryName
}
}
-
- // 鍒嗛〉鍙傛暟
- params.current = page.current
- params.size = page.size
+
+ // 鎶ヨ〃鎸夈�屼骇鍝佸ぇ绫�+瑙勬牸+渚涘簲鍟嗐�嶈仛鍚堬紝鏁版嵁閲忓皬锛屼竴娆″彇鍥炲悗鎸夎鏍兼湰鍦拌繃婊�
+ params.current = 1
+ params.size = 1000
const res = await procurementBusinessSummaryListPage(params)
- if (res && res.data) {
- // 鍏煎鍚庣鍙兘鐩存帴杩斿洖鏁扮粍/鎴栬繑鍥炲垎椤靛璞�
- businessSummaryData.value = Array.isArray(res.data) ? res.data : (res.data.records || [])
+ const payload = res && res.data !== undefined ? res.data : res
+ let rows = Array.isArray(payload) ? payload : ((payload && payload.records) || [])
- if (!Array.isArray(res.data)) {
- page.total = Number(res.data.total ?? 0)
- page.current = Number(res.data.current ?? page.current)
- page.size = Number(res.data.size ?? page.size)
- }
-
- // 璁$畻缁熻鏁版嵁
- if (businessSummaryData.value.length > 0) {
- businessSummaryStats.value.totalAmount = businessSummaryData.value.reduce((sum, item) => {
- return sum + (parseFloat(item.purchaseAmount) || 0)
- }, 0)
- businessSummaryStats.value.returnAmount = businessSummaryData.value.reduce((sum, item) => {
- return sum + (parseFloat(item.returnAmount) || 0)
- }, 0)
- businessSummaryStats.value.productTypes = businessSummaryData.value.length
- } else {
- businessSummaryStats.value = {
- totalAmount: 0,
- returnAmount: 0,
- productTypes: 0
- }
- }
+ // 瑙勬牸涓嬫媺閫夐」闅忓綋鍓嶆煡璇㈢粨鏋滃姩鎬佺敓鎴�
+ const specSet = []
+ rows.forEach((item) => {
+ const sp = item.specificationModel
+ if (sp && specSet.indexOf(sp) === -1) specSet.push(sp)
+ })
+ modelOptions.value = specSet.sort().map((sp) => ({ label: sp, value: sp }))
+
+ // 浜у搧瑙勬牸杩囨护
+ if (searchForm.specificationModel) {
+ rows = rows.filter((item) => item.specificationModel === searchForm.specificationModel)
}
+
+ page.total = rows.length
+ if (page.current < 1) page.current = 1
+ const startIdx = (page.current - 1) * page.size
+ businessSummaryData.value = rows.slice(startIdx, startIdx + page.size)
+
+ // 缁熻鎸夊叏閲忚繃婊ょ粨鏋滃彛寰�
+ businessSummaryStats.value.totalAmount = rows.reduce((sum, item) => {
+ return sum + (parseFloat(item.purchaseAmount) || 0)
+ }, 0)
+ businessSummaryStats.value.returnAmount = rows.reduce((sum, item) => {
+ return sum + (parseFloat(item.returnAmount) || 0)
+ }, 0)
+ businessSummaryStats.value.productTypes = rows.length
} catch (error) {
console.error('鏌ヨ澶辫触:', error)
} finally {
@@ -298,7 +320,8 @@
const resetSearch = () => {
Object.assign(searchForm, {
dateRange: [],
- productCategory: ''
+ productCategory: '',
+ specificationModel: ''
})
page.current = 1
handleSearch()
@@ -326,7 +349,7 @@
onMounted(() => {
- // 鍒濆鍖栦骇鍝佺被鍒爲
+ // 鍒濆鍖栦骇鍝佺被鍒爲銆佷骇鍝佽鏍�
getProductOptions()
// 璁剧疆榛樿鏃堕棿鑼冨洿涓烘渶杩�30澶�
diff --git a/src/views/salesManagement/indicatorStats/index.vue b/src/views/salesManagement/indicatorStats/index.vue
index 8ae15ed..862eff5 100644
--- a/src/views/salesManagement/indicatorStats/index.vue
+++ b/src/views/salesManagement/indicatorStats/index.vue
@@ -60,21 +60,7 @@
<!-- 鍥捐〃绛涢�夋潯浠� -->
<div class="chart-filter-section">
<el-row :gutter="16" class="search-row">
- <el-col :xs="24" :sm="12" :md="6">
- <div class="filter-item">
- <label class="filter-label">浜у搧绫诲埆</label>
- <el-tree-select
- v-model="indicatorFilter.productCategory"
- placeholder="璇烽�夋嫨浜у搧绫诲埆"
- clearable
- check-strictly
- :data="productOptions"
- :render-after-expand="false"
- style="width: 100%"
- />
- </div>
- </el-col>
- <el-col :xs="24" :sm="12" :md="6">
+ <el-col :xs="24" :sm="12" :md="8">
<div class="filter-item">
<label class="filter-label">瀹㈡埛</label>
<el-select
@@ -93,7 +79,7 @@
</el-select>
</div>
</el-col>
- <el-col :xs="24" :sm="12" :md="6">
+ <el-col :xs="24" :sm="12" :md="8">
<div class="filter-item">
<label class="filter-label">鏃ユ湡鑼冨洿</label>
<el-date-picker
@@ -107,7 +93,7 @@
/>
</div>
</el-col>
- <el-col :xs="24" :sm="12" :md="6">
+ <el-col :xs="24" :sm="12" :md="8">
<div class="filter-item filter-buttons">
<el-button type="primary" :loading="loading" @click="applyIndicatorFilter">
<el-icon><Search /></el-icon>
--
Gitblit v1.9.3