This commit is contained in:
zlwu committed 2026-08-09 14:51:41 +08:00
1 parent ca6aca2b14
commit f70dc26206
63 files changed
+589912 -9127

No files matched your search

+105 -68
View File
@@ -26,10 +26,10 @@
/>
</el-select>
</el-form-item>
<el-form-item label="客户名称">
<el-form-item label="需方">
<el-input
v-model="searchForm.customerName"
placeholder="搜索客户名称"
placeholder="搜索需方客户名称"
clearable
@keyup.enter="handleSearch"
/>
@@ -230,15 +230,53 @@
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('customerName')"
prop="customerName"
label="客户名称"
min-width="240"
v-if="isColumnVisible('supplierName')"
prop="supplierName"
label="供方"
min-width="200"
align="left"
header-align="left"
class-name="col-name-wrap"
label-class-name="col-name-wrap"
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('customerName')"
prop="customerName"
label="需方"
min-width="200"
align="left"
header-align="left"
class-name="col-name-wrap"
label-class-name="col-name-wrap"
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('contractSummary')"
label="合同"
min-width="220"
align="left"
header-align="left"
class-name="col-name-wrap"
label-class-name="col-name-wrap"
>
<template #default="{ row }">
<div
v-if="planContractLines(row).length"
class="pl-plan-contract-cell"
>
<div
v-for="(line, index) in planContractLines(row)"
:key="`${line.side}-${line.no}-${index}`"
class="pl-plan-contract-cell__row"
>
<span class="pl-plan-contract-cell__side">{{ line.side }}</span>
<span class="pl-plan-contract-cell__no">{{ line.no }}</span>
</div>
</div>
<span v-else class="pl-plan-contract-cell__empty">—</span>
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('productName')"
label="产品名称"
@@ -454,17 +492,6 @@
>
<el-icon><CircleClose /></el-icon>作废
</el-button>
<el-button
v-if="canDeletePlan(viewingPlan)"
class="btn-ghost"
type="danger"
:disabled="!canDeleteByCreator(viewingPlan)"
:title="getDeletePlanDisabledTitle(viewingPlan)"
:loading="deleteLoading"
@click="handleDelete(viewingPlan)"
>
<el-icon><Delete /></el-icon>删除
</el-button>
</template>
</PlPlanViewDialog>
@@ -486,7 +513,6 @@ import {
Bell,
CircleClose,
CopyDocument,
Delete,
Edit,
Plus,
Printer,
@@ -510,7 +536,6 @@ import PlPlanTypeTabs from '@/components/business/pl-plan-type-tabs/index.vue'
import ListToolbarDateShortcuts from '@/components/core/list-toolbar-date-shortcuts/index.vue'
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
import { useListDateShortcut } from '@/composables/useListDateShortcut'
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
import { canBatchPrintSlip } from '@/utils/pl-batch-print'
import {
canPrintSlipCommand,
@@ -529,7 +554,6 @@ const router = useRouter()
const loading = ref(false)
const voidLoading = ref(false)
const deleteLoading = ref(false)
const waitNoticeLoading = ref(false)
const formDialogVisible = ref(false)
const editingPlanId = ref('')
@@ -548,7 +572,9 @@ const listColumnDefs = [
{ prop: 'followStatus', label: '跟进状态' },
{ prop: 'planDate', label: '计划日期' },
{ prop: 'planType', label: '单据类型' },
{ prop: 'customerName', label: '客户名称' },
{ prop: 'supplierName', label: '供方' },
{ prop: 'customerName', label: '需方' },
{ prop: 'contractSummary', label: '合同' },
{ prop: 'productName', label: '产品名称' },
{ prop: 'productSpec', label: '型号/规格' },
{ prop: 'productPackageSpec', label: '包装规格' },
@@ -582,10 +608,7 @@ async function refreshViewIfOpen() {
await viewDialogRef.value?.reload()
}
function getPlanArrangePrerequisiteGaps(plan: Pick<
Plan,
'createDate' | 'planDate' | 'belongsCompany' | 'planType' | 'followUserId' | 'followUserName'
>): string[] {
function getPlanArrangePrerequisiteGaps(plan: Plan): string[] {
const missing: string[] = []
if (!String(plan.createDate || '').trim()) missing.push('创建日期')
if (!String(plan.planDate || '').trim()) missing.push('计划日期')
@@ -594,6 +617,12 @@ function getPlanArrangePrerequisiteGaps(plan: Pick<
if (!String(plan.followUserId || '').trim() && !String(plan.followUserName || '').trim()) {
missing.push('跟进人')
}
if (!String(plan.supplierId || '').trim() || !String(plan.supplierName || '').trim()) {
missing.push('供方客户')
}
if (!String(plan.customerId || '').trim() || !String(plan.customerName || '').trim()) {
missing.push('需方客户')
}
return missing
}
@@ -670,6 +699,20 @@ function getPlanTypeLabel(type?: string | null) {
return map[type] || type
}
/** 合同列:供/需合同各占一行展示 */
function planContractLines(plan: Plan): Array<{ side: string; no: string }> {
const lines: Array<{ side: string; no: string }> = []
for (const item of plan.supplierContracts || []) {
const no = item.contractNo || item.contractId
if (no) lines.push({ side: '供', no: String(no) })
}
for (const item of plan.demanderContracts || []) {
const no = item.contractNo || item.contractId
if (no) lines.push({ side: '需', no: String(no) })
}
return lines
}
async function fetchData() {
loading.value = true
try {
@@ -801,14 +844,6 @@ function canVoidPlan(row: Plan) {
return row.archiveStatus !== 'archived' && row.followStatus !== 'cancelled'
}
function canDeletePlan(row: Plan) {
return (
(row.followStatus === 'pending_arrange' || row.followStatus === 'wait_notice') &&
row.transportStatus === 'pending' &&
row.archiveStatus !== 'archived'
)
}
function canWaitNotice(row: Plan) {
return (
row.followStatus === 'pending_arrange' &&
@@ -820,12 +855,6 @@ function canCancelWaitNotice(row: Plan) {
return row.followStatus === 'wait_notice' && row.archiveStatus !== 'archived'
}
function getDeletePlanDisabledTitle(row: Plan) {
if (!canDeletePlan(row)) return '只能删除待安排或等通知且未安排运输的计划'
if (!canDeleteByCreator(row)) return CREATOR_DELETE_TIP
return ''
}
function syncViewingPlan(updated: Plan) {
if (viewingPlan.value?.id === updated.id) {
viewingPlan.value = { ...viewingPlan.value, ...updated }
@@ -869,35 +898,6 @@ function handleToolbarWaitNotice() {
handleWaitNotice(selectedPlan.value)
}
async function handleDelete(row: Plan) {
if (!canDeletePlan(row)) {
ElMessage.warning('只能删除待安排或等通知且未安排运输的计划')
return
}
if (!canDeleteByCreator(row)) {
ElMessage.warning(CREATOR_DELETE_TIP)
return
}
await ElMessageBox.confirm('确定删除该运输计划吗?删除后不可恢复。', '删除运输计划', {
type: 'warning'
})
deleteLoading.value = true
try {
await planApi.delete(row.id)
ElMessage.success('删除成功')
if (viewingPlan.value?.id === row.id) {
viewVisible.value = false
viewingPlan.value = null
}
fetchData()
} catch (e) {
const message = e instanceof Error ? e.message : '删除失败'
ElMessage.error(message)
} finally {
deleteLoading.value = false
}
}
async function handleVoid(row: Plan) {
const hint =
row.transportStatus === 'arranged'
@@ -1044,4 +1044,41 @@ async function openArrangeFromQuery() {
font-weight: 700;
}
}
.pl-plan-contract-cell {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 8px;
width: 100%;
text-align: left;
}
.pl-plan-contract-cell__row {
display: flex;
align-items: baseline;
gap: 6px;
width: 100%;
min-width: 0;
font-size: 13px;
line-height: 1.5;
color: var(--text, #1e293b);
}
.pl-plan-contract-cell__side {
flex-shrink: 0;
font-weight: 600;
color: var(--mint-text-muted, #64748b);
}
.pl-plan-contract-cell__no {
min-width: 0;
white-space: normal;
word-break: break-word;
overflow-wrap: anywhere;
}
.pl-plan-contract-cell__empty {
color: var(--mint-text-muted, #64748b);
}
</style>