| | |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row v-if="!isQuotationApproval && !isPurchaseApproval"> |
| | | <el-row v-if="!isQuotationApproval && !isPurchaseApproval && !isInboundApproval"> |
| | | <el-col :span="24"> |
| | | <el-form-item :label="props.approveType == 5 ? '采购合同号:' : '审批事由:'" |
| | | prop="approveReason"> |
| | |
| | | </template> |
| | | </el-skeleton> |
| | | </div> |
| | | <!-- 入库审批:展示入库详情 --> |
| | | <div v-if="isInboundApproval" |
| | | style="margin: 10px 0 18px;"> |
| | | <el-divider content-position="left">入库详情</el-divider> |
| | | <el-skeleton :loading="stockInLoading" |
| | | animated> |
| | | <template #template> |
| | | <el-skeleton-item variant="h3" |
| | | style="width: 30%" /> |
| | | <el-skeleton-item variant="text" |
| | | style="width: 100%" /> |
| | | <el-skeleton-item variant="text" |
| | | style="width: 100%" /> |
| | | </template> |
| | | <template #default> |
| | | <el-empty v-if="!currentStockInOrder || !Object.keys(currentStockInOrder).length" |
| | | description="未查询到对应入库详情" /> |
| | | <template v-else> |
| | | <el-descriptions :column="2" |
| | | border> |
| | | <el-descriptions-item label="销售合同号">{{ currentStockInOrder.salesContractNo || "-" }}</el-descriptions-item> |
| | | <el-descriptions-item label="客户名称">{{ currentStockInOrder.customerName || "-" }}</el-descriptions-item> |
| | | <el-descriptions-item label="项目名称">{{ currentStockInOrder.projectName || "-" }}</el-descriptions-item> |
| | | <el-descriptions-item label="产品名称">{{ inboundProductSummary.productName }}</el-descriptions-item> |
| | | <el-descriptions-item label="规格型号">{{ inboundProductSummary.specification }}</el-descriptions-item> |
| | | <el-descriptions-item label="单位">{{ inboundProductSummary.unit }}</el-descriptions-item> |
| | | <el-descriptions-item label="数量">{{ inboundProductSummary.quantity }}</el-descriptions-item> |
| | | <el-descriptions-item label="业务员">{{ currentStockInOrder.salesman || "-" }}</el-descriptions-item> |
| | | </el-descriptions> |
| | | </template> |
| | | </template> |
| | | </el-skeleton> |
| | | </div> |
| | | <el-form :model="{ activities }" |
| | | ref="formRef" |
| | | label-position="top"> |
| | |
| | | } from "vue"; |
| | | import { |
| | | approveProcessDetails, |
| | | getStockInOrderInfo, |
| | | getStockInProductList, |
| | | getDept, |
| | | updateApproveNode, |
| | | } from "@/api/collaborativeApproval/approvalProcess.js"; |
| | |
| | | const currentQuotation = ref({}); |
| | | const purchaseLoading = ref(false); |
| | | const currentPurchase = ref({}); |
| | | const stockInLoading = ref(false); |
| | | const currentStockInOrder = ref({}); |
| | | const stockInProductList = ref([]); |
| | | const isQuotationApproval = computed(() => Number(props.approveType) === 6); |
| | | const isPurchaseApproval = computed(() => Number(props.approveType) === 5); |
| | | const isInboundApproval = computed(() => Number(props.approveType) === 9); |
| | | const inboundProductSummary = computed(() => { |
| | | if (!stockInProductList.value.length) { |
| | | return { |
| | | productName: "-", |
| | | specification: "-", |
| | | unit: "-", |
| | | quantity: "-", |
| | | }; |
| | | } |
| | | const pickUniqueJoin = key => { |
| | | const values = stockInProductList.value |
| | | .map(item => item[key]) |
| | | .filter(v => v !== undefined && v !== null && v !== "" && v !== "-"); |
| | | const uniqueValues = [...new Set(values)]; |
| | | return uniqueValues.length ? uniqueValues.join("、") : "-"; |
| | | }; |
| | | let hasNumericQuantity = false; |
| | | const quantityTotal = stockInProductList.value.reduce((sum, item) => { |
| | | const raw = item.quantityDisplay; |
| | | const num = Number(raw); |
| | | if (Number.isFinite(num)) { |
| | | hasNumericQuantity = true; |
| | | return sum + num; |
| | | } |
| | | return sum; |
| | | }, 0); |
| | | return { |
| | | productName: pickUniqueJoin("productNameDisplay"), |
| | | specification: pickUniqueJoin("specificationDisplay"), |
| | | unit: pickUniqueJoin("unitDisplay"), |
| | | quantity: hasNumericQuantity ? String(quantityTotal) : "-", |
| | | }; |
| | | }); |
| | | |
| | | const getFirstValidValue = (item, keys) => { |
| | | for (const key of keys) { |
| | | const value = item?.[key]; |
| | | if (value !== undefined && value !== null && value !== "") { |
| | | return value; |
| | | } |
| | | } |
| | | return "-"; |
| | | }; |
| | | |
| | | const formatStockInProductItem = item => { |
| | | const unitPrice = getFirstValidValue(item, [ |
| | | "unitPrice", |
| | | "taxInclusiveUnitPrice", |
| | | "price", |
| | | "purchasePrice", |
| | | "inPrice", |
| | | ]); |
| | | const amount = getFirstValidValue(item, [ |
| | | "amount", |
| | | "totalPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "totalAmount", |
| | | "subtotal", |
| | | ]); |
| | | return { |
| | | ...item, |
| | | productNameDisplay: getFirstValidValue(item, [ |
| | | "productName", |
| | | "productCategory", |
| | | "materialName", |
| | | "name", |
| | | ]), |
| | | specificationDisplay: getFirstValidValue(item, [ |
| | | "specificationModel", |
| | | "specification", |
| | | "model", |
| | | ]), |
| | | unitDisplay: getFirstValidValue(item, ["unit"]), |
| | | quantityDisplay: getFirstValidValue(item, [ |
| | | "quantity", |
| | | "stockedQuantity", |
| | | "inboundQuantity", |
| | | "stockInQuantity", |
| | | "num", |
| | | ]), |
| | | priceDisplay: |
| | | unitPrice === "-" ? "-" : `¥${Number(unitPrice || 0).toFixed(2)}`, |
| | | amountDisplay: amount === "-" ? "-" : `¥${Number(amount || 0).toFixed(2)}`, |
| | | }; |
| | | }; |
| | | |
| | | const data = reactive({ |
| | | form: { |
| | |
| | | dialogFormVisible.value = true; |
| | | currentQuotation.value = {}; |
| | | currentPurchase.value = {}; |
| | | currentStockInOrder.value = {}; |
| | | stockInProductList.value = []; |
| | | approveUserList({ approveType: props.approveType }).then(res => { |
| | | userList.value = res.data; |
| | | }); |
| | |
| | | } |
| | | } |
| | | |
| | | // 入库审批:通过流程编号查询入库详情与明细 |
| | | if (isInboundApproval.value) { |
| | | const approveId = row?.approveId; |
| | | if (approveId) { |
| | | stockInLoading.value = true; |
| | | Promise.all([ |
| | | getStockInOrderInfo({ approveId }), |
| | | getStockInProductList({ approveId }), |
| | | ]) |
| | | .then(([orderRes, productRes]) => { |
| | | currentStockInOrder.value = orderRes?.data?.orderInfo || {}; |
| | | const list = productRes?.data; |
| | | const rawList = Array.isArray(list) |
| | | ? list |
| | | : Array.isArray(list?.records) |
| | | ? list.records |
| | | : []; |
| | | stockInProductList.value = rawList.map(item => |
| | | formatStockInProductItem(item) |
| | | ); |
| | | }) |
| | | .catch(err => { |
| | | console.error("查询入库详情失败:", err); |
| | | proxy.$modal.msgError("查询入库详情失败"); |
| | | }) |
| | | .finally(() => { |
| | | stockInLoading.value = false; |
| | | }); |
| | | } |
| | | } |
| | | |
| | | approveProcessDetails(row.approveId).then(res => { |
| | | activities.value = res.data; |
| | | // 增加isApproval字段 |
| | |
| | | currentQuotation.value = {}; |
| | | purchaseLoading.value = false; |
| | | currentPurchase.value = {}; |
| | | stockInLoading.value = false; |
| | | currentStockInOrder.value = {}; |
| | | stockInProductList.value = []; |
| | | emit("close"); |
| | | }; |
| | | defineExpose({ |