feat(web-admin): gate load products by selected contract
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
bbab39e6b7
commit
9b8848ea8c
2 files changed
+159
-14
No files matched your search
@@ -4,8 +4,8 @@
|
||||
<PlPlanContractMultiSelect
|
||||
v-model="contractsModel"
|
||||
:customer-id="modelValue.customerId"
|
||||
:disabled="!modelValue.customerId || contractDisabled"
|
||||
:required="false"
|
||||
:disabled="!modelValue.customerId || isInternal"
|
||||
:required="!!modelValue.customerId && !isInternal"
|
||||
compact-summary
|
||||
>
|
||||
<template #toolbar="{ open, disabled, hint, hintWarn }">
|
||||
@@ -47,7 +47,11 @@
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="装货合同" class="pl-plan-party-select-row__contract">
|
||||
<el-form-item
|
||||
v-if="!isInternal"
|
||||
label="装货合同"
|
||||
class="pl-plan-party-select-row__contract"
|
||||
>
|
||||
<div class="pl-plan-contract-trigger">
|
||||
<el-button class="btn-ghost" :disabled="disabled" @click="open">
|
||||
<el-icon><Search /></el-icon>选择合同
|
||||
@@ -104,27 +108,35 @@
|
||||
<div class="pl-plan-dibang-row">
|
||||
<el-checkbox
|
||||
:model-value="modelValue.generateDibang === 1"
|
||||
:disabled="isInternal"
|
||||
disabled
|
||||
@update:model-value="handleDibangToggle"
|
||||
>
|
||||
生成地磅单({{ dibangDirectionLabel }})
|
||||
</el-checkbox>
|
||||
<span v-if="isInternal" class="pl-plan-dibang-row__hint">本段客户为内部客户时默认勾选</span>
|
||||
<span v-else-if="modelValue.customerId" class="pl-plan-dibang-row__hint">
|
||||
仅安庆山峡/安徽云栋可生成地磅单
|
||||
</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div class="pl-plan-stop-products-head">
|
||||
<span class="pl-plan-stop-products-head__title">装货产品</span>
|
||||
<el-button
|
||||
<span
|
||||
v-if="!readonly"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="emit('add-products')"
|
||||
class="pl-plan-stop-products-head__add-wrap"
|
||||
@click="handleAddProductsClick"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>添加产品
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
size="small"
|
||||
:disabled="addProductsDisabled"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>添加产品
|
||||
</el-button>
|
||||
</span>
|
||||
</div>
|
||||
<p v-if="!modelValue.products.length" class="pl-plan-load-section__empty-hint">
|
||||
请添加至少一条装货产品
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user