sen
2025-09-10 9c82baeb3d65a0648fd819116707de057cc42e3c
ui/admin-ui3/src/views/cwgl/estimatedReceivableBill/index.vue
@@ -148,6 +148,9 @@
} from "@/api/cwgl/estimatedReceivableBill";
import useCurrentInstance from "@/utils/useCurrentInstance";
import { computed, reactive, ref, toRefs } from "vue";
import {
  getSelectCustomNam,
} from "@/api/cwgl/pendingSettlementBusiness";
import { PagesInterface, PageQueryInterface } from "@/utils/globalInterface";
import { usePagePlus } from "@/hooks/usePagePlus";
import { hasPermission } from "@/utils/permissionUtils";
@@ -215,6 +218,7 @@
    // },
    billSystemNo: {
      label: '账单系统编号',
       showOverflowTooltip: true,
      search: true,
      rules: [
        {
@@ -225,6 +229,8 @@
    },
    billName: {
      label: '账单名称',
       minWidth: 200,
      showOverflowTooltip: true,
      rules: [
        {
          required: true,
@@ -232,15 +238,16 @@
        }
      ],
    },
    customerName: {
      label: '客户名称',
      rules: [
        {
          required: true,
          message: "客户名称不能为空", trigger: "blur"
        }
      ],
      search: true,
      minWidth: 220,
      search: true,
      showOverflowTooltip: true,
      type: 'select',           // 设置为下拉框类型
      dicData: [], // 使用 selectCustomName 作为数据源
      disabled: false  // 根据需要设置是否禁用
    },
    dispatchCount: {
@@ -350,9 +357,9 @@
    },
    handleSelectionChangeFunc: (selection: any) => {
      selectionList.value = selection;
    },
    },
  })
const dialog = reactive({
  visible: false,
@@ -424,16 +431,42 @@
}
const newFormRef = ref();
const submitForm = () => {
  if(newTableData.value.length == 0) {
  if (newTableData.value.length == 0) {
    proxy.$message.error('无关联明细,无法结算');
  }else {
    return; // 添加 return 中断执行
  } else {
    newFormRef.value!.validate(valid => {
      if (valid) {
        // 添加校验逻辑:本次结算金额不能大于应结算金额
        const settlementAmount = parseFloat(newForm.value.settlementAmount);
        const totalAmount = parseFloat(importForm.value.totalAmount);
        // 检查输入是否为有效数字
        if (isNaN(settlementAmount) || isNaN(totalAmount)) {
          proxy.$message.error('金额格式不正确');
          return;
        }
        if (settlementAmount > totalAmount) {
          proxy.$message.error('本次结算金额不能大于应结算金额');
          return; // 关键:在这里添加 return 中断后续执行
        }
        let data = {
          billId: newForm.value.id,
          fileName: newForm.value.attachment
        }
        addEstimatedReceivableLog(data).then((res1) => {
       if (newForm.value.attachment == null || newForm.value.attachment === '' || newForm.value.attachment === undefined) {
             estimatedReceivableBillSettlement(newForm.value).then((res) => {
              if (res.code === 200) {
                onLoad(page.value);
                proxy.$message.success('操作成功');
                dialog.visible = false;
                newForm.value = {};
              }
            })
        }else{
               addEstimatedReceivableLog(data).then((res1) => {
          if (res1.code === 200) {
            estimatedReceivableBillSettlement(newForm.value).then((res) => {
              if (res.code === 200) {
@@ -441,24 +474,25 @@
                proxy.$message.success('操作成功');
                dialog.visible = false;
                newForm.value = {};
              }
            })
          }
        })
        }
      } else {
        // 表单验证失败
        return false;
      }
    });
  }
}
const submitFormTow = () => {
  proxy.$modal.confirm(`是否确认修改账单名称?`).then(function () {
    return updateEstimatedReceivableBillNmae(importForm.value);
  }).then((res) => {
     onLoad(page.value);
    onLoad(page.value);
    proxy.$modal.msgSuccess(res.msg);
  })
@@ -540,6 +574,21 @@
  })
}
const selectCustomName = ref([]);
const getSelectCustomName = () => {
  getSelectCustomNam().then((res) => {
    if (res.code === 200) {
      // selectCustomName.value = res.data;
      selectCustomName.value = res.data.map(item => ({
        dictLabel: item,
        dictValue: item
      }));
      option.value.column.customerName.dicData = selectCustomName.value || [];
    }
  })
}
getSelectCustomName()
</script>
<style scoped>
::v-deep .el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell {
@@ -547,4 +596,11 @@
  padding: 8px 11px;
  width: 200px;
}
</style>
:deep(.avue-crud__table) {
  overflow-y: auto;
}
:deep(.el-scrollbar__bar.is-horizontal) {
  pointer-events: auto;
}
</style>