From b3af089315a98903163a394a3b1ca0e4c634b9ab Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 14 一月 2026 17:51:37 +0800
Subject: [PATCH] Merge branch 'dev_New' of http://114.132.189.42:9002/r/product-inventory-management into dev_New

---
 src/views/salesManagement/invoiceLedger/index.vue |   99 +++++++++++++++++++++++++++----------------------
 1 files changed, 55 insertions(+), 44 deletions(-)

diff --git a/src/views/salesManagement/invoiceLedger/index.vue b/src/views/salesManagement/invoiceLedger/index.vue
index 8352dc6..eec3a26 100644
--- a/src/views/salesManagement/invoiceLedger/index.vue
+++ b/src/views/salesManagement/invoiceLedger/index.vue
@@ -31,9 +31,8 @@
         <el-table-column align="center" type="selection" width="55" />
         <el-table-column align="center" label="搴忓彿" type="index" width="60" />
         <el-table-column label="閿�鍞悎鍚屽彿" prop="salesContractNo" show-overflow-tooltip width="180" />
-        <el-table-column label="瀹㈡埛鍚堝悓鍙�" prop="customerContractNo" show-overflow-tooltip width="180" />
         <el-table-column label="瀹㈡埛鍚嶇О" prop="customerName" show-overflow-tooltip width="240" />
-        <el-table-column label="椤圭洰" prop="projectName" width="320" />
+<!--        <el-table-column label="椤圭洰" prop="projectName" width="320" />-->
         <el-table-column label="浜у搧澶х被" prop="productCategory" width="200" />
         <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" width="160" show-overflow-tooltip />
         <el-table-column label="鍙戠エ鍙�" prop="invoiceNo" width="200" show-overflow-tooltip />
@@ -43,7 +42,7 @@
         <el-table-column label="褰曞叆浜�" prop="invoicePerson" show-overflow-tooltip />
         <el-table-column label="褰曞叆鏃ユ湡" prop="createTime" show-overflow-tooltip :formatter="formatDate" width="180" />
         <el-table-column label="寮�绁ㄦ棩鏈�" prop="invoiceDate" show-overflow-tooltip width="120" />
-        <el-table-column label="鍙戠エ" prop="invoiceFileName" width="120" align="center" show-overflow-tooltip fixed="right">
+        <!-- <el-table-column label="鍙戠エ" prop="invoiceFileName" width="120" align="center" show-overflow-tooltip fixed="right">
           <template #default="scope">
             <el-button v-if="scope.row.invoiceFileName" text bg type="primary"
               @click="handleFile(scope.row.commonFiles)">
@@ -53,10 +52,11 @@
               涓婁紶
             </el-button>
           </template>
-        </el-table-column>
+        </el-table-column> -->
         <el-table-column fixed="right" label="鎿嶄綔" width="150" align="center">
           <template #default="scope">
             <el-button link type="primary" size="small" @click="openForm(scope.row)">缂栬緫</el-button>
+            <el-button link type="primary" size="small" @click="downLoadFile(scope.row)">闄勪欢</el-button>
             <el-button link type="primary" size="small" @click="delInvoiceLedger(scope.row)">鍒犻櫎</el-button>
           </template>
         </el-table-column>
@@ -64,7 +64,7 @@
       <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper"
         :page="page.current" :limit="page.size" @pagination="paginationChange" />
     </div>
-    <el-dialog v-model="dialogFormVisible" title="寮�绁ㄥ彴璐﹂〉闈�" width="70%" @close="closeDia">
+    <FormDialog v-model="dialogFormVisible" title="寮�绁ㄥ彴璐﹂〉闈�" :width="'70%'" @close="closeDia" @confirm="submitForm" @cancel="closeDia">
       <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
         <el-row :gutter="30">
           <el-col :span="12">
@@ -108,7 +108,7 @@
             <el-form-item label="闄勪欢鏉愭枡锛�" prop="remark">
               <el-upload v-model:file-list="fileList" :action="upload.url" multiple ref="fileUpload" auto-upload
                 :headers="upload.headers" accept=".pdf" :limit="10" :before-upload="handleBeforeUpload"
-                :on-error="handleUploadError" :on-success="handleUploadSuccess" :on-remove="handleRemove">
+                :on-error="handleUploadError" :on-success="handleUploadSuccess">
                 <el-button type="primary">涓婁紶</el-button>
                 <template #tip>
                   <!--                  鏂囦欢鏍煎紡鏀寔 doc锛宒ocx锛寈ls锛寈lsx锛宲pt锛宲ptx锛宲df锛宼xt锛寈ml锛宩pg锛宩peg锛宲ng锛実if锛宐mp锛宺ar锛寊ip锛�7z-->
@@ -119,13 +119,7 @@
           </el-col>
         </el-row>
       </el-form>
-      <template #footer>
-        <div class="dialog-footer">
-          <el-button type="primary" @click="submitForm">纭</el-button>
-          <el-button @click="closeDia">鍙栨秷</el-button>
-        </div>
-      </template>
-    </el-dialog>
+    </FormDialog>
     <el-dialog title="涓婁紶寮圭獥" width="50%" v-model="uploadModal">
       <el-row :gutter="30">
         <el-col :span="24">
@@ -149,11 +143,13 @@
         </div>
       </template>
     </el-dialog>
+    <FileListDialog ref="fileListRef" v-model="fileListDialogVisible" />
   </div>
 </template>
 
 <script setup>
 import pagination from "@/components/PIMTable/Pagination.vue";
+import FormDialog from '@/components/Dialog/FormDialog.vue';
 import { ref } from "vue";
 import { Search } from "@element-plus/icons-vue";
 import { ElMessageBox } from "element-plus";
@@ -164,10 +160,12 @@
   commitFile,
   registrationProductPage,
   delInvoiceLedgerByRegProductId,
-} from "../../../api/salesManagement/invoiceLedger.js";
+} from "@/api/salesManagement/invoiceLedger.js";
 import useUserStore from "@/store/modules/user.js";
 import useFormData from "@/hooks/useFormData";
 import dayjs from "dayjs";
+import FileListDialog from '@/components/Dialog/FileListDialog.vue';
+import { getCurrentDate } from "@/utils/index.js";
 
 const { proxy } = getCurrentInstance();
 const tableData = ref([]);
@@ -245,7 +243,11 @@
 const getList = () => {
   tableLoading.value = true;
   const { invoiceDate, ...rest } = searchForm;
-  registrationProductPage({ ...rest, ...page }).then((res) => {
+  // 灏嗚寖鍥存棩鏈熷瓧娈典紶閫掔粰鍚庣
+  const params = { ...rest, ...page };
+  // 绉婚櫎寮�绁ㄦ棩鏈熺殑榛樿鍊艰缃紝鍙繚鐣欒寖鍥存棩鏈熷瓧娈�
+  delete params.invoiceDate;
+  registrationProductPage(params).then((res) => {
     tableLoading.value = false;
     tableData.value = res.data.records;
     total.value = res.data.total;
@@ -272,12 +274,12 @@
   invoiceLedgerProductInfo({ id: row.id }).then((res) => {
     form.value = { ...res.data };
     fileList.value = res.data.fileList;
+    // 淇濆瓨ticketRegistrationId鍒拌〃鍗曟暟鎹腑
+    if (row.ticketRegistrationId) {
+      form.value.ticketRegistrationId = row.ticketRegistrationId;
+    }
     if (!form.value.invoicePerson) {
       form.value.invoicePerson = userStore.nickName;
-      form.value.entryDate = getCurrentDate();
-    }
-    if (!form.value.invoiceDate) {
-      form.value.invoiceDate = getCurrentDate();
     }
   });
   dialogFormVisible.value = true;
@@ -291,7 +293,6 @@
 };
 // 涓婁紶鍓嶆牎妫�
 function handleBeforeUpload(file) {
-  console.log("file", file);
   // 鏍℃鏂囦欢澶у皬
   if (file.size > 1024 * 1024 * 10) {
     proxy.$modal.msgError("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃10MB!");
@@ -315,19 +316,25 @@
 function handleUploadSuccess(res, file, uploadFiles) {
   proxy.$modal.closeLoading();
   if (res.code === 200) {
-    proxy.$refs["fileUpload"].handleRemove(file);
-    fileList.value.push(res.data);
     proxy.$modal.msgSuccess("涓婁紶鎴愬姛");
+    // 灏嗕笂浼犳垚鍔熺殑鏂囦欢淇℃伅娣诲姞鍒癴ileList涓�
+    const fileInfo = {
+      name: file.name,
+      url: res.data.url || file.response?.data?.url || file.url,
+      response: file.response
+    };
+    // 妫�鏌ユ槸鍚﹀凡瀛樺湪鐩稿悓鏂囦欢锛岄伩鍏嶉噸澶嶆坊鍔�
+    const existingFileIndex = fileList.value.findIndex(f => f.name === fileInfo.name);
+    if (existingFileIndex === -1) {
+      fileList.value.push(fileInfo);
+    } else {
+      fileList.value[existingFileIndex] = fileInfo;
+    }
+    // 纭繚琛ㄥ崟鏁版嵁涓殑fileList涔熸洿鏂�
+    form.value.fileList = fileList.value;
   } else {
     proxy.$modal.msgError(res.msg);
     proxy.$refs.fileUpload.handleRemove(file);
-  }
-}
-// 绉婚櫎鏂囦欢
-function handleRemove(file) {
-  let index = fileList.value.findIndex((item) => item.url === file.url);
-  if (index > -1) {
-    fileList.value.splice(index, 1);
   }
 }
 // 鎻愪氦琛ㄥ崟
@@ -361,13 +368,6 @@
     .catch(() => {
       proxy.$modal.msg("宸插彇娑�");
     });
-};
-
-// 鎵撳紑闄勪欢涓婁紶寮圭獥
-const handleDownload = (val) => {
-  fileList.value = [];
-  uploadModal.value = true;
-  currentId.value = val.id;
 };
 
 // 纭鏂囦欢涓婁紶
@@ -404,14 +404,6 @@
     });
 };
 
-// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
-function getCurrentDate() {
-  const today = new Date();
-  const year = today.getFullYear();
-  const month = String(today.getMonth() + 1).padStart(2, "0"); // 鏈堜唤浠�0寮�濮�
-  const day = String(today.getDate()).padStart(2, "0");
-  return `${year}-${month}-${day}`;
-}
 const changeDateRange = (date) => {
   if (date) {
     searchForm.invoiceDateStart = date[0];
@@ -433,7 +425,26 @@
   getList();
 };
 
+//闄勪欢鐩稿叧
+const fileListRef = ref(null)
+const fileListDialogVisible = ref(false)
+//鏌ョ湅闄勪欢
+const downLoadFile = (row) => {
+	invoiceLedgerProductInfo({ id: row.id }).then((res) => {
+		if (fileListRef.value) {
+			fileListRef.value.open(res.data.fileList)
+			fileListDialogVisible.value = true
+		}
+	});
+}
+
 onMounted(() => {
+  // 璁剧疆寮�绁ㄦ棩鏈熻寖鍥撮粯璁ゅ�间负褰撳ぉ
+  const today = dayjs().format('YYYY-MM-DD');
+  searchForm.invoiceDate = [today, today];
+  // 璁剧疆鑼冨洿鏃ユ湡瀛楁鐨勮捣濮嬪拰缁撴潫鏃堕棿
+  searchForm.invoiceDateStart = today;
+  searchForm.invoiceDateEnd = today;
   getList();
 });
 </script>

--
Gitblit v1.9.3