From 076bb96b437258f0e8cdbe184040e1e302b60d4b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 22 十二月 2025 14:10:12 +0800
Subject: [PATCH] 1.军泰伟业代码初始化

---
 src/views/financialManagement/financialStatements/index.vue |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/views/financialManagement/financialStatements/index.vue b/src/views/financialManagement/financialStatements/index.vue
index e5f9b23..430fe6a 100644
--- a/src/views/financialManagement/financialStatements/index.vue
+++ b/src/views/financialManagement/financialStatements/index.vue
@@ -1,4 +1,4 @@
- <template>
+<template>
   <div style="padding: 20px;">
     <!-- 椤甸潰鏍囬鍜屾棩鏈熺瓫閫� -->
     <div class="w-full md:w-auto flex items-center gap-3" style="margin-bottom: 20px;">
@@ -10,7 +10,7 @@
         range-separator="鑷�"
         start-placeholder="寮�濮嬫棩鏈�"
         end-placeholder="缁撴潫鏃ユ湡"
-        clearable
+        :default-value="[new Date(firstDayOfMonth), new Date()]"
         @change="handleDateChange"
         class="w-full md:w-auto"
         style="margin-right: 30px;"
@@ -137,7 +137,8 @@
 import dayjs from "dayjs";
 
 // 鏃ユ湡鑼冨洿
-const dateRange = ref(null);
+const dateRange = ref([]);
+const firstDayOfMonth = ref(null);
 const chartStyle = {
 	width: '100%',
 	height: '100%', // 璁剧疆鍥捐〃瀹瑰櫒鐨勯珮搴�
@@ -319,9 +320,6 @@
 })
 
 const getData = async () => {
-  if (!dateRange.value || !dateRange.value.length) {
-    return;
-  }
   try {
     const {code,data} = await reportForms({entryDateStart:dateRange.value[0], entryDateEnd:dateRange.value[1]});
     if(code === 200) {
@@ -372,22 +370,30 @@
 };
 
 
-// 鍒濆鍖�
+// 鍒濆鍖栨棩鏈熻寖鍥达紙榛樿褰撴湀锛�
 onMounted(() => {
-  // 涓嶈缃粯璁ゆ棩鏈燂紝鐢辩敤鎴锋墜鍔ㄩ�夋嫨
+  const today = new Date();
+  const firstDay = new Date(today.getFullYear(), today.getMonth(), 1);
+  firstDayOfMonth.value = firstDay;
+  dateRange.value = [dayjs(firstDay).format("YYYY-MM-DD"), dayjs(today).format("YYYY-MM-DD")];
+  getData()
+  
 });
 
 // 澶勭悊鏃ユ湡鑼冨洿鍙樺寲
 const handleDateChange = (newRange) => {
-  dateRange.value = newRange;
   if (newRange && newRange.length === 2) {
+    dateRange.value = newRange;
     getData()
   }
 };
 
 // 閲嶇疆鏃ユ湡鑼冨洿
 const resetDateRange = () => {
-  dateRange.value = null;
+  const today = new Date();
+  const firstDay = new Date(today.getFullYear(), today.getMonth(), 1);
+  dateRange.value = [dayjs(firstDay).format("YYYY-MM-DD"), dayjs(today).format("YYYY-MM-DD")];
+  getData()
 };
 
 </script>

--
Gitblit v1.9.3