| | |
| | | </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" |
| | |
| | | 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 => { |