wujianwei
2025-08-27 89cd54f5065f18b9e08983cec812a3c44060742d
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";
@@ -232,15 +235,15 @@
        }
      ],
    },
    customerName: {
      label: '客户名称',
      rules: [
        {
          required: true,
          message: "客户名称不能为空", trigger: "blur"
        }
      ],
      search: true,
      minWidth: 220,
      search: true,
      type: 'select',           // 设置为下拉框类型
      dicData: [], // 使用 selectCustomName 作为数据源
      disabled: false  // 根据需要设置是否禁用
    },
    dispatchCount: {
@@ -310,7 +313,7 @@
  // labelWidth: 120,
  column: {
    projectName: {
      label: '项目名称1',
      label: '项目名称',
    },
    dispatchNo: {
      label: '调度单号',
@@ -350,7 +353,9 @@
    },
    handleSelectionChangeFunc: (selection: any) => {
      selectionList.value = selection;
    }
    },
  })
const dialog = reactive({
  visible: false,
@@ -382,6 +387,7 @@
const handleAmend = (row) => {
  newFormData.value.billId = row.id;
  importForm.value.billId = row.id;
  dispIshow.value = true;
  newOption.value.menu = true;
  listPendingSettlementBusiness({ billId: row.id }).then((res) => {
@@ -421,35 +427,68 @@
}
const newFormRef = ref();
const submitForm = () => {
  newFormRef.value!.validate(valid => {
    if (valid) {
      let data = {
        billId: newForm.value.id,
        fileName: newForm.value.attachment
      }
      addEstimatedReceivableLog(data).then((res1) => {
        if (res1.code === 200) {
          estimatedReceivableBillSettlement(newForm.value).then((res) => {
            if (res.code === 200) {
              proxy.$message.success('操作成功');
              dialog.visible = false;
              newForm.value = {};
  if (newTableData.value.length == 0) {
    proxy.$message.error('无关联明细,无法结算');
    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
        }
       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) {
                onLoad(page.value);
                proxy.$message.success('操作成功');
                dialog.visible = false;
                newForm.value = {};
              }
            })
          }
        })
        }
      } else {
        // 表单验证失败
        return false;
      }
    });
  }
}
const submitFormTow = () => {
  proxy.$modal.confirm(`是否确认修改账单名称?`).then(function () {
    return updateEstimatedReceivableBillNmae(newForm.value);
    return updateEstimatedReceivableBillNmae(importForm.value);
  }).then((res) => {
    onLoad(page.value);
    proxy.$modal.msgSuccess(res.msg);
  })
@@ -523,7 +562,7 @@
const flowParams = ref([])
const handleFlow = (row: string) => {
  let data = {
    estimatedId: row.id,
    billId: row.id,
  }
  listEstimatedReceivableBillLog(data).then((res) => {
    flowParams.value = res.rows
@@ -531,6 +570,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 {