diff --git a/src/views/oa/erp/orderLedger/index.vue b/src/views/oa/erp/orderLedger/index.vue index 62fef00..afc853a 100644 --- a/src/views/oa/erp/orderLedger/index.vue +++ b/src/views/oa/erp/orderLedger/index.vue @@ -3,7 +3,7 @@ @@ -35,6 +35,18 @@ + + + + + + + + + + + {{ orderInfo?.orderPaymentRate ?? 0 }}% + {{ contractInfo?.contractDate || '-' }} @@ -58,6 +70,66 @@ + + +
+
+
+ + 采购信息 + {{ purchaseTotal }} 条 +
+
+ 前往采购页面 + 刷新 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
@@ -136,7 +208,70 @@
- +
+
+
+ + 开票信息 + {{ invoiceTotal }} 条 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -151,6 +286,10 @@ import { getContractOrder } from '@/api/oa/erp/contractOrder'; import { getContractInfo } from '@/api/oa/erp/contractInfo'; import { ContractInfoVO } from '@/api/oa/erp/contractInfo/types'; import { ProjectInfoVO } from '@/api/oa/erp/projectInfo/types'; +import { listProjectPurchase } from '@/api/oa/erp/projectPurchase'; +import { ProjectPurchaseVO } from '@/api/oa/erp/projectPurchase/types'; +import { listFinInvoiceInfo } from '@/api/oa/erp/finInvoiceInfo'; +import { FinInvoiceInfoVO } from '@/api/oa/erp/finInvoiceInfo/types'; import { listWmsShippingBill } from '@/api/wms/wmsShippingBill'; import { WmsShippingBillVO } from '@/api/wms/wmsShippingBill/types'; import { getErpProjectPlanStageList } from '@/api/oa/erp/erpProjectPlanStage'; @@ -162,8 +301,40 @@ const { proxy } = getCurrentInstance() as ComponentInternalInstance; const route = useRoute(); const router = useRouter(); -const { business_direction, contract_category, contract_type, contract_status, shipping_mode, shipping_status } = toRefs( - proxy?.useDict('business_direction', 'contract_category', 'contract_type', 'contract_status', 'shipping_mode', 'shipping_status') +const { + business_direction, + contract_category, + contract_type, + contract_status, + shipping_mode, + shipping_status, + order_purchase_status, + order_delivery_status, + order_invoice_status, + project_purchase_status, + spare_flag, + wf_business_status, + invoice_status, + invoice_category, + early_flag +} = toRefs( + proxy?.useDict( + 'business_direction', + 'contract_category', + 'contract_type', + 'contract_status', + 'shipping_mode', + 'shipping_status', + 'order_purchase_status', + 'order_delivery_status', + 'order_invoice_status', + 'project_purchase_status', + 'spare_flag', + 'wf_business_status', + 'invoice_status', + 'invoice_category', + 'early_flag' + ) ); const projectId = computed(() => route.params.projectId as string | number | undefined); @@ -172,6 +343,8 @@ const contractInfo = ref(null); const shippingList = ref([]); const planStageList = ref([]); const paymentStageList = ref([]); +const purchaseList = ref([]); +const invoiceList = ref([]); const activeTab = ref('contract'); const loadedTabs = ref>(new Set(['contract'])); @@ -179,9 +352,15 @@ const loadedTabs = ref>(new Set(['contract'])); const loadingContract = ref(false); const loadingShipping = ref(false); const loadingPayment = ref(false); +const loadingPurchase = ref(false); +const loadingInvoice = ref(false); const shippingTotal = ref(0); const shippingQuery = reactive({ pageNum: 1, pageSize: 10 }); +const purchaseTotal = ref(0); +const purchaseQuery = reactive({ pageNum: 1, pageSize: 10, projectId: undefined as string | number | undefined }); +const invoiceTotal = ref(0); +const invoiceQuery = reactive({ pageNum: 1, pageSize: 10, projectId: undefined as string | number | undefined, contractId: undefined as string | number | undefined }); /** 格式化数字 */ const formatNumber = (num: number) => { @@ -199,6 +378,29 @@ const handleViewShipping = (row: WmsShippingBillVO) => { router.push({ path: '/shipping/wmsShippingBill/edit', query: { type: 'view', id: row.shippingBillId as string } }); }; +/** 前往采购页面 */ +const openPurchasePage = () => { + proxy?.$tab.openPage('/purchase/projectPurchase', '采购管理'); +}; + +/** 查看采购信息 */ +const viewPurchase = (row: ProjectPurchaseVO) => { + if (!row?.projectPurchaseId) return; + proxy?.$tab.openPage('/purchase/projectPurchase/edit', '采购信息', { + id: row.projectPurchaseId, + type: 'view' + }); +}; + +/** 查看开票信息 */ +const viewInvoice = (row: FinInvoiceInfoVO) => { + if (!row?.invoiceId) return; + proxy?.$tab.openPage('/fin/finInvoiceInfo/edit', '开票信息', { + id: row.invoiceId, + type: 'view' + }); +}; + /** 加载订单基本信息和合同信息 */ const loadOrderAndContract = async () => { if (!projectId.value) return; @@ -217,6 +419,49 @@ const loadOrderAndContract = async () => { } }; +/** 加载采购信息 */ +const loadPurchaseList = async () => { + if (!projectId.value) { + purchaseList.value = []; + purchaseTotal.value = 0; + return; + } + loadingPurchase.value = true; + try { + const res: any = await listProjectPurchase({ + ...purchaseQuery, + projectId: projectId.value + }); + purchaseList.value = res.rows || []; + purchaseTotal.value = res.total || 0; + } finally { + loadingPurchase.value = false; + } +}; + +/** 加载开票信息 */ +const loadInvoiceList = async () => { + if (!projectId.value) { + invoiceList.value = []; + invoiceTotal.value = 0; + return; + } + + // 优先按合同ID查询(开票VO里也有contractId),否则按项目ID查询 + const contractId = orderInfo.value?.contractId ?? contractInfo.value?.contractId; + invoiceQuery.projectId = contractId ? undefined : projectId.value; + invoiceQuery.contractId = contractId ? contractId : undefined; + + loadingInvoice.value = true; + try { + const res: any = await listFinInvoiceInfo(invoiceQuery); + invoiceList.value = res.rows || []; + invoiceTotal.value = res.total || 0; + } finally { + loadingInvoice.value = false; + } +}; + /** 加载发货信息 */ const loadShippingList = async () => { if (!orderInfo.value?.contractId) { @@ -287,6 +532,15 @@ const handleTabChange = (tabName: string) => { if (!loadedTabs.value.has(tabName)) { loadedTabs.value.add(tabName); switch (tabName) { + case 'invoice': + invoiceQuery.pageNum = 1; + loadInvoiceList(); + break; + case 'purchase': + purchaseQuery.pageNum = 1; + purchaseQuery.projectId = projectId.value; + loadPurchaseList(); + break; case 'shipping': shippingQuery.pageNum = 1; loadShippingList(); @@ -360,6 +614,37 @@ watch( } } + .section-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 16px; + padding-bottom: 12px; + border-bottom: 1px solid #e4e7ed; + + .header-left { + display: flex; + align-items: center; + gap: 10px; + + .section-icon { + font-size: 16px; + color: #409eff; + } + + .section-title { + font-size: 15px; + font-weight: 600; + color: #303133; + } + } + + .header-actions { + display: flex; + gap: 8px; + } + } + .data-table { :deep(.el-table__header) { th {