This commit is contained in:
zlwu committed 2026-07-01 18:52:26 +08:00
1 parent 7c838cfb2d
commit 8e70047f4c
161 files changed
+16659 -10436

No files matched your search

@@ -11,7 +11,7 @@
@change="handleAttachmentChange"
>
<div class="upload-card">
<el-icon :size="28" color="#10b981"><Plus /></el-icon>
<el-icon :size="28" color="#1ca851"><Plus /></el-icon>
<span class="upload-card-text">上传附件</span>
</div>
</el-upload>
@@ -23,6 +23,7 @@
>
<div
class="attachment-preview"
:class="{ 'is-clickable': canPreview(file) }"
@click="canPreview(file) ? handlePreviewAttachment(file) : undefined"
>
<template v-if="isImageFile(file) && file.fileUrl">
@@ -37,8 +38,14 @@
</div>
</template>
<template v-else>
<div class="attachment-preview__icon attachment-preview__icon--doc">
<div
class="attachment-preview__icon"
:class="isPdfFile(file) ? 'attachment-preview__icon--pdf' : 'attachment-preview__icon--doc'"
>
<el-icon :size="28"><Document /></el-icon>
<span v-if="getFileExtension(file.fileName)" class="attachment-preview__ext">
{{ getFileExtension(file.fileName) }}
</span>
</div>
</template>
</div>
@@ -68,24 +75,41 @@
<el-dialog
v-model="previewVisible"
title="附件预览"
width="800px"
:title="previewFile?.fileName || '附件预览'"
width="860px"
align-center
destroy-on-close
append-to-body
modal-class="order-module-dialog-mask"
@closed="handlePreviewClosed"
>
<img
v-if="previewFile && isImageFile(previewFile)"
:src="resolveFileUrl(previewFile.fileUrl)"
:alt="previewFile.fileName"
class="preview-media"
/>
<video
v-else-if="previewFile && isVideoFile(previewFile)"
:src="resolveFileUrl(previewFile.fileUrl)"
controls
class="preview-media"
/>
<div v-loading="previewLoading" class="preview-body">
<img
v-if="previewFile && isImageFile(previewFile)"
:src="resolveFileUrl(previewFile.fileUrl)"
:alt="previewFile.fileName"
class="preview-media"
/>
<video
v-else-if="previewFile && isVideoFile(previewFile)"
:src="resolveFileUrl(previewFile.fileUrl)"
controls
class="preview-media"
/>
<iframe
v-else-if="previewFile && isPdfFile(previewFile) && previewPdfSrc"
:src="previewPdfSrc"
class="preview-media preview-media--iframe"
title="PDF 预览"
/>
<div
v-else-if="previewFile && isPdfFile(previewFile) && !previewLoading"
class="preview-fallback"
>
<el-icon :size="40" color="#94a3b8"><Document /></el-icon>
<p>PDF 暂无法在线预览,请使用下载查看。</p>
</div>
</div>
</el-dialog>
</div>
</template>
@@ -103,7 +127,10 @@ import {
import type { UploadFile, UploadInstance } from 'element-plus'
import { ElMessage } from 'element-plus'
import { fetchUploadAttachment } from '@/api/admin'
import { downloadAttachmentFile } from '@/utils/download-attachment'
import {
downloadAttachmentFile,
resolveAttachmentPreviewUrl
} from '@/utils/download-attachment'
type AttachmentItem = {
id: string
@@ -140,6 +167,8 @@ const uploadRef = ref<UploadInstance>()
const attachments = ref<AttachmentItem[]>([])
const previewVisible = ref(false)
const previewFile = ref<AttachmentItem | null>(null)
const previewPdfSrc = ref('')
const previewLoading = ref(false)
function resolveFileUrl(url: string) {
const trimmed = String(url || '').trim()
@@ -199,8 +228,26 @@ function isVideoFile(file: AttachmentItem) {
return type.startsWith('video/') || /\.(mp4|webm|ogg|mov|avi)$/i.test(name)
}
function isPdfFile(file: AttachmentItem) {
const name = file.fileName.toLowerCase()
const type = String(file.fileType || '').toLowerCase()
const url = String(file.fileUrl || '').toLowerCase()
return (
type === 'application/pdf' ||
/\.pdf$/i.test(name) ||
/\.pdf(\?|$)/i.test(url)
)
}
function getFileExtension(fileName: string) {
if (!fileName) return ''
const lastDotIndex = fileName.lastIndexOf('.')
if (lastDotIndex === -1) return ''
return fileName.substring(lastDotIndex + 1).toUpperCase()
}
function canPreview(file: AttachmentItem) {
return Boolean(file.fileUrl) && (isImageFile(file) || isVideoFile(file))
return Boolean(file.fileUrl) && (isImageFile(file) || isVideoFile(file) || isPdfFile(file))
}
async function handleAttachmentChange(uploadFile: UploadFile) {
@@ -260,7 +307,28 @@ function handleDownloadAttachment(file: AttachmentItem) {
function handlePreviewAttachment(file: AttachmentItem) {
if (!canPreview(file)) return
previewFile.value = file
previewPdfSrc.value = ''
previewVisible.value = true
if (!isPdfFile(file)) return
previewLoading.value = true
resolveAttachmentPreviewUrl(file, { fullFileUrl: resolveFileUrl })
.then((url) => {
if (previewFile.value?.id !== file.id) return
previewPdfSrc.value = url
})
.finally(() => {
if (previewFile.value?.id === file.id) {
previewLoading.value = false
}
})
}
function handlePreviewClosed() {
previewFile.value = null
previewPdfSrc.value = ''
previewLoading.value = false
}
function hasUploading() {
@@ -284,7 +352,7 @@ defineExpose({ hasUploading })
.upload-card {
width: 140px;
height: 96px;
border: 1px dashed #a7f3d0;
border: 1px dashed #a8e0b8;
border-radius: 8px;
background: #f0fdf4;
display: flex;
@@ -295,15 +363,15 @@ defineExpose({ hasUploading })
cursor: pointer;
&:hover {
border-color: #10b981;
border-color: #1ca851;
border-style: solid;
background: #ecfdf5;
background: #e6f8ed;
}
}
.upload-card-text {
font-size: 12px;
color: #10b981;
color: #1ca851;
font-weight: 500;
line-height: 1;
}
@@ -329,8 +397,8 @@ defineExpose({ hasUploading })
}
&:hover {
border-color: #10b981;
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
border-color: #1ca851;
box-shadow: 0 2px 8px rgba(28, 168, 81, 0.1);
}
}
@@ -342,7 +410,10 @@ defineExpose({ hasUploading })
justify-content: center;
background: #f8fafc;
overflow: hidden;
cursor: pointer;
&.is-clickable {
cursor: zoom-in;
}
img {
width: 100%;
@@ -354,9 +425,10 @@ defineExpose({ hasUploading })
.attachment-preview__icon {
width: 48px;
height: 48px;
min-height: 48px;
border-radius: 10px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
@@ -369,6 +441,18 @@ defineExpose({ hasUploading })
background: #e0f2fe;
color: #0284c7;
}
&--pdf {
background: #fee2e2;
color: #dc2626;
}
}
.attachment-preview__ext {
margin-top: 4px;
font-size: 11px;
font-weight: 600;
color: #1e293b;
}
.attachment-footer {
@@ -404,7 +488,7 @@ defineExpose({ hasUploading })
cursor: pointer;
&:hover {
background: #10b981;
background: #1ca851;
color: #fff;
}
@@ -416,9 +500,33 @@ defineExpose({ hasUploading })
.preview-media {
display: block;
width: 100%;
max-width: 100%;
max-height: 70vh;
margin: 0 auto;
object-fit: contain;
border-radius: 8px;
background: #f8fafc;
&--iframe {
height: 70vh;
border: 0;
}
}
.preview-body {
min-height: 240px;
}
.preview-fallback {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12px;
min-height: 240px;
color: #1e293b;
font-size: 14px;
}
:deep(.el-upload) {
@@ -187,7 +187,7 @@ defineExpose({ hasUploading, clearUploadRefs })
.cert-card-index {
font-size: 13px;
font-weight: 600;
color: var(--primary, #10b981);
color: var(--primary, #1ca851);
}
.cert-card-index::before {
@@ -198,7 +198,7 @@ defineExpose({ hasUploading, clearUploadRefs })
margin-right: 8px;
vertical-align: -2px;
border-radius: 2px;
background: var(--primary, #10b981);
background: var(--primary, #1ca851);
}
.cert-card-grid {
@@ -105,7 +105,7 @@ function buildCertViewFields(cert: CertRead): ViewField[] {
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #10b981;
border-left: 3px solid #1ca851;
line-height: 1;
}
@@ -293,8 +293,8 @@ defineExpose({ open })
gap: 12px 24px;
padding: 16px;
border-radius: 10px;
background: var(--primary-bg, #ecfdf5);
border: 1px solid #a7f3d0;
background: var(--primary-bg, #e6f8ed);
border: 1px solid #a8e0b8;
}
.summary-item {
@@ -317,7 +317,7 @@ defineExpose({ open })
&--amount {
font-size: 18px;
font-weight: 700;
color: var(--primary-dark, #059669);
color: var(--primary-dark, #168f45);
}
}
@@ -24,7 +24,7 @@
<el-input :model-value="settlement?.settlementNo" disabled />
</el-form-item>
<el-form-item label="运费合计(元)">
<el-input :model-value="formatAmount(settlement?.totalFreight)" disabled />
<el-input :model-value="formatAmount(displayTotalFreight)" disabled />
</el-form-item>
</div>
<div class="form-grid-3">
@@ -72,11 +72,21 @@
</el-form>
<section class="dialog-section">
<h3 class="dialog-section-title">关联运输信息</h3>
<div class="dialog-section-head">
<h3 class="dialog-section-title">关联运输信息</h3>
<el-button
v-if="canEditTransports"
class="btn-ghost"
:disabled="loading"
@click="openAddDialog"
>
<el-icon><Plus /></el-icon>添加运输
</el-button>
</div>
<div class="panel dialog-list-panel">
<div class="list-body list-wrap dialog-list-body-only">
<el-table
:data="settlement?.transports || []"
:data="editableTransports"
class="list-table"
stripe
empty-text="暂无数据"
@@ -119,9 +129,29 @@
<el-table-column prop="freightAmount" label="运费(元)" min-width="110" align="right">
<template #default="{ row }">{{ formatAmount(row.freightAmount) }}</template>
</el-table-column>
<el-table-column
v-if="canEditTransports"
label="操作"
min-width="90"
align="center"
fixed="right"
class-name="col-actions"
>
<template #default="{ row }">
<el-button
link
type="danger"
:disabled="editableTransports.length <= 1"
@click="handleRemoveTransport(row)"
>
<el-icon><Delete /></el-icon>删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<p v-if="canEditTransports" class="dialog-section-tip">至少保留一条关联运输;删除后可在「添加运输」中重新加入</p>
</section>
<template #footer>
@@ -133,16 +163,305 @@
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="addDialogVisible"
title="添加运输"
width="1200px"
align-center
append-to-body
destroy-on-close
class="dialog-form-layout pl-freight-add-transport-dialog"
modal-class="order-module-dialog-mask"
:close-on-click-modal="false"
>
<div class="add-transport-body">
<div class="filter-block add-transport-filter">
<el-form :model="addSearchForm" class="filter-form" @submit.prevent>
<div class="add-transport-filter-row">
<div class="add-transport-filter-fields">
<el-form-item label="计划编号">
<el-input
v-model="addSearchForm.q"
placeholder="搜索计划编号/客户"
clearable
@keyup.enter="handleAddSearch"
/>
</el-form-item>
<el-form-item label="车牌号">
<el-input
v-model="addSearchForm.licensePlate"
placeholder="搜索车牌号"
clearable
@keyup.enter="handleAddSearch"
/>
</el-form-item>
</div>
<div class="filter-actions-end">
<el-button class="btn-ghost" :loading="addLoading" @click="handleAddReset">
<el-icon><RefreshLeft /></el-icon>重置
</el-button>
<el-button class="btn-main" type="primary" :loading="addLoading" @click="handleAddSearch">
<el-icon><Search /></el-icon>搜索
</el-button>
</div>
</div>
</el-form>
</div>
<div v-if="removedTransports.length" class="panel dialog-list-panel add-transport-removed-panel">
<div class="panel-top">
<h2 class="title-bar-heading">本次已移除(可恢复)</h2>
</div>
<div class="list-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ addSelectedRemoved.length }}</span> 项
</div>
</div>
</div>
<div class="list-body list-wrap dialog-list-body-only">
<el-table
:data="removedTransports"
class="list-table"
stripe
row-key="id"
empty-text="暂无已移除运输"
@selection-change="handleRemovedSelectionChange"
>
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="60" align="center" header-align="center" />
<el-table-column
prop="transportNo"
label="运输编号"
min-width="160"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="licensePlate"
label="车牌号"
min-width="110"
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.licensePlate || '—' }}</template>
</el-table-column>
<el-table-column
prop="driverName"
label="司机"
min-width="90"
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.driverName || '—' }}</template>
</el-table-column>
<el-table-column
prop="carrierName"
label="承运商"
min-width="120"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.carrierName || '—' }}</template>
</el-table-column>
<el-table-column
prop="transportMedium"
label="运输介质"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.transportMedium || '—' }}</template>
</el-table-column>
<el-table-column
prop="startPoint"
label="出发地"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.startPoint || '—' }}</template>
</el-table-column>
<el-table-column
prop="endPoint"
label="目的地"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.endPoint || '—' }}</template>
</el-table-column>
<el-table-column
prop="freightAmount"
label="运费(元)"
min-width="120"
align="right"
header-align="center"
>
<template #default="{ row }">{{ formatAmount(row.freightAmount) }}</template>
</el-table-column>
</el-table>
</div>
</div>
<div class="panel dialog-list-panel">
<div class="panel-top">
<h2 class="title-bar-heading">未结算计划</h2>
</div>
<div class="list-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ pendingAddCount }}</span> 项
</div>
</div>
</div>
<div class="list-body list-wrap dialog-list-body-only">
<el-table
v-loading="addLoading"
:data="availablePlans"
class="list-table"
stripe
row-key="id"
empty-text="暂无可添加的未结算计划"
@selection-change="handleAddSelectionChange"
>
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
prop="planNo"
label="计划编号"
min-width="160"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="planDate"
label="计划日期"
min-width="120"
align="center"
header-align="center"
/>
<el-table-column
prop="planType"
label="单据类型"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="getPlanTypeTagType(row.planType)" size="small">
{{ getPlanTypeLabel(row.planType) }}
</el-tag>
</template>
</el-table-column>
<el-table-column
label="客户/供应商"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">
{{ row.customerName || row.supplierName || '—' }}
</template>
</el-table-column>
<el-table-column
prop="licensePlate"
label="车牌号"
min-width="110"
align="center"
header-align="center"
/>
<el-table-column
prop="transportCompany"
label="运输公司"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="freightAmount"
label="运费(元)"
min-width="120"
align="right"
header-align="center"
>
<template #default="{ row }">{{ formatAmount(row.freightAmount) }}</template>
</el-table-column>
<el-table-column
prop="archiveTime"
label="归档时间"
min-width="160"
align="center"
header-align="center"
>
<template #default="{ row }">{{
row.archiveTime ? formatDateTime(row.archiveTime) : '—'
}}</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
v-model:current-page="addPagination.page"
v-model:page-size="addPagination.pageSize"
:total="addPagination.total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="handleAddSizeChange"
@current-change="handleAddPageChange"
/>
</div>
</div>
</div>
</div>
<template #footer>
<el-button @click="addDialogVisible = false">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button type="primary" :disabled="!pendingAddCount" @click="confirmAddTransports">
<el-icon><Check /></el-icon>确定添加({{ pendingAddCount }})
</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { Check, Close } from '@element-plus/icons-vue'
import { freightApi, type FreightSettlement } from '@/api/pl'
import { Check, Close, Delete, Plus, RefreshLeft, Search } from '@element-plus/icons-vue'
import {
freightApi,
type FreightSettlement,
type Transport,
type UnsettledPlanItem
} from '@/api/pl'
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
import { formatMoneyDisplay } from '@/utils/money-format'
import { formatDateTime } from '@/utils/format'
import { getPlanTypeLabel, getPlanTypeTagType, isEditableDraftSettlement } from '@/views/pl/freight/freight-status'
const emit = defineEmits<{ success: [] }>()
type EditableTransport = Pick<
Transport,
| 'id'
| 'transportNo'
| 'licensePlate'
| 'driverName'
| 'carrierName'
| 'transportMedium'
| 'startPoint'
| 'endPoint'
| 'freightAmount'
>
const visible = ref(false)
const loading = ref(false)
const submitLoading = ref(false)
@@ -150,6 +469,23 @@ const settlement = ref<FreightSettlement | null>(null)
const formRef = ref<ElFormInstance>()
const attachmentRef = ref<InstanceType<typeof AttachmentUploadField>>()
const invoiceAttachmentUrlsStr = ref('')
const editableTransports = ref<EditableTransport[]>([])
const removedTransports = ref<EditableTransport[]>([])
const addDialogVisible = ref(false)
const addLoading = ref(false)
const addPlanList = ref<UnsettledPlanItem[]>([])
const addSelectedPlans = ref<UnsettledPlanItem[]>([])
const addSelectedRemoved = ref<EditableTransport[]>([])
const addSearchForm = reactive({
q: '',
licensePlate: ''
})
const addPagination = reactive({
page: 1,
pageSize: 10,
total: 0
})
const form = reactive({
invoiceNo: '',
@@ -160,20 +496,65 @@ const form = reactive({
const rules = {}
const canEditTransports = computed(() => isEditableDraftSettlement(settlement.value?.settlementStatus))
const dialogTitle = computed(() => {
if (settlement.value?.settlementStatus === 'approved') return '发票信息'
return '编辑结算单'
})
const displayTotalFreight = computed(() =>
editableTransports.value.reduce((sum, row) => sum + Number(row.freightAmount || 0), 0)
)
const selectedTransportIds = computed(() => new Set(editableTransports.value.map((row) => row.id)))
const availablePlans = computed(() =>
addPlanList.value.filter((plan) => !selectedTransportIds.value.has(plan.transportId))
)
const pendingAddCount = computed(
() => addSelectedPlans.value.length + addSelectedRemoved.value.length
)
function formatAmount(amount?: number) {
if (!amount) return '¥0.00'
return formatMoneyDisplay(amount)
}
function cloneTransportRows(rows: Transport[] = []): EditableTransport[] {
return rows.map((row) => ({
id: row.id,
transportNo: row.transportNo,
licensePlate: row.licensePlate,
driverName: row.driverName,
carrierName: row.carrierName,
transportMedium: row.transportMedium,
startPoint: row.startPoint,
endPoint: row.endPoint,
freightAmount: row.freightAmount
}))
}
function planToTransportRow(plan: UnsettledPlanItem): EditableTransport {
return {
id: plan.transportId,
transportNo: plan.transportNo || plan.planNo,
licensePlate: plan.licensePlate,
driverName: plan.driverName,
carrierName: plan.transportCompany,
transportMedium: plan.transportMedium,
startPoint: plan.startPoint,
endPoint: plan.endPoint,
freightAmount: plan.freightAmount
}
}
async function open(id: string) {
visible.value = true
loading.value = true
invoiceAttachmentUrlsStr.value = ''
removedTransports.value = []
try {
const res = await freightApi.get(id)
settlement.value = (res.data ?? res) as FreightSettlement
@@ -182,26 +563,131 @@ async function open(id: string) {
form.invoiceAmount = settlement.value.invoiceAmount
form.remark = settlement.value.remark || ''
invoiceAttachmentUrlsStr.value = settlement.value.invoiceAttachmentUrls || ''
editableTransports.value = cloneTransportRows(settlement.value.transports || [])
} finally {
loading.value = false
}
}
function handleRemoveTransport(row: EditableTransport) {
if (editableTransports.value.length <= 1) {
ElMessage.warning('至少保留一条关联运输')
return
}
editableTransports.value = editableTransports.value.filter((item) => item.id !== row.id)
if (!removedTransports.value.some((item) => item.id === row.id)) {
removedTransports.value = [...removedTransports.value, row]
}
}
function openAddDialog() {
addDialogVisible.value = true
addSelectedPlans.value = []
addSelectedRemoved.value = []
addSearchForm.q = ''
addSearchForm.licensePlate = ''
addPagination.page = 1
fetchAddPlans()
}
async function fetchAddPlans() {
addLoading.value = true
try {
const res = await freightApi.listUnsettledPlans({
q: addSearchForm.q || undefined,
licensePlate: addSearchForm.licensePlate || undefined,
page: addPagination.page,
pageSize: addPagination.pageSize
})
const data = res.data ?? res
addPlanList.value = data.list || []
addPagination.total = data.total || 0
} finally {
addLoading.value = false
}
}
function handleAddSearch() {
addPagination.page = 1
fetchAddPlans()
}
function handleAddReset() {
addSearchForm.q = ''
addSearchForm.licensePlate = ''
addPagination.page = 1
fetchAddPlans()
}
function handleAddPageChange() {
fetchAddPlans()
}
function handleAddSizeChange() {
addPagination.page = 1
fetchAddPlans()
}
function handleAddSelectionChange(rows: UnsettledPlanItem[]) {
addSelectedPlans.value = rows
}
function handleRemovedSelectionChange(rows: EditableTransport[]) {
addSelectedRemoved.value = rows
}
function confirmAddTransports() {
const nextIds = new Set(editableTransports.value.map((row) => row.id))
const rowsToAdd: EditableTransport[] = []
for (const row of addSelectedRemoved.value) {
if (!nextIds.has(row.id)) {
rowsToAdd.push(row)
nextIds.add(row.id)
}
}
for (const plan of addSelectedPlans.value) {
if (!nextIds.has(plan.transportId)) {
rowsToAdd.push(planToTransportRow(plan))
nextIds.add(plan.transportId)
}
}
if (!rowsToAdd.length) {
ElMessage.warning('请选择要添加的运输')
return
}
editableTransports.value = [...editableTransports.value, ...rowsToAdd]
removedTransports.value = removedTransports.value.filter(
(row) => !rowsToAdd.some((item) => item.id === row.id)
)
addDialogVisible.value = false
}
async function handleSubmit() {
if (!settlement.value) return
if (canEditTransports.value && editableTransports.value.length < 1) {
ElMessage.warning('至少保留一条关联运输')
return
}
if (attachmentRef.value?.hasUploading?.()) {
ElMessage.warning('附件上传中,请稍候')
return
}
submitLoading.value = true
try {
await freightApi.update(settlement.value.id, {
const payload = {
invoiceNo: form.invoiceNo || undefined,
invoiceDate: form.invoiceDate || undefined,
invoiceAmount: form.invoiceAmount,
invoiceAttachmentUrls: invoiceAttachmentUrlsStr.value || undefined,
remark: form.remark || undefined
})
remark: form.remark || undefined,
...(canEditTransports.value
? { transportIds: editableTransports.value.map((row) => row.id) }
: {})
}
await freightApi.update(settlement.value.id, payload)
ElMessage.success('保存成功')
visible.value = false
emit('success')
@@ -218,9 +704,94 @@ defineExpose({ open })
margin-top: 16px;
}
.dialog-section-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
}
.dialog-section-title {
margin: 0 0 12px;
margin: 0;
font-size: 14px;
font-weight: 600;
}
.dialog-section-tip {
margin: 8px 0 0;
font-size: 12px;
color: var(--text-muted, #64748b);
}
.add-transport-body {
min-height: 120px;
}
.add-transport-filter {
padding: 12px 16px 10px;
margin-bottom: 12px;
background: var(--mint-surface);
border: 1px solid var(--mint-border);
border-radius: var(--mint-radius);
.add-transport-filter-row {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 14px;
flex-wrap: wrap;
}
.add-transport-filter-fields {
display: grid;
flex: 1;
grid-template-columns: repeat(2, minmax(220px, 1fr));
gap: 10px 14px;
min-width: 0;
}
.add-transport-filter-fields .el-form-item {
margin-bottom: 0;
}
.filter-actions-end {
display: flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
margin-left: auto;
}
.filter-actions-end .el-button + .el-button {
margin-left: 0 !important;
}
}
.add-transport-removed-panel {
margin-bottom: 12px;
> .panel-top + .list-toolbar .list-toolbar-row {
border-top: none;
}
}
@media (max-width: 760px) {
.add-transport-filter {
.add-transport-filter-row {
align-items: stretch;
flex-direction: column;
}
.add-transport-filter-fields {
grid-template-columns: 1fr;
width: 100%;
}
.filter-actions-end {
justify-content: flex-end;
width: 100%;
}
}
}
</style>
@@ -195,6 +195,7 @@ import { formatDateTime } from '@/utils/format'
const visible = ref(false)
const loading = ref(false)
const settlement = ref<FreightSettlement | null>(null)
const settlementId = ref<string | null>(null)
const approvalNodes = computed(() =>
mapApprovalFlowToNodes(settlement.value?.approvalFlow || [])
@@ -209,18 +210,29 @@ function normalizeVoucherUrls(raw?: string) {
return normalizeAttachmentUrls(raw)
}
async function open(id: string) {
visible.value = true
async function loadData() {
if (!settlementId.value) return
loading.value = true
try {
const res = await freightApi.get(id)
const res = await freightApi.get(settlementId.value)
settlement.value = (res.data ?? res) as FreightSettlement
} finally {
loading.value = false
}
}
defineExpose({ open })
async function open(id: string) {
settlementId.value = id
visible.value = true
await loadData()
}
async function reload() {
if (!visible.value || !settlementId.value) return
await loadData()
}
defineExpose({ open, reload })
</script>
<style scoped lang="scss">
@@ -235,8 +247,8 @@ defineExpose({ open })
padding: 16px;
margin-bottom: 16px;
border-radius: 10px;
background: var(--primary-bg, #ecfdf5);
border: 1px solid #a7f3d0;
background: var(--primary-bg, #e6f8ed);
border: 1px solid #a8e0b8;
}
.view-hero-top {
@@ -281,7 +293,7 @@ defineExpose({ open })
.view-hero-amount {
font-size: 20px;
font-weight: 700;
color: var(--primary-dark, #059669);
color: var(--primary-dark, #168f45);
}
.view-section {
@@ -117,6 +117,7 @@ import PlPlanFormProductTable from '@/components/business/pl-plan-form-dialog/Pl
import PlPlanViewTabs from '@/components/business/pl-plan-view-tabs/index.vue'
import type { PlanFormProductRow } from '@/composables/usePlContractToPlan'
import { usePlFreightCalc, resolveFreightUnitLabel } from '@/composables/usePlFreightCalc'
import { useDictStore } from '@/store/modules/dict'
import { pickBxData } from '@/utils/http/bx'
const props = defineProps<{
@@ -154,7 +155,12 @@ const freightCalc = usePlFreightCalc({
freightType: freightTypeRef
})
const freightUnitLabel = computed(() => resolveFreightUnitLabel(productRows.value))
const dictStore = useDictStore()
const freightUnitLabel = computed(() => {
const unitCode = resolveFreightUnitLabel(productRows.value)
return dictStore.getLabel('crm_product_unit', unitCode) || unitCode || '吨'
})
const isAdjustMode = computed(() => plan.value.archiveStatus === 'archived')
@@ -181,9 +187,7 @@ function mapPlanProducts(products: PlanProduct[]): PlanFormProductRow[] {
categoryName: item.categoryName,
unit: item.unit || '吨',
quantity: Number(item.quantity ?? item.inboundEstimateQty ?? item.outboundEstimateQty ?? 0),
actualQty: Number(
item.actualQty ?? item.quantity ?? item.inboundEstimateQty ?? item.outboundEstimateQty ?? 0
),
actualQty: item.actualQty != null ? Number(item.actualQty) : undefined,
packageSpec: item.packageSpec,
deliveryMethod: item.deliveryMethod,
taxPrice: item.taxPrice != null ? Number(item.taxPrice) : undefined,
@@ -223,7 +227,8 @@ async function applyFreightPrefill(data: Plan) {
formData.distanceKm = transport.distanceKm != null ? Number(transport.distanceKm) : null
formData.freightType = transport.freightType || 'by_weight'
if (transport.transportQty != null) {
// 首次归档时运输量仅按实际数量汇总,不回填安排运输阶段可能基于计划数量的运输量
if (isAdjustMode.value && transport.transportQty != null) {
freightCalc.transportQty.value = Number(transport.transportQty)
freightCalc.transportQtyTouched.value = true
}
@@ -278,6 +283,14 @@ async function handleSubmit() {
ElMessage.warning('请填写有效的实际数量')
return
}
if (
formData.hasFreight === 1 &&
formData.freightType === 'by_weight' &&
(!freightCalc.transportQty.value || Number(freightCalc.transportQty.value) <= 0)
) {
ElMessage.warning('运输量须大于0,请填写产品实际数量')
return
}
if (formData.hasFreight === 1 && !plan.value.transportId) {
ElMessage.warning('计划有运输费用但未安排运输,请先安排运输')
return
@@ -137,9 +137,9 @@
<el-form-item label="取货时间">
<el-date-picker
v-model="formData.pickupTime"
type="datetime"
type="date"
placeholder="选择取货时间"
value-format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
@@ -179,9 +179,9 @@
<el-form-item label="送达时间">
<el-date-picker
v-model="formData.deliveryTime"
type="datetime"
type="date"
placeholder="选择送达时间"
value-format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
@@ -384,7 +384,7 @@ import { buildMissingHazardCertMessage } from '@/composables/usePlToxicProductCe
import { usePlPlanArrangeActions } from '@/composables/usePlPlanArrangeActions'
import { useDictStore } from '@/store/modules/dict'
import { isTonProductUnit } from '@/utils/crm-product-display'
import { formatDateTime } from '@/utils/format'
import { formatDate } from '@/utils/format'
import { pickBxData, pickBxList } from '@/utils/http/bx'
const dictStore = useDictStore()
@@ -505,9 +505,7 @@ const productRows = computed<PlanFormProductRow[]>(() =>
categoryName: item.categoryName,
unit: item.unit || '吨',
quantity: Number(item.quantity ?? item.inboundEstimateQty ?? item.outboundEstimateQty ?? 0),
actualQty: Number(
item.actualQty ?? item.quantity ?? item.inboundEstimateQty ?? item.outboundEstimateQty ?? 0
),
actualQty: item.actualQty != null ? Number(item.actualQty) : undefined,
packageSpec: item.packageSpec,
deliveryMethod: item.deliveryMethod,
remark: item.remark,
@@ -583,10 +581,10 @@ function applyVehiclePersonnel(personnelList: VehiclePersonnelRow[], preferredDr
async function applyPrefillFromPlan(data: Plan) {
formData.pickupAddress = data.pickupAddress || ''
formData.pickupTime = formatDateTime(data.pickupTime) || ''
formData.pickupTime = formatDate(data.pickupTime) || ''
formData.pickupNotes = data.pickupNotes || ''
formData.destinationAddress = data.destinationAddress || ''
formData.deliveryTime = formatDateTime(data.deliveryTime) || ''
formData.deliveryTime = formatDate(data.deliveryTime) || ''
formData.destinationNotes = data.destinationNotes || ''
formData.hasFreight = data.hasFreight ?? 0
formData.remark = data.remark || ''
@@ -628,10 +626,6 @@ async function applyPrefillFromPlan(data: Plan) {
formData.freightType = transport.freightType || 'by_weight'
prefilledDriverId.value = transport.driverId || prefilledDriverId.value
if (transport.transportQty != null) {
freightCalc.transportQty.value = Number(transport.transportQty)
freightCalc.transportQtyTouched.value = true
}
if (transport.freightPrice != null) {
freightCalc.freightPrice.value = Number(transport.freightPrice)
}
@@ -938,12 +932,12 @@ async function handleSubmit() {
.pl-plan-flow-bridge__label {
font-size: 12px;
font-weight: 600;
color: var(--primary-dark, #059669);
color: var(--primary-dark, #168f45);
letter-spacing: 0.06em;
padding: 4px 10px;
border-radius: 999px;
background: #ecfdf5;
border: 1px solid #a7f3d0;
background: #e6f8ed;
border: 1px solid #a8e0b8;
line-height: 1.2;
}
@@ -954,10 +948,10 @@ async function handleSubmit() {
width: 44px;
height: 44px;
border-radius: 50%;
color: var(--primary-dark, #059669);
background: linear-gradient(145deg, #ecfdf5 0%, #d1fae5 100%);
border: 1px solid #a7f3d0;
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.14);
color: var(--primary-dark, #168f45);
background: linear-gradient(145deg, #e6f8ed 0%, #d4f0de 100%);
border: 1px solid #a8e0b8;
box-shadow: 0 2px 8px rgba(28, 168, 81, 0.14);
svg {
width: 22px;
@@ -1019,7 +1013,7 @@ async function handleSubmit() {
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #10b981;
border-left: 3px solid #1ca851;
line-height: 1;
}
@@ -1036,7 +1030,7 @@ async function handleSubmit() {
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #10b981;
border-left: 3px solid #1ca851;
line-height: 1;
}
@@ -129,9 +129,9 @@
<el-form-item label="取货时间">
<el-date-picker
v-model="formData.pickupTime"
type="datetime"
type="date"
placeholder="选择取货时间"
value-format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
@@ -171,9 +171,9 @@
<el-form-item label="送达时间">
<el-date-picker
v-model="formData.deliveryTime"
type="datetime"
type="date"
placeholder="选择送达时间"
value-format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
@@ -284,7 +284,8 @@ import { usePlFreightCalc, resolveFreightUnitLabel } from '@/composables/usePlFr
import { loadVehicleViewBundle, type VehicleViewBundle } from '@/composables/usePlVehicleViewDetail'
import { useDictStore } from '@/store/modules/dict'
import { useUserStore } from '@/store/modules/user'
import { formatDateTime } from '@/utils/format'
import { formatDate } from '@/utils/format'
import { pickBxList } from '@/utils/http/bx'
import { formatMoneyDisplay } from '@/utils/money-format'
const ContractDetailDialog = defineAsyncComponent(
@@ -612,11 +613,8 @@ async function restoreFreightFromTransport(plan: Plan) {
}
freightCalc.freightPrice.value =
transport.freightPrice != null ? Number(transport.freightPrice) : null
freightCalc.transportQty.value =
transport.transportQty != null ? Number(transport.transportQty) : null
freightCalc.freightAmount.value =
transport.freightAmount != null ? Number(transport.freightAmount) : null
freightCalc.transportQtyTouched.value = transport.transportQty != null
freightCalc.freightAmountTouched.value = false
} catch {
if (plan.freightAmount) {
@@ -707,10 +705,10 @@ async function loadPlanForEdit(planId: string) {
settlementMethod: data.settlementMethod || '',
hasFreight: data.hasFreight ?? 0,
pickupAddress: data.pickupAddress || '',
pickupTime: formatDateTime(data.pickupTime) || '',
pickupTime: formatDate(data.pickupTime) || '',
pickupNotes: data.pickupNotes || '',
destinationAddress: data.destinationAddress || '',
deliveryTime: formatDateTime(data.deliveryTime) || '',
deliveryTime: formatDate(data.deliveryTime) || '',
destinationNotes: data.destinationNotes || '',
vehicleId: data.vehicleId || '',
remark: data.remark || '',
@@ -795,8 +793,8 @@ async function loadMasterData() {
vehicleApi.list({ vehicleStatus: 'available', excludeIneligibleCarrier: true }),
carrierApi.list({ status: '1', page: 1, pageSize: 100 })
])
vehicleList.value = (vehicleRes.data ?? vehicleRes) || []
carrierList.value = (carrierRes.data ?? carrierRes) || []
vehicleList.value = pickBxList<Vehicle>(vehicleRes)
carrierList.value = pickBxList<Carrier>(carrierRes)
} catch {
vehicleList.value = []
carrierList.value = []
@@ -882,7 +880,7 @@ function validateBusinessRules() {
return false
}
if (!freightCalc.transportQty.value || freightCalc.transportQty.value <= 0) {
ElMessage.warning('运输量必须大于 0')
ElMessage.warning('运输量须大于0,请填写产品实际数量或手动输入运输量')
return false
}
} else if (!freightCalc.freightAmount.value || freightCalc.freightAmount.value <= 0) {
@@ -954,7 +952,7 @@ async function handleSubmit() {
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #10b981;
border-left: 3px solid #1ca851;
line-height: 1;
}
@@ -1040,12 +1038,12 @@ async function handleSubmit() {
.pl-plan-flow-bridge__label {
font-size: 12px;
font-weight: 600;
color: var(--primary-dark, #059669);
color: var(--primary-dark, #168f45);
letter-spacing: 0.06em;
padding: 4px 10px;
border-radius: 999px;
background: #ecfdf5;
border: 1px solid #a7f3d0;
background: #e6f8ed;
border: 1px solid #a8e0b8;
line-height: 1.2;
}
@@ -1056,10 +1054,10 @@ async function handleSubmit() {
width: 44px;
height: 44px;
border-radius: 50%;
color: var(--primary-dark, #059669);
background: linear-gradient(145deg, #ecfdf5 0%, #d1fae5 100%);
border: 1px solid #a7f3d0;
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.14);
color: var(--primary-dark, #168f45);
background: linear-gradient(145deg, #e6f8ed 0%, #d4f0de 100%);
border: 1px solid #a8e0b8;
box-shadow: 0 2px 8px rgba(28, 168, 81, 0.14);
svg {
width: 22px;
@@ -201,7 +201,7 @@ function handleClosed() {
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #10b981;
border-left: 3px solid #1ca851;
line-height: 1;
}
@@ -188,7 +188,8 @@
<h5 class="pl-plan-dibang-weighing-title">地磅单</h5>
<div class="view-subtable-wrap">
<el-table :data="[row.weighing]" class="view-subtable list-table" stripe>
<el-table-column
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
prop="batchNo"
label="出入库单号"
min-width="130"
@@ -368,7 +369,7 @@
import { mapPlanProductToFormRow, usePlPlanViewDetail, type PlPlanTransportDibangRow, type PlPlanTransportSiteRow } from '@/composables/usePlPlanViewDetail'
import { isHazardProduct } from '@/composables/usePlToxicProductCertCheck'
import { useDictStore } from '@/store/modules/dict'
import { formatDateTime } from '@/utils/format'
import { formatDate, formatDateTime } from '@/utils/format'
import { pickBxData } from '@/utils/http/bx'
import {
buildSiteSummaryFromInventoryLinks
@@ -531,7 +532,7 @@
if (qty != null) return String(qty)
if (!productRows.value.length) return '—'
const sum = productRows.value.reduce(
(total, item) => total + Number(item.actualQty ?? item.quantity ?? 0),
(total, item) => total + Number(item.actualQty ?? 0),
0
)
return sum ? String(sum) : '—'
@@ -575,7 +576,7 @@
const pickupViewFields = computed<ViewField[]>(() => [
{ label: '取货地址', value: plan.value?.pickupAddress, span: 'full' },
{ label: '取货时间', value: formatDateTime(plan.value?.pickupTime) || '—' },
{ label: '取货时间', value: formatDate(plan.value?.pickupTime) || '—' },
{ label: '注意事项', value: plan.value?.pickupNotes, span: 'full' }
])
@@ -585,7 +586,7 @@
value: plan.value?.destinationAddress || plan.value?.destinationName,
span: 'full'
},
{ label: '送达时间', value: formatDateTime(plan.value?.deliveryTime) || '—' },
{ label: '送达时间', value: formatDate(plan.value?.deliveryTime) || '—' },
{ label: '注意事项', value: plan.value?.destinationNotes, span: 'full' }
])
@@ -763,7 +764,7 @@
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #10b981;
border-left: 3px solid #1ca851;
line-height: 1;
}
@@ -850,7 +851,7 @@
font-weight: 600;
color: var(--text, #1e293b);
line-height: 1.5;
border-left: 3px solid var(--primary, #10b981);
border-left: 3px solid var(--primary, #1ca851);
}
.party-flow-bridge {
@@ -866,12 +867,12 @@
.party-flow-bridge__label {
font-size: 12px;
font-weight: 600;
color: var(--primary-dark, #059669);
color: var(--primary-dark, #168f45);
letter-spacing: 0.06em;
padding: 4px 10px;
border-radius: 999px;
background: #ecfdf5;
border: 1px solid #a7f3d0;
background: #e6f8ed;
border: 1px solid #a8e0b8;
line-height: 1.2;
}
@@ -882,10 +883,10 @@
width: 44px;
height: 44px;
border-radius: 50%;
color: var(--primary-dark, #059669);
background: linear-gradient(145deg, #ecfdf5 0%, #d1fae5 100%);
border: 1px solid #a7f3d0;
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.14);
color: var(--primary-dark, #168f45);
background: linear-gradient(145deg, #e6f8ed 0%, #d4f0de 100%);
border: 1px solid #a8e0b8;
box-shadow: 0 2px 8px rgba(28, 168, 81, 0.14);
svg {
width: 22px;
@@ -926,7 +927,7 @@
font-size: 13px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #10b981;
border-left: 3px solid #1ca851;
line-height: 1;
}
@@ -970,7 +971,7 @@
}
.money-display {
color: #059669;
color: #168f45;
}
.pl-plan-dibang-block {
@@ -87,7 +87,7 @@ function getRoleTagType(role: string) {
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #10b981;
border-left: 3px solid #1ca851;
line-height: 1.4;
}
@@ -151,7 +151,7 @@ watch(
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #10b981;
border-left: 3px solid #1ca851;
line-height: 1;
}
</style>
@@ -369,7 +369,7 @@
display: flex;
gap: 16px;
padding: 20px 22px;
background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 55%);
background: linear-gradient(135deg, #e6f8ed 0%, #ffffff 55%);
border-bottom: 1px solid #d9e8e2;
align-items: center;
}
@@ -378,9 +378,9 @@
width: 72px;
height: 72px;
border-radius: 12px;
border: 1px solid rgba(16, 185, 129, 0.2);
background: rgba(16, 185, 129, 0.08);
color: #059669;
border: 1px solid rgba(28, 168, 81, 0.2);
background: rgba(28, 168, 81, 0.08);
color: #168f45;
display: inline-flex;
align-items: center;
justify-content: center;
@@ -421,7 +421,7 @@
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #10b981;
border-left: 3px solid #1ca851;
line-height: 1;
}
}
@@ -143,10 +143,10 @@ function connectorClass(index: number) {
}
.approval-flow-circle.is-approved {
border-color: var(--success, #10b981);
background: linear-gradient(135deg, #10b981, #059669);
border-color: var(--success, #1ca851);
background: linear-gradient(135deg, #1ca851, #168f45);
color: #fff;
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
box-shadow: 0 2px 8px rgba(28, 168, 81, 0.25);
}
.approval-flow-circle.is-rejected {
@@ -156,9 +156,9 @@ function connectorClass(index: number) {
}
.approval-flow-circle.is-pending {
border-color: var(--primary, #10b981);
border-color: var(--primary, #1ca851);
background: #fff;
color: var(--primary, #10b981);
color: var(--primary, #1ca851);
}
.approval-status-icon {
@@ -206,7 +206,7 @@ function connectorClass(index: number) {
}
.approval-flow-connector.is-done {
background: linear-gradient(90deg, #10b981, #34d399);
background: linear-gradient(90deg, #1ca851, #49be78);
}
.approval-flow-connector.is-done::after {
@@ -216,8 +216,8 @@ function connectorClass(index: number) {
top: -3px;
width: 8px;
height: 8px;
border-top: 2px solid #10b981;
border-right: 2px solid #10b981;
border-top: 2px solid #1ca851;
border-right: 2px solid #1ca851;
transform: rotate(45deg);
}
</style>
@@ -139,10 +139,10 @@ const sortedItems = computed(() =>
}
.approval-history-circle.is-approved {
border-color: var(--success, #10b981);
background: linear-gradient(135deg, #10b981, #059669);
border-color: var(--success, #1ca851);
background: linear-gradient(135deg, #1ca851, #168f45);
color: #fff;
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
box-shadow: 0 2px 8px rgba(28, 168, 81, 0.25);
}
.approval-history-circle.is-rejected {
@@ -152,9 +152,9 @@ const sortedItems = computed(() =>
}
.approval-history-circle.is-pending {
border-color: var(--primary, #10b981);
border-color: var(--primary, #1ca851);
background: #fff;
color: var(--primary, #10b981);
color: var(--primary, #1ca851);
}
.approval-status-icon {
@@ -11,7 +11,7 @@
@change="handleAttachmentChange"
>
<div class="upload-card">
<el-icon :size="28" color="#10b981"><Plus /></el-icon>
<el-icon :size="28" color="#1ca851"><Plus /></el-icon>
<span class="upload-card-text">上传附件</span>
</div>
</el-upload>
@@ -1,7 +1,7 @@
<!-- 系统logo -->
<template>
<div class="flex-cc">
<img :style="logoStyle" src="/logo.gif" alt="山峡化工" class="block object-contain" />
<img :style="logoStyle" :src="src" alt="山峡化工" class="block object-contain" />
</div>
</template>
@@ -11,10 +11,13 @@
interface Props {
/** logo 大小 */
size?: number | string
/** logo 图片路径 */
src?: string
}
const props = withDefaults(defineProps<Props>(), {
size: 36
size: 36,
src: '/logo.gif'
})
const logoStyle = computed(() => {
@@ -0,0 +1,28 @@
<!-- 列表序号列:有分页时连续编号,无分页时从 1 递增 -->
<script setup lang="ts">
const props = withDefaults(
defineProps<{
page?: number
pageSize?: number
}>(),
{
page: 1,
pageSize: 10
}
)
function resolveIndex(index: number) {
return (props.page - 1) * props.pageSize + index + 1
}
</script>
<template>
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="resolveIndex"
/>
</template>
@@ -111,14 +111,21 @@
<style scoped lang="scss">
.user-avatar-wrapper {
cursor: pointer;
display: inline-flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
margin-right: 5px;
background-color: #fff;
line-height: 0;
cursor: pointer;
border-radius: 50%;
padding: 2px;
&:hover {
opacity: 0.8;
opacity: 0.85;
}
:deep(.el-avatar) {
display: block;
}
}
@@ -19,6 +19,7 @@
:item="item"
:isMobile="false"
:level="0"
:show-icon="showIcon"
/>
</ElMenu>
</div>
@@ -37,12 +38,15 @@
interface Props {
/** 菜单列表数据 */
list: AppRouteRecord[]
/** 是否展示菜单图标 */
showIcon?: boolean
}
const route = useRoute()
const props = withDefaults(defineProps<Props>(), {
list: () => []
list: () => [],
showIcon: true
})
/**
@@ -1,7 +1,12 @@
<template>
<ElSubMenu v-if="hasChildren" :index="item.path || item.meta.title" class="!p-0">
<template #title>
<ArtSvgIcon :icon="item.meta.icon" :color="theme?.iconColor" class="mr-1 text-lg" />
<ArtSvgIcon
v-if="showIcon"
:icon="item.meta.icon"
:color="theme?.iconColor"
class="mr-1 text-lg"
/>
<span class="text-md">{{ formatMenuTitle(item.meta.title) }}</span>
<div v-if="item.meta.showBadge" class="art-badge art-badge-horizontal" />
<div v-if="item.meta.showTextBadge" class="art-text-badge">
@@ -17,6 +22,7 @@
:theme="theme"
:is-mobile="isMobile"
:level="level + 1"
:show-icon="showIcon"
@close="closeMenu"
/>
</ElSubMenu>
@@ -27,6 +33,7 @@
@click="goPage(item)"
>
<ArtSvgIcon
v-if="showIcon"
:icon="item.meta.icon"
:color="theme?.iconColor"
class="mr-1 text-lg"
@@ -63,6 +70,10 @@
level: {
type: Number,
default: 0
},
showIcon: {
type: Boolean,
default: true
}
})
@@ -178,7 +178,7 @@
overflow: hidden;
line-height: normal;
cursor: pointer;
background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
background: linear-gradient(135deg, #1ca851 0%, #49be78 100%);
border-bottom: none !important;
.header-brand {
@@ -215,7 +215,7 @@ $popup-menu-radius: 6px;
.el-menu--collapse {
.el-sub-menu.is-active {
.el-sub-menu__title {
background-color: var(--primary, #10b981);
background-color: var(--primary, #1ca851);
.menu-icon {
.art-svg-icon {
@@ -226,7 +226,7 @@ $popup-menu-radius: 6px;
}
.el-menu-item.is-active {
background-color: var(--primary, #10b981);
background-color: var(--primary, #1ca851);
color: #fff !important;
span,
@@ -240,7 +240,7 @@ $popup-menu-radius: 6px;
// ---------------------- Design theme menu ----------------------
.el-menu-design {
@include theme-menu-base;
@include menu-active(#fff, var(--primary, #10b981), #fff);
@include menu-active(#fff, var(--primary, #1ca851), #fff);
@include menu-hover($hover-bg-color);
.el-menu-item,
@@ -274,7 +274,7 @@ $popup-menu-radius: 6px;
}
.el-menu-item.is-active {
background-color: var(--primary, #10b981);
background-color: var(--primary, #1ca851);
color: #fff !important;
font-weight: 600;
@@ -322,7 +322,7 @@ $popup-menu-radius: 6px;
.el-menu--popup {
.el-menu-item.is-active {
color: #fff !important;
background-color: var(--primary, #10b981) !important;
background-color: var(--primary, #1ca851) !important;
span,
.menu-name,
@@ -17,7 +17,7 @@
<RouterView v-if="isRefresh" v-slot="{ Component, route }" :style="contentStyle">
<!-- 缓存路由动画 -->
<Transition :name="showTransitionMask ? '' : actualTransition" mode="out-in" appear>
<KeepAlive :max="10" :exclude="keepAliveExclude">
<KeepAlive :max="keepAliveMax" :exclude="keepAliveExclude">
<component
class="art-page-view"
:is="Component"
@@ -59,9 +59,11 @@
const route = useRoute()
const { containerMinHeight } = useAutoLayoutHeight()
const { pageTransition, containerWidth, refresh } = storeToRefs(useSettingStore())
const { pageTransition, containerWidth, refresh, showWorkTab } = storeToRefs(useSettingStore())
const { keepAliveExclude } = storeToRefs(useWorktabStore())
const keepAliveMax = computed(() => (showWorkTab.value ? 10 : 1))
const isRefresh = shallowRef(true)
const isOpenRouteInfo = import.meta.env.VITE_OPEN_ROUTE_INFO
const showTransitionMask = ref(false)
@@ -2,17 +2,24 @@
<template>
<header class="portal-header">
<div class="portal-header-brand" @click="toHome">
<ArtLogo class="portal-header-logo" />
<ArtLogo class="portal-header-logo" src="/logo-sx.svg" :size="38" />
<p class="portal-header-title">{{ AppConfig.systemInfo.name }}</p>
</div>
<ArtPortalTopNav class="portal-header-nav" />
<div class="portal-header-nav">
<ArtPortalModuleSelect />
<ArtPortalSubNav class="portal-header-sub-nav" />
</div>
<div class="portal-header-actions">
<ArtPortalMobileMenu />
<ArtIconButton
v-if="shouldShowFullscreen"
icon="fullscreen"
:class="[!isFullscreen ? 'full-screen-btn' : 'exit-full-screen-btn']"
:class="[
'portal-header-icon-btn',
!isFullscreen ? 'full-screen-btn' : 'exit-full-screen-btn'
]"
class="max-md:!hidden"
@click="toggleFullScreen"
/>
@@ -55,8 +62,8 @@
height: 56px;
padding: 0 var(--mint-content-padding, 24px);
user-select: none;
background: var(--mint-surface, #fff);
border-bottom: 1px solid var(--mint-border, #d9e8e2);
background: var(--mint-primary, #1ca851);
border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.portal-header-brand {
@@ -64,10 +71,10 @@
flex-shrink: 0;
gap: 12px;
align-items: center;
margin-right: 12px;
margin-right: 4px;
padding-right: 16px;
cursor: pointer;
border-right: 1px solid var(--mint-border, #d9e8e2);
border-right: 1px solid rgba(255, 255, 255, 0.22);
}
.portal-header-logo {
@@ -75,19 +82,26 @@
}
.portal-header-title {
max-width: 180px;
max-width: 240px;
margin: 0;
font-size: 16px;
font-weight: 700;
line-height: 1.35;
color: var(--mint-text, #1e293b);
white-space: normal;
color: #fff;
white-space: nowrap;
}
.portal-header-nav {
display: flex;
flex: 1;
gap: 12px;
align-items: center;
min-width: 0;
}
.portal-header-sub-nav {
flex: 1;
min-width: 0;
margin-left: 8px;
}
.portal-header-actions {
@@ -96,6 +110,90 @@
gap: 8px;
align-items: center;
}
:deep(.portal-module-select-trigger) {
background: rgba(255, 255, 255, 0.12);
border-color: rgba(255, 255, 255, 0.28);
.portal-module-select-trigger__icon,
.portal-module-select-trigger__label,
.portal-module-select-trigger__arrow {
color: #fff;
}
&:hover:not(.is-disabled) {
background: rgba(255, 255, 255, 0.18);
border-color: rgba(255, 255, 255, 0.45);
}
}
:deep(.portal-sub-nav-card__icon),
:deep(.portal-sub-nav-card__label) {
color: rgba(255, 255, 255, 0.88);
}
:deep(.portal-sub-nav-menu > .el-sub-menu .el-sub-menu__icon-arrow) {
color: rgba(255, 255, 255, 0.88);
}
:deep(.portal-sub-nav-menu > .el-sub-menu.el-sub-menu__hide-arrow .el-sub-menu__title) {
color: #fff !important;
}
:deep(.portal-sub-nav-menu > .el-sub-menu.el-sub-menu__hide-arrow .el-sub-menu__icon-more),
:deep(.portal-sub-nav-menu > .el-sub-menu.el-sub-menu__hide-arrow .el-icon) {
color: #fff !important;
}
:deep(.portal-sub-nav-menu > .el-sub-menu.el-sub-menu__hide-arrow:hover .el-sub-menu__title) {
background: rgba(255, 255, 255, 0.14) !important;
border-radius: 8px;
}
:deep(.portal-sub-nav-menu > .el-menu-item:hover .portal-sub-nav-card),
:deep(.portal-sub-nav-menu > .el-sub-menu:hover .portal-sub-nav-card) {
background: rgba(255, 255, 255, 0.14);
}
:deep(.portal-sub-nav-menu > .el-menu-item.is-active .portal-sub-nav-card),
:deep(.portal-sub-nav-menu > .el-sub-menu.is-active .portal-sub-nav-card) {
background: #fff;
.portal-sub-nav-card__icon,
.portal-sub-nav-card__label {
color: var(--mint-primary, #1ca851);
}
}
:deep(.portal-mobile-menu-trigger) {
color: #fff;
background: rgba(255, 255, 255, 0.12);
border-color: rgba(255, 255, 255, 0.28);
&:hover {
color: #fff;
background: rgba(255, 255, 255, 0.18);
border-color: rgba(255, 255, 255, 0.45);
}
}
:deep(.portal-header-icon-btn) {
color: #fff !important;
&:hover {
background: rgba(255, 255, 255, 0.14) !important;
}
}
@media only screen and (width <= 800px) {
.portal-header-title {
display: none;
}
.portal-header-sub-nav {
display: none !important;
}
}
</style>
<style lang="scss" scoped>
@@ -0,0 +1,106 @@
<!-- 门户窄屏菜单抽屉(≤800px) -->
<template>
<div class="portal-mobile-menu">
<ElButton class="portal-mobile-menu-trigger" @click="drawerVisible = true">
<ElIcon><Menu /></ElIcon>
<span>菜单</span>
</ElButton>
<ElDrawer
v-model="drawerVisible"
title="功能菜单"
direction="ltr"
size="280px"
:modal-class="'portal-mobile-menu-mask'"
class="portal-mobile-menu-drawer"
append-to-body
>
<ElScrollbar v-if="subMenuList.length">
<ElMenu
:default-active="routerPath"
class="portal-mobile-menu-tree"
@select="handleMenuSelect"
>
<SidebarSubmenu
:list="subMenuList"
:is-mobile="true"
:level="1"
@close="drawerVisible = false"
/>
</ElMenu>
</ElScrollbar>
<p v-else class="portal-mobile-menu-empty">当前模块暂无可用菜单</p>
</ElDrawer>
</div>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue'
import { Menu } from '@element-plus/icons-vue'
import { useRoute } from 'vue-router'
import { storeToRefs } from 'pinia'
import { useMenuStore } from '@/store/modules/menu'
import { filterSidebarRoutes } from '@/utils/router/sidebar-menu-filter'
import { resolvePortalSubMenus } from '@/utils/router/portal-menu'
import SidebarSubmenu from '../art-menus/art-sidebar-menu/widget/SidebarSubmenu.vue'
import type { AppRouteRecord } from '@/types/router'
defineOptions({ name: 'ArtPortalMobileMenu' })
const route = useRoute()
const menuStore = useMenuStore()
const { menuList } = storeToRefs(menuStore)
const drawerVisible = ref(false)
const currentRoutePath = computed(() => String(route.meta.activePath || route.path))
const routerPath = computed(() => currentRoutePath.value)
const subMenuList = computed<AppRouteRecord[]>(() => {
const raw = resolvePortalSubMenus(menuList.value, currentRoutePath.value)
return filterSidebarRoutes(raw)
})
const handleMenuSelect = (): void => {
drawerVisible.value = false
}
</script>
<style lang="scss" scoped>
.portal-mobile-menu {
display: none;
flex-shrink: 0;
}
.portal-mobile-menu-trigger {
display: inline-flex;
gap: 6px;
align-items: center;
height: 36px;
padding: 0 12px;
font-size: 14px;
border-radius: 8px;
}
.portal-mobile-menu-empty {
margin: 0;
font-size: 14px;
color: var(--mint-text-muted, #64748b);
}
:deep(.portal-mobile-menu-tree) {
border-right: none;
}
@media only screen and (width <= 800px) {
.portal-mobile-menu {
display: block;
}
}
</style>
<style lang="scss">
.portal-mobile-menu-mask {
backdrop-filter: none !important;
}
</style>
@@ -0,0 +1,185 @@
<!-- 门户顶栏一级模块下拉 -->
<template>
<div class="portal-module-select">
<ElDropdown
v-if="moduleList.length"
trigger="click"
popper-class="portal-module-select-popper"
@command="handleModuleSelect"
>
<button type="button" class="portal-module-select-trigger">
<ArtSvgIcon
v-if="activeModule?.meta?.icon"
:icon="activeModule.meta.icon"
class="portal-module-select-trigger__icon"
/>
<span class="portal-module-select-trigger__label">{{ triggerLabel }}</span>
<ElIcon class="portal-module-select-trigger__arrow"><ArrowDown /></ElIcon>
</button>
<template #dropdown>
<ElDropdownMenu>
<ElDropdownItem
v-for="item in moduleList"
:key="item.path"
:command="item.path"
:class="{ 'is-active': item.isActive }"
>
<ArtSvgIcon
v-if="item.meta.icon"
:icon="item.meta.icon"
class="portal-module-select-item__icon"
/>
<span>{{ item.formattedTitle }}</span>
</ElDropdownItem>
</ElDropdownMenu>
</template>
</ElDropdown>
<button v-else type="button" class="portal-module-select-trigger is-disabled" disabled>
<span class="portal-module-select-trigger__label">暂无可用模块</span>
</button>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { ArrowDown } from '@element-plus/icons-vue'
import { useRoute, useRouter } from 'vue-router'
import { storeToRefs } from 'pinia'
import { formatMenuTitle } from '@/utils/router'
import { useMenuStore } from '@/store/modules/menu'
import {
filterPortalTopModules,
getFirstAccessiblePath,
isPortalModuleActive,
PORTAL_DEFAULT_MODULE_PATH,
resolveActivePortalModule
} from '@/utils/router/portal-menu'
import type { AppRouteRecord } from '@/types/router'
defineOptions({ name: 'ArtPortalModuleSelect' })
interface PortalModuleItem extends AppRouteRecord {
isActive: boolean
formattedTitle: string
}
const route = useRoute()
const router = useRouter()
const menuStore = useMenuStore()
const { menuList } = storeToRefs(menuStore)
const currentRoutePath = computed(() => String(route.meta.activePath || route.path))
const moduleList = computed<PortalModuleItem[]>(() => {
return filterPortalTopModules(menuList.value).map((item) => ({
...item,
isActive: isPortalModuleActive(item, currentRoutePath.value),
formattedTitle: formatMenuTitle(item.meta.title)
}))
})
const activeModule = computed(() => {
const matched = resolveActivePortalModule(menuList.value, currentRoutePath.value)
if (matched) {
return matched
}
return moduleList.value.find((item) => item.path === PORTAL_DEFAULT_MODULE_PATH) || moduleList.value[0]
})
const triggerLabel = computed(() => {
if (activeModule.value) {
return formatMenuTitle(activeModule.value.meta.title)
}
return moduleList.value[0]?.formattedTitle || '选择模块'
})
const handleModuleSelect = (modulePath: string): void => {
const module = moduleList.value.find((item) => item.path === modulePath)
if (!module || module.isActive) {
return
}
const target = getFirstAccessiblePath(module)
if (target && target !== route.path) {
router.push(target)
}
}
</script>
<style lang="scss" scoped>
.portal-module-select {
flex-shrink: 0;
}
.portal-module-select-trigger {
display: inline-flex;
gap: 6px;
align-items: center;
max-width: 180px;
height: 36px;
padding: 0 12px;
cursor: pointer;
background: var(--primary-bg, #e6f8ed);
border: 1px solid var(--mint-border, #d9e8e2);
border-radius: 8px;
transition:
background-color 0.2s ease,
border-color 0.2s ease;
&__icon {
flex-shrink: 0;
font-size: 18px;
color: var(--primary, #1ca851);
}
&__label {
overflow: hidden;
text-overflow: ellipsis;
font-size: 15px;
font-weight: 600;
line-height: 1.2;
color: var(--mint-text, #1e293b);
white-space: nowrap;
}
&__arrow {
flex-shrink: 0;
font-size: 14px;
color: var(--mint-text-muted, #64748b);
}
&:hover:not(.is-disabled) {
border-color: var(--primary, #1ca851);
}
&.is-disabled {
cursor: not-allowed;
background: var(--mint-bg-page, #f8fafc);
}
}
</style>
<style lang="scss">
.portal-module-select-popper.el-popper {
backdrop-filter: none;
}
.portal-module-select-popper {
.el-dropdown-menu__item {
display: flex;
gap: 8px;
align-items: center;
font-size: 15px;
&.is-active {
color: var(--primary, #1ca851);
background: var(--primary-bg, #e6f8ed);
}
}
.portal-module-select-item__icon {
flex-shrink: 0;
font-size: 16px;
}
}
</style>
@@ -0,0 +1,225 @@
<!-- 门户顶栏二三级水平菜单(上图标、下标题) -->
<template>
<div v-show="subMenuList.length" class="portal-sub-nav">
<ElMenu
mode="horizontal"
:ellipsis="true"
:default-active="routerPath"
background-color="transparent"
:show-timeout="50"
:hide-timeout="50"
popper-class="portal-sub-nav-popper"
class="portal-sub-nav-menu"
>
<PortalSubmenu
v-for="(item, index) in subMenuList"
:key="`${item.path || item.meta.title}-${index}`"
:item="item"
:level="2"
/>
</ElMenu>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { useRoute } from 'vue-router'
import { storeToRefs } from 'pinia'
import { useMenuStore } from '@/store/modules/menu'
import { filterSidebarRoutes } from '@/utils/router/sidebar-menu-filter'
import { resolvePortalSubMenus } from '@/utils/router/portal-menu'
import PortalSubmenu from './widget/PortalSubmenu.vue'
import type { AppRouteRecord } from '@/types/router'
defineOptions({ name: 'ArtPortalSubNav' })
const route = useRoute()
const menuStore = useMenuStore()
const { menuList } = storeToRefs(menuStore)
const currentRoutePath = computed(() => String(route.meta.activePath || route.path))
const routerPath = computed(() => currentRoutePath.value)
const subMenuList = computed<AppRouteRecord[]>(() => {
const raw = resolvePortalSubMenus(menuList.value, currentRoutePath.value)
return filterSidebarRoutes(raw)
})
</script>
<style lang="scss" scoped>
.portal-sub-nav {
flex: 1;
min-width: 0;
height: 100%;
}
.portal-sub-nav-menu {
width: 100%;
height: 56px;
border-bottom: none !important;
}
:deep(.portal-sub-nav-menu.el-menu--horizontal) {
height: 56px;
border-bottom: none;
}
:deep(.portal-sub-nav-menu > .el-menu-item),
:deep(.portal-sub-nav-menu > .el-sub-menu .el-sub-menu__title) {
display: flex !important;
align-items: center;
justify-content: center;
height: 56px !important;
padding: 0 6px !important;
margin: 0 2px;
line-height: normal !important;
background-color: transparent !important;
border-bottom: none !important;
border-radius: 8px;
}
:deep(.portal-sub-nav-menu > .el-menu-item:hover),
:deep(.portal-sub-nav-menu > .el-sub-menu:hover > .el-sub-menu__title),
:deep(.portal-sub-nav-menu > .el-sub-menu .el-sub-menu__title:hover) {
background-color: transparent !important;
}
:deep(.portal-sub-nav-menu > .el-sub-menu .el-sub-menu__title) {
padding-right: 22px !important;
}
:deep(.portal-sub-nav-menu > .el-sub-menu .el-sub-menu__icon-arrow) {
right: 4px;
margin-top: 0;
font-size: 12px;
}
:deep(.portal-sub-nav-card) {
position: relative;
display: inline-flex;
flex-direction: column;
gap: 2px;
align-items: center;
justify-content: center;
min-width: 56px;
min-height: 48px;
padding: 4px 10px;
border-radius: 8px;
transition:
background-color 0.2s ease,
color 0.2s ease;
}
:deep(.portal-sub-nav-card__icon) {
flex-shrink: 0;
font-size: 20px;
line-height: 1;
color: var(--mint-text-muted, #64748b);
}
:deep(.portal-sub-nav-card__label) {
font-size: 14px;
line-height: 1.3;
color: var(--mint-text-muted, #64748b);
text-align: center;
white-space: nowrap;
}
:deep(.portal-sub-nav-menu > .el-menu-item:hover .portal-sub-nav-card),
:deep(.portal-sub-nav-menu > .el-sub-menu:hover .portal-sub-nav-card) {
background: var(--primary-bg, #e6f8ed);
}
:deep(.portal-sub-nav-menu > .el-menu-item.is-active .portal-sub-nav-card) {
background: var(--primary, #1ca851);
.portal-sub-nav-card__icon,
.portal-sub-nav-card__label {
color: #fff;
font-weight: 600;
}
}
:deep(.portal-sub-nav-menu > .el-sub-menu.is-active .portal-sub-nav-card) {
background: var(--primary, #1ca851);
.portal-sub-nav-card__icon,
.portal-sub-nav-card__label {
color: #fff;
font-weight: 600;
}
}
:deep(.portal-sub-nav-menu > .el-menu-item.is-active),
:deep(.portal-sub-nav-menu > .el-sub-menu.is-active .el-sub-menu__title) {
background: transparent !important;
border-bottom: none !important;
}
</style>
<style lang="scss">
.portal-sub-nav-popper.el-popper {
backdrop-filter: none;
}
.portal-sub-nav-popper {
.el-menu-item,
.el-sub-menu__title {
background-color: transparent !important;
}
.el-menu-item:hover,
.el-sub-menu__title:hover {
background-color: transparent !important;
}
.el-menu-item {
display: flex;
align-items: center;
justify-content: center;
height: auto !important;
min-height: 56px;
padding: 4px 8px !important;
line-height: normal !important;
}
.portal-sub-nav-card {
display: inline-flex;
flex-direction: column;
gap: 2px;
align-items: center;
justify-content: center;
min-width: 56px;
padding: 6px 12px;
border-radius: 8px;
}
.portal-sub-nav-card__icon {
font-size: 20px;
line-height: 1;
color: var(--mint-text-muted, #64748b);
}
.portal-sub-nav-card__label {
font-size: 14px;
line-height: 1.3;
color: var(--mint-text-muted, #64748b);
text-align: center;
white-space: nowrap;
}
.el-menu-item:hover .portal-sub-nav-card {
background: var(--primary-bg, #e6f8ed);
}
.el-menu-item.is-active .portal-sub-nav-card {
background: var(--primary, #1ca851);
.portal-sub-nav-card__icon,
.portal-sub-nav-card__label {
color: #fff;
font-weight: 600;
}
}
}
</style>
@@ -0,0 +1,83 @@
<template>
<ElSubMenu
v-if="hasChildren"
:index="item.path || item.meta.title"
popper-class="portal-sub-nav-popper"
class="portal-sub-nav-submenu"
>
<template #title>
<div class="portal-sub-nav-card">
<ArtSvgIcon
:icon="menuIcon"
class="portal-sub-nav-card__icon"
/>
<span class="portal-sub-nav-card__label">{{ formatMenuTitle(item.meta.title) }}</span>
<div v-if="item.meta.showBadge" class="art-badge" />
</div>
</template>
<PortalSubmenu
v-for="(child, index) in filteredChildren"
:key="getUniqueKey(child, index)"
:item="child"
:level="level + 1"
/>
</ElSubMenu>
<ElMenuItem
v-else-if="isNavigableRoute"
:index="item.path || item.meta.title"
class="portal-sub-nav-menuitem"
@click="goPage(item)"
>
<div class="portal-sub-nav-card">
<ArtSvgIcon
:icon="menuIcon"
class="portal-sub-nav-card__icon"
/>
<span class="portal-sub-nav-card__label">{{ formatMenuTitle(item.meta.title) }}</span>
<div v-if="item.meta.showBadge" class="art-badge" />
<div v-if="item.meta.showTextBadge" class="art-text-badge">
{{ item.meta.showTextBadge }}
</div>
</div>
</ElMenuItem>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import type { AppRouteRecord } from '@/types/router'
import { formatMenuTitle } from '@/utils/router'
import { filterSidebarRoutes, isSidebarNavigableRoute } from '@/utils/router/sidebar-menu-filter'
import { resolveSidebarMenuIcon } from '@/utils/router/menu-icon'
import { handleMenuJump } from '@/utils/navigation'
defineOptions({ name: 'PortalSubmenu' })
interface Props {
item: AppRouteRecord
level?: number
}
const props = withDefaults(defineProps<Props>(), {
level: 2
})
const filteredChildren = computed(() => filterSidebarRoutes(props.item.children || []))
const hasChildren = computed(() => filteredChildren.value.length > 0)
const isNavigableRoute = computed(() => isSidebarNavigableRoute(props.item))
const menuIcon = computed(() =>
resolveSidebarMenuIcon(props.item, hasChildren.value)
)
const goPage = (item: AppRouteRecord): void => {
handleMenuJump(item)
}
const getUniqueKey = (item: AppRouteRecord, index: number): string => {
return `${item.path || item.meta.title || 'menu'}-${props.level}-${index}`
}
</script>
@@ -139,11 +139,11 @@
}
&:hover:not(.is-active) {
background: var(--primary-bg, #ecfdf5);
background: var(--primary-bg, #e6f8ed);
}
&.is-active {
background: var(--primary, #10b981);
background: var(--primary, #1ca851);
.portal-top-nav-card__icon,
.portal-top-nav-card__label {
@@ -1,14 +1,16 @@
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { ContainerWidthEnum } from '@/enums/appEnum'
import { ContainerWidthEnum, MenuTypeEnum } from '@/enums/appEnum'
import AppConfig from '@/config'
import { headerBarConfig } from '@/config/modules/headerBar'
import { useSettingStore } from '@/store/modules/setting'
/**
* 设置项配置选项管理
*/
export function useSettingsConfig() {
const { t } = useI18n()
const settingStore = useSettingStore()
// 标签页风格选项
const tabStyleOptions = computed(() => [
@@ -219,6 +221,14 @@ export function useSettingsConfig() {
return (
allSettings
.filter((setting) => {
// 门户严格单页:隐藏多标签与标签样式配置
if (
settingStore.menuType === MenuTypeEnum.PORTAL &&
(setting.key === 'showWorkTab' || setting.key === 'tabStyle')
) {
return false
}
// 如果设置项不依赖headerBar配置,则始终显示
if (setting.headerBarKey === null) {
return true
@@ -64,7 +64,8 @@
import { useWorktabStore } from '@/store/modules/worktab'
import { useMenuStore } from '@/store/modules/menu'
import { useUserStore } from '@/store/modules/user'
import { getFirstSecondLevelMenuPath, isWorkbenchRoute } from '@/utils/navigation/route'
import { isWorkbenchRoute } from '@/utils/navigation/route'
import { getPortalDefaultHomePath, getPortalDefaultPathForRoute } from '@/utils/router/portal-menu'
import { formatMenuTitle } from '@/utils/router'
import { useSettingStore } from '@/store/modules/setting'
import { MenuItemType } from '../../others/art-menu-right/index.vue'
@@ -344,9 +345,15 @@
}
}
/** 标签全部关闭后,导航到侧栏第一个二级菜单 */
/** 标签全部关闭后,导航到当前模块第一个二级菜单 */
const navigateToDefaultMenuWhenEmpty = () => {
const fromMenu = getFirstSecondLevelMenuPath(menuStore.menuList as AppRouteRecord[])
const currentPath = String(route.meta.activePath || route.path)
const fromModule = getPortalDefaultPathForRoute(
menuStore.menuList as AppRouteRecord[],
currentPath
)
const fromMenu =
fromModule || getPortalDefaultHomePath(menuStore.menuList as AppRouteRecord[])
const home = useCommon().homePath.value
const fallbackPath = fromMenu || (home && !isWorkbenchRoute(home) ? home : '')
if (fallbackPath && route.path !== fallbackPath) {
@@ -123,7 +123,7 @@
right: -80px;
width: 360px;
height: 360px;
background: rgba(16, 185, 129, 0.18);
background: rgba(28, 168, 81, 0.18);
}
.exception-page__blob--2 {