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

+42 -17
View File
@@ -179,14 +179,26 @@
</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('productName')"
@@ -213,17 +225,6 @@
<PlPlanListProductCell :products="row.products" field="spec" />
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('productQty')"
label="数量"
min-width="90"
align="right"
header-align="right"
>
<template #default="{ row }">
<PlPlanListProductCell :products="row.products" field="qty" />
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('productUnit')"
label="单位"
@@ -235,6 +236,28 @@
<PlPlanListProductCell :products="row.products" field="unit" />
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('productPlanQty')"
label="计划数量"
min-width="100"
align="right"
header-align="right"
>
<template #default="{ row }">
<PlPlanListProductCell :products="row.products" field="planQty" />
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('productActualQty')"
label="实际数量"
min-width="100"
align="right"
header-align="right"
>
<template #default="{ row }">
<PlPlanListProductCell :products="row.products" field="actualQty" />
</template>
</el-table-column>
<el-table-column v-if="isColumnVisible('planAttachments')" label="计划附件" min-width="200">
<template #default="{ row }">
<PlPlanListCertCell :products="row.products" compact hide-product />
@@ -368,11 +391,13 @@ const listColumnDefs = [
{ prop: 'archiveStatus', label: '归档状态' },
{ prop: 'followStatus', label: '跟进状态' },
{ prop: 'planType', label: '单据类型' },
{ prop: 'customerName', label: '客户名称' },
{ prop: 'supplierName', label: '供方' },
{ prop: 'customerName', label: '需方' },
{ prop: 'productName', label: '产品名称' },
{ prop: 'productSpec', label: '型号/规格' },
{ prop: 'productQty', label: '数量' },
{ prop: 'productUnit', label: '单位' },
{ prop: 'productPlanQty', label: '计划数量' },
{ prop: 'productActualQty', label: '实际数量' },
{ prop: 'planAttachments', label: '计划附件' },
{ prop: 'licensePlate', label: '车牌号' },
{ prop: 'personnelSummary', label: '人员' },
+60 -35
View File
@@ -167,7 +167,7 @@
header-align="center"
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column prop="planNo" label="计划编号" min-width="180" show-overflow-tooltip>
<el-table-column prop="planNo" label="计划编号" min-width="150" show-overflow-tooltip>
<template #default="{ row }">
<el-link type="primary" @click="handleView(row)">{{ row.planNo }}</el-link>
</template>
@@ -180,14 +180,26 @@
align="center"
/>
<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('planType')"
@@ -202,6 +214,19 @@
</el-tag>
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('followStatus')"
prop="followStatus"
label="跟进状态"
min-width="100"
align="center"
>
<template #default="{ row }">
<el-tag :type="getPlPlanFollowStatusTagType(row.followStatus)" size="small">
{{ getPlPlanFollowStatusLabel(row.followStatus) }}
</el-tag>
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('hazardCertReady')"
label="证书齐备"
@@ -217,7 +242,7 @@
<el-table-column
v-if="isColumnVisible('productName')"
label="产品名称"
min-width="240"
min-width="160"
align="left"
header-align="left"
class-name="col-name-wrap"
@@ -230,7 +255,7 @@
<el-table-column
v-if="isColumnVisible('productSpec')"
label="型号/规格"
min-width="120"
min-width="96"
align="center"
header-align="center"
show-overflow-tooltip
@@ -239,21 +264,10 @@
<PlPlanListProductCell :products="row.products" field="spec" />
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('productQty')"
label="数量"
min-width="90"
align="right"
header-align="right"
>
<template #default="{ row }">
<PlPlanListProductCell :products="row.products" field="qty" />
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('productUnit')"
label="单位"
min-width="80"
min-width="64"
align="center"
header-align="center"
>
@@ -261,6 +275,28 @@
<PlPlanListProductCell :products="row.products" field="unit" />
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('productPlanQty')"
label="计划数量"
min-width="88"
align="right"
header-align="right"
>
<template #default="{ row }">
<PlPlanListProductCell :products="row.products" field="planQty" />
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('productActualQty')"
label="实际数量"
min-width="88"
align="right"
header-align="right"
>
<template #default="{ row }">
<PlPlanListProductCell :products="row.products" field="actualQty" />
</template>
</el-table-column>
<el-table-column v-if="isColumnVisible('planAttachments')" label="计划附件" min-width="280">
<template #default="{ row }">
<PlPlanListCertCell
@@ -273,19 +309,6 @@
/>
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('followStatus')"
prop="followStatus"
label="跟进状态"
min-width="100"
align="center"
>
<template #default="{ row }">
<el-tag :type="getPlPlanFollowStatusTagType(row.followStatus)" size="small">
{{ getPlPlanFollowStatusLabel(row.followStatus) }}
</el-tag>
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('licensePlate')"
prop="licensePlate"
@@ -431,15 +454,17 @@ const planList = ref<Plan[]>([])
const listColumnDefs = [
{ prop: 'planDate', label: '计划日期' },
{ prop: 'customerName', label: '客户名称' },
{ prop: 'supplierName', label: '供方' },
{ prop: 'customerName', label: '需方' },
{ prop: 'planType', label: '单据类型' },
{ prop: 'followStatus', label: '跟进状态' },
{ prop: 'hazardCertReady', label: '证书齐备' },
{ prop: 'productName', label: '产品名称' },
{ prop: 'productSpec', label: '型号/规格' },
{ prop: 'productQty', label: '数量' },
{ prop: 'productUnit', label: '单位' },
{ prop: 'productPlanQty', label: '计划数量' },
{ prop: 'productActualQty', label: '实际数量' },
{ prop: 'planAttachments', label: '计划附件' },
{ prop: 'followStatus', label: '跟进状态' },
{ prop: 'licensePlate', label: '车牌号' },
{ prop: 'personnelSummary', label: '人员' },
{ prop: 'followUserName', label: '跟进人', defaultVisible: false }
+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>
+418 -155
View File
@@ -1,76 +1,116 @@
<template>
<div class="portal-home">
<div class="portal-home-hero">
<div>
<h3>{{ greetText }},{{ displayName }}</h3>
<p>{{ dateText }} · 点击卡片进入业务,星标加入收藏</p>
<div v-if="modules.length" class="portal-home-shell">
<aside class="portal-home-aside" aria-label="一级菜单">
<button
type="button"
class="portal-home-aside__item"
:class="{ 'is-on': isFavView }"
@click="activeModule = FAV_KEY"
>
<span>收藏</span>
<span class="n">{{ favoriteList.length }}</span>
</button>
<button
v-for="mod in modules"
:key="mod.modulePath"
type="button"
class="portal-home-aside__item"
:class="{ 'is-on': activeModule === mod.modulePath }"
@click="activeModule = mod.modulePath"
>
<span>{{ mod.moduleTitle }}</span>
<span class="n">{{ mod.cards.length }}</span>
</button>
</aside>
<div class="portal-home-panel">
<header class="portal-home-panel__head">
<div>
<h2 class="portal-home-panel__title">{{ panelTitle }}</h2>
<p class="portal-home-panel__desc">{{ panelDesc }}</p>
</div>
<span class="portal-home-panel__count">{{ panelCount }} 项</span>
</header>
<section v-if="isFavView" class="portal-home-block portal-home-block--fav">
<VueDraggable
v-if="favoriteList.length"
v-model="favoriteList"
class="portal-home-grid"
ghost-class="portal-home-card--ghost"
chosen-class="portal-home-card--chosen"
:animation="180"
@start="onFavDragStart"
@end="onFavDragEnd"
>
<button
v-for="card in favoriteList"
:key="'fav-' + card.path"
type="button"
class="portal-home-card portal-home-card--fav"
@click="onFavCardClick(card.path)"
>
<span class="portal-home-card__badge portal-home-card__badge--fav" aria-hidden="true">
{{ titleAbbr(card.title) }}
</span>
<span class="portal-home-card__body">
<span class="portal-home-card__title">{{ card.title }}</span>
<span class="portal-home-card__sub">{{ favSubTitle(card.path) }}</span>
</span>
<button
type="button"
class="portal-home-card__star is-on"
aria-label="取消收藏"
@click.stop="onToggleStar(card.path)"
>
<ElIcon><StarFilled /></ElIcon>
</button>
</button>
</VueDraggable>
<p v-else class="portal-home-empty">暂无收藏,可在各模块菜单卡片上点星标添加</p>
</section>
<section v-else class="portal-home-block">
<div class="portal-home-grid">
<button
v-for="card in activeCards"
:key="card.path"
type="button"
class="portal-home-card"
@click="openCard(card.path)"
>
<span
class="portal-home-card__badge"
:data-tone="toneIndex(activeModule)"
aria-hidden="true"
>
{{ titleAbbr(card.title) }}
</span>
<span class="portal-home-card__body">
<span class="portal-home-card__title">{{ card.title }}</span>
<span class="portal-home-card__sub">{{ panelTitle }}</span>
</span>
<button
type="button"
class="portal-home-card__star"
:class="{ 'is-on': favoritePathSet.has(card.path) }"
:aria-label="favoritePathSet.has(card.path) ? '取消收藏' : '加入收藏'"
@click.stop="onToggleStar(card.path)"
>
<ElIcon>
<StarFilled v-if="favoritePathSet.has(card.path)" />
<Star v-else />
</ElIcon>
</button>
</button>
</div>
<p v-if="!activeCards.length" class="portal-home-empty">该模块暂无可用菜单</p>
</section>
</div>
</div>
<div class="portal-home-cards-area">
<section v-if="favoriteList.length" class="portal-home-section">
<div class="portal-home-section__head">
<h2 class="title-bar-heading">收藏</h2>
<span class="portal-home-section__tip">可拖拽调整顺序</span>
</div>
<VueDraggable
v-model="favoriteList"
class="portal-home-grid"
ghost-class="portal-home-card--ghost"
chosen-class="portal-home-card--chosen"
:animation="180"
@start="onFavDragStart"
@end="onFavDragEnd"
>
<button
v-for="card in favoriteList"
:key="'fav-' + card.path"
type="button"
class="portal-home-card portal-home-card--fav"
@click="onFavCardClick(card.path)"
>
<span class="portal-home-card__title">{{ card.title }}</span>
<button
type="button"
class="portal-home-card__star is-on"
aria-label="取消收藏"
@click.stop="onToggleStar(card.path)"
>
<ElIcon><StarFilled /></ElIcon>
</button>
</button>
</VueDraggable>
</section>
<section
v-for="sec in visibleSections"
:key="sec.modulePath"
class="portal-home-section"
>
<h2 class="title-bar-heading">{{ sec.moduleTitle }}</h2>
<div class="portal-home-grid">
<button
v-for="card in sec.cards"
:key="card.path"
type="button"
class="portal-home-card"
@click="openCard(card.path)"
>
<span class="portal-home-card__title">{{ card.title }}</span>
<button
type="button"
class="portal-home-card__star"
aria-label="收藏"
@click.stop="onToggleStar(card.path)"
>
<ElIcon><Star /></ElIcon>
</button>
</button>
</div>
</section>
<p v-if="!sections.length" class="portal-home-empty">暂无可用菜单</p>
</div>
<p v-else class="portal-home-empty portal-home-empty--page">暂无可用菜单</p>
</div>
</template>
@@ -82,7 +122,6 @@
import { VueDraggable } from 'vue-draggable-plus'
import { useMenuStore } from '@/store/modules/menu'
import { useMenuFavoriteStore } from '@/store/modules/menuFavorite'
import { useUserStore } from '@/store/modules/user'
import {
collectPortalHomeSections,
findHomeCardByPath,
@@ -91,58 +130,85 @@
defineOptions({ name: 'PortalHome' })
const FAV_KEY = '__favorites__'
const router = useRouter()
const menuStore = useMenuStore()
const favStore = useMenuFavoriteStore()
const userStore = useUserStore()
const { menuList } = storeToRefs(menuStore)
const { items: favItems } = storeToRefs(favStore)
const sections = computed(() => collectPortalHomeSections(menuList.value || []))
const favoritePathSet = computed(() => new Set(favItems.value.map((i) => i.path)))
/** 模块区隐藏已在收藏中展示的菜单,避免重复 */
const visibleSections = computed(() =>
sections.value
.map((sec) => ({
...sec,
cards: sec.cards.filter((c) => !favoritePathSet.value.has(c.path))
}))
.filter((sec) => sec.cards.length > 0)
)
const activeModule = ref(FAV_KEY)
const favoriteList = ref<PortalHomeCardItem[]>([])
const favDragging = ref(false)
const suppressFavClick = ref(false)
const modules = computed(() => collectPortalHomeSections(menuList.value || []))
const favoritePathSet = computed(() => new Set(favItems.value.map((i) => i.path)))
const isFavView = computed(() => activeModule.value === FAV_KEY)
const activeCards = computed(() => {
if (isFavView.value) return []
const sec = modules.value.find((m) => m.modulePath === activeModule.value)
return sec?.cards || []
})
const panelTitle = computed(() => {
if (isFavView.value) return '收藏'
return modules.value.find((m) => m.modulePath === activeModule.value)?.moduleTitle || ''
})
const panelDesc = computed(() =>
isFavView.value ? '可拖拽调整顺序,星标取消收藏' : '点击卡片进入功能,星标加入收藏'
)
const panelCount = computed(() =>
isFavView.value ? favoriteList.value.length : activeCards.value.length
)
const titleAbbr = (title: string) => {
const t = String(title || '').trim()
if (!t) return '?'
return t.slice(0, 1)
}
const favSubTitle = (path: string) => {
for (const sec of modules.value) {
if (sec.cards.some((c) => c.path === path)) return sec.moduleTitle
}
return '收藏入口'
}
/** 同模块稳定色相,便于扫读区分(低饱和薄荷绿系) */
const toneIndex = (modulePath: string) => {
const s = String(modulePath || '')
let h = 0
for (let i = 0; i < s.length; i++) h = (h * 31 + s.charCodeAt(i)) >>> 0
return String(h % 5)
}
const ensureActiveModule = () => {
if (activeModule.value === FAV_KEY) return
const list = modules.value
if (!list.length) {
activeModule.value = FAV_KEY
return
}
if (!list.some((m) => m.modulePath === activeModule.value)) {
activeModule.value = FAV_KEY
}
}
const syncFavoriteList = () => {
favoriteList.value = favItems.value.map(
(i) => findHomeCardByPath(sections.value, i.path) || { path: i.path, title: i.path }
(i) => findHomeCardByPath(modules.value, i.path) || { path: i.path, title: i.path }
)
}
watch([favItems, sections], syncFavoriteList, { immediate: true, deep: true })
const displayName = computed(() => {
const info = userStore.getUserInfo || ({} as Api.Auth.UserInfo)
return String(info.realName || info.userName || info.username || '').trim() || '管理员'
})
const greetText = computed(() => {
const h = new Date().getHours()
if (h < 12) return '上午好'
if (h < 18) return '下午好'
return '晚上好'
})
const dateText = computed(() =>
new Date().toLocaleDateString('zh-CN', {
month: 'long',
day: 'numeric',
weekday: 'short'
})
)
watch(modules, ensureActiveModule, { immediate: true, deep: true })
watch([favItems, modules], syncFavoriteList, { immediate: true, deep: true })
onMounted(async () => {
if (!favStore.loaded) {
@@ -187,72 +253,171 @@
<style scoped lang="scss">
.portal-home {
padding: 16px 0 24px;
display: flex;
flex-direction: column;
height: calc(var(--art-full-height, 70vh) - 24px);
min-height: 420px;
padding: 12px 0;
}
.portal-home-hero {
.portal-home-shell {
display: grid;
flex: 1;
grid-template-columns: 180px 1fr;
min-height: 0;
overflow: hidden;
background: #fff;
border: 1px solid var(--mint-border, #d9e8e2);
border-radius: 12px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.portal-home-aside {
display: flex;
flex-direction: column;
gap: 2px;
min-height: 0;
padding: 10px 8px;
overflow: auto;
background: #f8fafc;
border-right: 1px solid var(--mint-border, #d9e8e2);
}
.portal-home-aside__item {
display: flex;
gap: 8px;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 4px;
padding: 12px 14px;
border: 1px solid #bbf7d0;
border-radius: 10px;
background:
radial-gradient(100% 120% at 100% 0%, rgba(16, 185, 129, 0.14), transparent 55%),
linear-gradient(135deg, #ecfdf5 0%, #ffffff 60%, #f8fafc 100%);
width: 100%;
padding: 9px 12px;
font-size: 13px;
font-weight: 500;
color: var(--mint-text, #1e293b);
text-align: left;
cursor: pointer;
background: transparent;
border: 0;
border-radius: 8px;
transition:
background 0.15s ease,
color 0.15s ease;
h3 {
margin: 0 0 2px;
font-size: 16px;
span:first-child {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.n {
flex-shrink: 0;
font-size: 11px;
font-weight: 600;
font-variant-numeric: tabular-nums;
color: #94a3b8;
}
&:hover {
background: #eef2f7;
}
&.is-on {
font-weight: 700;
color: var(--mint-text, #1e293b);
}
color: var(--mint-primary-dark, #059669);
background: var(--mint-primary-bg, #ecfdf5);
p {
margin: 0;
font-size: 12px;
color: var(--mint-text-muted, #64748b);
.n {
color: var(--mint-primary-dark, #059669);
}
}
}
/* 卡片区:与问候条拉开,左右留白 */
.portal-home-cards-area {
margin-top: 4px;
padding: 12px 16px 8px;
.portal-home-panel {
min-height: 0;
padding: 0 0 18px;
overflow: auto;
background:
radial-gradient(80% 40% at 100% 0%, rgba(16, 185, 129, 0.06), transparent 55%), #fefefe;
}
.portal-home-section {
margin-bottom: 22px;
.portal-home-panel__head {
position: sticky;
top: 0;
z-index: 3;
display: flex;
gap: 12px;
align-items: flex-start;
justify-content: space-between;
padding: 16px 18px 12px;
background: rgba(254, 254, 254, 0.94);
border-bottom: 1px solid #eef2f0;
}
.portal-home-panel__title {
margin: 0 0 2px;
font-size: 16px;
font-weight: 700;
color: var(--mint-text, #1e293b);
letter-spacing: -0.01em;
}
.portal-home-panel__desc {
margin: 0;
font-size: 12px;
color: var(--mint-text-muted, #64748b);
}
.portal-home-panel__count {
flex-shrink: 0;
display: inline-flex;
align-items: center;
height: 26px;
padding: 0 10px;
font-size: 12px;
font-weight: 600;
font-variant-numeric: tabular-nums;
color: var(--mint-primary-dark, #059669);
background: var(--mint-primary-bg, #ecfdf5);
border: 1px solid #bbf7d0;
border-radius: 8px;
}
.portal-home-block {
margin: 0 18px 18px;
&:last-child {
margin-bottom: 4px;
}
&--fav {
margin-top: 14px;
padding: 12px 12px 14px;
background: linear-gradient(180deg, #ecfdf5 0%, #fff 72%);
border: 1px solid #bbf7d0;
border-radius: 10px;
}
}
.portal-home-section__head {
.portal-home-block__head {
display: flex;
flex-wrap: wrap;
gap: 8px;
align-items: center;
}
.portal-home-section__tip {
.portal-home-block__tip {
font-size: 12px;
font-weight: 400;
color: var(--mint-text-muted, #94a3b8);
}
/* 不在 .panel-top 内,自行补绿色竖条 */
.title-bar-heading {
position: relative;
display: inline-flex;
align-items: center;
gap: 8px;
margin: 0;
padding-left: 0;
font-size: 15px;
font-size: 14px;
font-weight: 600;
color: var(--mint-text, #1e293b);
@@ -268,23 +433,24 @@
.portal-home-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
gap: 8px;
margin-top: 12px;
grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
gap: 10px;
margin-top: 10px;
}
.portal-home-card {
position: relative;
display: flex;
gap: 10px;
align-items: center;
justify-content: center;
min-height: 56px;
padding: 12px 22px 12px 10px;
text-align: center;
min-height: 64px;
padding: 12px 34px 12px 12px;
text-align: left;
cursor: pointer;
background: #fff;
border: 1px solid var(--mint-border, #e2e8f0);
border-radius: 10px;
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
transition:
transform 0.15s ease,
box-shadow 0.15s ease,
@@ -292,10 +458,18 @@
background 0.15s ease;
&:hover {
background: var(--mint-primary-bg, #ecfdf5);
background: #fff;
border-color: #6ee7b7;
box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
box-shadow: 0 6px 16px rgba(16, 185, 129, 0.12);
transform: translateY(-1px);
.portal-home-card__badge {
transform: scale(1.04);
}
.portal-home-card__title {
color: var(--mint-primary-dark, #059669);
}
}
&:active {
@@ -304,6 +478,8 @@
&--fav {
cursor: grab;
background: #fff;
border-color: #a7f3d0;
&:active {
cursor: grabbing;
@@ -311,7 +487,6 @@
}
}
/* Sortable 幽灵节点可能无 scoped 属性 */
:deep(.portal-home-card--ghost) {
background: var(--mint-primary-bg, #ecfdf5);
border-style: dashed;
@@ -324,29 +499,89 @@
box-shadow: 0 6px 16px rgba(16, 185, 129, 0.16);
}
.portal-home-card__badge {
display: grid;
flex-shrink: 0;
place-items: center;
width: 36px;
height: 36px;
font-size: 14px;
font-weight: 700;
border-radius: 9px;
transition: transform 0.15s ease;
&[data-tone='0'] {
color: #047857;
background: #d1fae5;
}
&[data-tone='1'] {
color: #0f766e;
background: #ccfbf1;
}
&[data-tone='2'] {
color: #065f46;
background: #ecfdf5;
box-shadow: inset 0 0 0 1px #a7f3d0;
}
&[data-tone='3'] {
color: #334155;
background: #e2e8f0;
}
&[data-tone='4'] {
color: #115e59;
background: #f0fdfa;
box-shadow: inset 0 0 0 1px #99f6e4;
}
&--fav {
color: #b45309;
background: #fef3c7;
}
}
.portal-home-card__body {
display: flex;
flex: 1;
flex-direction: column;
gap: 2px;
min-width: 0;
}
.portal-home-card__title {
display: -webkit-box;
width: 100%;
overflow: hidden;
font-size: 13px;
font-weight: 600;
line-height: 1.35;
color: var(--mint-text, #1e293b);
text-align: center;
word-break: break-all;
transition: color 0.15s ease;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.portal-home-card__sub {
overflow: hidden;
font-size: 11px;
line-height: 1.3;
color: var(--mint-text-muted, #94a3b8);
text-overflow: ellipsis;
white-space: nowrap;
}
.portal-home-card__star {
position: absolute;
top: 4px;
right: 4px;
top: 6px;
right: 6px;
display: inline-flex;
align-items: center;
justify-content: center;
width: 22px;
height: 22px;
width: 24px;
height: 24px;
padding: 0;
font-size: 13px;
line-height: 1;
@@ -355,7 +590,7 @@
background: transparent;
border: 0;
border-radius: 6px;
opacity: 0.55;
opacity: 0.45;
transition:
background 0.15s ease,
color 0.15s ease,
@@ -363,7 +598,7 @@
&:hover {
color: #d97706;
background: #f1f5f9;
background: #fff7ed;
opacity: 1;
}
@@ -378,8 +613,36 @@
}
.portal-home-empty {
margin-top: 48px;
margin-top: 32px;
font-size: 13px;
color: var(--mint-text-muted, #94a3b8);
text-align: center;
&--page {
margin: 48px 0;
}
}
@media (max-width: 720px) {
.portal-home-shell {
grid-template-columns: 1fr;
}
.portal-home-aside {
flex-direction: row;
flex-wrap: wrap;
max-height: 140px;
border-right: 0;
border-bottom: 1px solid var(--mint-border, #d9e8e2);
}
.portal-home-aside__item {
width: auto;
max-width: 100%;
}
.portal-home-grid {
grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
}
}
</style>