gongchunyi
21 小时以前 a5e0e0de30cfa041d473dbd2d5111abb7689c9d7
src/views/procurementManagement/invoiceEntry/index.vue
@@ -39,7 +39,7 @@
        <div></div>
        <div>
          <el-button @click="handleExport" style="margin-right: 10px">导出</el-button>
          <el-button type="primary" @click="handleAdd('add')">
          <el-button type="primary" @click="handleAdd('add')" :disabled="isInvoiceDisabled">
            来票登记
          </el-button>
<!--          <el-button type="danger" plain @click="handleDelete">删除</el-button>-->
@@ -84,7 +84,7 @@
<script setup>
import { usePaginationApi } from "@/hooks/usePaginationApi";
import {delRegistration, gePurchaseListPage} from "@/api/procurementManagement/invoiceEntry.js";
import { nextTick, onMounted, getCurrentInstance, ref } from "vue";
import { nextTick, onMounted, getCurrentInstance, ref, computed } from "vue";
import ExpandTable from "./components/ExpandTable.vue";
import Modal from "./components/Modal.vue";
import {ElMessageBox} from "element-plus";
@@ -112,6 +112,8 @@
  gePurchaseListPage,
  {
    purchaseContractNumber: undefined,
    // 只查询已审批通过(或指定状态为 3)的记录
    approvalStatus: 3,
  },
  [
    {
@@ -184,6 +186,18 @@
  );
};
// 计算是否可以来票登记:如果所有选中行的待来票金额都为0,则禁用按钮
const isInvoiceDisabled = computed(() => {
  if (selectedRows.value.length === 0) {
    return true;
  }
  // 如果所有选中行的待来票金额都为0或小于等于0,则禁用
  return selectedRows.value.every(row => {
    const amount = parseFloat(row.unReceiptPaymentAmount || 0);
    return amount <= 0;
  });
});
const handleAdd = (type) => {
   if (selectedRows.value.length < 1) {
      proxy.$modal.msgWarning("请至少选中一条数据");