请添加至少一条装货产品 @@ -180,7 +192,20 @@ const customerOptionsLoading = ref(false) const isInternal = computed(() => isPlInternalCustomerName(props.modelValue.customerName)) - const contractDisabled = computed(() => isInternal.value) + + /** 非内部客户须先选装货合同才能添加产品;内部客户不限制 */ + const addProductsDisabled = computed(() => { + if (isInternal.value) return false + return !(props.modelValue.contracts || []).some((c) => String(c.contractId || '').trim()) + }) + + function handleAddProductsClick() { + if (addProductsDisabled.value) { + ElMessage.warning('请先选择装货合同后再添加产品') + return + } + emit('add-products') + } const dibangDirectionLabel = computed(() => { if (props.modelValue.dibangDirection === 'outbound') return '出库' @@ -363,10 +388,14 @@ } function handleDibangToggle(checked: boolean) { - const direction = isInternal.value ? 'outbound' : props.modelValue.dibangDirection || 'none' + // 仅山峡/云栋可生成地磅单,且由客户类型自动决定,不允许手动勾选 + if (!isInternal.value) { + patch({ generateDibang: 0, dibangDirection: 'none' }) + return + } patch({ generateDibang: checked ? 1 : 0, - dibangDirection: checked ? direction : 'none' + dibangDirection: checked ? 'outbound' : 'none' }) } @@ -400,6 +429,15 @@ color: #64748b; } + .pl-plan-stop-products-head__add-wrap { + display: inline-flex; + cursor: pointer; + + :deep(.el-button.is-disabled) { + pointer-events: none; + } + } + .pl-plan-load-section__empty-hint { margin: 8px 0 0; font-size: 12px;