瀏覽代碼

fix: 范围查询日期框参数请求接口时自动加1

Tong 2 年之前
父節點
當前提交
36581fd063

+ 10 - 2
src/views/biz/engineer/upkeep/index.vue

@@ -69,6 +69,8 @@
   import { XTTab } from '/@/components/XTTab/index';
   import { XTForm } from '/@/components/XTForm/index';
 
+  import dayjs from 'dayjs';
+
   // 标题数据
   const titleData = [
     {
@@ -86,6 +88,7 @@
       format: 'YYYY-MM-DD',
       valueFormat: 'YYYY-MM-DD',
       placeholder: '请选择日期',
+      defaultValue: dayjs().format('YYYY-MM-DD'),
       width: 280,
     },
     {
@@ -182,13 +185,18 @@
 
   // 表格请求之前,对参数进行处理, 添加默认 排序
   async function handleBeforeFetch(params) {
-    console.log('searchNames:::', searchNames.value);
+    const shiftTimes = [];
+    if (shiftDate.value && shiftDate.value.length > 0) {
+      shiftTimes.push(shiftDate.value[0]);
+      shiftTimes.push(shiftDate.value[1]);
+      shiftTimes[1] = dayjs(shiftTimes[1]).add(1, 'day').format('YYYY-MM-DD');
+    }
     return {
       ...params,
       orders: tableSort.value,
       uniqueCode: searchNames.value == '' ? undefined : searchNames.value,
       maintainCompany: tabSelected.value == '' ? undefined : tabSelected.value,
-      maintainTime: shiftDate.value.length <= 0 ? undefined : shiftDate.value,
+      maintainTime: shiftTimes.length <= 0 ? undefined : shiftTimes,
     };
   }
 

+ 8 - 2
src/views/biz/inventory/pharmaceuticals/index.vue

@@ -89,6 +89,7 @@
   import { XTTitle } from '/@/components/XTTitle/index';
   import { XTTab } from '/@/components/XTTab/index';
   import { XTForm } from '/@/components/XTForm/index';
+  import dayjs from 'dayjs';
 
   // 标题数据
   const titleData = [
@@ -207,13 +208,18 @@
 
   // 表格请求之前,对参数进行处理, 添加默认 排序
   async function handleBeforeFetch(params) {
-    console.log('searchNames:::', searchNames.value);
+    const shiftTimes = [];
+    if (shiftDate.value && shiftDate.value.length > 0) {
+      shiftTimes.push(shiftDate.value[0]);
+      shiftTimes.push(shiftDate.value[1]);
+      shiftTimes[1] = dayjs(shiftTimes[1]).add(1, 'day').format('YYYY-MM-DD');
+    }
     return {
       ...params,
       // orders: tableSort.value,
       name: searchNames.value == '' ? undefined : searchNames.value,
       status: tabSelected.value == '' ? undefined : tabSelected.value,
-      time: shiftDate.value.length <= 0 ? undefined : shiftDate.value,
+      time: shiftTimes.length <= 0 ? undefined : shiftTimes,
     };
   }
 

+ 8 - 2
src/views/biz/inventory/supplies/index.vue

@@ -89,6 +89,7 @@
   import { XTTitle } from '/@/components/XTTitle/index';
   import { XTTab } from '/@/components/XTTab/index';
   import { XTForm } from '/@/components/XTForm/index';
+  import dayjs from 'dayjs';
 
   // 标题数据
   const titleData = [
@@ -220,13 +221,18 @@
 
   // 表格请求之前,对参数进行处理, 添加默认 排序
   async function handleBeforeFetch(params) {
-    console.log('searchNames:::', searchNames.value);
+    const shiftTimes = [];
+    if (shiftDate.value && shiftDate.value.length > 0) {
+      shiftTimes.push(shiftDate.value[0]);
+      shiftTimes.push(shiftDate.value[1]);
+      shiftTimes[1] = dayjs(shiftTimes[1]).add(1, 'day').format('YYYY-MM-DD');
+    }
     return {
       ...params,
       orders: tableSort.value,
       name: searchNames.value == '' ? undefined : searchNames.value,
       status: tabSelected.value == '' ? undefined : tabSelected.value,
-      time: shiftDate.value.length <= 0 ? undefined : shiftDate.value,
+      time: shiftTimes.length <= 0 ? undefined : shiftTimes,
     };
   }