Selaa lähdekoodia

物资领取归还页面查询,编辑和列表展示相关问题修改

wyn 2 kuukautta sitten
vanhempi
sitoutus
29a661e0bc
1 muutettua tiedostoa jossa 18 lisäystä ja 6 poistoa
  1. 18 6
      src/views/material/coll/index.vue

+ 18 - 6
src/views/material/coll/index.vue

@@ -58,7 +58,8 @@
           range-separator="-"
           start-placeholder="开始日期"
           end-placeholder="结束日期"
-          :default-time="['00:00:00', '23:59:59']"
+          value-format="YYYY-MM-DD HH:mm:ss"
+          :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
           @change="handleClearLoanTime"
           class="!w-240px"
         />
@@ -79,15 +80,16 @@
           range-separator="-"
           start-placeholder="开始日期"
           end-placeholder="结束日期"
-          :default-time="['00:00:00', '23:59:59']"
+          value-format="YYYY-MM-DD HH:mm:ss"
+          :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
           @change="handleClearRestitutionTime"
-          class="!w-240px"
+
         />
       </el-form-item>
       <el-form-item label="状态" prop="status">
         <el-select v-model="queryParams.status" placeholder="请选择状态" class="!w-240px">
           <el-option
-            v-for="dict in getIntDictOptions(DICT_TYPE.RECORD_OF_COLLECTION)"
+            v-for="dict in getStrDictOptions(DICT_TYPE.RECORD_OF_COLLECTION)"
             :key="dict.value"
             :label="dict.label"
             :value="dict.value"
@@ -127,7 +129,7 @@
       <el-table-column label="领取时间" align="center" prop="loanTime" />
       <el-table-column label="归还人" align="center" prop="restitutionUserName" />
       <el-table-column label="归还时间" align="center" prop="actualRestitutionTime" />
-      <el-table-column label="借出时长" align="center" prop="loanDuration" />
+      <el-table-column label="借出时长" align="center" prop="loanDuration" :formatter="formatLoanDuration"/>
       <el-table-column label="状态" align="center" prop="status">
         <template #default="scope">
           <dict-tag :type="DICT_TYPE.RECORD_OF_COLLECTION" :value="scope.row.status" />
@@ -145,7 +147,7 @@
 </template>
 
 <script lang="ts" setup>
-import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
+import { DICT_TYPE, getIntDictOptions,getStrDictOptions } from '@/utils/dict'
 import { handleTree } from '@/utils/tree'
 import * as LoanApi from '@/api/material/loan/index'
 import * as CabinetApi from '@/api/material/lockers/index'
@@ -220,6 +222,14 @@ const getList = async () => {
     loading.value = false
   }
 }
+const formatLoanDuration = (row) => {
+  const duration = row.loanDuration || ''
+  // 假设返回格式是 "0小时 18分 54秒"
+  return duration
+    .replace(/^0小时\s*/, '')   // 去掉开头的 "0小时"
+    .replace(/^0分\s*/, '')     // 如果有 "0分" 在最前面也去掉
+    .trim()
+}
 
 /** 获取物资柜列表 */
 const getCabinets = async () => {
@@ -255,6 +265,8 @@ const resetQuery = () => {
   loanTime.value = null
   restitutionTime.value = null
   queryFormRef.value?.resetFields()
+  queryParams.loanTimeStart = null
+  queryParams.loanTimeEnd = null
   handleQuery()
 }