liding
9 天以前 f3590d3b29112c8d18315c1f7e93c8a57b27e3ec
feat:销售台账顺序和导出顺序优化
已修改1个文件
47 ■■■■ 文件已修改
src/views/salesManagement/salesLedger/index.vue 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesLedger/index.vue
@@ -149,8 +149,7 @@
              </el-dropdown-menu>
            </template>
          </el-dropdown>
          <el-button @click="handleOut"
                     :disabled="isBatchButtonDisabled('export')">导出</el-button>
          <el-button @click="handleOut">导出</el-button>
          <el-button type="danger"
                     plain
                     @click="handleDelete"
@@ -4317,30 +4316,34 @@
    proxy.$refs["importUploadRef"].submit();
  };
  // 导出
  // 导出(按当前查询条件导出)
  const handleOut = () => {
    if (selectedRows.value.length === 0) {
      proxy.$modal.msgWarning("请至少选择一条数据进行导出");
      return;
    // 构建查询参数(与 getList 保持一致)
    const { entryDate, ...rest } = searchForm;
    const params = { ...rest };
    // 处理录入日期范围
    if (entryDate && entryDate.length === 2) {
      params.entryDateStart = entryDate[0];
      params.entryDateEnd = entryDate[1];
    }
    const hasUnapproved = selectedRows.value.some(
      row => Number(row.reviewStatus) !== 1
    // 处理客户名称查询
    const selectedCustomer = (customerOption.value || []).find(
      item => String(item?.id ?? "") === String(params.customerId ?? "")
    );
    if (hasUnapproved) {
      proxy.$modal.msgWarning("选中的数据中包含未审核项,无法导出");
      return;
    if (selectedCustomer?.customerName) {
      params.customerName = String(selectedCustomer.customerName).trim();
    }
    ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
    })
      .then(() => {
        proxy.download("/sales/ledger/export", {}, "销售台账.xlsx");
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
    delete params.customerId;
    // 处理产品宽高查询参数
    const widthValue = params.width != null ? String(params.width).trim() : "";
    const heightValue = params.height != null ? String(params.height).trim() : "";
    if (!widthValue) delete params.width;
    if (!heightValue) delete params.height;
    proxy.download("/sales/ledger/exportWithProducts", params, "销售台账.xlsx");
  };
  /** 判断单个产品是否已发货(根据shippingStatus判断,已发货或审核通过不可编辑和删除) */
  const isProductShipped = product => {