Przeglądaj źródła

fix: 查房记录日期查询修改

han 2 lat temu
rodzic
commit
65369fc7b5
1 zmienionych plików z 10 dodań i 27 usunięć
  1. 10 27
      src/views/biz/mission/record/index.vue

+ 10 - 27
src/views/biz/mission/record/index.vue

@@ -45,7 +45,7 @@
   </div>
 </template>
 <script lang="ts" setup>
-  import { onBeforeMount, ref, reactive } from 'vue';
+  import { onBeforeMount, ref } from 'vue';
   import { BasicTable, useTable, TableAction } from '/@/components/TableCard';
   import { useMessage } from '/@/hooks/web/useMessage';
 
@@ -77,19 +77,11 @@
     },
   ];
 
-  const formValue = reactive({
-    shiftDate: [
-      dayjs().subtract(1, 'month').format('YYYY-MM-DD'),
-      dayjs().add(12, 'month').format('YYYY-MM-DD'),
-    ],
-    content: '',
-  });
-
   // tab 切换选中
   const tabSelected = ref();
   // 操作名称
   const searchNames = ref('');
-  // const shiftDate = ref([]);
+  const shiftDate = ref([]);
 
   const typeOptions = ref();
   const responseTypeOptions = ref();
@@ -100,13 +92,6 @@
 
   const { createConfirm, createMessage } = useMessage();
 
-  // const tableSort = ref([
-  //   {
-  //     field: 'create_time',
-  //     direction: 'DESC',
-  //   },
-  // ]) as any;
-
   const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({
     api: getrecordList,
     batchDelApi: recordDel,
@@ -146,20 +131,19 @@
       });
     }
   }
-
   // 表格请求之前,对参数进行处理, 添加默认 排序
   async function handleBeforeFetch(params) {
+    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');
+    }
     console.log('searchNames:::', searchNames.value);
     return {
       ...params,
-      // orders: tableSort.value,
       title: searchNames.value == '' ? undefined : searchNames.value,
-      treatmentStage: tabSelected.value == '' ? undefined : tabSelected.value,
-      // time: shiftDate.value.length <= 0 ? undefined : shiftDate.value,
-      time: [
-        formValue.shiftDate[0],
-        dayjs(formValue.shiftDate[1]).add(1, 'day').format('YYYY-MM-DD'),
-      ],
+      time: shiftTimes.length <= 0 ? undefined : shiftTimes,
     };
   }
 
@@ -204,9 +188,8 @@
 
   // 查询组件回调
   async function callForm(data) {
-    // shiftDate.value = data.shiftDate ? data.shiftDate : '';
     searchNames.value = data.searchNames ? data.searchNames : '';
-    formValue.shiftDate = data.shiftDate || '';
+    shiftDate.value = data.shiftDate ? data.shiftDate : '';
     console.log('callForm:::', searchNames.value);
     await reload();
   }