gaoluyang
3 天以前 e44ce4501ea4cf30e79b2181fda84cd3faf8ec8a
src/views/procurementManagement/invoiceEntry/index.vue
@@ -40,6 +40,8 @@
          total: pagination.total,
        }"
        :expand-row-keys="expandRowKeys"
        :summaryMethod="summarizeMainTable"
        :isShowSummary="true"
        @expand-change="expandChange"
        @selection-change="handleSelectionChange"
        @pagination="changePage"
@@ -59,16 +61,17 @@
        </template>
      </PIMTable>
    </div>
    <Modal ref="modalRef"></Modal>
    <Modal ref="modalRef" @refreshList="getTableData"></Modal>
  </div>
</template>
<script setup>
import { usePaginationApi } from "@/hooks/usePaginationApi";
import { gePurchaseListPage } from "@/api/procurementManagement/invoiceEntry.js";
import {delRegistration, gePurchaseListPage} from "@/api/procurementManagement/invoiceEntry.js";
import { nextTick, onMounted, getCurrentInstance } from "vue";
import ExpandTable from "./components/ExpandTable.vue";
import Modal from "./components/Modal.vue";
import {ElMessageBox} from "element-plus";
defineOptions({
  name: "来票登记",
@@ -113,12 +116,12 @@
    {
      label: "供应商名称",
      prop: "supplierName",
      width:240
      width:300
    },
    {
      label: "项目名称",
      prop: "projectName",
      width:150
      width:400
    },
    {
      label: "录入人",
@@ -127,12 +130,12 @@
    {
      label: "录入日期",
      prop: "entryDate",
      width:100
      width:110
    },
    {
      label: "合同金额(元)",
      prop: "contractAmount",
      width:150,
      width:200,
      formatData: (val) => {
        return val ? parseFloat(val).toFixed(2) : 0;
      },
@@ -140,7 +143,7 @@
    {
      label: "已开票金额(元)",
      prop: "receiptPaymentAmount",
      width:150,
      width:200,
      formatData: (val) => {
        return val ? parseFloat(val).toFixed(2) : 0;
      },
@@ -148,7 +151,7 @@
    {
      label: "待开票金额(元)",
      prop: "unReceiptPaymentAmount",
      width:150,
      width:200,
      formatData: (val) => {
        return val ? parseFloat(val).toFixed(2) : 0;
      },
@@ -182,8 +185,50 @@
  modalRef.value.open(type, id);
};
const handleOut = () => {};
const handleDelete = () => {};
// 导出
const handleOut = () => {
   ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
   })
      .then(() => {
         proxy.download("/purchase/registration/export", {}, "来票登记.xlsx");
      })
      .catch(() => {
         proxy.$modal.msg("已取消");
      });
};
// 删除
const handleDelete = () => {
   let ids = [];
   if (selectedRows.value.length > 0) {
    // 新增判断:如果有选中的数据没有ticketRegistrationId,提示并终止
    const noTicket = selectedRows.value.some(item => !item.ticketRegistrationId);
    if (noTicket) {
      proxy.$modal.msgWarning("采购台账还未进行来票登记,无法进行删除操作");
      return;
    }
      ids = selectedRows.value.map((item) => item.ticketRegistrationId);
   } else {
      proxy.$modal.msgWarning("请选择数据");
      return;
   }
   ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "导出", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
   })
      .then(() => {
         delRegistration(ids).then((res) => {
            proxy.$modal.msgSuccess("删除成功");
            getList();
         });
      })
      .catch(() => {
         proxy.$modal.msg("已取消");
      });
};
const expandChange = async (row, expandedRows) => {
  if (expandedRows.length > 0) {
@@ -196,7 +241,17 @@
  pagination.currentPage = page;
  onCurrentChange(page);
};
// 主表合计方法
const summarizeMainTable = (param) => {
   return proxy.summarizeTable(
      param,
      ["contractAmount", "receiptPaymentAmount", "unReceiptPaymentAmount"],
      {
         ticketsNum: { noDecimal: true }, // 不保留小数
         futureTickets: { noDecimal: true }, // 不保留小数
      }
   );
};
onMounted(() => {
  getTableData();
});