gaoluyang
2026-05-21 a2c33664f683aee11fdc62391c8d1e21cc74f5b2
src/views/salesManagement/salesLedger/index.vue
@@ -48,6 +48,9 @@
                     @click="openForm('add')">
            新增台账
          </el-button>
               <el-button type="primary" plain :disabled="selectedRows.length === 0" @click="handleBatchExportContract">
                  导出合同
               </el-button>
          <el-button type="primary"
                     plain
                     @click="handleImport">导入
@@ -1578,7 +1581,7 @@
    selectedQuotation.value = null;
    let userLists = await userListNoPage();
    userList.value = userLists.data;
    listCustomer({ current: -1, size: -1 }).then(res => {
    listCustomer({ current: -1, size: -1, type: 0 }).then(res => {
      customerOption.value = res.data.records;
    });
    form.value.entryPerson = userStore.id;
@@ -2652,7 +2655,7 @@
    // 发货状态必须是"待发货"或"审核拒绝"
    const statusStr = shippingStatus ? String(shippingStatus).trim() : "";
    return statusStr === "待发货" || statusStr === "审核拒绝";
    return statusStr === "待发货" || statusStr === "审核拒绝" || statusStr === "部分发货";
  };
  // 打开附件弹窗
@@ -2664,7 +2667,40 @@
    recordId.value = row.id;
    fileDialogVisible.value = true;
  };
   const handleBatchExportContract = () => {
      if (selectedRows.value.length === 0) {
         proxy.$modal.msgWarning("请选择要导出的台账");
         return;
      }
      const firstCustomerKey =
         selectedRows.value[0].customerId ?? selectedRows.value[0].customerName ?? "";
      const hasDifferentCustomer = selectedRows.value.some((row) => {
         const customerKey = row.customerId ?? row.customerName ?? "";
         return String(customerKey) !== String(firstCustomerKey);
      });
      if (hasDifferentCustomer) {
         proxy.$modal.msgWarning("仅支持同一客户同时导出合同");
         return;
      }
      const ids = selectedRows.value
         .map((row) => row.id)
         .filter((id) => id !== null && id !== undefined);
      if (ids.length === 0) {
         proxy.$modal.msgWarning("未获取到合同ID");
         return;
      }
      proxy.download(
         "/sales/ledger/exportContract",
         ids,
         `销售合同_批量_${dayjs().format("YYYYMMDDHHmmss")}.docx`,
         {
            method: "post",
            filename: `销售合同_批量_${dayjs().format("YYYYMMDDHHmmss")}.docx`,
            headers: { "Content-Type": "application/json;charset=utf-8" },
            transformRequest: [(data) => JSON.stringify(data)],
         }
      );
   }
  // 打开发货弹框
  const openDeliveryForm = async row => {
    // 检查是否可以发货