提交
This commit is contained in:
1 parent
c2cba3e668
commit
2142b33cfa
24 files changed
+4834
-3684
No files matched your search
@@ -9,7 +9,13 @@
|
||||
|
||||
<div v-if="!certList.length" class="cert-empty">{{ emptyHint }}</div>
|
||||
|
||||
<el-table v-else-if="layout === 'table'" :data="certList" stripe class="list-table cert-form-table">
|
||||
<el-table
|
||||
v-else-if="layout === 'table'"
|
||||
:data="certList"
|
||||
stripe
|
||||
class="list-table cert-form-table"
|
||||
:row-class-name="showVehiclePartColumn ? getCertRowClassName : undefined"
|
||||
>
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
v-if="showVehiclePartColumn"
|
||||
@@ -298,6 +304,13 @@ function handleVehiclePartChange(row: CertRowWithKey, value: string) {
|
||||
row.vehiclePart = normalizeVehicleCertPart(value)
|
||||
}
|
||||
|
||||
function getCertRowClassName({ row }: { row: CertRowWithKey }) {
|
||||
if (!props.showVehiclePartColumn) return ''
|
||||
return normalizeVehicleCertPart(row.vehiclePart) === PL_VEHICLE_CERT_PART_TRAILER
|
||||
? 'cert-row-trailer'
|
||||
: 'cert-row-head'
|
||||
}
|
||||
|
||||
const certList = defineModel<CertRowWithKey[]>('modelValue', { default: () => [] })
|
||||
|
||||
watch(
|
||||
@@ -407,6 +420,14 @@ defineExpose({ hasUploading, clearUploadRefs, refreshRequiredSlots })
|
||||
.cert-form-table {
|
||||
border-top: 1px solid var(--mint-border, #d9e8e2);
|
||||
|
||||
:deep(.cert-row-head td.el-table__cell) {
|
||||
background-color: #ecfdf5 !important;
|
||||
}
|
||||
|
||||
:deep(.cert-row-trailer td.el-table__cell) {
|
||||
background-color: #fffbeb !important;
|
||||
}
|
||||
|
||||
:deep(.el-select),
|
||||
:deep(.el-input),
|
||||
:deep(.el-date-editor) {
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<div v-if="badges.length" class="pl-personnel-cert-badges">
|
||||
<el-tooltip
|
||||
v-for="badge in badges"
|
||||
:key="badge.requiredName"
|
||||
:content="badge.title"
|
||||
placement="top"
|
||||
>
|
||||
<span
|
||||
class="pl-personnel-cert-badges__item"
|
||||
:class="`pl-personnel-cert-badges__item--${badge.status}`"
|
||||
>
|
||||
{{ badge.shortLabel }}
|
||||
</span>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import type { CertRead } from '@/api/pl'
|
||||
import { getPersonnelRequiredCertBadges } from '@/utils/pl-personnel-cert'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
personnelType?: string | null
|
||||
certList?: CertRead[]
|
||||
}>(),
|
||||
{
|
||||
personnelType: '',
|
||||
certList: () => []
|
||||
}
|
||||
)
|
||||
|
||||
const badges = computed(() =>
|
||||
getPersonnelRequiredCertBadges(props.personnelType, props.certList || [])
|
||||
)
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-personnel-cert-badges {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.pl-personnel-cert-badges__item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 20px;
|
||||
height: 20px;
|
||||
padding: 0 4px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.pl-personnel-cert-badges__item--missing {
|
||||
background: #f1f5f9;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pl-personnel-cert-badges__item--valid {
|
||||
background: #ecfdf5;
|
||||
color: #059669;
|
||||
}
|
||||
|
||||
.pl-personnel-cert-badges__item--expiring {
|
||||
background: #fffbeb;
|
||||
color: #d97706;
|
||||
}
|
||||
|
||||
.pl-personnel-cert-badges__item--expired {
|
||||
background: #fef2f2;
|
||||
color: #dc2626;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,135 @@
|
||||
<template>
|
||||
<span v-if="badgeGroups.length" class="pl-vehicle-cert-badges">
|
||||
<span class="pl-vehicle-cert-badges__paren">(</span>
|
||||
<template v-for="(group, groupIndex) in badgeGroups" :key="group.key">
|
||||
<span v-if="groupIndex > 0" class="pl-vehicle-cert-badges__divider">|</span>
|
||||
<span class="pl-vehicle-cert-badges__group">
|
||||
<el-tooltip
|
||||
v-for="badge in group.badges"
|
||||
:key="`${group.key}-${badge.requiredName}`"
|
||||
:content="badge.title"
|
||||
placement="top"
|
||||
>
|
||||
<span
|
||||
class="pl-vehicle-cert-badges__item"
|
||||
:class="`pl-vehicle-cert-badges__item--${badge.status}`"
|
||||
>
|
||||
{{ badge.shortLabel }}
|
||||
</span>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
<span class="pl-vehicle-cert-badges__paren">)</span>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import type { CertRead } from '@/api/pl'
|
||||
import {
|
||||
PL_VEHICLE_CERT_PART_HEAD,
|
||||
PL_VEHICLE_CERT_PART_TRAILER,
|
||||
getVehiclePartRequiredCertBadges,
|
||||
type PlVehicleCertCheckType
|
||||
} from '@/utils/pl-vehicle-cert'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
vehicleType?: PlVehicleCertCheckType
|
||||
certList?: CertRead[]
|
||||
trailerNo?: string | null
|
||||
}>(),
|
||||
{
|
||||
vehicleType: 'self',
|
||||
certList: () => [],
|
||||
trailerNo: ''
|
||||
}
|
||||
)
|
||||
|
||||
const hasTrailer = computed(() => Boolean(props.trailerNo?.trim()))
|
||||
|
||||
const badgeGroups = computed(() => {
|
||||
const groups = [
|
||||
{
|
||||
key: PL_VEHICLE_CERT_PART_HEAD,
|
||||
badges: getVehiclePartRequiredCertBadges({
|
||||
vehicleType: props.vehicleType,
|
||||
certList: props.certList || [],
|
||||
part: PL_VEHICLE_CERT_PART_HEAD,
|
||||
partLabel: hasTrailer.value ? '主车' : ''
|
||||
})
|
||||
}
|
||||
]
|
||||
|
||||
if (hasTrailer.value) {
|
||||
groups.push({
|
||||
key: PL_VEHICLE_CERT_PART_TRAILER,
|
||||
badges: getVehiclePartRequiredCertBadges({
|
||||
vehicleType: props.vehicleType,
|
||||
certList: props.certList || [],
|
||||
part: PL_VEHICLE_CERT_PART_TRAILER,
|
||||
partLabel: '挂车'
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return groups
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-vehicle-cert-badges {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
gap: 4px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.pl-vehicle-cert-badges__paren,
|
||||
.pl-vehicle-cert-badges__divider {
|
||||
font-size: 12px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.pl-vehicle-cert-badges__group {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.pl-vehicle-cert-badges__item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 20px;
|
||||
height: 20px;
|
||||
padding: 0 4px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.pl-vehicle-cert-badges__item--missing {
|
||||
background: #f1f5f9;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pl-vehicle-cert-badges__item--valid {
|
||||
background: #ecfdf5;
|
||||
color: #059669;
|
||||
}
|
||||
|
||||
.pl-vehicle-cert-badges__item--expiring {
|
||||
background: #fffbeb;
|
||||
color: #d97706;
|
||||
}
|
||||
|
||||
.pl-vehicle-cert-badges__item--expired {
|
||||
background: #fef2f2;
|
||||
color: #dc2626;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user