| | |
| | | import { getQuotationList } from "@/api/salesManagement/salesQuotation.js"; |
| | | import { getPurchaseByCode } from "@/api/procurementManagement/procurementLedger.js"; |
| | | import { getDeliveryDetailByShippingNo } from "@/api/salesManagement/deliveryLedger.js"; |
| | | import { ledgerListPage } from "@/api/salesManagement/salesLedger.js"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | |
| | | return hit?.label || ""; |
| | | } |
| | | |
| | | // 列表「业务单号」:按业务类型取对应的单号(19=销售台账审批) |
| | | function businessNoOf(row) { |
| | | return ( |
| | | row?.salesContractNo || |
| | | row?.quotationNo || |
| | | row?.purchaseContractNumber || |
| | | row?.shippingNo || |
| | | row?.bizId || |
| | | "" |
| | | ); |
| | | } |
| | | |
| | | function countTemplatesByBusinessType(type) { |
| | | return allSubmitTemplates.value.filter((card) => matchBusinessTypeValue(card.businessType, type)).length; |
| | | } |
| | |
| | | // { label: "申请人编号", prop: "applicantNo", width: 110 }, |
| | | { label: "发起人", prop: "applicantName", minWidth: 100 }, |
| | | { label: "模板类型", prop: "businessName", minWidth: 120 }, |
| | | { |
| | | label: "业务单号", |
| | | prop: "businessNo", |
| | | minWidth: 170, |
| | | dataType: "slot", |
| | | slot: "bizNo", |
| | | }, |
| | | { |
| | | label: "审批类型", |
| | | prop: "approvalType", |
| | |
| | | detailData.value = res?.data || res || {}; |
| | | } |
| | | } |
| | | |
| | | |
| | | // 销售台账审批:用审批事由字段承载的"销售合同号"去查台账列表 |
| | | else if (row.businessType === 19) { |
| | | detailData.value = await fetchSalesLedgerByContractNo(row?.salesContractNo); |
| | | } |
| | | |
| | | // 其他审批类型 |
| | | else { |
| | | detailData.value = {}; |
| | | } |
| | | |
| | | |
| | | detailDialog.visible = true; |
| | | } |
| | | |
| | | async function fetchSalesLedgerByContractNo(salesContractNo) { |
| | | if (!salesContractNo) return {}; |
| | | // /sales/ledger/listPage 直接返回 IPage(顶层 records),没有 code/msg 外层 |
| | | const res = await ledgerListPage({ |
| | | salesContractNo, |
| | | pageNum: 1, |
| | | pageSize: 1, |
| | | }); |
| | | return res?.records?.[0] || {}; |
| | | } |
| | | |
| | | async function openApprove(row) { |
| | |
| | | const res = await getDeliveryDetailByShippingNo({ shippingNo }); |
| | | detailData.value = res?.data || res || {}; |
| | | } |
| | | } |
| | | |
| | | // 销售台账审批:用审批事由字段承载的"销售合同号"去查台账列表 |
| | | else if (row.businessType === 19) { |
| | | detailData.value = await fetchSalesLedgerByContractNo(row?.salesContractNo); |
| | | } |
| | | |
| | | // 其他审批类型 |
| | |
| | | selectedBusinessType, |
| | | selectedBusinessTypeLabel, |
| | | businessTypeLabel, |
| | | businessNoOf, |
| | | countTemplatesByBusinessType, |
| | | submitTemplatesLoading, |
| | | handleQuery, |