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

+7
View File
@@ -575,3 +575,10 @@ export function fetchAttachmentDownloadUrl(data: { fileUrl: string; fileName?: s
data
})
}
export function fetchAttachmentPreviewUrl(data: { fileUrl: string; fileName?: string }) {
return request.post<{ previewUrl: string }>({
url: '/web/admin/attachment/preview-url',
data
})
}
+16 -1
View File
@@ -622,6 +622,12 @@ export interface UnsettledPlanItem {
transportCompany?: string
freightAmount: number
archiveTime?: string
transportId: string
transportNo?: string
driverName?: string
transportMedium?: string
startPoint?: string
endPoint?: string
}
export interface UnsettledPlanQuery {
@@ -740,6 +746,15 @@ export interface FreightSettlementDisburseBody {
remark?: string
}
export interface FreightSettlementUpdateBody {
invoiceNo?: string
invoiceDate?: string
invoiceAmount?: number
invoiceAttachmentUrls?: string
remark?: string
transportIds?: string[]
}
export const freightApi = {
listUnsettledPlans: (params?: UnsettledPlanQuery) =>
request.get<UnsettledPlanListResponse>('/transport/freight/unsettled-plans', { params }),
@@ -750,7 +765,7 @@ export const freightApi = {
get: (id: string) => request.get<FreightSettlement>(`/transport/freight/${id}`),
create: (data: { planIds?: string[]; transportIds?: string[] }) =>
request.post<FreightSettlement>('/transport/freight/', data),
update: (id: string, data: Partial<FreightSettlement>) =>
update: (id: string, data: FreightSettlementUpdateBody) =>
request.put<FreightSettlement>(`/transport/freight/${id}`, data),
cancel: (id: string) => request.post<FreightSettlement>(`/transport/freight/${id}/cancel`),
delete: (id: string) => request.delete(`/transport/freight/${id}`),
+20 -25
View File
@@ -396,7 +396,7 @@ body {
justify-content: center;
background: var(--mint-primary-bg);
color: var(--mint-primary-dark);
border: 1px solid rgba(16, 185, 129, 0.16);
border: 1px solid rgba(28, 168, 81, 0.16);
margin-right: 4px;
flex-shrink: 0;
}
@@ -425,7 +425,7 @@ body {
width: 4px;
height: 14px;
border-radius: 999px;
background: var(--mint-primary, #10b981);
background: var(--mint-primary, #1ca851);
flex-shrink: 0;
}
}
@@ -464,8 +464,8 @@ body {
display: inline-flex;
gap: 4px;
padding: 4px;
background: linear-gradient(180deg, var(--primary-bg, #ecfdf5) 0%, #fff 100%);
border: 1px solid #d1fae5;
background: linear-gradient(180deg, var(--primary-bg, #e6f8ed) 0%, #fff 100%);
border: 1px solid #d4f0de;
border-radius: 8px;
}
@@ -492,18 +492,18 @@ body {
box-shadow 0.15s;
&:hover:not(.is-active) {
color: #065f46;
color: #125a30;
}
&.is-active {
background: var(--primary, #10b981);
background: var(--primary, #1ca851);
color: #fff;
box-shadow: 0 1px 3px rgba(16, 185, 129, 0.28);
box-shadow: 0 1px 3px rgba(28, 168, 81, 0.28);
font-weight: 500;
&:hover {
color: #fff;
background: var(--primary, #10b981);
background: var(--primary, #1ca851);
}
}
}
@@ -524,13 +524,13 @@ body {
font-size: 11px;
font-weight: 600;
line-height: 1;
border: 2px solid #d1fae5;
border: 2px solid #d4f0de;
pointer-events: none;
box-sizing: border-box;
}
&__btn.is-active &__badge {
border-color: var(--primary, #10b981);
border-color: var(--primary, #1ca851);
}
&__badge--zero {
@@ -546,8 +546,8 @@ body {
&__btn.is-active &__badge--zero {
background: rgba(255, 255, 255, 0.92);
color: var(--primary-dark, #059669);
border-color: var(--primary, #10b981);
color: var(--primary-dark, #168f45);
border-color: var(--primary, #1ca851);
}
// el-tabs 结构
@@ -578,8 +578,8 @@ body {
gap: 4px;
float: none;
padding: 4px;
background: linear-gradient(180deg, var(--primary-bg, #ecfdf5) 0%, #fff 100%);
border: 1px solid #d1fae5;
background: linear-gradient(180deg, var(--primary-bg, #e6f8ed) 0%, #fff 100%);
border: 1px solid #d4f0de;
border-radius: 8px;
}
@@ -609,18 +609,18 @@ body {
box-shadow 0.15s;
&:hover:not(.is-active) {
color: #065f46;
color: #125a30;
}
&.is-active {
background: var(--primary, #10b981);
background: var(--primary, #1ca851);
color: #fff;
box-shadow: 0 1px 3px rgba(16, 185, 129, 0.28);
box-shadow: 0 1px 3px rgba(28, 168, 81, 0.28);
font-weight: 500;
&:hover {
color: #fff;
background: var(--primary, #10b981);
background: var(--primary, #1ca851);
}
}
}
@@ -799,7 +799,7 @@ body {
justify-content: center;
background: var(--mint-primary-bg);
color: var(--mint-primary-dark);
border: 1px solid rgba(16, 185, 129, 0.16);
border: 1px solid rgba(28, 168, 81, 0.16);
margin-right: 4px;
flex-shrink: 0;
}
@@ -1373,7 +1373,7 @@ body {
/* Portal 一体化顶栏(对齐 zkxw TOP_LEFT 顶栏 56px + Fresh Mint) */
#app-portal-header .portal-header {
background: var(--mint-surface) !important;
background: var(--mint-primary) !important;
}
.app-layout-portal #app-worktab .worktab-strip {
@@ -1381,11 +1381,6 @@ body {
padding: 0 24px 4px !important;
}
.app-layout-portal #app-sidebar .layout-sidebar {
border-right: 1px solid var(--mint-border) !important;
background: var(--mint-surface);
}
/* 弹窗 / 抽屉内键值展示:上下布局、深色正文(对齐 zkxw Token 链) */
:is(.el-dialog, .system-view-dialog, .el-drawer) {
:is(.view-kv, [class*='-view-kv']:not([class*='-grid']), .pl-plan-kv) {
@@ -7,7 +7,7 @@
'white': #ffffff,
'black': #000000,
'success': (
'base': #059669
'base': #168f45
),
'warning': (
'base': #ffae1f
+11 -11
View File
@@ -4,10 +4,10 @@
// 系统主色
--main-color: var(--mint-primary);
--el-color-primary: var(--mint-primary) !important;
--el-color-primary-light-3: #0d9d6e !important;
--el-color-primary-light-5: #34a88a !important;
--el-color-primary-light-7: #6bb99a !important;
--el-color-primary-light-8: #a8d4c4 !important;
--el-color-primary-light-3: #4db872 !important;
--el-color-primary-light-5: #73c892 !important;
--el-color-primary-light-7: #a8e0b8 !important;
--el-color-primary-light-8: #c8ecd4 !important;
--el-color-primary-light-9: var(--mint-primary-bg) !important;
--el-color-primary-dark-2: var(--mint-primary-dark) !important;
--el-border-color: var(--mint-border) !important;
@@ -785,8 +785,8 @@ body .el-table thead {
.page-container .el-tag--success,
.console-container .el-tag--success {
background: #d1fae5 !important;
color: #047857 !important;
background: #d4f0de !important;
color: #147a3c !important;
}
.page-container .el-tag--warning,
@@ -810,8 +810,8 @@ body .el-table thead {
.page-container .el-tag--primary,
.console-container .el-tag--primary {
background: #ecfdf5 !important;
color: #059669 !important;
background: #e6f8ed !important;
color: #168f45 !important;
}
.page-container .el-button--primary,
@@ -946,7 +946,7 @@ textarea::placeholder {
.console-container .el-select__wrapper.is-focused {
box-shadow:
0 0 0 1px var(--mint-primary) inset,
0 0 0 2px rgba(16, 185, 129, 0.2) !important;
0 0 0 2px rgba(28, 168, 81, 0.2) !important;
}
.page-container .btn-main.el-button,
@@ -1154,7 +1154,7 @@ textarea::placeholder {
):focus-visible {
background: var(--mint-primary-bg) !important;
border-color: var(--mint-primary) !important;
color: #047857 !important;
color: #147a3c !important;
}
.page-container
@@ -1193,7 +1193,7 @@ textarea::placeholder {
.op-warn
):focus-visible
.el-icon {
color: #047857 !important;
color: #147a3c !important;
}
// 列表分割线统一:每个分区只保留一条线
@@ -1,8 +1,8 @@
// Fresh Mint 设计令牌(与 docs/web-admin-ui-spec-fresh-mint.md 一致;Step1 对齐 zkxw 语义色)
:root {
--mint-primary: #10b981;
--mint-primary-dark: #059669;
--mint-primary-bg: #ecfdf5;
--mint-primary: #1ca851;
--mint-primary-dark: #168f45;
--mint-primary-bg: #e6f8ed;
--mint-text: #1e293b;
/* 略浅于主文字:label / 说明 / 表头等次要文字,可读且保留层次(对齐 zkxw 实践) */
--mint-text-muted: #334155;
@@ -18,10 +18,10 @@
--mint-content-padding: 24px;
/* 成功 / 启用等语义色(深一档于主色,便于与 primary Tag 区分) */
--mint-success: #059669;
--mint-success-dark: #047857;
--mint-success-bg: #d1fae5;
--mint-success-text: #047857;
--mint-success: #168f45;
--mint-success-dark: #147a3c;
--mint-success-bg: #d4f0de;
--mint-success-text: #147a3c;
--primary: var(--mint-primary);
--primary-dark: var(--mint-primary-dark);
@@ -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 {
@@ -12,7 +12,7 @@ export function sumProductActualQuantities(products: FreightCalcProductRow[]) {
if (actual != null && !Number.isNaN(Number(actual))) {
return sum + Number(actual)
}
return sum + Number(row.quantity || 0)
return sum
}, 0)
}
@@ -8,7 +8,7 @@ import type {
import { planApi } from '@/api/pl'
import DbPoundSlipQrcodeDialog from '@/components/business/db/DbPoundSlipQrcodeDialog.vue'
import { useDictStore } from '@/store/modules/dict'
import { formatDateTime } from '@/utils/format'
import { formatDate } from '@/utils/format'
import { pickBxData } from '@/utils/http/bx'
import { formatPlanProductListText } from '@/utils/pl-display'
import { buildSiteSummaryFromInventoryLinks } from '@/utils/db-site-summary'
@@ -118,7 +118,7 @@ export function usePlPlanArrangeActions() {
const lines = ['【运输安排】', `计划号:${plan.value?.planNo || '—'}`]
lines.push(`车牌:${options?.licensePlate || licensePlate.value || plan.value?.licensePlate || '—'}`)
lines.push(
`时间:${formatDateTime(plan.value?.pickupTime) || plan.value?.planDate || '—'}`
`时间:${formatDate(plan.value?.pickupTime) || plan.value?.planDate || '—'}`
)
const productText = products.value
.map(p => formatPlanProductListText(p, getUnitLabel, { usePlannedQuantity: true }))
+2 -1
View File
@@ -38,7 +38,7 @@ import { headerBarConfig } from './modules/headerBar'
const appConfig: SystemConfig = {
// 系统信息
systemInfo: {
name: '一体化门户' // 系统名称
name: '山峡化工一体化门户' // 系统名称
},
// 系统主题
systemThemeStyles: {
@@ -119,6 +119,7 @@ const appConfig: SystemConfig = {
],
// 系统主色
systemMainColor: [
'#1ca851', // 山峡品牌绿
'#1989fa', // 运营端专业蓝
'#07c160', // 成功绿
'#ff976a', // 警告橙
+2 -2
View File
@@ -51,8 +51,8 @@ export const SETTING_DEFAULT_CONFIG = {
showRefreshButton: false,
/** 是否显示面包屑 */
showCrumbs: false,
/** 是否显示工作台标签 */
showWorkTab: true,
/** 是否显示工作台标签(false = 严格单页:每次仅保留当前页面) */
showWorkTab: false,
/** 是否显示语言切换 */
showLanguage: true,
/** 是否显示进度条 */
+3 -2
View File
@@ -31,8 +31,9 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { AppRouteRecord } from '@/types/router'
import { getFirstMenuPath, getFirstSecondLevelMenuPath } from '@/utils'
import { getFirstMenuPath } from '@/utils'
import { HOME_PAGE_PATH } from '@/router'
import { getPortalDefaultHomePath } from '@/utils/router/portal-menu'
/**
* 菜单状态管理
@@ -54,7 +55,7 @@ export const useMenuStore = defineStore('menuStore', () => {
*/
const setMenuList = (list: AppRouteRecord[]) => {
menuList.value = list
setHomePath(HOME_PAGE_PATH || getFirstSecondLevelMenuPath(list) || getFirstMenuPath(list))
setHomePath(HOME_PAGE_PATH || getPortalDefaultHomePath(list) || getFirstMenuPath(list))
}
/**
+7 -1
View File
@@ -39,6 +39,7 @@ import { setElementThemeColor } from '@/utils/ui'
import { useCeremony } from '@/hooks/core/useCeremony'
import { StorageConfig } from '@/utils'
import { SETTING_DEFAULT_CONFIG } from '@/config/setting'
import { useWorktabStore } from '@/store/modules/worktab'
/**
* 系统设置状态管理
@@ -266,6 +267,9 @@ export const useSettingStore = defineStore(
*/
const setWorkTab = (show: boolean) => {
showWorkTab.value = show
if (!show) {
useWorktabStore().enforceSinglePageTabs()
}
}
/**
@@ -444,7 +448,9 @@ export const useSettingStore = defineStore(
{
persist: {
key: 'setting',
storage: localStorage
storage: localStorage,
/** 严格单页:不持久化多标签开关,避免旧配置覆盖默认 false */
omit: ['showWorkTab']
}
}
)
+58 -6
View File
@@ -45,7 +45,9 @@ import { LocationQueryRaw, Router } from 'vue-router'
import { WorkTab } from '@/types'
import { useCommon } from '@/hooks/core/useCommon'
import { useMenuStore } from '@/store/modules/menu'
import { getFirstSecondLevelMenuPath, isWorkbenchRoute } from '@/utils/navigation/route'
import { isWorkbenchRoute } from '@/utils/navigation/route'
import { getPortalDefaultHomePath, getPortalDefaultPathForRoute } from '@/utils/router/portal-menu'
import { useSettingStore } from '@/store/modules/setting'
interface WorktabState {
current: Partial<WorkTab>
@@ -111,12 +113,19 @@ export const useWorktabStore = defineStore(
}
/**
* 标签全部关闭后的默认落点:侧栏第一个二级菜单(无则回退首页路径)
* 标签全部关闭后的默认落点:当前一级模块首个二级菜单(无则回退首页路径)
*/
const resolveEmptyTabsPath = (): string => {
const menuStore = useMenuStore()
const { homePath } = useCommon()
const fromMenu = getFirstSecondLevelMenuPath(menuStore.menuList)
const currentPath = String(
router.currentRoute.value.meta.activePath || router.currentRoute.value.path
)
const fromModule = getPortalDefaultPathForRoute(menuStore.menuList, currentPath)
if (fromModule) {
return fromModule
}
const fromMenu = getPortalDefaultHomePath(menuStore.menuList)
if (fromMenu) {
return fromMenu
}
@@ -146,6 +155,30 @@ export const useWorktabStore = defineStore(
}
}
/** 严格单页:showWorkTab 为 false 时仅保留当前页面并清理缓存 */
const isSinglePageMode = (): boolean => !useSettingStore().showWorkTab
/**
* 将已打开标签压至单页(保留当前激活页,其余移出 KeepAlive)
*/
const enforceSinglePageTabs = (): void => {
if (!isSinglePageMode() || opened.value.length <= 1) {
return
}
const activePath =
current.value.path || router.currentRoute.value.meta.activePath || router.currentRoute.value.path
const activeTab =
opened.value.find((t) => t.path === activePath) ?? opened.value[opened.value.length - 1]
const toRemove = opened.value.filter((t) => t.path !== activeTab?.path)
markTabsToRemove(toRemove)
opened.value = activeTab ? [activeTab] : []
if (activeTab) {
current.value = activeTab
}
}
/**
* 打开或激活一个选项卡
*/
@@ -156,6 +189,8 @@ export const useWorktabStore = defineStore(
}
if (shouldIgnoreTab(tab)) return
const singlePage = isSinglePageMode()
// 从 keepAlive 排除列表中移除
if (tab.name) {
removeKeepAliveExclude(tab.name)
@@ -171,13 +206,21 @@ export const useWorktabStore = defineStore(
}
if (existingIndex === -1) {
const newTab = { ...tab, fixedTab: singlePage ? false : tab.fixedTab }
if (singlePage) {
markTabsToRemove(opened.value.filter((t) => t.path !== newTab.path))
opened.value = [newTab]
current.value = newTab
return
}
// 新增标签页:超出上限时淘汰最早的可关闭标签
if (!ensureCapacityForNewTab()) {
return
}
const insertIndex = tab.fixedTab ? findFixedTabInsertIndex() : opened.value.length
const newTab = { ...tab }
if (tab.fixedTab) {
opened.value.splice(insertIndex, 0, newTab)
@@ -196,13 +239,17 @@ export const useWorktabStore = defineStore(
params: tab.params,
query: tab.query,
title: tab.title || existingTab.title,
fixedTab: tab.fixedTab ?? existingTab.fixedTab,
fixedTab: singlePage ? false : (tab.fixedTab ?? existingTab.fixedTab),
keepAlive: tab.keepAlive ?? existingTab.keepAlive,
name: tab.name || existingTab.name,
icon: tab.icon || existingTab.icon
}
current.value = opened.value[existingIndex]
if (singlePage) {
enforceSinglePageTabs()
}
}
}
@@ -528,7 +575,11 @@ export const useWorktabStore = defineStore(
opened.value = validTabs
}
trimTabsToMaxOpen()
if (isSinglePageMode()) {
enforceSinglePageTabs()
} else {
trimTabsToMaxOpen()
}
// 验证当前激活标签的有效性
const isCurrentValid =
@@ -621,6 +672,7 @@ export const useWorktabStore = defineStore(
removeAll,
toggleFixedTab,
validateWorktabs,
enforceSinglePageTabs,
clearAll,
getStateSnapshot,
+8 -8
View File
@@ -44,7 +44,7 @@
font-size: 13px;
font-weight: 600;
color: #374151;
background: #ecfdf5;
background: #e6f8ed;
padding: 0 12px;
height: 36px;
line-height: 36px;
@@ -60,7 +60,7 @@
display: inline-block;
width: 3px;
height: 14px;
background: #10b981;
background: #1ca851;
border-radius: 2px;
margin-right: 8px;
vertical-align: middle;
@@ -78,8 +78,8 @@
transition: all 0.15s ease;
&:hover {
border-color: #10b981;
box-shadow: 0 2px 4px rgba(16, 185, 129, 0.12);
border-color: #1ca851;
box-shadow: 0 2px 4px rgba(28, 168, 81, 0.12);
}
&:active {
cursor: grabbing;
@@ -171,11 +171,11 @@
transition: all 0.15s ease;
&:hover {
border-color: #6ee7b7;
border-color: #7dd094;
}
&.is-active {
border-color: #10b981;
background: #ecfdf5;
border-color: #1ca851;
background: #e6f8ed;
}
}
.route-config-step-handle {
@@ -192,7 +192,7 @@
width: 24px;
height: 24px;
border-radius: 50%;
background: #10b981;
background: #1ca851;
color: #fff;
display: flex;
align-items: center;
+2 -2
View File
@@ -11,7 +11,7 @@
.upload-card {
width: 140px;
height: 96px;
border: 1px dashed var(--el-color-primary-light-7, #a7f3d0);
border: 1px dashed var(--el-color-primary-light-7, #a8e0b8);
border-radius: var(--radius-md, 8px);
background: var(--primary-bg);
display: flex;
@@ -57,7 +57,7 @@
&:hover {
border-color: var(--primary);
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
box-shadow: 0 2px 8px rgba(28, 168, 81, 0.1);
}
}
+3 -3
View File
@@ -161,7 +161,7 @@
.bx-select .el-select__wrapper.is-focus,
.bx-date-picker .el-input__wrapper.is-focus {
border-color: var(--primary);
box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
box-shadow: 0 0 0 2px rgba(28, 168, 81, 0.2);
}
.bx-input .el-input__inner {
@@ -366,7 +366,7 @@
.bx-tag--pending { color: var(--text-muted); }
.bx-tag--processing { color: var(--primary-dark); }
.bx-tag--done { color: var(--mint-success-text, #047857); }
.bx-tag--done { color: var(--mint-success-text, #147a3c); }
.bx-tag--warning {
color: #b45309;
background: var(--surface)beb;
@@ -377,7 +377,7 @@
background: var(--surface)beb;
}
.bx-tag--error { color: var(--danger); }
.bx-tag--info { color: var(--mint-success-text, #047857); }
.bx-tag--info { color: var(--mint-success-text, #147a3c); }
.bx-btn.el-button {
height: var(--control-h);
+3 -3
View File
@@ -44,13 +44,13 @@
.list-toolbar-date-shortcuts .date-shortcut-btn.is-active.el-button {
color: var(--primary-dark) !important;
background: var(--primary-bg) !important;
border-color: rgba(16, 185, 129, 0.35) !important;
border-color: rgba(28, 168, 81, 0.35) !important;
--el-button-text-color: var(--primary-dark);
--el-button-bg-color: var(--primary-bg);
--el-button-border-color: rgba(16, 185, 129, 0.35);
--el-button-border-color: rgba(28, 168, 81, 0.35);
--el-button-hover-text-color: var(--primary-dark);
--el-button-hover-bg-color: var(--primary-bg);
--el-button-hover-border-color: rgba(16, 185, 129, 0.45);
--el-button-hover-border-color: rgba(28, 168, 81, 0.45);
}
.db-quick-search-icon {
+9 -9
View File
@@ -1,15 +1,15 @@
:root {
--van-primary-color: #10b981;
--van-success-color: #10b981;
--van-button-primary-background: #10b981;
--van-button-primary-border-color: #10b981;
--van-nav-bar-background: #ecfdf5;
--van-nav-bar-title-text-color: #059669;
--van-primary-color: #1ca851;
--van-success-color: #1ca851;
--van-button-primary-background: #1ca851;
--van-button-primary-border-color: #1ca851;
--van-nav-bar-background: #e6f8ed;
--van-nav-bar-title-text-color: #168f45;
--van-cell-group-inset-padding: 0;
--van-uploader-size: 96px;
--van-uploader-upload-background: #ecfdf5;
--van-uploader-upload-icon-color: #059669;
--van-uploader-upload-active-color: #10b981;
--van-uploader-upload-background: #e6f8ed;
--van-uploader-upload-icon-color: #168f45;
--van-uploader-upload-active-color: #1ca851;
}
.public-pl-transport-page {
+2 -2
View File
@@ -1,6 +1,6 @@
import type { InventoryRecord } from '@/api/db/inventory'
import type { TransportInventoryLink } from '@/api/pl'
import { formatDateTime } from '@/utils/format'
import { formatDate } from '@/utils/format'
const SITE_INSTRUCTION = '说明:请打开链接上传现场附件并填写备注。'
@@ -27,7 +27,7 @@ export function buildSiteSummaryFromInventoryLinks(options: {
const planNo = options.planNo || options.records[0]?.planNo
if (planNo) lines.push(`计划号:${planNo}`)
if (options.licensePlate) lines.push(`车牌:${options.licensePlate}`)
const time = formatDateTime(options.pickupTime) || options.planDate
const time = formatDate(options.pickupTime) || options.planDate
if (time) lines.push(`时间:${time}`)
const validRecords = options.records.filter(item => item.siteUrl)
+20 -1
View File
@@ -1,5 +1,5 @@
import { ElMessage } from 'element-plus'
import { fetchAttachmentDownloadUrl } from '@/api/admin'
import { fetchAttachmentDownloadUrl, fetchAttachmentPreviewUrl } from '@/api/admin'
export type AttachmentDownloadItem = {
fileUrl?: string
@@ -34,6 +34,25 @@ function triggerAnchorDownload(href: string, fileName: string) {
document.body.removeChild(a)
}
/** 附件预览:优先走后端预签名 inline URL,供 PDF iframe 等内联展示。 */
export async function resolveAttachmentPreviewUrl(
file: AttachmentDownloadItem,
options?: { fullFileUrl?: (url: string) => string }
): Promise<string> {
const fileUrl = String(file.fileUrl || '').trim()
if (!fileUrl) return ''
const resolveUrl = options?.fullFileUrl || ((url: string) => url)
try {
const res = await fetchAttachmentPreviewUrl({ fileUrl, fileName: file.fileName })
if (res?.previewUrl) return res.previewUrl
} catch {
// 预签名失败时回退直连
}
return resolveUrl(fileUrl)
}
/** 附件下载:优先走后端预签名 URL,保证跨域场景下保留原始文件名与后缀。 */
export async function downloadAttachmentFile(
file: AttachmentDownloadItem,
+4
View File
@@ -35,3 +35,7 @@ export function parseTime(time?: string | number | Date | null, pattern = '{y}-{
export function formatDateTime(time?: string | null) {
return parseTime(time)
}
export function formatDate(time?: string | number | Date | null) {
return parseTime(time, '{y}-{m}-{d}')
}
+1 -3
View File
@@ -24,9 +24,7 @@
import { useWorktabStore } from '@/store/modules/worktab'
import { RouteLocationNormalized } from 'vue-router'
import { isIframe, isWorkbenchRoute } from './route'
import { useSettingStore } from '@/store/modules/setting'
import { IframeRouteManager } from '@/router/core'
import { useCommon } from '@/hooks/core/useCommon'
/**
* 根据当前路由信息设置工作标签页(worktab)
@@ -54,7 +52,7 @@ export const setWorktab = (to: RouteLocationNormalized): void => {
query
})
}
} else if (useSettingStore().showWorkTab || path === useCommon().homePath.value) {
} else {
worktabStore.openTab({
title: meta.title as string,
icon: meta.icon as string,
+79 -1
View File
@@ -1,5 +1,5 @@
import type { AppRouteRecord } from '@/types/router'
import { getFirstMenuPath } from '@/utils/navigation/route'
import { getFirstMenuPath, getFirstSecondLevelMenuPath, isIframe } from '@/utils/navigation/route'
import { filterSidebarRoutes } from '@/utils/router/sidebar-menu-filter'
/** 门户顶栏一级模块展示顺序(与路由注册顺序无关) */
@@ -14,6 +14,9 @@ export const PORTAL_TOP_MODULE_ORDER = [
export type PortalTopModulePath = (typeof PORTAL_TOP_MODULE_ORDER)[number]
/** 门户默认一级模块(登录后 / 关闭全部标签等场景的默认落点) */
export const PORTAL_DEFAULT_MODULE_PATH: PortalTopModulePath = '/crm'
export function isDashboardMenuItem(item: AppRouteRecord): boolean {
const path = String(item.path ?? '')
const title = String(item.meta?.title ?? '')
@@ -101,3 +104,78 @@ export function getFirstAccessiblePath(module: AppRouteRecord): string {
return module.path || '/'
}
function findIframeSubMenus(currentPath: string, menuList: AppRouteRecord[]): AppRouteRecord[] {
const hasPath = (items: AppRouteRecord[]): boolean => {
for (const item of items) {
if (item.path === currentPath) {
return true
}
if (item.children?.length && hasPath(item.children)) {
return true
}
}
return false
}
for (const menu of menuList) {
if (menu.children?.length && hasPath(menu.children)) {
return menu.children
}
}
return []
}
/** 当前路由所属一级模块下的侧栏/顶栏子菜单(二三级) */
export function resolvePortalSubMenus(
menuList: AppRouteRecord[],
routePath: string
): AppRouteRecord[] {
const allMenus = menuList || []
const activePath = String(routePath)
if (isIframe(activePath)) {
return findIframeSubMenus(activePath, allMenus)
}
const currentTopPath = resolveTopModulePath(activePath)
if (!currentTopPath) {
return []
}
const currentMenu = allMenus.find((menu) => menu.path === currentTopPath)
return currentMenu?.children ?? []
}
/** 门户默认首页:优先 CRM 管理模块首个可访问页 */
export function getPortalDefaultHomePath(menuList: AppRouteRecord[]): string {
const tops = filterPortalTopModules(menuList)
const defaultModule =
tops.find((item) => item.path === PORTAL_DEFAULT_MODULE_PATH) || tops[0]
if (defaultModule) {
return getFirstAccessiblePath(defaultModule)
}
return getFirstSecondLevelMenuPath(menuList) || getFirstMenuPath(menuList)
}
/** WorkTab 全部关闭后:当前模块首个二级路径,无则模块首个可访问页 */
export function getPortalDefaultPathForRoute(
menuList: AppRouteRecord[],
routePath: string
): string {
const module = resolveActivePortalModule(menuList, routePath)
if (!module) {
return getPortalDefaultHomePath(menuList)
}
const children = filterSidebarRoutes(resolvePortalSubMenus(menuList, routePath))
if (children.length) {
const childPath = getFirstMenuPath(children, module.path)
if (childPath) {
return childPath
}
}
return getFirstAccessiblePath(module)
}
@@ -334,7 +334,8 @@
<BaseDetailTableSection title="冲抵记录" :data="viewOffsetRecords" empty-text="暂无冲抵记录">
<el-table class="list-table" :data="viewOffsetRecords" stripe size="small">
<el-table-column
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
prop="reimburseApplyCode"
label="报销单号"
min-width="130"
@@ -420,7 +420,8 @@
<BaseDetailTableSection title="冲抵流水" :data="offsetRecords" empty-text="暂无冲抵记录">
<el-table class="list-table" :data="offsetRecords" stripe size="small">
<el-table-column prop="reimburseApplyCode" label="报销单号" min-width="130" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column prop="reimburseApplyCode" label="报销单号" min-width="130" align="center" header-align="center" />
<el-table-column prop="reimburseApplicantName" label="报销申请人" min-width="100" align="center" header-align="center" />
<el-table-column label="冲抵金额(元)" min-width="120" class-name="col-money" align="right" header-align="center">
<template #default="{ row: offsetRow }">
+3 -1
View File
@@ -453,6 +453,7 @@
@selection-change="handleOffsetSelectionChange"
>
<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="applyCode" label="申请单号" min-width="130" align="center" header-align="center" />
<el-table-column prop="applicantName" label="申请人" min-width="80" align="center" header-align="center" />
<el-table-column prop="reason" label="申请原因" min-width="120" align="left" header-align="center" show-overflow-tooltip />
@@ -561,7 +562,8 @@
<h4 class="dlg-view-section-title section-gap-tight">冲抵明细</h4>
<BaseDetailTableSection embedded title="冲抵明细" :data="processedOffsetRecords" empty-text="暂无冲抵明细">
<el-table class="list-table" :data="processedOffsetRecords" stripe size="small">
<el-table-column prop="advanceApplyCode" label="备用金单号" min-width="130" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column prop="advanceApplyCode" label="备用金单号" min-width="130" align="center" header-align="center" />
<el-table-column prop="advanceApplicantName" label="备用金申请人" min-width="110" align="center" header-align="center" />
<el-table-column prop="advanceReason" label="申请原因" min-width="160" align="left" header-align="center" show-overflow-tooltip />
<el-table-column label="冲抵金额(元)" min-width="120" class-name="col-money" align="right" header-align="center">
@@ -401,7 +401,7 @@
font-size: 14px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #10b981;
border-left: 3px solid #1ca851;
line-height: 1;
}
}
+8
View File
@@ -241,6 +241,14 @@
@row-dblclick="handleView"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column
prop="clueName"
label="线索姓名"
+6 -5
View File
@@ -77,7 +77,8 @@
<section v-else class="invalid-dialog-section">
<h3 class="invalid-section-title">待标记线索({{ batchClues.length }} 条)</h3>
<el-table :data="batchClues" class="list-table invalid-batch-table" stripe max-height="240">
<el-table-column prop="clueName" label="线索姓名" min-width="120" show-overflow-tooltip />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column prop="clueName" label="线索姓名" min-width="120" show-overflow-tooltip />
<el-table-column prop="company" label="公司名称" min-width="140" show-overflow-tooltip />
<el-table-column prop="mobile" label="手机号" min-width="120" />
<el-table-column prop="level" label="线索等级" min-width="100">
@@ -275,7 +276,7 @@
height: 14px;
margin-right: 8px;
vertical-align: -2px;
background: var(--primary, #10b981);
background: var(--primary, #1ca851);
border-radius: 2px;
}
}
@@ -291,7 +292,7 @@
display: flex;
gap: 16px;
padding: 16px 18px;
background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 55%);
background: linear-gradient(135deg, #e6f8ed 0%, #ffffff 55%);
align-items: center;
}
@@ -302,9 +303,9 @@
justify-content: center;
width: 52px;
height: 52px;
color: var(--primary, #10b981);
color: var(--primary, #1ca851);
background: #fff;
border: 1px solid #a7f3d0;
border: 1px solid #a8e0b8;
border-radius: 12px;
}
@@ -148,9 +148,9 @@
getStatisticsByOwner
} from '@/api/crm/clue'
const MINT = '#10b981'
const MINT_DARK = '#059669'
const MINT_LIGHT = 'rgba(16, 185, 129, 0.25)'
const MINT = '#1ca851'
const MINT_DARK = '#168f45'
const MINT_LIGHT = 'rgba(28, 168, 81, 0.25)'
const AMBER = '#d97706'
const loading = ref(false)
@@ -410,7 +410,7 @@
label: { show: true, position: 'inside', formatter: '{b}: {c}个\n{d}%' },
data: [
{ value: totalCount, name: '新增线索', itemStyle: { color: MINT } },
{ value: followCount, name: '开始跟进', itemStyle: { color: '#34d399' } },
{ value: followCount, name: '开始跟进', itemStyle: { color: '#49be78' } },
{ value: deepFollowCount, name: '深度跟进', itemStyle: { color: AMBER } },
{ value: intentCount, name: '意向明确', itemStyle: { color: '#f59e0b' } },
{ value: convertedCount, name: '成功转化', itemStyle: { color: MINT_DARK } }
@@ -526,13 +526,13 @@
margin-right: 14px;
&.primary {
background: var(--primary-bg, #ecfdf5);
color: var(--primary, #10b981);
background: var(--primary-bg, #e6f8ed);
color: var(--primary, #1ca851);
}
&.success {
background: rgba(16, 185, 129, 0.12);
color: var(--primary-dark, #059669);
background: rgba(28, 168, 81, 0.12);
color: var(--primary-dark, #168f45);
}
&.warning {
@@ -541,8 +541,8 @@
}
&.danger {
background: rgba(16, 185, 129, 0.08);
color: #047857;
background: rgba(28, 168, 81, 0.08);
color: #147a3c;
}
}
@@ -90,6 +90,14 @@
row-key="id"
@row-dblclick="handleView"
>
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(index) => (queryParams.pageNum - 1) * queryParams.pageSize + index + 1"
/>
<el-table-column
prop="contractNo"
label="合同编号"
@@ -99,7 +107,9 @@
show-overflow-tooltip
>
<template #default="{ row }">
<el-link type="primary" @click="handleViewContract(row)">{{ row.contractNo }}</el-link>
<el-link type="primary" @click="handleViewContract(row)">{{
row.contractNo
}}</el-link>
</template>
</el-table-column>
<el-table-column
@@ -122,8 +132,12 @@
/>
<el-table-column label="审批结果" min-width="100" align="center" header-align="center">
<template #default="{ row }">
<el-tag v-if="row.approvalResult === 'approved'" type="success" size="small">通过</el-tag>
<el-tag v-else-if="row.approvalResult === 'rejected'" type="danger" size="small">驳回</el-tag>
<el-tag v-if="row.approvalResult === 'approved'" type="success" size="small"
>通过</el-tag
>
<el-tag v-else-if="row.approvalResult === 'rejected'" type="danger" size="small"
>驳回</el-tag
>
<el-tag v-else type="warning" size="small">待审批</el-tag>
</template>
</el-table-column>
@@ -166,7 +180,9 @@
<template #hero-actions>
<div class="approval-view-hero-actions">
<el-button
v-if="hasContractPerm('approvalApprove') && viewDialog.data.approvalResult === 'pending'"
v-if="
hasContractPerm('approvalApprove') && viewDialog.data.approvalResult === 'pending'
"
class="btn-main"
type="primary"
@click="handleApprove(viewDialog.data)"
@@ -219,7 +235,12 @@
<el-button class="btn-ghost" @click="approvalDialog.visible = false">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button class="btn-main" type="primary" :loading="submitLoading" @click="submitApproval">
<el-button
class="btn-main"
type="primary"
:loading="submitLoading"
@click="submitApproval"
>
<el-icon><Check /></el-icon>确定
</el-button>
</template>
@@ -229,121 +250,207 @@
</template>
<script setup lang="ts" name="ContractApproval">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { ref, reactive, computed, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { Document, Download, Search, RefreshLeft, Close, Check, EditPen } from '@element-plus/icons-vue'
import SystemViewDialog, {
type ViewField,
type ViewSection
} from '@/components/business/system-view-dialog/index.vue'
import { crmField, crmLongField, crmTagField } from '@/utils/crm/view-fields'
import {
listApproval,
getApproval,
approvePass,
approveReject,
exportApproval,
type ApprovalQuery,
type ApprovalVO
} from '@/api/crm/contract/approval'
import { parseTime } from '@/utils/format'
import { $modal } from '@/utils/modal'
import { useContractPerm } from '@/hooks/business/useContractPerm'
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { ref, reactive, computed, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import {
Document,
Download,
Search,
RefreshLeft,
Close,
Check,
EditPen
} from '@element-plus/icons-vue'
import SystemViewDialog, {
type ViewField,
type ViewSection
} from '@/components/business/system-view-dialog/index.vue'
import { crmField, crmLongField, crmTagField } from '@/utils/crm/view-fields'
import {
listApproval,
getApproval,
approvePass,
approveReject,
exportApproval,
type ApprovalQuery,
type ApprovalVO
} from '@/api/crm/contract/approval'
import { parseTime } from '@/utils/format'
import { $modal } from '@/utils/modal'
import { useContractPerm } from '@/hooks/business/useContractPerm'
const router = useRouter()
const { loadPerms, hasContractPerm } = useContractPerm()
const router = useRouter()
const { loadPerms, hasContractPerm } = useContractPerm()
const queryParams = ref<ApprovalQuery>({
pageNum: 1,
pageSize: 20,
contractNo: undefined,
contractName: undefined,
approverName: undefined,
approvalResult: undefined,
beginTime: undefined,
endTime: undefined
})
const queryParams = ref<ApprovalQuery>({
pageNum: 1,
pageSize: 20,
contractNo: undefined,
contractName: undefined,
approverName: undefined,
approvalResult: undefined,
beginTime: undefined,
endTime: undefined
})
const approvalForm = ref({
id: undefined as number | undefined,
approvalResult: 'approved',
approvalOpinion: ''
})
const approvalForm = ref({
id: undefined as number | undefined,
approvalResult: 'approved',
approvalOpinion: ''
})
const approvalRules = ref({
approvalResult: [{ required: true, message: '请选择审批结果', trigger: 'change' }],
approvalOpinion: [
{
validator: (_rule: unknown, value: string, callback: (err?: Error) => void) => {
if (approvalForm.value.approvalResult === 'rejected' && !value) {
callback(new Error('驳回时必须填写驳回原因'))
} else {
callback()
}
},
trigger: 'blur'
const approvalRules = ref({
approvalResult: [{ required: true, message: '请选择审批结果', trigger: 'change' }],
approvalOpinion: [
{
validator: (_rule: unknown, value: string, callback: (err?: Error) => void) => {
if (approvalForm.value.approvalResult === 'rejected' && !value) {
callback(new Error('驳回时必须填写驳回原因'))
} else {
callback()
}
},
trigger: 'blur'
}
]
})
const approvalList = ref<ApprovalVO[]>([])
const loading = ref(true)
const submitLoading = ref(false)
const exportLoading = ref(false)
const total = ref(0)
const dateRange = ref<[string, string]>()
const viewDialog = reactive({
visible: false,
data: {} as ApprovalVO
})
function approvalResultTag(result?: string) {
if (result === 'approved') return { label: '通过', type: 'success' as const }
if (result === 'rejected') return { label: '驳回', type: 'danger' as const }
return { label: '待审批', type: 'warning' as const }
}
const approvalViewSections = computed<ViewSection[]>(() => {
const d = viewDialog.data
if (!d?.id && !d?.contractNo) return []
const result = approvalResultTag(d.approvalResult)
const basicFields: ViewField[] = [
crmField('合同名称', d.contractName),
crmField('审批流程 ID', d.flowId),
crmField('审批级别', d.step != null ? `第${d.step}级` : undefined),
crmField('步骤名称', d.stepName),
crmField('审批人部门', d.approverDept),
crmField('审批人', d.approverName),
crmTagField('审批结果', result.label, result.type)
]
const detailFields: ViewField[] = [
crmLongField('审批意见', d.approvalOpinion, { fullSpan: true }),
crmField('审批时间', parseTime(d.approvalTime)),
crmField('创建时间', parseTime(d.createTime)),
crmLongField('备注', d.remark, { fullSpan: true })
]
return [
{ title: '基本信息', fields: basicFields },
{ title: '审批详情', fields: detailFields }
]
})
const approvalDialog = reactive({
visible: false
})
const queryFormRef = ref<ElFormInstance>()
const approvalFormRef = ref<ElFormInstance>()
const getList = async () => {
loading.value = true
try {
if (dateRange.value && dateRange.value.length === 2) {
queryParams.value.beginTime = dateRange.value[0]
queryParams.value.endTime = dateRange.value[1]
} else {
queryParams.value.beginTime = undefined
queryParams.value.endTime = undefined
}
const res = await listApproval(queryParams.value)
approvalList.value = res.rows
total.value = res.total
} finally {
loading.value = false
}
]
})
}
const approvalList = ref<ApprovalVO[]>([])
const loading = ref(true)
const submitLoading = ref(false)
const exportLoading = ref(false)
const total = ref(0)
const dateRange = ref<[string, string]>()
const handleQuery = () => {
queryParams.value.pageNum = 1
getList()
}
const viewDialog = reactive({
visible: false,
data: {} as ApprovalVO
})
const resetQuery = () => {
dateRange.value = undefined
queryFormRef.value?.resetFields()
handleQuery()
}
function approvalResultTag(result?: string) {
if (result === 'approved') return { label: '通过', type: 'success' as const }
if (result === 'rejected') return { label: '驳回', type: 'danger' as const }
return { label: '待审批', type: 'warning' as const }
}
const handleView = async (row: ApprovalVO) => {
const res = await getApproval(row.id)
viewDialog.data = res.data
viewDialog.visible = true
}
const approvalViewSections = computed<ViewSection[]>(() => {
const d = viewDialog.data
if (!d?.id && !d?.contractNo) return []
const handleViewContract = (row: ApprovalVO) => {
router.push({
path: '/crm/contract/detail',
query: { id: row.contractId }
})
}
const result = approvalResultTag(d.approvalResult)
const handleApprove = (row: ApprovalVO) => {
approvalForm.value = {
id: row.id,
approvalResult: 'approved',
approvalOpinion: ''
}
approvalDialog.visible = true
}
const basicFields: ViewField[] = [
crmField('合同名称', d.contractName),
crmField('审批流程 ID', d.flowId),
crmField('审批级别', d.step != null ? `第${d.step}级` : undefined),
crmField('步骤名称', d.stepName),
crmField('审批人部门', d.approverDept),
crmField('审批人', d.approverName),
crmTagField('审批结果', result.label, result.type)
]
const submitApproval = () => {
approvalFormRef.value?.validate(async (valid) => {
if (!valid) return
submitLoading.value = true
try {
if (approvalForm.value.approvalResult === 'approved') {
await approvePass({
id: approvalForm.value.id!,
approvalOpinion: approvalForm.value.approvalOpinion
})
$modal.msgSuccess('审批通过')
} else {
await approveReject({
id: approvalForm.value.id!,
approvalOpinion: approvalForm.value.approvalOpinion
})
$modal.msgSuccess('已驳回')
}
approvalDialog.visible = false
await getList()
} catch (error) {
console.error(error)
} finally {
submitLoading.value = false
}
})
}
const detailFields: ViewField[] = [
crmLongField('审批意见', d.approvalOpinion, { fullSpan: true }),
crmField('审批时间', parseTime(d.approvalTime)),
crmField('创建时间', parseTime(d.createTime)),
crmLongField('备注', d.remark, { fullSpan: true })
]
return [
{ title: '基本信息', fields: basicFields },
{ title: '审批详情', fields: detailFields }
]
})
const approvalDialog = reactive({
visible: false
})
const queryFormRef = ref<ElFormInstance>()
const approvalFormRef = ref<ElFormInstance>()
const getList = async () => {
loading.value = true
try {
const handleExport = async () => {
if (dateRange.value && dateRange.value.length === 2) {
queryParams.value.beginTime = dateRange.value[0]
queryParams.value.endTime = dateRange.value[1]
@@ -351,109 +458,31 @@ const getList = async () => {
queryParams.value.beginTime = undefined
queryParams.value.endTime = undefined
}
const res = await listApproval(queryParams.value)
approvalList.value = res.rows
total.value = res.total
} finally {
loading.value = false
}
}
const handleQuery = () => {
queryParams.value.pageNum = 1
getList()
}
const resetQuery = () => {
dateRange.value = undefined
queryFormRef.value?.resetFields()
handleQuery()
}
const handleView = async (row: ApprovalVO) => {
const res = await getApproval(row.id)
viewDialog.data = res.data
viewDialog.visible = true
}
const handleViewContract = (row: ApprovalVO) => {
router.push({
path: '/crm/contract/detail',
query: { id: row.contractId }
})
}
const handleApprove = (row: ApprovalVO) => {
approvalForm.value = {
id: row.id,
approvalResult: 'approved',
approvalOpinion: ''
}
approvalDialog.visible = true
}
const submitApproval = () => {
approvalFormRef.value?.validate(async (valid) => {
if (!valid) return
submitLoading.value = true
exportLoading.value = true
try {
if (approvalForm.value.approvalResult === 'approved') {
await approvePass({
id: approvalForm.value.id!,
approvalOpinion: approvalForm.value.approvalOpinion
})
$modal.msgSuccess('审批通过')
} else {
await approveReject({
id: approvalForm.value.id!,
approvalOpinion: approvalForm.value.approvalOpinion
})
$modal.msgSuccess('已驳回')
}
approvalDialog.visible = false
await getList()
const res = await exportApproval(queryParams.value)
const blob =
res instanceof Blob
? res
: new Blob([res as BlobPart], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
const url = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = `contract_approval_${new Date().getTime()}.xlsx`
link.click()
URL.revokeObjectURL(url)
} catch (error) {
console.error(error)
$modal.msgError('导出失败')
} finally {
submitLoading.value = false
exportLoading.value = false
}
}
onMounted(async () => {
await loadPerms()
getList()
})
}
const handleExport = async () => {
if (dateRange.value && dateRange.value.length === 2) {
queryParams.value.beginTime = dateRange.value[0]
queryParams.value.endTime = dateRange.value[1]
} else {
queryParams.value.beginTime = undefined
queryParams.value.endTime = undefined
}
exportLoading.value = true
try {
const res = await exportApproval(queryParams.value)
const blob =
res instanceof Blob
? res
: new Blob([res as BlobPart], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
const url = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = `contract_approval_${new Date().getTime()}.xlsx`
link.click()
URL.revokeObjectURL(url)
} catch (error) {
console.error(error)
$modal.msgError('导出失败')
} finally {
exportLoading.value = false
}
}
onMounted(async () => {
await loadPerms()
getList()
})
</script>
+399 -352
View File
@@ -139,6 +139,14 @@
@row-dblclick="handleView"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(index) => (queryParams.pageNum - 1) * queryParams.pageSize + index + 1"
/>
<el-table-column
prop="contractNo"
label="合同编号"
@@ -148,7 +156,9 @@
show-overflow-tooltip
>
<template #default="{ row }">
<el-link type="primary" @click="handleViewContract(row)">{{ row.contractNo }}</el-link>
<el-link type="primary" @click="handleViewContract(row)">{{
row.contractNo
}}</el-link>
</template>
</el-table-column>
<el-table-column
@@ -185,9 +195,15 @@
</el-table-column>
<el-table-column label="审批状态" min-width="100" align="center" header-align="center">
<template #default="{ row }">
<el-tag v-if="row.approvalStatus === 'pending'" type="warning" size="small">待审批</el-tag>
<el-tag v-else-if="row.approvalStatus === 'approved'" type="success" size="small">已通过</el-tag>
<el-tag v-else-if="row.approvalStatus === 'rejected'" type="danger" size="small">已驳回</el-tag>
<el-tag v-if="row.approvalStatus === 'pending'" type="warning" size="small"
>待审批</el-tag
>
<el-tag v-else-if="row.approvalStatus === 'approved'" type="success" size="small"
>已通过</el-tag
>
<el-tag v-else-if="row.approvalStatus === 'rejected'" type="danger" size="small"
>已驳回</el-tag
>
</template>
</el-table-column>
<el-table-column
@@ -236,7 +252,12 @@
>
<div class="form-grid-2">
<el-form-item label="合同" prop="contractId" class="form-col-span-2">
<el-select v-model="form.contractId" placeholder="请选择合同" filterable style="width: 100%">
<el-select
v-model="form.contractId"
placeholder="请选择合同"
filterable
style="width: 100%"
>
<!-- TODO: 动态加载合同列表 -->
<el-option label="合同1" :value="1" />
</el-select>
@@ -261,16 +282,36 @@
/>
</el-form-item>
<el-form-item label="变更原因" prop="changeReason" class="form-col-span-2">
<el-input v-model="form.changeReason" type="textarea" :rows="3" placeholder="请输入变更原因" />
<el-input
v-model="form.changeReason"
type="textarea"
:rows="3"
placeholder="请输入变更原因"
/>
</el-form-item>
<el-form-item label="变更内容" prop="changeContent" class="form-col-span-2">
<el-input v-model="form.changeContent" type="textarea" :rows="2" placeholder="请输入变更内容描述" />
<el-input
v-model="form.changeContent"
type="textarea"
:rows="2"
placeholder="请输入变更内容描述"
/>
</el-form-item>
<el-form-item label="变更前值" prop="oldValue" class="form-col-span-2">
<el-input v-model="form.oldValue" type="textarea" :rows="2" placeholder="请输入变更前的值" />
<el-input
v-model="form.oldValue"
type="textarea"
:rows="2"
placeholder="请输入变更前的值"
/>
</el-form-item>
<el-form-item label="变更后值" prop="newValue" class="form-col-span-2">
<el-input v-model="form.newValue" type="textarea" :rows="2" placeholder="请输入变更后的值" />
<el-input
v-model="form.newValue"
type="textarea"
:rows="2"
placeholder="请输入变更后的值"
/>
</el-form-item>
<el-form-item label="备注" prop="remark" class="form-col-span-2">
<el-input v-model="form.remark" type="textarea" :rows="2" placeholder="请输入备注" />
@@ -300,21 +341,27 @@
<template #hero-actions>
<div class="change-view-hero-actions">
<el-button
v-if="hasContractPerm('changeApprove') && viewDialog.data.approvalStatus === 'pending'"
v-if="
hasContractPerm('changeApprove') && viewDialog.data.approvalStatus === 'pending'
"
class="btn-ghost"
@click="handleSubmitApproval(viewDialog.data)"
>
<el-icon><Promotion /></el-icon>提交审批
</el-button>
<el-button
v-if="hasContractPerm('changeApprove') && viewDialog.data.approvalStatus === 'approved'"
v-if="
hasContractPerm('changeApprove') && viewDialog.data.approvalStatus === 'approved'
"
class="btn-ghost"
@click="handleExecute(viewDialog.data)"
>
<el-icon><VideoPlay /></el-icon>执行变更
</el-button>
<el-button
v-if="hasContractPerm('changeApprove') && viewDialog.data.approvalStatus === 'pending'"
v-if="
hasContractPerm('changeApprove') && viewDialog.data.approvalStatus === 'pending'
"
class="btn-ghost"
@click="handleWithdraw(viewDialog.data)"
>
@@ -340,343 +387,67 @@
</template>
<script setup lang="ts" name="ContractChange">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { ref, reactive, computed, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import {
Document,
Plus,
Delete,
Download,
Search,
RefreshLeft,
Close,
Check,
Promotion,
VideoPlay
} from '@element-plus/icons-vue'
import SystemViewDialog, {
type ViewField,
type ViewSection
} from '@/components/business/system-view-dialog/index.vue'
import { crmDictField, crmField, crmLongField, crmTagField } from '@/utils/crm/view-fields'
import {
listChange,
getChange,
addChange,
updateChange,
delChange,
submitChangeApproval,
withdrawChange,
executeChange,
exportChange,
type ChangeQuery,
type ChangeForm,
type ChangeVO
} from '@/api/crm/contract/change'
import { parseTime } from '@/utils/format'
import { useDictStore } from '@/store/modules/dict'
import { $modal } from '@/utils/modal'
import { useContractPerm } from '@/hooks/business/useContractPerm'
import {
canDeleteByCreator,
filterDeletableByCreator,
allRowsDeletableByCreator,
CREATOR_DELETE_TIP
} from '@/utils/creator-delete'
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { ref, reactive, computed, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import {
Document,
Plus,
Delete,
Download,
Search,
RefreshLeft,
Close,
Check,
Promotion,
VideoPlay
} from '@element-plus/icons-vue'
import SystemViewDialog, {
type ViewField,
type ViewSection
} from '@/components/business/system-view-dialog/index.vue'
import { crmDictField, crmField, crmLongField, crmTagField } from '@/utils/crm/view-fields'
import {
listChange,
getChange,
addChange,
updateChange,
delChange,
submitChangeApproval,
withdrawChange,
executeChange,
exportChange,
type ChangeQuery,
type ChangeForm,
type ChangeVO
} from '@/api/crm/contract/change'
import { parseTime } from '@/utils/format'
import { useDictStore } from '@/store/modules/dict'
import { $modal } from '@/utils/modal'
import { useContractPerm } from '@/hooks/business/useContractPerm'
import {
canDeleteByCreator,
filterDeletableByCreator,
allRowsDeletableByCreator,
CREATOR_DELETE_TIP
} from '@/utils/creator-delete'
const router = useRouter()
const dictStore = useDictStore()
const { loadPerms, hasContractPerm } = useContractPerm()
const router = useRouter()
const dictStore = useDictStore()
const { loadPerms, hasContractPerm } = useContractPerm()
const queryParams = ref<ChangeQuery>({
pageNum: 1,
pageSize: 20,
contractNo: undefined,
contractName: undefined,
changeType: undefined,
approvalStatus: undefined,
beginTime: undefined,
endTime: undefined
})
const form = ref<ChangeForm>({
contractId: 0,
changeType: '',
changeReason: '',
changeContent: '',
oldValue: '',
newValue: '',
changeAmount: 0,
remark: ''
})
const rules = ref({
contractId: [{ required: true, message: '请选择合同', trigger: 'change' }],
changeType: [{ required: true, message: '请选择变更类型', trigger: 'change' }],
changeReason: [{ required: true, message: '请输入变更原因', trigger: 'blur' }],
newValue: [{ required: true, message: '请输入变更后的值', trigger: 'blur' }]
})
const changeList = ref<ChangeVO[]>([])
const selectedRows = ref<ChangeVO[]>([])
const loading = ref(true)
const submitLoading = ref(false)
const exportLoading = ref(false)
const total = ref(0)
const ids = ref<number[]>([])
const dateRange = ref<[string, string]>()
const dialog = reactive<DialogOption>({
visible: false,
title: ''
})
const viewDialog = reactive({
visible: false,
data: {} as ChangeVO
})
function changeStatusTag(status?: string) {
if (status === 'pending') return { label: '待审批', type: 'warning' as const }
if (status === 'approved') return { label: '已通过', type: 'success' as const }
if (status === 'rejected') return { label: '已驳回', type: 'danger' as const }
if (status === 'executed') return { label: '已执行', type: 'info' as const }
return { label: '—', type: undefined }
}
function approvalStatusTag(status?: string) {
if (status === 'pending') return { label: '待审批', type: 'warning' as const }
if (status === 'approved') return { label: '已通过', type: 'success' as const }
if (status === 'rejected') return { label: '已驳回', type: 'danger' as const }
return { label: '—', type: undefined }
}
const changeViewSections = computed<ViewSection[]>(() => {
const d = viewDialog.data
if (!d?.id && !d?.contractNo) return []
const changeStatus = changeStatusTag(d.changeStatus)
const approvalStatus = approvalStatusTag(d.approvalStatus)
const basicFields: ViewField[] = [
crmField('合同名称', d.contractName),
crmDictField('变更类型', 'crm_contract_change_type', d.changeType, dictStore),
crmTagField('变更状态', changeStatus.label, changeStatus.type)
]
const contentFields: ViewField[] = [
crmLongField('变更原因', d.changeReason),
crmLongField('变更内容', d.changeContent),
crmLongField('变更前值', d.oldValue, { fullSpan: true }),
crmLongField('变更后值', d.newValue, { fullSpan: true }),
{
label: '变更金额',
value: d.changeAmount != null ? `¥${Number(d.changeAmount).toLocaleString()}` : '—',
money: true
}
]
const approvalFields: ViewField[] = [
crmTagField('审批状态', approvalStatus.label, approvalStatus.type),
crmField('审批人', d.approverName),
crmField('审批时间', parseTime(d.approvalTime)),
crmLongField('审批意见', d.approvalOpinion, { fullSpan: true })
]
const otherFields: ViewField[] = [
crmField('创建时间', parseTime(d.createTime)),
crmLongField('备注', d.remark, { fullSpan: true })
]
return [
{ title: '基本信息', fields: basicFields },
{ title: '变更内容', fields: contentFields },
{ title: '审批信息', fields: approvalFields },
{ title: '其他', fields: otherFields }
]
})
const queryFormRef = ref<ElFormInstance>()
const formRef = ref<ElFormInstance>()
const getList = async () => {
loading.value = true
try {
if (dateRange.value && dateRange.value.length === 2) {
queryParams.value.beginTime = dateRange.value[0]
queryParams.value.endTime = dateRange.value[1]
} else {
queryParams.value.beginTime = undefined
queryParams.value.endTime = undefined
}
const res = await listChange(queryParams.value)
changeList.value = res.rows
total.value = res.total
} finally {
loading.value = false
}
}
const handleQuery = () => {
queryParams.value.pageNum = 1
getList()
}
const resetQuery = () => {
dateRange.value = undefined
queryFormRef.value?.resetFields()
handleQuery()
}
const handleSelectionChange = (selection: ChangeVO[]) => {
selectedRows.value = selection
ids.value = selection.map((item) => item.id)
}
const handleAdd = () => {
reset()
dialog.visible = true
dialog.title = '添加变更记录'
}
const handleView = async (row: ChangeVO) => {
const res = await getChange(row.id)
viewDialog.data = res.data
viewDialog.visible = true
}
const handleViewContract = (row: ChangeVO) => {
router.push({
path: '/crm/contract/detail',
query: { id: row.contractId }
const queryParams = ref<ChangeQuery>({
pageNum: 1,
pageSize: 20,
contractNo: undefined,
contractName: undefined,
changeType: undefined,
approvalStatus: undefined,
beginTime: undefined,
endTime: undefined
})
}
const submitForm = () => {
formRef.value?.validate(async (valid) => {
if (!valid) return
submitLoading.value = true
try {
if (form.value.id) {
await updateChange(form.value)
$modal.msgSuccess('修改成功')
} else {
await addChange(form.value)
$modal.msgSuccess('新增成功')
}
dialog.visible = false
await getList()
} catch (error) {
console.error(error)
} finally {
submitLoading.value = false
}
})
}
const handleDelete = async (row?: ChangeVO) => {
const targets = row ? [row] : selectedRows.value
const deletable = filterDeletableByCreator(targets)
if (!deletable.length) {
$modal.msgWarning(CREATOR_DELETE_TIP)
return
}
if (deletable.length < targets.length) {
$modal.msgWarning(CREATOR_DELETE_TIP)
return
}
const idList = row?.id ? [row.id] : ids.value
await $modal.confirm('是否确认删除选中的变更记录?')
await delChange(idList)
$modal.msgSuccess('删除成功')
await getList()
}
async function handleDetailDelete() {
if (!viewDialog.data?.id) return
await handleDelete(viewDialog.data as ChangeVO)
viewDialog.visible = false
}
const handleCommand = async (command: string, row: ChangeVO) => {
switch (command) {
case 'submit':
await handleSubmitApproval(row)
break
case 'execute':
await handleExecute(row)
break
case 'withdraw':
await handleWithdraw(row)
break
case 'delete':
await handleDelete(row)
break
}
}
const handleSubmitApproval = async (row: ChangeVO) => {
await $modal.confirm('是否确认提交该变更记录进行审批?')
await submitChangeApproval({ id: row.id, approverIds: [] })
$modal.msgSuccess('提交成功')
await getList()
}
const handleExecute = async (row: ChangeVO) => {
await $modal.confirm('是否确认执行该变更?执行后将无法撤销')
await executeChange(row.id)
$modal.msgSuccess('执行成功')
await getList()
}
const handleWithdraw = async (row: ChangeVO) => {
await $modal.confirm('是否确认撤回该变更记录?')
await withdrawChange(row.id)
$modal.msgSuccess('撤回成功')
await getList()
}
const handleExport = async () => {
if (dateRange.value && dateRange.value.length === 2) {
queryParams.value.beginTime = dateRange.value[0]
queryParams.value.endTime = dateRange.value[1]
} else {
queryParams.value.beginTime = undefined
queryParams.value.endTime = undefined
}
exportLoading.value = true
try {
const res = await exportChange(queryParams.value)
const blob =
res instanceof Blob
? res
: new Blob([res as BlobPart], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
const url = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = `contract_change_${new Date().getTime()}.xlsx`
link.click()
URL.revokeObjectURL(url)
} catch (error) {
console.error(error)
$modal.msgError('导出失败')
} finally {
exportLoading.value = false
}
}
const cancel = () => {
dialog.visible = false
reset()
}
const reset = () => {
form.value = {
id: undefined,
const form = ref<ChangeForm>({
contractId: 0,
changeType: '',
changeReason: '',
@@ -685,12 +456,288 @@ const reset = () => {
newValue: '',
changeAmount: 0,
remark: ''
}
formRef.value?.resetFields()
}
})
onMounted(async () => {
await loadPerms()
getList()
})
const rules = ref({
contractId: [{ required: true, message: '请选择合同', trigger: 'change' }],
changeType: [{ required: true, message: '请选择变更类型', trigger: 'change' }],
changeReason: [{ required: true, message: '请输入变更原因', trigger: 'blur' }],
newValue: [{ required: true, message: '请输入变更后的值', trigger: 'blur' }]
})
const changeList = ref<ChangeVO[]>([])
const selectedRows = ref<ChangeVO[]>([])
const loading = ref(true)
const submitLoading = ref(false)
const exportLoading = ref(false)
const total = ref(0)
const ids = ref<number[]>([])
const dateRange = ref<[string, string]>()
const dialog = reactive<DialogOption>({
visible: false,
title: ''
})
const viewDialog = reactive({
visible: false,
data: {} as ChangeVO
})
function changeStatusTag(status?: string) {
if (status === 'pending') return { label: '待审批', type: 'warning' as const }
if (status === 'approved') return { label: '已通过', type: 'success' as const }
if (status === 'rejected') return { label: '已驳回', type: 'danger' as const }
if (status === 'executed') return { label: '已执行', type: 'info' as const }
return { label: '—', type: undefined }
}
function approvalStatusTag(status?: string) {
if (status === 'pending') return { label: '待审批', type: 'warning' as const }
if (status === 'approved') return { label: '已通过', type: 'success' as const }
if (status === 'rejected') return { label: '已驳回', type: 'danger' as const }
return { label: '—', type: undefined }
}
const changeViewSections = computed<ViewSection[]>(() => {
const d = viewDialog.data
if (!d?.id && !d?.contractNo) return []
const changeStatus = changeStatusTag(d.changeStatus)
const approvalStatus = approvalStatusTag(d.approvalStatus)
const basicFields: ViewField[] = [
crmField('合同名称', d.contractName),
crmDictField('变更类型', 'crm_contract_change_type', d.changeType, dictStore),
crmTagField('变更状态', changeStatus.label, changeStatus.type)
]
const contentFields: ViewField[] = [
crmLongField('变更原因', d.changeReason),
crmLongField('变更内容', d.changeContent),
crmLongField('变更前值', d.oldValue, { fullSpan: true }),
crmLongField('变更后值', d.newValue, { fullSpan: true }),
{
label: '变更金额',
value: d.changeAmount != null ? `¥${Number(d.changeAmount).toLocaleString()}` : '—',
money: true
}
]
const approvalFields: ViewField[] = [
crmTagField('审批状态', approvalStatus.label, approvalStatus.type),
crmField('审批人', d.approverName),
crmField('审批时间', parseTime(d.approvalTime)),
crmLongField('审批意见', d.approvalOpinion, { fullSpan: true })
]
const otherFields: ViewField[] = [
crmField('创建时间', parseTime(d.createTime)),
crmLongField('备注', d.remark, { fullSpan: true })
]
return [
{ title: '基本信息', fields: basicFields },
{ title: '变更内容', fields: contentFields },
{ title: '审批信息', fields: approvalFields },
{ title: '其他', fields: otherFields }
]
})
const queryFormRef = ref<ElFormInstance>()
const formRef = ref<ElFormInstance>()
const getList = async () => {
loading.value = true
try {
if (dateRange.value && dateRange.value.length === 2) {
queryParams.value.beginTime = dateRange.value[0]
queryParams.value.endTime = dateRange.value[1]
} else {
queryParams.value.beginTime = undefined
queryParams.value.endTime = undefined
}
const res = await listChange(queryParams.value)
changeList.value = res.rows
total.value = res.total
} finally {
loading.value = false
}
}
const handleQuery = () => {
queryParams.value.pageNum = 1
getList()
}
const resetQuery = () => {
dateRange.value = undefined
queryFormRef.value?.resetFields()
handleQuery()
}
const handleSelectionChange = (selection: ChangeVO[]) => {
selectedRows.value = selection
ids.value = selection.map((item) => item.id)
}
const handleAdd = () => {
reset()
dialog.visible = true
dialog.title = '添加变更记录'
}
const handleView = async (row: ChangeVO) => {
const res = await getChange(row.id)
viewDialog.data = res.data
viewDialog.visible = true
}
const handleViewContract = (row: ChangeVO) => {
router.push({
path: '/crm/contract/detail',
query: { id: row.contractId }
})
}
const submitForm = () => {
formRef.value?.validate(async (valid) => {
if (!valid) return
submitLoading.value = true
try {
if (form.value.id) {
await updateChange(form.value)
$modal.msgSuccess('修改成功')
} else {
await addChange(form.value)
$modal.msgSuccess('新增成功')
}
dialog.visible = false
await getList()
} catch (error) {
console.error(error)
} finally {
submitLoading.value = false
}
})
}
const handleDelete = async (row?: ChangeVO) => {
const targets = row ? [row] : selectedRows.value
const deletable = filterDeletableByCreator(targets)
if (!deletable.length) {
$modal.msgWarning(CREATOR_DELETE_TIP)
return
}
if (deletable.length < targets.length) {
$modal.msgWarning(CREATOR_DELETE_TIP)
return
}
const idList = row?.id ? [row.id] : ids.value
await $modal.confirm('是否确认删除选中的变更记录?')
await delChange(idList)
$modal.msgSuccess('删除成功')
await getList()
}
async function handleDetailDelete() {
if (!viewDialog.data?.id) return
await handleDelete(viewDialog.data as ChangeVO)
viewDialog.visible = false
}
const handleCommand = async (command: string, row: ChangeVO) => {
switch (command) {
case 'submit':
await handleSubmitApproval(row)
break
case 'execute':
await handleExecute(row)
break
case 'withdraw':
await handleWithdraw(row)
break
case 'delete':
await handleDelete(row)
break
}
}
const handleSubmitApproval = async (row: ChangeVO) => {
await $modal.confirm('是否确认提交该变更记录进行审批?')
await submitChangeApproval({ id: row.id, approverIds: [] })
$modal.msgSuccess('提交成功')
await getList()
}
const handleExecute = async (row: ChangeVO) => {
await $modal.confirm('是否确认执行该变更?执行后将无法撤销')
await executeChange(row.id)
$modal.msgSuccess('执行成功')
await getList()
}
const handleWithdraw = async (row: ChangeVO) => {
await $modal.confirm('是否确认撤回该变更记录?')
await withdrawChange(row.id)
$modal.msgSuccess('撤回成功')
await getList()
}
const handleExport = async () => {
if (dateRange.value && dateRange.value.length === 2) {
queryParams.value.beginTime = dateRange.value[0]
queryParams.value.endTime = dateRange.value[1]
} else {
queryParams.value.beginTime = undefined
queryParams.value.endTime = undefined
}
exportLoading.value = true
try {
const res = await exportChange(queryParams.value)
const blob =
res instanceof Blob
? res
: new Blob([res as BlobPart], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
const url = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = `contract_change_${new Date().getTime()}.xlsx`
link.click()
URL.revokeObjectURL(url)
} catch (error) {
console.error(error)
$modal.msgError('导出失败')
} finally {
exportLoading.value = false
}
}
const cancel = () => {
dialog.visible = false
reset()
}
const reset = () => {
form.value = {
id: undefined,
contractId: 0,
changeType: '',
changeReason: '',
changeContent: '',
oldValue: '',
newValue: '',
changeAmount: 0,
remark: ''
}
formRef.value?.resetFields()
}
onMounted(async () => {
await loadPerms()
getList()
})
</script>
@@ -331,14 +331,14 @@ defineExpose({
height: 14px;
margin-right: 8px;
vertical-align: -2px;
background: var(--primary, #10b981);
background: var(--primary, #1ca851);
border-radius: 2px;
}
}
.approval-flow {
padding: 16px;
background: var(--primary-bg, #ecfdf5);
background: var(--primary-bg, #e6f8ed);
border: 1px solid var(--border, #d9e8e2);
border-radius: 8px;
}
@@ -12,7 +12,7 @@
:accept="accept"
>
<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>
@@ -322,7 +322,7 @@ defineExpose({ hasUploading })
.upload-card {
width: 140px;
height: 96px;
border: 1px dashed #a7f3d0;
border: 1px dashed #a8e0b8;
border-radius: 8px;
background: #f0fdf4;
display: flex;
@@ -333,15 +333,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;
}
@@ -369,8 +369,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);
}
}
@@ -471,7 +471,7 @@ defineExpose({ hasUploading })
cursor: pointer;
&:hover {
background: #10b981;
background: #1ca851;
color: #fff;
}
@@ -362,7 +362,8 @@
</div>
<div class="list-body list-wrap">
<el-table :data="detailPaymentList" class="list-table" stripe v-loading="detailPaymentLoading" empty-text="暂无回款记录">
<el-table-column label="回款单号" prop="paymentNo" min-width="150" align="center" header-align="center">
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column label="回款单号" prop="paymentNo" min-width="150" align="center" header-align="center">
<template #default="scope">
<el-link type="primary" @click="handleDetailViewPayment(scope.row)">
{{ scope.row.paymentNo }}
@@ -402,7 +403,8 @@
</div>
<div class="list-body list-wrap">
<el-table :data="detailInvoiceList" class="list-table" stripe v-loading="detailInvoiceLoading" empty-text="暂无开票记录">
<el-table-column label="发票号码" prop="invoiceNo" min-width="150" align="center" header-align="center">
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column label="发票号码" prop="invoiceNo" min-width="150" align="center" header-align="center">
<template #default="scope">
<el-link type="primary" @click="handleDetailViewInvoice(scope.row)">
{{ scope.row.invoiceNo }}
@@ -2883,7 +2885,7 @@ onMounted(async () => {
font-size: 14px;
font-weight: 600;
color: var(--text, #1e293b);
border-left: 3px solid var(--primary, #10b981);
border-left: 3px solid var(--primary, #1ca851);
line-height: 1;
}
}
@@ -2922,7 +2924,7 @@ onMounted(async () => {
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 {
@@ -2938,12 +2940,12 @@ onMounted(async () => {
.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;
}
@@ -2954,10 +2956,10 @@ onMounted(async () => {
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;
@@ -3340,11 +3342,11 @@ onMounted(async () => {
}
&:hover {
border-color: #10b981;
background: #ecfdf5;
border-color: #1ca851;
background: #e6f8ed;
.el-icon {
color: #10b981;
color: #1ca851;
}
}
}
@@ -3363,9 +3365,9 @@ onMounted(async () => {
z-index: 2;
&:hover {
color: #10b981;
border-color: #10b981;
background: #ecfdf5;
color: #1ca851;
border-color: #1ca851;
background: #e6f8ed;
}
}
@@ -3442,9 +3444,9 @@ onMounted(async () => {
}
.list-toolbar-date-shortcuts :deep(.date-shortcut-btn.is-active.el-button) {
color: var(--mint-primary-dark, #059669) !important;
background: var(--mint-primary-bg, #ecfdf5) !important;
border-color: rgba(16, 185, 129, 0.35) !important;
color: var(--mint-primary-dark, #168f45) !important;
background: var(--mint-primary-bg, #e6f8ed) !important;
border-color: rgba(28, 168, 81, 0.35) !important;
}
.quick-search-input {
@@ -3458,7 +3460,7 @@ onMounted(async () => {
}
.quick-search-icon:hover {
color: var(--mint-primary, #10b981);
color: var(--mint-primary, #1ca851);
}
.panel-stats {
@@ -3506,8 +3508,8 @@ onMounted(async () => {
flex-direction: column;
&: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);
}
}
@@ -2124,7 +2124,7 @@ const loadSupplierList = async () => {
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 {
@@ -2140,12 +2140,12 @@ const loadSupplierList = async () => {
.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;
}
@@ -2156,10 +2156,10 @@ const loadSupplierList = async () => {
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;
@@ -257,8 +257,8 @@ const formatAmount = (amount: number): string => {
}
const getProgressColor = (rate: number): string => {
if (rate >= 100) return '#10b981'
if (rate >= 80) return '#059669'
if (rate >= 100) return '#1ca851'
if (rate >= 80) return '#168f45'
if (rate >= 50) return '#d97706'
return '#ef4444'
}
@@ -290,7 +290,7 @@ defineExpose({
height: 14px;
margin-right: 8px;
vertical-align: -2px;
background: var(--primary, #10b981);
background: var(--primary, #1ca851);
border-radius: 2px;
}
}
@@ -302,12 +302,12 @@ defineExpose({
}
.amount-text {
color: var(--primary-dark, #059669);
color: var(--primary-dark, #168f45);
font-weight: 600;
}
.received-text {
color: var(--primary, #10b981);
color: var(--primary, #1ca851);
font-weight: 600;
}
@@ -317,7 +317,7 @@ defineExpose({
}
.invoiced-text {
color: var(--primary-dark, #059669);
color: var(--primary-dark, #168f45);
font-weight: 600;
}
+7 -4
View File
@@ -455,7 +455,8 @@
<el-tab-pane label="回款记录" name="payment">
<el-button type="primary" icon="Plus" @click="handleAddPayment" class="mb-3">新增回款</el-button>
<el-table :data="paymentList" border v-loading="paymentLoading">
<el-table-column label="回款单号" prop="paymentNo" width="150" align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column label="回款单号" prop="paymentNo" width="150" align="center" />
<el-table-column label="回款金额" prop="amount" width="130" align="right">
<template #default="scope">
<span class="text-success font-weight-bold"
@@ -482,7 +483,8 @@
<el-tab-pane label="开票记录" name="invoice">
<el-button type="primary" icon="Plus" @click="handleAddInvoice" class="mb-3">新增开票</el-button>
<el-table :data="invoiceList" border v-loading="invoiceLoading">
<el-table-column label="发票号码" prop="invoiceNo" width="150" align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column label="发票号码" prop="invoiceNo" width="150" align="center" />
<el-table-column label="发票类型" prop="invoiceType" width="120" align="center" />
<el-table-column label="开票金额" prop="amount" width="130" align="right">
<template #default="scope">
@@ -913,7 +915,8 @@
<el-tab-pane label="操作日志" name="log">
<!-- 操作日志列表 -->
<el-table v-loading="logLoading" :data="operLogList" stripe>
<el-table-column label="操作时间" align="center" prop="operTime" width="160" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column label="操作时间" align="center" prop="operTime" width="160" />
<el-table-column label="操作模块" align="center" prop="title" width="120" />
<el-table-column label="操作类型" align="center" width="100">
<template #default="scope">
@@ -2717,7 +2720,7 @@ const handleGeneratePdfFile = async () => {
font-weight: bold;
&.primary {
color: var(--primary, #10b981);
color: var(--primary, #1ca851);
}
}
}
+4 -4
View File
@@ -1332,9 +1332,9 @@ onMounted(async () => {
}
.list-toolbar-date-shortcuts :deep(.date-shortcut-btn.is-active.el-button) {
color: var(--mint-primary-dark, #059669) !important;
background: var(--mint-primary-bg, #ecfdf5) !important;
border-color: rgba(16, 185, 129, 0.35) !important;
color: var(--mint-primary-dark, #168f45) !important;
background: var(--mint-primary-bg, #e6f8ed) !important;
border-color: rgba(28, 168, 81, 0.35) !important;
}
.quick-search-icon {
@@ -1343,7 +1343,7 @@ onMounted(async () => {
}
.quick-search-icon:hover {
color: var(--mint-primary, #10b981);
color: var(--mint-primary, #1ca851);
}
</style>
@@ -73,10 +73,7 @@
v-if="hasContractPerm('templateRemove')"
class="btn-ghost"
type="danger"
:disabled="
selectedRows.length === 0 ||
!allRowsDeletableByCreator(selectedRows)
"
:disabled="selectedRows.length === 0 || !allRowsDeletableByCreator(selectedRows)"
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
@click="handleDelete()"
>
@@ -106,6 +103,14 @@
@row-dblclick="handleView"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(index) => (queryParams.pageNum - 1) * queryParams.pageSize + index + 1"
/>
<el-table-column
prop="templateName"
label="模板名称"
@@ -157,7 +162,13 @@
align="center"
header-align="center"
/>
<el-table-column prop="sort" label="排序" min-width="80" align="center" header-align="center" />
<el-table-column
prop="sort"
label="排序"
min-width="80"
align="center"
header-align="center"
/>
<el-table-column label="创建时间" min-width="160" align="center" header-align="center">
<template #default="{ row }">
{{ parseTime(row.createTime) }}
@@ -202,7 +213,11 @@
<el-input v-model="form.templateName" placeholder="请输入模板名称" />
</el-form-item>
<el-form-item label="模板类型" prop="templateType">
<el-select v-model="form.templateType" placeholder="请选择模板类型" style="width: 100%">
<el-select
v-model="form.templateType"
placeholder="请选择模板类型"
style="width: 100%"
>
<el-option
v-for="dict in dictStore.getOptions('crm_contract_type')"
:key="dict.value"
@@ -227,16 +242,36 @@
/>
</el-form-item>
<el-form-item label="合同条款" prop="contractTerms" class="form-col-span-2">
<el-input v-model="form.contractTerms" type="textarea" :rows="4" placeholder="请输入合同条款" />
<el-input
v-model="form.contractTerms"
type="textarea"
:rows="4"
placeholder="请输入合同条款"
/>
</el-form-item>
<el-form-item label="付款条款" prop="paymentTerms" class="form-col-span-2">
<el-input v-model="form.paymentTerms" type="textarea" :rows="3" placeholder="请输入付款条款" />
<el-input
v-model="form.paymentTerms"
type="textarea"
:rows="3"
placeholder="请输入付款条款"
/>
</el-form-item>
<el-form-item label="交付条款" prop="deliveryTerms" class="form-col-span-2">
<el-input v-model="form.deliveryTerms" type="textarea" :rows="3" placeholder="请输入交付条款" />
<el-input
v-model="form.deliveryTerms"
type="textarea"
:rows="3"
placeholder="请输入交付条款"
/>
</el-form-item>
<el-form-item label="模板内容" prop="templateContent" class="form-col-span-2">
<el-input v-model="form.templateContent" type="textarea" :rows="6" placeholder="请输入模板内容" />
<el-input
v-model="form.templateContent"
type="textarea"
:rows="6"
placeholder="请输入模板内容"
/>
</el-form-item>
<el-form-item label="备注" prop="remark" class="form-col-span-2">
<el-input v-model="form.remark" type="textarea" :rows="2" placeholder="请输入备注" />
@@ -290,280 +325,61 @@
</template>
<script setup lang="ts" name="ContractTemplate">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { ref, reactive, computed, onMounted } from 'vue'
import {
Document,
Plus,
Edit,
Delete,
Download,
Search,
RefreshLeft,
Close,
Check
} from '@element-plus/icons-vue'
import SystemViewDialog, {
type ViewField,
type ViewSection
} from '@/components/business/system-view-dialog/index.vue'
import { crmDictField, crmField, crmLongField, crmTagField } from '@/utils/crm/view-fields'
import {
listTemplate,
getTemplate,
addTemplate,
updateTemplate,
delTemplate,
enableTemplate,
disableTemplate,
exportTemplate,
type TemplateQuery,
type TemplateForm,
type TemplateVO
} from '@/api/crm/contract/template'
import { parseTime } from '@/utils/format'
import { useDictStore } from '@/store/modules/dict'
import { $modal } from '@/utils/modal'
import { useContractPerm } from '@/hooks/business/useContractPerm'
import {
canDeleteByCreator,
filterDeletableByCreator,
allRowsDeletableByCreator,
CREATOR_DELETE_TIP
} from '@/utils/creator-delete'
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { ref, reactive, computed, onMounted } from 'vue'
import {
Document,
Plus,
Edit,
Delete,
Download,
Search,
RefreshLeft,
Close,
Check
} from '@element-plus/icons-vue'
import SystemViewDialog, {
type ViewField,
type ViewSection
} from '@/components/business/system-view-dialog/index.vue'
import { crmDictField, crmField, crmLongField, crmTagField } from '@/utils/crm/view-fields'
import {
listTemplate,
getTemplate,
addTemplate,
updateTemplate,
delTemplate,
enableTemplate,
disableTemplate,
exportTemplate,
type TemplateQuery,
type TemplateForm,
type TemplateVO
} from '@/api/crm/contract/template'
import { parseTime } from '@/utils/format'
import { useDictStore } from '@/store/modules/dict'
import { $modal } from '@/utils/modal'
import { useContractPerm } from '@/hooks/business/useContractPerm'
import {
canDeleteByCreator,
filterDeletableByCreator,
allRowsDeletableByCreator,
CREATOR_DELETE_TIP
} from '@/utils/creator-delete'
const dictStore = useDictStore()
const { loadPerms, hasContractPerm } = useContractPerm()
const dictStore = useDictStore()
const { loadPerms, hasContractPerm } = useContractPerm()
const queryParams = ref<TemplateQuery>({
pageNum: 1,
pageSize: 20,
templateNo: undefined,
templateName: undefined,
templateType: undefined,
isActive: undefined
})
const form = ref<TemplateForm>({
templateName: '',
templateType: '',
templateContent: '',
contractTerms: '',
paymentTerms: '',
deliveryTerms: '',
isActive: 1,
sort: 0,
remark: ''
})
const rules = ref({
templateName: [{ required: true, message: '模板名称不能为空', trigger: 'blur' }],
templateType: [{ required: true, message: '模板类型不能为空', trigger: 'change' }],
templateContent: [{ required: true, message: '模板内容不能为空', trigger: 'blur' }]
})
const templateList = ref<TemplateVO[]>([])
const selectedRows = ref<TemplateVO[]>([])
const loading = ref(true)
const submitLoading = ref(false)
const exportLoading = ref(false)
const total = ref(0)
const ids = ref<number[]>([])
const dialog = reactive<DialogOption>({
visible: false,
title: ''
})
const viewDialog = reactive({
visible: false,
data: {} as TemplateVO
})
const templateViewSections = computed<ViewSection[]>(() => {
const d = viewDialog.data
if (!d?.id && !d?.templateNo) return []
const basicFields: ViewField[] = [
crmField('模板名称', d.templateName),
crmDictField('模板类型', 'crm_contract_type', d.templateType, dictStore),
crmTagField('状态', d.isActive === 1 ? '启用' : '停用', d.isActive === 1 ? 'success' : 'info'),
crmField('使用次数', d.usageCount),
crmField('排序', d.sort),
crmField('创建时间', parseTime(d.createTime)),
crmField('更新时间', parseTime(d.updateTime))
]
const termFields: ViewField[] = [
crmLongField('合同条款', d.contractTerms, { fullSpan: true }),
crmLongField('付款条款', d.paymentTerms, { fullSpan: true }),
crmLongField('交付条款', d.deliveryTerms, { fullSpan: true }),
crmLongField('模板内容', d.templateContent, { fullSpan: true }),
crmLongField('备注', d.remark, { fullSpan: true })
].filter((f) => f.value !== '—')
const sections: ViewSection[] = [{ title: '基本信息', fields: basicFields }]
if (termFields.length) sections.push({ title: '条款与内容', fields: termFields })
return sections
})
const queryFormRef = ref<ElFormInstance>()
const formRef = ref<ElFormInstance>()
function handleToolbarEdit() {
if (selectedRows.value.length !== 1) {
$modal.msgWarning('请选择一条数据进行编辑')
return
}
handleUpdate(selectedRows.value[0])
}
async function handleDetailEdit() {
if (!viewDialog.data?.id) return
viewDialog.visible = false
await handleUpdate(viewDialog.data as TemplateVO)
}
async function handleDetailDelete() {
if (!viewDialog.data?.id) return
await handleDelete(viewDialog.data as TemplateVO)
viewDialog.visible = false
}
const getList = async () => {
loading.value = true
try {
const res = await listTemplate(queryParams.value)
templateList.value = res.rows
total.value = res.total
} finally {
loading.value = false
}
}
const handleQuery = () => {
queryParams.value.pageNum = 1
getList()
}
const resetQuery = () => {
queryFormRef.value?.resetFields()
handleQuery()
}
const handleSelectionChange = (selection: TemplateVO[]) => {
selectedRows.value = selection
ids.value = selection.map((item) => item.id)
}
const handleAdd = () => {
reset()
dialog.visible = true
dialog.title = '添加合同模板'
}
const handleUpdate = async (row: TemplateVO) => {
reset()
const res = await getTemplate(row.id)
Object.assign(form.value, res.data)
dialog.visible = true
dialog.title = '修改合同模板'
}
const handleView = async (row: TemplateVO) => {
const res = await getTemplate(row.id)
viewDialog.data = res.data
viewDialog.visible = true
}
const submitForm = () => {
formRef.value?.validate(async (valid) => {
if (!valid) return
submitLoading.value = true
try {
if (form.value.id) {
await updateTemplate(form.value)
$modal.msgSuccess('修改成功')
} else {
await addTemplate(form.value)
$modal.msgSuccess('新增成功')
}
dialog.visible = false
await getList()
} catch (error) {
console.error(error)
} finally {
submitLoading.value = false
}
const queryParams = ref<TemplateQuery>({
pageNum: 1,
pageSize: 20,
templateNo: undefined,
templateName: undefined,
templateType: undefined,
isActive: undefined
})
}
const handleDelete = async (row?: TemplateVO) => {
const targets = row ? [row] : selectedRows.value
const deletable = filterDeletableByCreator(targets)
if (!deletable.length) {
$modal.msgWarning(CREATOR_DELETE_TIP)
return
}
if (deletable.length < targets.length) {
$modal.msgWarning(CREATOR_DELETE_TIP)
return
}
const idList = row?.id ? [row.id] : ids.value
await $modal.confirm('是否确认删除选中的合同模板?')
await delTemplate(idList)
$modal.msgSuccess('删除成功')
await getList()
}
const handleStatusChange = async (row: TemplateVO) => {
try {
const text = row.isActive === 1 ? '启用' : '停用'
await $modal.confirm(`确认要${text}"${row.templateName}"吗?`)
if (row.isActive === 1) {
await enableTemplate(row.id)
} else {
await disableTemplate(row.id)
}
$modal.msgSuccess(`${text}成功`)
await getList()
} catch {
row.isActive = row.isActive === 0 ? 1 : 0
}
}
const handleExport = async () => {
exportLoading.value = true
try {
const res = await exportTemplate(queryParams.value)
const blob =
res instanceof Blob
? res
: new Blob([res as BlobPart], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
const url = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = `contract_template_${new Date().getTime()}.xlsx`
link.click()
URL.revokeObjectURL(url)
} catch (error) {
console.error(error)
$modal.msgError('导出失败')
} finally {
exportLoading.value = false
}
}
const cancel = () => {
dialog.visible = false
reset()
}
const reset = () => {
form.value = {
id: undefined,
const form = ref<TemplateForm>({
templateName: '',
templateType: '',
templateContent: '',
@@ -573,12 +389,235 @@ const reset = () => {
isActive: 1,
sort: 0,
remark: ''
}
formRef.value?.resetFields()
}
})
onMounted(async () => {
await loadPerms()
getList()
})
const rules = ref({
templateName: [{ required: true, message: '模板名称不能为空', trigger: 'blur' }],
templateType: [{ required: true, message: '模板类型不能为空', trigger: 'change' }],
templateContent: [{ required: true, message: '模板内容不能为空', trigger: 'blur' }]
})
const templateList = ref<TemplateVO[]>([])
const selectedRows = ref<TemplateVO[]>([])
const loading = ref(true)
const submitLoading = ref(false)
const exportLoading = ref(false)
const total = ref(0)
const ids = ref<number[]>([])
const dialog = reactive<DialogOption>({
visible: false,
title: ''
})
const viewDialog = reactive({
visible: false,
data: {} as TemplateVO
})
const templateViewSections = computed<ViewSection[]>(() => {
const d = viewDialog.data
if (!d?.id && !d?.templateNo) return []
const basicFields: ViewField[] = [
crmField('模板名称', d.templateName),
crmDictField('模板类型', 'crm_contract_type', d.templateType, dictStore),
crmTagField(
'状态',
d.isActive === 1 ? '启用' : '停用',
d.isActive === 1 ? 'success' : 'info'
),
crmField('使用次数', d.usageCount),
crmField('排序', d.sort),
crmField('创建时间', parseTime(d.createTime)),
crmField('更新时间', parseTime(d.updateTime))
]
const termFields: ViewField[] = [
crmLongField('合同条款', d.contractTerms, { fullSpan: true }),
crmLongField('付款条款', d.paymentTerms, { fullSpan: true }),
crmLongField('交付条款', d.deliveryTerms, { fullSpan: true }),
crmLongField('模板内容', d.templateContent, { fullSpan: true }),
crmLongField('备注', d.remark, { fullSpan: true })
].filter((f) => f.value !== '—')
const sections: ViewSection[] = [{ title: '基本信息', fields: basicFields }]
if (termFields.length) sections.push({ title: '条款与内容', fields: termFields })
return sections
})
const queryFormRef = ref<ElFormInstance>()
const formRef = ref<ElFormInstance>()
function handleToolbarEdit() {
if (selectedRows.value.length !== 1) {
$modal.msgWarning('请选择一条数据进行编辑')
return
}
handleUpdate(selectedRows.value[0])
}
async function handleDetailEdit() {
if (!viewDialog.data?.id) return
viewDialog.visible = false
await handleUpdate(viewDialog.data as TemplateVO)
}
async function handleDetailDelete() {
if (!viewDialog.data?.id) return
await handleDelete(viewDialog.data as TemplateVO)
viewDialog.visible = false
}
const getList = async () => {
loading.value = true
try {
const res = await listTemplate(queryParams.value)
templateList.value = res.rows
total.value = res.total
} finally {
loading.value = false
}
}
const handleQuery = () => {
queryParams.value.pageNum = 1
getList()
}
const resetQuery = () => {
queryFormRef.value?.resetFields()
handleQuery()
}
const handleSelectionChange = (selection: TemplateVO[]) => {
selectedRows.value = selection
ids.value = selection.map((item) => item.id)
}
const handleAdd = () => {
reset()
dialog.visible = true
dialog.title = '添加合同模板'
}
const handleUpdate = async (row: TemplateVO) => {
reset()
const res = await getTemplate(row.id)
Object.assign(form.value, res.data)
dialog.visible = true
dialog.title = '修改合同模板'
}
const handleView = async (row: TemplateVO) => {
const res = await getTemplate(row.id)
viewDialog.data = res.data
viewDialog.visible = true
}
const submitForm = () => {
formRef.value?.validate(async (valid) => {
if (!valid) return
submitLoading.value = true
try {
if (form.value.id) {
await updateTemplate(form.value)
$modal.msgSuccess('修改成功')
} else {
await addTemplate(form.value)
$modal.msgSuccess('新增成功')
}
dialog.visible = false
await getList()
} catch (error) {
console.error(error)
} finally {
submitLoading.value = false
}
})
}
const handleDelete = async (row?: TemplateVO) => {
const targets = row ? [row] : selectedRows.value
const deletable = filterDeletableByCreator(targets)
if (!deletable.length) {
$modal.msgWarning(CREATOR_DELETE_TIP)
return
}
if (deletable.length < targets.length) {
$modal.msgWarning(CREATOR_DELETE_TIP)
return
}
const idList = row?.id ? [row.id] : ids.value
await $modal.confirm('是否确认删除选中的合同模板?')
await delTemplate(idList)
$modal.msgSuccess('删除成功')
await getList()
}
const handleStatusChange = async (row: TemplateVO) => {
try {
const text = row.isActive === 1 ? '启用' : '停用'
await $modal.confirm(`确认要${text}"${row.templateName}"吗?`)
if (row.isActive === 1) {
await enableTemplate(row.id)
} else {
await disableTemplate(row.id)
}
$modal.msgSuccess(`${text}成功`)
await getList()
} catch {
row.isActive = row.isActive === 0 ? 1 : 0
}
}
const handleExport = async () => {
exportLoading.value = true
try {
const res = await exportTemplate(queryParams.value)
const blob =
res instanceof Blob
? res
: new Blob([res as BlobPart], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
const url = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = `contract_template_${new Date().getTime()}.xlsx`
link.click()
URL.revokeObjectURL(url)
} catch (error) {
console.error(error)
$modal.msgError('导出失败')
} finally {
exportLoading.value = false
}
}
const cancel = () => {
dialog.visible = false
reset()
}
const reset = () => {
form.value = {
id: undefined,
templateName: '',
templateType: '',
templateContent: '',
contractTerms: '',
paymentTerms: '',
deliveryTerms: '',
isActive: 1,
sort: 0,
remark: ''
}
formRef.value?.resetFields()
}
onMounted(async () => {
await loadPerms()
getList()
})
</script>
@@ -136,7 +136,8 @@
stripe
empty-text=""
>
<el-table-column
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
label="联系人"
prop="contactName"
min-width="120"
@@ -228,7 +229,8 @@
stripe
empty-text=""
>
<el-table-column
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
label="商机名称"
prop="opportunityName"
min-width="180"
@@ -288,7 +290,8 @@
stripe
empty-text=""
>
<el-table-column
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
label="合同编号"
prop="contractNo"
min-width="150"
@@ -365,7 +368,8 @@
stripe
empty-text=""
>
<el-table-column
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
label="操作时间"
prop="operTime"
min-width="160"
@@ -14,7 +14,8 @@
</div>
<el-table v-loading="loading" :data="contactList" stripe class="list-table">
<el-table-column label="姓名" prop="contactName" min-width="120" align="center">
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column label="姓名" prop="contactName" min-width="120" align="center">
<template #default="{ row }">
<span>{{ row.contactName }}</span>
<el-tag v-if="row.isPrimary === 1" type="warning" size="small" style="margin-left: 6px">主要</el-tag>
@@ -18,7 +18,8 @@
class="list-table"
empty-text=""
>
<el-table-column
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
label="单位名称(章)"
prop="companyName"
min-width="180"
@@ -211,6 +211,14 @@
@row-dblclick="handleView"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column
prop="customerNo"
label="客户编号"
@@ -111,6 +111,14 @@
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column
prop="poolName"
label="规则名称"
@@ -116,6 +116,14 @@
@row-dblclick="handleView"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column
prop="customerNo"
label="客户编号"
@@ -588,7 +588,7 @@ defineExpose({ open })
}
&--success {
color: #059669;
color: #168f45;
}
}
@@ -92,7 +92,8 @@
</div>
<div class="list-body list-wrap">
<el-table class="list-table" :data="funnelData" stripe>
<el-table-column label="商机阶段" prop="stageName" min-width="120" align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column label="商机阶段" prop="stageName" min-width="120" align="center" />
<el-table-column label="商机数量" prop="count" min-width="100" align="center">
<template #default="scope">
<el-tag type="primary" size="small">{{ scope.row.count }}</el-tag>
@@ -127,8 +128,8 @@ import type { ECharts } from 'echarts'
import { ElMessage } from 'element-plus'
import { Opportunity, CircleCheck, TrendCharts, Money, Search, RefreshLeft } from '@element-plus/icons-vue'
const MINT_DARK = '#059669'
const MINT_PALETTE = ['#10b981', '#34d399', '#059669', '#047857', '#6ee7b7', '#0d9488', '#14b8a6']
const MINT_DARK = '#168f45'
const MINT_PALETTE = ['#1ca851', '#49be78', '#168f45', '#147a3c', '#7dd094', '#0d9488', '#14b8a6']
const loading = ref(false)
const queryFormRef = ref()
@@ -330,13 +331,13 @@ onBeforeUnmount(() => {
margin-right: 14px;
&.primary {
background: var(--primary-bg, #ecfdf5);
color: var(--primary, #10b981);
background: var(--primary-bg, #e6f8ed);
color: var(--primary, #1ca851);
}
&.success {
background: rgba(16, 185, 129, 0.12);
color: var(--primary-dark, #059669);
background: rgba(28, 168, 81, 0.12);
color: var(--primary-dark, #168f45);
}
&.warning {
File diff suppressed because it is too large. Load diff
@@ -129,10 +129,10 @@ const queryParams = ref<OpportunityQuery>({})
const stageColors: Record<string, string> = {
initial: '#64748b',
requirement: '#10b981',
solution: '#059669',
requirement: '#1ca851',
solution: '#168f45',
quote: '#d97706',
negotiate: '#047857',
negotiate: '#147a3c',
contract: '#0d9488'
}
@@ -277,7 +277,7 @@ onMounted(() => {
.header-amount {
font-size: 14px;
color: var(--primary-dark, #059669);
color: var(--primary-dark, #168f45);
font-weight: 600;
}
}
@@ -327,7 +327,7 @@ onMounted(() => {
cursor: pointer;
&:hover {
color: var(--primary, #10b981);
color: var(--primary, #1ca851);
}
}
}
@@ -351,7 +351,7 @@ onMounted(() => {
}
&.amount {
color: var(--primary-dark, #059669);
color: var(--primary-dark, #168f45);
font-weight: 600;
}
}
@@ -161,8 +161,8 @@ import {
} from '@/api/crm/opportunity'
import type { OpportunityStatisticsOverview, OpportunityVO } from '@/api/crm/opportunity/types'
const MINT = '#10b981'
const MINT_DARK = '#059669'
const MINT = '#1ca851'
const MINT_DARK = '#168f45'
const AMBER = '#d97706'
const DANGER = '#dc2626'
@@ -282,7 +282,7 @@ const loadStageChart = async () => {
const option: EChartsOption = {
tooltip: { trigger: 'item', formatter: '{b}: {c}个 ({d}%)' },
legend: { orient: 'vertical', right: 10, top: 'center' },
color: [MINT, MINT_DARK, '#34d399', AMBER, '#047857', '#6ee7b7'],
color: [MINT, MINT_DARK, '#49be78', AMBER, '#147a3c', '#7dd094'],
series: [
{
type: 'pie',
@@ -373,7 +373,7 @@ const loadAmountChart = async () => {
data: data.map((item) => item.count),
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#34d399' },
{ offset: 0, color: '#49be78' },
{ offset: 0.5, color: MINT },
{ offset: 1, color: MINT_DARK }
])
@@ -565,13 +565,13 @@ onBeforeUnmount(() => {
flex-shrink: 0;
&.primary {
background: var(--primary-bg, #ecfdf5);
color: var(--primary, #10b981);
background: var(--primary-bg, #e6f8ed);
color: var(--primary, #1ca851);
}
&.success {
background: rgba(16, 185, 129, 0.12);
color: var(--primary-dark, #059669);
background: rgba(28, 168, 81, 0.12);
color: var(--primary-dark, #168f45);
}
&.warning {
@@ -102,7 +102,8 @@
highlight-current-row
@current-change="handleCurrentChange"
>
<el-table-column
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
prop="categoryName"
label="分类名称"
min-width="200"
+26 -39
View File
@@ -131,6 +131,14 @@
@row-dblclick="handleView"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column
v-if="isColumnVisible('productNo')"
prop="productNo"
@@ -196,7 +204,7 @@
header-align="center"
>
<template #default="{ row }">
{{ dictStore.getLabel('crm_product_unit', row.unit) }}
{{ formatProductUnit(row.unit) }}
</template>
</el-table-column>
<el-table-column
@@ -208,7 +216,7 @@
header-align="right"
>
<template #default="{ row }">
<span class="money-display">¥{{ formatMoneyDisplay(row.price) }}</span>
<span class="money-display">{{ formatProductPrice(row.price) }}</span>
</template>
</el-table-column>
<el-table-column
@@ -220,7 +228,7 @@
header-align="right"
>
<template #default="{ row }">
<span class="money-display">¥{{ formatMoneyDisplay(row.cost) }}</span>
<span class="money-display">{{ formatProductPrice(row.costPrice ?? row.cost) }}</span>
</template>
</el-table-column>
<el-table-column
@@ -296,28 +304,12 @@
<el-form-item label="规格型号">
<el-input v-model="formData.model" placeholder="请输入规格型号" />
</el-form-item>
<el-form-item label="计量单位">
<el-select v-model="formData.unit" placeholder="请选择计量单位" clearable>
<el-option
v-for="opt in dictStore.getOptions('crm_product_unit')"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-select>
</el-form-item>
<el-form-item label="条码" prop="barcode">
<el-input
v-model="formData.barcode"
:placeholder="isEdit ? '请输入条码' : '留空自动生成'"
/>
</el-form-item>
<el-form-item label="标准价(元)">
<AmountInput v-model="formData.price" :min="0" class="money-field-input" />
</el-form-item>
<el-form-item label="成本价(元)">
<AmountInput v-model="formData.cost" :min="0" class="money-field-input" />
</el-form-item>
<el-form-item label="税率(%)">
<el-input-number
v-model="formData.taxRate"
@@ -544,6 +536,18 @@ function getHazardFlagTagType(value: unknown) {
return 'danger'
}
function formatProductUnit(unit: string | null | undefined) {
if (!unit) return '-'
return dictStore.getLabel('crm_product_unit', unit) || unit
}
function formatProductPrice(value: unknown) {
if (value === null || value === undefined || value === '') return '-'
const num = Number(value)
if (Number.isNaN(num) || num === 0) return '-'
return `¥${formatMoneyDisplay(num)}`
}
const productList = ref<any[]>([])
const categoryOptions = ref<any[]>([])
const loading = ref(false)
@@ -586,10 +590,7 @@ const formData = reactive({
productNo: '',
categoryId: '',
model: '',
unit: 'dun',
barcode: '',
price: 0,
cost: 0,
stock: 0,
lowStock: 10,
taxRate: 13,
@@ -637,7 +638,7 @@ const productViewSections = computed<ViewSection[]>(() => {
crmField('产品名称', d.productName),
crmField('产品分类', d.categoryName),
crmField('规格型号', d.model),
crmDictField('计量单位', 'crm_product_unit', d.unit, dictStore),
crmField('计量单位', formatProductUnit(d.unit)),
crmField('条码', d.barcode),
crmDictField('状态', 'crm_product_status', d.status, dictStore),
crmField('库存数量', d.stock ?? 0),
@@ -652,12 +653,12 @@ const productViewSections = computed<ViewSection[]>(() => {
const priceFields: ViewField[] = [
{
label: '标准价(元)',
value: `¥${formatMoneyDisplay(d.price)}`,
value: formatProductPrice(d.price),
money: true
},
{
label: '成本价(元)',
value: `¥${formatMoneyDisplay(d.costPrice ?? d.cost)}`,
value: formatProductPrice(d.costPrice ?? d.cost),
money: true
}
]
@@ -769,10 +770,7 @@ async function handleUpdate(row: any) {
productNo: data.productNo || '',
categoryId: data.categoryId || '',
model: data.model || '',
unit: data.unit || 'dun',
barcode: data.barcode || '',
price: data.price ?? 0,
cost: data.costPrice ?? data.cost ?? 0,
stock: data.stock ?? 0,
lowStock: data.lowStock ?? 10,
taxRate: data.taxRate ?? 13,
@@ -854,10 +852,7 @@ async function submitForm() {
productNo: formData.productNo || undefined,
categoryId: formData.categoryId || undefined,
model: formData.model || undefined,
unit: formData.unit || undefined,
barcode: formData.barcode || undefined,
price: formData.price ?? 0,
cost: formData.cost ?? 0,
stock: formData.stock ?? 0,
lowStock: formData.lowStock ?? 10,
taxRate: formData.taxRate,
@@ -957,10 +952,7 @@ function resetFormData() {
formData.productNo = ''
formData.categoryId = ''
formData.model = ''
formData.unit = 'dun'
formData.barcode = ''
formData.price = 0
formData.cost = 0
formData.stock = 0
formData.lowStock = 10
formData.taxRate = 13
@@ -993,11 +985,6 @@ onMounted(() => {
</script>
<style scoped lang="scss">
.money-field-input :deep(.el-input__inner) {
color: #dc2626;
font-weight: 600;
}
.product-name-cell {
display: inline-flex;
align-items: center;
@@ -201,7 +201,7 @@ const handleClose = () => {
height: 14px;
margin-right: 8px;
vertical-align: -2px;
background: var(--primary, #10b981);
background: var(--primary, #1ca851);
border-radius: 2px;
}
}
@@ -218,7 +218,7 @@ const handleClose = () => {
}
.approval-radio-icon--pass {
color: var(--primary, #10b981);
color: var(--primary, #1ca851);
}
.approval-radio-icon--reject {
@@ -387,7 +387,7 @@ function getDaysRemaining(expireDate?: string) {
}
function getApprovalTimelineColor(result?: string) {
if (result === 'approved') return '#10b981'
if (result === 'approved') return '#1ca851'
if (result === 'rejected') return '#ef4444'
return '#94a3b8'
}
@@ -73,7 +73,8 @@
</template>
<el-table :data="logs" style="width: 100%" max-height="400">
<el-table-column label="访问时间" prop="visitTime" width="180">
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column label="访问时间" prop="visitTime" width="180">
<template #default="{ row }">
{{ parseTime(row.visitTime) }}
</template>
+14 -14
View File
@@ -843,7 +843,7 @@ const getQuoteTypeTag = (type?: string) => {
/** 审批时间轴节点色(Fresh Mint 语义色) */
const getApprovalTimelineColor = (result?: string) => {
if (result === 'approved') return '#10b981';
if (result === 'approved') return '#1ca851';
if (result === 'rejected') return '#ef4444';
return '#94a3b8';
};
@@ -2508,15 +2508,15 @@ onMounted(() => {
}
.list-toolbar-date-shortcuts :deep(.date-shortcut-btn.is-active.el-button) {
color: var(--mint-primary-dark, #059669) !important;
background: var(--mint-primary-bg, #ecfdf5) !important;
border-color: rgba(16, 185, 129, 0.35) !important;
--el-button-text-color: var(--mint-primary-dark, #059669);
--el-button-bg-color: var(--mint-primary-bg, #ecfdf5);
--el-button-border-color: rgba(16, 185, 129, 0.35);
--el-button-hover-text-color: var(--mint-primary-dark, #059669);
--el-button-hover-bg-color: var(--mint-primary-bg, #ecfdf5);
--el-button-hover-border-color: rgba(16, 185, 129, 0.45);
color: var(--mint-primary-dark, #168f45) !important;
background: var(--mint-primary-bg, #e6f8ed) !important;
border-color: rgba(28, 168, 81, 0.35) !important;
--el-button-text-color: var(--mint-primary-dark, #168f45);
--el-button-bg-color: var(--mint-primary-bg, #e6f8ed);
--el-button-border-color: rgba(28, 168, 81, 0.35);
--el-button-hover-text-color: var(--mint-primary-dark, #168f45);
--el-button-hover-bg-color: var(--mint-primary-bg, #e6f8ed);
--el-button-hover-border-color: rgba(28, 168, 81, 0.45);
}
.quick-search-input {
@@ -2586,7 +2586,7 @@ onMounted(() => {
height: 14px;
margin-right: 8px;
vertical-align: -2px;
background: var(--primary, #10b981);
background: var(--primary, #1ca851);
border-radius: 2px;
}
}
@@ -2612,8 +2612,8 @@ onMounted(() => {
}
.approval-flow-card--current {
border-color: var(--primary, #10b981);
box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.15);
border-color: var(--primary, #1ca851);
box-shadow: 0 0 0 1px rgba(28, 168, 81, 0.15);
}
.approval-radio-icon {
@@ -2622,7 +2622,7 @@ onMounted(() => {
}
.approval-radio-icon--pass {
color: var(--primary, #10b981);
color: var(--primary, #1ca851);
}
.approval-radio-icon--reject {
+279 -264
View File
@@ -18,7 +18,11 @@
</el-statistic>
</div>
<div class="stat-card">
<el-statistic title="总报价金额" :value="overview.totalAmount / 10000 || 0" :precision="2">
<el-statistic
title="总报价金额"
:value="overview.totalAmount / 10000 || 0"
:precision="2"
>
<template #prefix>
<el-icon class="stat-icon stat-icon-success"><Money /></el-icon>
</template>
@@ -37,7 +41,11 @@
</div>
</div>
<div class="stat-card">
<el-statistic title="已接受金额" :value="overview.acceptedAmount / 10000 || 0" :precision="2">
<el-statistic
title="已接受金额"
:value="overview.acceptedAmount / 10000 || 0"
:precision="2"
>
<template #prefix>
<el-icon class="stat-icon stat-icon-muted"><TrendCharts /></el-icon>
</template>
@@ -55,6 +63,13 @@
<h3 class="section-title">状态详情统计</h3>
<div class="list-body list-wrap">
<el-table :data="statusList" class="list-table" stripe>
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
/>
<el-table-column label="状态" prop="statusName" min-width="120">
<template #default="{ row }">
<el-tag :type="dictStore.getTagType('crm_quote_status', row.status)" size="small">
@@ -90,291 +105,291 @@
</template>
<script setup lang="ts" name="QuoteStatistics">
import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue'
import { useRouter } from 'vue-router'
import { Back, Check, Document, Money, TrendCharts } from '@element-plus/icons-vue'
import { useDictStore } from '@/store/modules/dict'
import { statisticsOverview, statisticsStatus, statisticsTrend } from '@/api/crm/quote'
import * as echarts from 'echarts'
import type { ECharts } from 'echarts'
import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue'
import { useRouter } from 'vue-router'
import { Back, Check, Document, Money, TrendCharts } from '@element-plus/icons-vue'
import { useDictStore } from '@/store/modules/dict'
import { statisticsOverview, statisticsStatus, statisticsTrend } from '@/api/crm/quote'
import * as echarts from 'echarts'
import type { ECharts } from 'echarts'
const dictStore = useDictStore()
const router = useRouter()
const dictStore = useDictStore()
const router = useRouter()
const loading = ref(false)
const overview = ref<Record<string, number>>({})
const statusList = ref<any[]>([])
const trendList = ref<any[]>([])
const trendType = ref('month')
const statusChartRef = ref<HTMLElement>()
const trendChartRef = ref<HTMLElement>()
let statusChart: ECharts | null = null
let trendChart: ECharts | null = null
const loading = ref(false)
const overview = ref<Record<string, number>>({})
const statusList = ref<any[]>([])
const trendList = ref<any[]>([])
const trendType = ref('month')
const statusChartRef = ref<HTMLElement>()
const trendChartRef = ref<HTMLElement>()
let statusChart: ECharts | null = null
let trendChart: ECharts | null = null
const goBack = () => {
router.push('/crm/quote')
}
const formatAmount = (amount: number | undefined) => {
if (!amount) return '0.00'
return amount.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
}
const loadOverview = async () => {
try {
const res = await statisticsOverview()
overview.value = res.data || {}
} catch (error) {
console.error('加载概览数据失败:', error)
}
}
const loadStatusData = async () => {
try {
const res = await statisticsStatus()
statusList.value = res.data || []
await nextTick()
renderStatusChart()
} catch (error) {
console.error('加载状态分布失败:', error)
}
}
const loadTrendData = async () => {
try {
const res = await statisticsTrend({ type: trendType.value })
trendList.value = res.data || []
await nextTick()
renderTrendChart()
} catch (error) {
console.error('加载趋势数据失败:', error)
}
}
const renderStatusChart = () => {
if (!statusChartRef.value || statusList.value.length === 0) return
if (!statusChart) {
statusChart = echarts.init(statusChartRef.value)
const goBack = () => {
router.push('/crm/quote')
}
const chartData = statusList.value.map((item) => ({
name: item.statusName,
value: item.count
}))
const formatAmount = (amount: number | undefined) => {
if (!amount) return '0.00'
return amount.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
}
statusChart.setOption({
tooltip: {
trigger: 'item',
formatter: '{b}: {c}个 ({d}%)'
},
legend: {
orient: 'vertical',
right: '10%',
top: 'center'
},
color: ['#10b981', '#059669', '#d97706', '#ef4444', '#64748b'],
series: [
{
name: '报价单状态',
type: 'pie',
radius: ['40%', '70%'],
avoidLabelOverlap: false,
itemStyle: {
borderRadius: 10,
borderColor: '#fff',
borderWidth: 2
},
label: { show: false, position: 'center' },
emphasis: {
label: { show: true, fontSize: 20, fontWeight: 'bold' }
},
labelLine: { show: false },
data: chartData
}
]
const loadOverview = async () => {
try {
const res = await statisticsOverview()
overview.value = res.data || {}
} catch (error) {
console.error('加载概览数据失败:', error)
}
}
const loadStatusData = async () => {
try {
const res = await statisticsStatus()
statusList.value = res.data || []
await nextTick()
renderStatusChart()
} catch (error) {
console.error('加载状态分布失败:', error)
}
}
const loadTrendData = async () => {
try {
const res = await statisticsTrend({ type: trendType.value })
trendList.value = res.data || []
await nextTick()
renderTrendChart()
} catch (error) {
console.error('加载趋势数据失败:', error)
}
}
const renderStatusChart = () => {
if (!statusChartRef.value || statusList.value.length === 0) return
if (!statusChart) {
statusChart = echarts.init(statusChartRef.value)
}
const chartData = statusList.value.map((item) => ({
name: item.statusName,
value: item.count
}))
statusChart.setOption({
tooltip: {
trigger: 'item',
formatter: '{b}: {c}个 ({d}%)'
},
legend: {
orient: 'vertical',
right: '10%',
top: 'center'
},
color: ['#1ca851', '#168f45', '#d97706', '#ef4444', '#64748b'],
series: [
{
name: '报价单状态',
type: 'pie',
radius: ['40%', '70%'],
avoidLabelOverlap: false,
itemStyle: {
borderRadius: 10,
borderColor: '#fff',
borderWidth: 2
},
label: { show: false, position: 'center' },
emphasis: {
label: { show: true, fontSize: 20, fontWeight: 'bold' }
},
labelLine: { show: false },
data: chartData
}
]
})
}
const renderTrendChart = () => {
if (!trendChartRef.value || trendList.value.length === 0) return
if (!trendChart) {
trendChart = echarts.init(trendChartRef.value)
}
const periods = trendList.value.map((item) => item.period)
const totalCounts = trendList.value.map((item) => item.totalCount)
const acceptedCounts = trendList.value.map((item) => item.acceptedCount)
const totalAmounts = trendList.value.map((item) => (item.totalAmount / 10000).toFixed(2))
const acceptedAmounts = trendList.value.map((item) => (item.acceptedAmount / 10000).toFixed(2))
trendChart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: { type: 'cross', label: { backgroundColor: '#64748b' } }
},
legend: {
data: ['报价数量', '成交数量', '报价金额', '成交金额'],
top: 10
},
grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true },
xAxis: [{ type: 'category', boundaryGap: false, data: periods }],
yAxis: [
{ type: 'value', name: '数量(个)', position: 'left' },
{ type: 'value', name: '金额(万元)', position: 'right' }
],
color: ['#1ca851', '#168f45', '#d97706', '#0ea5e9'],
series: [
{ name: '报价数量', type: 'line', data: totalCounts, smooth: true },
{ name: '成交数量', type: 'line', data: acceptedCounts, smooth: true },
{ name: '报价金额', type: 'line', yAxisIndex: 1, data: totalAmounts, smooth: true },
{ name: '成交金额', type: 'line', yAxisIndex: 1, data: acceptedAmounts, smooth: true }
]
})
}
const loadAllData = async () => {
loading.value = true
try {
await Promise.all([loadOverview(), loadStatusData(), loadTrendData()])
} finally {
loading.value = false
}
}
const handleResize = () => {
statusChart?.resize()
trendChart?.resize()
}
onMounted(() => {
loadAllData()
window.addEventListener('resize', handleResize)
})
}
const renderTrendChart = () => {
if (!trendChartRef.value || trendList.value.length === 0) return
if (!trendChart) {
trendChart = echarts.init(trendChartRef.value)
}
const periods = trendList.value.map((item) => item.period)
const totalCounts = trendList.value.map((item) => item.totalCount)
const acceptedCounts = trendList.value.map((item) => item.acceptedCount)
const totalAmounts = trendList.value.map((item) => (item.totalAmount / 10000).toFixed(2))
const acceptedAmounts = trendList.value.map((item) => (item.acceptedAmount / 10000).toFixed(2))
trendChart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: { type: 'cross', label: { backgroundColor: '#64748b' } }
},
legend: {
data: ['报价数量', '成交数量', '报价金额', '成交金额'],
top: 10
},
grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true },
xAxis: [{ type: 'category', boundaryGap: false, data: periods }],
yAxis: [
{ type: 'value', name: '数量(个)', position: 'left' },
{ type: 'value', name: '金额(万元)', position: 'right' }
],
color: ['#10b981', '#059669', '#d97706', '#0ea5e9'],
series: [
{ name: '报价数量', type: 'line', data: totalCounts, smooth: true },
{ name: '成交数量', type: 'line', data: acceptedCounts, smooth: true },
{ name: '报价金额', type: 'line', yAxisIndex: 1, data: totalAmounts, smooth: true },
{ name: '成交金额', type: 'line', yAxisIndex: 1, data: acceptedAmounts, smooth: true }
]
onBeforeUnmount(() => {
statusChart?.dispose()
trendChart?.dispose()
window.removeEventListener('resize', handleResize)
})
}
const loadAllData = async () => {
loading.value = true
try {
await Promise.all([loadOverview(), loadStatusData(), loadTrendData()])
} finally {
loading.value = false
}
}
const handleResize = () => {
statusChart?.resize()
trendChart?.resize()
}
onMounted(() => {
loadAllData()
window.addEventListener('resize', handleResize)
})
onBeforeUnmount(() => {
statusChart?.dispose()
trendChart?.dispose()
window.removeEventListener('resize', handleResize)
})
</script>
<style lang="scss" scoped>
.panel-top-with-actions {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.stats-overview {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 16px;
margin-bottom: 20px;
@media (max-width: 1100px) {
grid-template-columns: repeat(2, 1fr);
.panel-top-with-actions {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
@media (max-width: 560px) {
grid-template-columns: 1fr;
.stats-overview {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 16px;
margin-bottom: 20px;
@media (max-width: 1100px) {
grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 560px) {
grid-template-columns: 1fr;
}
}
}
.stat-card {
padding: 16px 20px;
border: 1px solid var(--border, #d9e8e2);
border-radius: 10px;
background: #fff;
}
.stat-icon {
margin-right: 4px;
vertical-align: middle;
}
.stat-icon-primary {
color: var(--primary, #10b981);
}
.stat-icon-success {
color: var(--primary-dark, #059669);
}
.stat-icon-warning {
color: #d97706;
}
.stat-icon-muted {
color: var(--mint-text);
}
.stat-extra {
margin-top: 12px;
font-size: 13px;
color: var(--mint-text);
.success-rate {
font-weight: 600;
color: var(--primary-dark, #059669);
.stat-card {
padding: 16px 20px;
border: 1px solid var(--border, #d9e8e2);
border-radius: 10px;
background: #fff;
}
}
.stats-charts-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin-bottom: 20px;
@media (max-width: 1100px) {
grid-template-columns: 1fr;
.stat-icon {
margin-right: 4px;
vertical-align: middle;
}
}
.stats-section {
border: 1px solid var(--border, #d9e8e2);
border-radius: 10px;
padding: 16px;
background: #fff;
}
.stats-section-full {
margin-top: 4px;
}
.section-title {
margin: 0 0 12px;
font-size: 15px;
font-weight: 600;
color: var(--text, #1e293b);
&::before {
content: '';
display: inline-block;
width: 3px;
height: 14px;
margin-right: 8px;
vertical-align: -2px;
background: var(--primary, #10b981);
border-radius: 2px;
.stat-icon-primary {
color: var(--primary, #1ca851);
}
.stat-icon-success {
color: var(--primary-dark, #168f45);
}
.stat-icon-warning {
color: #d97706;
}
.stat-icon-muted {
color: var(--mint-text);
}
}
.section-title-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
.stat-extra {
margin-top: 12px;
font-size: 13px;
color: var(--mint-text);
.success-rate {
font-weight: 600;
color: var(--primary-dark, #168f45);
}
}
.stats-charts-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin-bottom: 20px;
@media (max-width: 1100px) {
grid-template-columns: 1fr;
}
}
.stats-section {
border: 1px solid var(--border, #d9e8e2);
border-radius: 10px;
padding: 16px;
background: #fff;
}
.stats-section-full {
margin-top: 4px;
}
.section-title {
margin-bottom: 0;
margin: 0 0 12px;
font-size: 15px;
font-weight: 600;
color: var(--text, #1e293b);
&::before {
content: '';
display: inline-block;
width: 3px;
height: 14px;
margin-right: 8px;
vertical-align: -2px;
background: var(--primary, #1ca851);
border-radius: 2px;
}
}
}
.chart-box {
height: 350px;
width: 100%;
}
.section-title-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
.chart-box-tall {
height: 400px;
}
.section-title {
margin-bottom: 0;
}
}
.chart-box {
height: 350px;
width: 100%;
}
.chart-box-tall {
height: 400px;
}
</style>
+3 -3
View File
@@ -1473,7 +1473,7 @@ import ListToolbarEndActions from '@/components/business/list-toolbar-end-action
padding-bottom: 12px;
padding-left: 10px;
border-bottom: 1px solid #ebeef5;
border-left: 3px solid #047857;
border-left: 3px solid #147a3c;
}
.form-row {
@@ -1539,7 +1539,7 @@ import ListToolbarEndActions from '@/components/business/list-toolbar-end-action
.parameter-ghost {
opacity: 0.5;
background: #e6f7ff;
border: 1px dashed #047857;
border: 1px dashed #147a3c;
}
.parameter-item {
@@ -1576,7 +1576,7 @@ import ListToolbarEndActions from '@/components/business/list-toolbar-end-action
}
.parameter-drag-handle:hover {
color: #065f46;
color: #125a30;
}
.parameter-order {
+14 -14
View File
@@ -3073,14 +3073,14 @@
.order-list-table :deep(.el-table__expand-icon:hover) {
background: var(--mint-primary-bg, #e8f4ee);
border-color: #047857;
color: var(--mint-primary-dark, #065f46);
border-color: #147a3c;
color: var(--mint-primary-dark, #125a30);
}
.order-list-table :deep(.el-table__expand-icon--expanded) {
background: var(--mint-primary-bg, #e8f4ee);
border-color: #047857;
color: var(--mint-primary-dark, #065f46);
border-color: #147a3c;
color: var(--mint-primary-dark, #125a30);
}
.order-list-table :deep(.el-table__expand-icon svg) {
@@ -3144,7 +3144,7 @@
top: 0;
bottom: 0;
width: 3px;
background: #047857;
background: #147a3c;
}
.order-row-expand-wrap .order-row-expand-table-wrap {
padding: 12px 12px 14px 16px;
@@ -3258,7 +3258,7 @@
font-weight: 600;
margin-bottom: 12px;
padding-left: 12px;
border-left: 4px solid #047857;
border-left: 4px solid #147a3c;
}
.order-tab-pane {
@@ -3276,13 +3276,13 @@
padding: 0 !important;
height: auto !important;
min-height: 0 !important;
color: #065f46 !important;
color: #125a30 !important;
font-weight: 600;
}
.price-version-link:hover,
.price-version-link:focus {
color: #047857 !important;
color: #147a3c !important;
text-decoration: underline;
}
@@ -3309,7 +3309,7 @@
flex-wrap: wrap;
gap: 40px;
padding: 16px 0;
border-top: 2px solid #047857;
border-top: 2px solid #147a3c;
margin-top: 16px;
.amount-item {
@@ -3325,7 +3325,7 @@
margin-left: 8px;
&.success {
color: #065f46;
color: #125a30;
}
}
}
@@ -3366,7 +3366,7 @@
}
.od-address-card--customer :deep(.el-card__header) {
border-left: 4px solid #065f46;
border-left: 4px solid #125a30;
}
.od-address-card-title {
@@ -3456,7 +3456,7 @@
}
.od-address-card--customer :deep(.el-card__header) {
border-left: 4px solid #065f46;
border-left: 4px solid #125a30;
}
.od-address-card-title {
@@ -3570,7 +3570,7 @@
width: 22px;
height: 22px;
border-radius: 50%;
background: #047857;
background: #147a3c;
color: #fff;
font-size: 12px;
font-weight: 600;
@@ -3891,7 +3891,7 @@
border-radius: 12px;
border: 1px solid rgba(4, 120, 87, 0.2);
background: rgba(4, 120, 87, 0.08);
color: #065f46;
color: #125a30;
display: inline-flex;
align-items: center;
justify-content: center;
+5 -5
View File
@@ -2646,7 +2646,7 @@ import ListToolbarEndActions from '@/components/business/list-toolbar-end-action
.banner-loading-icon {
font-size: 22px;
color: #065f46;
color: #125a30;
}
// 新增/编辑弹窗表单容器
@@ -2693,7 +2693,7 @@ import ListToolbarEndActions from '@/components/business/list-toolbar-end-action
padding-bottom: 10px;
padding-left: 10px;
border-bottom: 1px solid var(--mint-border);
border-left: 3px solid #047857;
border-left: 3px solid #147a3c;
.section-tip {
font-size: 12px;
@@ -2884,7 +2884,7 @@ import ListToolbarEndActions from '@/components/business/list-toolbar-end-action
.banner-ghost {
opacity: 0.55;
background: #e8f4ff;
border: 1px dashed #047857;
border: 1px dashed #147a3c;
}
.banner-chosen {
@@ -3081,7 +3081,7 @@ import ListToolbarEndActions from '@/components/business/list-toolbar-end-action
padding-bottom: 8px;
padding-left: 10px;
border-bottom: 1px solid #ebeef5;
border-left: 3px solid #047857;
border-left: 3px solid #147a3c;
}
.view-banner-list {
@@ -3100,7 +3100,7 @@ import ListToolbarEndActions from '@/components/business/list-toolbar-end-action
border: 1px solid #ebeef5;
&:hover {
border-color: #047857;
border-color: #147a3c;
.view-video-play {
opacity: 1;
+5 -7
View File
@@ -6,14 +6,7 @@
</div>
<div id="app-portal-body">
<aside id="app-sidebar">
<ArtSidebarMenu />
</aside>
<main id="app-workspace">
<div id="app-worktab">
<ArtWorkTab />
</div>
<div id="app-content">
<ArtPageContent />
</div>
@@ -50,10 +43,12 @@
import { storeToRefs } from 'pinia'
import { MenuTypeEnum } from '@/enums/appEnum'
import { useSettingStore } from '@/store/modules/setting'
import { useWorktabStore } from '@/store/modules/worktab'
defineOptions({ name: 'AppLayout' })
const settingStore = useSettingStore()
const worktabStore = useWorktabStore()
const { menuType } = storeToRefs(settingStore)
const isPortalLayout = computed(() => menuType.value === MenuTypeEnum.PORTAL)
@@ -63,6 +58,9 @@
settingStore.switchMenuLayouts(MenuTypeEnum.PORTAL)
}
settingStore.setMenuOpen(true)
// 门户布局强制严格单页(忽略 localStorage 中历史 showWorkTab=true)
settingStore.setWorkTab(false)
worktabStore.enforceSinglePageTabs()
})
</script>
+2 -21
View File
@@ -14,20 +14,17 @@
#app-portal-body {
display: flex;
flex: 1;
flex-direction: column;
min-height: 0;
height: calc(100vh - 56px);
overflow: hidden;
}
#app-sidebar {
flex-shrink: 0;
height: 100%;
}
#app-workspace {
display: flex;
flex: 1;
flex-direction: column;
width: 100%;
min-width: 0;
height: 100%;
overflow: hidden;
@@ -75,22 +72,6 @@
@media only screen and (width <= 800px) {
.app-layout-portal {
#app-portal-body {
position: relative;
}
#app-sidebar {
position: fixed;
top: 56px;
left: 0;
z-index: 300;
height: calc(100vh - 56px);
}
#app-workspace {
width: 100%;
}
#app-content {
:deep(.layout-content) {
width: 100%;
+8
View File
@@ -102,6 +102,14 @@
@row-dblclick="handleView"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column
prop="carrierName"
label="承运商名称"
+8
View File
@@ -82,6 +82,14 @@
@row-dblclick="handleView"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column prop="driverName" label="姓名" min-width="100" align="center">
<template #default="{ row }">
<el-link type="primary" @click="handleView(row)">{{ row.driverName }}</el-link>
@@ -41,7 +41,15 @@
<div class="list-body list-wrap">
<el-table class="list-table" :data="settlementList" v-loading="loading" stripe row-key="id">
<el-table-column prop="settlementNo" label="结算单号" min-width="180" show-overflow-tooltip>
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column prop="settlementNo" label="结算单号" min-width="180" show-overflow-tooltip>
<template #default="{ row }">
<el-link type="primary" @click="handleView(row)">{{ row.settlementNo }}</el-link>
</template>
Loaded 100 of 161 files, more files were not shown because too many files have changed in this diff. Show more