提交
This commit is contained in:
1 parent
16986f443e
commit
63a1209620
83 files changed
+1083168
-11413
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<SystemViewDialog
|
||||
v-model:visible="innerVisible"
|
||||
title="查看关联数据"
|
||||
title="查看出入库单"
|
||||
:icon="Link"
|
||||
:sections="sections"
|
||||
:loading="loading"
|
||||
@@ -22,12 +22,13 @@
|
||||
import { computed } from 'vue'
|
||||
import { Link } from '@element-plus/icons-vue'
|
||||
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
|
||||
import type { InventoryRelatedData } from '@/api/db/inventory'
|
||||
import type { InventoryRecord, InventoryRelatedData } from '@/api/db/inventory'
|
||||
import { buildInventoryRelatedSections } from '@/components/business/db/db-related-view'
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
loading?: boolean
|
||||
inventory?: InventoryRecord | null
|
||||
data: InventoryRelatedData
|
||||
}>()
|
||||
|
||||
@@ -40,5 +41,5 @@
|
||||
set: (val) => emit('update:visible', val)
|
||||
})
|
||||
|
||||
const sections = computed(() => buildInventoryRelatedSections(props.data))
|
||||
const sections = computed(() => buildInventoryRelatedSections(props.data, props.inventory))
|
||||
</script>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<SystemViewDialog
|
||||
v-model:visible="innerVisible"
|
||||
title="查看关联数据"
|
||||
title="查看计划"
|
||||
:icon="Link"
|
||||
:sections="sections"
|
||||
:loading="loading"
|
||||
@@ -22,12 +22,13 @@
|
||||
import { computed } from 'vue'
|
||||
import { Link } from '@element-plus/icons-vue'
|
||||
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
|
||||
import type { PlanRelatedData } from '@/api/db/plans'
|
||||
import type { Plan, PlanRelatedData } from '@/api/db/plans'
|
||||
import { buildPlanRelatedSections } from '@/components/business/db/db-related-view'
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
loading?: boolean
|
||||
plan?: Plan | null
|
||||
data: PlanRelatedData
|
||||
}>()
|
||||
|
||||
@@ -40,5 +41,5 @@
|
||||
set: (val) => emit('update:visible', val)
|
||||
})
|
||||
|
||||
const sections = computed(() => buildPlanRelatedSections(props.data))
|
||||
const sections = computed(() => buildPlanRelatedSections(props.data, props.plan))
|
||||
</script>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<SystemViewDialog
|
||||
v-model:visible="innerVisible"
|
||||
title="查看关联数据"
|
||||
title="查看地磅单"
|
||||
:icon="Link"
|
||||
:sections="sections"
|
||||
:loading="loading"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Plan, PlanInventoryRecord, PlanRelatedData, PlanWeighingRecord } from '@/api/db/plans'
|
||||
import type { InventoryRecord, InventoryRelatedData, InventoryWeighingRecord } from '@/api/db/inventory'
|
||||
import type { WeighingRelatedData } from '@/api/db/weighing'
|
||||
import type { WeighingRecord, WeighingRelatedData } from '@/api/db/weighing'
|
||||
import type { TagType, ViewField, ViewSection } from '@/components/business/system-view-dialog/index.vue'
|
||||
|
||||
export function businessTypeTagType(businessType: string): TagType {
|
||||
@@ -85,7 +85,7 @@ export function buildInventoryViewSection(
|
||||
}
|
||||
|
||||
export function buildWeighingViewSection(
|
||||
record: PlanWeighingRecord | InventoryWeighingRecord,
|
||||
record: PlanWeighingRecord | InventoryWeighingRecord | WeighingRecord,
|
||||
title = '地磅单'
|
||||
): ViewSection {
|
||||
const fields: ViewField[] = [
|
||||
@@ -161,17 +161,22 @@ function mergePlanRelatedItems(data: PlanRelatedData): MergedPlanRelatedItem[] {
|
||||
})
|
||||
}
|
||||
|
||||
export function buildPlanRelatedSections(data: PlanRelatedData): ViewSection[] {
|
||||
export function buildPlanRelatedSections(
|
||||
data: PlanRelatedData,
|
||||
plan?: Plan | null
|
||||
): ViewSection[] {
|
||||
const sections: ViewSection[] = []
|
||||
if (plan) sections.push(buildPlanViewSection(plan))
|
||||
|
||||
const items = mergePlanRelatedItems(data)
|
||||
if (!items.length) {
|
||||
return [
|
||||
{
|
||||
title: '关联数据',
|
||||
fieldLayout: 'table',
|
||||
tableMode: 'triple',
|
||||
fields: [{ label: '说明', value: '暂无关联数据', span: 'full' }]
|
||||
}
|
||||
]
|
||||
sections.push({
|
||||
title: '关联数据',
|
||||
fieldLayout: 'table',
|
||||
tableMode: 'triple',
|
||||
fields: [{ label: '说明', value: '暂无关联数据', span: 'full' }]
|
||||
})
|
||||
return sections
|
||||
}
|
||||
|
||||
const inventoryCount = items.filter((item) => item.type === 'inventory').length
|
||||
@@ -179,48 +184,55 @@ export function buildPlanRelatedSections(data: PlanRelatedData): ViewSection[] {
|
||||
let inventoryIndex = 0
|
||||
let weighingIndex = 0
|
||||
|
||||
return items.map((item) => {
|
||||
items.forEach((item) => {
|
||||
if (item.type === 'inventory') {
|
||||
const title = sectionTitle('出入库单', inventoryIndex, inventoryCount)
|
||||
inventoryIndex += 1
|
||||
return buildInventoryViewSection(item, title)
|
||||
sections.push(buildInventoryViewSection(item, title))
|
||||
return
|
||||
}
|
||||
const title = sectionTitle('地磅单', weighingIndex, weighingCount)
|
||||
weighingIndex += 1
|
||||
return buildWeighingViewSection(item, title)
|
||||
sections.push(buildWeighingViewSection(item, title))
|
||||
})
|
||||
|
||||
return sections
|
||||
}
|
||||
|
||||
export function buildInventoryRelatedSections(data: InventoryRelatedData): ViewSection[] {
|
||||
export function buildInventoryRelatedSections(
|
||||
data: InventoryRelatedData,
|
||||
inventory?: InventoryRecord | null
|
||||
): ViewSection[] {
|
||||
const sections: ViewSection[] = []
|
||||
if (inventory) sections.push(buildInventoryViewSection(inventory))
|
||||
if (data.plan) sections.push(buildPlanViewSection(data.plan))
|
||||
if (data.weighing) sections.push(buildWeighingViewSection(data.weighing))
|
||||
if (!sections.length) {
|
||||
return [
|
||||
{
|
||||
title: '关联数据',
|
||||
fieldLayout: 'table',
|
||||
tableMode: 'triple',
|
||||
fields: [{ label: '说明', value: '暂无关联数据', span: 'full' }]
|
||||
}
|
||||
]
|
||||
if (!data.plan && !data.weighing) {
|
||||
sections.push({
|
||||
title: '关联数据',
|
||||
fieldLayout: 'table',
|
||||
tableMode: 'triple',
|
||||
fields: [{ label: '说明', value: '暂无关联数据', span: 'full' }]
|
||||
})
|
||||
}
|
||||
return sections
|
||||
}
|
||||
|
||||
export function buildWeighingRelatedSections(data: WeighingRelatedData): ViewSection[] {
|
||||
export function buildWeighingRelatedSections(
|
||||
data: WeighingRelatedData,
|
||||
weighing?: WeighingRecord | null
|
||||
): ViewSection[] {
|
||||
const sections: ViewSection[] = []
|
||||
if (weighing) sections.push(buildWeighingViewSection(weighing))
|
||||
if (data.plan) sections.push(buildPlanViewSection(data.plan))
|
||||
if (data.inventory) sections.push(buildInventoryViewSection(data.inventory))
|
||||
if (!sections.length) {
|
||||
return [
|
||||
{
|
||||
title: '关联数据',
|
||||
fieldLayout: 'table',
|
||||
tableMode: 'triple',
|
||||
fields: [{ label: '说明', value: '暂无关联数据', span: 'full' }]
|
||||
}
|
||||
]
|
||||
if (!data.plan && !data.inventory) {
|
||||
sections.push({
|
||||
title: '关联数据',
|
||||
fieldLayout: 'table',
|
||||
tableMode: 'triple',
|
||||
fields: [{ label: '说明', value: '暂无关联数据', span: 'full' }]
|
||||
})
|
||||
}
|
||||
return sections
|
||||
}
|
||||
@@ -39,17 +39,23 @@
|
||||
<PlPlanStopsSplitShell :show-balance="false">
|
||||
<template #load>
|
||||
<PlPlanArchiveSegmentBlock
|
||||
ref="loadSegmentRef"
|
||||
stop-type="load"
|
||||
:meta="loadArchiveMeta"
|
||||
:view-products="loadViewProducts"
|
||||
:products="loadProductRows"
|
||||
archive-mode="inbound"
|
||||
:show-stop-feedback="showStopFeedback"
|
||||
editable-attachments
|
||||
:generate-dibang="plan.load?.generateDibang"
|
||||
:dibang-rows="loadDibangRows"
|
||||
:driver-feedback="resolveDriverStopFeedback('load', loadStopId)"
|
||||
:site-feedback="resolveSiteStopFeedback('load', loadStopId)"
|
||||
:fallback-remark="transport?.feedbackRemark"
|
||||
:driver-attachment-urls="getFeedbackAttachmentCsv('load', loadStopId, 'driver')"
|
||||
:site-attachment-urls="getFeedbackAttachmentCsv('load', loadStopId, 'site')"
|
||||
@update:driver-attachment-urls="setFeedbackAttachmentCsv('load', loadStopId, 'driver', $event)"
|
||||
@update:site-attachment-urls="setFeedbackAttachmentCsv('load', loadStopId, 'site', $event)"
|
||||
/>
|
||||
</template>
|
||||
<template #delivery>
|
||||
@@ -72,18 +78,28 @@
|
||||
class="pl-plan-view-delivery-block"
|
||||
>
|
||||
<PlPlanArchiveSegmentBlock
|
||||
:ref="(el) => setDeliverySegmentRef(index, el)"
|
||||
stop-type="delivery"
|
||||
:meta="block.meta"
|
||||
:view-products="getDeliveryViewProducts(index)"
|
||||
:products="block.products"
|
||||
archive-mode="outbound"
|
||||
:show-stop-feedback="showStopFeedback"
|
||||
editable-attachments
|
||||
:feedback-stop-label="deliveryBlocks.length > 1 ? `送货 #${index + 1}` : '送货'"
|
||||
:generate-dibang="plan.deliveries?.[index]?.generateDibang"
|
||||
:dibang-rows="resolveDeliveryDibangRows(index)"
|
||||
:driver-feedback="resolveDriverStopFeedback('delivery', block.stopId)"
|
||||
:site-feedback="resolveSiteStopFeedback('delivery', block.stopId)"
|
||||
:fallback-remark="transport?.feedbackRemark"
|
||||
:driver-attachment-urls="getFeedbackAttachmentCsv('delivery', block.stopId, 'driver')"
|
||||
:site-attachment-urls="getFeedbackAttachmentCsv('delivery', block.stopId, 'site')"
|
||||
@update:driver-attachment-urls="
|
||||
setFeedbackAttachmentCsv('delivery', block.stopId, 'driver', $event)
|
||||
"
|
||||
@update:site-attachment-urls="
|
||||
setFeedbackAttachmentCsv('delivery', block.stopId, 'site', $event)
|
||||
"
|
||||
/>
|
||||
</article>
|
||||
</template>
|
||||
@@ -194,6 +210,13 @@
|
||||
<el-button @click="innerVisible = false">
|
||||
<el-icon><Close /></el-icon>取消
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="!isAdjustMode"
|
||||
:loading="draftLoading"
|
||||
@click="handleSaveDraft"
|
||||
>
|
||||
<el-icon><Document /></el-icon>暂存
|
||||
</el-button>
|
||||
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">
|
||||
<el-icon><Check /></el-icon>{{ submitLabel }}
|
||||
</el-button>
|
||||
@@ -203,7 +226,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Check, Close } from '@element-plus/icons-vue'
|
||||
import { Check, Close, Document } from '@element-plus/icons-vue'
|
||||
import { fetchProductDetail, type ProductDetail } from '@/api/crm/product'
|
||||
import {
|
||||
inboundOrderApi,
|
||||
@@ -211,6 +234,8 @@
|
||||
planApi,
|
||||
type Plan,
|
||||
type PlanArchiveBody,
|
||||
type PlanArchiveFeedbacksBlock,
|
||||
type PlanArchiveStopFeedbackAttachmentItem,
|
||||
type PlanDelivery,
|
||||
type PlanProduct,
|
||||
type PlanStopProduct,
|
||||
@@ -244,6 +269,7 @@
|
||||
resolveStopProductsForView,
|
||||
type PlanStopProductFormRow
|
||||
} from '@/utils/pl-plan-stop-form'
|
||||
import { isPlInternalCustomerName } from '@/utils/pl-internal-customer'
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
@@ -262,6 +288,7 @@
|
||||
|
||||
const loading = ref(false)
|
||||
const submitLoading = ref(false)
|
||||
const draftLoading = ref(false)
|
||||
const activeTab = ref<'archive' | 'overview'>('archive')
|
||||
const tabsRef = ref<InstanceType<typeof PlPlanViewTabs> | null>(null)
|
||||
const vehicleViewVisible = ref(false)
|
||||
@@ -287,6 +314,9 @@
|
||||
}>
|
||||
>([])
|
||||
const archiveDeliveryTabIndex = ref(0)
|
||||
const loadSegmentRef = ref<InstanceType<typeof PlPlanArchiveSegmentBlock> | null>(null)
|
||||
const deliverySegmentRefs = ref<Array<InstanceType<typeof PlPlanArchiveSegmentBlock> | null>>([])
|
||||
const feedbackAttachmentEdits = reactive<Record<string, string>>({})
|
||||
const canSubmitStopArchive = computed(
|
||||
() =>
|
||||
Boolean(plan.value.load?.id) &&
|
||||
@@ -395,7 +425,7 @@
|
||||
function getDeliveryViewProducts(index: number): PlanStopProductFormRow[] {
|
||||
const delivery = plan.value?.deliveries?.[index]
|
||||
if (delivery) {
|
||||
const mapped = mapDeliveriesFromApi([delivery], plan.value?.load?.customerName)[0]
|
||||
const mapped = mapDeliveriesFromApi([delivery])[0]
|
||||
return resolveStopProductsForView(mapped.products, productRows.value)
|
||||
}
|
||||
const legacy = mapLegacyPlanToStops(plan.value || ({} as Plan)).deliveries[index]
|
||||
@@ -455,8 +485,139 @@
|
||||
)
|
||||
}
|
||||
|
||||
type FeedbackAttachmentKind = 'driver' | 'site'
|
||||
|
||||
function feedbackAttachmentKey(
|
||||
stopType: 'load' | 'delivery',
|
||||
stopId: string,
|
||||
kind: FeedbackAttachmentKind
|
||||
) {
|
||||
return `${stopType}:${stopId}:${kind}`
|
||||
}
|
||||
|
||||
function parseAttachmentCsv(csv: string) {
|
||||
return csv
|
||||
.split(',')
|
||||
.map((item) => item.trim())
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
||||
function resolveFeedbackAttachmentCsv(
|
||||
stopType: 'load' | 'delivery',
|
||||
stopId: string,
|
||||
kind: FeedbackAttachmentKind
|
||||
) {
|
||||
const feedback =
|
||||
kind === 'driver'
|
||||
? resolveDriverStopFeedback(stopType, stopId)
|
||||
: resolveSiteStopFeedback(stopType, stopId)
|
||||
return (feedback?.attachmentUrls || []).join(',')
|
||||
}
|
||||
|
||||
function initFeedbackAttachmentEdits() {
|
||||
Object.keys(feedbackAttachmentEdits).forEach((key) => {
|
||||
delete feedbackAttachmentEdits[key]
|
||||
})
|
||||
|
||||
const loadId = loadStopId.value
|
||||
if (loadId) {
|
||||
feedbackAttachmentEdits[feedbackAttachmentKey('load', loadId, 'driver')] =
|
||||
resolveFeedbackAttachmentCsv('load', loadId, 'driver')
|
||||
if (shouldCollectSiteFeedbackAttachments('load', loadId)) {
|
||||
feedbackAttachmentEdits[feedbackAttachmentKey('load', loadId, 'site')] =
|
||||
resolveFeedbackAttachmentCsv('load', loadId, 'site')
|
||||
}
|
||||
}
|
||||
|
||||
deliveryBlocks.value.forEach((block) => {
|
||||
if (!block.stopId) return
|
||||
feedbackAttachmentEdits[feedbackAttachmentKey('delivery', block.stopId, 'driver')] =
|
||||
resolveFeedbackAttachmentCsv('delivery', block.stopId, 'driver')
|
||||
if (shouldCollectSiteFeedbackAttachments('delivery', block.stopId)) {
|
||||
feedbackAttachmentEdits[feedbackAttachmentKey('delivery', block.stopId, 'site')] =
|
||||
resolveFeedbackAttachmentCsv('delivery', block.stopId, 'site')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function shouldCollectSiteFeedbackAttachments(
|
||||
stopType: 'load' | 'delivery',
|
||||
stopId: string
|
||||
) {
|
||||
if (!stopId) return false
|
||||
const customerName =
|
||||
stopType === 'load'
|
||||
? loadArchiveMeta.value.customerName
|
||||
: deliveryBlocks.value.find((block) => block.stopId === stopId)?.customerName
|
||||
return isPlInternalCustomerName(customerName)
|
||||
}
|
||||
|
||||
function getFeedbackAttachmentCsv(
|
||||
stopType: 'load' | 'delivery',
|
||||
stopId: string,
|
||||
kind: FeedbackAttachmentKind
|
||||
) {
|
||||
if (!stopId) return ''
|
||||
const key = feedbackAttachmentKey(stopType, stopId, kind)
|
||||
if (key in feedbackAttachmentEdits) {
|
||||
return feedbackAttachmentEdits[key]
|
||||
}
|
||||
return resolveFeedbackAttachmentCsv(stopType, stopId, kind)
|
||||
}
|
||||
|
||||
function setFeedbackAttachmentCsv(
|
||||
stopType: 'load' | 'delivery',
|
||||
stopId: string,
|
||||
kind: FeedbackAttachmentKind,
|
||||
csv: string
|
||||
) {
|
||||
if (!stopId) return
|
||||
feedbackAttachmentEdits[feedbackAttachmentKey(stopType, stopId, kind)] = csv
|
||||
}
|
||||
|
||||
function setDeliverySegmentRef(index: number, el: unknown) {
|
||||
deliverySegmentRefs.value[index] = (el as InstanceType<typeof PlPlanArchiveSegmentBlock>) || null
|
||||
}
|
||||
|
||||
function hasFeedbackAttachmentUploading() {
|
||||
const refs = [loadSegmentRef.value, ...deliverySegmentRefs.value].filter(Boolean)
|
||||
return refs.some((refItem) => refItem?.hasAttachmentUploading?.())
|
||||
}
|
||||
|
||||
function collectFeedbackAttachmentsForSubmit(): PlanArchiveFeedbacksBlock {
|
||||
const driverStops: PlanArchiveStopFeedbackAttachmentItem[] = []
|
||||
const siteStops: PlanArchiveStopFeedbackAttachmentItem[] = []
|
||||
|
||||
const appendStop = (
|
||||
stopType: 'load' | 'delivery',
|
||||
stopId: string,
|
||||
kind: FeedbackAttachmentKind,
|
||||
target: PlanArchiveStopFeedbackAttachmentItem[]
|
||||
) => {
|
||||
if (!stopId) return
|
||||
if (kind === 'site' && !shouldCollectSiteFeedbackAttachments(stopType, stopId)) return
|
||||
target.push({
|
||||
stopType,
|
||||
stopId,
|
||||
attachmentUrls: parseAttachmentCsv(getFeedbackAttachmentCsv(stopType, stopId, kind))
|
||||
})
|
||||
}
|
||||
|
||||
if (loadStopId.value) {
|
||||
appendStop('load', loadStopId.value, 'driver', driverStops)
|
||||
appendStop('load', loadStopId.value, 'site', siteStops)
|
||||
}
|
||||
|
||||
deliveryBlocks.value.forEach((block) => {
|
||||
appendStop('delivery', block.stopId, 'driver', driverStops)
|
||||
appendStop('delivery', block.stopId, 'site', siteStops)
|
||||
})
|
||||
|
||||
return { driverStops, siteStops }
|
||||
}
|
||||
|
||||
function buildDeliveryArchiveMeta(delivery: PlanDelivery): ArchiveSegmentMeta {
|
||||
const mappedRows = mapDeliveriesFromApi([delivery], plan.value?.load?.customerName)
|
||||
const mappedRows = mapDeliveriesFromApi([delivery])
|
||||
const mapped = mappedRows[0]
|
||||
return {
|
||||
customerId: mapped.customerId,
|
||||
@@ -989,6 +1150,10 @@
|
||||
loadProductRows.value = []
|
||||
deliveryBlocks.value = []
|
||||
archiveDeliveryTabIndex.value = 0
|
||||
deliverySegmentRefs.value = []
|
||||
Object.keys(feedbackAttachmentEdits).forEach((key) => {
|
||||
delete feedbackAttachmentEdits[key]
|
||||
})
|
||||
Object.assign(formData, {
|
||||
hasFreight: 1,
|
||||
distanceKm: null,
|
||||
@@ -1072,6 +1237,7 @@
|
||||
}
|
||||
syncMultiStopBrandActualQty()
|
||||
await applyFreightPrefill(data)
|
||||
initFeedbackAttachmentEdits()
|
||||
} catch (error) {
|
||||
innerVisible.value = false
|
||||
const message = error instanceof Error ? error.message : '加载运输计划失败'
|
||||
@@ -1089,6 +1255,109 @@
|
||||
resetState()
|
||||
}
|
||||
|
||||
function toOptionalNumber(value: unknown): number | undefined {
|
||||
if (value == null || value === '') return undefined
|
||||
const n = Number(value)
|
||||
return Number.isFinite(n) ? n : undefined
|
||||
}
|
||||
|
||||
function buildArchiveBody(options?: { allowEmptyQty?: boolean }): PlanArchiveBody {
|
||||
const allowEmptyQty = options?.allowEmptyQty === true
|
||||
const mapBrandQtys = (row: PlanFormProductRow) =>
|
||||
(row.brandQtyRows || [])
|
||||
.filter((item) => Number(item.qty) > 0)
|
||||
.map((item) => ({
|
||||
brandId: item.brandId,
|
||||
brandName: item.brandName,
|
||||
qty: Number(item.qty),
|
||||
unitPrice:
|
||||
(item as { price?: number }).price != null
|
||||
? Number((item as { price?: number }).price)
|
||||
: undefined
|
||||
}))
|
||||
const brandProducts = collectBrandProductsForSubmit()
|
||||
|
||||
return {
|
||||
load: {
|
||||
stopId: plan.value.load!.id!,
|
||||
products: loadProductRows.value.map((row) => ({
|
||||
id: row.id!,
|
||||
inboundQty: allowEmptyQty
|
||||
? toOptionalNumber(row.inboundQty)
|
||||
: Number(row.inboundQty ?? 0),
|
||||
inboundPrice: row.inboundPrice != null ? Number(row.inboundPrice) : undefined,
|
||||
brandQtys: mapBrandQtys(row)
|
||||
}))
|
||||
},
|
||||
deliveries: deliveryBlocks.value.map((block) => ({
|
||||
stopId: block.stopId,
|
||||
products: block.products.map((row) => ({
|
||||
id: row.id!,
|
||||
outboundQty: allowEmptyQty
|
||||
? toOptionalNumber(row.outboundQty)
|
||||
: Number(row.outboundQty ?? 0),
|
||||
outboundPrice: row.outboundPrice != null ? Number(row.outboundPrice) : undefined,
|
||||
brandQtys: mapBrandQtys(row)
|
||||
}))
|
||||
})),
|
||||
...(brandProducts.length ? { products: brandProducts } : {}),
|
||||
freight: {
|
||||
hasFreight: formData.hasFreight,
|
||||
freightRemark: formData.freightRemark || undefined,
|
||||
...(formData.hasFreight === 1
|
||||
? {
|
||||
distanceKm: formData.distanceKm ?? undefined,
|
||||
freightType: formData.freightType,
|
||||
freightPrice:
|
||||
formData.freightType === 'by_weight'
|
||||
? (freightCalc.freightPrice.value ?? undefined)
|
||||
: undefined,
|
||||
freightAmount:
|
||||
freightCalc.calculatedFreight.value ||
|
||||
freightCalc.freightAmount.value ||
|
||||
undefined,
|
||||
transportQty:
|
||||
formData.freightType === 'by_weight'
|
||||
? (freightCalc.transportQty.value ?? undefined)
|
||||
: undefined
|
||||
}
|
||||
: {})
|
||||
},
|
||||
...(plan.value.transportId ? { feedbacks: collectFeedbackAttachmentsForSubmit() } : {})
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSaveDraft() {
|
||||
if (isAdjustMode.value) return
|
||||
if (!canSubmitStopArchive.value) {
|
||||
ElMessage.warning('缺少装货/送货段数据,请先完成运输安排后再暂存')
|
||||
return
|
||||
}
|
||||
if (hasFeedbackAttachmentUploading()) {
|
||||
ElMessage.warning('附件正在上传,请稍候再暂存')
|
||||
return
|
||||
}
|
||||
|
||||
syncSegmentBrandTotals(loadProductRows.value, 'inbound')
|
||||
deliveryBlocks.value.forEach((block) => syncSegmentBrandTotals(block.products, 'outbound'))
|
||||
syncMultiStopBrandActualQty()
|
||||
|
||||
draftLoading.value = true
|
||||
try {
|
||||
const body = buildArchiveBody({ allowEmptyQty: true })
|
||||
await planApi.archiveDraft(props.planId, body)
|
||||
plan.value.archiveStatus = 'draft'
|
||||
ElMessage.success('已暂存')
|
||||
emit('success')
|
||||
innerVisible.value = false
|
||||
} catch (e: unknown) {
|
||||
const message = e instanceof Error ? e.message : '暂存失败'
|
||||
ElMessage.error(message)
|
||||
} finally {
|
||||
draftLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
if (!canSubmitStopArchive.value) {
|
||||
ElMessage.warning('缺少装货/送货段数据,请先完成运输安排后再归档')
|
||||
@@ -1130,7 +1399,6 @@
|
||||
return
|
||||
}
|
||||
|
||||
const brandProducts = collectBrandProductsForSubmit()
|
||||
if (
|
||||
formData.hasFreight === 1 &&
|
||||
formData.freightType === 'by_weight' &&
|
||||
@@ -1154,73 +1422,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (hasFeedbackAttachmentUploading()) {
|
||||
ElMessage.warning('附件正在上传,请稍候再保存')
|
||||
return
|
||||
}
|
||||
|
||||
submitLoading.value = true
|
||||
try {
|
||||
const body: PlanArchiveBody = {
|
||||
load: {
|
||||
stopId: plan.value.load!.id!,
|
||||
products: loadProductRows.value.map((row) => ({
|
||||
id: row.id!,
|
||||
inboundQty: Number(row.inboundQty ?? 0),
|
||||
inboundPrice: row.inboundPrice != null ? Number(row.inboundPrice) : undefined,
|
||||
brandQtys: (row.brandQtyRows || [])
|
||||
.filter((item) => Number(item.qty) > 0)
|
||||
.map((item) => ({
|
||||
brandId: item.brandId,
|
||||
brandName: item.brandName,
|
||||
qty: Number(item.qty),
|
||||
unitPrice:
|
||||
(item as { price?: number }).price != null
|
||||
? Number((item as { price?: number }).price)
|
||||
: undefined
|
||||
}))
|
||||
}))
|
||||
},
|
||||
deliveries: deliveryBlocks.value.map((block) => ({
|
||||
stopId: block.stopId,
|
||||
products: block.products.map((row) => ({
|
||||
id: row.id!,
|
||||
outboundQty: Number(row.outboundQty ?? 0),
|
||||
outboundPrice: row.outboundPrice != null ? Number(row.outboundPrice) : undefined,
|
||||
brandQtys: (row.brandQtyRows || [])
|
||||
.filter((item) => Number(item.qty) > 0)
|
||||
.map((item) => ({
|
||||
brandId: item.brandId,
|
||||
brandName: item.brandName,
|
||||
qty: Number(item.qty),
|
||||
unitPrice:
|
||||
(item as { price?: number }).price != null
|
||||
? Number((item as { price?: number }).price)
|
||||
: undefined
|
||||
}))
|
||||
}))
|
||||
})),
|
||||
...(brandProducts.length ? { products: brandProducts } : {}),
|
||||
freight: {
|
||||
hasFreight: formData.hasFreight,
|
||||
freightRemark: formData.freightRemark || undefined,
|
||||
...(formData.hasFreight === 1
|
||||
? {
|
||||
distanceKm: formData.distanceKm ?? undefined,
|
||||
freightType: formData.freightType,
|
||||
freightPrice:
|
||||
formData.freightType === 'by_weight'
|
||||
? (freightCalc.freightPrice.value ?? undefined)
|
||||
: undefined,
|
||||
freightAmount:
|
||||
freightCalc.calculatedFreight.value ||
|
||||
freightCalc.freightAmount.value ||
|
||||
undefined,
|
||||
transportQty:
|
||||
formData.freightType === 'by_weight'
|
||||
? (freightCalc.transportQty.value ?? undefined)
|
||||
: undefined
|
||||
}
|
||||
: {})
|
||||
}
|
||||
}
|
||||
|
||||
await planApi.archive(props.planId, body)
|
||||
await planApi.archive(props.planId, buildArchiveBody())
|
||||
ElMessage.success(isAdjustMode.value ? '保存成功' : '归档成功')
|
||||
tabsRef.value?.reload()
|
||||
emit('success')
|
||||
@@ -1409,8 +1618,8 @@
|
||||
|
||||
<style lang="scss">
|
||||
.el-dialog.pl-plan-archive-dialog.dialog-form-layout {
|
||||
width: calc(100vw - 48px) !important;
|
||||
max-width: calc(100vw - 48px);
|
||||
width: min(2000px, calc(100vw - 48px)) !important;
|
||||
max-width: min(2000px, calc(100vw - 48px));
|
||||
max-height: calc(100vh - 48px);
|
||||
}
|
||||
</style>
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
<PlPlanStopFeedbackPanel
|
||||
v-if="showStopFeedback"
|
||||
ref="feedbackPanelRef"
|
||||
:stop-label="feedbackStopLabel"
|
||||
:customer-name="meta.customerName"
|
||||
:generate-dibang="generateDibang"
|
||||
@@ -35,6 +36,11 @@
|
||||
:driver-feedback="driverFeedback"
|
||||
:site-feedback="siteFeedback"
|
||||
:fallback-remark="fallbackRemark"
|
||||
:editable-attachments="editableAttachments"
|
||||
:driver-attachment-urls="driverAttachmentUrls"
|
||||
:site-attachment-urls="siteAttachmentUrls"
|
||||
@update:driver-attachment-urls="emit('update:driverAttachmentUrls', $event)"
|
||||
@update:site-attachment-urls="emit('update:siteAttachmentUrls', $event)"
|
||||
/>
|
||||
|
||||
<section class="pl-archive-segment-form">
|
||||
@@ -169,8 +175,24 @@
|
||||
driverFeedback?: TransportStopFeedback | null
|
||||
siteFeedback?: TransportStopFeedback | null
|
||||
fallbackRemark?: string | null
|
||||
editableAttachments?: boolean
|
||||
driverAttachmentUrls?: string
|
||||
siteAttachmentUrls?: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:driverAttachmentUrls': [value: string]
|
||||
'update:siteAttachmentUrls': [value: string]
|
||||
}>()
|
||||
|
||||
const feedbackPanelRef = ref<InstanceType<typeof PlPlanStopFeedbackPanel> | null>(null)
|
||||
|
||||
function hasAttachmentUploading() {
|
||||
return Boolean(feedbackPanelRef.value?.hasAttachmentUploading?.())
|
||||
}
|
||||
|
||||
defineExpose({ hasAttachmentUploading })
|
||||
|
||||
const dictStore = useDictStore()
|
||||
|
||||
const customerLabel = computed(() => (props.stopType === 'load' ? '装货客户' : '送货客户'))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<el-dialog
|
||||
v-model="visibleProxy"
|
||||
title="上传危化品证书"
|
||||
width="min(960px, calc(100vw - 80px))"
|
||||
width="min(2000px, calc(100vw - 80px))"
|
||||
align-center
|
||||
destroy-on-close
|
||||
append-to-body
|
||||
|
||||
@@ -156,13 +156,16 @@
|
||||
<div class="pl-plan-dibang-row">
|
||||
<el-checkbox
|
||||
:model-value="delivery.generateDibang === 1"
|
||||
:disabled="isDibangLocked"
|
||||
:disabled="isPlInternalCustomerName(delivery.customerName)"
|
||||
@update:model-value="(checked) => handleDibangToggle(index, checked)"
|
||||
>
|
||||
生成地磅单({{ directionLabel(delivery.dibangDirection) }})
|
||||
</el-checkbox>
|
||||
<span v-if="isDibangLocked" class="pl-plan-dibang-row__hint">
|
||||
装货客户为内部客户时默认勾选
|
||||
<span
|
||||
v-if="isPlInternalCustomerName(delivery.customerName)"
|
||||
class="pl-plan-dibang-row__hint"
|
||||
>
|
||||
本段客户为内部客户时默认勾选
|
||||
</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
@@ -208,6 +211,7 @@
|
||||
import PlPlanStopProductTable from '@/components/business/pl-plan-stop-product-table/index.vue'
|
||||
import {
|
||||
createEmptyDeliveryForm,
|
||||
resolveStopDibangDefaults,
|
||||
sumStopProductsPlanQty,
|
||||
type PlanDeliveryForm
|
||||
} from '@/utils/pl-plan-stop-form'
|
||||
@@ -217,7 +221,6 @@
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
modelValue: PlanDeliveryForm[]
|
||||
loadCustomerName?: string
|
||||
tabMode?: boolean
|
||||
readonly?: boolean
|
||||
compactProducts?: boolean
|
||||
@@ -226,7 +229,6 @@
|
||||
showSplitHint?: boolean
|
||||
}>(),
|
||||
{
|
||||
loadCustomerName: '',
|
||||
tabMode: true,
|
||||
readonly: false,
|
||||
compactProducts: true,
|
||||
@@ -252,7 +254,6 @@
|
||||
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,
|
||||
@@ -304,7 +305,7 @@
|
||||
const nextSeq = props.modelValue.length + 1
|
||||
emit('update:modelValue', resequence([
|
||||
...props.modelValue,
|
||||
createEmptyDeliveryForm(nextSeq, props.loadCustomerName)
|
||||
createEmptyDeliveryForm(nextSeq)
|
||||
]))
|
||||
activeIndex.value = props.modelValue.length
|
||||
emit('add-delivery')
|
||||
@@ -313,7 +314,7 @@
|
||||
function removeDelivery(index: number) {
|
||||
const next = props.modelValue.filter((_, i) => i !== index)
|
||||
emit('update:modelValue', resequence(
|
||||
next.length ? next : [createEmptyDeliveryForm(1, props.loadCustomerName)]
|
||||
next.length ? next : [createEmptyDeliveryForm(1)]
|
||||
))
|
||||
if (activeIndex.value >= index && activeIndex.value > 0) {
|
||||
activeIndex.value -= 1
|
||||
@@ -474,10 +475,13 @@
|
||||
(item) => String(item.id) === String(customerId)
|
||||
)
|
||||
const customerName = customer?.customerName || ''
|
||||
const defaults = resolveStopDibangDefaults(customerName, 'delivery')
|
||||
patchDelivery(index, {
|
||||
customerId: String(customerId),
|
||||
customerName,
|
||||
contracts: [],
|
||||
generateDibang: defaults.generateDibang,
|
||||
dibangDirection: defaults.dibangDirection,
|
||||
address: '',
|
||||
lng: null,
|
||||
lat: null,
|
||||
@@ -511,7 +515,8 @@
|
||||
|
||||
function handleDibangToggle(index: number, checked: boolean) {
|
||||
const delivery = props.modelValue[index]
|
||||
const direction = isDibangLocked.value ? 'inbound' : delivery.dibangDirection || 'none'
|
||||
const isInternal = isPlInternalCustomerName(delivery.customerName)
|
||||
const direction = isInternal ? 'inbound' : delivery.dibangDirection || 'none'
|
||||
patchDelivery(index, {
|
||||
generateDibang: checked ? 1 : 0,
|
||||
dibangDirection: checked ? direction : 'none'
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
>
|
||||
<template #error>
|
||||
<div class="pl-plan-document-attachment-cell__placeholder is-clickable is-common-thumb">
|
||||
<el-icon :size="16" color="#10b981"><Picture /></el-icon>
|
||||
<el-icon :size="18" color="#10b981"><Picture /></el-icon>
|
||||
</div>
|
||||
</template>
|
||||
</el-image>
|
||||
@@ -31,7 +31,7 @@
|
||||
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'">
|
||||
<el-icon :size="18" :color="usePlaceholderThumb ? '#10b981' : item.isPdf ? '#0284c7' : '#10b981'">
|
||||
<Picture v-if="usePlaceholderThumb || item.isImage" />
|
||||
<Document v-else />
|
||||
</el-icon>
|
||||
@@ -185,7 +185,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 56px;
|
||||
width: 72px;
|
||||
}
|
||||
|
||||
.pl-plan-document-attachment-cell__thumb {
|
||||
@@ -193,11 +193,11 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 56px;
|
||||
height: 40px;
|
||||
width: 72px;
|
||||
height: 52px;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--border, #d9e8e2);
|
||||
border-radius: 6px;
|
||||
border-radius: 8px;
|
||||
background: var(--table-head, #f8fafc);
|
||||
}
|
||||
|
||||
@@ -237,24 +237,24 @@
|
||||
|
||||
.pl-plan-document-attachment-cell__ext {
|
||||
margin-top: 2px;
|
||||
font-size: 9px;
|
||||
font-size: 10px;
|
||||
line-height: 1;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pl-plan-document-attachment-cell__download {
|
||||
position: absolute;
|
||||
right: 1px;
|
||||
top: 1px;
|
||||
right: 2px;
|
||||
top: 2px;
|
||||
z-index: 2;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 50%;
|
||||
background: #fff;
|
||||
border: 1px solid #e2e8f0;
|
||||
color: #1e293b;
|
||||
cursor: pointer;
|
||||
font-size: 10px;
|
||||
font-size: 11px;
|
||||
|
||||
&:hover {
|
||||
color: #1ca851;
|
||||
@@ -268,10 +268,10 @@
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
padding: 1px 2px;
|
||||
padding: 2px 3px;
|
||||
background: rgba(15, 23, 42, 0.62);
|
||||
color: #fff;
|
||||
font-size: 10px;
|
||||
font-size: 11px;
|
||||
line-height: 1.2;
|
||||
text-align: center;
|
||||
word-break: keep-all;
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
<el-option
|
||||
v-for="item in vehicleList"
|
||||
:key="item.id"
|
||||
:label="item.licensePlate"
|
||||
:label="formatPlVehiclePlateOptionLabel(item.licensePlate, item.trailerNo)"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
@@ -226,7 +226,6 @@
|
||||
<PlPlanDeliverySection
|
||||
ref="deliverySectionRef"
|
||||
v-model="deliveryForms"
|
||||
:load-customer-name="loadForm.customerName"
|
||||
tab-mode
|
||||
compact-products
|
||||
:qty-unit-label="planQtyUnitLabel"
|
||||
@@ -365,7 +364,6 @@
|
||||
mergePlanProductsFromLoadMirror,
|
||||
sumStopProductsPlanQty,
|
||||
syncDeliveriesProductsFromLoad,
|
||||
syncDeliveryDibangFromLoad,
|
||||
type PlanDeliveryForm,
|
||||
type PlanLoadForm
|
||||
} from '@/utils/pl-plan-stop-form'
|
||||
@@ -377,6 +375,7 @@
|
||||
initLineBrandMetaFromProduct,
|
||||
prepareLineAliasAndBrandForSubmit
|
||||
} from '@/utils/crm-product-brand'
|
||||
import { formatPlVehiclePlateOptionLabel } from '@/utils/pl-display'
|
||||
import {
|
||||
buildMissingHazardCertReadyMessage,
|
||||
enrichPlanProductsHazardFromCrm
|
||||
@@ -948,7 +947,7 @@
|
||||
stopFormsReady.value = false
|
||||
if (data.load || data.deliveries?.length) {
|
||||
loadForm.value = mapLoadFromApi(data.load)
|
||||
deliveryForms.value = mapDeliveriesFromApi(data.deliveries, data.load?.customerName)
|
||||
deliveryForms.value = mapDeliveriesFromApi(data.deliveries)
|
||||
} else {
|
||||
const legacy = mapLegacyPlanToStops(data)
|
||||
loadForm.value = legacy.load
|
||||
@@ -995,14 +994,6 @@
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
watch(
|
||||
() => loadForm.value.customerName,
|
||||
(loadCustomerName) => {
|
||||
if (!stopFormsReady.value) return
|
||||
deliveryForms.value = syncDeliveryDibangFromLoad(deliveryForms.value, loadCustomerName)
|
||||
}
|
||||
)
|
||||
|
||||
function openCustomerSelector(side: CustomerSide, deliveryIndex = 0) {
|
||||
customerSelectorSide.value = side
|
||||
customerSelectorDeliveryIndex.value = deliveryIndex
|
||||
@@ -1691,27 +1682,29 @@
|
||||
}
|
||||
|
||||
async function handleSubmit(mode: 'save' | 'saveAndArrange' | 'rearrange' = 'save') {
|
||||
// 必须在 await validate 之前置位,避免连点并发多次 createFull
|
||||
if (submitLoading.value) return
|
||||
const valid = await basicFormRef.value?.validate().catch(() => false)
|
||||
if (!valid || !validateBusinessRules()) return
|
||||
|
||||
if (mode === 'saveAndArrange' || mode === 'rearrange') {
|
||||
const missing = getArrangePrerequisiteGaps()
|
||||
if (missing.length) {
|
||||
ElMessage.warning(`安排运输前请先填写:${missing.join('、')}`)
|
||||
return
|
||||
}
|
||||
if (!formData.vehicleId) {
|
||||
ElMessage.warning('安排运输前请选择车辆')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
submitLoading.value = true
|
||||
try {
|
||||
const valid = await basicFormRef.value?.validate().catch(() => false)
|
||||
if (!valid || !validateBusinessRules()) return
|
||||
|
||||
if (mode === 'saveAndArrange' || mode === 'rearrange') {
|
||||
const missing = getArrangePrerequisiteGaps()
|
||||
if (missing.length) {
|
||||
ElMessage.warning(`安排运输前请先填写:${missing.join('、')}`)
|
||||
return
|
||||
}
|
||||
if (!formData.vehicleId) {
|
||||
ElMessage.warning('安排运输前请选择车辆')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
mirrorPlanProductsFromLoad()
|
||||
const commonPayload = buildPlanCommonPayload({ allowClearTransport: isEdit.value })
|
||||
let planId = props.planId || ''
|
||||
const wasCreate = !isEdit.value
|
||||
|
||||
if (isEdit.value) {
|
||||
if (!props.planId) return
|
||||
@@ -1741,6 +1734,15 @@
|
||||
if ((mode === 'saveAndArrange' || mode === 'rearrange') && planId) {
|
||||
const arranged = await performArrangeAfterSave(planId)
|
||||
if (!arranged) {
|
||||
// 计划已落库;关闭新建窗,避免停留在创建态再次点击又生成一张
|
||||
if (wasCreate) {
|
||||
ElMessage.warning(
|
||||
'计划已创建成功,但未能安排运输。请至列表查看;若因危化证未就绪,请先完成【危化品证上传】后再安排。'
|
||||
)
|
||||
} else {
|
||||
ElMessage.warning('计划已保存,但未能安排运输。请稍后在列表中重试安排。')
|
||||
}
|
||||
innerVisible.value = false
|
||||
emit('success', { planId, arranged: false })
|
||||
}
|
||||
return
|
||||
@@ -1771,7 +1773,7 @@
|
||||
|
||||
.pl-plan-transport-row--three {
|
||||
display: grid;
|
||||
grid-template-columns: max-content minmax(360px, 520px) minmax(280px, 1fr);
|
||||
grid-template-columns: max-content minmax(240px, 340px) minmax(280px, 1fr);
|
||||
gap: 12px 16px;
|
||||
}
|
||||
|
||||
@@ -1782,7 +1784,7 @@
|
||||
|
||||
.pl-plan-transport-row__driver {
|
||||
min-width: 0;
|
||||
max-width: 520px;
|
||||
max-width: 340px;
|
||||
}
|
||||
|
||||
.pl-plan-transport-row__carrier {
|
||||
@@ -1798,8 +1800,8 @@
|
||||
}
|
||||
|
||||
.pl-plan-vehicle-with-library__select {
|
||||
flex: 0 0 140px;
|
||||
width: 140px;
|
||||
flex: 0 0 220px;
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.pl-plan-carrier-with-library__select {
|
||||
@@ -2149,12 +2151,22 @@
|
||||
|
||||
<style lang="scss">
|
||||
.el-dialog.pl-plan-form-dialog.dialog-form-layout {
|
||||
width: 100% !important;
|
||||
max-width: calc(100vw - 48px);
|
||||
width: min(2000px, calc(100vw - 32px)) !important;
|
||||
max-width: min(2000px, calc(100vw - 32px));
|
||||
height: var(--dialog-max-height, calc(100vh - 40px));
|
||||
max-height: var(--dialog-max-height, calc(100vh - 40px));
|
||||
}
|
||||
|
||||
.el-dialog.pl-plan-form-dialog.dialog-form-layout .el-dialog__body {
|
||||
max-height: calc(100vh - 120px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
max-height: none;
|
||||
}
|
||||
|
||||
.el-dialog.pl-plan-form-dialog.dialog-form-layout .pl-plan-form-body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -109,7 +109,7 @@
|
||||
>
|
||||
生成地磅单({{ dibangDirectionLabel }})
|
||||
</el-checkbox>
|
||||
<span v-if="isInternal" class="pl-plan-dibang-row__hint">装货客户为内部客户时默认勾选</span>
|
||||
<span v-if="isInternal" class="pl-plan-dibang-row__hint">本段客户为内部客户时默认勾选</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,10 @@
|
||||
formatFeedbackTime(driverFeedback.feedbackTime)
|
||||
}}</span>
|
||||
</div>
|
||||
<p v-if="!hasDriverFeedback" class="pl-plan-form-empty-hint pl-stop-feedback-ticket__empty">
|
||||
<p
|
||||
v-if="!hasDriverFeedback && !editableAttachments"
|
||||
class="pl-plan-form-empty-hint pl-stop-feedback-ticket__empty"
|
||||
>
|
||||
暂无司机回传
|
||||
</p>
|
||||
<template v-else>
|
||||
@@ -34,14 +37,17 @@
|
||||
<div class="pl-stop-feedback-ticket__foot">
|
||||
<span class="pl-stop-feedback-ticket__lab">附件</span>
|
||||
<AttachmentUploadField
|
||||
v-if="driverAttachmentCsv"
|
||||
v-if="editableAttachments || driverAttachmentCsv"
|
||||
ref="driverAttachRef"
|
||||
class="pl-stop-feedback-ticket__attach"
|
||||
:model-value="driverAttachmentCsv"
|
||||
disabled
|
||||
:class="{ 'pl-stop-feedback-ticket__attach--editable': editableAttachments }"
|
||||
:model-value="driverAttachmentModel"
|
||||
:disabled="!editableAttachments"
|
||||
compact
|
||||
folder="pl/transport/feedback"
|
||||
accept="image/*,video/*,.pdf"
|
||||
:limit="15"
|
||||
@update:model-value="handleDriverAttachmentChange"
|
||||
/>
|
||||
<span v-else class="pl-plan-form-empty-hint">—</span>
|
||||
</div>
|
||||
@@ -57,7 +63,10 @@
|
||||
formatFeedbackTime(siteFeedback.feedbackTime)
|
||||
}}</span>
|
||||
</div>
|
||||
<p v-if="!hasSiteFeedback" class="pl-plan-form-empty-hint pl-stop-feedback-ticket__empty">
|
||||
<p
|
||||
v-if="!hasSiteFeedback && !editableAttachments"
|
||||
class="pl-plan-form-empty-hint pl-stop-feedback-ticket__empty"
|
||||
>
|
||||
暂无现场回传
|
||||
</p>
|
||||
<template v-else>
|
||||
@@ -111,14 +120,17 @@
|
||||
<div class="pl-stop-feedback-ticket__foot">
|
||||
<span class="pl-stop-feedback-ticket__lab">附件</span>
|
||||
<AttachmentUploadField
|
||||
v-if="siteAttachmentCsv"
|
||||
v-if="editableAttachments || siteAttachmentCsv"
|
||||
ref="siteAttachRef"
|
||||
class="pl-stop-feedback-ticket__attach"
|
||||
:model-value="siteAttachmentCsv"
|
||||
disabled
|
||||
:class="{ 'pl-stop-feedback-ticket__attach--editable': editableAttachments }"
|
||||
:model-value="siteAttachmentModel"
|
||||
:disabled="!editableAttachments"
|
||||
compact
|
||||
folder="pl/transport/site-feedback"
|
||||
accept="image/*,video/*,.pdf"
|
||||
:limit="15"
|
||||
@update:model-value="handleSiteAttachmentChange"
|
||||
/>
|
||||
<span v-else class="pl-plan-form-empty-hint">—</span>
|
||||
</div>
|
||||
@@ -203,7 +215,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { computed, ref } 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'
|
||||
@@ -223,6 +235,10 @@
|
||||
fallbackRemark?: string
|
||||
/** 无回传数据时也展示卡片空态 */
|
||||
showWhenEmpty?: boolean
|
||||
/** 归档弹窗等场景:允许编辑段级回传附件 */
|
||||
editableAttachments?: boolean
|
||||
driverAttachmentUrls?: string
|
||||
siteAttachmentUrls?: string
|
||||
}>(),
|
||||
{
|
||||
stopLabel: '',
|
||||
@@ -232,10 +248,21 @@
|
||||
driverFeedback: null,
|
||||
siteFeedback: null,
|
||||
fallbackRemark: '',
|
||||
showWhenEmpty: true
|
||||
showWhenEmpty: true,
|
||||
editableAttachments: false,
|
||||
driverAttachmentUrls: '',
|
||||
siteAttachmentUrls: ''
|
||||
}
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:driverAttachmentUrls': [value: string]
|
||||
'update:siteAttachmentUrls': [value: string]
|
||||
}>()
|
||||
|
||||
const driverAttachRef = ref<InstanceType<typeof AttachmentUploadField> | null>(null)
|
||||
const siteAttachRef = ref<InstanceType<typeof AttachmentUploadField> | null>(null)
|
||||
|
||||
const isInternalCustomer = computed(() => isPlInternalCustomerName(props.customerName))
|
||||
|
||||
const showSiteCard = computed(() => isInternalCustomer.value)
|
||||
@@ -298,6 +325,44 @@
|
||||
const driverAttachmentCsv = computed(() => (props.driverFeedback?.attachmentUrls || []).join(','))
|
||||
const siteAttachmentCsv = computed(() => (props.siteFeedback?.attachmentUrls || []).join(','))
|
||||
|
||||
const driverAttachmentModel = computed({
|
||||
get: () =>
|
||||
props.editableAttachments ? props.driverAttachmentUrls || '' : driverAttachmentCsv.value,
|
||||
set: (value: string) => {
|
||||
if (props.editableAttachments) {
|
||||
emit('update:driverAttachmentUrls', value)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const siteAttachmentModel = computed({
|
||||
get: () =>
|
||||
props.editableAttachments ? props.siteAttachmentUrls || '' : siteAttachmentCsv.value,
|
||||
set: (value: string) => {
|
||||
if (props.editableAttachments) {
|
||||
emit('update:siteAttachmentUrls', value)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function handleDriverAttachmentChange(value: string) {
|
||||
if (props.editableAttachments) {
|
||||
emit('update:driverAttachmentUrls', value)
|
||||
}
|
||||
}
|
||||
|
||||
function handleSiteAttachmentChange(value: string) {
|
||||
if (props.editableAttachments) {
|
||||
emit('update:siteAttachmentUrls', value)
|
||||
}
|
||||
}
|
||||
|
||||
function hasAttachmentUploading() {
|
||||
return Boolean(driverAttachRef.value?.hasUploading?.() || siteAttachRef.value?.hasUploading?.())
|
||||
}
|
||||
|
||||
defineExpose({ hasAttachmentUploading })
|
||||
|
||||
function formatFeedbackTime(value?: string) {
|
||||
return formatDateTime(value) || '—'
|
||||
}
|
||||
@@ -618,6 +683,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
.pl-stop-feedback-ticket__attach--editable {
|
||||
:deep(.upload-card) {
|
||||
width: 88px;
|
||||
height: 66px;
|
||||
}
|
||||
|
||||
:deep(.attachment-item) {
|
||||
width: 88px;
|
||||
}
|
||||
|
||||
:deep(.attachment-preview) {
|
||||
height: 66px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1280px) {
|
||||
.pl-stop-feedback-cards.is-cols-3 {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
|
||||
@@ -165,8 +165,8 @@
|
||||
|
||||
<style lang="scss">
|
||||
.el-dialog.pl-plan-view-dialog.dialog-form-layout {
|
||||
width: 100% !important;
|
||||
max-width: calc(100vw - 48px);
|
||||
width: min(2000px, calc(100vw - 48px)) !important;
|
||||
max-width: min(2000px, calc(100vw - 48px));
|
||||
height: var(--dialog-max-height, calc(100vh - 40px));
|
||||
max-height: var(--dialog-max-height, calc(100vh - 40px));
|
||||
}
|
||||
|
||||
@@ -1234,7 +1234,7 @@
|
||||
|
||||
const deliveryViews = computed(() => {
|
||||
if (plan.value?.deliveries?.length) {
|
||||
return mapDeliveriesFromApi(plan.value.deliveries, plan.value.load?.customerName).map(
|
||||
return mapDeliveriesFromApi(plan.value.deliveries).map(
|
||||
(row, index) => ({
|
||||
id: plan.value?.deliveries?.[index]?.id,
|
||||
...row,
|
||||
@@ -1512,7 +1512,11 @@
|
||||
money: hasFreight,
|
||||
long: false
|
||||
},
|
||||
{ label: '是否开票', value: hasFreight ? displayHasInvoiceLabel.value : '—', long: false }
|
||||
{ label: '是否开票', value: hasFreight ? displayHasInvoiceLabel.value : '—', long: false },
|
||||
{
|
||||
label: '运费备注',
|
||||
value: hasFreight ? plan.value?.freightRemark?.trim() || '—' : '—'
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
@@ -378,15 +378,19 @@
|
||||
useCommon().refresh()
|
||||
return
|
||||
}
|
||||
// 强制重新加载:先将目标组件从 KeepAlive 缓存中排除
|
||||
store.addKeepAliveExclude(item)
|
||||
// 等待 Vue 处理 exclude 变更、清除缓存后再导航
|
||||
nextTick(() => {
|
||||
router.push({
|
||||
// 切换到已打开的 Tab 时强制刷新。
|
||||
// 说明:仅靠 keepAliveExclude 无效——① openTab 会立刻 removeKeepAliveExclude;
|
||||
// ② KeepAlive 按组件 name 匹配,多数 views/**/index.vue 与路由 name 不一致。
|
||||
router
|
||||
.push({
|
||||
path: item.path,
|
||||
query: item.query as LocationQueryRaw
|
||||
})
|
||||
})
|
||||
.then((failure) => {
|
||||
if (!failure) {
|
||||
useCommon().refresh()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const closeWorktab = (type: TabCloseType, tabPath: string) => {
|
||||
|
||||
Reference in new issue
Block a user