zlwu пре 11 месеци
родитељ
комит
7f1ea42260

+ 2 - 0
art-design-pro/src/api/plansApi.ts

@@ -68,6 +68,8 @@ export const planApi = {
     q?: string
     q?: string
     businessType?: '入库' | '出库'
     businessType?: '入库' | '出库'
     executionStatus?: string
     executionStatus?: string
+    createdFrom?: string
+    createdTo?: string
   }): Promise<Plan[]> => {
   }): Promise<Plan[]> => {
     return api.get<Plan[]>({
     return api.get<Plan[]>({
       url: '/plans',
       url: '/plans',

+ 79 - 3
art-design-pro/src/views/inventory/index.vue

@@ -32,6 +32,32 @@
           <el-icon><Document /></el-icon>
           <el-icon><Document /></el-icon>
           导出 Excel
           导出 Excel
         </el-button>
         </el-button>
+        <el-button-group>
+          <el-button
+            :type="dateFilterType === 'all' ? 'primary' : 'default'"
+            @click="setDateFilter('all')"
+          >
+            全部
+          </el-button>
+          <el-button
+            :type="dateFilterType === 'today' ? 'primary' : 'default'"
+            @click="setDateFilter('today')"
+          >
+            今日
+          </el-button>
+          <el-button
+            :type="dateFilterType === 'yesterday' ? 'primary' : 'default'"
+            @click="setDateFilter('yesterday')"
+          >
+            昨日
+          </el-button>
+          <el-button
+            :type="dateFilterType === 'week' ? 'primary' : 'default'"
+            @click="setDateFilter('week')"
+          >
+            本周
+          </el-button>
+        </el-button-group>
       </div>
       </div>
 
 
       <art-table
       <art-table
@@ -45,7 +71,7 @@
         @current-change="handlePageChange"
         @current-change="handlePageChange"
         @size-change="handleSizeChange"
         @size-change="handleSizeChange"
       >
       >
-        <el-table-column prop="planNo" label="计划号" min-width="120" />
+        <el-table-column prop="planNo" label="计划号" min-width="200" />
         <el-table-column prop="batchNo" label="出入库单号" min-width="140" />
         <el-table-column prop="batchNo" label="出入库单号" min-width="140" />
         <el-table-column prop="date" label="日期" min-width="120" />
         <el-table-column prop="date" label="日期" min-width="120" />
         <el-table-column prop="partnerCompany" label="往来单位" min-width="150" />
         <el-table-column prop="partnerCompany" label="往来单位" min-width="150" />
@@ -306,6 +332,7 @@
   const currentPage = ref(1)
   const currentPage = ref(1)
   const pageSize = ref(10)
   const pageSize = ref(10)
   const searchKeyword = ref('')
   const searchKeyword = ref('')
+  const dateFilterType = ref<'all' | 'today' | 'yesterday' | 'week'>('all')
 
 
   const modalOpen = ref(false)
   const modalOpen = ref(false)
   const editingRecord = ref<InventoryRecord | null>(null)
   const editingRecord = ref<InventoryRecord | null>(null)
@@ -371,7 +398,28 @@
   const loadData = async () => {
   const loadData = async () => {
     loading.value = true
     loading.value = true
     try {
     try {
-      const records = await inventoryApi.list({ q: searchKeyword.value || undefined })
+      const params: any = {
+        q: searchKeyword.value || undefined
+      }
+      const today = dayjs().format('YYYY-MM-DD')
+      if (dateFilterType.value === 'today') {
+        params.dateFrom = today
+        params.dateTo = today
+      } else if (dateFilterType.value === 'yesterday') {
+        const y = dayjs().subtract(1, 'day').format('YYYY-MM-DD')
+        params.dateFrom = y
+        params.dateTo = y
+      } else if (dateFilterType.value === 'week') {
+        // 本周:周一到周日
+        const today = dayjs()
+        const weekday = today.day() === 0 ? 7 : today.day()
+        const monday = today.subtract(weekday - 1, 'day').format('YYYY-MM-DD')
+        const sunday = today.add(7 - weekday, 'day').format('YYYY-MM-DD')
+        params.dateFrom = monday
+        params.dateTo = sunday
+      }
+
+      const records = await inventoryApi.list(params)
       total.value = records.length
       total.value = records.length
       // 根据当前页和每页大小进行数据切片
       // 根据当前页和每页大小进行数据切片
       const start = (currentPage.value - 1) * pageSize.value
       const start = (currentPage.value - 1) * pageSize.value
@@ -389,6 +437,12 @@
     loadData()
     loadData()
   }
   }
 
 
+  const setDateFilter = (type: 'today' | 'yesterday' | 'week') => {
+    dateFilterType.value = type
+    currentPage.value = 1
+    loadData()
+  }
+
   const handlePageChange = (page: number) => {
   const handlePageChange = (page: number) => {
     currentPage.value = page
     currentPage.value = page
     loadData()
     loadData()
@@ -554,7 +608,29 @@
 
 
   const handleExport = async () => {
   const handleExport = async () => {
     try {
     try {
-      const records = await inventoryApi.list({})
+      const params: any = {}
+      if (searchKeyword.value) {
+        params.q = searchKeyword.value
+      }
+      const today = dayjs().format('YYYY-MM-DD')
+      if (dateFilterType.value === 'today') {
+        params.dateFrom = today
+        params.dateTo = today
+      } else if (dateFilterType.value === 'yesterday') {
+        const y = dayjs().subtract(1, 'day').format('YYYY-MM-DD')
+        params.dateFrom = y
+        params.dateTo = y
+      } else if (dateFilterType.value === 'week') {
+        // 本周:周一到周日
+        const today = dayjs()
+        const weekday = today.day() === 0 ? 7 : today.day()
+        const monday = today.subtract(weekday - 1, 'day').format('YYYY-MM-DD')
+        const sunday = today.add(7 - weekday, 'day').format('YYYY-MM-DD')
+        params.dateFrom = monday
+        params.dateTo = sunday
+      }
+
+      const records = await inventoryApi.list(params)
       if (records.length === 0) {
       if (records.length === 0) {
         ElMessage.warning('没有数据可导出')
         ElMessage.warning('没有数据可导出')
         return
         return

+ 80 - 2
art-design-pro/src/views/plans/index.vue

@@ -44,6 +44,32 @@
           <el-icon><Document /></el-icon>
           <el-icon><Document /></el-icon>
           导出 Excel
           导出 Excel
         </el-button>
         </el-button>
+        <el-button-group>
+          <el-button
+            :type="dateFilterType === 'all' ? 'primary' : 'default'"
+            @click="setDateFilter('all')"
+          >
+            全部
+          </el-button>
+          <el-button
+            :type="dateFilterType === 'today' ? 'primary' : 'default'"
+            @click="setDateFilter('today')"
+          >
+            今日
+          </el-button>
+          <el-button
+            :type="dateFilterType === 'yesterday' ? 'primary' : 'default'"
+            @click="setDateFilter('yesterday')"
+          >
+            昨日
+          </el-button>
+          <el-button
+            :type="dateFilterType === 'week' ? 'primary' : 'default'"
+            @click="setDateFilter('week')"
+          >
+            本周
+          </el-button>
+        </el-button-group>
       </div>
       </div>
 
 
       <!-- 表格 -->
       <!-- 表格 -->
@@ -324,6 +350,7 @@
   const currentPage = ref(1)
   const currentPage = ref(1)
   const pageSize = ref(10)
   const pageSize = ref(10)
   const searchKeyword = ref('')
   const searchKeyword = ref('')
+  const dateFilterType = ref<'all' | 'today' | 'yesterday' | 'week'>('all')
 
 
   const modalOpen = ref(false)
   const modalOpen = ref(false)
   const editingPlan = ref<Plan | null>(null)
   const editingPlan = ref<Plan | null>(null)
@@ -399,7 +426,29 @@
   const loadData = async () => {
   const loadData = async () => {
     loading.value = true
     loading.value = true
     try {
     try {
-      const plans = await planApi.list({ q: searchKeyword.value || undefined })
+      const params: any = {
+        q: searchKeyword.value || undefined
+      }
+      // 计划按创建时间筛选
+      const today = dayjs().format('YYYY-MM-DD')
+      if (dateFilterType.value === 'today') {
+        params.createdFrom = today
+        params.createdTo = today
+      } else if (dateFilterType.value === 'yesterday') {
+        const y = dayjs().subtract(1, 'day').format('YYYY-MM-DD')
+        params.createdFrom = y
+        params.createdTo = y
+      } else if (dateFilterType.value === 'week') {
+        // 本周:周一到周日(按创建时间过滤)
+        const today = dayjs()
+        const weekday = today.day() === 0 ? 7 : today.day()
+        const monday = today.subtract(weekday - 1, 'day').format('YYYY-MM-DD')
+        const sunday = today.add(7 - weekday, 'day').format('YYYY-MM-DD')
+        params.createdFrom = monday
+        params.createdTo = sunday
+      }
+
+      const plans = await planApi.list(params)
       total.value = plans.length
       total.value = plans.length
       // 根据当前页和每页大小进行数据切片
       // 根据当前页和每页大小进行数据切片
       const start = (currentPage.value - 1) * pageSize.value
       const start = (currentPage.value - 1) * pageSize.value
@@ -436,6 +485,12 @@
     loadData()
     loadData()
   }
   }
 
 
+  const setDateFilter = (type: 'today' | 'yesterday' | 'week') => {
+    dateFilterType.value = type
+    currentPage.value = 1
+    loadData()
+  }
+
   // 分页变化
   // 分页变化
   const handlePageChange = (page: number) => {
   const handlePageChange = (page: number) => {
     currentPage.value = page
     currentPage.value = page
@@ -601,7 +656,30 @@
   // 导出Excel
   // 导出Excel
   const handleExport = async () => {
   const handleExport = async () => {
     try {
     try {
-      const planList = await planApi.list({})
+      const params: any = {}
+      // 和列表保持一致:支持关键字和日期筛选
+      if (searchKeyword.value) {
+        params.q = searchKeyword.value
+      }
+      const today = dayjs().format('YYYY-MM-DD')
+      if (dateFilterType.value === 'today') {
+        params.createdFrom = today
+        params.createdTo = today
+      } else if (dateFilterType.value === 'yesterday') {
+        const y = dayjs().subtract(1, 'day').format('YYYY-MM-DD')
+        params.createdFrom = y
+        params.createdTo = y
+      } else if (dateFilterType.value === 'week') {
+        // 本周:周一到周日(按创建时间过滤)
+        const today = dayjs()
+        const weekday = today.day() === 0 ? 7 : today.day()
+        const monday = today.subtract(weekday - 1, 'day').format('YYYY-MM-DD')
+        const sunday = today.add(7 - weekday, 'day').format('YYYY-MM-DD')
+        params.createdFrom = monday
+        params.createdTo = sunday
+      }
+
+      const planList = await planApi.list(params)
       if (planList.length === 0) {
       if (planList.length === 0) {
         ElMessage.warning('没有数据可导出')
         ElMessage.warning('没有数据可导出')
         return
         return

+ 76 - 7
art-design-pro/src/views/weighing/index.vue

@@ -29,6 +29,32 @@
           <el-icon><Document /></el-icon>
           <el-icon><Document /></el-icon>
           导出 Excel
           导出 Excel
         </el-button>
         </el-button>
+        <el-button-group>
+          <el-button
+            :type="dateFilterType === 'all' ? 'primary' : 'default'"
+            @click="setDateFilter('all')"
+          >
+            全部
+          </el-button>
+          <el-button
+            :type="dateFilterType === 'today' ? 'primary' : 'default'"
+            @click="setDateFilter('today')"
+          >
+            今日
+          </el-button>
+          <el-button
+            :type="dateFilterType === 'yesterday' ? 'primary' : 'default'"
+            @click="setDateFilter('yesterday')"
+          >
+            昨日
+          </el-button>
+          <el-button
+            :type="dateFilterType === 'week' ? 'primary' : 'default'"
+            @click="setDateFilter('week')"
+          >
+            本周
+          </el-button>
+        </el-button-group>
       </div>
       </div>
 
 
       <art-table
       <art-table
@@ -47,7 +73,7 @@
             {{ row.inventoryDate || (row.grossWeightTime ? row.grossWeightTime.split(' ')[0] : (row.createdAt ? row.createdAt.split(' ')[0] : '')) }}
             {{ row.inventoryDate || (row.grossWeightTime ? row.grossWeightTime.split(' ')[0] : (row.createdAt ? row.createdAt.split(' ')[0] : '')) }}
           </template>
           </template>
         </el-table-column>
         </el-table-column>
-        <el-table-column prop="planNo" label="计划单号" min-width="120" />
+        <el-table-column prop="planNo" label="计划单号" min-width="200" />
         <el-table-column prop="batchNo" label="出入库单号" min-width="140" />
         <el-table-column prop="batchNo" label="出入库单号" min-width="140" />
         <el-table-column prop="vehicleNo" label="车牌号" min-width="120" />
         <el-table-column prop="vehicleNo" label="车牌号" min-width="120" />
         <el-table-column prop="cargoName" label="货物名称" min-width="150" />
         <el-table-column prop="cargoName" label="货物名称" min-width="150" />
@@ -79,7 +105,7 @@
             {{ row.deduction || 0 }}
             {{ row.deduction || 0 }}
           </template>
           </template>
         </el-table-column>
         </el-table-column>
-        <el-table-column label="操作" width="280" fixed="right">
+        <el-table-column label="操作" width="220" fixed="right">
           <template #default="{ row }">
           <template #default="{ row }">
             <el-button link type="primary" @click="handleView(row)">
             <el-button link type="primary" @click="handleView(row)">
               <el-icon><View /></el-icon>
               <el-icon><View /></el-icon>
@@ -98,10 +124,6 @@
               <el-icon><Close /></el-icon>
               <el-icon><Close /></el-icon>
               作废
               作废
             </el-button>
             </el-button>
-            <el-button link type="danger" @click="handleDelete(row.id)">
-              <el-icon><Delete /></el-icon>
-              删除
-            </el-button>
           </template>
           </template>
         </el-table-column>
         </el-table-column>
       </art-table>
       </art-table>
@@ -394,6 +416,7 @@
   const currentPage = ref(1)
   const currentPage = ref(1)
   const pageSize = ref(10)
   const pageSize = ref(10)
   const searchKeyword = ref('')
   const searchKeyword = ref('')
+  const dateFilterType = ref<'all' | 'today' | 'yesterday' | 'week'>('all')
   const companies = ref<Company[]>([])
   const companies = ref<Company[]>([])
   const cargos = ref<Cargo[]>([])
   const cargos = ref<Cargo[]>([])
   const route = useRoute()
   const route = useRoute()
@@ -491,6 +514,36 @@
     return allData.value.slice(start, end)
     return allData.value.slice(start, end)
   })
   })
 
 
+  const dateRange = computed(() => {
+    const today = dayjs().format('YYYY-MM-DD')
+
+    if (dateFilterType.value === 'today') {
+      return { dateFrom: today, dateTo: today }
+    }
+
+    if (dateFilterType.value === 'yesterday') {
+      const y = dayjs().subtract(1, 'day').format('YYYY-MM-DD')
+      return { dateFrom: y, dateTo: y }
+    }
+
+    if (dateFilterType.value === 'week') {
+      // 本周:周一到周日
+      const today = dayjs()
+      const weekday = today.day() === 0 ? 7 : today.day() // 1-7,周一=1,周日=7
+      const monday = today.subtract(weekday - 1, 'day').format('YYYY-MM-DD')
+      const sunday = today.add(7 - weekday, 'day').format('YYYY-MM-DD')
+      return { dateFrom: monday, dateTo: sunday }
+    }
+
+    return { dateFrom: undefined, dateTo: undefined }
+  })
+
+  const setDateFilter = (type: 'today' | 'yesterday' | 'week') => {
+    dateFilterType.value = type
+    currentPage.value = 1
+    loadData()
+  }
+
   const loadData = async () => {
   const loadData = async () => {
     loading.value = true
     loading.value = true
     try {
     try {
@@ -498,6 +551,12 @@
       if (searchKeyword.value) {
       if (searchKeyword.value) {
         params.vehicleNo = searchKeyword.value
         params.vehicleNo = searchKeyword.value
       }
       }
+      if (dateRange.value.dateFrom) {
+        params.dateFrom = dateRange.value.dateFrom
+      }
+      if (dateRange.value.dateTo) {
+        params.dateTo = dateRange.value.dateTo
+      }
       const records = await weighingApi.list(params)
       const records = await weighingApi.list(params)
       allData.value = records
       allData.value = records
       total.value = records.length
       total.value = records.length
@@ -694,7 +753,17 @@
 
 
   const handleExport = async () => {
   const handleExport = async () => {
     try {
     try {
-      const records = await weighingApi.list({})
+      const params: any = {}
+      if (searchKeyword.value) {
+        params.vehicleNo = searchKeyword.value
+      }
+      if (dateRange.value.dateFrom) {
+        params.dateFrom = dateRange.value.dateFrom
+      }
+      if (dateRange.value.dateTo) {
+        params.dateTo = dateRange.value.dateTo
+      }
+      const records = await weighingApi.list(params)
       if (records.length === 0) {
       if (records.length === 0) {
         ElMessage.warning('没有数据可导出')
         ElMessage.warning('没有数据可导出')
         return
         return

+ 3 - 2
backend/app/api/routes/inventory.py

@@ -61,8 +61,9 @@ async def _generate_batch_no(session: AsyncSession) -> str:
 @router.get("/", response_model=list[InboundOutboundRead])
 @router.get("/", response_model=list[InboundOutboundRead])
 async def list_inventory(
 async def list_inventory(
     q: str | None = Query(default=None, description="模糊搜索往来单位或产品"),
     q: str | None = Query(default=None, description="模糊搜索往来单位或产品"),
-    date_from: str | None = Query(default=None, description="开始日期"),
-    date_to: str | None = Query(default=None, description="结束日期"),
+    # 前端使用的是 dateFrom / dateTo,这里通过 alias 做映射
+    date_from: str | None = Query(default=None, alias="dateFrom", description="开始日期"),
+    date_to: str | None = Query(default=None, alias="dateTo", description="结束日期"),
     status_filter: str | None = Query(default=None, alias="status", description="状态筛选"),
     status_filter: str | None = Query(default=None, alias="status", description="状态筛选"),
     business_type: str | None = Query(default=None, alias="businessType", description="业务类型"),
     business_type: str | None = Query(default=None, alias="businessType", description="业务类型"),
     session: AsyncSession = Depends(get_async_session),
     session: AsyncSession = Depends(get_async_session),

+ 10 - 0
backend/app/api/routes/plans.py

@@ -28,8 +28,11 @@ async def list_plans(
     q: str | None = Query(default=None, description="模糊搜索往来单位或产品"),
     q: str | None = Query(default=None, description="模糊搜索往来单位或产品"),
     business_type: str | None = Query(default=None, alias="businessType", description="业务类型"),
     business_type: str | None = Query(default=None, alias="businessType", description="业务类型"),
     execution_status: str | None = Query(default=None, alias="executionStatus", description="执行状态"),
     execution_status: str | None = Query(default=None, alias="executionStatus", description="执行状态"),
+    created_from: str | None = Query(default=None, alias="createdFrom", description="创建开始日期"),
+    created_to: str | None = Query(default=None, alias="createdTo", description="创建结束日期"),
     session: AsyncSession = Depends(get_async_session),
     session: AsyncSession = Depends(get_async_session),
 ) -> list[PurchasePlan]:
 ) -> list[PurchasePlan]:
+    # 默认按创建时间倒序
     query = _base_query().order_by(PurchasePlan.created_at.desc())
     query = _base_query().order_by(PurchasePlan.created_at.desc())
 
 
     if q:
     if q:
@@ -45,6 +48,13 @@ async def list_plans(
     if execution_status:
     if execution_status:
         query = query.where(PurchasePlan.execution_status == execution_status)
         query = query.where(PurchasePlan.execution_status == execution_status)
 
 
+    # 按创建时间过滤(日期粒度)
+    if created_from:
+        query = query.where(PurchasePlan.created_at >= created_from)
+
+    if created_to:
+        query = query.where(PurchasePlan.created_at <= created_to + " 23:59:59")
+
     result = await session.exec(query)
     result = await session.exec(query)
     return result.all()
     return result.all()
 
 

+ 2 - 0
mobile-h5/src/api/plansApi.ts

@@ -68,6 +68,8 @@ export const planApi = {
     q?: string
     q?: string
     businessType?: '入库' | '出库'
     businessType?: '入库' | '出库'
     executionStatus?: string
     executionStatus?: string
+    createdFrom?: string
+    createdTo?: string
   }): Promise<Plan[]> => {
   }): Promise<Plan[]> => {
     return api.get<Plan[]>({
     return api.get<Plan[]>({
       url: '/plans',
       url: '/plans',

+ 76 - 2
mobile-h5/src/views/inventory/index.vue

@@ -17,6 +17,17 @@
       />
       />
       <van-button type="primary" size="normal" class="search-button" @click="handleSearch">搜索</van-button>
       <van-button type="primary" size="normal" class="search-button" @click="handleSearch">搜索</van-button>
     </div>
     </div>
+    <div class="filter-bar">
+      <div
+        v-for="item in dateFilterOptions"
+        :key="item.value"
+        class="filter-chip"
+        :class="{ active: dateFilterType === item.value }"
+        @click="setDateFilter(item.value)"
+      >
+        {{ item.label }}
+      </div>
+    </div>
 
 
     <van-list
     <van-list
       v-model:loading="loading"
       v-model:loading="loading"
@@ -267,6 +278,7 @@
 
 
 <script setup lang="ts">
 <script setup lang="ts">
 import { ref, onMounted } from 'vue'
 import { ref, onMounted } from 'vue'
+import dayjs from 'dayjs'
 import { useRoute, useRouter } from 'vue-router'
 import { useRoute, useRouter } from 'vue-router'
 import { showToast, showDialog } from 'vant'
 import { showToast, showDialog } from 'vant'
 import { inventoryApi, type InventoryRecord } from '@/api/inventoryApi'
 import { inventoryApi, type InventoryRecord } from '@/api/inventoryApi'
@@ -283,6 +295,14 @@ const allData = ref<InventoryRecord[]>([]) // 存储所有数据
 const searchKeyword = ref('')
 const searchKeyword = ref('')
 const currentPage = ref(1)
 const currentPage = ref(1)
 const pageSize = ref(20)
 const pageSize = ref(20)
+const dateFilterType = ref<'all' | 'today' | 'yesterday' | 'week'>('all')
+
+const dateFilterOptions = [
+  { label: '全部', value: 'all' },
+  { label: '今日', value: 'today' },
+  { label: '昨日', value: 'yesterday' },
+  { label: '本周', value: 'week' }
+] as const
 
 
 // 关联数据相关
 // 关联数据相关
 const relatedModalOpen = ref(false)
 const relatedModalOpen = ref(false)
@@ -301,7 +321,28 @@ const loadData = async (reset = false) => {
   try {
   try {
     // 如果是第一页或搜索,重新获取所有数据
     // 如果是第一页或搜索,重新获取所有数据
     if (reset || currentPage.value === 1) {
     if (reset || currentPage.value === 1) {
-      const records = await inventoryApi.list({ q: searchKeyword.value || undefined })
+      const params: any = {
+        q: searchKeyword.value || undefined
+      }
+      const today = dayjs()
+      if (dateFilterType.value === 'today') {
+        const d = today.format('YYYY-MM-DD')
+        params.dateFrom = d
+        params.dateTo = d
+      } else if (dateFilterType.value === 'yesterday') {
+        const y = today.subtract(1, 'day').format('YYYY-MM-DD')
+        params.dateFrom = y
+        params.dateTo = y
+      } else if (dateFilterType.value === 'week') {
+        // 本周:周一到周日
+        const weekday = today.day() === 0 ? 7 : today.day()
+        const monday = today.subtract(weekday - 1, 'day').format('YYYY-MM-DD')
+        const sunday = today.add(7 - weekday, 'day').format('YYYY-MM-DD')
+        params.dateFrom = monday
+        params.dateTo = sunday
+      }
+
+      const records = await inventoryApi.list(params)
       allData.value = records
       allData.value = records
     }
     }
 
 
@@ -341,6 +382,12 @@ const handleSearch = () => {
   loadData(true) // 重置并重新加载
   loadData(true) // 重置并重新加载
 }
 }
 
 
+const setDateFilter = (type: (typeof dateFilterOptions)[number]['value']) => {
+  if (dateFilterType.value === type) return
+  dateFilterType.value = type
+  loadData(true)
+}
+
 const handleBack = () => {
 const handleBack = () => {
   // 如果是从计划管理跳转过来的,返回到计划管理页面
   // 如果是从计划管理跳转过来的,返回到计划管理页面
   if (route.query.from === 'plans') {
   if (route.query.from === 'plans') {
@@ -479,10 +526,37 @@ onMounted(() => {
 .search-bar {
 .search-bar {
   padding: 0px 16px;
   padding: 0px 16px;
   background: #fff;
   background: #fff;
-  border-bottom: 1px solid #e5e7eb;
+  border-bottom: 0;
+  display: flex;
+  align-items: center;
+  gap: 8px;
+}
+
+.filter-bar {
   display: flex;
   display: flex;
   align-items: center;
   align-items: center;
   gap: 8px;
   gap: 8px;
+  padding: 8px 16px 4px;
+  background: #fff;
+  border-bottom: 1px solid #f3f4f6;
+  overflow-x: auto;
+}
+
+.filter-chip {
+  flex-shrink: 0;
+  padding: 4px 10px;
+  font-size: 13px;
+  border-radius: 999px;
+  border: 1px solid #d1d5db;
+  color: #4b5563;
+  background-color: #fff;
+  line-height: 1.4;
+}
+
+.filter-chip.active {
+  border-color: #52b788;
+  background-color: #52b788;
+  color: #fff;
 }
 }
 
 
 .search-input {
 .search-input {

+ 77 - 2
mobile-h5/src/views/plans/index.vue

@@ -17,6 +17,17 @@
       />
       />
       <van-button type="primary" size="normal" class="search-button" @click="handleSearch">搜索</van-button>
       <van-button type="primary" size="normal" class="search-button" @click="handleSearch">搜索</van-button>
     </div>
     </div>
+    <div class="filter-bar">
+      <div
+        v-for="item in dateFilterOptions"
+        :key="item.value"
+        class="filter-chip"
+        :class="{ active: dateFilterType === item.value }"
+        @click="setDateFilter(item.value)"
+      >
+        {{ item.label }}
+      </div>
+    </div>
 
 
     <van-list
     <van-list
       v-model:loading="loading"
       v-model:loading="loading"
@@ -215,6 +226,7 @@
 
 
 <script setup lang="ts">
 <script setup lang="ts">
 import { ref, computed, onMounted } from 'vue'
 import { ref, computed, onMounted } from 'vue'
+import dayjs from 'dayjs'
 import { useRouter } from 'vue-router'
 import { useRouter } from 'vue-router'
 import { showToast, showDialog } from 'vant'
 import { showToast, showDialog } from 'vant'
 import { planApi, type Plan } from '@/api/plansApi'
 import { planApi, type Plan } from '@/api/plansApi'
@@ -230,6 +242,14 @@ const allData = ref<Plan[]>([]) // 存储所有数据
 const searchKeyword = ref('')
 const searchKeyword = ref('')
 const currentPage = ref(1)
 const currentPage = ref(1)
 const pageSize = ref(20)
 const pageSize = ref(20)
+const dateFilterType = ref<'all' | 'today' | 'yesterday' | 'week'>('all')
+
+const dateFilterOptions = [
+  { label: '全部', value: 'all' },
+  { label: '今日', value: 'today' },
+  { label: '昨日', value: 'yesterday' },
+  { label: '本周', value: 'week' }
+] as const
 
 
 // 关联数据相关
 // 关联数据相关
 const relatedModalOpen = ref(false)
 const relatedModalOpen = ref(false)
@@ -314,7 +334,29 @@ const loadData = async (reset = false) => {
   try {
   try {
     // 如果是第一页或搜索,重新获取所有数据
     // 如果是第一页或搜索,重新获取所有数据
     if (reset || currentPage.value === 1) {
     if (reset || currentPage.value === 1) {
-      const plans = await planApi.list({ q: searchKeyword.value || undefined })
+      const params: any = {
+        q: searchKeyword.value || undefined
+      }
+      // 按创建时间过滤(与 web 端保持一致)
+      const today = dayjs()
+      if (dateFilterType.value === 'today') {
+        const d = today.format('YYYY-MM-DD')
+        params.createdFrom = d
+        params.createdTo = d
+      } else if (dateFilterType.value === 'yesterday') {
+        const y = today.subtract(1, 'day').format('YYYY-MM-DD')
+        params.createdFrom = y
+        params.createdTo = y
+      } else if (dateFilterType.value === 'week') {
+        // 本周:周一到周日
+        const weekday = today.day() === 0 ? 7 : today.day()
+        const monday = today.subtract(weekday - 1, 'day').format('YYYY-MM-DD')
+        const sunday = today.add(7 - weekday, 'day').format('YYYY-MM-DD')
+        params.createdFrom = monday
+        params.createdTo = sunday
+      }
+
+      const plans = await planApi.list(params)
       allData.value = plans
       allData.value = plans
     }
     }
 
 
@@ -354,6 +396,12 @@ const handleSearch = () => {
   loadData(true) // 重置并重新加载
   loadData(true) // 重置并重新加载
 }
 }
 
 
+const setDateFilter = (type: (typeof dateFilterOptions)[number]['value']) => {
+  if (dateFilterType.value === type) return
+  dateFilterType.value = type
+  loadData(true)
+}
+
 const handleBack = () => {
 const handleBack = () => {
   router.push('/dashboard')
   router.push('/dashboard')
 }
 }
@@ -459,12 +507,39 @@ onMounted(() => {
 .search-bar {
 .search-bar {
   padding: 0px 16px;
   padding: 0px 16px;
   background: #fff;
   background: #fff;
-  border-bottom: 1px solid #e5e7eb;
+  border-bottom: 0;
   display: flex;
   display: flex;
   align-items: center;
   align-items: center;
   gap: 8px;
   gap: 8px;
 }
 }
 
 
+.filter-bar {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  padding: 8px 16px 4px;
+  background: #fff;
+  border-bottom: 1px solid #f3f4f6;
+  overflow-x: auto;
+}
+
+.filter-chip {
+  flex-shrink: 0;
+  padding: 4px 10px;
+  font-size: 13px;
+  border-radius: 999px;
+  border: 1px solid #d1d5db;
+  color: #4b5563;
+  background-color: #fff;
+  line-height: 1.4;
+}
+
+.filter-chip.active {
+  border-color: #52b788;
+  background-color: #52b788;
+  color: #fff;
+}
+
 .search-input {
 .search-input {
   flex: 1;
   flex: 1;
   
   

+ 73 - 2
mobile-h5/src/views/weighing/index.vue

@@ -17,6 +17,17 @@
       />
       />
       <van-button type="primary" size="normal" class="search-button" @click="handleSearch">搜索</van-button>
       <van-button type="primary" size="normal" class="search-button" @click="handleSearch">搜索</van-button>
     </div>
     </div>
+    <div class="filter-bar">
+      <div
+        v-for="item in dateFilterOptions"
+        :key="item.value"
+        class="filter-chip"
+        :class="{ active: dateFilterType === item.value }"
+        @click="setDateFilter(item.value)"
+      >
+        {{ item.label }}
+      </div>
+    </div>
 
 
     <van-list
     <van-list
       v-model:loading="loading"
       v-model:loading="loading"
@@ -92,7 +103,6 @@
             >
             >
               作废
               作废
             </van-button>
             </van-button>
-            <van-button size="small" type="danger" plain @click.stop="handleDelete(item.id)">删除</van-button>
           </div>
           </div>
         </div>
         </div>
       </div>
       </div>
@@ -247,6 +257,7 @@
 
 
 <script setup lang="ts">
 <script setup lang="ts">
 import { ref, onMounted } from 'vue'
 import { ref, onMounted } from 'vue'
+import dayjs from 'dayjs'
 import { useRoute, useRouter } from 'vue-router'
 import { useRoute, useRouter } from 'vue-router'
 import { showToast, showDialog } from 'vant'
 import { showToast, showDialog } from 'vant'
 import { weighingApi, type WeighingRecord } from '@/api/weighingApi'
 import { weighingApi, type WeighingRecord } from '@/api/weighingApi'
@@ -263,6 +274,14 @@ const allData = ref<WeighingRecord[]>([]) // 存储所有数据
 const searchKeyword = ref('')
 const searchKeyword = ref('')
 const currentPage = ref(1)
 const currentPage = ref(1)
 const pageSize = ref(20)
 const pageSize = ref(20)
+const dateFilterType = ref<'all' | 'today' | 'yesterday' | 'week'>('all')
+
+const dateFilterOptions = [
+  { label: '全部', value: 'all' },
+  { label: '今日', value: 'today' },
+  { label: '昨日', value: 'yesterday' },
+  { label: '本周', value: 'week' }
+] as const
 
 
 // 关联数据相关
 // 关联数据相关
 const relatedModalOpen = ref(false)
 const relatedModalOpen = ref(false)
@@ -286,6 +305,25 @@ const loadData = async (reset = false) => {
       if (searchKeyword.value) {
       if (searchKeyword.value) {
         params.vehicleNo = searchKeyword.value
         params.vehicleNo = searchKeyword.value
       }
       }
+      // 按毛重时间日期过滤(和 web 端一致)
+      const today = dayjs()
+      if (dateFilterType.value === 'today') {
+        const d = today.format('YYYY-MM-DD')
+        params.dateFrom = d
+        params.dateTo = d
+      } else if (dateFilterType.value === 'yesterday') {
+        const y = today.subtract(1, 'day').format('YYYY-MM-DD')
+        params.dateFrom = y
+        params.dateTo = y
+      } else if (dateFilterType.value === 'week') {
+        // 本周:周一到周日
+        const weekday = today.day() === 0 ? 7 : today.day()
+        const monday = today.subtract(weekday - 1, 'day').format('YYYY-MM-DD')
+        const sunday = today.add(7 - weekday, 'day').format('YYYY-MM-DD')
+        params.dateFrom = monday
+        params.dateTo = sunday
+      }
+
       const records = await weighingApi.list(params)
       const records = await weighingApi.list(params)
       allData.value = records
       allData.value = records
     }
     }
@@ -326,6 +364,12 @@ const handleSearch = () => {
   loadData(true) // 重置并重新加载
   loadData(true) // 重置并重新加载
 }
 }
 
 
+const setDateFilter = (type: (typeof dateFilterOptions)[number]['value']) => {
+  if (dateFilterType.value === type) return
+  dateFilterType.value = type
+  loadData(true)
+}
+
 const handleBack = () => {
 const handleBack = () => {
   // 如果是从出入库管理跳转过来的,返回到出入库管理页面
   // 如果是从出入库管理跳转过来的,返回到出入库管理页面
   if (route.query.from === 'inventory') {
   if (route.query.from === 'inventory') {
@@ -457,10 +501,37 @@ onMounted(() => {
 .search-bar {
 .search-bar {
   padding: 0px 16px;
   padding: 0px 16px;
   background: #fff;
   background: #fff;
-  border-bottom: 1px solid #e5e7eb;
+  border-bottom: 0;
+  display: flex;
+  align-items: center;
+  gap: 8px;
+}
+
+.filter-bar {
   display: flex;
   display: flex;
   align-items: center;
   align-items: center;
   gap: 8px;
   gap: 8px;
+  padding: 8px 16px 4px;
+  background: #fff;
+  border-bottom: 1px solid #f3f4f6;
+  overflow-x: auto;
+}
+
+.filter-chip {
+  flex-shrink: 0;
+  padding: 4px 10px;
+  font-size: 13px;
+  border-radius: 999px;
+  border: 1px solid #d1d5db;
+  color: #4b5563;
+  background-color: #fff;
+  line-height: 1.4;
+}
+
+.filter-chip.active {
+  border-color: #52b788;
+  background-color: #52b788;
+  color: #fff;
 }
 }
 
 
 .search-input {
 .search-input {