diff --git a/web-admin/src/views/crm/contract/components/ContractFormDialog.vue b/web-admin/src/views/crm/contract/components/ContractFormDialog.vue index e25f03343..39e69e005 100644 --- a/web-admin/src/views/crm/contract/components/ContractFormDialog.vue +++ b/web-admin/src/views/crm/contract/components/ContractFormDialog.vue @@ -273,47 +273,69 @@ /> - + - + @@ -548,6 +570,14 @@ @confirm="handleProductSelected" /> + + @@ -601,7 +631,8 @@ import { Promotion, Loading, ArrowDown, - ArrowUp + ArrowUp, + Setting } from '@element-plus/icons-vue' import { buildUploadFileListFromField, @@ -614,12 +645,14 @@ import ContractAttachmentPanel from './ContractAttachmentPanel.vue' import { getOpportunity } from '@/api/crm/opportunity' import { getQuote } from '@/api/crm/quote' import ProductSelector from './ProductSelector.vue' +import ProductAliasBrandDialog from '@/components/business/product-alias-brand-dialog/index.vue' import CustomerSelector from '@/components/CustomerSelector.vue' import ContactSelector from '@/components/ContactSelector.vue' import QuoteSelector from '@/components/QuoteSelector.vue' import { removeProductsNotAllowedByHazard } from '@/utils/crm-supplier-hazard' import { applyBrandSelectChange, + applyManagedProductMetaToLines, initLineBrandMetaFromProduct, prepareLineAliasAndBrandForSubmit, resolveAliasFromSavedName @@ -1682,6 +1715,29 @@ const handleBrandIdChange = (row: ExtendedContractProductForm, val: string | und applyBrandSelectChange(row, val, row.brandOptions || []) } +const aliasBrandManageVisible = ref(false) +const aliasBrandManageProductId = ref('') +const aliasBrandManageProductName = ref('') +const aliasBrandManageMode = ref<'alias' | 'brand'>('alias') + +function openAliasBrandManage(row: ExtendedContractProductForm, mode: 'alias' | 'brand') { + if (!row.productId) return + aliasBrandManageProductId.value = String(row.productId) + aliasBrandManageProductName.value = String( + row.standardProductName || row.productName || '' + ) + aliasBrandManageMode.value = mode + aliasBrandManageVisible.value = true +} + +function handleAliasBrandManaged(product: Record) { + applyManagedProductMetaToLines( + form.value.products || [], + aliasBrandManageProductId.value, + product + ) +} + async function enrichContractProductBrandMeta(lines: ExtendedContractProductForm[]) { await Promise.all( (lines || []).map(async (line) => { @@ -2597,4 +2653,23 @@ const loadSupplierList = async () => { .ml-2 { margin-left: 8px; } + +.line-meta-cell { + display: flex; + align-items: center; + gap: 4px; + min-width: 0; +} +.line-meta-cell__control { + flex: 1; + min-width: 0; +} +.line-meta-cell__empty { + flex: 1; + min-width: 0; +} +.line-meta-cell__btn { + flex-shrink: 0; + padding: 4px; +}