From 58f83d2e89ffbd51f2fcac506843a9e5121b0c4c Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期三, 14 一月 2026 14:02:55 +0800
Subject: [PATCH] 开票台账数量限制

---
 src/views/salesManagement/invoiceLedger/index.vue |  850 ++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 493 insertions(+), 357 deletions(-)

diff --git a/src/views/salesManagement/invoiceLedger/index.vue b/src/views/salesManagement/invoiceLedger/index.vue
index 814b36f..364fe9b 100644
--- a/src/views/salesManagement/invoiceLedger/index.vue
+++ b/src/views/salesManagement/invoiceLedger/index.vue
@@ -1,47 +1,107 @@
 <template>
   <div class="app-container">
     <div class="search_form">
-      <el-form :inline="true" :model="searchForm">
+      <el-form :inline="true"
+               :model="searchForm">
         <el-form-item label="瀹㈡埛鍚嶇О/鍚堝悓鍙�">
-          <el-input v-model="searchForm.searchText" style="width: 240px" placeholder="杈撳叆瀹㈡埛鍚嶇О/閿�鍞悎鍚屽彿鎼滅储"
-            @change="handleQuery" clearable :prefix-icon="Search" />
+          <el-input v-model="searchForm.searchText"
+                    style="width: 240px"
+                    placeholder="杈撳叆瀹㈡埛鍚嶇О/閿�鍞悎鍚屽彿鎼滅储"
+                    @change="handleQuery"
+                    clearable
+                    :prefix-icon="Search" />
         </el-form-item>
         <el-form-item label="寮�绁ㄦ棩鏈�">
-          <el-date-picker style="width: 240px" v-model="searchForm.invoiceDate" value-format="YYYY-MM-DD"
-            format="YYYY-MM-DD" type="daterange" start-placeholder="寮�濮嬫椂闂�" end-placeholder="缁撴潫鏃堕棿" clearable
-            @change="changeDateRange" @clear="clearRange" />
+          <el-date-picker style="width: 240px"
+                          v-model="searchForm.invoiceDate"
+                          value-format="YYYY-MM-DD"
+                          format="YYYY-MM-DD"
+                          type="daterange"
+                          start-placeholder="寮�濮嬫椂闂�"
+                          end-placeholder="缁撴潫鏃堕棿"
+                          clearable
+                          @change="changeDateRange"
+                          @clear="clearRange" />
         </el-form-item>
         <el-form-item label="褰曞叆鏃ユ湡">
-          <el-date-picker style="width: 100%" v-model="searchForm.createTimeStart" value-format="YYYY-MM-DD HH:mm:ss"
-            format="YYYY-MM-DD" type="date" placeholder="璇烽�夋嫨" clearable @change="handleQuery" />
+          <el-date-picker style="width: 100%"
+                          v-model="searchForm.createTimeStart"
+                          value-format="YYYY-MM-DD HH:mm:ss"
+                          format="YYYY-MM-DD"
+                          type="date"
+                          placeholder="璇烽�夋嫨"
+                          clearable
+                          @change="handleQuery" />
         </el-form-item>
         <el-form-item label="涓嶆樉绀烘湁鍙戠エ琛�">
-          <el-checkbox v-model="searchForm.status" @change="handleQuery" />
+          <el-checkbox v-model="searchForm.status"
+                       @change="handleQuery" />
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" @click="handleQuery"> 鎼滅储 </el-button>
+          <el-button type="primary"
+                     @click="handleQuery"> 鎼滅储 </el-button>
           <el-button @click="resetForm"> 閲嶇疆 </el-button>
-          <el-button @click="handleOut" type="primary">瀵煎嚭</el-button>
+          <el-button @click="handleOut"
+                     type="primary">瀵煎嚭</el-button>
         </el-form-item>
       </el-form>
     </div>
     <div class="table_list">
-      <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange"
-        :row-key="(row) => row.id" show-summary :summary-method="summarizeMainTable" height="calc(100vh - 18.5em)">
-        <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="customerName" show-overflow-tooltip width="240" />
-<!--        <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 />
-        <el-table-column label="鍙戠エ閲戦(鍏�)" prop="invoiceTotal" show-overflow-tooltip :formatter="formattedNumber"
-          width="200" />
-        <el-table-column label="绋庣巼(%)" prop="taxRate" show-overflow-tooltip />
-        <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 :data="tableData"
+                border
+                v-loading="tableLoading"
+                @selection-change="handleSelectionChange"
+                :row-key="(row) => row.id"
+                show-summary
+                :summary-method="summarizeMainTable"
+                height="calc(100vh - 18.5em)">
+        <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="customerName"
+                         show-overflow-tooltip
+                         width="240" />
+        <!--        <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 />
+        <el-table-column label="鍙戠エ閲戦(鍏�)"
+                         prop="invoiceTotal"
+                         show-overflow-tooltip
+                         :formatter="formattedNumber"
+                         width="200" />
+        <el-table-column label="绋庣巼(%)"
+                         prop="taxRate"
+                         show-overflow-tooltip />
+        <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">
           <template #default="scope">
             <el-button v-if="scope.row.invoiceFileName" text bg type="primary"
@@ -53,62 +113,121 @@
             </el-button>
           </template>
         </el-table-column> -->
-        <el-table-column fixed="right" label="鎿嶄綔" width="150" align="center">
+        <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>
+            <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>
-      <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper"
-        :page="page.current" :limit="page.size" @pagination="paginationChange" />
+      <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">
-      <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
+    <el-dialog v-model="dialogFormVisible"
+               title="寮�绁ㄥ彴璐﹂〉闈�"
+               width="70%"
+               @close="closeDia">
+      <el-form :model="form"
+               label-width="140px"
+               label-position="top"
+               :rules="rules"
+               ref="formRef">
         <el-row :gutter="30">
           <el-col :span="12">
-            <el-form-item label="閿�鍞悎鍚屽彿锛�" prop="salesContractNo">
-              <el-input v-model="form.salesContractNo" disabled></el-input>
+            <el-form-item label="閿�鍞悎鍚屽彿锛�"
+                          prop="salesContractNo">
+              <el-input v-model="form.salesContractNo"
+                        disabled></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="瀹㈡埛鍚嶇О锛�" prop="customerName">
-              <el-input v-model="form.customerName" placeholder="鑷姩濉厖" clearable disabled />
+            <el-form-item label="瀹㈡埛鍚嶇О锛�"
+                          prop="customerName">
+              <el-input v-model="form.customerName"
+                        placeholder="鑷姩濉厖"
+                        clearable
+                        disabled />
             </el-form-item>
           </el-col>
         </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
-            <el-form-item label="鍙戠エ鍙凤細" prop="invoiceNo">
-              <el-input v-model="form.invoiceNo" placeholder="璇疯緭鍏�" clearable />
+            <el-form-item label="鍙戠エ鍙凤細"
+                          prop="invoiceNo">
+              <el-input v-model="form.invoiceNo"
+                        placeholder="璇疯緭鍏�"
+                        clearable />
             </el-form-item>
           </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 :precision="2"/>
+            <el-form-item :label="`鍙戠エ閲戦(鍏�)锛� 鍚堝悓鎬婚(${form.taxInclusiveTotalPrice}鍏�)`"
+                          prop="invoiceTotal">
+              <el-input-number :step="0.01"
+                               :min="0"
+                               :max="form.noInvoiceAmount"
+                               style="width: 100%"
+                               v-model="form.invoiceTotal"
+                               placeholder="璇疯緭鍏�"
+                               clearable
+                               :precision="2" />
             </el-form-item>
           </el-col>
         </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
-            <el-form-item label="寮�绁ㄤ汉锛�" prop="invoicePerson">
-              <el-input v-model="form.invoicePerson" placeholder="璇疯緭鍏�" clearable disabled />
+            <el-form-item label="寮�绁ㄤ汉锛�"
+                          prop="invoicePerson">
+              <el-input v-model="form.invoicePerson"
+                        placeholder="璇疯緭鍏�"
+                        clearable
+                        disabled />
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="寮�绁ㄦ棩鏈燂細" prop="invoiceDate">
-              <el-date-picker style="width: 100%" v-model="form.invoiceDate" value-format="YYYY-MM-DD"
-                format="YYYY-MM-DD" type="date" placeholder="璇烽�夋嫨" clearable />
+            <el-form-item label="寮�绁ㄦ棩鏈燂細"
+                          prop="invoiceDate">
+              <el-date-picker style="width: 100%"
+                              v-model="form.invoiceDate"
+                              value-format="YYYY-MM-DD"
+                              format="YYYY-MM-DD"
+                              type="date"
+                              placeholder="璇烽�夋嫨"
+                              clearable />
             </el-form-item>
           </el-col>
         </el-row>
         <el-row :gutter="30">
           <el-col :span="24">
-            <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">
+            <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">
                 <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-->
@@ -121,19 +240,33 @@
       </el-form>
       <template #footer>
         <div class="dialog-footer">
-          <el-button type="primary" @click="submitForm">纭</el-button>
+          <el-button type="primary"
+                     @click="submitForm">纭</el-button>
           <el-button @click="closeDia">鍙栨秷</el-button>
         </div>
       </template>
     </el-dialog>
-    <el-dialog title="涓婁紶寮圭獥" width="50%" v-model="uploadModal">
+    <el-dialog title="涓婁紶寮圭獥"
+               width="50%"
+               v-model="uploadModal">
       <el-row :gutter="30">
         <el-col :span="24">
-          <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" style="width: 100%" :on-exceed="handleExceed"
-              :before-upload="handleBeforeUpload" :on-error="handleUploadError" :on-success="handleUploadSuccess"
-              :on-remove="handleRemove">
+          <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"
+                       style="width: 100%"
+                       :on-exceed="handleExceed"
+                       :before-upload="handleBeforeUpload"
+                       :on-error="handleUploadError"
+                       :on-success="handleUploadSuccess"
+                       :on-remove="handleRemove">
               <el-button type="primary">涓婁紶</el-button>
               <template #tip>
                 <div class="el-upload__tip">鏂囦欢鏍煎紡浠呮敮鎸� pdf</div>
@@ -144,7 +277,8 @@
       </el-row>
       <template #footer>
         <div class="dialog-footer">
-          <el-button @click="commiInvoicetFile" type="primary">纭</el-button>
+          <el-button @click="commiInvoicetFile"
+                     type="primary">纭</el-button>
           <el-button @click="uploadModal = false">鍙栨秷</el-button>
         </div>
       </template>
@@ -154,315 +288,317 @@
 </template>
 
 <script setup>
-import pagination from "@/components/PIMTable/Pagination.vue";
-import { ref } from "vue";
-import { Search } from "@element-plus/icons-vue";
-import { ElMessageBox } from "element-plus";
-import { getToken } from "@/utils/auth";
-import {
-  invoiceLedgerSaveOrUpdate,
-  invoiceLedgerProductInfo,
-  commitFile,
-  registrationProductPage,
-  delInvoiceLedgerByRegProductId,
-} from "@/api/salesManagement/invoiceLedger.js";
-import useUserStore from "@/store/modules/user.js";
-import useFormData from "@/hooks/useFormData";
-import dayjs from "dayjs";
-import FileList from "./fileList.vue";
+  import pagination from "@/components/PIMTable/Pagination.vue";
+  import { ref } from "vue";
+  import { Search } from "@element-plus/icons-vue";
+  import { ElMessageBox } from "element-plus";
+  import { getToken } from "@/utils/auth";
+  import {
+    invoiceLedgerSaveOrUpdate,
+    invoiceLedgerProductInfo,
+    commitFile,
+    registrationProductPage,
+    delInvoiceLedgerByRegProductId,
+  } from "@/api/salesManagement/invoiceLedger.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([]);
-const productData = ref([]);
-const selectedRows = ref([]);
-const tableLoading = ref(false);
-const page = reactive({
-  current: 1,
-  size: 100,
-});
-const total = ref(0);
-const fileList = ref([]);
-const dialogFormVisible = ref(false);
-const data = reactive({
-  searchForm: {
-    searchText: "",
-    status: false,
-    invoiceDate: null,
-    invoiceDateStart: undefined,
-    invoiceDateEnd: undefined,
-    createTimeStart: "", // 褰曞叆鏃ユ湡
-  },
-  form: {
-    salesLedgerId: "",
-    customerId: "",
-    invoiceNo: "",
-    invoiceTotal: "",
-    taxRate: "",
-    invoicePerson: "",
-    invoiceDate: "",
-    customerName: "",
-    fileList: [],
-    createTime: "", // 褰曞叆鏃ユ湡
-  },
-  rules: {
-    salesLedgerId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
-    customerId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-    invoiceNo: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
-    invoiceAmount: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-    taxRate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
-    invoicePerson: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
-    invoiceDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
-    customerName: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
-  },
-});
-const { form, rules } = toRefs(data);
-const { form: searchForm, resetForm } = useFormData(data.searchForm);
-const currentId = ref("");
-const userStore = useUserStore();
-const upload = reactive({
-  // 涓婁紶鐨勫湴鍧�
-  url: import.meta.env.VITE_APP_BASE_API + "/invoiceLedger/uploadFile",
-  // 璁剧疆涓婁紶鐨勮姹傚ご閮�
-  headers: { Authorization: "Bearer " + getToken() },
-});
-const matchFileType = ref(["pdf"]);
-const uploadModal = ref(false);
-const formattedNumber = (row, column, cellValue) => {
-  return parseFloat(cellValue).toFixed(2);
-};
-const formatDate = (row, column, cellValue) => {
-  return dayjs(cellValue).format("YYYY-MM-DD HH:mm:ss");
-};
-// 鏌ヨ鍒楄〃
-/** 鎼滅储鎸夐挳鎿嶄綔 */
-const handleQuery = () => {
-  page.current = 1;
-  getList();
-};
-const paginationChange = (obj) => {
-  page.current = obj.page;
-  page.size = obj.limit;
-  getList();
-};
-const getList = () => {
-  tableLoading.value = true;
-  const { invoiceDate, ...rest } = searchForm;
-  // 灏嗚寖鍥存棩鏈熷瓧娈典紶閫掔粰鍚庣
-  const params = { ...rest, ...page };
-  // 绉婚櫎寮�绁ㄦ棩鏈熺殑榛樿鍊艰缃紝鍙繚鐣欒寖鍥存棩鏈熷瓧娈�
-  delete params.invoiceDate;
-  registrationProductPage(params).then((res) => {
-    tableLoading.value = false;
-    tableData.value = res.data.records;
-    total.value = res.data.total;
+  const { proxy } = getCurrentInstance();
+  const tableData = ref([]);
+  const productData = ref([]);
+  const selectedRows = ref([]);
+  const tableLoading = ref(false);
+  const page = reactive({
+    current: 1,
+    size: 100,
   });
-};
-// 琛ㄦ牸閫夋嫨鏁版嵁
-const handleSelectionChange = (selection) => {
-  selectedRows.value = selection;
-};
-// 涓昏〃鍚堣鏂规硶
-const summarizeMainTable = (param) => {
-  return proxy.summarizeTable(param, ["invoiceTotal"], {
-    ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
-    futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+  const total = ref(0);
+  const fileList = ref([]);
+  const dialogFormVisible = ref(false);
+  const data = reactive({
+    searchForm: {
+      searchText: "",
+      status: false,
+      invoiceDate: null,
+      invoiceDateStart: undefined,
+      invoiceDateEnd: undefined,
+      createTimeStart: "", // 褰曞叆鏃ユ湡
+    },
+    form: {
+      salesLedgerId: "",
+      customerId: "",
+      invoiceNo: "",
+      invoiceTotal: "",
+      taxRate: "",
+      invoicePerson: "",
+      invoiceDate: "",
+      customerName: "",
+      fileList: [],
+      createTime: "", // 褰曞叆鏃ユ湡
+    },
+    rules: {
+      salesLedgerId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+      customerId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+      invoiceNo: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+      invoiceAmount: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+      taxRate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+      invoicePerson: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+      invoiceDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+      customerName: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+    },
   });
-};
-// 鎵撳紑寮规
-const openForm = (row) => {
-  form.value = {};
-  productData.value = [];
-  fileList.value = [];
-  currentId.value = row.id;
-
-  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;
-      // 绉婚櫎褰曞叆鏃ユ湡榛樿鍊艰缃紝鍙鐞嗚寖鍥存棩鏈熷瓧娈�
-    }
-    // 绉婚櫎寮�绁ㄦ棩鏈熼粯璁ゅ�艰缃紝鍙鐞嗚寖鍥存棩鏈熷瓧娈�
+  const { form, rules } = toRefs(data);
+  const { form: searchForm, resetForm } = useFormData(data.searchForm);
+  const currentId = ref("");
+  const userStore = useUserStore();
+  const upload = reactive({
+    // 涓婁紶鐨勫湴鍧�
+    url: import.meta.env.VITE_APP_BASE_API + "/invoiceLedger/uploadFile",
+    // 璁剧疆涓婁紶鐨勮姹傚ご閮�
+    headers: { Authorization: "Bearer " + getToken() },
   });
-  dialogFormVisible.value = true;
-};
-// 涓婁紶澶氫釜鏂囦欢灏辫鐩栧師鏉ョ殑
-const handleExceed = (files) => {
-  proxy.$refs["fileUpload"].clearFiles();
-  const file = files[0];
-  file.uid = genFileId();
-  proxy.$refs["fileUpload"].handleStart(file);
-};
-// 涓婁紶鍓嶆牎妫�
-function handleBeforeUpload(file) {
-  // 鏍℃鏂囦欢澶у皬
-  if (file.size > 1024 * 1024 * 10) {
-    proxy.$modal.msgError("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃10MB!");
-    return false;
-  }
-  // 鍒ゆ柇鏂囦欢鏍煎紡鏄惁绗﹀悎
-  const fileType = file.name.split(".").pop().toLowerCase();
-  if (!matchFileType.value.includes(fileType)) {
-    proxy.$modal.msgError("鏂囦欢鏍煎紡涓嶅尮閰�");
-    return false;
-  }
-  console.log('handleBeforeUpload');
-  proxy.$modal.loading("姝e湪涓婁紶鏂囦欢锛岃绋嶅��...");
-  return true;
-}
-// 涓婁紶澶辫触
-function handleUploadError(err) {
-  proxy.$modal.msgError("涓婁紶鏂囦欢澶辫触");
-  proxy.$modal.closeLoading();
-}
-// 涓婁紶鎴愬姛鍥炶皟
-function handleUploadSuccess(res, file, uploadFiles) {
-  proxy.$modal.closeLoading();
-  console.log('handleUploadSuccess');
-  if (res.code === 200) {
-    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);
-  }
-}
-// 鎻愪氦琛ㄥ崟
-const submitForm = () => {
-  proxy.$refs["formRef"].validate((valid) => {
-    if (valid) {
-      form.value.fileList = fileList.value;
-      invoiceLedgerSaveOrUpdate(form.value).then((res) => {
-        proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
-        closeDia();
-        getList();
-      });
-    }
-  });
-};
-// 鍏抽棴寮规
-const closeDia = () => {
-  proxy.resetForm("formRef");
-  dialogFormVisible.value = false;
-};
-// 瀵煎嚭
-const handleOut = () => {
-  ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
-    confirmButtonText: "纭",
-    cancelButtonText: "鍙栨秷",
-    type: "warning",
-  })
-    .then(() => {
-      proxy.download("/invoiceLedger/export", {}, "寮�绁ㄥ彴璐�.xlsx");
-    })
-    .catch(() => {
-      proxy.$modal.msg("宸插彇娑�");
-    });
-};
-
-// 纭鏂囦欢涓婁紶
-const commiInvoicetFile = () => {
-  const object = {
-    fileList: fileList.value,
-    id: currentId.value,
+  const matchFileType = ref(["pdf"]);
+  const uploadModal = ref(false);
+  const formattedNumber = (row, column, cellValue) => {
+    return parseFloat(cellValue).toFixed(2);
   };
-  commitFile(object).then((res) => {
-    if (res.code === 200) {
-      proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
-      uploadModal.value = false;
-    }
+  const formatDate = (row, column, cellValue) => {
+    return dayjs(cellValue).format("YYYY-MM-DD HH:mm:ss");
+  };
+  // 鏌ヨ鍒楄〃
+  /** 鎼滅储鎸夐挳鎿嶄綔 */
+  const handleQuery = () => {
+    page.current = 1;
     getList();
-    currentId.value = "";
-    fileList.value = [];
-  });
-};
-// 鍒犻櫎寮�绁ㄥ彴璐�
-const delInvoiceLedger = (row) => {
-  ElMessageBox.confirm("璇ュ彂绁ㄥ彴璐﹀皢琚垹闄�,鏄惁纭鍒犻櫎", {
-    confirmButtonText: "纭",
-    cancelButtonText: "鍙栨秷",
-    type: "warning",
-  })
-    .then(() => {
-      delInvoiceLedgerByRegProductId(row.id).then((res) => {
-				proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-        getList();
-      });
-    })
-    .catch(() => {
-      proxy.$modal.msg("宸插彇娑�");
+  };
+  const paginationChange = obj => {
+    page.current = obj.page;
+    page.size = obj.limit;
+    getList();
+  };
+  const getList = () => {
+    tableLoading.value = true;
+    const { invoiceDate, ...rest } = searchForm;
+    // 灏嗚寖鍥存棩鏈熷瓧娈典紶閫掔粰鍚庣
+    const params = { ...rest, ...page };
+    // 绉婚櫎寮�绁ㄦ棩鏈熺殑榛樿鍊艰缃紝鍙繚鐣欒寖鍥存棩鏈熷瓧娈�
+    delete params.invoiceDate;
+    registrationProductPage(params).then(res => {
+      tableLoading.value = false;
+      tableData.value = res.data.records;
+      total.value = res.data.total;
     });
-};
+  };
+  // 琛ㄦ牸閫夋嫨鏁版嵁
+  const handleSelectionChange = selection => {
+    selectedRows.value = selection;
+  };
+  // 涓昏〃鍚堣鏂规硶
+  const summarizeMainTable = param => {
+    return proxy.summarizeTable(param, ["invoiceTotal"], {
+      ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+      futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+    });
+  };
+  // 鎵撳紑寮规
+  const openForm = row => {
+    form.value = {};
+    productData.value = [];
+    fileList.value = [];
+    currentId.value = row.id;
 
-// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� 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];
-    searchForm.invoiceDateEnd = date[1];
-    getList();
+    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;
+        // 绉婚櫎褰曞叆鏃ユ湡榛樿鍊艰缃紝鍙鐞嗚寖鍥存棩鏈熷瓧娈�
+      }
+      // 绉婚櫎寮�绁ㄦ棩鏈熼粯璁ゅ�艰缃紝鍙鐞嗚寖鍥存棩鏈熷瓧娈�
+    });
+    dialogFormVisible.value = true;
+  };
+  // 涓婁紶澶氫釜鏂囦欢灏辫鐩栧師鏉ョ殑
+  const handleExceed = files => {
+    proxy.$refs["fileUpload"].clearFiles();
+    const file = files[0];
+    file.uid = genFileId();
+    proxy.$refs["fileUpload"].handleStart(file);
+  };
+  // 涓婁紶鍓嶆牎妫�
+  function handleBeforeUpload(file) {
+    // 鏍℃鏂囦欢澶у皬
+    if (file.size > 1024 * 1024 * 10) {
+      proxy.$modal.msgError("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃10MB!");
+      return false;
+    }
+    // 鍒ゆ柇鏂囦欢鏍煎紡鏄惁绗﹀悎
+    const fileType = file.name.split(".").pop().toLowerCase();
+    if (!matchFileType.value.includes(fileType)) {
+      proxy.$modal.msgError("鏂囦欢鏍煎紡涓嶅尮閰�");
+      return false;
+    }
+    console.log("handleBeforeUpload");
+    proxy.$modal.loading("姝e湪涓婁紶鏂囦欢锛岃绋嶅��...");
+    return true;
   }
-};
+  // 涓婁紶澶辫触
+  function handleUploadError(err) {
+    proxy.$modal.msgError("涓婁紶鏂囦欢澶辫触");
+    proxy.$modal.closeLoading();
+  }
+  // 涓婁紶鎴愬姛鍥炶皟
+  function handleUploadSuccess(res, file, uploadFiles) {
+    proxy.$modal.closeLoading();
+    console.log("handleUploadSuccess");
+    if (res.code === 200) {
+      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);
+    }
+  }
+  // 鎻愪氦琛ㄥ崟
+  const submitForm = () => {
+    proxy.$refs["formRef"].validate(valid => {
+      if (valid) {
+        form.value.fileList = fileList.value;
+        invoiceLedgerSaveOrUpdate(form.value).then(res => {
+          proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+          closeDia();
+          getList();
+        });
+      }
+    });
+  };
+  // 鍏抽棴寮规
+  const closeDia = () => {
+    proxy.resetForm("formRef");
+    dialogFormVisible.value = false;
+  };
+  // 瀵煎嚭
+  const handleOut = () => {
+    ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+      confirmButtonText: "纭",
+      cancelButtonText: "鍙栨秷",
+      type: "warning",
+    })
+      .then(() => {
+        proxy.download("/invoiceLedger/export", {}, "寮�绁ㄥ彴璐�.xlsx");
+      })
+      .catch(() => {
+        proxy.$modal.msg("宸插彇娑�");
+      });
+  };
 
-const handleFile = (commonFiles) => {
-  commonFiles.forEach((e) => {
-    proxy.$download.name(e.url);
+  // 纭鏂囦欢涓婁紶
+  const commiInvoicetFile = () => {
+    const object = {
+      fileList: fileList.value,
+      id: currentId.value,
+    };
+    commitFile(object).then(res => {
+      if (res.code === 200) {
+        proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+        uploadModal.value = false;
+      }
+      getList();
+      currentId.value = "";
+      fileList.value = [];
+    });
+  };
+  // 鍒犻櫎寮�绁ㄥ彴璐�
+  const delInvoiceLedger = row => {
+    ElMessageBox.confirm("璇ュ彂绁ㄥ彴璐﹀皢琚垹闄�,鏄惁纭鍒犻櫎", {
+      confirmButtonText: "纭",
+      cancelButtonText: "鍙栨秷",
+      type: "warning",
+    })
+      .then(() => {
+        delInvoiceLedgerByRegProductId(row.id).then(res => {
+          proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+          getList();
+        });
+      })
+      .catch(() => {
+        proxy.$modal.msg("宸插彇娑�");
+      });
+  };
+
+  // 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� 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];
+      searchForm.invoiceDateEnd = date[1];
+      getList();
+    }
+  };
+
+  const handleFile = commonFiles => {
+    commonFiles.forEach(e => {
+      proxy.$download.name(e.url);
+    });
+  };
+
+  const clearRange = () => {
+    searchForm.invoiceDate = [];
+    searchForm.invoiceDateStart = undefined;
+    searchForm.invoiceDateEnd = undefined;
+    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();
   });
-};
-
-const clearRange = () => {
-  searchForm.invoiceDate = [];
-  searchForm.invoiceDateStart = undefined;
-  searchForm.invoiceDateEnd = undefined;
-  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>
 
 <style scoped lang="scss">
-.table_list {
-  margin-top: unset;
-}
+  .table_list {
+    margin-top: unset;
+  }
 </style>

--
Gitblit v1.9.3