提交
This commit is contained in:
1 parent
e56d227fe8
commit
4611dbc2b2
237 files changed
+1384060
-24942
No files matched your search
@@ -61,11 +61,16 @@ const props = withDefaults(
|
||||
}
|
||||
)
|
||||
|
||||
export type PlAddressApplyPayload = {
|
||||
address: string
|
||||
lng: number | null
|
||||
lat: number | null
|
||||
contact?: string
|
||||
}
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: string]
|
||||
'update:lng': [value: number | null]
|
||||
'update:lat': [value: number | null]
|
||||
'update:contact': [value: string]
|
||||
/** 地址库选中后一次性回写,避免父级多次 patch 互相覆盖 */
|
||||
apply: [value: PlAddressApplyPayload]
|
||||
}>()
|
||||
|
||||
/** 下拉默认最多展示条数 */
|
||||
@@ -101,16 +106,23 @@ function formatAddressContact(row: TransportAddress): string {
|
||||
return name || phone
|
||||
}
|
||||
|
||||
function emitApply(payload: PlAddressApplyPayload) {
|
||||
emit('apply', payload)
|
||||
}
|
||||
|
||||
function applyAddressRow(row: TransportAddress) {
|
||||
selectedId.value = row.id
|
||||
legacyOption.value = null
|
||||
emit('update:modelValue', row.fullAddress || '')
|
||||
emit('update:lng', row.lng != null ? Number(row.lng) : null)
|
||||
emit('update:lat', row.lat != null ? Number(row.lat) : null)
|
||||
const contactText = formatAddressContact(row)
|
||||
if (contactText) {
|
||||
emit('update:contact', contactText)
|
||||
const payload: PlAddressApplyPayload = {
|
||||
address: row.fullAddress || '',
|
||||
lng: row.lng != null ? Number(row.lng) : null,
|
||||
lat: row.lat != null ? Number(row.lat) : null
|
||||
}
|
||||
if (contactText) {
|
||||
payload.contact = contactText
|
||||
}
|
||||
emitApply(payload)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,9 +154,7 @@ function handleFocus() {
|
||||
function handleClear() {
|
||||
selectedId.value = ''
|
||||
legacyOption.value = null
|
||||
emit('update:modelValue', '')
|
||||
emit('update:lng', null)
|
||||
emit('update:lat', null)
|
||||
emitApply({ address: '', lng: null, lat: null })
|
||||
}
|
||||
|
||||
function handleSelectChange(id: string) {
|
||||
@@ -156,7 +166,11 @@ function handleSelectChange(id: string) {
|
||||
if (!row) return
|
||||
if (row.id.startsWith('legacy-')) {
|
||||
selectedId.value = row.id
|
||||
emit('update:modelValue', row.fullAddress || '')
|
||||
emitApply({
|
||||
address: row.fullAddress || '',
|
||||
lng: props.lng ?? null,
|
||||
lat: props.lat ?? null
|
||||
})
|
||||
return
|
||||
}
|
||||
applyAddressRow(row)
|
||||
|
||||
@@ -154,7 +154,7 @@ function openBlank() {
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
async function open(planIdOrIds: string | string[]) {
|
||||
async function open(planIdOrIds: string | string[], options?: { customerId?: string }) {
|
||||
const ids = normalizePlanIds(planIdOrIds)
|
||||
if (!ids.length) {
|
||||
ElMessage.warning('无法获取计划ID')
|
||||
@@ -175,7 +175,12 @@ async function open(planIdOrIds: string | string[]) {
|
||||
return (res.data ?? res) as Plan
|
||||
})
|
||||
)
|
||||
const plan = ids.length === 1 ? plans[0] : buildBatchPrintPlanView(plans)
|
||||
let plan = ids.length === 1 ? plans[0] : buildBatchPrintPlanView(plans)
|
||||
const customerId = String(options?.customerId || '').trim()
|
||||
if (customerId && ids.length === 1) {
|
||||
const { applyDeliveryCustomerToPlan } = await import('@/utils/pl-delivery-slip-print')
|
||||
plan = applyDeliveryCustomerToPlan(plan, customerId)
|
||||
}
|
||||
currentPlan.value = plan
|
||||
|
||||
let htmlContent = ''
|
||||
@@ -196,7 +201,7 @@ async function open(planIdOrIds: string | string[]) {
|
||||
visible.value = true
|
||||
} catch (error) {
|
||||
console.error('打开送(提)货单打印失败', error)
|
||||
ElMessage.error('加载送(提)货单失败')
|
||||
ElMessage.error(error instanceof Error ? error.message : '加载送(提)货单失败')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,6 +131,35 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="settlement?.plans?.length" class="view-section">
|
||||
<h4 class="view-section-title">关联计划</h4>
|
||||
<div class="panel dialog-list-panel">
|
||||
<div class="list-body list-wrap dialog-list-body-only">
|
||||
<ListTable table-key="business-pl-freight-settlement-view-dialog-plans"
|
||||
:data="settlement.plans || []"
|
||||
class="list-table"
|
||||
stripe
|
||||
empty-text="暂无数据"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="planNo" label="计划编号" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column prop="planDate" label="计划日期" min-width="120" align="center">
|
||||
<template #default="{ row }">{{ row.planDate || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="licensePlate" label="车牌号" min-width="140" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.licensePlate || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="freightAmount" label="运费(元)" min-width="110" align="right">
|
||||
<template #default="{ row }">{{ formatAmount(row.freightAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="freightRemark" label="运费备注" min-width="180" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.freightRemark || '—' }}</template>
|
||||
</el-table-column>
|
||||
</ListTable>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section
|
||||
v-if="settlement && (settlement.approvalFlow?.length || settlement.approvalHistory?.length)"
|
||||
class="view-section"
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,10 @@
|
||||
<!-- eslint-disable vue/no-v-model-argument -->
|
||||
<template>
|
||||
<div class="pl-plan-contract-panel" v-loading="loadingDetails">
|
||||
<div
|
||||
class="pl-plan-contract-panel"
|
||||
:class="{ 'is-compact-summary': compactSummary }"
|
||||
v-loading="loadingDetails"
|
||||
>
|
||||
<slot
|
||||
name="toolbar"
|
||||
:open="openSelector"
|
||||
@@ -26,75 +30,105 @@
|
||||
<span class="pl-plan-contract-card__no">{{ row.contractNo || row.id || '—' }}</span>
|
||||
<DictTag dict-type="crm_contract_type" :value="row.contractType" />
|
||||
<span class="pl-plan-contract-card__count">
|
||||
{{ row.products?.length || 0 }} 个产品
|
||||
{{ formatContractProductCount(row) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="pl-plan-contract-card__actions">
|
||||
<el-button link type="primary" @click="handleViewContract(String(row.id))">
|
||||
<el-icon><View /></el-icon>查看
|
||||
<el-button
|
||||
v-if="compactSummary && row.products?.length"
|
||||
link
|
||||
type="primary"
|
||||
@click="toggleExpand(String(row.id))"
|
||||
>
|
||||
<el-icon>
|
||||
<ArrowDown v-if="!isExpanded(String(row.id))" />
|
||||
<ArrowUp v-else />
|
||||
</el-icon>
|
||||
{{ isExpanded(String(row.id)) ? '收起产品明细' : '展开产品明细' }}
|
||||
</el-button>
|
||||
<el-button v-if="!readonly" link type="danger" @click="removeContract(String(row.id))">
|
||||
<el-icon><Delete /></el-icon>移除
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
title="查看"
|
||||
aria-label="查看"
|
||||
@click="handleViewContract(String(row.id))"
|
||||
>
|
||||
<el-icon><View /></el-icon>
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="!readonly"
|
||||
link
|
||||
type="danger"
|
||||
title="移除"
|
||||
aria-label="移除"
|
||||
@click="removeContract(String(row.id))"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="row.products?.length" class="pl-plan-contract-card__body">
|
||||
<div class="pl-plan-contract-card__table-scroll">
|
||||
<el-table
|
||||
:data="row.products"
|
||||
class="list-table pl-plan-contract-card__table"
|
||||
size="small"
|
||||
stripe
|
||||
>
|
||||
<el-table-column label="产品名称" min-width="110" align="left" show-overflow-tooltip>
|
||||
<template #default="{ row: product }">
|
||||
{{ product.standardProductName || product.productName || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="别名" min-width="80" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row: product }">
|
||||
{{ product.aliasName || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="品牌" min-width="72" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row: product }">
|
||||
{{ formatBrandConstraintLabel(product.brandMode, product.brandName) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="型号/规格" min-width="90" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row: product }">
|
||||
{{ product.model || product.productModel || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" min-width="64" align="right" show-overflow-tooltip>
|
||||
<template #default="{ row: product }">
|
||||
{{ product.quantity ?? '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" min-width="56" align="center">
|
||||
<template #default="{ row: product }">
|
||||
<DictTag dict-type="crm_product_unit" :value="product.unit" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="包装规格" min-width="90" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row: product }">
|
||||
{{ product.packageSpec || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="送货方式" min-width="80" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row: product }">
|
||||
{{ product.deliveryMethod || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" min-width="90" align="left" show-overflow-tooltip>
|
||||
<template #default="{ row: product }">
|
||||
{{ product.remark || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<template v-if="row.products?.length">
|
||||
<div
|
||||
v-if="!compactSummary || isExpanded(String(row.id))"
|
||||
class="pl-plan-contract-card__body"
|
||||
>
|
||||
<div class="pl-plan-contract-card__table-scroll">
|
||||
<el-table
|
||||
:data="row.products"
|
||||
class="list-table pl-plan-contract-card__table"
|
||||
size="small"
|
||||
stripe
|
||||
>
|
||||
<el-table-column label="产品名称" min-width="110" align="left" show-overflow-tooltip>
|
||||
<template #default="{ row: product }">
|
||||
{{ product.standardProductName || product.productName || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="别名" min-width="80" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row: product }">
|
||||
{{ product.aliasName || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="品牌" min-width="72" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row: product }">
|
||||
{{ formatBrandConstraintLabel(product.brandMode, product.brandName) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="型号/规格" min-width="90" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row: product }">
|
||||
{{ product.model || product.productModel || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" min-width="64" align="right" show-overflow-tooltip>
|
||||
<template #default="{ row: product }">
|
||||
{{ product.quantity ?? '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" min-width="56" align="center">
|
||||
<template #default="{ row: product }">
|
||||
<DictTag dict-type="crm_product_unit" :value="product.unit" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="包装规格" min-width="90" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row: product }">
|
||||
{{ product.packageSpec || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="送货方式" min-width="80" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row: product }">
|
||||
{{ product.deliveryMethod || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" min-width="90" align="left" show-overflow-tooltip>
|
||||
<template #default="{ row: product }">
|
||||
{{ product.remark || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<p v-else class="pl-plan-contract-card__empty">暂无产品明细</p>
|
||||
</article>
|
||||
</div>
|
||||
@@ -122,7 +156,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Delete, Search, View } from '@element-plus/icons-vue'
|
||||
import { ArrowDown, ArrowUp, Delete, Search, View } from '@element-plus/icons-vue'
|
||||
import { getContract } from '@/api/crm/contract'
|
||||
import type { ContractProductForm, ContractVO } from '@/api/crm/contract/types'
|
||||
import { fetchProductDetail } from '@/api/crm/product'
|
||||
@@ -147,12 +181,15 @@ const props = withDefaults(
|
||||
required?: boolean
|
||||
/** 只读:展示合同卡片,标题栏提供「查看」 */
|
||||
readonly?: boolean
|
||||
/** 段内窄栏:默认仅合同摘要(含产品名称),展开后显示完整产品表 */
|
||||
compactSummary?: boolean
|
||||
selectableStatuses?: string[]
|
||||
}>(),
|
||||
{
|
||||
disabled: false,
|
||||
required: false,
|
||||
readonly: false,
|
||||
compactSummary: false,
|
||||
selectableStatuses: () => ['approved', 'executing']
|
||||
}
|
||||
)
|
||||
@@ -167,6 +204,42 @@ const detailRows = ref<ContractVO[]>([])
|
||||
const loadingDetails = ref(false)
|
||||
const contractDetailDialogActive = ref(false)
|
||||
const contractDetailRef = ref<InstanceType<typeof ContractDetailDialog>>()
|
||||
const expandedContractIds = ref<Set<string>>(new Set())
|
||||
|
||||
function isExpanded(contractId: string) {
|
||||
return expandedContractIds.value.has(contractId)
|
||||
}
|
||||
|
||||
function toggleExpand(contractId: string) {
|
||||
const id = String(contractId || '').trim()
|
||||
if (!id) return
|
||||
const next = new Set(expandedContractIds.value)
|
||||
if (next.has(id)) next.delete(id)
|
||||
else next.add(id)
|
||||
expandedContractIds.value = next
|
||||
}
|
||||
|
||||
function contractProductName(product: ContractProductForm) {
|
||||
return product.standardProductName || product.productName || '—'
|
||||
}
|
||||
|
||||
/** 摘要标题:N个产品(名称1、名称2…);超过 5 个时末尾加 … */
|
||||
function formatContractProductCount(row: ContractVO) {
|
||||
const products = row.products || []
|
||||
const count = products.length
|
||||
if (!count) return '0个产品'
|
||||
const names = products
|
||||
.map(product => {
|
||||
const name = String(contractProductName(product) || '').trim()
|
||||
return name && name !== '—' ? name : ''
|
||||
})
|
||||
.filter(Boolean)
|
||||
if (!names.length) return `${count}个产品`
|
||||
const maxShow = 5
|
||||
const shown = names.slice(0, maxShow)
|
||||
const suffix = names.length > maxShow ? '、...' : ''
|
||||
return `${count}个产品(${shown.join('、')}${suffix})`
|
||||
}
|
||||
|
||||
const selectedIds = computed(() =>
|
||||
(props.modelValue || []).map(item => String(item.contractId)).filter(Boolean)
|
||||
@@ -265,6 +338,9 @@ async function handleConfirmMultiple(contracts: ContractVO[]) {
|
||||
function removeContract(id: string) {
|
||||
const next = detailRows.value.filter(item => String(item.id) !== id)
|
||||
detailRows.value = next
|
||||
const expanded = new Set(expandedContractIds.value)
|
||||
expanded.delete(String(id))
|
||||
expandedContractIds.value = expanded
|
||||
emitLinksFromDetails(next)
|
||||
}
|
||||
|
||||
@@ -290,6 +366,7 @@ watch(
|
||||
if (props.readonly) return
|
||||
if (prev && id !== prev) {
|
||||
detailRows.value = []
|
||||
expandedContractIds.value = new Set()
|
||||
emit('update:modelValue', [])
|
||||
}
|
||||
}
|
||||
@@ -312,6 +389,7 @@ watch(
|
||||
.pl-plan-contract-panel {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.pl-plan-contract-panel__toolbar {
|
||||
@@ -355,6 +433,10 @@ watch(
|
||||
border-bottom: 1px solid #a7f3d0;
|
||||
}
|
||||
|
||||
.pl-plan-contract-panel.is-compact-summary .pl-plan-contract-card__head {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.pl-plan-contract-card__meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
<!-- 送(提)货单:多送货客户时单选 -->
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="innerVisible"
|
||||
title="选择送货客户"
|
||||
width="480px"
|
||||
align-center
|
||||
append-to-body
|
||||
destroy-on-close
|
||||
class="dialog-form-layout pl-plan-delivery-customer-select-dialog"
|
||||
modal-class="order-module-dialog-mask"
|
||||
:close-on-click-modal="false"
|
||||
@closed="handleClosed"
|
||||
>
|
||||
<p class="select-hint">该计划存在多个送货客户,请选择本次打印的收货单位。</p>
|
||||
<el-radio-group v-model="selectedCustomerId" class="customer-radio-group">
|
||||
<el-radio
|
||||
v-for="item in customers"
|
||||
:key="item.customerId"
|
||||
:value="item.customerId"
|
||||
class="customer-radio-item"
|
||||
>
|
||||
<span class="customer-name">{{ item.customerName }}</span>
|
||||
<span v-if="item.deliveryCount > 1" class="form-label-tip">({{ item.deliveryCount }} 段合并)</span>
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="innerVisible = false">
|
||||
<el-icon><Close /></el-icon>取消
|
||||
</el-button>
|
||||
<el-button type="primary" :disabled="!selectedCustomerId" @click="handleConfirm">
|
||||
<el-icon><Check /></el-icon>确定
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Check, Close } from '@element-plus/icons-vue'
|
||||
import type { DeliveryPrintCustomerOption } from '@/utils/pl-delivery-slip-print'
|
||||
|
||||
const emit = defineEmits<{
|
||||
confirm: [customerId: string]
|
||||
}>()
|
||||
|
||||
const innerVisible = ref(false)
|
||||
const customers = ref<DeliveryPrintCustomerOption[]>([])
|
||||
const selectedCustomerId = ref('')
|
||||
let resolveSelect: ((customerId: string | null) => void) | null = null
|
||||
|
||||
function handleClosed() {
|
||||
customers.value = []
|
||||
selectedCustomerId.value = ''
|
||||
if (resolveSelect) {
|
||||
resolveSelect(null)
|
||||
resolveSelect = null
|
||||
}
|
||||
}
|
||||
|
||||
function handleConfirm() {
|
||||
if (!selectedCustomerId.value) {
|
||||
ElMessage.warning('请选择送货客户')
|
||||
return
|
||||
}
|
||||
const customerId = selectedCustomerId.value
|
||||
const done = resolveSelect
|
||||
resolveSelect = null
|
||||
innerVisible.value = false
|
||||
done?.(customerId)
|
||||
emit('confirm', customerId)
|
||||
}
|
||||
|
||||
/** 打开弹窗并等待用户选择;取消返回 null */
|
||||
function open(options: DeliveryPrintCustomerOption[]): Promise<string | null> {
|
||||
customers.value = options || []
|
||||
selectedCustomerId.value = options.length === 1 ? options[0].customerId : ''
|
||||
innerVisible.value = true
|
||||
return new Promise((resolve) => {
|
||||
resolveSelect = resolve
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.select-hint {
|
||||
margin: 0 0 12px;
|
||||
font-size: 13px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.customer-radio-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.customer-radio-item {
|
||||
margin-right: 0;
|
||||
height: auto;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.customer-name {
|
||||
font-size: 14px;
|
||||
color: #1e293b;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,708 @@
|
||||
<!-- eslint-disable vue/no-v-model-argument -->
|
||||
<template>
|
||||
<div class="pl-plan-delivery-section">
|
||||
<div v-if="tabMode" class="pl-plan-delivery-tabs">
|
||||
<button
|
||||
v-for="(delivery, index) in modelValue"
|
||||
:key="delivery.seq + '-' + index"
|
||||
type="button"
|
||||
class="pl-plan-delivery-tab"
|
||||
:class="{ 'is-active': activeIndex === index }"
|
||||
@click="activeIndex = index"
|
||||
>
|
||||
#{{ delivery.seq || index + 1 }}
|
||||
{{ delivery.customerName || '未选客户' }}
|
||||
<span v-if="segmentQtyLabel(delivery)" class="pl-plan-delivery-tab__qty">
|
||||
{{ segmentQtyLabel(delivery) }}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-else class="pl-plan-delivery-section__toolbar">
|
||||
<p class="pl-plan-delivery-section__hint">支持多个送货客户;数量不平衡仅告警,可暂存。</p>
|
||||
</div>
|
||||
|
||||
<article
|
||||
v-for="(delivery, index) in modelValue"
|
||||
v-show="!tabMode || activeIndex === index"
|
||||
:key="delivery.seq + '-' + index"
|
||||
class="pl-plan-delivery-card"
|
||||
:class="{ 'is-tab-panel': tabMode }"
|
||||
>
|
||||
<header v-if="!tabMode" class="pl-plan-delivery-card__head">
|
||||
<h4 class="pl-plan-delivery-card__title">送货段 #{{ delivery.seq || index + 1 }}</h4>
|
||||
<div class="pl-plan-delivery-card__actions">
|
||||
<el-button
|
||||
v-if="index > 0"
|
||||
class="btn-ghost"
|
||||
size="small"
|
||||
@click="moveDelivery(index, -1)"
|
||||
>
|
||||
<el-icon><Top /></el-icon>上移
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="index < modelValue.length - 1"
|
||||
class="btn-ghost"
|
||||
size="small"
|
||||
@click="moveDelivery(index, 1)"
|
||||
>
|
||||
<el-icon><Bottom /></el-icon>下移
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="modelValue.length > 1"
|
||||
class="btn-ghost"
|
||||
size="small"
|
||||
type="danger"
|
||||
@click="removeDelivery(index)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<PlPlanContractMultiSelect
|
||||
v-model="delivery.contracts"
|
||||
:customer-id="delivery.customerId"
|
||||
:disabled="!delivery.customerId || isPlInternalCustomerName(delivery.customerName)"
|
||||
:required="false"
|
||||
compact-summary
|
||||
>
|
||||
<template #toolbar="{ open, disabled, hint, hintWarn }">
|
||||
<div class="pl-plan-party-select-row">
|
||||
<el-form-item label="送货客户" required class="pl-plan-party-select-row__customer">
|
||||
<div class="customer-select-row">
|
||||
<el-select
|
||||
:model-value="delivery.customerId"
|
||||
class="customer-select-row__select"
|
||||
filterable
|
||||
remote
|
||||
clearable
|
||||
:remote-method="(q) => searchCustomerOptions(q, index)"
|
||||
:loading="customerOptionsLoading[index]"
|
||||
placeholder="客户名称/拼音首字母"
|
||||
@focus="handleCustomerSelectFocus(index)"
|
||||
@update:model-value="(val) => handleCustomerChange(index, val)"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in customerOptionsByIndex[index] || []"
|
||||
:key="item.id"
|
||||
:label="item.customerName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
text
|
||||
class="customer-select-row__search"
|
||||
@click="emit('open-customer-picker', index)"
|
||||
>
|
||||
<el-icon><Search /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item 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>选择合同
|
||||
</el-button>
|
||||
<span
|
||||
v-if="hint"
|
||||
class="pl-plan-contract-trigger__hint"
|
||||
:class="{ 'is-warn': hintWarn }"
|
||||
>
|
||||
{{ hint }}
|
||||
</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</template>
|
||||
</PlPlanContractMultiSelect>
|
||||
|
||||
<div class="form-grid-2">
|
||||
<el-form-item label="送货时间">
|
||||
<el-date-picker
|
||||
:model-value="delivery.deliveryTime"
|
||||
type="date"
|
||||
placeholder="选择送货时间"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%"
|
||||
@update:model-value="patchDelivery(index, { deliveryTime: $event || '' })"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系方式">
|
||||
<el-input
|
||||
:model-value="delivery.contact"
|
||||
placeholder="联系方式"
|
||||
@update:model-value="patchDelivery(index, { contact: $event })"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="送货地址" class="form-col-span-2">
|
||||
<PlAddressWithLibrary
|
||||
:model-value="delivery.address"
|
||||
:lng="delivery.lng"
|
||||
:lat="delivery.lat"
|
||||
:contact="delivery.contact"
|
||||
placeholder="送货地址"
|
||||
@apply="patchDeliveryAddress(index, $event)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="注意事项" class="form-col-span-2">
|
||||
<el-input
|
||||
:model-value="delivery.notes"
|
||||
placeholder="送货注意事项"
|
||||
@update:model-value="patchDelivery(index, { notes: $event })"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="地磅单" class="form-col-span-2">
|
||||
<div class="pl-plan-dibang-row">
|
||||
<el-checkbox
|
||||
:model-value="delivery.generateDibang === 1"
|
||||
:disabled="isDibangLocked"
|
||||
@update:model-value="(checked) => handleDibangToggle(index, checked)"
|
||||
>
|
||||
生成地磅单({{ directionLabel(delivery.dibangDirection) }})
|
||||
</el-checkbox>
|
||||
<span v-if="isDibangLocked" 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
|
||||
v-if="!readonly"
|
||||
class="btn-ghost"
|
||||
size="small"
|
||||
@click="emit('sync-products', index)"
|
||||
>
|
||||
<el-icon><Refresh /></el-icon>从装货同步
|
||||
</el-button>
|
||||
</div>
|
||||
<p v-if="showSplitHint" class="pl-plan-delivery-section__split-hint">
|
||||
多个送货段,请拆分各段数量
|
||||
</p>
|
||||
<p v-if="!delivery.products.length" class="pl-plan-delivery-section__empty-hint">
|
||||
请先在装货区添加产品,将自动同步到送货段
|
||||
</p>
|
||||
<PlPlanStopProductTable
|
||||
:products="delivery.products"
|
||||
:editable="!readonly"
|
||||
:compact="compactProducts"
|
||||
:allow-remove="false"
|
||||
:shared-readonly="true"
|
||||
@remove="(productIndex) => removeStopProduct(index, productIndex)"
|
||||
/>
|
||||
</article>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Bottom, Delete, Refresh, Search, Top } from '@element-plus/icons-vue'
|
||||
import { fetchCustomerOptions } from '@/api/crm/customer'
|
||||
import { customerStopPrefApi, type CustomerStopPref } from '@/api/pl/index'
|
||||
import PlAddressWithLibrary, {
|
||||
type PlAddressApplyPayload
|
||||
} from '@/components/business/pl-address-with-library/index.vue'
|
||||
import PlPlanContractMultiSelect from '@/components/business/pl-plan-contract-multi-select/index.vue'
|
||||
import PlPlanStopProductTable from '@/components/business/pl-plan-stop-product-table/index.vue'
|
||||
import {
|
||||
createEmptyDeliveryForm,
|
||||
sumStopProductsPlanQty,
|
||||
type PlanDeliveryForm
|
||||
} from '@/utils/pl-plan-stop-form'
|
||||
import { isPlInternalCustomerName } from '@/utils/pl-internal-customer'
|
||||
import { pickBxData } from '@/utils/http/bx'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
modelValue: PlanDeliveryForm[]
|
||||
loadCustomerName?: string
|
||||
tabMode?: boolean
|
||||
readonly?: boolean
|
||||
compactProducts?: boolean
|
||||
qtyUnitLabel?: string
|
||||
/** 多送货段时提示拆分数量 */
|
||||
showSplitHint?: boolean
|
||||
}>(),
|
||||
{
|
||||
loadCustomerName: '',
|
||||
tabMode: true,
|
||||
readonly: false,
|
||||
compactProducts: true,
|
||||
qtyUnitLabel: '',
|
||||
showSplitHint: false
|
||||
}
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: PlanDeliveryForm[]]
|
||||
'open-customer-picker': [index: number]
|
||||
'sync-products': [index: number]
|
||||
'add-delivery': []
|
||||
'active-index-change': [index: number]
|
||||
}>()
|
||||
|
||||
interface CustomerOptionRow {
|
||||
id: string
|
||||
customerName: string
|
||||
customerNo?: string
|
||||
}
|
||||
|
||||
const activeIndex = ref(0)
|
||||
const customerOptionsByIndex = ref<Record<number, CustomerOptionRow[]>>({})
|
||||
const customerOptionsLoading = ref<Record<number, boolean>>({})
|
||||
const isDibangLocked = computed(() => isPlInternalCustomerName(props.loadCustomerName))
|
||||
|
||||
watch(
|
||||
() => props.modelValue.length,
|
||||
(len) => {
|
||||
if (activeIndex.value >= len) {
|
||||
activeIndex.value = Math.max(0, len - 1)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
watch(
|
||||
activeIndex,
|
||||
(index) => {
|
||||
emit('active-index-change', index)
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
function resequence(list: PlanDeliveryForm[]) {
|
||||
return list.map((row, index) => ({ ...row, seq: index + 1 }))
|
||||
}
|
||||
|
||||
function patchDelivery(index: number, partial: Partial<PlanDeliveryForm>) {
|
||||
const next = props.modelValue.map((row, i) => (i === index ? { ...row, ...partial } : row))
|
||||
emit('update:modelValue', next)
|
||||
}
|
||||
|
||||
function patchDeliveryAddress(index: number, fields: PlAddressApplyPayload) {
|
||||
const partial: Partial<PlanDeliveryForm> = {
|
||||
address: fields.address,
|
||||
lng: fields.lng,
|
||||
lat: fields.lat
|
||||
}
|
||||
if (fields.contact !== undefined) {
|
||||
partial.contact = fields.contact
|
||||
}
|
||||
patchDelivery(index, partial)
|
||||
}
|
||||
|
||||
function removeStopProduct(deliveryIndex: number, productIndex: number) {
|
||||
const delivery = props.modelValue[deliveryIndex]
|
||||
if (!delivery) return
|
||||
patchDelivery(deliveryIndex, {
|
||||
products: delivery.products.filter((_, i) => i !== productIndex)
|
||||
})
|
||||
}
|
||||
|
||||
function addDelivery() {
|
||||
const nextSeq = props.modelValue.length + 1
|
||||
emit('update:modelValue', resequence([
|
||||
...props.modelValue,
|
||||
createEmptyDeliveryForm(nextSeq, props.loadCustomerName)
|
||||
]))
|
||||
activeIndex.value = props.modelValue.length
|
||||
emit('add-delivery')
|
||||
}
|
||||
|
||||
function removeDelivery(index: number) {
|
||||
const next = props.modelValue.filter((_, i) => i !== index)
|
||||
emit('update:modelValue', resequence(
|
||||
next.length ? next : [createEmptyDeliveryForm(1, props.loadCustomerName)]
|
||||
))
|
||||
if (activeIndex.value >= index && activeIndex.value > 0) {
|
||||
activeIndex.value -= 1
|
||||
}
|
||||
}
|
||||
|
||||
function moveDelivery(index: number, delta: number) {
|
||||
const target = index + delta
|
||||
if (target < 0 || target >= props.modelValue.length) return
|
||||
const next = [...props.modelValue]
|
||||
const temp = next[index]
|
||||
next[index] = next[target]
|
||||
next[target] = temp
|
||||
emit('update:modelValue', resequence(next))
|
||||
if (activeIndex.value === index) {
|
||||
activeIndex.value = target
|
||||
} else if (activeIndex.value === target) {
|
||||
activeIndex.value = index
|
||||
}
|
||||
}
|
||||
|
||||
function segmentQtyLabel(delivery: PlanDeliveryForm) {
|
||||
const qty = sumStopProductsPlanQty(delivery.products || [])
|
||||
if (qty <= 0) return ''
|
||||
const unit = props.qtyUnitLabel || ''
|
||||
const text = String(parseFloat(qty.toFixed(3)))
|
||||
return unit ? `${text}${unit}` : text
|
||||
}
|
||||
|
||||
function directionLabel(direction?: string) {
|
||||
if (direction === 'outbound') return '出库'
|
||||
if (direction === 'inbound') return '入库'
|
||||
return '无'
|
||||
}
|
||||
|
||||
function extractCustomerOptions(res: unknown): CustomerOptionRow[] {
|
||||
const unwrapped = (res as { data?: unknown })?.data ?? res
|
||||
if (Array.isArray(unwrapped)) return unwrapped as CustomerOptionRow[]
|
||||
const payload = (unwrapped as { list?: CustomerOptionRow[]; rows?: CustomerOptionRow[] }) || {}
|
||||
return payload.list || payload.rows || []
|
||||
}
|
||||
|
||||
function ensureCustomerOption(index: number, customer?: Partial<CustomerOptionRow> | null) {
|
||||
if (!customer?.id) return
|
||||
const id = String(customer.id)
|
||||
const list = customerOptionsByIndex.value[index] || []
|
||||
const existing = list.find((item) => String(item.id) === id)
|
||||
if (existing) {
|
||||
if (!customer.customerName) return
|
||||
customerOptionsByIndex.value = {
|
||||
...customerOptionsByIndex.value,
|
||||
[index]: list.map((item) =>
|
||||
String(item.id) === id
|
||||
? {
|
||||
...item,
|
||||
customerName: customer.customerName || item.customerName,
|
||||
customerNo: customer.customerNo || item.customerNo
|
||||
}
|
||||
: item
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
customerOptionsByIndex.value = {
|
||||
...customerOptionsByIndex.value,
|
||||
[index]: [
|
||||
{ id, customerName: customer.customerName || '', customerNo: customer.customerNo },
|
||||
...list
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.modelValue.map((row) => [row.customerId, row.customerName] as const),
|
||||
(rows) => {
|
||||
rows.forEach((pair, index) => {
|
||||
const [customerId, customerName] = pair
|
||||
if (!customerId) return
|
||||
ensureCustomerOption(index, {
|
||||
id: String(customerId),
|
||||
customerName: customerName || ''
|
||||
})
|
||||
})
|
||||
},
|
||||
{ immediate: true, deep: true }
|
||||
)
|
||||
|
||||
async function loadDefaultCustomerOptions(
|
||||
index: number,
|
||||
customerId?: string,
|
||||
customerName?: string
|
||||
) {
|
||||
customerOptionsLoading.value = { ...customerOptionsLoading.value, [index]: true }
|
||||
try {
|
||||
const res = await fetchCustomerOptions({ limit: 20 })
|
||||
customerOptionsByIndex.value = {
|
||||
...customerOptionsByIndex.value,
|
||||
[index]: extractCustomerOptions(res)
|
||||
}
|
||||
ensureCustomerOption(index, { id: customerId, customerName })
|
||||
} finally {
|
||||
customerOptionsLoading.value = { ...customerOptionsLoading.value, [index]: false }
|
||||
}
|
||||
}
|
||||
|
||||
async function searchCustomerOptions(query: string, index: number) {
|
||||
const keyword = query?.trim()
|
||||
const delivery = props.modelValue[index]
|
||||
if (!keyword) {
|
||||
await loadDefaultCustomerOptions(index, delivery?.customerId, delivery?.customerName)
|
||||
return
|
||||
}
|
||||
customerOptionsLoading.value = { ...customerOptionsLoading.value, [index]: true }
|
||||
try {
|
||||
const res = await fetchCustomerOptions({ keyword, limit: 50 })
|
||||
customerOptionsByIndex.value = {
|
||||
...customerOptionsByIndex.value,
|
||||
[index]: extractCustomerOptions(res)
|
||||
}
|
||||
ensureCustomerOption(index, {
|
||||
id: delivery?.customerId,
|
||||
customerName: delivery?.customerName
|
||||
})
|
||||
} finally {
|
||||
customerOptionsLoading.value = { ...customerOptionsLoading.value, [index]: false }
|
||||
}
|
||||
}
|
||||
|
||||
function handleCustomerSelectFocus(index: number) {
|
||||
if (!(customerOptionsByIndex.value[index] || []).length) {
|
||||
const delivery = props.modelValue[index]
|
||||
loadDefaultCustomerOptions(index, delivery?.customerId, delivery?.customerName)
|
||||
}
|
||||
}
|
||||
|
||||
function handleCustomerChange(index: number, customerId?: string) {
|
||||
if (!customerId) {
|
||||
patchDelivery(index, {
|
||||
customerId: '',
|
||||
customerName: '',
|
||||
contracts: [],
|
||||
generateDibang: 0,
|
||||
dibangDirection: 'none',
|
||||
address: '',
|
||||
lng: null,
|
||||
lat: null,
|
||||
contact: '',
|
||||
notes: ''
|
||||
})
|
||||
return
|
||||
}
|
||||
const current = props.modelValue[index]
|
||||
if (current && String(current.customerId) === String(customerId)) {
|
||||
ensureCustomerOption(index, { id: customerId, customerName: current.customerName })
|
||||
return
|
||||
}
|
||||
const customer = (customerOptionsByIndex.value[index] || []).find(
|
||||
(item) => String(item.id) === String(customerId)
|
||||
)
|
||||
const customerName = customer?.customerName || ''
|
||||
patchDelivery(index, {
|
||||
customerId: String(customerId),
|
||||
customerName,
|
||||
contracts: [],
|
||||
address: '',
|
||||
lng: null,
|
||||
lat: null,
|
||||
contact: '',
|
||||
notes: ''
|
||||
})
|
||||
void applyDeliveryStopPref(index, String(customerId))
|
||||
}
|
||||
|
||||
async function applyDeliveryStopPref(index: number, customerId: string) {
|
||||
try {
|
||||
const res = await customerStopPrefApi.get({ customerId, stopType: 'delivery' })
|
||||
const pref = pickBxData<CustomerStopPref | null>(res)
|
||||
if (!pref) return
|
||||
const current = props.modelValue[index]
|
||||
if (!current || String(current.customerId) !== String(customerId)) return
|
||||
const partial: Partial<PlanDeliveryForm> = {}
|
||||
const prefAddress = (pref.address || '').trim()
|
||||
if (prefAddress) partial.address = prefAddress
|
||||
if (pref.lng != null) partial.lng = pref.lng
|
||||
if (pref.lat != null) partial.lat = pref.lat
|
||||
const prefContact = (pref.contact || '').trim()
|
||||
if (prefContact) partial.contact = prefContact
|
||||
const prefNotes = (pref.notes || '').trim()
|
||||
if (prefNotes) partial.notes = prefNotes
|
||||
if (Object.keys(partial).length) patchDelivery(index, partial)
|
||||
} catch {
|
||||
// 静默:不阻断选客户
|
||||
}
|
||||
}
|
||||
|
||||
function handleDibangToggle(index: number, checked: boolean) {
|
||||
const delivery = props.modelValue[index]
|
||||
const direction = isDibangLocked.value ? 'inbound' : delivery.dibangDirection || 'none'
|
||||
patchDelivery(index, {
|
||||
generateDibang: checked ? 1 : 0,
|
||||
dibangDirection: checked ? direction : 'none'
|
||||
})
|
||||
}
|
||||
|
||||
function applyCustomerFromPicker(
|
||||
index: number,
|
||||
customer: { id: string | number; customerName?: string }
|
||||
) {
|
||||
ensureCustomerOption(index, { id: String(customer.id), customerName: customer.customerName })
|
||||
handleCustomerChange(index, String(customer.id))
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
applyCustomerFromPicker,
|
||||
ensureCustomerOption,
|
||||
loadDefaultCustomerOptions,
|
||||
addDelivery,
|
||||
moveDelivery,
|
||||
removeDelivery
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-delivery-section__toolbar {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.pl-plan-delivery-section__hint {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pl-plan-delivery-tabs {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.pl-plan-delivery-tab {
|
||||
border: 1px solid #d9e8e2;
|
||||
background: #fff;
|
||||
border-radius: 6px;
|
||||
padding: 5px 10px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
color: #64748b;
|
||||
font-family: inherit;
|
||||
max-width: 100%;
|
||||
text-align: left;
|
||||
line-height: 1.35;
|
||||
|
||||
&.is-active {
|
||||
border-color: #7dd3fc;
|
||||
background: #f0f9ff;
|
||||
color: #0284c7;
|
||||
}
|
||||
|
||||
&__qty {
|
||||
margin-left: 4px;
|
||||
font-weight: 400;
|
||||
color: #94a3b8;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-delivery-card {
|
||||
&.is-tab-panel {
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
&:not(.is-tab-panel) {
|
||||
border: 1px solid #d9e8e2;
|
||||
border-radius: 10px;
|
||||
padding: 14px;
|
||||
margin-bottom: 12px;
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-delivery-card__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.pl-plan-delivery-card__title {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.pl-plan-delivery-card__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.pl-plan-stop-products-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin: 8px 0 0;
|
||||
}
|
||||
|
||||
.pl-plan-stop-products-head__title {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pl-plan-delivery-section__split-hint {
|
||||
margin: 6px 0 0;
|
||||
font-size: 12px;
|
||||
color: #d97706;
|
||||
}
|
||||
|
||||
.pl-plan-delivery-section__empty-hint {
|
||||
margin: 6px 0 0;
|
||||
font-size: 12px;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.pl-plan-dibang-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.pl-plan-dibang-row__hint {
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.customer-select-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.customer-select-row__select {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.pl-plan-party-select-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.pl-plan-party-select-row__customer {
|
||||
flex: 1.4 1 0;
|
||||
min-width: 0;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.pl-plan-party-select-row__contract {
|
||||
flex: 1 1 0;
|
||||
min-width: 120px;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.pl-plan-contract-trigger {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
min-height: 32px;
|
||||
}
|
||||
|
||||
.pl-plan-contract-trigger__hint {
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
|
||||
&.is-warn {
|
||||
color: #d97706;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -12,8 +12,32 @@
|
||||
:title="item.isImage || item.isPdf ? '点击在新标签页查看' : '点击查看'"
|
||||
@click.stop="handlePreview(item)"
|
||||
>
|
||||
<div class="pl-plan-document-attachment-cell__placeholder is-clickable">
|
||||
<el-icon :size="16" color="#10b981"><Picture /></el-icon>
|
||||
<el-image
|
||||
v-if="item.isImage && !usePlaceholderThumb && mediaActive"
|
||||
class="pl-plan-document-attachment-cell__image pl-plan-document-attachment-cell__image--passive"
|
||||
fit="cover"
|
||||
lazy
|
||||
:src="displaySrc(item.url)"
|
||||
:preview-src-list="[]"
|
||||
>
|
||||
<template #error>
|
||||
<div class="pl-plan-document-attachment-cell__placeholder is-clickable is-common-thumb">
|
||||
<el-icon :size="16" color="#10b981"><Picture /></el-icon>
|
||||
</div>
|
||||
</template>
|
||||
</el-image>
|
||||
<div
|
||||
v-else
|
||||
class="pl-plan-document-attachment-cell__placeholder is-clickable"
|
||||
:class="{ 'is-common-thumb': usePlaceholderThumb }"
|
||||
>
|
||||
<el-icon :size="16" :color="usePlaceholderThumb ? '#10b981' : item.isPdf ? '#0284c7' : '#10b981'">
|
||||
<Picture v-if="usePlaceholderThumb || item.isImage" />
|
||||
<Document v-else />
|
||||
</el-icon>
|
||||
<span v-if="!usePlaceholderThumb && item.ext" class="pl-plan-document-attachment-cell__ext">{{
|
||||
item.ext
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-icon
|
||||
@@ -32,7 +56,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { Download, Picture } from '@element-plus/icons-vue'
|
||||
import { Document, Download, Picture } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { PlanDocumentAttachmentItem } from '@/api/pl'
|
||||
import {
|
||||
@@ -44,11 +68,15 @@
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
attachments?: PlanDocumentAttachmentItem[] | null
|
||||
/** KeepAlive 离开页时置 false,暂停缩略图请求 */
|
||||
mediaActive?: boolean
|
||||
/** 列表态仅用统一占位缩略图,点击预览/下载时再加载真实文件 */
|
||||
usePlaceholderThumb?: boolean
|
||||
}>(),
|
||||
{
|
||||
attachments: () => [],
|
||||
mediaActive: true
|
||||
mediaActive: true,
|
||||
usePlaceholderThumb: true
|
||||
}
|
||||
)
|
||||
|
||||
@@ -59,6 +87,7 @@
|
||||
url: string
|
||||
isImage: boolean
|
||||
isPdf: boolean
|
||||
ext: string
|
||||
}
|
||||
|
||||
function isImageUrl(url: string) {
|
||||
@@ -75,6 +104,14 @@
|
||||
return /\.pdf$/i.test(path)
|
||||
}
|
||||
|
||||
function fileExt(url: string) {
|
||||
const path = String(url || '')
|
||||
.split('?')[0]
|
||||
.toLowerCase()
|
||||
const match = path.match(/\.([a-z0-9]+)$/i)
|
||||
return match ? match[1].toUpperCase() : ''
|
||||
}
|
||||
|
||||
function fileNameFromUrl(url: string) {
|
||||
return (
|
||||
String(url || '')
|
||||
@@ -84,6 +121,10 @@
|
||||
)
|
||||
}
|
||||
|
||||
function displaySrc(url: string) {
|
||||
return resolvePhotoDisplayUrl(url) || url
|
||||
}
|
||||
|
||||
async function handlePreview(item: ItemDef) {
|
||||
if (!item.url) return
|
||||
await openAttachmentPreviewInNewTab(
|
||||
@@ -125,7 +166,8 @@
|
||||
fullLabel,
|
||||
url,
|
||||
isImage: isImageUrl(url),
|
||||
isPdf: isPdfUrl(url)
|
||||
isPdf: isPdfUrl(url),
|
||||
ext: fileExt(url)
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -165,18 +207,39 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.pl-plan-document-attachment-cell__image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
&--passive {
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-document-attachment-cell__placeholder {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin-bottom: 10px;
|
||||
background: var(--primary-bg, #ecfdf5);
|
||||
|
||||
&.is-clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&.is-common-thumb {
|
||||
background: var(--primary-bg, #ecfdf5);
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-document-attachment-cell__ext {
|
||||
margin-top: 2px;
|
||||
font-size: 9px;
|
||||
line-height: 1;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pl-plan-document-attachment-cell__download {
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="showInboundOutboundQty || showArchiveIoFields"
|
||||
label="入库数量"
|
||||
v-if="(showInboundOutboundQty || showArchiveIoFields) && !archiveIoOutboundOnly"
|
||||
:label="archiveSegmentLabels ? '实际数量' : '入库数量'"
|
||||
min-width="110"
|
||||
align="right"
|
||||
>
|
||||
@@ -144,8 +144,8 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="showArchiveIoFields"
|
||||
label="入库单价(元)"
|
||||
v-if="showArchiveIoFields && !archiveIoOutboundOnly"
|
||||
:label="archiveSegmentLabels ? '单价(元)' : '入库单价(元)'"
|
||||
min-width="120"
|
||||
align="right"
|
||||
>
|
||||
@@ -162,8 +162,8 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="showArchiveIoFields"
|
||||
label="入库金额"
|
||||
v-if="showArchiveIoFields && !archiveIoOutboundOnly"
|
||||
:label="archiveSegmentLabels ? '金额(元)' : '入库金额'"
|
||||
min-width="110"
|
||||
align="right"
|
||||
>
|
||||
@@ -172,8 +172,8 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="showInboundOutboundQty || showArchiveIoFields"
|
||||
label="出库数量"
|
||||
v-if="(showInboundOutboundQty || showArchiveIoFields) && !archiveIoInboundOnly"
|
||||
:label="archiveSegmentLabels ? '实际数量' : '出库数量'"
|
||||
min-width="110"
|
||||
align="right"
|
||||
>
|
||||
@@ -190,8 +190,8 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="showArchiveIoFields"
|
||||
label="出库单价(元)"
|
||||
v-if="showArchiveIoFields && !archiveIoInboundOnly"
|
||||
:label="archiveSegmentLabels ? '单价(元)' : '出库单价(元)'"
|
||||
min-width="120"
|
||||
align="right"
|
||||
>
|
||||
@@ -208,8 +208,8 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="showArchiveIoFields"
|
||||
label="出库金额"
|
||||
v-if="showArchiveIoFields && !archiveIoInboundOnly"
|
||||
:label="archiveSegmentLabels ? '金额(元)' : '出库金额'"
|
||||
min-width="110"
|
||||
align="right"
|
||||
>
|
||||
@@ -348,6 +348,12 @@ const props = defineProps<{
|
||||
showArchiveIoFields?: boolean
|
||||
/** 入库/出库数量与价格可编辑(归档弹窗) */
|
||||
editableArchiveIoFields?: boolean
|
||||
/** 归档:仅展示/编辑入库列(装货段) */
|
||||
archiveIoInboundOnly?: boolean
|
||||
/** 归档:仅展示/编辑出库列(送货段) */
|
||||
archiveIoOutboundOnly?: boolean
|
||||
/** 段次归档:入库/出库列统一展示为实际数量、单价、金额 */
|
||||
archiveSegmentLabels?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div v-if="products.length" class="pl-plan-list-product-cell">
|
||||
<div v-if="displayProducts.length" class="pl-plan-list-product-cell">
|
||||
<div
|
||||
v-for="(product, index) in products"
|
||||
v-for="(product, index) in displayProducts"
|
||||
:key="product.id || `${product.productNo}-${index}`"
|
||||
class="pl-plan-list-product-cell__row"
|
||||
>
|
||||
@@ -19,7 +19,11 @@
|
||||
}"
|
||||
>
|
||||
<template v-if="!field">
|
||||
<span class="pl-plan-list-product-cell__text">{{ formatProductLine(product) }}</span>
|
||||
<span class="pl-plan-list-product-cell__text">{{
|
||||
useStopProducts
|
||||
? formatStopProductLine(product as PlanStopProduct)
|
||||
: formatProductLine(product as PlanProduct)
|
||||
}}</span>
|
||||
<el-tag
|
||||
v-if="getHazardFlags(product).isToxic"
|
||||
type="warning"
|
||||
@@ -37,22 +41,24 @@
|
||||
爆
|
||||
</el-tag>
|
||||
<span
|
||||
v-if="showCertStatus && isHazardProduct(product)"
|
||||
v-if="showCertStatus && isHazardProduct(resolveCertProduct(product))"
|
||||
class="pl-plan-list-product-cell__certs"
|
||||
>
|
||||
<span
|
||||
v-for="slot in getRequiredCertSlots(product)"
|
||||
v-for="slot in getRequiredCertSlots(resolveCertProduct(product))"
|
||||
:key="slot.key"
|
||||
class="pl-plan-list-product-cell__cert-text"
|
||||
>
|
||||
{{ slot.label }}(<span
|
||||
:class="{
|
||||
'pl-plan-list-product-cell__cert-status--missing': !isProductCertSlotFilled(
|
||||
product,
|
||||
resolveCertProduct(product),
|
||||
slot.key
|
||||
)
|
||||
}"
|
||||
>{{ isProductCertSlotFilled(product, slot.key) ? '有' : '无' }}</span
|
||||
>{{
|
||||
isProductCertSlotFilled(resolveCertProduct(product), slot.key) ? '有' : '无'
|
||||
}}</span
|
||||
>)
|
||||
</span>
|
||||
</span>
|
||||
@@ -84,174 +90,276 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { PlanProduct } from '@/api/pl'
|
||||
import {
|
||||
getRequiredCertSlots,
|
||||
isHazardProduct,
|
||||
isProductCertSlotFilled,
|
||||
resolveProductHazardFlags
|
||||
} from '@/composables/usePlToxicProductCertCheck'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import {
|
||||
formatPlanProductListText,
|
||||
getPlanProductActualQuantity,
|
||||
getPlanProductInboundQuantity,
|
||||
getPlanProductModel,
|
||||
getPlanProductOutboundQuantity,
|
||||
getPlanProductPackageSpec,
|
||||
getPlanProductPlannedQuantity,
|
||||
getPlanProductQuantity,
|
||||
getPlanProductSpec
|
||||
} from '@/utils/pl-display'
|
||||
import type { PlanProduct, PlanStopProduct } from '@/api/pl'
|
||||
import {
|
||||
getRequiredCertSlots,
|
||||
isHazardProduct,
|
||||
isProductCertSlotFilled,
|
||||
resolveProductHazardFlags
|
||||
} from '@/composables/usePlToxicProductCertCheck'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import {
|
||||
formatPlanProductListText,
|
||||
getPlanProductActualQuantity,
|
||||
getPlanProductInboundQuantity,
|
||||
getPlanProductModel,
|
||||
getPlanProductOutboundQuantity,
|
||||
getPlanProductPackageSpec,
|
||||
getPlanProductPlannedQuantity,
|
||||
getPlanProductQuantity,
|
||||
getPlanProductSpec
|
||||
} from '@/utils/pl-display'
|
||||
import { computed } from 'vue'
|
||||
|
||||
export type PlPlanListProductCellField =
|
||||
| 'name'
|
||||
| 'spec'
|
||||
| 'model'
|
||||
| 'packageSpec'
|
||||
| 'qty'
|
||||
| 'planQty'
|
||||
| 'actualQty'
|
||||
| 'inboundQty'
|
||||
| 'outboundQty'
|
||||
| 'unit'
|
||||
export type PlPlanListProductCellField =
|
||||
| 'name'
|
||||
| 'spec'
|
||||
| 'model'
|
||||
| 'packageSpec'
|
||||
| 'qty'
|
||||
| 'planQty'
|
||||
| 'actualQty'
|
||||
| 'inboundQty'
|
||||
| 'outboundQty'
|
||||
| 'unit'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
products?: PlanProduct[]
|
||||
/** 按字段拆列展示;未传时保持整行拼接 */
|
||||
field?: PlPlanListProductCellField
|
||||
/** 危化品行下方展示证书有无(按产品类型;仅整行模式) */
|
||||
showCertStatus?: boolean
|
||||
}>(),
|
||||
{
|
||||
products: () => [],
|
||||
showCertStatus: false
|
||||
}
|
||||
)
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
products?: PlanProduct[]
|
||||
/** 段内产品(与 products 二选一,优先 stopProducts) */
|
||||
stopProducts?: PlanStopProduct[]
|
||||
/** 关联计划产品,用于段内 actualQty 与危化标识 */
|
||||
planProducts?: PlanProduct[]
|
||||
/** 按字段拆列展示;未传时保持整行拼接 */
|
||||
field?: PlPlanListProductCellField
|
||||
/** 危化品行下方展示证书有无(按产品类型;仅整行模式) */
|
||||
showCertStatus?: boolean
|
||||
}>(),
|
||||
{
|
||||
products: () => [],
|
||||
stopProducts: () => [],
|
||||
planProducts: () => [],
|
||||
showCertStatus: false
|
||||
}
|
||||
)
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const dictStore = useDictStore()
|
||||
|
||||
function getUnitLabel(unit: string) {
|
||||
return dictStore.getLabel('crm_product_unit', unit)
|
||||
}
|
||||
const useStopProducts = computed(() => (props.stopProducts?.length ?? 0) > 0)
|
||||
|
||||
function formatProductLine(product: PlanProduct) {
|
||||
return formatPlanProductListText(product, getUnitLabel)
|
||||
}
|
||||
const displayProducts = computed(() => {
|
||||
if (useStopProducts.value) return props.stopProducts
|
||||
return props.products
|
||||
})
|
||||
|
||||
function formatFieldValue(product: PlanProduct) {
|
||||
if (props.field === 'spec') {
|
||||
return getPlanProductSpec(product)
|
||||
function getUnitLabel(unit: string) {
|
||||
return dictStore.getLabel('crm_product_unit', unit)
|
||||
}
|
||||
if (props.field === 'model') {
|
||||
return getPlanProductModel(product)
|
||||
}
|
||||
if (props.field === 'packageSpec') {
|
||||
return getPlanProductPackageSpec(product)
|
||||
}
|
||||
if (props.field === 'qty') {
|
||||
return getPlanProductQuantity(product)
|
||||
}
|
||||
if (props.field === 'planQty') {
|
||||
return getPlanProductPlannedQuantity(product)
|
||||
}
|
||||
if (props.field === 'actualQty') {
|
||||
return getPlanProductActualQuantity(product)
|
||||
}
|
||||
if (props.field === 'inboundQty') {
|
||||
return getPlanProductInboundQuantity(product)
|
||||
}
|
||||
if (props.field === 'outboundQty') {
|
||||
return getPlanProductOutboundQuantity(product)
|
||||
}
|
||||
if (props.field === 'unit') {
|
||||
const unitRaw = product.unit || ''
|
||||
if (!unitRaw) return '—'
|
||||
return getUnitLabel(unitRaw) || unitRaw
|
||||
}
|
||||
return '—'
|
||||
}
|
||||
|
||||
function getHazardFlags(product: PlanProduct) {
|
||||
return resolveProductHazardFlags(product)
|
||||
}
|
||||
function resolveLinkedPlanProduct(stopProduct: PlanStopProduct): PlanProduct | undefined {
|
||||
const planProducts = props.planProducts || []
|
||||
return (
|
||||
planProducts.find(
|
||||
(item) =>
|
||||
stopProduct.planProductId &&
|
||||
item.id &&
|
||||
String(item.id) === String(stopProduct.planProductId)
|
||||
) || planProducts.find((item) => String(item.productId) === String(stopProduct.productId))
|
||||
)
|
||||
}
|
||||
|
||||
function formatStopProductLine(stopProduct: PlanStopProduct) {
|
||||
const linked = resolveLinkedPlanProduct(stopProduct)
|
||||
if (linked) return formatPlanProductListText(linked, getUnitLabel)
|
||||
const unit = getUnitLabel(stopProduct.unit || '') || stopProduct.unit || ''
|
||||
const qty =
|
||||
stopProduct.planQty != null && Number.isFinite(Number(stopProduct.planQty))
|
||||
? `${stopProduct.planQty}${unit ? ` ${unit}` : ''}`
|
||||
: ''
|
||||
const model = stopProduct.model ? ` ${stopProduct.model}` : ''
|
||||
return [stopProduct.productName || '—', model, qty].filter(Boolean).join('')
|
||||
}
|
||||
|
||||
function formatStopQty(value: unknown, unitRaw?: string) {
|
||||
if (value == null || value === '') return '—'
|
||||
const num = Number(value)
|
||||
if (!Number.isFinite(num)) return '—'
|
||||
const unit = getUnitLabel(unitRaw || '') || unitRaw || ''
|
||||
return unit ? `${num} ${unit}` : String(num)
|
||||
}
|
||||
|
||||
function formatProductLine(product: PlanProduct) {
|
||||
return formatPlanProductListText(product, getUnitLabel)
|
||||
}
|
||||
|
||||
function formatFieldValue(product: PlanProduct | PlanStopProduct) {
|
||||
if (useStopProducts.value) {
|
||||
const stopProduct = product as PlanStopProduct
|
||||
const linked = resolveLinkedPlanProduct(stopProduct)
|
||||
if (props.field === 'spec' || props.field === 'model') {
|
||||
return (
|
||||
stopProduct.model || linked?.model || (linked ? getPlanProductSpec(linked) : '—') || '—'
|
||||
)
|
||||
}
|
||||
if (props.field === 'packageSpec') {
|
||||
return stopProduct.packageSpec || linked?.packageSpec || '—'
|
||||
}
|
||||
if (props.field === 'planQty') {
|
||||
return formatStopQty(stopProduct.planQty)
|
||||
}
|
||||
if (props.field === 'inboundQty') {
|
||||
return formatStopQty(stopProduct.inboundQty, stopProduct.unit)
|
||||
}
|
||||
if (props.field === 'outboundQty') {
|
||||
return formatStopQty(stopProduct.outboundQty, stopProduct.unit)
|
||||
}
|
||||
if (props.field === 'actualQty') {
|
||||
return linked ? getPlanProductActualQuantity(linked) : '—'
|
||||
}
|
||||
if (props.field === 'unit') {
|
||||
const unitRaw = stopProduct.unit || linked?.unit || ''
|
||||
if (!unitRaw) return '—'
|
||||
return getUnitLabel(unitRaw) || unitRaw
|
||||
}
|
||||
return '—'
|
||||
}
|
||||
|
||||
const planProduct = product as PlanProduct
|
||||
if (props.field === 'spec') {
|
||||
return getPlanProductSpec(planProduct)
|
||||
}
|
||||
if (props.field === 'model') {
|
||||
return getPlanProductModel(planProduct)
|
||||
}
|
||||
if (props.field === 'packageSpec') {
|
||||
return getPlanProductPackageSpec(planProduct)
|
||||
}
|
||||
if (props.field === 'qty') {
|
||||
return getPlanProductQuantity(planProduct)
|
||||
}
|
||||
if (props.field === 'planQty') {
|
||||
return getPlanProductPlannedQuantity(planProduct)
|
||||
}
|
||||
if (props.field === 'actualQty') {
|
||||
return getPlanProductActualQuantity(planProduct)
|
||||
}
|
||||
if (props.field === 'inboundQty') {
|
||||
return getPlanProductInboundQuantity(planProduct)
|
||||
}
|
||||
if (props.field === 'outboundQty') {
|
||||
return getPlanProductOutboundQuantity(planProduct)
|
||||
}
|
||||
if (props.field === 'unit') {
|
||||
const unitRaw = planProduct.unit || ''
|
||||
if (!unitRaw) return '—'
|
||||
return getUnitLabel(unitRaw) || unitRaw
|
||||
}
|
||||
return '—'
|
||||
}
|
||||
|
||||
function getHazardFlags(product: PlanProduct | PlanStopProduct) {
|
||||
if (useStopProducts.value) {
|
||||
const linked = resolveLinkedPlanProduct(product as PlanStopProduct)
|
||||
if (linked) return resolveProductHazardFlags(linked)
|
||||
return { isToxic: false, isExplosive: false }
|
||||
}
|
||||
return resolveProductHazardFlags(product as PlanProduct)
|
||||
}
|
||||
|
||||
function resolveCertProduct(product: PlanProduct | PlanStopProduct): PlanProduct {
|
||||
if (useStopProducts.value) {
|
||||
return (
|
||||
resolveLinkedPlanProduct(product as PlanStopProduct) ||
|
||||
({
|
||||
id: (product as PlanStopProduct).id || (product as PlanStopProduct).productId,
|
||||
planId: '',
|
||||
productId: (product as PlanStopProduct).productId,
|
||||
productNo: (product as PlanStopProduct).productNo,
|
||||
productName: (product as PlanStopProduct).productName,
|
||||
unit: (product as PlanStopProduct).unit || '吨',
|
||||
isExplosive: 0,
|
||||
isToxic: 0
|
||||
} as PlanProduct)
|
||||
)
|
||||
}
|
||||
return product as PlanProduct
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-list-product-cell {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
.pl-plan-list-product-cell {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.pl-plan-list-product-cell__row {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
.pl-plan-list-product-cell__row {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.pl-plan-list-product-cell__line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: var(--text, #1e293b);
|
||||
text-align: left;
|
||||
}
|
||||
.pl-plan-list-product-cell__line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: var(--text, #1e293b);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.pl-plan-list-product-cell__line--qty {
|
||||
justify-content: flex-end;
|
||||
text-align: right;
|
||||
width: 100%;
|
||||
}
|
||||
.pl-plan-list-product-cell__line--qty {
|
||||
justify-content: flex-end;
|
||||
text-align: right;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pl-plan-list-product-cell__line--center {
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
.pl-plan-list-product-cell__line--center {
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pl-plan-list-product-cell__text {
|
||||
min-width: 0;
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.pl-plan-list-product-cell__text {
|
||||
min-width: 0;
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.pl-plan-list-product-cell__mark {
|
||||
flex-shrink: 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
.pl-plan-list-product-cell__mark {
|
||||
flex-shrink: 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.pl-plan-list-product-cell__certs {
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
.pl-plan-list-product-cell__certs {
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.pl-plan-list-product-cell__cert-text {
|
||||
color: var(--mint-text);
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.pl-plan-list-product-cell__cert-text {
|
||||
color: var(--mint-text);
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.pl-plan-list-product-cell__cert-status--missing {
|
||||
color: var(--danger, #dc2626);
|
||||
font-weight: 500;
|
||||
}
|
||||
.pl-plan-list-product-cell__cert-status--missing {
|
||||
color: var(--danger, #dc2626);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.pl-plan-list-product-cell__empty {
|
||||
color: var(--mint-text);
|
||||
}
|
||||
.pl-plan-list-product-cell__empty {
|
||||
color: var(--mint-text);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,481 @@
|
||||
<!-- eslint-disable vue/no-v-model-argument -->
|
||||
<template>
|
||||
<div class="pl-plan-load-section">
|
||||
<PlPlanContractMultiSelect
|
||||
v-model="contractsModel"
|
||||
:customer-id="modelValue.customerId"
|
||||
:disabled="!modelValue.customerId || contractDisabled"
|
||||
:required="false"
|
||||
compact-summary
|
||||
>
|
||||
<template #toolbar="{ open, disabled, hint, hintWarn }">
|
||||
<div class="pl-plan-party-select-row">
|
||||
<el-form-item label="装货客户" required class="pl-plan-party-select-row__customer">
|
||||
<div class="customer-select-row">
|
||||
<el-select
|
||||
:model-value="modelValue.customerId"
|
||||
class="customer-select-row__select"
|
||||
filterable
|
||||
remote
|
||||
clearable
|
||||
:remote-method="searchCustomerOptions"
|
||||
:loading="customerOptionsLoading"
|
||||
placeholder="客户名称/拼音首字母"
|
||||
@focus="handleCustomerSelectFocus"
|
||||
@update:model-value="handleCustomerChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in customerOptions"
|
||||
:key="item.id"
|
||||
:label="item.customerName"
|
||||
:value="item.id"
|
||||
>
|
||||
<div class="customer-option-row">
|
||||
<span>{{ item.customerName }}</span>
|
||||
<span v-if="item.customerNo" class="customer-option-row__meta">{{
|
||||
item.customerNo
|
||||
}}</span>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button
|
||||
text
|
||||
class="customer-select-row__search"
|
||||
@click="emit('open-customer-picker')"
|
||||
>
|
||||
<el-icon><Search /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item 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>选择合同
|
||||
</el-button>
|
||||
<span
|
||||
v-if="hint"
|
||||
class="pl-plan-contract-trigger__hint"
|
||||
:class="{ 'is-warn': hintWarn }"
|
||||
>
|
||||
{{ hint }}
|
||||
</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</template>
|
||||
</PlPlanContractMultiSelect>
|
||||
|
||||
<div class="form-grid-2 pl-plan-load-section__grid">
|
||||
<el-form-item label="装货时间">
|
||||
<el-date-picker
|
||||
:model-value="modelValue.loadTime"
|
||||
type="date"
|
||||
placeholder="选择装货时间"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%"
|
||||
@update:model-value="patch({ loadTime: $event || '' })"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系方式">
|
||||
<el-input
|
||||
:model-value="modelValue.contact"
|
||||
placeholder="联系方式"
|
||||
@update:model-value="patch({ contact: $event })"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="装货地址" class="form-col-span-2">
|
||||
<PlAddressWithLibrary
|
||||
:model-value="modelValue.address"
|
||||
:lng="modelValue.lng"
|
||||
:lat="modelValue.lat"
|
||||
:contact="modelValue.contact"
|
||||
placeholder="装货地址"
|
||||
@apply="patchAddress($event)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="注意事项" class="form-col-span-2">
|
||||
<el-input
|
||||
:model-value="modelValue.notes"
|
||||
placeholder="装货注意事项"
|
||||
@update:model-value="patch({ notes: $event })"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="地磅单" class="form-col-span-2">
|
||||
<div class="pl-plan-dibang-row">
|
||||
<el-checkbox
|
||||
:model-value="modelValue.generateDibang === 1"
|
||||
:disabled="isInternal"
|
||||
@update:model-value="handleDibangToggle"
|
||||
>
|
||||
生成地磅单({{ dibangDirectionLabel }})
|
||||
</el-checkbox>
|
||||
<span v-if="isInternal" 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
|
||||
v-if="!readonly"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="emit('add-products')"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>添加产品
|
||||
</el-button>
|
||||
</div>
|
||||
<p v-if="!modelValue.products.length" class="pl-plan-load-section__empty-hint">
|
||||
请添加至少一条装货产品
|
||||
</p>
|
||||
<PlPlanStopProductTable
|
||||
:products="modelValue.products"
|
||||
:editable="!readonly"
|
||||
:compact="compactProducts"
|
||||
@remove="removeStopProduct"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Plus, Search } from '@element-plus/icons-vue'
|
||||
import { fetchCustomerOptions } from '@/api/crm/customer'
|
||||
import { customerStopPrefApi, type CustomerStopPref } from '@/api/pl/index'
|
||||
import PlAddressWithLibrary, {
|
||||
type PlAddressApplyPayload
|
||||
} from '@/components/business/pl-address-with-library/index.vue'
|
||||
import PlPlanContractMultiSelect from '@/components/business/pl-plan-contract-multi-select/index.vue'
|
||||
import PlPlanStopProductTable from '@/components/business/pl-plan-stop-product-table/index.vue'
|
||||
import { resolveStopDibangDefaults, type PlanLoadForm } from '@/utils/pl-plan-stop-form'
|
||||
import { isPlInternalCustomerName } from '@/utils/pl-internal-customer'
|
||||
import { pickBxData } from '@/utils/http/bx'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
modelValue: PlanLoadForm
|
||||
readonly?: boolean
|
||||
compactProducts?: boolean
|
||||
}>(),
|
||||
{
|
||||
readonly: false,
|
||||
compactProducts: true
|
||||
}
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: PlanLoadForm]
|
||||
'open-customer-picker': []
|
||||
'add-products': []
|
||||
'customer-conflict': [message: string]
|
||||
}>()
|
||||
|
||||
interface CustomerOptionRow {
|
||||
id: string
|
||||
customerName: string
|
||||
customerNo?: string
|
||||
}
|
||||
|
||||
const customerOptions = ref<CustomerOptionRow[]>([])
|
||||
const customerOptionsLoading = ref(false)
|
||||
|
||||
const isInternal = computed(() => isPlInternalCustomerName(props.modelValue.customerName))
|
||||
const contractDisabled = computed(() => isInternal.value)
|
||||
|
||||
const dibangDirectionLabel = computed(() => {
|
||||
if (props.modelValue.dibangDirection === 'outbound') return '出库'
|
||||
if (props.modelValue.dibangDirection === 'inbound') return '入库'
|
||||
return '无'
|
||||
})
|
||||
|
||||
const contractsModel = computed({
|
||||
get: () => props.modelValue.contracts,
|
||||
set: (value) => patch({ contracts: value })
|
||||
})
|
||||
|
||||
function patch(partial: Partial<PlanLoadForm>) {
|
||||
emit('update:modelValue', { ...props.modelValue, ...partial })
|
||||
}
|
||||
|
||||
function patchAddress(fields: PlAddressApplyPayload) {
|
||||
const partial: Partial<PlanLoadForm> = {
|
||||
address: fields.address,
|
||||
lng: fields.lng,
|
||||
lat: fields.lat
|
||||
}
|
||||
if (fields.contact !== undefined) {
|
||||
partial.contact = fields.contact
|
||||
}
|
||||
patch(partial)
|
||||
}
|
||||
|
||||
function removeStopProduct(index: number) {
|
||||
patch({
|
||||
products: props.modelValue.products.filter((_, i) => i !== index)
|
||||
})
|
||||
}
|
||||
|
||||
function extractCustomerOptions(res: unknown): CustomerOptionRow[] {
|
||||
const unwrapped = (res as { data?: unknown })?.data ?? res
|
||||
if (Array.isArray(unwrapped)) return unwrapped as CustomerOptionRow[]
|
||||
const payload = (unwrapped as { list?: CustomerOptionRow[]; rows?: CustomerOptionRow[] }) || {}
|
||||
return payload.list || payload.rows || []
|
||||
}
|
||||
|
||||
function ensureCustomerOption(customer?: Partial<CustomerOptionRow> | null) {
|
||||
if (!customer?.id) return
|
||||
const id = String(customer.id)
|
||||
const exists = customerOptions.value.some((item) => String(item.id) === id)
|
||||
if (exists) {
|
||||
if (!customer.customerName) return
|
||||
customerOptions.value = customerOptions.value.map((item) =>
|
||||
String(item.id) === id
|
||||
? {
|
||||
...item,
|
||||
customerName: customer.customerName || item.customerName,
|
||||
customerNo: customer.customerNo || item.customerNo
|
||||
}
|
||||
: item
|
||||
)
|
||||
return
|
||||
}
|
||||
customerOptions.value = [
|
||||
{
|
||||
id,
|
||||
customerName: customer.customerName || '',
|
||||
customerNo: customer.customerNo
|
||||
},
|
||||
...customerOptions.value
|
||||
]
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [props.modelValue.customerId, props.modelValue.customerName] as const,
|
||||
([customerId, customerName]) => {
|
||||
if (!customerId) return
|
||||
ensureCustomerOption({
|
||||
id: String(customerId),
|
||||
customerName: customerName || ''
|
||||
})
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
async function loadDefaultCustomerOptions() {
|
||||
customerOptionsLoading.value = true
|
||||
try {
|
||||
const res = await fetchCustomerOptions({ limit: 20 })
|
||||
customerOptions.value = extractCustomerOptions(res)
|
||||
ensureCustomerOption({
|
||||
id: props.modelValue.customerId,
|
||||
customerName: props.modelValue.customerName
|
||||
})
|
||||
} finally {
|
||||
customerOptionsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function searchCustomerOptions(query: string) {
|
||||
const keyword = query?.trim()
|
||||
if (!keyword) {
|
||||
await loadDefaultCustomerOptions()
|
||||
return
|
||||
}
|
||||
customerOptionsLoading.value = true
|
||||
try {
|
||||
const res = await fetchCustomerOptions({ keyword, limit: 50 })
|
||||
customerOptions.value = extractCustomerOptions(res)
|
||||
ensureCustomerOption({
|
||||
id: props.modelValue.customerId,
|
||||
customerName: props.modelValue.customerName
|
||||
})
|
||||
} finally {
|
||||
customerOptionsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleCustomerSelectFocus() {
|
||||
if (!customerOptions.value.length) {
|
||||
loadDefaultCustomerOptions()
|
||||
}
|
||||
}
|
||||
|
||||
function handleCustomerChange(customerId?: string) {
|
||||
if (!customerId) {
|
||||
patch({
|
||||
customerId: '',
|
||||
customerName: '',
|
||||
contracts: [],
|
||||
generateDibang: 0,
|
||||
dibangDirection: 'none',
|
||||
address: '',
|
||||
lng: null,
|
||||
lat: null,
|
||||
contact: '',
|
||||
notes: ''
|
||||
})
|
||||
return
|
||||
}
|
||||
if (String(props.modelValue.customerId) === String(customerId)) {
|
||||
ensureCustomerOption({
|
||||
id: customerId,
|
||||
customerName: props.modelValue.customerName
|
||||
})
|
||||
return
|
||||
}
|
||||
const customer = customerOptions.value.find((item) => String(item.id) === String(customerId))
|
||||
const customerName = customer?.customerName || ''
|
||||
const defaults = resolveStopDibangDefaults(customerName, 'load')
|
||||
patch({
|
||||
customerId: String(customerId),
|
||||
customerName,
|
||||
contracts: [],
|
||||
generateDibang: defaults.generateDibang,
|
||||
dibangDirection: defaults.dibangDirection,
|
||||
address: '',
|
||||
lng: null,
|
||||
lat: null,
|
||||
contact: '',
|
||||
notes: ''
|
||||
})
|
||||
void applyStopPrefFromCustomer(String(customerId))
|
||||
}
|
||||
|
||||
async function applyStopPrefFromCustomer(customerId: string) {
|
||||
try {
|
||||
const res = await customerStopPrefApi.get({ customerId, stopType: 'load' })
|
||||
const pref = pickBxData<CustomerStopPref | null>(res)
|
||||
if (!pref) return
|
||||
if (String(props.modelValue.customerId) !== String(customerId)) return
|
||||
const partial: Partial<PlanLoadForm> = {}
|
||||
const prefAddress = (pref.address || '').trim()
|
||||
if (prefAddress) partial.address = prefAddress
|
||||
if (pref.lng != null) partial.lng = pref.lng
|
||||
if (pref.lat != null) partial.lat = pref.lat
|
||||
const prefContact = (pref.contact || '').trim()
|
||||
if (prefContact) partial.contact = prefContact
|
||||
const prefNotes = (pref.notes || '').trim()
|
||||
if (prefNotes) partial.notes = prefNotes
|
||||
if (Object.keys(partial).length) patch(partial)
|
||||
} catch {
|
||||
// 静默:不阻断选客户
|
||||
}
|
||||
}
|
||||
|
||||
function handleDibangToggle(checked: boolean) {
|
||||
const direction = isInternal.value ? 'outbound' : props.modelValue.dibangDirection || 'none'
|
||||
patch({
|
||||
generateDibang: checked ? 1 : 0,
|
||||
dibangDirection: checked ? direction : 'none'
|
||||
})
|
||||
}
|
||||
|
||||
function applyCustomerFromPicker(customer: { id: string | number; customerName?: string }) {
|
||||
ensureCustomerOption({
|
||||
id: String(customer.id),
|
||||
customerName: customer.customerName
|
||||
})
|
||||
handleCustomerChange(String(customer.id))
|
||||
}
|
||||
|
||||
defineExpose({ applyCustomerFromPicker, ensureCustomerOption, searchCustomerOptions })
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-load-section__grid {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.pl-plan-stop-products-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin: 8px 0 0;
|
||||
}
|
||||
|
||||
.pl-plan-stop-products-head__title {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pl-plan-load-section__empty-hint {
|
||||
margin: 8px 0 0;
|
||||
font-size: 12px;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.pl-plan-dibang-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.pl-plan-dibang-row__hint {
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.customer-select-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.customer-select-row__select {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.pl-plan-party-select-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.pl-plan-party-select-row__customer {
|
||||
flex: 1.4 1 0;
|
||||
min-width: 0;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.pl-plan-party-select-row__contract {
|
||||
flex: 1 1 0;
|
||||
min-width: 120px;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.pl-plan-contract-trigger {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
min-height: 32px;
|
||||
}
|
||||
|
||||
.pl-plan-contract-trigger__hint {
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
|
||||
&.is-warn {
|
||||
color: #d97706;
|
||||
}
|
||||
}
|
||||
|
||||
.customer-option-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.customer-option-row__meta {
|
||||
font-size: 12px;
|
||||
color: #94a3b8;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,154 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="innerVisible"
|
||||
title="选择磅单二维码"
|
||||
width="560px"
|
||||
align-center
|
||||
class="dialog-form-layout pl-plan-pound-qrcode-pick-dialog"
|
||||
modal-class="order-module-dialog-mask"
|
||||
destroy-on-close
|
||||
@closed="handleClosed"
|
||||
>
|
||||
<p class="pl-plan-pound-qrcode-pick-dialog__hint">
|
||||
本计划关联了多张地磅出入库单,请选择要复制或查看的磅单(不会同时打开多个弹窗)。
|
||||
</p>
|
||||
<el-radio-group v-model="selectedKey" class="pl-plan-pound-qrcode-pick-dialog__list">
|
||||
<el-radio
|
||||
v-for="item in options"
|
||||
:key="item.key"
|
||||
:value="item.key"
|
||||
class="pl-plan-pound-qrcode-pick-dialog__item"
|
||||
>
|
||||
<span class="pl-plan-pound-qrcode-pick-dialog__label">{{ item.label }}</span>
|
||||
<span v-if="item.planNo" class="pl-plan-pound-qrcode-pick-dialog__meta">
|
||||
计划 {{ item.planNo }}
|
||||
</span>
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
<template #footer>
|
||||
<el-button @click="innerVisible = false">
|
||||
<el-icon><Close /></el-icon>取消
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :disabled="!selectedRecord" @click="handlePreview">
|
||||
<el-icon><View /></el-icon>查看二维码
|
||||
</el-button>
|
||||
<el-button type="primary" :disabled="!selectedRecord" @click="handleCopy">
|
||||
<el-icon><CopyDocument /></el-icon>复制二维码
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Close, CopyDocument, View } from '@element-plus/icons-vue'
|
||||
import type { Plan, TransportInventoryLink } from '@/api/pl'
|
||||
import { formatTransportInventoryLinkLabel } from '@/utils/pl-pound-qrcode-display'
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
records?: TransportInventoryLink[]
|
||||
plan?: Plan | null
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:visible': [value: boolean]
|
||||
copy: [record: TransportInventoryLink]
|
||||
preview: [record: TransportInventoryLink]
|
||||
}>()
|
||||
|
||||
const innerVisible = computed({
|
||||
get: () => props.visible,
|
||||
set: (value) => emit('update:visible', value)
|
||||
})
|
||||
|
||||
const selectedKey = ref('')
|
||||
|
||||
const options = computed(() =>
|
||||
(props.records || []).map((record, index) => ({
|
||||
key: `${record.dbInventoryId}-${index}`,
|
||||
label: formatTransportInventoryLinkLabel(record, props.plan),
|
||||
planNo: record.planNo,
|
||||
record
|
||||
}))
|
||||
)
|
||||
|
||||
const selectedRecord = computed(() => {
|
||||
const item = options.value.find((row) => row.key === selectedKey.value)
|
||||
return item?.record
|
||||
})
|
||||
|
||||
watch(
|
||||
() => [props.visible, props.records] as const,
|
||||
([visible, records]) => {
|
||||
if (!visible) return
|
||||
const first = records?.[0]
|
||||
selectedKey.value = first ? `${first.dbInventoryId}-0` : ''
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
function handleClosed() {
|
||||
selectedKey.value = ''
|
||||
}
|
||||
|
||||
function handleCopy() {
|
||||
if (!selectedRecord.value) return
|
||||
emit('copy', selectedRecord.value)
|
||||
innerVisible.value = false
|
||||
}
|
||||
|
||||
function handlePreview() {
|
||||
if (!selectedRecord.value) return
|
||||
emit('preview', selectedRecord.value)
|
||||
innerVisible.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-pound-qrcode-pick-dialog__hint {
|
||||
margin: 0 0 12px;
|
||||
font-size: 13px;
|
||||
line-height: 1.55;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
}
|
||||
|
||||
.pl-plan-pound-qrcode-pick-dialog__list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pl-plan-pound-qrcode-pick-dialog__item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin: 0;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--mint-border, #d9e8e2);
|
||||
border-radius: 8px;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
white-space: normal;
|
||||
|
||||
:deep(.el-radio__label) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
align-items: flex-start;
|
||||
line-height: 1.45;
|
||||
white-space: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-pound-qrcode-pick-dialog__label {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--text, #1e293b);
|
||||
}
|
||||
|
||||
.pl-plan-pound-qrcode-pick-dialog__meta {
|
||||
font-size: 12px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,638 @@
|
||||
<template>
|
||||
<div v-if="visible" class="pl-plan-stop-feedback-panel">
|
||||
<h4 v-if="panelTitle" class="pl-plan-stop-feedback-panel__title">{{ panelTitle }}</h4>
|
||||
|
||||
<div class="pl-stop-feedback-cards" :class="cardsLayoutClass">
|
||||
<section class="pl-stop-feedback-card">
|
||||
<div class="pl-stop-feedback-ticket">
|
||||
<div class="pl-stop-feedback-ticket__band pl-stop-feedback-ticket__band--driver">
|
||||
<span class="pl-stop-feedback-ticket__who">司机回传</span>
|
||||
<span v-if="driverFeedback?.feedbackTime" class="pl-stop-feedback-ticket__when">{{
|
||||
formatFeedbackTime(driverFeedback.feedbackTime)
|
||||
}}</span>
|
||||
</div>
|
||||
<p v-if="!hasDriverFeedback" class="pl-plan-form-empty-hint pl-stop-feedback-ticket__empty">
|
||||
暂无司机回传
|
||||
</p>
|
||||
<template v-else>
|
||||
<div v-if="driverFeedback?.products?.length" class="pl-stop-feedback-ticket__products">
|
||||
<div
|
||||
v-for="product in driverFeedback.products"
|
||||
:key="product.stopProductId"
|
||||
class="pl-stop-feedback-ticket__product-row"
|
||||
>
|
||||
<span class="pl-stop-feedback-ticket__text">{{ product.productName || '产品' }}</span>
|
||||
<span class="pl-stop-feedback-ticket__text pl-stop-feedback-ticket__text--qty">
|
||||
{{ formatDriverProductQty(product) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="driverRemarkDisplay" class="pl-stop-feedback-ticket__line pl-stop-feedback-ticket__line--full">
|
||||
<span class="pl-stop-feedback-ticket__lab">备注</span>
|
||||
<span class="pl-stop-feedback-ticket__text">{{ driverRemarkDisplay }}</span>
|
||||
</div>
|
||||
<div class="pl-stop-feedback-ticket__foot">
|
||||
<span class="pl-stop-feedback-ticket__lab">附件</span>
|
||||
<AttachmentUploadField
|
||||
v-if="driverAttachmentCsv"
|
||||
class="pl-stop-feedback-ticket__attach"
|
||||
:model-value="driverAttachmentCsv"
|
||||
disabled
|
||||
compact
|
||||
folder="pl/transport/feedback"
|
||||
accept="image/*,video/*,.pdf"
|
||||
:limit="15"
|
||||
/>
|
||||
<span v-else class="pl-plan-form-empty-hint">—</span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="showSiteCard" class="pl-stop-feedback-card">
|
||||
<div class="pl-stop-feedback-ticket">
|
||||
<div class="pl-stop-feedback-ticket__band pl-stop-feedback-ticket__band--site">
|
||||
<span class="pl-stop-feedback-ticket__who">现场回传</span>
|
||||
<span v-if="siteFeedback?.feedbackTime" class="pl-stop-feedback-ticket__when">{{
|
||||
formatFeedbackTime(siteFeedback.feedbackTime)
|
||||
}}</span>
|
||||
</div>
|
||||
<p v-if="!hasSiteFeedback" class="pl-plan-form-empty-hint pl-stop-feedback-ticket__empty">
|
||||
暂无现场回传
|
||||
</p>
|
||||
<template v-else>
|
||||
<div v-if="siteFeedback?.products?.length" class="pl-stop-feedback-ticket__products">
|
||||
<div
|
||||
v-for="product in siteFeedback.products"
|
||||
:key="product.stopProductId"
|
||||
class="pl-stop-feedback-ticket__product-row"
|
||||
>
|
||||
<span class="pl-stop-feedback-ticket__text">{{ product.productName || '产品' }}</span>
|
||||
<span class="pl-stop-feedback-ticket__text pl-stop-feedback-ticket__text--qty">
|
||||
<span class="pl-stop-feedback-ticket__val pl-stop-feedback-ticket__val--highlight">{{
|
||||
formatSiteProductQty(product).qty
|
||||
}}</span>
|
||||
<span class="pl-stop-feedback-ticket__unit">{{ formatSiteProductQty(product).unit }}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pl-stop-feedback-ticket__lines">
|
||||
<div
|
||||
v-if="
|
||||
(siteFeedback?.quantity != null && !siteFeedback?.products?.length) ||
|
||||
siteFeedback?.businessType
|
||||
"
|
||||
class="pl-stop-feedback-ticket__row"
|
||||
>
|
||||
<div
|
||||
v-if="siteFeedback?.quantity != null && !siteFeedback?.products?.length"
|
||||
class="pl-stop-feedback-ticket__line"
|
||||
>
|
||||
<span class="pl-stop-feedback-ticket__lab">数量</span>
|
||||
<span class="pl-stop-feedback-ticket__text pl-stop-feedback-ticket__text--qty">
|
||||
<span class="pl-stop-feedback-ticket__val pl-stop-feedback-ticket__val--highlight">{{
|
||||
siteFeedback.quantity
|
||||
}}</span>
|
||||
<span class="pl-stop-feedback-ticket__unit">吨</span>
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="siteFeedback?.businessType" class="pl-stop-feedback-ticket__line">
|
||||
<span class="pl-stop-feedback-ticket__lab">业务类型</span>
|
||||
<span class="pl-stop-feedback-ticket__text">{{
|
||||
formatSiteBusinessType(siteFeedback.businessType)
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="siteFeedback?.remark" class="pl-stop-feedback-ticket__line pl-stop-feedback-ticket__line--full">
|
||||
<span class="pl-stop-feedback-ticket__lab">备注</span>
|
||||
<span class="pl-stop-feedback-ticket__text">{{ siteFeedback.remark }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pl-stop-feedback-ticket__foot">
|
||||
<span class="pl-stop-feedback-ticket__lab">附件</span>
|
||||
<AttachmentUploadField
|
||||
v-if="siteAttachmentCsv"
|
||||
class="pl-stop-feedback-ticket__attach"
|
||||
:model-value="siteAttachmentCsv"
|
||||
disabled
|
||||
compact
|
||||
folder="pl/transport/site-feedback"
|
||||
accept="image/*,video/*,.pdf"
|
||||
:limit="15"
|
||||
/>
|
||||
<span v-else class="pl-plan-form-empty-hint">—</span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="showDibangCard" class="pl-stop-feedback-card">
|
||||
<div class="pl-stop-feedback-ticket">
|
||||
<div class="pl-stop-feedback-ticket__band pl-stop-feedback-ticket__band--dibang">
|
||||
<span class="pl-stop-feedback-ticket__who">地磅单</span>
|
||||
<span v-if="dibangRows.length === 1" class="pl-stop-feedback-ticket__when">{{
|
||||
dibangBatchNo(dibangRows[0])
|
||||
}}</span>
|
||||
</div>
|
||||
<p
|
||||
v-if="!dibangRows.length"
|
||||
class="pl-plan-form-empty-hint pl-stop-feedback-ticket__empty"
|
||||
>
|
||||
暂无关联地磅单
|
||||
</p>
|
||||
<template v-else>
|
||||
<div
|
||||
v-for="(row, idx) in dibangRows"
|
||||
:key="row.link.dbInventoryId || idx"
|
||||
class="pl-stop-feedback-dibang-item"
|
||||
:class="{ 'pl-stop-feedback-dibang-item--split': dibangRows.length > 1 }"
|
||||
>
|
||||
<p v-if="dibangRows.length > 1" class="pl-stop-feedback-ticket__product">
|
||||
{{ dibangProductLabel(row, idx) }}
|
||||
</p>
|
||||
<div class="pl-stop-feedback-ticket__qty pl-stop-feedback-ticket__qty--compact">
|
||||
<div>
|
||||
<div class="pl-stop-feedback-ticket__lab">{{
|
||||
row.weighing ? '净重(吨)' : '数量(吨)'
|
||||
}}</div>
|
||||
<div class="pl-stop-feedback-ticket__val pl-stop-feedback-ticket__val--highlight">{{
|
||||
dibangPrimaryQty(row)
|
||||
}}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="pl-stop-feedback-ticket__lab">{{
|
||||
row.weighing ? '毛/皮(吨)' : '状态'
|
||||
}}</div>
|
||||
<div
|
||||
class="pl-stop-feedback-ticket__val"
|
||||
:class="
|
||||
row.weighing
|
||||
? 'pl-stop-feedback-ticket__val--highlight'
|
||||
: 'pl-stop-feedback-ticket__val--sm'
|
||||
"
|
||||
>
|
||||
{{ dibangSecondaryQty(row) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pl-stop-feedback-ticket__lines pl-stop-feedback-ticket__lines--compact">
|
||||
<div class="pl-stop-feedback-ticket__row">
|
||||
<div class="pl-stop-feedback-ticket__line">
|
||||
<span class="pl-stop-feedback-ticket__lab">单号</span>
|
||||
<span class="pl-stop-feedback-ticket__text">{{ dibangBatchNo(row) }}</span>
|
||||
</div>
|
||||
<div class="pl-stop-feedback-ticket__line">
|
||||
<span class="pl-stop-feedback-ticket__lab">业务</span>
|
||||
<span class="pl-stop-feedback-ticket__text">{{ dibangBusinessType(row) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pl-stop-feedback-ticket__line pl-stop-feedback-ticket__line--full">
|
||||
<span class="pl-stop-feedback-ticket__lab">往来</span>
|
||||
<span class="pl-stop-feedback-ticket__text">{{ dibangPartner(row) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="!row.weighing" class="pl-plan-form-empty-hint pl-stop-feedback-ticket__hint">
|
||||
尚未关联地磅明细
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import type { TransportStopFeedback } from '@/api/pl'
|
||||
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import { formatKgToTon } from '@/components/business/db/db-related-view'
|
||||
import type { PlPlanTransportDibangRow } from '@/composables/usePlPlanViewDetail'
|
||||
import { formatDateTime } from '@/utils/format'
|
||||
import { isPlInternalCustomerName } from '@/utils/pl-internal-customer'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
stopLabel?: string
|
||||
customerName?: string
|
||||
generateDibang?: number
|
||||
dibangRows?: PlPlanTransportDibangRow[]
|
||||
driverFeedback?: TransportStopFeedback | null
|
||||
siteFeedback?: TransportStopFeedback | null
|
||||
/** 段级无备注时回退展示(如运输单级司机回传备注) */
|
||||
fallbackRemark?: string
|
||||
/** 无回传数据时也展示卡片空态 */
|
||||
showWhenEmpty?: boolean
|
||||
}>(),
|
||||
{
|
||||
stopLabel: '',
|
||||
customerName: '',
|
||||
generateDibang: 0,
|
||||
dibangRows: () => [],
|
||||
driverFeedback: null,
|
||||
siteFeedback: null,
|
||||
fallbackRemark: '',
|
||||
showWhenEmpty: true
|
||||
}
|
||||
)
|
||||
|
||||
const isInternalCustomer = computed(() => isPlInternalCustomerName(props.customerName))
|
||||
|
||||
const showSiteCard = computed(() => isInternalCustomer.value)
|
||||
|
||||
const showDibangCard = computed(
|
||||
() => isInternalCustomer.value && (props.generateDibang === 1 || (props.dibangRows?.length ?? 0) > 0)
|
||||
)
|
||||
|
||||
const cardCount = computed(() => {
|
||||
let count = 1
|
||||
if (showSiteCard.value) count += 1
|
||||
if (showDibangCard.value) count += 1
|
||||
return count
|
||||
})
|
||||
|
||||
const cardsLayoutClass = computed(() => {
|
||||
if (cardCount.value >= 3) return 'is-cols-3'
|
||||
if (cardCount.value === 2) return 'is-cols-2'
|
||||
return 'is-cols-1'
|
||||
})
|
||||
|
||||
const driverRemarkDisplay = computed(() => {
|
||||
const stopRemark = (props.driverFeedback?.remark || '').trim()
|
||||
if (stopRemark) return stopRemark
|
||||
return (props.fallbackRemark || '').trim()
|
||||
})
|
||||
|
||||
const hasDriverFeedback = computed(() =>
|
||||
Boolean(
|
||||
driverRemarkDisplay.value ||
|
||||
props.driverFeedback?.attachmentUrls?.length ||
|
||||
props.driverFeedback?.products?.length ||
|
||||
props.driverFeedback?.feedbackTime
|
||||
)
|
||||
)
|
||||
|
||||
const hasSiteFeedback = computed(() =>
|
||||
Boolean(
|
||||
props.siteFeedback?.quantity != null ||
|
||||
props.siteFeedback?.remark ||
|
||||
props.siteFeedback?.attachmentUrls?.length ||
|
||||
props.siteFeedback?.products?.length ||
|
||||
props.siteFeedback?.feedbackTime
|
||||
)
|
||||
)
|
||||
|
||||
const hasAnyFeedback = computed(
|
||||
() =>
|
||||
hasDriverFeedback.value ||
|
||||
hasSiteFeedback.value ||
|
||||
(props.dibangRows?.length ?? 0) > 0
|
||||
)
|
||||
|
||||
const visible = computed(() => props.showWhenEmpty || hasAnyFeedback.value)
|
||||
|
||||
const panelTitle = computed(() =>
|
||||
props.stopLabel ? `${props.stopLabel} · 执行回传` : '执行回传'
|
||||
)
|
||||
|
||||
const driverAttachmentCsv = computed(() => (props.driverFeedback?.attachmentUrls || []).join(','))
|
||||
const siteAttachmentCsv = computed(() => (props.siteFeedback?.attachmentUrls || []).join(','))
|
||||
|
||||
function formatFeedbackTime(value?: string) {
|
||||
return formatDateTime(value) || '—'
|
||||
}
|
||||
|
||||
function formatSiteBusinessType(value?: string) {
|
||||
const text = (value || '').trim()
|
||||
if (text === 'outbound') return '出库'
|
||||
if (text === 'inbound') return '入库'
|
||||
return text || '—'
|
||||
}
|
||||
|
||||
function formatDriverProductQty(product: NonNullable<TransportStopFeedback['products']>[number]) {
|
||||
const qty = product.actualQty
|
||||
const unit = product.unit || '吨'
|
||||
if (qty == null) return '—'
|
||||
return `${qty} ${unit}`
|
||||
}
|
||||
|
||||
function formatSiteProductQty(product: NonNullable<TransportStopFeedback['products']>[number]) {
|
||||
const qty = product.actualQty ?? product.quantity
|
||||
const unit = product.unit || '吨'
|
||||
if (qty == null) return { qty: '—', unit: '' }
|
||||
return { qty: String(qty), unit: ` ${unit}` }
|
||||
}
|
||||
|
||||
function dibangProductLabel(row: PlPlanTransportDibangRow, idx: number): string {
|
||||
return row.link.productName || row.inventory?.product || `地磅 ${idx + 1}`
|
||||
}
|
||||
|
||||
function dibangBatchNo(row: PlPlanTransportDibangRow): string {
|
||||
return row.weighing?.batchNo || row.inventory?.batchNo || row.link.batchNo || '—'
|
||||
}
|
||||
|
||||
function dibangBusinessType(row: PlPlanTransportDibangRow): string {
|
||||
return row.weighing?.businessType || row.inventory?.businessType || '—'
|
||||
}
|
||||
|
||||
function dibangPartner(row: PlPlanTransportDibangRow): string {
|
||||
if (row.inventory?.partnerCompany) return row.inventory.partnerCompany
|
||||
const weighing = row.weighing
|
||||
if (!weighing) return '—'
|
||||
const businessType = dibangBusinessType(row)
|
||||
if (businessType === '入库') return weighing.supplier || weighing.consignee || '—'
|
||||
return weighing.consignee || weighing.supplier || '—'
|
||||
}
|
||||
|
||||
function dibangPrimaryQty(row: PlPlanTransportDibangRow): string {
|
||||
if (row.weighing) return formatKgToTon(row.weighing.netWeight)
|
||||
if (row.inventory?.quantity != null && row.inventory.quantity !== undefined) {
|
||||
return String(row.inventory.quantity)
|
||||
}
|
||||
return '—'
|
||||
}
|
||||
|
||||
function dibangSecondaryQty(row: PlPlanTransportDibangRow): string {
|
||||
if (row.weighing) {
|
||||
return `${formatKgToTon(row.weighing.grossWeight)} / ${formatKgToTon(row.weighing.tareWeight)}`
|
||||
}
|
||||
return row.inventory?.status || '—'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-stop-feedback-panel {
|
||||
margin-top: 12px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px dashed #e2e8f0;
|
||||
}
|
||||
|
||||
.pl-plan-stop-feedback-panel__title {
|
||||
margin: 0 0 10px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-cards {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
align-items: stretch;
|
||||
|
||||
&.is-cols-1 {
|
||||
grid-template-columns: minmax(0, 280px);
|
||||
}
|
||||
|
||||
&.is-cols-2 {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
&.is-cols-3 {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
.pl-stop-feedback-card {
|
||||
min-width: 0;
|
||||
min-height: 100%;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100%;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__band {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
padding: 8px 10px;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
|
||||
&--driver {
|
||||
background: linear-gradient(90deg, #ecfdf5 0%, #f8fafc 100%);
|
||||
}
|
||||
|
||||
&--site {
|
||||
background: linear-gradient(90deg, #eff6ff 0%, #f8fafc 100%);
|
||||
}
|
||||
|
||||
&--dibang {
|
||||
background: linear-gradient(90deg, #fff7ed 0%, #f8fafc 100%);
|
||||
}
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__who {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__when {
|
||||
flex-shrink: 0;
|
||||
max-width: 52%;
|
||||
font-size: 11px;
|
||||
color: #64748b;
|
||||
text-align: right;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__product {
|
||||
margin: 0;
|
||||
padding: 8px 10px 0;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__qty {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
padding: 8px 10px;
|
||||
|
||||
&--compact {
|
||||
padding-top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__lab {
|
||||
font-size: 11px;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__val {
|
||||
margin-top: 2px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #0f172a;
|
||||
line-height: 1.2;
|
||||
|
||||
&--highlight {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #059669;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
&--sm {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__lines {
|
||||
padding: 0 10px 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
|
||||
&--compact {
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__line {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
padding: 0 10px 6px;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__lines .pl-stop-feedback-ticket__line {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__lines .pl-stop-feedback-ticket__line--full {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__text {
|
||||
font-size: 12px;
|
||||
color: #1e293b;
|
||||
word-break: break-word;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__products {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
padding: 8px 10px 0;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__product-row {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__text--qty {
|
||||
display: inline-flex;
|
||||
align-items: baseline;
|
||||
gap: 2px;
|
||||
flex-shrink: 0;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: #64748b;
|
||||
|
||||
.pl-stop-feedback-ticket__val--highlight {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #059669;
|
||||
font-variant-numeric: tabular-nums;
|
||||
line-height: 1.2;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__unit {
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__foot {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
margin-top: auto;
|
||||
padding: 8px 10px 10px;
|
||||
border-top: 1px solid #f1f5f9;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__empty {
|
||||
padding: 12px 10px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__hint {
|
||||
margin: 0;
|
||||
padding: 0 10px 8px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-dibang-item {
|
||||
&--split + &--split {
|
||||
border-top: 1px dashed #e2e8f0;
|
||||
margin-top: 4px;
|
||||
padding-top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-form-empty-hint {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
color: var(--mint-text-muted, #94a3b8);
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__attach {
|
||||
:deep(.attachment-list) {
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
:deep(.attachment-item) {
|
||||
width: 56px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
:deep(.attachment-preview) {
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1280px) {
|
||||
.pl-stop-feedback-cards.is-cols-3 {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.pl-stop-feedback-cards.is-cols-2,
|
||||
.pl-stop-feedback-cards.is-cols-3 {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.pl-stop-feedback-cards.is-cols-1 {
|
||||
grid-template-columns: 1fr;
|
||||
max-width: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,686 @@
|
||||
<template>
|
||||
<div
|
||||
class="panel dialog-list-panel pl-plan-stop-product-table-wrap"
|
||||
:class="{ 'is-compact': compact, 'is-editable': editable }"
|
||||
>
|
||||
<div class="list-body list-wrap dialog-list-body-only">
|
||||
<!-- compact:双行列表(方案 A) -->
|
||||
<div v-if="compact" class="pl-stop-product-dual-list">
|
||||
<p v-if="!products.length" class="pl-stop-product-dual-empty"> 暂无产品 </p>
|
||||
<article
|
||||
v-for="(row, index) in products"
|
||||
v-else
|
||||
:key="`${row.productId}-${row.planProductId || index}`"
|
||||
class="pl-stop-product-dual-item"
|
||||
>
|
||||
<div class="pl-stop-product-dual-item__row1">
|
||||
<div class="pl-stop-product-dual-item__field pl-stop-product-dual-item__product">
|
||||
<span class="pl-stop-product-dual-item__label">产品名称</span>
|
||||
<PlProductNameHazardCell
|
||||
:product="{ ...row, productName: row.standardProductName || row.productName }"
|
||||
/>
|
||||
</div>
|
||||
<div class="pl-stop-product-dual-item__field">
|
||||
<span class="pl-stop-product-dual-item__label">别名</span>
|
||||
<div v-if="sharedEditable" class="line-meta-cell">
|
||||
<el-select
|
||||
v-if="(row.aliasOptions || []).length"
|
||||
v-model="row.aliasName"
|
||||
class="pl-plan-product-cell-control line-meta-cell__control"
|
||||
placeholder="不选则用产品名称"
|
||||
clearable
|
||||
filterable
|
||||
popper-class="pl-plan-alias-brand-select-dropdown"
|
||||
@change="() => handleAliasChange(row)"
|
||||
>
|
||||
<el-option
|
||||
v-for="name in row.aliasOptions"
|
||||
:key="name"
|
||||
:label="name"
|
||||
:value="name"
|
||||
/>
|
||||
</el-select>
|
||||
<span v-else class="text-muted line-meta-cell__empty">—</span>
|
||||
<el-button
|
||||
v-if="row.productId"
|
||||
link
|
||||
type="primary"
|
||||
class="line-meta-cell__btn"
|
||||
@click="openAliasBrandManage(row, 'alias')"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
<span v-else class="pl-stop-product-dual-item__readonly">{{
|
||||
row.aliasName || '—'
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="pl-stop-product-dual-item__field">
|
||||
<span class="pl-stop-product-dual-item__label">品牌</span>
|
||||
<div v-if="sharedEditable" class="line-meta-cell">
|
||||
<el-select
|
||||
v-if="(row.brandOptions || []).length"
|
||||
v-model="row.brandId"
|
||||
class="pl-plan-product-cell-control line-meta-cell__control"
|
||||
placeholder="不限品牌"
|
||||
clearable
|
||||
filterable
|
||||
popper-class="pl-plan-alias-brand-select-dropdown"
|
||||
@change="(val) => handleBrandChange(row, val)"
|
||||
>
|
||||
<el-option
|
||||
v-for="b in row.brandOptions"
|
||||
:key="b.id"
|
||||
:label="b.brandName"
|
||||
:value="b.id"
|
||||
/>
|
||||
</el-select>
|
||||
<span v-else class="text-muted line-meta-cell__empty">—</span>
|
||||
<el-button
|
||||
v-if="row.productId"
|
||||
link
|
||||
type="primary"
|
||||
class="line-meta-cell__btn"
|
||||
@click="openAliasBrandManage(row, 'brand')"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
<span v-else class="pl-stop-product-dual-item__readonly">
|
||||
{{ formatBrandConstraintLabel(row.brandMode, row.brandName) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="pl-stop-product-dual-item__field">
|
||||
<span class="pl-stop-product-dual-item__label">规格型号</span>
|
||||
<span class="pl-stop-product-dual-item__readonly">{{ row.model || '—' }}</span>
|
||||
</div>
|
||||
<div class="pl-stop-product-dual-item__field">
|
||||
<span class="pl-stop-product-dual-item__label">单位</span>
|
||||
<DictSelect
|
||||
v-if="sharedEditable"
|
||||
v-model="row.unit"
|
||||
class="pl-plan-product-cell-control pl-stop-product-dual-dict"
|
||||
dict-type="crm_product_unit"
|
||||
placeholder="单位"
|
||||
/>
|
||||
<template v-else>
|
||||
<span class="pl-stop-product-dual-item__readonly">{{
|
||||
resolveDictLabel('crm_product_unit', row.unit)
|
||||
}}</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pl-stop-product-dual-item__row2">
|
||||
<div class="pl-stop-product-dual-item__field">
|
||||
<span class="pl-stop-product-dual-item__label">计划数量</span>
|
||||
<el-input-number
|
||||
v-if="editable"
|
||||
v-model="row.planQty"
|
||||
:min="0"
|
||||
:precision="3"
|
||||
:controls="false"
|
||||
class="pl-plan-product-cell-control pl-stop-product-dual-qty"
|
||||
/>
|
||||
<span
|
||||
v-else
|
||||
class="pl-stop-product-dual-item__readonly pl-stop-product-dual-item__qty-text"
|
||||
>
|
||||
{{ row.planQty ?? '—' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="pl-stop-product-dual-item__field">
|
||||
<span class="pl-stop-product-dual-item__label">包装规格</span>
|
||||
<DictSelect
|
||||
v-if="sharedEditable"
|
||||
v-model="row.packageSpec"
|
||||
class="pl-plan-product-cell-control pl-stop-product-dual-dict"
|
||||
dict-type="crm_product_gg"
|
||||
placeholder="包装"
|
||||
/>
|
||||
<span v-else class="pl-stop-product-dual-item__readonly">{{
|
||||
resolveDictLabel('crm_product_gg', row.packageSpec)
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="pl-stop-product-dual-item__field">
|
||||
<span class="pl-stop-product-dual-item__label">送货方式</span>
|
||||
<DictSelect
|
||||
v-if="sharedEditable"
|
||||
v-model="row.deliveryMethod"
|
||||
class="pl-plan-product-cell-control pl-stop-product-dual-dict"
|
||||
dict-type="crm_shfs"
|
||||
placeholder="送货"
|
||||
/>
|
||||
<span v-else class="pl-stop-product-dual-item__readonly">{{
|
||||
row.deliveryMethod ? getDeliveryMethodDisplay(row.deliveryMethod) : '—'
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="pl-stop-product-dual-item__field pl-stop-product-dual-item__field--remark">
|
||||
<span class="pl-stop-product-dual-item__label">备注</span>
|
||||
<el-input
|
||||
v-if="editable"
|
||||
v-model="row.remark"
|
||||
class="pl-plan-product-cell-control"
|
||||
placeholder="备注"
|
||||
/>
|
||||
<span v-else class="pl-stop-product-dual-item__readonly">{{
|
||||
row.remark || '—'
|
||||
}}</span>
|
||||
</div>
|
||||
<div v-if="canRemove" class="pl-stop-product-dual-item__act">
|
||||
<el-button link type="danger" @click="handleRemove(index)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="showStopActualQty || showStopArchivePrice"
|
||||
class="pl-stop-product-dual-item__row3"
|
||||
>
|
||||
<div v-if="showStopActualQty" class="pl-stop-product-dual-item__field">
|
||||
<span class="pl-stop-product-dual-item__label">实际数量</span>
|
||||
<span
|
||||
class="pl-stop-product-dual-item__readonly pl-stop-product-dual-item__qty-text"
|
||||
>
|
||||
{{ formatStopQty(resolveStopActualQty(row, stopArchiveMode)) }}
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="showStopArchivePrice" class="pl-stop-product-dual-item__field">
|
||||
<span class="pl-stop-product-dual-item__label">单价(元)</span>
|
||||
<span class="pl-stop-product-dual-item__readonly">
|
||||
{{ formatStopPrice(resolveStopUnitPrice(row, stopArchiveMode)) }}
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="showStopArchivePrice" class="pl-stop-product-dual-item__field">
|
||||
<span class="pl-stop-product-dual-item__label">金额(元)</span>
|
||||
<span class="pl-stop-product-dual-item__readonly">
|
||||
{{ formatStopArchiveAmount(row, stopArchiveMode) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<!-- 非 compact:完整表格 -->
|
||||
<el-table
|
||||
v-else
|
||||
:data="products"
|
||||
stripe
|
||||
class="list-table pl-plan-stop-product-table"
|
||||
empty-text="暂无产品"
|
||||
>
|
||||
<el-table-column label="产品名称" min-width="140" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<PlProductNameHazardCell
|
||||
:product="{ ...row, productName: row.standardProductName || row.productName }"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="别名" min-width="140" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.aliasName || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="品牌" min-width="140" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ formatBrandConstraintLabel(row.brandMode, row.brandName) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="型号/规格" min-width="120" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.model || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<DictSelect
|
||||
v-if="sharedEditable"
|
||||
v-model="row.unit"
|
||||
class="pl-plan-product-cell-control"
|
||||
dict-type="crm_product_unit"
|
||||
placeholder="请选择单位"
|
||||
style="width: 100%"
|
||||
/>
|
||||
<template v-else>
|
||||
<DictTag v-if="row.unit" dict-type="crm_product_unit" :value="row.unit" />
|
||||
<span v-else>—</span>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计划数量" min-width="110" align="right">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-if="editable"
|
||||
v-model="row.planQty"
|
||||
:min="0"
|
||||
:precision="3"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
/>
|
||||
<span v-else>{{ row.planQty ?? '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="showStopActualQty"
|
||||
label="实际数量"
|
||||
min-width="110"
|
||||
align="right"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ formatStopQty(resolveStopActualQty(row, stopArchiveMode)) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="showStopArchivePrice"
|
||||
label="单价(元)"
|
||||
min-width="120"
|
||||
align="right"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ formatStopPrice(resolveStopUnitPrice(row, stopArchiveMode)) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="showStopArchivePrice"
|
||||
label="金额(元)"
|
||||
min-width="110"
|
||||
align="right"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ formatStopArchiveAmount(row, stopArchiveMode) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="packageSpec" label="包装规格" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<DictSelect
|
||||
v-if="sharedEditable"
|
||||
v-model="row.packageSpec"
|
||||
class="pl-plan-product-cell-control"
|
||||
dict-type="crm_product_gg"
|
||||
placeholder="请选择包装规格"
|
||||
style="width: 100%"
|
||||
/>
|
||||
<template v-else>
|
||||
<DictTag v-if="row.packageSpec" dict-type="crm_product_gg" :value="row.packageSpec" />
|
||||
<span v-else>—</span>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="送货方式" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<DictSelect
|
||||
v-if="sharedEditable"
|
||||
v-model="row.deliveryMethod"
|
||||
class="pl-plan-product-cell-control"
|
||||
dict-type="crm_shfs"
|
||||
placeholder="请选择送货方式"
|
||||
style="width: 100%"
|
||||
/>
|
||||
<template v-else>
|
||||
<el-tag v-if="row.deliveryMethod" size="small" type="info">
|
||||
{{ getDeliveryMethodDisplay(row.deliveryMethod) }}
|
||||
</el-tag>
|
||||
<span v-else>—</span>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="editable" label="备注" min-width="140">
|
||||
<template #default="{ row }">
|
||||
<el-input
|
||||
v-model="row.remark"
|
||||
class="pl-plan-product-cell-control"
|
||||
placeholder="备注"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-else prop="remark" label="备注" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column
|
||||
v-if="canRemove"
|
||||
label="操作"
|
||||
min-width="56"
|
||||
align="center"
|
||||
fixed="right"
|
||||
class-name="col-actions"
|
||||
>
|
||||
<template #default="{ $index }">
|
||||
<el-button link type="danger" @click="handleRemove($index)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<ProductAliasBrandDialog
|
||||
v-if="editable"
|
||||
v-model="aliasBrandManageVisible"
|
||||
:product-id="aliasBrandManageProductId"
|
||||
:product-name="aliasBrandManageProductName"
|
||||
:mode="aliasBrandManageMode"
|
||||
@saved="handleAliasBrandManaged"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Delete, Plus } from '@element-plus/icons-vue'
|
||||
import type { PlanStopProductFormRow } from '@/utils/pl-plan-stop-form'
|
||||
import {
|
||||
formatStopArchiveAmount,
|
||||
resolveStopActualQty,
|
||||
resolveStopUnitPrice
|
||||
} from '@/utils/pl-plan-stop-form'
|
||||
import { getDeliveryMethodLabel } from '@/composables/usePlContractToPlan'
|
||||
import {
|
||||
applyBrandSelectChange,
|
||||
applyManagedProductMetaToLines,
|
||||
formatBrandConstraintLabel,
|
||||
resolveLineProductName
|
||||
} from '@/utils/crm-product-brand'
|
||||
import PlProductNameHazardCell from '@/components/business/pl-product-name-hazard-cell/index.vue'
|
||||
import ProductAliasBrandDialog from '@/components/business/product-alias-brand-dialog/index.vue'
|
||||
import DictTag from '@/components/DictTag/index.vue'
|
||||
import DictSelect from '@/components/DictSelect/index.vue'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
products: PlanStopProductFormRow[]
|
||||
editable?: boolean
|
||||
/** 段内双行列表(装货/送货 pane) */
|
||||
compact?: boolean
|
||||
/** 是否允许删除行,默认跟 editable */
|
||||
allowRemove?: boolean
|
||||
/** 共享字段只读(送货段:别名/品牌/单位/包装/送货方式跟装货) */
|
||||
sharedReadonly?: boolean
|
||||
/** 查看态:展示段级实际数量(装货 inbound / 送货 outbound) */
|
||||
showStopActualQty?: boolean
|
||||
/** 查看态:展示段级单价与金额(仅运输计划归档) */
|
||||
showStopArchivePrice?: boolean
|
||||
/** 与 showStopActualQty / showStopArchivePrice 配合 */
|
||||
stopArchiveMode?: 'load' | 'delivery'
|
||||
}>(),
|
||||
{
|
||||
compact: false,
|
||||
allowRemove: undefined,
|
||||
sharedReadonly: false,
|
||||
showStopActualQty: false,
|
||||
showStopArchivePrice: false,
|
||||
stopArchiveMode: 'load'
|
||||
}
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
remove: [index: number]
|
||||
}>()
|
||||
|
||||
const sharedEditable = computed(() => !!props.editable && !props.sharedReadonly)
|
||||
const canRemove = computed(
|
||||
() => !!props.editable && (props.allowRemove === undefined ? true : props.allowRemove)
|
||||
)
|
||||
|
||||
const dictStore = useDictStore()
|
||||
|
||||
const aliasBrandManageVisible = ref(false)
|
||||
const aliasBrandManageProductId = ref('')
|
||||
const aliasBrandManageProductName = ref('')
|
||||
const aliasBrandManageMode = ref<'alias' | 'brand'>('alias')
|
||||
|
||||
function handleRemove(index: number) {
|
||||
emit('remove', index)
|
||||
}
|
||||
|
||||
function getDeliveryMethodDisplay(method?: string) {
|
||||
const label = dictStore.getLabel('crm_shfs', method || '')
|
||||
if (label && label !== method) return label
|
||||
return getDeliveryMethodLabel(method)
|
||||
}
|
||||
|
||||
function resolveDictLabel(dictType: string, value?: string | null) {
|
||||
const raw = String(value || '').trim()
|
||||
if (!raw) return '—'
|
||||
const label = dictStore.getLabel(dictType, raw)
|
||||
return label && label !== raw ? label : raw
|
||||
}
|
||||
|
||||
function formatStopQty(value?: number | null) {
|
||||
return value != null && Number.isFinite(Number(value)) ? String(value) : '—'
|
||||
}
|
||||
|
||||
function formatStopPrice(value?: number | null) {
|
||||
return value != null && Number.isFinite(Number(value)) ? Number(value).toFixed(2) : '—'
|
||||
}
|
||||
|
||||
function handleAliasChange(row: PlanStopProductFormRow) {
|
||||
row.productName = resolveLineProductName(row.standardProductName, row.aliasName)
|
||||
}
|
||||
|
||||
function handleBrandChange(row: PlanStopProductFormRow, val: string | undefined | null) {
|
||||
applyBrandSelectChange(row, val, row.brandOptions || [])
|
||||
}
|
||||
|
||||
function openAliasBrandManage(row: PlanStopProductFormRow, 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<string, unknown>) {
|
||||
applyManagedProductMetaToLines(props.products || [], aliasBrandManageProductId.value, product)
|
||||
const pid = aliasBrandManageProductId.value
|
||||
for (const line of props.products || []) {
|
||||
if (String(line.productId || '') !== pid) continue
|
||||
line.productName = resolveLineProductName(line.standardProductName, line.aliasName)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-stop-product-table-wrap {
|
||||
margin-top: 8px;
|
||||
|
||||
&.is-compact {
|
||||
margin-top: 6px;
|
||||
|
||||
:deep(.list-body.list-wrap.dialog-list-body-only) {
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-stop-product-meta {
|
||||
display: block;
|
||||
margin-top: 2px;
|
||||
font-size: 11px;
|
||||
line-height: 1.35;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pl-plan-product-cell-control {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-empty {
|
||||
margin: 0;
|
||||
padding: 16px 12px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
border: 1px solid #d9e8e2;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-item {
|
||||
border: 1px solid #d9e8e2;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-item__row1,
|
||||
.pl-stop-product-dual-item__row2,
|
||||
.pl-stop-product-dual-item__row3 {
|
||||
display: grid;
|
||||
/* 上下共用同一套 5 列轨道,保证第一列左右对齐;下行仅 4 个字段占前 4 列 */
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
gap: 8px 12px;
|
||||
padding: 10px 12px;
|
||||
align-items: start;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-item__row1 {
|
||||
border-bottom: 1px solid #eef2f0;
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-item__row3 {
|
||||
border-top: 1px solid #eef2f0;
|
||||
}
|
||||
|
||||
/* 可编辑:末列留给删除按钮(上下同行宽,删除键只在第二行) */
|
||||
.pl-plan-stop-product-table-wrap.is-compact.is-editable {
|
||||
.pl-stop-product-dual-item__row1,
|
||||
.pl-stop-product-dual-item__row2 {
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr)) 36px;
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-item__act {
|
||||
grid-column: 6;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-item__field {
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 4px;
|
||||
|
||||
&--remark {
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-item__label {
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
color: #64748b;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-item__readonly {
|
||||
font-size: 12px;
|
||||
color: #1e293b;
|
||||
word-break: break-all;
|
||||
line-height: 1.4;
|
||||
min-height: 22px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-item__qty-text {
|
||||
justify-content: flex-start;
|
||||
font-weight: 600;
|
||||
color: #059669;
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-item__act {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
min-height: 32px;
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-qty {
|
||||
width: 100%;
|
||||
|
||||
:deep(.el-input__wrapper) {
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
:deep(.el-input__inner) {
|
||||
text-align: left;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-dict {
|
||||
:deep(.el-select__wrapper) {
|
||||
min-height: 32px;
|
||||
padding: 0 8px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.line-meta-cell__btn {
|
||||
flex-shrink: 0;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
:deep(.pl-plan-product-cell-control) {
|
||||
.el-input__wrapper,
|
||||
.el-select__wrapper {
|
||||
min-height: 32px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 520px) {
|
||||
.pl-stop-product-dual-item__row1 {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-item__product {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-item__row2 {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-item__field--remark {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.pl-stop-product-dual-item__act {
|
||||
grid-column: 2;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.pl-plan-alias-brand-select-dropdown {
|
||||
.el-select-dropdown__item {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,333 @@
|
||||
<template>
|
||||
<div class="pl-plan-stops-split">
|
||||
<div class="pl-plan-stops-split__main">
|
||||
<div class="pl-plan-stops-split__pane pl-plan-stops-split__pane--load">
|
||||
<header class="pl-plan-stops-split__hd">
|
||||
<h4 class="pl-plan-stops-split__title">
|
||||
<span class="pl-plan-stops-split__dot pl-plan-stops-split__dot--load" />
|
||||
装货信息
|
||||
</h4>
|
||||
<div class="pl-plan-stops-split__hd-actions">
|
||||
<slot name="load-actions" />
|
||||
</div>
|
||||
</header>
|
||||
<div class="pl-plan-stops-split__bd">
|
||||
<slot name="load" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pl-plan-flow-bridge" aria-hidden="true">
|
||||
<span class="pl-plan-flow-bridge__label">运输</span>
|
||||
<span class="pl-plan-flow-bridge__arrow">
|
||||
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
||||
<path
|
||||
d="M5 12h11.5"
|
||||
stroke="currentColor"
|
||||
stroke-width="2.75"
|
||||
stroke-linecap="round"
|
||||
/>
|
||||
<path
|
||||
d="M13.5 8.5 18.5 12l-5 3.5"
|
||||
stroke="currentColor"
|
||||
stroke-width="2.75"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="pl-plan-stops-split__pane pl-plan-stops-split__pane--delivery">
|
||||
<header class="pl-plan-stops-split__hd">
|
||||
<h4 class="pl-plan-stops-split__title">
|
||||
<span class="pl-plan-stops-split__dot pl-plan-stops-split__dot--delivery" />
|
||||
送货信息
|
||||
</h4>
|
||||
<div class="pl-plan-stops-split__hd-actions">
|
||||
<slot name="delivery-actions" />
|
||||
</div>
|
||||
</header>
|
||||
<div class="pl-plan-stops-split__bd">
|
||||
<slot name="delivery" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer v-if="showBalance" class="pl-plan-stops-split__balance">
|
||||
<span class="pl-plan-stops-split__balance-item">
|
||||
计划总量 <strong>{{ formatQty(planTotalQty) }}{{ unitSuffix }}</strong>
|
||||
</span>
|
||||
<span class="pl-plan-stops-split__balance-item">
|
||||
装货合计 <strong>{{ formatQty(loadTotalQty) }}{{ unitSuffix }}</strong>
|
||||
</span>
|
||||
<span class="pl-plan-stops-split__balance-item">
|
||||
送货合计 <strong>{{ formatQty(deliveryTotalQty) }}{{ unitSuffix }}</strong>
|
||||
</span>
|
||||
<span
|
||||
class="pl-plan-stops-split__balance-status"
|
||||
:class="isBalanced ? 'is-ok' : 'is-warn'"
|
||||
>
|
||||
{{ isBalanced ? '✓ 数量平衡' : '数量不平衡(可暂存)' }}
|
||||
</span>
|
||||
<span v-if="deliveryBreakdown" class="pl-plan-stops-split__balance-extra">
|
||||
{{ deliveryBreakdown }}
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
planTotalQty?: number
|
||||
loadTotalQty?: number
|
||||
deliveryTotalQty?: number
|
||||
unitLabel?: string
|
||||
showBalance?: boolean
|
||||
/** 送货各段数量摘要,如「10 + 15 + 5 = 30」 */
|
||||
deliveryBreakdown?: string
|
||||
qtyPrecision?: number
|
||||
}>(),
|
||||
{
|
||||
planTotalQty: 0,
|
||||
loadTotalQty: 0,
|
||||
deliveryTotalQty: 0,
|
||||
unitLabel: '',
|
||||
showBalance: true,
|
||||
deliveryBreakdown: '',
|
||||
qtyPrecision: 3
|
||||
}
|
||||
)
|
||||
|
||||
const unitSuffix = computed(() => (props.unitLabel ? props.unitLabel : ''))
|
||||
|
||||
const isBalanced = computed(() => {
|
||||
const plan = roundQty(props.planTotalQty)
|
||||
const load = roundQty(props.loadTotalQty)
|
||||
const delivery = roundQty(props.deliveryTotalQty)
|
||||
if (plan <= 0 && load <= 0 && delivery <= 0) return true
|
||||
return plan === load && load === delivery
|
||||
})
|
||||
|
||||
function roundQty(value: number) {
|
||||
const p = props.qtyPrecision
|
||||
return Number(Number(value || 0).toFixed(p))
|
||||
}
|
||||
|
||||
function formatQty(value: number) {
|
||||
const n = Number(value || 0)
|
||||
if (!Number.isFinite(n)) return '—'
|
||||
return String(parseFloat(n.toFixed(props.qtyPrecision)))
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-stops-split {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
min-height: 360px;
|
||||
}
|
||||
|
||||
.pl-plan-stops-split__main {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.pl-plan-stops-split__pane {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1 1 0;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
border: 1px solid #d9e8e2;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pl-plan-flow-bridge {
|
||||
flex: 0 0 88px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
padding: 0 8px;
|
||||
align-self: center;
|
||||
background: transparent;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.pl-plan-flow-bridge__label {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--primary-dark, #168f45);
|
||||
letter-spacing: 0.06em;
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
background: #e6f8ed;
|
||||
border: 1px solid #a8e0b8;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.pl-plan-flow-bridge__arrow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 50%;
|
||||
color: var(--primary-dark, #168f45);
|
||||
background: linear-gradient(145deg, #e6f8ed 0%, #d4f0de 100%);
|
||||
border: 1px solid #a8e0b8;
|
||||
box-shadow: 0 2px 8px rgba(28, 168, 81, 0.14);
|
||||
|
||||
svg {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-stops-split__hd {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
height: 38px;
|
||||
min-height: 38px;
|
||||
padding: 0 12px;
|
||||
border-bottom: 1px solid #d9e8e2;
|
||||
flex-shrink: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.pl-plan-stops-split__hd-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
min-height: 0;
|
||||
gap: 4px;
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.el-button) {
|
||||
height: 26px !important;
|
||||
padding: 0 8px !important;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
border-radius: 6px;
|
||||
font-weight: 600;
|
||||
|
||||
.el-icon {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-stops-split__pane--load .pl-plan-stops-split__hd {
|
||||
background: linear-gradient(180deg, #ecfdf5 0%, #f8fffc 100%);
|
||||
}
|
||||
|
||||
.pl-plan-stops-split__pane--delivery .pl-plan-stops-split__hd {
|
||||
background: linear-gradient(180deg, #f0f9ff 0%, #f8fcff 100%);
|
||||
}
|
||||
|
||||
.pl-plan-stops-split__title {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
color: #1e293b;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.pl-plan-stops-split__dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
|
||||
&--load {
|
||||
background: #10b981;
|
||||
}
|
||||
|
||||
&--delivery {
|
||||
background: #0284c7;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-stops-split__bd {
|
||||
padding: 12px;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.pl-plan-stops-split__balance {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px 16px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #d9e8e2;
|
||||
border-radius: 10px;
|
||||
background: #f8fafc;
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pl-plan-stops-split__balance-item strong {
|
||||
color: #1e293b;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.pl-plan-stops-split__balance-status {
|
||||
font-weight: 600;
|
||||
|
||||
&.is-ok {
|
||||
color: #059669;
|
||||
}
|
||||
|
||||
&.is-warn {
|
||||
color: #d97706;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-stops-split__balance-extra {
|
||||
margin-left: auto;
|
||||
font-size: 11px;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.pl-plan-stops-split__main {
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.pl-plan-flow-bridge {
|
||||
flex: 0 0 auto;
|
||||
flex-direction: row;
|
||||
gap: 12px;
|
||||
padding: 10px 0;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.pl-plan-flow-bridge__arrow {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -77,6 +77,28 @@
|
||||
/>
|
||||
<span v-else class="pl-plan-form-empty-hint">—</span>
|
||||
</div>
|
||||
<div v-if="driverStopFeedbacks.length" class="pl-feedback-stop-list">
|
||||
<div
|
||||
v-for="row in driverStopFeedbacks"
|
||||
:key="`${row.stopType}-${row.stopId}`"
|
||||
class="pl-feedback-stop-item"
|
||||
>
|
||||
<div class="pl-feedback-stop-title">
|
||||
{{ row.label }} · {{ row.customerName }}
|
||||
</div>
|
||||
<AttachmentUploadField
|
||||
v-if="row.attachmentUrls?.length"
|
||||
class="pl-feedback-ticket-attach"
|
||||
:model-value="(row.attachmentUrls || []).join(',')"
|
||||
disabled
|
||||
compact
|
||||
folder="pl/transport/feedback"
|
||||
accept="image/*,video/*,.pdf"
|
||||
:limit="15"
|
||||
/>
|
||||
<span v-else class="pl-plan-form-empty-hint">暂无附件</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="feedbackEditable" class="pl-plan-feedback-card-footer">
|
||||
@@ -89,9 +111,9 @@
|
||||
<el-icon><Edit /></el-icon>
|
||||
{{ hasDriverFeedback ? '编辑' : '补充' }}
|
||||
</el-button>
|
||||
<el-button v-if="arrangeDriverUrl" class="btn-op-item" @click="emit('copy-driver-url')">
|
||||
<el-button v-if="arrangeDriverUrl" class="btn-op-item" @click="emit('copy-driver-summary')">
|
||||
<el-icon><CopyDocument /></el-icon>
|
||||
复制司机链接
|
||||
复制给司机
|
||||
</el-button>
|
||||
</div>
|
||||
</section>
|
||||
@@ -223,6 +245,35 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="siteStopFeedbacks.length" class="pl-feedback-stop-list">
|
||||
<div
|
||||
v-for="row in siteStopFeedbacks"
|
||||
:key="`site-stop-${row.stopType}-${row.stopId}`"
|
||||
class="pl-feedback-stop-item"
|
||||
>
|
||||
<div class="pl-feedback-stop-title">
|
||||
{{ row.label }} · {{ row.customerName }}
|
||||
<span v-if="row.businessType" class="form-label-tip">({{ row.businessType }})</span>
|
||||
</div>
|
||||
<ViewKvGrid
|
||||
:fields="[
|
||||
{ label: '数量', value: row.quantity != null ? `${row.quantity} 吨` : '—' },
|
||||
{ label: '备注', value: row.remark || '—', fullSpan: true }
|
||||
]"
|
||||
:columns="2"
|
||||
/>
|
||||
<AttachmentUploadField
|
||||
v-if="row.attachmentUrls?.length"
|
||||
class="pl-feedback-ticket-attach"
|
||||
:model-value="(row.attachmentUrls || []).join(',')"
|
||||
disabled
|
||||
compact
|
||||
folder="pl/transport/site-feedback"
|
||||
accept="image/*,video/*,.pdf"
|
||||
:limit="15"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
@@ -425,6 +476,26 @@
|
||||
ioOrderImageCsv?: string
|
||||
siteFeedbackTableRows?: SiteFeedbackTableRow[]
|
||||
dibangPlanRows?: PlPlanTransportDibangRow[]
|
||||
driverStopFeedbacks?: {
|
||||
stopType: string
|
||||
stopId: string
|
||||
label: string
|
||||
customerName: string
|
||||
attachmentUrls?: string[]
|
||||
remark?: string
|
||||
feedbackTime?: string
|
||||
}[]
|
||||
siteStopFeedbacks?: {
|
||||
stopType: string
|
||||
stopId: string
|
||||
label: string
|
||||
customerName: string
|
||||
businessType?: string
|
||||
quantity?: number
|
||||
attachmentUrls?: string[]
|
||||
remark?: string
|
||||
feedbackTime?: string
|
||||
}[]
|
||||
}>(),
|
||||
{
|
||||
feedbackEditable: false,
|
||||
@@ -448,7 +519,9 @@
|
||||
ioOrderViewFields: () => [],
|
||||
ioOrderImageCsv: '',
|
||||
siteFeedbackTableRows: () => [],
|
||||
dibangPlanRows: () => []
|
||||
dibangPlanRows: () => [],
|
||||
driverStopFeedbacks: () => [],
|
||||
siteStopFeedbacks: () => []
|
||||
}
|
||||
)
|
||||
|
||||
@@ -553,6 +626,7 @@
|
||||
const emit = defineEmits<{
|
||||
'edit-driver': []
|
||||
'copy-driver-url': []
|
||||
'copy-driver-summary': []
|
||||
'edit-io-order': []
|
||||
'copy-site-url': [url?: string]
|
||||
'edit-site-feedback': [row: SiteFeedbackTableRow]
|
||||
@@ -1064,4 +1138,25 @@
|
||||
max-height: 480px;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-feedback-stop-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
padding: 0 12px 12px;
|
||||
}
|
||||
|
||||
.pl-feedback-stop-item {
|
||||
padding: 10px 12px;
|
||||
border: 1px dashed #cbd5e1;
|
||||
border-radius: 8px;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.pl-feedback-stop-title {
|
||||
margin-bottom: 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
</style>
|
||||
@@ -13,10 +13,7 @@
|
||||
@closed="handleClosed"
|
||||
@opened="handleOpened"
|
||||
>
|
||||
<div
|
||||
v-if="$slots['hero-actions'] || showArrangeActions"
|
||||
class="pl-plan-view-hero-actions"
|
||||
>
|
||||
<div v-if="$slots['hero-actions'] || showArrangeActions" class="pl-plan-view-hero-actions">
|
||||
<template v-if="showArrangeActions">
|
||||
<el-button @click="copyPlanSummary()">
|
||||
<el-icon><CopyDocument /></el-icon>复制给司机
|
||||
@@ -49,145 +46,149 @@
|
||||
ref="qrcodeDialogRef"
|
||||
/>
|
||||
|
||||
<PlPlanPoundQrcodePickDialog
|
||||
v-model:visible="poundQrcodePickVisible"
|
||||
:records="poundQrcodePickRecords"
|
||||
:plan="arrangeActionPlan"
|
||||
@copy="handlePoundQrcodePickCopy"
|
||||
@preview="handlePoundQrcodePickPreview"
|
||||
/>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { CopyDocument } from '@element-plus/icons-vue'
|
||||
import { planApi } from '@/api/pl'
|
||||
import DbPoundSlipQrcodeDialog from '@/components/business/db/DbPoundSlipQrcodeDialog.vue'
|
||||
import PlPlanViewTabs from '@/components/business/pl-plan-view-tabs/index.vue'
|
||||
import { usePlPlanArrangeActions } from '@/composables/usePlPlanArrangeActions'
|
||||
import { CopyDocument } from '@element-plus/icons-vue'
|
||||
import { planApi } from '@/api/pl'
|
||||
import DbPoundSlipQrcodeDialog from '@/components/business/db/DbPoundSlipQrcodeDialog.vue'
|
||||
import PlPlanPoundQrcodePickDialog from '@/components/business/pl-plan-pound-qrcode-pick-dialog/index.vue'
|
||||
import PlPlanViewTabs from '@/components/business/pl-plan-view-tabs/index.vue'
|
||||
import { usePlPlanArrangeActions } from '@/composables/usePlPlanArrangeActions'
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
planId?: string
|
||||
/** 仅运输计划归档:展示入库/出库单价与金额 */
|
||||
showArchiveIoFields?: boolean
|
||||
/** 计划概况产品表:展示入库/出库数量(不含单价与金额) */
|
||||
showInboundOutboundQty?: boolean
|
||||
}>()
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
planId?: string
|
||||
/** 仅运输计划归档:展示入库/出库单价与金额 */
|
||||
showArchiveIoFields?: boolean
|
||||
/** 计划概况产品表:展示入库/出库数量(不含单价与金额) */
|
||||
showInboundOutboundQty?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:visible': [value: boolean]
|
||||
}>()
|
||||
const emit = defineEmits<{
|
||||
'update:visible': [value: boolean]
|
||||
}>()
|
||||
|
||||
const innerVisible = computed({
|
||||
get: () => props.visible,
|
||||
set: value => emit('update:visible', value)
|
||||
})
|
||||
const innerVisible = computed({
|
||||
get: () => props.visible,
|
||||
set: (value) => emit('update:visible', value)
|
||||
})
|
||||
|
||||
const tabsRef = ref<InstanceType<typeof PlPlanViewTabs> | null>(null)
|
||||
const planNo = ref('')
|
||||
const tabsRef = ref<InstanceType<typeof PlPlanViewTabs> | null>(null)
|
||||
const planNo = ref('')
|
||||
|
||||
const {
|
||||
showArrangeActions,
|
||||
hasSiteInventoryRecords,
|
||||
hasDibangInventoryRecords,
|
||||
driverUrl,
|
||||
siteRecords,
|
||||
qrcodeVisible,
|
||||
selectedInventoryId,
|
||||
selectedInventoryUnit,
|
||||
qrcodeDialogRef,
|
||||
resetArrangeActions,
|
||||
loadArrangeActions,
|
||||
copySiteSummary,
|
||||
copyPlanSummary,
|
||||
copyPoundSlipQrcode
|
||||
} = usePlPlanArrangeActions()
|
||||
const {
|
||||
plan: arrangeActionPlan,
|
||||
showArrangeActions,
|
||||
hasSiteInventoryRecords,
|
||||
hasDibangInventoryRecords,
|
||||
driverUrl,
|
||||
siteRecords,
|
||||
qrcodeVisible,
|
||||
selectedInventoryId,
|
||||
selectedInventoryUnit,
|
||||
qrcodeDialogRef,
|
||||
poundQrcodePickVisible,
|
||||
poundQrcodePickRecords,
|
||||
resetArrangeActions,
|
||||
loadArrangeActions,
|
||||
copySiteSummary,
|
||||
copyPlanSummary,
|
||||
copyPoundSlipQrcode,
|
||||
handlePoundQrcodePickCopy,
|
||||
handlePoundQrcodePickPreview
|
||||
} = usePlPlanArrangeActions()
|
||||
|
||||
const dialogTitle = computed(() =>
|
||||
planNo.value ? `查看运输计划 · ${planNo.value}` : '查看运输计划'
|
||||
)
|
||||
const dialogTitle = computed(() =>
|
||||
planNo.value ? `查看运输计划 · ${planNo.value}` : '查看运输计划'
|
||||
)
|
||||
|
||||
async function handleOpened() {
|
||||
if (!props.planId) return
|
||||
try {
|
||||
const res = await planApi.get(props.planId)
|
||||
const data = res.data ?? res
|
||||
planNo.value = data?.planNo || ''
|
||||
await loadArrangeActions(props.planId)
|
||||
} catch {
|
||||
innerVisible.value = false
|
||||
ElMessage.error('加载运输计划详情失败')
|
||||
async function handleOpened() {
|
||||
if (!props.planId) return
|
||||
try {
|
||||
const res = await planApi.get(props.planId)
|
||||
const data = res.data ?? res
|
||||
planNo.value = data?.planNo || ''
|
||||
await loadArrangeActions(props.planId)
|
||||
} catch {
|
||||
innerVisible.value = false
|
||||
ElMessage.error('加载运输计划详情失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleClosed() {
|
||||
planNo.value = ''
|
||||
resetArrangeActions()
|
||||
}
|
||||
|
||||
async function reload() {
|
||||
if (!props.visible || !props.planId) return
|
||||
try {
|
||||
const res = await planApi.get(props.planId)
|
||||
const data = res.data ?? res
|
||||
planNo.value = data?.planNo || ''
|
||||
await loadArrangeActions(props.planId)
|
||||
await tabsRef.value?.reload()
|
||||
} catch {
|
||||
/* 查看弹窗仍打开时静默失败,避免打断用户 */
|
||||
function handleClosed() {
|
||||
planNo.value = ''
|
||||
resetArrangeActions()
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({ reload })
|
||||
async function reload() {
|
||||
if (!props.visible || !props.planId) return
|
||||
try {
|
||||
const res = await planApi.get(props.planId)
|
||||
const data = res.data ?? res
|
||||
planNo.value = data?.planNo || ''
|
||||
await loadArrangeActions(props.planId)
|
||||
await tabsRef.value?.reload()
|
||||
} catch {
|
||||
/* 查看弹窗仍打开时静默失败,避免打断用户 */
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({ reload })
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-view-footer {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.pl-plan-view-footer {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.pl-plan-view-hero-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.pl-plan-view-hero-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.el-dialog.pl-plan-view-dialog.dialog-form-layout {
|
||||
width: 100% !important;
|
||||
max-width: calc(100vw - 48px);
|
||||
height: var(--dialog-max-height, calc(100vh - 40px));
|
||||
max-height: var(--dialog-max-height, calc(100vh - 40px));
|
||||
}
|
||||
.el-dialog.pl-plan-view-dialog.dialog-form-layout {
|
||||
width: 100% !important;
|
||||
max-width: calc(100vw - 48px);
|
||||
height: var(--dialog-max-height, calc(100vh - 40px));
|
||||
max-height: var(--dialog-max-height, calc(100vh - 40px));
|
||||
}
|
||||
|
||||
.el-dialog.pl-plan-view-dialog.dialog-form-layout .el-dialog__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
.el-dialog.pl-plan-view-dialog.dialog-form-layout .el-dialog__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.el-dialog.pl-plan-view-dialog.dialog-form-layout .pl-plan-view-tabs {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.el-dialog.pl-plan-view-dialog.dialog-form-layout .pl-plan-view-tabs {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.el-dialog.pl-plan-view-dialog.dialog-form-layout .pl-plan-view-tabs__nav.el-tabs {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.el-dialog.pl-plan-view-dialog.dialog-form-layout
|
||||
.pl-plan-view-tabs__nav.el-tabs
|
||||
> .el-tabs__content {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
max-height: none;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.el-dialog.pl-plan-view-dialog.dialog-form-layout .pl-plan-view-body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
max-height: none;
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -5,116 +5,18 @@
|
||||
class="pl-plan-view-tabs"
|
||||
:class="{ 'is-embedded': embedded, 'is-hide-nav': hideNav }"
|
||||
>
|
||||
<el-tabs v-model="activeTab" class="pl-plan-view-tabs__nav">
|
||||
<el-tab-pane label="计划概况" name="overview">
|
||||
<section class="pl-plan-form-section pl-plan-form-section--plain">
|
||||
<h3 class="pl-plan-form-section-title">基础信息</h3>
|
||||
<ViewKvTable :fields="overviewBasicViewFields" mode="sept" />
|
||||
</section>
|
||||
<div class="pl-plan-view-body">
|
||||
<section class="pl-plan-form-section pl-plan-form-section--plain">
|
||||
<h3 class="pl-plan-form-section-title">基础信息</h3>
|
||||
<ViewKvTable :fields="overviewBasicViewFields" mode="sept" />
|
||||
</section>
|
||||
|
||||
<section class="pl-plan-form-section pl-plan-form-section--plain">
|
||||
<h3 class="pl-plan-form-section-title">产品信息</h3>
|
||||
<p v-if="!productRows.length && !loading" class="pl-plan-form-empty-hint">暂无产品明细</p>
|
||||
<PlPlanFormProductTable
|
||||
v-else
|
||||
:products="productRows"
|
||||
show-actual-qty
|
||||
show-brand-qty
|
||||
:show-archive-io-fields="showArchiveIoFields"
|
||||
:show-inbound-outbound-qty="showInboundOutboundQty && !showArchiveIoFields"
|
||||
/>
|
||||
</section>
|
||||
|
||||
<section class="pl-plan-form-section pl-plan-form-section--plain">
|
||||
<h3 class="pl-plan-form-section-title">供需双方</h3>
|
||||
<div class="pl-plan-party-row">
|
||||
<div class="pl-plan-party-block">
|
||||
<h4 class="pl-plan-subtitle">供方信息</h4>
|
||||
<PlPlanContractMultiSelect
|
||||
:model-value="plan?.supplierContracts || []"
|
||||
:customer-id="plan?.supplierId"
|
||||
readonly
|
||||
>
|
||||
<template #toolbar>
|
||||
<div class="pl-plan-party-select-row">
|
||||
<div class="pl-plan-view-party-field pl-plan-party-select-row__customer">
|
||||
<span class="pl-plan-view-party-field__value">{{
|
||||
plan?.supplierName || '—'
|
||||
}}</span>
|
||||
<span
|
||||
v-if="supplierContactText"
|
||||
class="pl-plan-view-party-field__contact"
|
||||
>
|
||||
{{ supplierContactText }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</PlPlanContractMultiSelect>
|
||||
</div>
|
||||
|
||||
<div class="pl-plan-flow-bridge" aria-hidden="true">
|
||||
<span class="pl-plan-flow-bridge__label">供货</span>
|
||||
<span class="pl-plan-flow-bridge__arrow">
|
||||
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
||||
<path
|
||||
d="M5 12h11.5"
|
||||
stroke="currentColor"
|
||||
stroke-width="2.75"
|
||||
stroke-linecap="round"
|
||||
/>
|
||||
<path
|
||||
d="M13.5 8.5 18.5 12l-5 3.5"
|
||||
stroke="currentColor"
|
||||
stroke-width="2.75"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="pl-plan-party-block">
|
||||
<h4 class="pl-plan-subtitle">需方信息</h4>
|
||||
<PlPlanContractMultiSelect
|
||||
:model-value="plan?.demanderContracts || []"
|
||||
:customer-id="plan?.customerId"
|
||||
readonly
|
||||
>
|
||||
<template #toolbar>
|
||||
<div class="pl-plan-party-select-row">
|
||||
<div class="pl-plan-view-party-field pl-plan-party-select-row__customer">
|
||||
<span class="pl-plan-view-party-field__value">{{
|
||||
plan?.customerName || '—'
|
||||
}}</span>
|
||||
<span
|
||||
v-if="demanderContactText"
|
||||
class="pl-plan-view-party-field__contact"
|
||||
>
|
||||
{{ demanderContactText }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</PlPlanContractMultiSelect>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="pl-plan-form-section pl-plan-form-section--plain">
|
||||
<h3 class="pl-plan-form-section-title">危化品证书信息</h3>
|
||||
<PlPlanHazardCertViewTable :products="hazardProducts" />
|
||||
</section>
|
||||
|
||||
<section class="pl-plan-form-section pl-plan-form-section--plain">
|
||||
<h3 class="pl-plan-form-section-title">备注</h3>
|
||||
<p class="pl-plan-view-remark">{{ plan?.remark || '—' }}</p>
|
||||
</section>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="运输信息" name="transport">
|
||||
<section v-if="showArrangeLinks" class="pl-plan-form-section pl-plan-form-section--plain pl-plan-arrange-links">
|
||||
<h3 class="pl-plan-form-section-title">运输链接</h3>
|
||||
<section class="pl-plan-form-section pl-plan-form-section--plain">
|
||||
<h3 class="pl-plan-form-section-title">运输信息</h3>
|
||||
<div
|
||||
v-if="showArrangeLinks"
|
||||
class="pl-plan-arrange-links pl-plan-transport-block"
|
||||
>
|
||||
<div class="pl-arrange-links-body">
|
||||
<div class="pl-arrange-link-row">
|
||||
<span class="pl-arrange-link-label">司机链接</span>
|
||||
@@ -138,7 +40,9 @@
|
||||
:key="record.siteLinkId"
|
||||
class="pl-arrange-link-row"
|
||||
>
|
||||
<span class="pl-arrange-link-label">{{ record.productName || '现场链接' }}</span>
|
||||
<span class="pl-arrange-link-label">{{
|
||||
record.productName || '现场链接'
|
||||
}}</span>
|
||||
<el-input :model-value="record.siteUrl || ''" readonly />
|
||||
<el-button @click="copyArrangeSiteUrl(record.siteUrl)">
|
||||
<el-icon><CopyDocument /></el-icon>复制链接
|
||||
@@ -147,76 +51,188 @@
|
||||
</template>
|
||||
</template>
|
||||
<p
|
||||
v-else-if="showArrangeLinks && planSupportsInventory"
|
||||
v-else-if="showArrangeLinks && planRequiresSiteLinkFlag"
|
||||
class="pl-plan-form-empty-hint pl-plan-arrange-links-hint"
|
||||
>
|
||||
暂无现场链接
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section class="pl-plan-form-section pl-plan-form-section--plain">
|
||||
<h3 class="pl-plan-form-section-title">车辆信息</h3>
|
||||
<PlVehicleSummaryStrip
|
||||
v-if="vehicleBundle"
|
||||
:detail="vehicleBundle.detail"
|
||||
:personnel-list="vehicleBundle.personnelList"
|
||||
:carrier-name="summaryCarrierName"
|
||||
@view="vehicleViewVisible = true"
|
||||
/>
|
||||
<p v-else-if="!loading" class="pl-plan-form-empty-hint">暂无车辆信息</p>
|
||||
</section>
|
||||
|
||||
<section class="pl-plan-form-section pl-plan-form-section--plain">
|
||||
<h3 class="pl-plan-form-section-title">物流节点</h3>
|
||||
<div class="parties-row">
|
||||
<div class="party-panel party-panel--plain pl-plan-logistics-panel">
|
||||
<ViewKvTable :fields="pickupViewFields" mode="dual" />
|
||||
</div>
|
||||
|
||||
<div class="party-flow-bridge">
|
||||
<span class="party-flow-bridge__label">运输</span>
|
||||
<span class="party-flow-bridge__arrow">
|
||||
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
||||
<path
|
||||
d="M5 12h11.5"
|
||||
stroke="currentColor"
|
||||
stroke-width="2.75"
|
||||
stroke-linecap="round"
|
||||
/>
|
||||
<path
|
||||
d="M13.5 8.5 18.5 12l-5 3.5"
|
||||
stroke="currentColor"
|
||||
stroke-width="2.75"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="party-panel party-panel--plain pl-plan-logistics-panel">
|
||||
<ViewKvTable :fields="deliveryViewFields" mode="dual" />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="pl-plan-form-section pl-plan-form-section--plain">
|
||||
<h3 class="pl-plan-form-section-title">运费信息</h3>
|
||||
<ViewKvTable :fields="freightViewFields" mode="sept" />
|
||||
</section>
|
||||
|
||||
<PlPlanTransportFeedbackBlocks
|
||||
v-if="!feedbackMirrorTo"
|
||||
v-bind="feedbackBlocksBind"
|
||||
v-on="feedbackBlocksOn"
|
||||
<PlVehicleSummaryStrip
|
||||
v-if="vehicleBundle"
|
||||
class="pl-plan-transport-block"
|
||||
:detail="vehicleBundle.detail"
|
||||
:personnel-list="vehicleBundle.personnelList"
|
||||
:carrier-name="summaryCarrierName"
|
||||
@view="vehicleViewVisible = true"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<p v-else-if="!loading" class="pl-plan-form-empty-hint">暂无车辆信息</p>
|
||||
</section>
|
||||
|
||||
</el-tabs>
|
||||
<section class="pl-plan-form-section pl-plan-form-section--plain">
|
||||
<h3 class="pl-plan-form-section-title">装送货信息</h3>
|
||||
<PlPlanStopsSplitShell
|
||||
:plan-total-qty="viewPlanTotalQty"
|
||||
:load-total-qty="viewLoadTotalQty"
|
||||
:delivery-total-qty="viewDeliveryTotalQty"
|
||||
:unit-label="viewQtyUnitLabel"
|
||||
:delivery-breakdown="viewDeliveryQtyBreakdown"
|
||||
>
|
||||
<template #load>
|
||||
<div class="pl-plan-view-stop-block">
|
||||
<div class="pl-plan-view-stop-meta">
|
||||
<div class="pl-plan-view-party-field">
|
||||
<span class="pl-plan-view-party-field__label">装货客户</span>
|
||||
<span class="pl-plan-view-party-field__value">{{
|
||||
loadView.customerName || '—'
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="pl-plan-view-party-field">
|
||||
<span class="pl-plan-view-party-field__label">装货时间</span>
|
||||
<span class="pl-plan-view-party-field__value">{{
|
||||
formatViewDate(loadView.loadTime)
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="pl-plan-view-party-field">
|
||||
<span class="pl-plan-view-party-field__label">装货地址</span>
|
||||
<span class="pl-plan-view-party-field__value">{{ loadView.address || '—' }}</span>
|
||||
</div>
|
||||
<div v-if="loadView.contact" class="pl-plan-view-party-field">
|
||||
<span class="pl-plan-view-party-field__label">联系方式</span>
|
||||
<span class="pl-plan-view-party-field__value">{{ loadView.contact }}</span>
|
||||
</div>
|
||||
<div v-if="loadView.notes" class="pl-plan-view-party-field">
|
||||
<span class="pl-plan-view-party-field__label">注意事项</span>
|
||||
<span class="pl-plan-view-party-field__value">{{ loadView.notes }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<PlPlanContractMultiSelect
|
||||
:model-value="loadView.contracts || []"
|
||||
:customer-id="loadView.customerId"
|
||||
readonly
|
||||
compact-summary
|
||||
/>
|
||||
<PlPlanStopProductTable
|
||||
v-if="loadView.products?.length"
|
||||
:products="loadView.products"
|
||||
compact
|
||||
show-stop-actual-qty
|
||||
:show-stop-archive-price="showArchiveIoFields"
|
||||
stop-archive-mode="load"
|
||||
/>
|
||||
<p v-else class="pl-plan-form-empty-hint">暂无装货产品</p>
|
||||
<PlPlanStopFeedbackPanel
|
||||
v-if="showStopFeedback && !feedbackMirrorTo"
|
||||
stop-label="装货"
|
||||
:customer-name="loadView.customerName"
|
||||
:generate-dibang="loadView.generateDibang"
|
||||
:dibang-rows="loadDibangRows"
|
||||
:driver-feedback="resolveDriverStopFeedback('load', loadStopId)"
|
||||
:site-feedback="resolveSiteStopFeedback('load', loadStopId)"
|
||||
:fallback-remark="transport?.feedbackRemark"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<template #delivery>
|
||||
<div v-if="deliveryViews.length > 1" class="pl-plan-delivery-tabs pl-plan-view-delivery-tabs">
|
||||
<button
|
||||
v-for="(delivery, index) in deliveryViews"
|
||||
:key="delivery.id || 'delivery-tab-' + index"
|
||||
type="button"
|
||||
class="pl-plan-delivery-tab"
|
||||
:class="{ 'is-active': deliveryViewActiveIndex === index }"
|
||||
@click="deliveryViewActiveIndex = index"
|
||||
>
|
||||
#{{ delivery.seq || index + 1 }}
|
||||
{{ delivery.customerName || '未选客户' }}
|
||||
<span v-if="viewDeliveryQtyLabel(delivery)" class="pl-plan-delivery-tab__qty">
|
||||
{{ viewDeliveryQtyLabel(delivery) }}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<article
|
||||
v-for="(delivery, index) in deliveryViews"
|
||||
v-show="deliveryViews.length <= 1 || deliveryViewActiveIndex === index"
|
||||
:key="delivery.id || 'delivery-' + index"
|
||||
class="pl-plan-view-delivery-block"
|
||||
>
|
||||
<div class="pl-plan-view-stop-meta">
|
||||
<div class="pl-plan-view-party-field">
|
||||
<span class="pl-plan-view-party-field__label">送货客户</span>
|
||||
<span class="pl-plan-view-party-field__value">{{
|
||||
delivery.customerName || '—'
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="pl-plan-view-party-field">
|
||||
<span class="pl-plan-view-party-field__label">送货时间</span>
|
||||
<span class="pl-plan-view-party-field__value">{{
|
||||
formatViewDate(delivery.deliveryTime)
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="pl-plan-view-party-field">
|
||||
<span class="pl-plan-view-party-field__label">送货地址</span>
|
||||
<span class="pl-plan-view-party-field__value">{{ delivery.address || '—' }}</span>
|
||||
</div>
|
||||
<div v-if="delivery.contact" class="pl-plan-view-party-field">
|
||||
<span class="pl-plan-view-party-field__label">联系方式</span>
|
||||
<span class="pl-plan-view-party-field__value">{{ delivery.contact }}</span>
|
||||
</div>
|
||||
<div v-if="delivery.notes" class="pl-plan-view-party-field">
|
||||
<span class="pl-plan-view-party-field__label">注意事项</span>
|
||||
<span class="pl-plan-view-party-field__value">{{ delivery.notes }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<PlPlanContractMultiSelect
|
||||
:model-value="delivery.contracts || []"
|
||||
:customer-id="delivery.customerId"
|
||||
readonly
|
||||
compact-summary
|
||||
/>
|
||||
<PlPlanStopProductTable
|
||||
v-if="delivery.products?.length"
|
||||
:products="delivery.products"
|
||||
compact
|
||||
show-stop-actual-qty
|
||||
:show-stop-archive-price="showArchiveIoFields"
|
||||
stop-archive-mode="delivery"
|
||||
/>
|
||||
<p v-else class="pl-plan-form-empty-hint">暂无送货产品</p>
|
||||
<PlPlanStopFeedbackPanel
|
||||
v-if="showStopFeedback && !feedbackMirrorTo"
|
||||
:stop-label="
|
||||
deliveryViews.length > 1 ? `送货 #${delivery.seq || index + 1}` : '送货'
|
||||
"
|
||||
:customer-name="delivery.customerName"
|
||||
:generate-dibang="delivery.generateDibang"
|
||||
:dibang-rows="resolveDeliveryDibangRows(delivery)"
|
||||
:driver-feedback="resolveDriverStopFeedback('delivery', delivery.id || '')"
|
||||
:site-feedback="resolveSiteStopFeedback('delivery', delivery.id || '')"
|
||||
:fallback-remark="transport?.feedbackRemark"
|
||||
/>
|
||||
</article>
|
||||
</template>
|
||||
</PlPlanStopsSplitShell>
|
||||
</section>
|
||||
|
||||
<!-- defer:目标在同次渲染的兄弟节点(归档左侧)时,等 flush 后再解析,避免 emitsOptions 空引用 -->
|
||||
<section class="pl-plan-form-section pl-plan-form-section--plain">
|
||||
<h3 class="pl-plan-form-section-title">危化品证书信息</h3>
|
||||
<PlPlanHazardCertViewTable :products="hazardProducts" />
|
||||
</section>
|
||||
|
||||
<section class="pl-plan-form-section pl-plan-form-section--plain">
|
||||
<h3 class="pl-plan-form-section-title">运费信息</h3>
|
||||
<ViewKvTable :fields="freightViewFields" mode="sept" />
|
||||
</section>
|
||||
|
||||
<section class="pl-plan-form-section pl-plan-form-section--plain">
|
||||
<h3 class="pl-plan-form-section-title">备注</h3>
|
||||
<p class="pl-plan-view-remark">{{ plan?.remark || '—' }}</p>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- 归档左侧仍镜像旧回传区块;查看弹窗内改为按装/送货段展示 -->
|
||||
<Teleport v-if="feedbackMirrorTo" :to="feedbackMirrorTo" defer>
|
||||
<PlPlanTransportFeedbackBlocks v-bind="feedbackBlocksBind" v-on="feedbackBlocksOn" />
|
||||
</Teleport>
|
||||
@@ -375,8 +391,10 @@
|
||||
type BrandQtyRow
|
||||
} from '@/components/business/brand-qty-chips-field/index.vue'
|
||||
import PlPlanDriverFeedbackDialog from '@/components/business/pl-plan-driver-feedback-dialog/index.vue'
|
||||
import PlPlanFormProductTable from '@/components/business/pl-plan-form-dialog/PlPlanFormProductTable.vue'
|
||||
import PlPlanHazardCertViewTable from '@/components/business/pl-plan-hazard-cert-view-table/index.vue'
|
||||
import PlPlanStopFeedbackPanel from '@/components/business/pl-plan-stop-feedback-panel/index.vue'
|
||||
import PlPlanStopProductTable from '@/components/business/pl-plan-stop-product-table/index.vue'
|
||||
import PlPlanStopsSplitShell from '@/components/business/pl-plan-stops-split-shell/index.vue'
|
||||
import PlPlanSiteFeedbackDialog from '@/components/business/pl-plan-site-feedback-dialog/index.vue'
|
||||
import PlPlanTransportFeedbackBlocks, {
|
||||
type SiteFeedbackTableRow
|
||||
@@ -386,9 +404,6 @@
|
||||
import ViewKvTable from '@/components/business/system-view-dialog/ViewKvTable.vue'
|
||||
import type { ViewField } from '@/components/business/system-view-dialog/types'
|
||||
import type { ContractVO } from '@/api/crm/contract/types'
|
||||
import { getContactByCustomerId } from '@/api/crm/customer'
|
||||
import type { ContactVO } from '@/api/crm/customerTypes'
|
||||
import { inventoryApi } from '@/api/db/inventory'
|
||||
import {
|
||||
inboundOrderApi,
|
||||
outboundOrderApi,
|
||||
@@ -401,15 +416,35 @@
|
||||
getDeliveryMethodLabel,
|
||||
type PlanFormProductRow
|
||||
} from '@/composables/usePlContractToPlan'
|
||||
import { mapPlanProductToFormRow, usePlPlanViewDetail, type PlPlanTransportSiteRow } from '@/composables/usePlPlanViewDetail'
|
||||
import {
|
||||
mapPlanProductToFormRow,
|
||||
usePlPlanViewDetail,
|
||||
type PlPlanTransportDibangRow,
|
||||
type PlPlanTransportSiteRow
|
||||
} from '@/composables/usePlPlanViewDetail'
|
||||
import {
|
||||
mapDeliveriesFromApi,
|
||||
mapLegacyPlanToStops,
|
||||
mapLoadFromApi,
|
||||
resolveDeliveryViewAddress,
|
||||
resolveLoadViewAddress,
|
||||
resolveStopProductsForView,
|
||||
sumStopProductsPlanQty,
|
||||
type PlanLoadForm,
|
||||
type PlanStopProductFormRow
|
||||
} from '@/utils/pl-plan-stop-form'
|
||||
import { resolveFreightUnitLabel } from '@/composables/usePlFreightCalc'
|
||||
import { isHazardProduct } from '@/composables/usePlToxicProductCertCheck'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { formatDate, formatDateTime } from '@/utils/format'
|
||||
import { pickBxData } from '@/utils/http/bx'
|
||||
import {
|
||||
buildSiteSummaryFromInventoryLinks
|
||||
buildSiteSummaryFromInventoryLinks,
|
||||
buildSiteStopBlocksFromPlan
|
||||
} from '@/utils/db-site-summary'
|
||||
import {
|
||||
buildDriverSummaryFromPlan,
|
||||
buildDriverStopBlocksFromPlan
|
||||
} from '@/utils/pl-driver-summary'
|
||||
import {
|
||||
formatPlanProductListText,
|
||||
formatBrandQtySummary,
|
||||
@@ -421,6 +456,7 @@
|
||||
parsePlFeedbackImages
|
||||
} from '@/utils/pl-display'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { planRequiresSiteLink } from '@/utils/pl-internal-customer'
|
||||
import type { Transport, TransportDriverProductFeedback } from '@/api/pl'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
@@ -508,80 +544,6 @@
|
||||
resetDetail
|
||||
} = usePlPlanViewDetail()
|
||||
|
||||
type PartyContactDisplay = { contactName?: string; phone?: string }
|
||||
const supplierContact = ref<PartyContactDisplay>({})
|
||||
const demanderContact = ref<PartyContactDisplay>({})
|
||||
let partyContactLoadSeq = 0
|
||||
|
||||
function pickPrimaryContact(list: ContactVO[]): PartyContactDisplay {
|
||||
if (!list.length) return {}
|
||||
const primary =
|
||||
list.find(item => Number(item.isPrimary) === 1) ||
|
||||
list.find(item => Number(item.isKey) === 1) ||
|
||||
list[0]
|
||||
const contactName = String(primary?.contactName || '').trim()
|
||||
const phone = String(primary?.mobile || primary?.telephone || '').trim()
|
||||
return {
|
||||
contactName: contactName || undefined,
|
||||
phone: phone || undefined
|
||||
}
|
||||
}
|
||||
|
||||
function formatPartyContactText(contact: PartyContactDisplay): string {
|
||||
const parts: string[] = []
|
||||
if (contact.contactName) parts.push(contact.contactName)
|
||||
if (contact.phone) parts.push(contact.phone)
|
||||
return parts.join(' ')
|
||||
}
|
||||
|
||||
const supplierContactText = computed(() => formatPartyContactText(supplierContact.value))
|
||||
const demanderContactText = computed(() => formatPartyContactText(demanderContact.value))
|
||||
|
||||
async function loadPartyContact(customerId?: string | null): Promise<PartyContactDisplay> {
|
||||
const id = String(customerId || '').trim()
|
||||
if (!id) return {}
|
||||
try {
|
||||
const res = await getContactByCustomerId(id)
|
||||
const list = (res?.data || []) as ContactVO[]
|
||||
return pickPrimaryContact(Array.isArray(list) ? list : [])
|
||||
} catch {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
async function refreshPartyContacts() {
|
||||
const seq = ++partyContactLoadSeq
|
||||
const supplierId = plan.value?.supplierId
|
||||
const customerId = plan.value?.customerId
|
||||
const [supplier, demanderFromCrm] = await Promise.all([
|
||||
loadPartyContact(supplierId),
|
||||
loadPartyContact(customerId)
|
||||
])
|
||||
if (seq !== partyContactLoadSeq) return
|
||||
|
||||
supplierContact.value = supplier
|
||||
|
||||
const planContactName = String(plan.value?.contactName || '').trim()
|
||||
const planContactPhone = String(plan.value?.contactPhone || '').trim()
|
||||
demanderContact.value = {
|
||||
contactName: demanderFromCrm.contactName || planContactName || undefined,
|
||||
phone: demanderFromCrm.phone || planContactPhone || undefined
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [plan.value?.id, plan.value?.supplierId, plan.value?.customerId] as const,
|
||||
() => {
|
||||
if (!plan.value?.id) {
|
||||
supplierContact.value = {}
|
||||
demanderContact.value = {}
|
||||
return
|
||||
}
|
||||
void refreshPartyContacts()
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
const ioOrderEditVisible = ref(false)
|
||||
const ioOrderSaving = ref(false)
|
||||
const driverImagesSaving = ref(false)
|
||||
@@ -1156,10 +1118,7 @@
|
||||
() => props.showArrangeLinks && (props.arrangeSiteRecords?.length ?? 0) > 0
|
||||
)
|
||||
|
||||
const planSupportsInventory = computed(() => {
|
||||
const planType = plan.value?.planType
|
||||
return planType === 'inbound' || planType === 'outbound'
|
||||
})
|
||||
const planRequiresSiteLinkFlag = computed(() => planRequiresSiteLink(plan.value))
|
||||
|
||||
async function copyArrangeDriverUrl() {
|
||||
const url = props.arrangeDriverUrl?.trim()
|
||||
@@ -1171,6 +1130,29 @@
|
||||
ElMessage.success('已复制司机链接')
|
||||
}
|
||||
|
||||
async function copyDriverSummaryForArrange() {
|
||||
const url = props.arrangeDriverUrl?.trim()
|
||||
if (!url) {
|
||||
ElMessage.warning('暂无司机链接')
|
||||
return
|
||||
}
|
||||
const getUnitLabel = (unit: string) => dictStore.getLabel('crm_product_unit', unit) || unit
|
||||
const text = buildDriverSummaryFromPlan({
|
||||
plan: plan.value || undefined,
|
||||
planNo: plan.value?.planNo,
|
||||
licensePlate: plan.value?.licensePlate || transport.value?.licensePlate,
|
||||
pickupTime: plan.value?.pickupTime,
|
||||
planDate: plan.value?.planDate,
|
||||
personnelSummary: plan.value?.personnelSummary,
|
||||
driverUrl: url,
|
||||
products: products.value,
|
||||
getUnitLabel,
|
||||
stopBlocks: buildDriverStopBlocksFromPlan(plan.value, getUnitLabel)
|
||||
})
|
||||
await navigator.clipboard.writeText(text)
|
||||
ElMessage.success('已复制给司机')
|
||||
}
|
||||
|
||||
async function copyArrangeSiteUrl(url?: string) {
|
||||
const target = url?.trim()
|
||||
if (!target) {
|
||||
@@ -1198,7 +1180,8 @@
|
||||
licensePlate: plan.value?.licensePlate || transport.value?.licensePlate,
|
||||
pickupTime: plan.value?.pickupTime,
|
||||
planDate: plan.value?.planDate,
|
||||
records: [{ ...row.link, siteUrl: url, productText }]
|
||||
records: [{ ...row.link, siteUrl: url, productText }],
|
||||
stopBlocks: buildSiteStopBlocksFromPlan(plan.value)
|
||||
})
|
||||
await navigator.clipboard.writeText(text)
|
||||
ElMessage.success('已复制给现场')
|
||||
@@ -1206,6 +1189,155 @@
|
||||
|
||||
const displayFeedbackTime = computed(() => formatDateTime(transport.value?.feedbackTime) || '—')
|
||||
|
||||
const deliveryViewActiveIndex = ref(0)
|
||||
|
||||
const loadView = computed<PlanLoadForm & { id?: string }>(() => {
|
||||
if (plan.value?.load) {
|
||||
const mapped = mapLoadFromApi(plan.value.load)
|
||||
return {
|
||||
id: plan.value.load.id,
|
||||
...mapped,
|
||||
address: resolveLoadViewAddress(plan.value, mapped),
|
||||
products: resolveStopProductsForView(mapped.products, productRows.value)
|
||||
}
|
||||
}
|
||||
const legacy = mapLegacyPlanToStops(plan.value || ({} as any))
|
||||
return {
|
||||
id: undefined,
|
||||
...legacy.load,
|
||||
address: resolveLoadViewAddress(plan.value, legacy.load),
|
||||
products: resolveStopProductsForView(legacy.load.products, productRows.value)
|
||||
}
|
||||
})
|
||||
|
||||
const deliveryViews = computed(() => {
|
||||
if (plan.value?.deliveries?.length) {
|
||||
return mapDeliveriesFromApi(plan.value.deliveries, plan.value.load?.customerName).map((row, index) => ({
|
||||
id: plan.value?.deliveries?.[index]?.id,
|
||||
...row,
|
||||
address: resolveDeliveryViewAddress(plan.value, row, index),
|
||||
products: resolveStopProductsForView(row.products, productRows.value)
|
||||
}))
|
||||
}
|
||||
return mapLegacyPlanToStops(plan.value || ({} as any)).deliveries.map((row, index) => ({
|
||||
id: undefined as string | undefined,
|
||||
...row,
|
||||
address: resolveDeliveryViewAddress(plan.value, row, index),
|
||||
products: resolveStopProductsForView(row.products, productRows.value)
|
||||
}))
|
||||
})
|
||||
|
||||
watch(
|
||||
() => deliveryViews.value.length,
|
||||
(len) => {
|
||||
if (deliveryViewActiveIndex.value > Math.max(0, len - 1)) {
|
||||
deliveryViewActiveIndex.value = 0
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
watch(
|
||||
() => props.planId,
|
||||
() => {
|
||||
deliveryViewActiveIndex.value = 0
|
||||
}
|
||||
)
|
||||
|
||||
const loadStopId = computed(() => String(plan.value?.load?.id || loadView.value.id || ''))
|
||||
|
||||
const viewPlanTotalQty = computed(() =>
|
||||
productRows.value.reduce((sum, row) => sum + Number(row.quantity ?? 0), 0)
|
||||
)
|
||||
const viewLoadTotalQty = computed(() => sumStopProductsPlanQty(loadView.value.products || []))
|
||||
const viewDeliveryTotalQty = computed(() =>
|
||||
deliveryViews.value.reduce((sum, row) => sum + sumStopProductsPlanQty(row.products || []), 0)
|
||||
)
|
||||
const viewQtyUnitLabel = computed(() => resolveFreightUnitLabel(productRows.value))
|
||||
const viewDeliveryQtyBreakdown = computed(() => {
|
||||
const parts = deliveryViews.value
|
||||
.map((row) => parseFloat(sumStopProductsPlanQty(row.products || []).toFixed(3)))
|
||||
.filter((qty) => qty > 0)
|
||||
if (parts.length < 2) return ''
|
||||
const total = parseFloat(parts.reduce((a, b) => a + b, 0).toFixed(3))
|
||||
return `${parts.join(' + ')} = ${total}`
|
||||
})
|
||||
|
||||
function formatViewDate(value?: string | null) {
|
||||
if (!value) return '—'
|
||||
return formatDate(value) || String(value).slice(0, 10) || '—'
|
||||
}
|
||||
|
||||
function viewDeliveryQtyLabel(delivery: { products?: PlanStopProductFormRow[] }) {
|
||||
const qty = sumStopProductsPlanQty(delivery.products || [])
|
||||
if (qty <= 0) return ''
|
||||
const unit = viewQtyUnitLabel.value || ''
|
||||
const text = String(parseFloat(qty.toFixed(3)))
|
||||
return unit ? `${text}${unit}` : text
|
||||
}
|
||||
|
||||
function collectStopProductIds(products: PlanStopProductFormRow[]) {
|
||||
return products.map((row) => String(row.planProductId || '').trim()).filter(Boolean)
|
||||
}
|
||||
|
||||
function resolveStopDibangRows(
|
||||
stopType: 'load' | 'delivery',
|
||||
stopId: string,
|
||||
productIds: string[]
|
||||
): PlPlanTransportDibangRow[] {
|
||||
return dibangRows.value.filter((row) => {
|
||||
const link = row.link
|
||||
if (link.stopType && link.stopId) {
|
||||
return link.stopType === stopType && link.stopId === stopId
|
||||
}
|
||||
if (productIds.length && link.planProductId) {
|
||||
return productIds.includes(String(link.planProductId))
|
||||
}
|
||||
return false
|
||||
})
|
||||
}
|
||||
|
||||
const loadDibangRows = computed(() =>
|
||||
resolveStopDibangRows(
|
||||
'load',
|
||||
loadStopId.value,
|
||||
collectStopProductIds(loadView.value.products || [])
|
||||
)
|
||||
)
|
||||
|
||||
function resolveDeliveryDibangRows(delivery: {
|
||||
id?: string
|
||||
products?: PlanStopProductFormRow[]
|
||||
}) {
|
||||
return resolveStopDibangRows(
|
||||
'delivery',
|
||||
delivery.id || '',
|
||||
collectStopProductIds(delivery.products || [])
|
||||
)
|
||||
}
|
||||
|
||||
function resolveDriverStopFeedback(stopType: 'load' | 'delivery', stopId: string) {
|
||||
if (!stopId) return null
|
||||
return (
|
||||
transport.value?.driverStopFeedbacks?.find(
|
||||
(item) => item.stopType === stopType && item.stopId === stopId
|
||||
) || null
|
||||
)
|
||||
}
|
||||
|
||||
function resolveSiteStopFeedback(stopType: 'load' | 'delivery', stopId: string) {
|
||||
if (!stopId) return null
|
||||
return (
|
||||
transport.value?.siteStopFeedbacks?.find(
|
||||
(item) => item.stopType === stopType && item.stopId === stopId
|
||||
) || null
|
||||
)
|
||||
}
|
||||
|
||||
const showStopFeedback = computed(
|
||||
() => plan.value?.transportStatus === 'arranged' && plan.value?.followStatus !== 'cancelled'
|
||||
)
|
||||
|
||||
|
||||
const feedbackBlocksBind = computed(() => ({
|
||||
feedbackEditable: props.feedbackEditable,
|
||||
showArchiveIoFields: props.showArchiveIoFields,
|
||||
@@ -1236,6 +1368,9 @@
|
||||
const feedbackBlocksOn = {
|
||||
'edit-driver': openDriverFeedbackDialog,
|
||||
'copy-driver-url': copyArrangeDriverUrl,
|
||||
'copy-driver-summary': () => {
|
||||
void copyDriverSummaryForArrange()
|
||||
},
|
||||
'edit-io-order': openIoOrderEditDialog,
|
||||
'save-driver-images': (csv: string) => {
|
||||
void saveDriverImagesInline(csv)
|
||||
@@ -1304,31 +1439,11 @@
|
||||
{ label: '计划日期', value: plan.value?.planDate },
|
||||
{ label: '归属公司', value: getPlPlanCompanyLabel(plan.value?.belongsCompany) },
|
||||
{ label: '单据类型', value: getPlPlanTypeLabel(plan.value?.planType || '') },
|
||||
{ label: '跟进人', value: plan.value?.followUserName },
|
||||
{ label: '供方', value: plan.value?.supplierName },
|
||||
{ label: '需方', value: plan.value?.customerName }
|
||||
{ label: '跟进人', value: plan.value?.followUserName }
|
||||
])
|
||||
|
||||
const summaryCarrierName = computed(() => displayCarrierName.value)
|
||||
|
||||
const pickupViewFields = computed<ViewField[]>(() => [
|
||||
{ label: '取货地址', value: plan.value?.pickupAddress, span: 'full' },
|
||||
{ label: '取货时间', value: formatDate(plan.value?.pickupTime) || '—', long: false },
|
||||
{ label: '取货联系方式', value: plan.value?.pickupContact, long: false, fullSpan: false },
|
||||
{ label: '注意事项', value: plan.value?.pickupNotes, span: 'full' }
|
||||
])
|
||||
|
||||
const deliveryViewFields = computed<ViewField[]>(() => [
|
||||
{
|
||||
label: '送货地址',
|
||||
value: plan.value?.destinationAddress || plan.value?.destinationName,
|
||||
span: 'full'
|
||||
},
|
||||
{ label: '送货时间', value: formatDate(plan.value?.deliveryTime) || '—', long: false },
|
||||
{ label: '送货联系方式', value: plan.value?.deliveryContact, long: false, fullSpan: false },
|
||||
{ label: '注意事项', value: plan.value?.destinationNotes, span: 'full' }
|
||||
])
|
||||
|
||||
const freightViewFields = computed<ViewField[]>(() => {
|
||||
const hasFreight = plan.value?.hasFreight === 1
|
||||
const unit = freightUnitLabel.value
|
||||
@@ -1405,6 +1520,8 @@
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-view-tabs {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 200px;
|
||||
|
||||
&.is-embedded {
|
||||
@@ -1412,22 +1529,88 @@
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.is-hide-nav {
|
||||
.pl-plan-view-tabs__nav :deep(> .el-tabs__header) {
|
||||
display: none;
|
||||
}
|
||||
.pl-plan-view-body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
padding-right: 4px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.pl-plan-view-tabs__nav :deep(> .el-tabs__content) {
|
||||
padding-top: 0;
|
||||
}
|
||||
.pl-plan-transport-block {
|
||||
& + & {
|
||||
margin-top: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-view-tabs__nav :deep(.el-tabs__content) {
|
||||
max-height: min(52vh, 560px);
|
||||
overflow-y: auto;
|
||||
padding-right: 4px;
|
||||
.pl-plan-view-stop-block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.pl-plan-view-stop-meta {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 10px 16px;
|
||||
}
|
||||
|
||||
.pl-plan-view-party-field__label {
|
||||
font-size: 13px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.pl-plan-view-delivery-block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.pl-plan-view-delivery-tabs {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.pl-plan-view-delivery-tabs .pl-plan-delivery-tab {
|
||||
border: 1px solid #d9e8e2;
|
||||
background: #fff;
|
||||
border-radius: 6px;
|
||||
padding: 5px 10px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
color: #64748b;
|
||||
font-family: inherit;
|
||||
max-width: 100%;
|
||||
text-align: left;
|
||||
line-height: 1.35;
|
||||
|
||||
&.is-active {
|
||||
border-color: #7dd3fc;
|
||||
background: #f0f9ff;
|
||||
color: #0284c7;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-view-delivery-tabs .pl-plan-delivery-tab__qty {
|
||||
margin-left: 4px;
|
||||
font-weight: 400;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.pl-plan-view-stop-meta {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.pl-plan-form-section {
|
||||
|
||||
@@ -68,7 +68,11 @@
|
||||
header-align="left"
|
||||
class-name="col-name-wrap"
|
||||
label-class-name="col-name-wrap"
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<PlProductNameHazardCell :product="row" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="品牌"
|
||||
min-width="140"
|
||||
@@ -218,6 +222,7 @@
|
||||
import ListPagination from '@/components/ListPagination/index.vue'
|
||||
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
|
||||
import ProductFormDialog from '@/components/business/product-form-dialog/index.vue'
|
||||
import PlProductNameHazardCell from '@/components/business/pl-product-name-hazard-cell/index.vue'
|
||||
import {
|
||||
fetchCategoryTree,
|
||||
fetchProductList,
|
||||
@@ -238,6 +243,8 @@
|
||||
unit?: string
|
||||
taxRate?: number
|
||||
status?: string
|
||||
isToxic?: number
|
||||
isExplosive?: number
|
||||
brands?: ProductBrandItem[]
|
||||
aliases?: ProductAliasItem[]
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user