fix(pl): 证用品类差量复用软删关联,并修正归档用证结转与证面品类展示。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-11-15 18:52:33 +08:00
1 parent 6f20c0ff8a
commit f865d8ed99
19 files changed
+445 -65

No files matched your search

+2
View File
@@ -65,7 +65,9 @@ export interface QuotaCert extends Omit<CertBody, 'status'> {
createTime?: string
certType?: CertType
derivedCategoryIds?: string[]
derivedCategoryNames?: string[]
customerName?: string | null
categoryName?: string | null
}
export interface ScopeProduct {
id?: string
@@ -1604,36 +1604,17 @@
async function showArchiveQuotaBlockDialog(message: string, title = '不能归档') {
const html = `<p class="pl-arrange-block-text">${escapeArchiveBlockText(message)}</p>`
const mode = resolveArchiveQuotaBlockMode(message, title, plan.value)
if (mode !== 'confirm-ready') {
const guide =
mode === 'alert-pending'
? `${html}<p class="pl-arrange-block-text">该运输计划已走证书齐备,归档前须完善证件。请到「证书齐备 → 已标记待完善证书」上传购买证/运输证并执行完善并关闭后再归档。</p>`
: html
await ElMessageBox.alert(guide, title, {
type: 'warning',
confirmButtonText: '知道了',
dangerouslyUseHTMLString: true,
customClass: 'pl-arrange-block-msgbox',
closeOnClickModal: false
}).catch(() => undefined)
return undefined
}
// 仅旧规则(legacy)允许在归档时标记证书齐备以跳过额度
const readyHtml = `${html}<p class="pl-arrange-block-text">如果购买证、运输证还没上传,可以标记证书齐备。仅旧规则计划标记后这次归档不再校验、不扣这两证额度;新规则计划请走「证书齐备 → 已标记待完善证书」。</p>`
try {
await ElMessageBox.confirm(readyHtml, title, {
type: 'warning',
confirmButtonText: '证书齐备',
cancelButtonText: '知道了',
dangerouslyUseHTMLString: true,
customClass: 'pl-arrange-block-msgbox',
closeOnClickModal: false,
distinguishCancelAndClose: true
})
return 'ready' as const
} catch {
return undefined
}
const guide =
mode === 'alert-pending'
? `${html}<p class="pl-arrange-block-text">该运输计划已走证书齐备,归档前须完善证件。请到「证书齐备 → 已标记待完善证书」上传购买证/运输证并执行完善并关闭后再归档。</p>`
: html
await ElMessageBox.alert(guide, title, {
type: 'warning',
confirmButtonText: '知道了',
dangerouslyUseHTMLString: true,
customClass: 'pl-arrange-block-msgbox',
closeOnClickModal: false
}).catch(() => undefined)
}
function applyArchiveOverageHighlight(items: Array<Record<string, unknown>>) {
@@ -1668,13 +1649,7 @@
// 业务异常已作为一次请求提交;补齐条件后允许新尝试,不回放旧异常。
quotaArchiveAttempt = { signature: '', id: '' }
const message = saved.quotaSettlementError
const choice = await showArchiveQuotaBlockDialog(message, '用证没有完成')
if (choice === 'ready' && current()) {
await planApi.markQuotaCertReady(targetId)
if (!current()) return
await submitArchiveWithOverageConfirm(targetId, frozenBody, current, confirmOverage)
return
}
await showArchiveQuotaBlockDialog(message, '用证没有完成')
const error = new Error(message) as Error & { cancelled?: boolean }
error.cancelled = true
throw error
@@ -1,6 +1,6 @@
/** 归档用证拦截弹窗:已齐备/待完善只提醒,未齐备旧规则才可再点证书齐备。 */
/** 归档用证拦截弹窗:只提醒,不在归档界面提供「证书齐备」操作。 */
export type ArchiveQuotaBlockMode = 'alert-pending' | 'alert-plain' | 'confirm-ready'
export type ArchiveQuotaBlockMode = 'alert-pending' | 'alert-plain'
export type ArchiveQuotaBlockPlanFlags = {
quotaCertPendingFulfill?: number | boolean | null
@@ -23,5 +23,5 @@ export function resolveArchiveQuotaBlockMode(
const pendingByPlan = flagOn(plan?.quotaCertPendingFulfill) || flagOn(plan?.quotaCertWaived)
if (title !== '用证没有完成') return 'alert-plain'
if (pendingByPlan || pendingByMessage) return 'alert-pending'
return 'confirm-ready'
return 'alert-plain'
}
@@ -25,6 +25,12 @@
}}</span>
</div>
<div class="mp-wv-card__kv">
<div class="mp-wv-card__kv-row"
><span>系统客户</span><span>{{ row.customerName || '—' }}</span></div
>
<div class="mp-wv-card__kv-row"
><span>证用品类</span><span>{{ certCategoryLabel(row) }}</span></div
>
<div class="mp-wv-card__kv-row"
><span>销售单位</span><span>{{ salePartyName(row) || '—' }}</span></div
>
@@ -119,7 +125,7 @@
} from '@/views/pl/quota-cert/cert-list-face'
import { useDictStore } from '@/store/modules/dict'
import { getProductUnitLabel } from '@/utils/crm-product-display'
import { certStatusLabels } from './face-model'
import { certCategoryLabel, certStatusLabels } from './face-model'
const props = defineProps<{
keyword: string
@@ -1,5 +1,5 @@
<template>
<MpWebviewShell @ready="ready = true">
<MpWebviewShell @ready="onShellReady">
<MpBusinessHeader title="客户用证" back-label="返回运输证件管理" @back="router.back()" />
<main v-if="ready" class="mp-h5-list-content mp-h5-detail-page mp-plan-cert-list">
<p v-if="error" class="mp-wv-empty" role="alert">
@@ -34,11 +34,19 @@
import { useRoute, useRouter } from 'vue-router'
import { fetchGetMenuCodes } from '@/api/auth'
import { quotaStatisticsApi, type CustomerStatistics } from '@/api/pl/quota-cert'
import MpWebviewShell from '@/layouts/MpWebviewShell.vue'
import MpBusinessHeader from '@/components/mp/MpBusinessHeader.vue'
import CustomerCertQuotaTab from '@/views/m/crm/contract/CustomerCertQuotaTab.vue'
import '@/styles/mp-webview.scss'
import './cert-mobile.scss'
const route = useRoute()
const router = useRouter()
const ready = ref(false)
function onShellReady() {
ready.value = true
}
const authReady = ref(false)
const allowed = ref(false)
const loading = ref(true)
@@ -30,6 +30,22 @@ const longFaceKeys = new Set([
export type FaceField = { label: string; value: string; wide?: boolean }
export type FaceGroup = { title: string; fields: FaceField[] }
export function certCategoryLabel(
cert: Pick<QuotaCert, 'certType' | 'categoryName' | 'derivedCategoryNames'> & {
certType?: CertType | null
},
kind?: CertType
) {
const certKind = kind || cert.certType
if (certKind === 'transport') {
const names = (cert.derivedCategoryNames || [])
.map((item) => String(item || '').trim())
.filter(Boolean)
return names.join('、') || '—'
}
return String(cert.categoryName || '').trim() || '—'
}
export function certFaceGroups(
cert: QuotaCert,
kind: CertType,
@@ -51,6 +67,11 @@ export function certFaceGroups(
label: '系统客户',
value: String(cert.customerName || '').trim() || '—',
wide: true
},
{
label: '证用品类',
value: certCategoryLabel(cert, kind),
wide: true
}
)
}
+1 -1
View File
@@ -361,7 +361,7 @@
]
const placeholder = computed(() =>
tab.value === 'contract'
? '合同编号 / 名称 / 销售或购买单位'
? '客户名称 / 编号'
: tab.value === 'plan' || tab.value === 'ready'
? '计划编号 / 供方 / 需方'
: '证件编号 / 品名 / 销售或购买单位'
@@ -1656,7 +1656,7 @@ async function handleArchive(row: Plan) {
ElMessage.warning('无运输计划归档操作权限')
return
}
// 打开归档弹窗:已归档走调整;未归档/已暂存可直接打开(证书齐备仅在「确认归档」时校验,以便支持暂存)
// 打开归档弹窗:已归档走调整;未归档/已暂存可直接打开(用证校验在「确认归档」时执行,以便支持暂存)
archivePlanId.value = row.id
archiveDialogVisible.value = true
}