From 492802e4fc1b371ba21a2a490c8dcd67d7c8b29c Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期一, 22 六月 2026 14:03:40 +0800
Subject: [PATCH] fix: 出差和请假审批新增开始与结束日期

---
 src/views/salesManagement/deliveryLedger/index.vue |   72 +++++++++++++++++++++++++++++-------
 1 files changed, 58 insertions(+), 14 deletions(-)

diff --git a/src/views/salesManagement/deliveryLedger/index.vue b/src/views/salesManagement/deliveryLedger/index.vue
index 21a0c5a..6545adf 100644
--- a/src/views/salesManagement/deliveryLedger/index.vue
+++ b/src/views/salesManagement/deliveryLedger/index.vue
@@ -14,6 +14,11 @@
           <el-input v-model="searchForm.expressNumber" placeholder="璇疯緭鍏�" clearable prefix-icon="Search" style="width: 200px"
             @change="handleQuery" />
         </el-form-item>
+        <el-form-item label="鍙戣揣鏃ユ湡锛�">
+          <el-date-picker v-model="shippingDateRange" type="daterange" range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�"
+            end-placeholder="缁撴潫鏃ユ湡" value-format="YYYY-MM-DD" format="YYYY-MM-DD" clearable style="width: 240px"
+            @change="handleShippingDateChange" />
+        </el-form-item>
         <el-form-item>
           <el-button type="primary" @click="handleQuery"> 鎼滅储 </el-button>
         </el-form-item>
@@ -245,20 +250,37 @@
 const detailRow = ref(null);
 const detailImages = ref([]);
 
+const getFileAccessUrl = (file = {}) => {
+  if (file?.link) {
+    if (String(file.link).startsWith('http')) return file.link;
+    return normalizeFileUrl(file.link);
+  }
+  return normalizeFileUrl(file?.url || '');
+};
+
 const normalizeFileUrl = (rawUrl = '') => {
   let fileUrl = rawUrl || '';
-  // Windows 璺緞杞� URL
+
   if (fileUrl && fileUrl.indexOf('\\') > -1) {
-    const uploadsIndex = fileUrl.toLowerCase().indexOf('uploads');
-    if (uploadsIndex > -1) {
-      const relativePath = fileUrl.substring(uploadsIndex).replace(/\\/g, '/');
-      fileUrl = '/' + relativePath;
-    } else {
-      const parts = fileUrl.split('\\');
-      const fileName = parts[parts.length - 1];
-      fileUrl = '/uploads/' + fileName;
-    }
+    fileUrl = fileUrl.replace(/\\/g, '/');
   }
+
+  const lowerPath = fileUrl.toLowerCase();
+
+  const uploadPathIndex = lowerPath.indexOf('/uploadpath/');
+  if (uploadPathIndex > -1) {
+    fileUrl = '/profile' + fileUrl.substring(uploadPathIndex + '/uploadpath'.length);
+  }
+
+  const fileRootIndex = fileUrl.toLowerCase().indexOf('/file/');
+  if (!fileUrl.startsWith('/profile/') && fileRootIndex > -1) {
+    fileUrl = '/profile' + fileUrl.substring(fileRootIndex + '/file'.length);
+  }
+
+  if (!fileUrl.startsWith('http') && fileUrl.toLowerCase().startsWith('profile/')) {
+    fileUrl = '/' + fileUrl;
+  }
+
   if (fileUrl && !fileUrl.startsWith('http')) {
     if (!fileUrl.startsWith('/')) fileUrl = '/' + fileUrl;
     fileUrl = javaApi + fileUrl;
@@ -277,11 +299,14 @@
 // 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
 const operationType = ref("");
 const dialogFormVisible = ref(false);
+const shippingDateRange = ref([]);
 const data = reactive({
   searchForm: {
     salesContractNo: "", // 閿�鍞鍗曞彿
     shippingCarNumber: "", // 杞︾墝鍙�
     expressNumber: "", // 蹇�掑崟鍙�
+    shippingDateStart: "", // 鍙戣揣鏃ユ湡寮�濮�
+    shippingDateEnd: "", // 鍙戣揣鏃ユ湡缁撴潫
   },
   form: {
     id: null,
@@ -319,6 +344,18 @@
 const handleQuery = () => {
   page.current = 1;
   getList();
+};
+
+// 鍙戣揣鏃ユ湡鍙樻洿
+const handleShippingDateChange = (value) => {
+  if (value && value.length === 2) {
+    searchForm.value.shippingDateStart = value[0];
+    searchForm.value.shippingDateEnd = value[1];
+  } else {
+    searchForm.value.shippingDateStart = "";
+    searchForm.value.shippingDateEnd = "";
+  }
+  handleQuery();
 };
 
 const paginationChange = (obj) => {
@@ -378,7 +415,7 @@
     // 濡傛灉鏈夊浘鐗囷紝灏� commonFileList 杞崲涓烘枃浠跺垪琛ㄦ牸寮�
     if (row.commonFileList && Array.isArray(row.commonFileList) && row.commonFileList.length > 0) {
       deliveryFileList.value = row.commonFileList.map((file, index) => {
-        const fileUrl = normalizeFileUrl(file.url || '');
+        const fileUrl = getFileAccessUrl(file);
         
         return {
           uid: file.id || Date.now() + index,
@@ -420,7 +457,7 @@
   detailRow.value = row || null;
   const list = Array.isArray(row?.commonFileList) ? row.commonFileList : [];
   detailImages.value = list
-    .map((f) => ({ url: normalizeFileUrl(f?.url || '') }))
+    .map((f) => ({ url: getFileAccessUrl(f) }))
     .filter((i) => !!i.url);
   detailDialogVisible.value = true;
 };
@@ -465,13 +502,20 @@
 
 // 瀵煎嚭
 const handleOut = () => {
-  ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+  ElMessageBox.confirm("鏄惁纭瀵煎嚭鍙戣揣鍙拌处鏁版嵁锛�", "瀵煎嚭", {
     confirmButtonText: "纭",
     cancelButtonText: "鍙栨秷",
     type: "warning",
   })
     .then(() => {
-      proxy.download("/shippingInfo/export", {}, "鍙戣揣鍙拌处.xlsx");
+      const params = {
+        salesContractNo: searchForm.value.salesContractNo,
+        shippingCarNumber: searchForm.value.shippingCarNumber,
+        expressNumber: searchForm.value.expressNumber,
+        shippingDateStart: searchForm.value.shippingDateStart,
+        shippingDateEnd: searchForm.value.shippingDateEnd,
+      };
+      proxy.download("/shippingInfo/export", params, "鍙戣揣鍙拌处.xlsx");
     })
     .catch(() => {
       proxy.$modal.msg("宸插彇娑�");

--
Gitblit v1.9.3