From 6de8af4c5c12809104c74f7e809d9ea92ae3cfc1 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期五, 30 一月 2026 13:23:59 +0800
Subject: [PATCH] 生成核算增加日期搜索

---
 src/views/productionManagement/productionCosting/index.vue |   63 +++++++++++++++++++++++--------
 1 files changed, 47 insertions(+), 16 deletions(-)

diff --git a/src/views/productionManagement/productionCosting/index.vue b/src/views/productionManagement/productionCosting/index.vue
index 3547087..fe8d781 100644
--- a/src/views/productionManagement/productionCosting/index.vue
+++ b/src/views/productionManagement/productionCosting/index.vue
@@ -4,12 +4,28 @@
 			<!-- 宸︿晶鍙拌处 + 椤堕儴绛涢�� -->
 			<div class="left-panel">
 				<div class="left-header">
-					<!-- <div class="left-title">鐢熶骇鍙拌处</div> -->
-					<el-radio-group v-model="dateType" size="small" @change="handleDateTypeChange">
-						<el-radio-button label="day">鏃�</el-radio-button>
-						<el-radio-button label="month">鏈�</el-radio-button>
-					</el-radio-group>
-					
+          <el-form :model="searchForm" inline>
+            <el-form-item prop="dateType">
+              <el-radio-group v-model="searchForm.dateType" size="small" @change="handleDateTypeChange">
+                <el-radio-button label="day">鏃�</el-radio-button>
+                <el-radio-button label="month">鏈�</el-radio-button>
+              </el-radio-group>
+            </el-form-item>
+
+            <el-form-item label="鏃ユ湡锛�" prop="dateRange">
+              <el-date-picker
+                  v-model="searchForm.dateRange"
+                  :type="searchForm.dateType === 'day' ? 'date' : 'daterange'"
+                  range-separator="鑷�"
+                  start-placeholder="寮�濮嬫棩鏈�"
+                  end-placeholder="缁撴潫鏃ユ湡"
+                  format="YYYY-MM-DD"
+                  value-format="YYYY-MM-DD"
+                  style="width: 300px"
+                  @change="handleDateRangeChange"
+              />
+            </el-form-item>
+          </el-form>
 				</div>
 				<PIMTable
 					rowKey="id"
@@ -139,7 +155,6 @@
 const tableLoading1 = ref(false);
 const leftTableData = ref([]);
 // 鏃� / 鏈� 鍒囨崲锛堥粯璁ゆ寜鏃ワ級
-const dateType = ref("day");
 const page = reactive({
 	current: 1,
 	size: 100,
@@ -156,6 +171,8 @@
 	searchForm: {
 		schedulingUserName: "",
 		salesContractNo: "",
+    dateType: "day",
+    dateRange: undefined,
 		entryDate: [
 			dayjs().format("YYYY-MM-DD"),
 			dayjs().add(1, "day").format("YYYY-MM-DD"),
@@ -178,21 +195,26 @@
 	getList1();
 };
 
-const changeDaterange = (value) => {
+const handleDateRangeChange = (value) => {
 	if (value) {
-		searchForm.value.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
-		searchForm.value.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
+    if (searchForm.value.dateType === "day") {
+      searchForm.value.entryDate = value;
+    } else {
+      searchForm.value.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
+      searchForm.value.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
+    }
+
 	} else {
+		searchForm.value.entryDate = undefined;
 		searchForm.value.entryDateStart = undefined;
 		searchForm.value.entryDateEnd = undefined;
 	}
-	handleQuery();
+  reloadData()
 };
+
 const getList = () => {
 	tableLoading.value = true;
 	const params = { ...searchForm.value, ...page };
-	params.dateType = dateType.value;
-	params.entryDate = undefined
 
   salesLedgerProductionAccountingList(params).then((res) => {
 		tableLoading.value = false;
@@ -239,11 +261,20 @@
 // 宸︿晶鏃�/鏈堝垏鎹�
 const handleDateTypeChange = () => {
 	// 杩欓噷鍙綔涓虹瓫閫夋潯浠剁殑涓�閮ㄥ垎锛岀洿鎺ラ噸鏂版煡璇㈠垪琛�
-  page.current = 1;
-	getList();
-  handleQuery()
+  searchForm.value.dateRange = undefined;
+  searchForm.value.entryDate = undefined;
+  searchForm.value.entryDateStart = undefined;
+  searchForm.value.entryDateEnd = undefined;
+  reloadData()
 };
 
+const reloadData = () => {
+  page.current = 1;
+  page1.current = 1;
+  getList();
+  tableData.value = []
+}
+
 // 鐐瑰嚮宸︿晶琛岋紝鍒峰彸渚ф槑缁嗭紙鎸夌敓浜т汉杩囨护锛�
 const handleLeftRowClick = (row) => {
 	searchForm.value.schedulingUserName = row.schedulingUserName || "";

--
Gitblit v1.9.3