jinxia.mo 3 semanas atrás
pai
commit
5d394f12e0

+ 5 - 5
back-ui/src/views/dz/cards/index.vue

@@ -1,14 +1,14 @@
 <template>
   <div class="app-page">
-    <el-form :model="queryParams" ref="queryRef" v-show="showSearch" label-width="100px">
+    <el-form :model="queryParams" ref="queryRef" v-show="showSearch" label-width="100px" @submit.prevent="handleQuery">
       <!-- 第一行:卡号段、卡类型、卡分配日期 -->
       <el-row :gutter="20">
         <el-col :span="6">
           <el-form-item label="卡号段" prop="begin">
             <div class="flex items-center gap-x-1">
-              <el-input v-model="queryParams.begin" type="text" maxlength="11" class="w-[85px]!" placeholder="开始卡号" />
+              <el-input v-model="queryParams.begin" type="text" maxlength="11" class="w-[85px]!" placeholder="开始卡号" @keyup.enter="handleQuery" />
               <span class="text-gray-500 text-sm">-</span>
-              <el-input v-model="queryParams.end" type="text" maxlength="11" class="w-[85px]!" placeholder="结束卡号" />
+              <el-input v-model="queryParams.end" type="text" maxlength="11" class="w-[85px]!" placeholder="结束卡号" @keyup.enter="handleQuery" />
             </div>
           </el-form-item>
         </el-col>
@@ -85,13 +85,13 @@
       <el-row :gutter="20">
         <el-col :span="6">
           <el-form-item label="姓名" prop="nickName">
-            <el-input v-model="queryParams.nickName" type="text" class="w-[180px]!" placeholder="请输入姓名" clearable />
+            <el-input v-model="queryParams.nickName" type="text" class="w-[180px]!" placeholder="请输入姓名" clearable @keyup.enter="handleQuery" />
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="手机" prop="phonenumber">
             <el-input v-model="queryParams.phonenumber" type="text" v-number maxlength="11" class="w-[180px]!"
-              placeholder="请输入手机号" clearable />
+              placeholder="请输入手机号" clearable @keyup.enter="handleQuery" />
           </el-form-item>
         </el-col>
         <el-col :span="6">

+ 1 - 1
back-ui/src/views/dz/papers/components/paper-exact-intelligent.vue

@@ -31,7 +31,7 @@ import {useInjectGlobalLoading} from "@/views/hooks/useGlobalLoading.js";
 import BuiltPaperList from "@/views/dz/papers/components/plugs/built-paper-list.vue";
 
 const type = consts.enums.buildType.ExactIntelligent
-const {batchId, batchList, onBatchReady} = useProvidePaperBatchCondition(type)
+const {batchId, batchList, onBatchReady} = useProvidePaperBatchCondition(type, true)
 const {selectedClasses, classList, loadClassStatistic} = useProvidePaperClassStatisticCondition()
 const {loading} = useInjectGlobalLoading()
 const built = ref(null)

+ 14 - 1
back-ui/src/views/dz/papers/hooks/usePaperBatchCondition.js

@@ -3,16 +3,29 @@ import {createEventHook, injectLocal, provideLocal} from "@vueuse/core";
 
 const key = Symbol('PaperBatchCondition')
 
-export const useProvidePaperBatchCondition = function (type) {
+export const useProvidePaperBatchCondition = function (type, autoSelectFirst = false) {
     // 批次
     const buildType = type
     const batchId = ref('')
     const batchList = ref([])
     const batchEvent = createEventHook()
+    let isInitialized = false
 
     onMounted(async () => {
         const res = await getPaperBatches()
         batchList.value = res.data
+        
+        // 如果启用自动选择且列表不为空,且是首次初始化,默认选中最新的第一个
+        if (autoSelectFirst && batchList.value.length > 0 && !isInitialized && !batchId.value) {
+            isInitialized = true
+            // 按创建时间降序排序,选择最新的第一个
+            const sorted = [...batchList.value].sort((a, b) => {
+                const timeA = a.createTime || a.create_time || 0
+                const timeB = b.createTime || b.create_time || 0
+                return timeB - timeA
+            })
+            batchId.value = sorted[0].batchId
+        }
     })
     watch(batchId, async (batchId) => {
         if (batchId) {