提交
This commit is contained in:
1 parent
f3693be913
commit
3d645b4112
272 files changed
+950716
-27033
No files matched your search
@@ -47,8 +47,7 @@
|
||||
<AttachmentUploadField
|
||||
v-model="item[slot.key]"
|
||||
folder="pl/plan-cert"
|
||||
:limit="1"
|
||||
:hint="`支持图片、PDF 等,上传${slot.label}`"
|
||||
:hint="`支持图片、PDF 等,可上传多个${slot.label}`"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
@@ -112,7 +112,7 @@ withDefaults(
|
||||
}
|
||||
|
||||
:deep(.attachment-list) {
|
||||
gap: 0;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
:deep(.attachment-item) {
|
||||
|
||||
@@ -55,14 +55,14 @@
|
||||
<div
|
||||
class="pl-plan-list-cert-cell__thumb"
|
||||
:class="{
|
||||
'pl-plan-list-cert-cell__thumb--empty': !getProductCertUrl(product, slot.key),
|
||||
'pl-plan-list-cert-cell__thumb--filled': getProductCertUrl(product, slot.key)
|
||||
'pl-plan-list-cert-cell__thumb--empty': !getPrimaryProductCertUrl(product, slot.key),
|
||||
'pl-plan-list-cert-cell__thumb--filled': getPrimaryProductCertUrl(product, slot.key)
|
||||
}"
|
||||
>
|
||||
<template v-if="getProductCertUrl(product, slot.key)">
|
||||
<template v-if="getPrimaryProductCertUrl(product, slot.key)">
|
||||
<img
|
||||
v-if="isCertImageUrl(getProductCertUrl(product, slot.key))"
|
||||
:src="displayCertSrc(getProductCertUrl(product, slot.key))"
|
||||
v-if="isCertImageUrl(getPrimaryProductCertUrl(product, slot.key))"
|
||||
:src="displayCertSrc(getPrimaryProductCertUrl(product, slot.key))"
|
||||
:alt="slot.label"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
@@ -71,7 +71,7 @@
|
||||
v-else
|
||||
class="pl-plan-list-cert-cell__thumb-icon"
|
||||
:class="
|
||||
isCertPdfUrl(getProductCertUrl(product, slot.key))
|
||||
isCertPdfUrl(getPrimaryProductCertUrl(product, slot.key))
|
||||
? 'pl-plan-list-cert-cell__thumb-icon--pdf'
|
||||
: 'pl-plan-list-cert-cell__thumb-icon--doc'
|
||||
"
|
||||
@@ -79,6 +79,12 @@
|
||||
<el-icon :size="20"><Document /></el-icon>
|
||||
</div>
|
||||
<span class="pl-plan-list-cert-cell__cert-caption">{{ slot.label }}</span>
|
||||
<span
|
||||
v-if="getCertUrlCount(product, slot.key) > 1"
|
||||
class="pl-plan-list-cert-cell__cert-count"
|
||||
>
|
||||
{{ getCertUrlCount(product, slot.key) }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-icon :size="18"><Upload /></el-icon>
|
||||
@@ -94,18 +100,16 @@
|
||||
class="pl-plan-list-cert-cell__cert-item"
|
||||
>
|
||||
<div
|
||||
v-if="getProductCertUrl(product, slot.key)"
|
||||
v-if="getPrimaryProductCertUrl(product, slot.key)"
|
||||
class="pl-plan-list-cert-cell__thumb pl-plan-list-cert-cell__thumb--filled"
|
||||
>
|
||||
<el-image
|
||||
v-if="isCertImageUrl(getProductCertUrl(product, slot.key))"
|
||||
v-if="isCertImageUrl(getPrimaryProductCertUrl(product, slot.key))"
|
||||
class="pl-plan-list-cert-cell__image"
|
||||
fit="cover"
|
||||
lazy
|
||||
:src="displayCertSrc(getProductCertUrl(product, slot.key))"
|
||||
:preview-src-list="
|
||||
mediaActive ? [resolveCertFileUrl(getProductCertUrl(product, slot.key))] : []
|
||||
"
|
||||
:src="displayCertSrc(getPrimaryProductCertUrl(product, slot.key))"
|
||||
:preview-src-list="mediaActive ? getCertPreviewSrcList(product, slot.key) : []"
|
||||
preview-teleported
|
||||
hide-on-click-modal
|
||||
>
|
||||
@@ -119,13 +123,19 @@
|
||||
v-else
|
||||
class="pl-plan-list-cert-cell__thumb-icon"
|
||||
:class="
|
||||
isCertPdfUrl(getProductCertUrl(product, slot.key))
|
||||
isCertPdfUrl(getPrimaryProductCertUrl(product, slot.key))
|
||||
? 'pl-plan-list-cert-cell__thumb-icon--pdf'
|
||||
: 'pl-plan-list-cert-cell__thumb-icon--doc'
|
||||
"
|
||||
>
|
||||
<el-icon :size="20"><Document /></el-icon>
|
||||
</div>
|
||||
<span
|
||||
v-if="getCertUrlCount(product, slot.key) > 1"
|
||||
class="pl-plan-list-cert-cell__cert-count"
|
||||
>
|
||||
{{ getCertUrlCount(product, slot.key) }}
|
||||
</span>
|
||||
</div>
|
||||
<span v-else class="pl-plan-list-cert-cell__missing">未上传</span>
|
||||
<span class="pl-plan-list-cert-cell__cert-label">{{ slot.label }}</span>
|
||||
@@ -141,10 +151,13 @@
|
||||
import { Document, Upload } from '@element-plus/icons-vue'
|
||||
import type { PlanProduct } from '@/api/pl'
|
||||
import {
|
||||
getPrimaryProductCertUrl,
|
||||
getProductCertUrl,
|
||||
getRequiredCertSlots,
|
||||
isHazardProduct,
|
||||
isProductCertSlotFilled
|
||||
isProductCertSlotFilled,
|
||||
splitProductCertUrls,
|
||||
type HazardCertSlotKey
|
||||
} from '@/composables/usePlToxicProductCertCheck'
|
||||
|
||||
const props = withDefaults(
|
||||
@@ -217,6 +230,17 @@
|
||||
return /\.pdf(\?|$)/i.test(name) || /\.pdf(\?|$)/i.test(normalized)
|
||||
}
|
||||
|
||||
function getCertUrlCount(product: PlanProduct, key: HazardCertSlotKey) {
|
||||
return splitProductCertUrls(getProductCertUrl(product, key)).length
|
||||
}
|
||||
|
||||
function getCertPreviewSrcList(product: PlanProduct, key: HazardCertSlotKey) {
|
||||
return splitProductCertUrls(getProductCertUrl(product, key))
|
||||
.filter((url) => isCertImageUrl(url))
|
||||
.map((url) => resolveCertFileUrl(url))
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
||||
function handleCertClick() {
|
||||
if (props.clickableDisabled) return
|
||||
emit('click')
|
||||
@@ -336,6 +360,23 @@
|
||||
word-break: keep-all;
|
||||
}
|
||||
|
||||
.pl-plan-list-cert-cell__cert-count {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 4px;
|
||||
z-index: 1;
|
||||
min-width: 18px;
|
||||
height: 18px;
|
||||
padding: 0 5px;
|
||||
border-radius: 999px;
|
||||
background: rgba(15, 23, 42, 0.72);
|
||||
color: #fff;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pl-plan-list-cert-cell__thumb--empty {
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
|
||||
@@ -82,9 +82,9 @@
|
||||
<AttachmentUploadField
|
||||
ref="photoUploadRef"
|
||||
v-model="formData.photoUrls"
|
||||
:limit="1"
|
||||
accept="image/*"
|
||||
folder="pl/vehicle-photo"
|
||||
hint="支持图片,可上传多张;可拖拽或在此区域粘贴上传"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user