From 742643e009dfd72591392f0d7dcf07c2a9a3ec9a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 16 十二月 2025 13:47:56 +0800
Subject: [PATCH] 1.海川开心-开票台账发票信息上传了,没有查看的地方,只能上传

---
 src/views/salesManagement/invoiceLedger/index.vue |   94 ++++++++++++++++++++++++++++-------------------
 1 files changed, 56 insertions(+), 38 deletions(-)

diff --git a/src/views/salesManagement/invoiceLedger/index.vue b/src/views/salesManagement/invoiceLedger/index.vue
index 9d9ed3a..d1bb3fe 100644
--- a/src/views/salesManagement/invoiceLedger/index.vue
+++ b/src/views/salesManagement/invoiceLedger/index.vue
@@ -31,11 +31,10 @@
         <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="200" />
+<!--        <el-table-column label="椤圭洰" prop="projectName" width="320" />-->
         <el-table-column label="浜у搧澶х被" prop="productCategory" width="200" />
-        <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" width="300" show-overflow-tooltip />
+        <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" width="160" show-overflow-tooltip />
         <el-table-column label="鍙戠エ鍙�" prop="invoiceNo" width="200" show-overflow-tooltip />
         <el-table-column label="鍙戠エ閲戦(鍏�)" prop="invoiceTotal" show-overflow-tooltip :formatter="formattedNumber"
           width="200" />
@@ -43,21 +42,22 @@
         <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>
+        <!-- <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)">
               鏌ョ湅闄勪欢
             </el-button>
-            <el-button v-else link type="primary" @click="handleDownload(scope.row)" :disabled="scope.row.invoicePerson !== userStore.nickName">
+            <el-button v-else link type="primary" @click="handleDownload(scope.row)">
               涓婁紶
             </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)" :disabled="scope.row.invoicePerson !== userStore.nickName">缂栬緫</el-button>
-            <el-button link type="primary" size="small" @click="delInvoiceLedger(scope.row)" :disabled="scope.row.invoicePerson !== userStore.nickName">鍒犻櫎</el-button>
+            <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>
       </el-table>
@@ -86,7 +86,7 @@
           </el-col>
           <el-col :span="12">
             <el-form-item :label="`鍙戠エ閲戦(鍏�)锛� 鍚堝悓鎬婚(${form.taxInclusiveTotalPrice}鍏�)`" prop="invoiceTotal">
-              <el-input-number :step="0.01" :min="0" :max="form.taxInclusiveTotalPrice" style="width: 100%" v-model="form.invoiceTotal" placeholder="璇疯緭鍏�" clearable />
+              <el-input-number :step="0.01" :min="0" :max="form.taxInclusiveTotalPrice" style="width: 100%" v-model="form.invoiceTotal" placeholder="璇疯緭鍏�" clearable :precision="2"/>
             </el-form-item>
           </el-col>
         </el-row>
@@ -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-->
@@ -149,6 +149,7 @@
         </div>
       </template>
     </el-dialog>
+    <FileList ref="fileListRef" />
   </div>
 </template>
 
@@ -165,9 +166,11 @@
   registrationProductPage,
   delInvoiceLedgerByRegProductId,
 } from "../../../api/salesManagement/invoiceLedger.js";
+import { getSalesLedgerWithProducts } from "@/api/salesManagement/salesLedger.js";
 import useUserStore from "@/store/modules/user.js";
 import useFormData from "@/hooks/useFormData";
 import dayjs from "dayjs";
+import FileList from "./fileList.vue";
 
 const { proxy } = getCurrentInstance();
 const tableData = ref([]);
@@ -185,12 +188,9 @@
   searchForm: {
     searchText: "",
     status: false,
-    invoiceDate: [
-      dayjs().startOf("month").format("YYYY-MM-DD"),
-      dayjs().endOf("month").format("YYYY-MM-DD"),
-    ],
-    invoiceDateStart: dayjs().startOf("month").format("YYYY-MM-DD"),
-    invoiceDateEnd: dayjs().endOf("month").format("YYYY-MM-DD"),
+    invoiceDate: null,
+    invoiceDateStart: undefined,
+    invoiceDateEnd: undefined,
     createTimeStart: "", // 褰曞叆鏃ユ湡
   },
   form: {
@@ -248,7 +248,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;
@@ -277,11 +281,9 @@
     fileList.value = res.data.fileList;
     if (!form.value.invoicePerson) {
       form.value.invoicePerson = userStore.nickName;
-      form.value.entryDate = getCurrentDate();
+      // 绉婚櫎褰曞叆鏃ユ湡榛樿鍊艰缃紝鍙鐞嗚寖鍥存棩鏈熷瓧娈�
     }
-    if (!form.value.invoiceDate) {
-      form.value.invoiceDate = getCurrentDate();
-    }
+    // 绉婚櫎寮�绁ㄦ棩鏈熼粯璁ゅ�艰缃紝鍙鐞嗚寖鍥存棩鏈熷瓧娈�
   });
   dialogFormVisible.value = true;
 };
@@ -294,7 +296,6 @@
 };
 // 涓婁紶鍓嶆牎妫�
 function handleBeforeUpload(file) {
-  console.log("file", file);
   // 鏍℃鏂囦欢澶у皬
   if (file.size > 1024 * 1024 * 10) {
     proxy.$modal.msgError("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃10MB!");
@@ -306,6 +307,7 @@
     proxy.$modal.msgError("鏂囦欢鏍煎紡涓嶅尮閰�");
     return false;
   }
+  console.log('handleBeforeUpload');
   proxy.$modal.loading("姝e湪涓婁紶鏂囦欢锛岃绋嶅��...");
   return true;
 }
@@ -317,20 +319,27 @@
 // 涓婁紶鎴愬姛鍥炶皟
 function handleUploadSuccess(res, file, uploadFiles) {
   proxy.$modal.closeLoading();
+  console.log('handleUploadSuccess');
   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);
   }
 }
 // 鎻愪氦琛ㄥ崟
@@ -366,13 +375,6 @@
     });
 };
 
-// 鎵撳紑闄勪欢涓婁紶寮圭獥
-const handleDownload = (val) => {
-  fileList.value = [];
-  uploadModal.value = true;
-  currentId.value = val.id;
-};
-
 // 纭鏂囦欢涓婁紶
 const commiInvoicetFile = () => {
   const object = {
@@ -398,6 +400,7 @@
   })
     .then(() => {
       delInvoiceLedgerByRegProductId(row.id).then((res) => {
+				proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
         getList();
       });
     })
@@ -435,7 +438,22 @@
   getList();
 };
 
+//闄勪欢鐩稿叧
+const fileListRef = ref(null)
+//鏌ョ湅闄勪欢
+const downLoadFile = (row) => {
+	invoiceLedgerProductInfo({ id: row.id }).then((res) => {
+		fileListRef.value.open(res.data.fileList)
+	});
+}
+
 onMounted(() => {
+  // 璁剧疆寮�绁ㄦ棩鏈熻寖鍥撮粯璁ゅ�间负褰撳ぉ
+  const today = dayjs().format('YYYY-MM-DD');
+  searchForm.invoiceDate = [today, today];
+  // 璁剧疆鑼冨洿鏃ユ湡瀛楁鐨勮捣濮嬪拰缁撴潫鏃堕棿
+  searchForm.invoiceDateStart = today;
+  searchForm.invoiceDateEnd = today;
   getList();
 });
 </script>

--
Gitblit v1.9.3