| | |
| | | @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">导入 |
| | |
| | | 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; |
| | |
| | | |
| | | // 发货状态必须是"待发货"或"审核拒绝" |
| | | const statusStr = shippingStatus ? String(shippingStatus).trim() : ""; |
| | | return statusStr === "待发货" || statusStr === "审核拒绝"; |
| | | return statusStr === "待发货" || statusStr === "审核拒绝" || statusStr === "部分发货"; |
| | | }; |
| | | |
| | | // 打开附件弹窗 |
| | |
| | | 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 => { |
| | | // 检查是否可以发货 |