This commit is contained in:
chabai 2025-08-11 10:44:10 +08:00
commit ff2c80e1e8
15 changed files with 2587 additions and 527 deletions

26
.env.development Normal file
View File

@ -0,0 +1,26 @@
# 环境变量 (命名必须以 VITE_ 开头)
# 接口前缀
VITE_API_PREFIX = '/dev-api'
# 接口地址
# VITE_API_BASE_URL = 'http://pms.dtyx.net:9158/'
# VITE_API_BASE_URL = 'http://localhost:8888/'
VITE_API_BASE_URL = 'http://10.18.34.163:8888/'
# VITE_API_BASE_URL = 'http://10.18.34.213:8888/'
# 接口地址 (WebSocket)
# VITE_API_WS_URL = 'ws://localhost:8000'
VITE_API_WS_URL = 'ws://10.18.34.163:8000'
# VITE_API_WS_URL = 'ws://10.18.34.213:8000'
# 地址前缀
VITE_BASE = '/'
# 是否开启开发者工具
VITE_OPEN_DEVTOOLS = false
# 应用配置面板
VITE_APP_SETTING = true
# 客户端ID
VITE_CLIENT_ID = 'ef51c9a3e9046c4f2ea45142c8a8344a'

View File

@ -14,4 +14,4 @@ VITE_BASE = '/'
VITE_APP_SETTING = true VITE_APP_SETTING = true
# 客户端ID # 客户端ID
VITE_CLIENT_ID = 'ef51c9a3e9046c4f2ea45142c8a8344a' VITE_CLIENT_ID = 'ef51c9a3e9046c4f2ea45142c8a8344a'

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -19,8 +19,13 @@
:content-style="{ marginTop: '-5px', padding: 0, border: 'none' }" :content-style="{ marginTop: '-5px', padding: 0, border: 'none' }"
:arrow-style="{ width: 0, height: 0 }" :arrow-style="{ width: 0, height: 0 }"
> >
<a-badge :count="unreadMessageCount" dot> <a-badge
<a-button size="mini" class="gi_hover_btn"> :count="unreadMessageCount"
:dot="unreadMessageCount > 0"
:show-zero="false"
class="notification-badge"
>
<a-button size="mini" class="gi_hover_btn notification-btn">
<template #icon> <template #icon>
<icon-notification :size="18" /> <icon-notification :size="18" />
</template> </template>
@ -97,10 +102,148 @@ onBeforeUnmount(() => {
socket.close() socket.close()
socket = null socket = null
} }
//
if (titleFlashInterval) {
clearInterval(titleFlashInterval)
titleFlashInterval = null
}
}) })
const unreadMessageCount = ref(0) const unreadMessageCount = ref(0)
//
const playNotificationSound = () => {
try {
//
const audioContext = new (window.AudioContext || (window as any).webkitAudioContext)()
const oscillator = audioContext.createOscillator()
const gainNode = audioContext.createGain()
oscillator.connect(gainNode)
gainNode.connect(audioContext.destination)
//
oscillator.frequency.setValueAtTime(800, audioContext.currentTime) // 800Hz
oscillator.type = 'sine'
gainNode.gain.setValueAtTime(0.3, audioContext.currentTime)
gainNode.gain.exponentialRampToValueAtTime(0.01, audioContext.currentTime + 0.5)
//
oscillator.start(audioContext.currentTime)
oscillator.stop(audioContext.currentTime + 0.5)
console.log('播放语音提示')
} catch (error) {
console.error('播放语音提示失败:', error)
}
}
//
let titleFlashInterval: NodeJS.Timeout | null = null
const flashPageTitle = () => {
const originalTitle = document.title
let flashCount = 0
const maxFlashes = 6 // 3-----
//
if (titleFlashInterval) {
clearInterval(titleFlashInterval)
}
titleFlashInterval = setInterval(() => {
if (flashCount >= maxFlashes) {
document.title = originalTitle
if (titleFlashInterval) {
clearInterval(titleFlashInterval)
titleFlashInterval = null
}
return
}
document.title = flashCount % 2 === 0 ? '🔔 新的采购申请' : originalTitle
flashCount++
}, 500)
}
// 便
if (typeof window !== 'undefined') {
(window as any).testNotification = {
playSound: playNotificationSound,
flashTitle: flashPageTitle,
showNotification: () => {
Notification.info({
title: '测试通知',
content: '这是一个测试通知,用于验证通知功能是否正常工作。',
duration: 5000,
closable: true,
position: 'topRight'
})
unreadMessageCount.value++
},
testAll: () => {
playNotificationSound()
flashPageTitle()
Notification.info({
title: '测试通知',
content: '这是一个测试通知,用于验证通知功能是否正常工作。',
duration: 5000,
closable: true,
position: 'topRight'
})
unreadMessageCount.value++
},
//
debugWebSocket: () => {
console.log('=== WebSocket 调试信息 ===')
console.log('Socket对象:', socket)
console.log('Socket状态:', socket ? socket.readyState : '未连接')
console.log('Token:', getToken())
console.log('环境变量:', import.meta.env.VITE_API_WS_URL)
console.log('未读消息计数:', unreadMessageCount.value)
console.log('用户Token:', userStore.token)
},
// WebSocket
simulateWebSocketMessage: () => {
const mockMessage = {
type: "PROCUREMENT_APPLICATION",
title: "新的采购申请",
content: "收到来自 测试用户 的设备采购申请:测试设备"
}
const event = new MessageEvent('message', {
data: JSON.stringify(mockMessage)
})
if (socket && socket.onmessage) {
console.log('模拟WebSocket消息:', mockMessage)
socket.onmessage(event)
} else {
console.error('WebSocket连接不存在或onmessage未设置')
}
},
// WebSocket
reconnectWebSocket: () => {
console.log('强制重新连接WebSocket')
const token = getToken()
if (token) {
if (socket) {
socket.close()
socket = null
}
initWebSocket(token)
} else {
console.error('Token不存在无法重新连接')
}
}
}
// socket便
;(window as any).socket = socket
;(window as any).unreadMessageCount = unreadMessageCount
}
// WebSocket - 使 // WebSocket - 使
let initTimer: NodeJS.Timeout | null = null let initTimer: NodeJS.Timeout | null = null
const initWebSocket = (token: string) => { const initWebSocket = (token: string) => {
@ -116,10 +259,12 @@ const initWebSocket = (token: string) => {
} }
try { try {
// WebSocket URL使
const wsUrl = import.meta.env.VITE_API_WS_URL || 'ws://localhost:8888' const wsUrl = import.meta.env.VITE_API_WS_URL || 'ws://localhost:8888'
console.log('正在连接WebSocket:', `${wsUrl}/websocket?token=${token}`) const wsEndpoint = wsUrl.replace('8000', '8888') // 使8888
console.log('正在连接WebSocket:', `${wsEndpoint}/websocket?token=${token}`)
socket = new WebSocket(`${wsUrl}/websocket?token=${token}`) socket = new WebSocket(`${wsEndpoint}/websocket?token=${token}`)
socket.onopen = () => { socket.onopen = () => {
console.log('WebSocket连接成功') console.log('WebSocket连接成功')
@ -133,6 +278,10 @@ const initWebSocket = (token: string) => {
// //
if (data.type && data.title && data.content) { if (data.type && data.title && data.content) {
console.log('处理通知消息:', data) console.log('处理通知消息:', data)
//
playNotificationSound()
// //
Notification.info({ Notification.info({
title: data.title, title: data.title,
@ -144,6 +293,9 @@ const initWebSocket = (token: string) => {
// //
unreadMessageCount.value++ unreadMessageCount.value++
//
flashPageTitle()
} else { } else {
// //
const count = Number.parseInt(event.data) const count = Number.parseInt(event.data)
@ -181,10 +333,17 @@ const initWebSocket = (token: string) => {
const getMessageCount = async () => { const getMessageCount = async () => {
try { try {
const token = getToken() const token = getToken()
console.log('获取到token:', token ? '存在' : '不存在')
if (token && !socket) { if (token && !socket) {
console.log('准备初始化WebSocket连接')
nextTick(() => { nextTick(() => {
initWebSocket(token) initWebSocket(token)
}) })
} else if (!token) {
console.warn('Token不存在无法建立WebSocket连接')
} else if (socket) {
console.log('WebSocket连接已存在')
} }
} catch (error) { } catch (error) {
console.error('Failed to get message count:', error) console.error('Failed to get message count:', error)
@ -218,9 +377,32 @@ const logout = () => {
onMounted(() => { onMounted(() => {
nextTick(() => { nextTick(() => {
// getMessageCount() // WebSocket
getMessageCount()
// 1
setTimeout(() => {
if (!socket) {
console.log('首次连接失败重试WebSocket连接')
getMessageCount()
}
}, 1000)
}) })
}) })
//
watch(() => userStore.token, (newToken, oldToken) => {
console.log('Token变化:', { oldToken: oldToken ? '存在' : '不存在', newToken: newToken ? '存在' : '不存在' })
if (newToken && !socket) {
console.log('用户登录初始化WebSocket连接')
getMessageCount()
} else if (!newToken && socket) {
console.log('用户登出关闭WebSocket连接')
socket.close()
socket = null
}
}, { immediate: true })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@ -242,4 +424,56 @@ onMounted(() => {
margin-left: 2px; margin-left: 2px;
} }
} }
//
.notification-badge {
.arco-badge-dot {
background-color: #f53f3f;
box-shadow: 0 0 0 2px rgba(245, 63, 63, 0.2);
animation: pulse 2s infinite;
}
.arco-badge-count {
background-color: #f53f3f;
font-weight: bold;
animation: bounce 0.6s ease-in-out;
}
}
.notification-btn {
transition: all 0.3s ease;
&:hover {
transform: scale(1.05);
}
}
//
@keyframes pulse {
0% {
box-shadow: 0 0 0 0 rgba(245, 63, 63, 0.7);
}
70% {
box-shadow: 0 0 0 10px rgba(245, 63, 63, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(245, 63, 63, 0);
}
}
//
@keyframes bounce {
0%, 20%, 53%, 80%, 100% {
transform: translate3d(0, 0, 0);
}
40%, 43% {
transform: translate3d(0, -8px, 0);
}
70% {
transform: translate3d(0, -4px, 0);
}
90% {
transform: translate3d(0, -2px, 0);
}
}
</style> </style>

View File

@ -70,6 +70,6 @@ declare global {
// for type re-export // for type re-export
declare global { declare global {
// @ts-ignore // @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue' export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
import('vue') import('vue')
} }

View File

@ -0,0 +1,125 @@
<template>
<div>
<a-tab-pane key="props" tap="形变" title="形变原数据">
<div class="tab-content">
<raw-data>
</raw-data>
</div>
</a-tab-pane>
</div>
</template>
<script setup>
import rawData from './raw-data.vue';
</script>
<style lang="scss" scoped>
.data-storage-container {
padding: 16px;
background: #f5f5f5;
min-height: 100vh;
}
.page-header {
margin-bottom: 16px;
.page-title {
font-size: 20px;
font-weight: 500;
color: #262626;
margin: 0;
}
}
.tabs-section {
background: #fff;
border-radius: 8px;
padding: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.tab-content {
margin-top: 16px;
}
.filter-section {
margin-bottom: 16px;
padding: 12px;
background: #fafafa;
border-radius: 4px;
.filter-item {
display: inline-flex;
align-items: center;
.filter-label {
font-size: 14px;
color: #595959;
margin-right: 8px;
}
}
}
.uploaded-files-section {
.section-title {
font-size: 16px;
font-weight: 500;
color: #262626;
margin: 0 0 16px 0;
}
}
.preview-container {
text-align: center;
.image-preview,
.video-preview {
max-height: 500px;
overflow: hidden;
}
.file-info {
text-align: left;
p {
margin: 8px 0;
font-size: 14px;
color: #595959;
}
}
}
:deep(.arco-tabs-nav) {
margin-bottom: 0;
}
:deep(.arco-tabs-tab) {
font-size: 14px;
padding: 8px 16px;
}
:deep(.arco-table-th) {
background-color: #fafafa;
color: #8c8c8c;
font-weight: 500;
}
:deep(.arco-table-td) {
padding: 12px 16px;
}
:deep(.arco-tag) {
border-radius: 4px;
font-size: 12px;
}
:deep(.arco-btn-size-small) {
padding: 2px 8px;
font-size: 12px;
}
:deep(.arco-upload-drag:hover) {
border-color: #1890ff;
}
</style>

View File

@ -0,0 +1,590 @@
<template>
<GiPageLayout>
<div class="raw-data-container">
<!-- <div class="page-header">
<div class="page-title">原始数据管理</div>
<div class="page-subtitle">管理和分析原始视频数据</div>
</div> -->
<div class="action-bar">
<div class="action-buttons">
<a-button type="primary" @click="showUploadModal = true">
<template #icon>
<IconUpload />
</template>
上传视频
</a-button>
<a-button type="primary" @click="handleBatchAnalysis">
<template #icon>
<IconPlayCircle />
</template>
批量分析
</a-button>
<a-button type="primary" @click="handleExportData">
<template #icon>
<IconDownload />
</template>
导出数据
</a-button>
</div>
<div class="filter-section">
<a-form :model="filterForm" layout="inline">
<a-form-item label="项目">
<a-select v-model="filterForm.projectId" placeholder="请选择项目">
<a-option value="project-1">风电场A区</a-option>
<a-option value="project-2">风电场B区</a-option>
<a-option value="project-3">风电场C区</a-option>
</a-select>
</a-form-item>
<a-form-item label="机组号">
<a-input v-model="filterForm.unitNumber" placeholder="请输入机组号" />
</a-form-item>
<a-form-item label="状态">
<a-select v-model="filterForm.status" placeholder="请选择状态">
<a-option value="completed">已完成</a-option>
<a-option value="pending">待分析</a-option>
<a-option value="analyzing">分析中</a-option>
<a-option value="failed">失败</a-option>
</a-select>
</a-form-item>
<a-form-item>
<a-button type="primary" @click="handleFilterChange">查询</a-button>
</a-form-item>
</a-form>
</div>
</div>
<div class="project-sections">
<div v-for="project in filteredProjects" :key="project.id" class="project-section">
<div class="project-header">
<div class="project-title">{{ project.name }}</div>
<div class="project-stats">
<div class="stat-item">
<IconVideoCamera />
{{ project.totalVideos }} 个视频
</div>
<div class="stat-item">
<IconCheckCircle />
{{ project.completedCount }} 个已完成
</div>
<div class="stat-item">
<IconClockCircle />
{{ project.pendingCount }} 个待分析
</div>
</div>
</div>
<div class="units-grid">
<div v-for="unit in project.units" :key="unit.id" class="unit-card">
<div class="unit-header">
<div class="unit-title">{{ unit.number }}</div>
<div class="unit-actions">
<a-button type="primary" size="small" @click="handleViewUnitVideos(unit)">查看全部</a-button>
<a-button type="primary" size="small" @click="handleAnalyzeUnit(unit)">{{
getAnalysisButtonText(unit.status)
}}</a-button>
</div>
</div>
<div class="videos-list">
<div v-for="video in unit.videos" :key="video.id" class="video-item">
<div class="video-thumbnail">
<img :src="video.thumbnail" alt="Video Thumbnail" />
<div class="video-overlay" @click="handlePlayVideo(video)">
<IconPlayArrowFill style="font-size: 24px; color: #fff;" />
</div>
</div>
<div class="video-info">
<div class="video-name">{{ video.name }}</div>
<div class="video-meta">
<span>{{ video.duration }}</span>
<span>{{ video.angle }}°</span>
</div>
<div class="video-status">
<a-tag :color="getStatusColor(video.status)">{{ getStatusText(video.status) }}</a-tag>
</div>
</div>
</div>
</div>
<div class="analysis-progress">
<div class="progress-info">
<span>分析进度</span>
<span>{{ unit.progress }}%</span>
</div>
<a-progress :percent="unit.progress" :show-text="false" status="active" />
</div>
</div>
</div>
</div>
</div>
<!-- 视频播放模态框 -->
<a-modal v-model:visible="videoModalVisible" title="原始视频播放" width="900px" @ok="videoModalVisible = false"
@cancel="videoModalVisible = false">
<video v-if="selectedVideo" :src="selectedVideo.url" controls
style="width: 100%; height: 480px; border-radius: 8px; background: #000;"></video>
<div v-if="selectedVideo" class="video-meta-info">
<p>项目{{ selectedVideo.projectName }}</p>
<p>机组号{{ selectedVideo.unitNumber }}</p>
<p>采集人{{ selectedVideo.collector }}</p>
<p>风速{{ selectedVideo.windSpeed }} m/s</p>
<p>转速{{ selectedVideo.rpm }} rpm</p>
<p>采集时间{{ selectedVideo.time }}</p>
<p>角度{{ selectedVideo.angle }}°</p>
</div>
</a-modal>
<!-- 上传视频模态框 -->
<a-modal v-model:visible="showUploadModal" title="上传原始视频" width="600px" @ok="handleUpload"
@cancel="showUploadModal = false">
<a-form :model="uploadForm" layout="vertical">
<a-form-item label="项目" required>
<a-select v-model="uploadForm.projectId" placeholder="请选择项目">
<a-option value="project-1">风电场A区</a-option>
<a-option value="project-2">风电场B区</a-option>
<a-option value="project-3">风电场C区</a-option>
</a-select>
</a-form-item>
<a-form-item label="机组号" required>
<a-input v-model="uploadForm.unitNumber" placeholder="请输入机组号" />
</a-form-item>
<a-form-item label="采集人" required>
<a-input v-model="uploadForm.collector" placeholder="请输入采集人姓名" />
</a-form-item>
<a-form-item label="风速 (m/s)">
<a-input-number v-model="uploadForm.windSpeed" :min="0" />
</a-form-item>
<a-form-item label="转速 (rpm)">
<a-input-number v-model="uploadForm.rpm" :min="0" />
</a-form-item>
<a-form-item label="采集时间" required>
<a-date-picker v-model="uploadForm.time" show-time format="YYYY-MM-DD HH:mm" style="width: 100%;" />
</a-form-item>
<a-form-item label="视频文件可多选建议3个角度" required>
<a-upload v-model:file-list="uploadForm.fileList" :multiple="true" :limit="3" accept="video/*"
:auto-upload="false" list-type="picture-card">
<template #upload-button>
<a-button>选择视频</a-button>
</template>
</a-upload>
</a-form-item>
</a-form>
</a-modal>
</div>
</GiPageLayout>
</template>
<script setup lang="ts">
import { ref, reactive, computed } from 'vue'
import { Message } from '@arco-design/web-vue'
import {
IconUpload,
IconPlayCircle,
IconDownload,
IconVideoCamera,
IconCheckCircle,
IconClockCircle,
IconPlayArrowFill
} from '@arco-design/web-vue/es/icon'
const showUploadModal = ref(false)
const videoModalVisible = ref(false)
const selectedVideo = ref<any>(null)
const filterForm = reactive({
projectId: '',
unitNumber: '',
status: ''
})
const uploadForm = reactive({
projectId: '',
unitNumber: '',
collector: '',
windSpeed: null,
rpm: null,
time: '',
fileList: []
})
//
const projects = ref([
{
id: 'project-1',
name: '风电场A区',
totalVideos: 6,
completedCount: 4,
pendingCount: 2,
units: [
{
id: 'A-001',
number: 'A-001',
status: 'completed',
progress: 100,
videos: [
{
id: 'v1',
name: 'A-001-正面',
url: '/videos/A-001-front.mp4',
thumbnail: '/images/A-001-front.jpg',
angle: 0,
duration: '00:30',
status: 'completed',
projectName: '风电场A区',
unitNumber: 'A-001',
collector: '张三',
windSpeed: 8.2,
rpm: 15,
time: '2023-11-05 08:00'
},
{
id: 'v2',
name: 'A-001-侧面',
url: '/videos/A-001-side.mp4',
thumbnail: '/images/A-001-side.jpg',
angle: 90,
duration: '00:30',
status: 'completed',
projectName: '风电场A区',
unitNumber: 'A-001',
collector: '张三',
windSpeed: 8.2,
rpm: 15,
time: '2023-11-05 08:00'
},
{
id: 'v3',
name: 'A-001-背面',
url: '/videos/A-001-back.mp4',
thumbnail: '/images/A-001-back.jpg',
angle: 180,
duration: '00:30',
status: 'pending',
projectName: '风电场A区',
unitNumber: 'A-001',
collector: '张三',
windSpeed: 8.2,
rpm: 15,
time: '2023-11-05 08:00'
}
]
},
{
id: 'A-002',
number: 'A-002',
status: 'analyzing',
progress: 60,
videos: [
{
id: 'v4',
name: 'A-002-正面',
url: '/videos/A-002-front.mp4',
thumbnail: '/images/A-002-front.jpg',
angle: 0,
duration: '00:28',
status: 'analyzing',
projectName: '风电场A区',
unitNumber: 'A-002',
collector: '李四',
windSpeed: 7.9,
rpm: 14,
time: '2023-11-05 12:00'
},
{
id: 'v5',
name: 'A-002-侧面',
url: '/videos/A-002-side.mp4',
thumbnail: '/images/A-002-side.jpg',
angle: 90,
duration: '00:28',
status: 'pending',
projectName: '风电场A区',
unitNumber: 'A-002',
collector: '李四',
windSpeed: 7.9,
rpm: 14,
time: '2023-11-05 12:00'
},
{
id: 'v6',
name: 'A-002-背面',
url: '/videos/A-002-back.mp4',
thumbnail: '/images/A-002-back.jpg',
angle: 180,
duration: '00:28',
status: 'pending',
projectName: '风电场A区',
unitNumber: 'A-002',
collector: '李四',
windSpeed: 7.9,
rpm: 14,
time: '2023-11-05 12:00'
}
]
}
]
}
// ...
])
const filteredProjects = computed(() => {
//
return projects.value
.filter(p => !filterForm.projectId || p.id === filterForm.projectId)
.map(project => ({
...project,
units: project.units
.filter(u => !filterForm.unitNumber || u.number === filterForm.unitNumber)
.map(unit => ({
...unit,
videos: unit.videos.filter(v => !filterForm.status || v.status === filterForm.status)
}))
.filter(u => u.videos.length > 0)
}))
.filter(p => p.units.length > 0)
})
function handleFilterChange() {
// API
}
function handlePlayVideo(video: any) {
selectedVideo.value = video
videoModalVisible.value = true
}
function handleViewUnitVideos(unit: any) {
//
Message.info(`查看机组 ${unit.number} 的所有视频`)
}
function handleAnalyzeUnit(unit: any) {
//
Message.success(`已提交机组 ${unit.number} 的分析任务`)
// API
}
function getStatusColor(status: string) {
switch (status) {
case 'completed': return 'green'
case 'pending': return 'gray'
case 'analyzing': return 'blue'
case 'failed': return 'red'
default: return 'gray'
}
}
function getStatusText(status: string) {
switch (status) {
case 'completed': return '已完成'
case 'pending': return '待分析'
case 'analyzing': return '分析中'
case 'failed': return '失败'
default: return '未知'
}
}
function getAnalysisButtonText(status: string) {
switch (status) {
case 'completed': return '重新分析'
case 'pending': return '分析'
case 'analyzing': return '分析中...'
case 'failed': return '重新分析'
default: return '分析'
}
}
function handleBatchAnalysis() {
Message.success('批量分析任务已提交')
}
function handleExportData() {
Message.success('数据导出成功')
}
function handleUpload() {
Message.success('上传成功')
showUploadModal.value = false
}
</script>
<style scoped lang="scss">
.raw-data-container {
padding: 20px;
}
.page-header {
margin-bottom: 20px;
}
.page-title {
font-size: 28px;
font-weight: 600;
margin: 0 0 8px 0;
color: #1d2129;
}
.page-subtitle {
font-size: 14px;
color: #86909c;
margin: 0;
}
.action-bar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
.filter-section {
margin-left: 24px;
}
}
.project-sections {
.project-section {
margin-bottom: 32px;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 8px #f0f1f2;
padding: 20px;
.project-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
.project-title {
font-size: 20px;
font-weight: 600;
}
.project-stats {
display: flex;
gap: 16px;
.stat-item {
display: flex;
align-items: center;
gap: 4px;
color: #86909c;
}
}
}
.units-grid {
display: flex;
gap: 24px;
flex-wrap: wrap;
.unit-card {
background: #fafbfc;
border-radius: 8px;
padding: 16px;
width: 360px;
margin-bottom: 16px;
.unit-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
.unit-title {
font-size: 16px;
font-weight: 600;
}
.unit-actions {
display: flex;
gap: 8px;
}
}
.videos-list {
display: flex;
gap: 12px;
margin-bottom: 8px;
.video-item {
width: 100px;
.video-thumbnail {
position: relative;
width: 100px;
height: 60px;
border-radius: 6px;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
.video-overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
background: rgba(0, 0, 0, 0.2);
opacity: 0;
transition: opacity 0.2s;
&:hover {
opacity: 1;
}
}
}
.video-info {
margin-top: 4px;
.video-name {
font-size: 12px;
font-weight: 500;
color: #1d2129;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.video-meta {
font-size: 11px;
color: #86909c;
display: flex;
gap: 4px;
}
.video-status {
margin-top: 2px;
}
}
}
}
.analysis-progress {
margin-top: 8px;
.progress-info {
display: flex;
justify-content: space-between;
font-size: 12px;
color: #86909c;
margin-bottom: 2px;
}
}
}
}
}
}
.video-meta-info {
margin-top: 16px;
font-size: 13px;
color: #4e5969;
p {
margin: 2px 0;
}
}
</style>

View File

@ -1,7 +1,7 @@
<template> <template>
<GiPageLayout> <GiPageLayout>
<!-- 页面标题 --> <!-- 页面标题 -->
<!-- <div class="page-header"> <!-- <div class="page-header">
<h2 class="page-title">图像音频关联查看</h2> <h2 class="page-title">图像音频关联查看</h2>
</div>--> </div>-->
@ -17,62 +17,32 @@
<!-- 项目选择 --> <!-- 项目选择 -->
<div class="filter-item"> <div class="filter-item">
<span class="filter-label">项目</span> <span class="filter-label">项目</span>
<a-select <a-select v-model="filterParams.project" placeholder="请选择项目" :options="projectOptions" allow-search
v-model="filterParams.project" allow-clear :loading="loading.project" style="width: 200px" @change="handleFilterChange" />
placeholder="请选择项目"
:options="projectOptions"
allow-search
allow-clear
:loading="loading.project"
style="width: 200px"
@change="handleFilterChange"
/>
</div> </div>
<!-- 机组选择 --> <!-- 机组选择 -->
<div class="filter-item"> <div class="filter-item">
<span class="filter-label">机组</span> <span class="filter-label">机组</span>
<a-select <a-select v-model="filterParams.unit" placeholder="请先选择项目" :options="unitOptions" allow-search
v-model="filterParams.unit" allow-clear :disabled="!filterParams.project" :loading="loading.unit" style="width: 200px"
placeholder="请先选择项目" @change="handleFilterChange" />
:options="unitOptions"
allow-search
allow-clear
:disabled="!filterParams.project"
:loading="loading.unit"
style="width: 200px"
@change="handleFilterChange"
/>
</div> </div>
<!-- 部件选择 --> <!-- 部件选择 -->
<div class="filter-item"> <div class="filter-item">
<span class="filter-label">部件</span> <span class="filter-label">部件</span>
<a-select <a-select v-model="filterParams.component" placeholder="请先选择机组" :options="componentOptions"
v-model="filterParams.component" allow-search allow-clear :disabled="!filterParams.unit" :loading="loading.component"
placeholder="请先选择机组" style="width: 200px" @change="handleFilterChange" />
:options="componentOptions"
allow-search
allow-clear
:disabled="!filterParams.unit"
:loading="loading.component"
style="width: 200px"
@change="handleFilterChange"
/>
</div> </div>
</a-space> </a-space>
</div> </div>
<!-- 已上传数据列表 --> <!-- 已上传数据列表 -->
<div class="uploaded-files-section"> <div class="uploaded-files-section">
<a-table <a-table :columns="fileColumns" :data="imageList" :pagination="false"
:columns="fileColumns" :scroll="{ x: '100%', y: 'calc(100vh - 380px)' }" :loading="loading.image" class="scrollable-table">
:data="imageList"
:pagination="false"
:scroll="{ x: '100%', y: 'calc(100vh - 380px)' }"
:loading="loading.image"
class="scrollable-table"
>
<!-- 文件类型 --> <!-- 文件类型 -->
<template #type="{ record }"> <template #type="{ record }">
<a-tag :color="getFileTypeColor(record.type)" size="small"> <a-tag :color="getFileTypeColor(record.type)" size="small">
@ -82,7 +52,7 @@
<!-- 文件大小 --> <!-- 文件大小 -->
<template #size="{ record }"> <template #size="{ record }">
<span>{{ record.imageTypeLabel}}</span> <span>{{ record.imageTypeLabel }}</span>
</template> </template>
<!-- 状态 --> <!-- 状态 -->
@ -103,6 +73,13 @@
</div> </div>
</div> </div>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="props" tap="形变" title="形变原数据">
<div class="tab-content">
<raw-data>
</raw-data>
</div>
</a-tab-pane>
</a-tabs> </a-tabs>
</div> </div>
@ -112,10 +89,11 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed,onMounted } from 'vue' import { ref, reactive, computed, onMounted } from 'vue'
import { Message } from '@arco-design/web-vue' import { Message } from '@arco-design/web-vue'
import type { TableColumnData } from '@arco-design/web-vue' import type { TableColumnData } from '@arco-design/web-vue'
import PreviewModal from './components/PreviewModal.vue'
import rawData from './components/raw-data.vue'
import { import {
getProjectList, getProjectList,
getTurbineList, getTurbineList,
@ -127,6 +105,7 @@ import {
batchUploadImages, batchUploadImages,
uploadImageToPartV2 uploadImageToPartV2
} from '@/apis/industrial-image' } from '@/apis/industrial-image'
import DeformationTap from './components/DeformationTap.vue'
// //
// const previewModal = ref() // const previewModal = ref()
@ -141,9 +120,9 @@ const filterParams = reactive({
}) })
// //
const projectOptions = ref<Array<{label: string, value: string}>>([]) const projectOptions = ref<Array<{ label: string, value: string }>>([])
const unitOptions = ref<Array<{label: string, value: string}>>([]) const unitOptions = ref<Array<{ label: string, value: string }>>([])
const componentOptions = ref<Array<{label: string, value: string}>>([]) const componentOptions = ref<Array<{ label: string, value: string }>>([])
// //
const imageList = ref<Array<{ const imageList = ref<Array<{
@ -251,37 +230,32 @@ const fetchPartList = async (projectId: string, turbineId: string) => {
// //
const handleFilterChange = async () => { const handleFilterChange = async () => {
// if (!filterParams.project) return // if (!filterParams.project) return
loading.image = true loading.image = true
try { try {
let params = { const params: any = {
projectId: filterParams.project projectId: filterParams.project,
} }
if(filterParams.unit){
params = { if (filterParams.unit) {
projectId: filterParams.project, params.turbineId = filterParams.unit
turbineId: filterParams.unit
}
} }
if(filterParams.component){
params = { if (filterParams.component) {
projectId: filterParams.project, params.partId = filterParams.component
turbineId: filterParams.unit,
partId: filterParams.component
}
} }
const res = await getImageList(params) const res = await getImageList(params)
imageList.value = res.data.map((item: any) => ({ imageList.value = res.data.map((item: any) => ({
id: item.imageId, id: item.imageId,
name: item.imageName, name: item.imageName,
type: item.imageType?item.imageType:"未指定类型", type: item.imageType ? item.imageType : "未指定类型",
imageTypeLabel: item.imageTypeLabel, imageTypeLabel: item.imageTypeLabel,
shootingTime: item.shootingTime, shootingTime: item.shootingTime,
preTreatment: item.preTreatment?"已审核":"未审核", preTreatment: item.preTreatment ? "已审核" : "未审核",
imagePath: item.imagePath, imagePath: item.imagePath,
audioList:item.audioList audioList: item.audioList
})) }))
Message.success(`获取到 ${imageList.value.length} 条图像数据`) Message.success(`获取到 ${imageList.value.length} 条图像数据`)
} catch (error) { } catch (error) {
@ -313,14 +287,6 @@ const fileColumns: TableColumnData[] = [
{ title: '操作', slotName: 'action', width: 150, fixed: 'right' } { title: '操作', slotName: 'action', width: 150, fixed: 'right' }
] ]
//
const filteredFiles = computed(() => {
return uploadedFiles.value.filter(file =>
(filterParams.project === null || file.project === filterParams.project) &&
(filterParams.unit === null || file.unit === filterParams.unit) &&
(filterParams.component === null || file.component === filterParams.component)
)
})
// //
const getFileTypeColor = (type: string) => { const getFileTypeColor = (type: string) => {
@ -360,6 +326,9 @@ const getImageUrl = (imagePath: string): string => {
// //
const previewFile = (file: any) => { const previewFile = (file: any) => {
/* previewFileData.value = file
previewModalVisible.value = true*/
const fileObj = { const fileObj = {
id: file.id, id: file.id,
name: file.name, name: file.name,
@ -373,12 +342,7 @@ const previewFile = (file: any) => {
// //
const deleteFile = (file: any) => { const deleteFile = (file: any) => {
console.log(index);
const index = uploadedFiles.value.findIndex(f => f.id === file.id)
if (index > -1) {
uploadedFiles.value.splice(index, 1)
Message.success('文件已删除')
}
} }
</script> </script>

View File

@ -0,0 +1,155 @@
<template>
<a-spin :loading="loading">
<div v-if="contractDetail">
<a-descriptions
:column="1"
size="medium"
:label-style="{ width: '120px' }"
>
<a-descriptions-item label="合同编号">
{{ contractDetail.code }}
</a-descriptions-item>
<a-descriptions-item label="项目名称">
{{ contractDetail.projectName }}
</a-descriptions-item>
<a-descriptions-item label="客户名称">
{{ contractDetail.customer }}
</a-descriptions-item>
<a-descriptions-item label="合同金额">
<span class="font-medium text-green-600">{{ (contractDetail.amount || 0).toLocaleString() }}</span>
</a-descriptions-item>
<a-descriptions-item label="已收款金额">
<span class="font-medium text-blue-600">{{ (contractDetail.receivedAmount || 0).toLocaleString() }}</span>
</a-descriptions-item>
<a-descriptions-item label="未收款金额">
<span class="font-medium text-orange-600">{{ (contractDetail.pendingAmount || 0).toLocaleString() }}</span>
</a-descriptions-item>
<a-descriptions-item label="签署日期">
{{ contractDetail.signDate }}
</a-descriptions-item>
<a-descriptions-item label="履约期限">
{{ contractDetail.performanceDeadline }}
</a-descriptions-item>
<a-descriptions-item label="付款日期">
{{ contractDetail.paymentDate }}
</a-descriptions-item>
<a-descriptions-item label="合同状态">
<a-tag :color="getStatusColor(contractDetail.contractStatus)">
{{ getStatusText(contractDetail.contractStatusLabel || contractDetail.contractStatus) }}
</a-tag>
</a-descriptions-item>
<a-descriptions-item label="销售人员">
{{ contractDetail.salespersonName }}
</a-descriptions-item>
<a-descriptions-item label="销售部门">
{{ contractDetail.salespersonDeptName }}
</a-descriptions-item>
<a-descriptions-item label="产品服务">
{{ contractDetail.productService }}
</a-descriptions-item>
<a-descriptions-item label="备注">
{{ contractDetail.notes }}
</a-descriptions-item>
</a-descriptions>
</div>
<div v-else-if="!loading" class="empty-container">
<a-empty description="暂无信息" />
</div>
</a-spin>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import http from '@/utils/http'
import { Message } from '@arco-design/web-vue'
interface ContractDetail {
contractId: string
customer: string
code: string
projectId: string
type: string
productService: string
paymentDate: string | null
performanceDeadline: string | null
paymentAddress: string
amount: number
accountNumber: string
notes: string
contractStatus: string
contractText: string | null
projectName: string
salespersonName: string | null
salespersonDeptName: string
settlementAmount: number | null
receivedAmount: number | null
contractStatusLabel: string | null
createBy: string | null
updateBy: string | null
createTime: string
updateTime: string
page: number
pageSize: number
signDate: string
duration: string
pendingAmount?: number
}
const props = defineProps({
contractId: {
type: String,
required: true
}
})
const contractDetail = ref<ContractDetail | null>(null)
const loading = ref(false)
const getStatusColor = (status: string) => {
const colorMap: Record<string, string> = {
未确认: 'gray',
待审批: 'orange',
已签署: 'blue',
执行中: 'cyan',
已完成: 'green',
已终止: 'red'
}
return colorMap[status] || 'gray'
}
const getStatusText = (status: string) => {
return status || '未知状态'
}
const fetchContractDetail = async () => {
try {
loading.value = true
const response = await http.get(`/contract/${props.contractId}`)
if (response.code === 200) {
contractDetail.value = response.data
//
if (contractDetail.value) {
contractDetail.value.pendingAmount = (contractDetail.value.amount || 0) - (contractDetail.value.receivedAmount || 0)
}
} else {
Message.error(response.msg || '获取合同详情失败')
}
} catch (error) {
console.error('获取合同详情失败:', error)
Message.error('获取合同详情失败')
} finally {
loading.value = false
}
}
onMounted(() => {
fetchContractDetail()
})
</script>
<style scoped>
.empty-container {
text-align: center;
padding: 40px 0;
}
</style>

View File

@ -0,0 +1,122 @@
<template>
<a-form :model="contractData" layout="vertical">
<a-row :gutter="16">
<a-col :span="12">
<a-form-item field="code" label="合同编号">
<a-input v-model="contractData.code" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item field="projectName" label="项目名称">
<a-input v-model="contractData.projectName" />
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :span="12">
<a-form-item field="customer" label="客户名称">
<a-input v-model="contractData.customer" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item field="amount" label="合同金额">
<a-input-number v-model="contractData.amount" style="width: 100%" />
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :span="12">
<a-form-item field="accountNumber" label="收款账号">
<a-input v-model="contractData.accountNumber" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item field="contractStatus" label="合同状态">
<a-select v-model="contractData.contractStatus">
<a-option value="未确认">未确认</a-option>
<a-option value="待审批">待审批</a-option>
<a-option value="已签署">已签署</a-option>
<a-option value="执行中">执行中</a-option>
<a-option value="已完成">已完成</a-option>
<a-option value="已终止">已终止</a-option>
</a-select>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :span="12">
<a-form-item field="signDate" label="签订日期">
<a-date-picker v-model="contractData.signDate" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item field="performanceDeadline" label="履约期限">
<a-date-picker v-model="contractData.performanceDeadline" style="width: 100%" />
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :span="12">
<a-form-item field="paymentDate" label="付款日期">
<a-date-picker v-model="contractData.paymentDate" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item field="productService" label="产品或服务">
<a-input v-model="contractData.productService" />
</a-form-item>
</a-col>
</a-row>
<a-form-item field="paymentAddress" label="付款地址">
<a-input v-model="contractData.paymentAddress" />
</a-form-item>
<a-form-item field="notes" label="备注">
<a-textarea v-model="contractData.notes" />
</a-form-item>
<a-form-item field="contractText" label="合同内容">
<a-textarea v-model="contractData.contractText" />
</a-form-item>
</a-form>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import type { ContractItem } from './index.vue'
const props = defineProps<{
contractData: ContractItem
}>()
const emit = defineEmits<{
(e: 'update:contractData', data: ContractItem): void
}>()
const contractData = ref({ ...props.contractData })
// props
watch(
() => props.contractData,
(newVal) => {
if (newVal) {
contractData.value = { ...newVal }
}
},
{ immediate: true },
)
//
watch(
contractData,
(newVal) => {
emit('update:contractData', newVal)
},
{ deep: true },
)
</script>

View File

@ -1,28 +1,28 @@
<template> <template>
<GiPageLayout> <GiPageLayout>
<GiTable <GiTable
row-key="id" row-key="id"
title="支出合同管理" title="支出合同管理"
:data="dataList" :data="dataList"
:columns="tableColumns" :columns="tableColumns"
:loading="loading" :loading="loading"
:scroll="{ x: '100%', y: '100%', minWidth: 1600 }" :scroll="{ x: '100%', y: '100%', minWidth: 1600 }"
:pagination="pagination" :pagination="pagination"
@page-change="onPageChange" @page-change="onPageChange"
@page-size-change="onPageSizeChange" @page-size-change="onPageSizeChange"
@refresh="search" @refresh="search"
> >
<template #top> <template #top>
<GiForm <GiForm
v-model="searchForm" v-model="searchForm"
search search
:columns="queryFormColumns" :columns="queryFormColumns"
size="medium" size="medium"
@search="search" @search="search"
@reset="reset" @reset="reset"
/> />
</template> </template>
<template #toolbar-left> <template #toolbar-left>
<a-space> <a-space>
<a-button type="primary" @click="openAddModal"> <a-button type="primary" @click="openAddModal">
@ -35,51 +35,113 @@
</a-button> </a-button>
</a-space> </a-space>
</template> </template>
<!-- 合同状态 --> <!-- 合同状态 -->
<template #status="{ record }"> <template #status="{ record }">
<a-tag :color="getStatusColor(record.status)"> <a-tag :color="getStatusColor(record.contractStatus)">
{{ getStatusText(record.status) }} {{ getStatusText(record.contractStatusLabel || record.contractStatus) }}
</a-tag> </a-tag>
</template> </template>
<!-- 合同金额 --> <!-- 合同金额 -->
<template #contractAmount="{ record }"> <template #contractAmount="{ record }">
<span class="font-medium text-red-600">{{ record.contractAmount.toLocaleString() }}</span> <span class="font-medium text-green-600">{{ (record.amount || 0).toLocaleString() }}</span>
</template> </template>
<!-- 款金额 --> <!-- 款金额 -->
<template #paidAmount="{ record }"> <template #receivedAmount="{ record }">
<span class="font-medium text-orange-600">{{ record.paidAmount.toLocaleString() }}</span> <span class="font-medium text-blue-600">{{ (record.receivedAmount || 0).toLocaleString() }}</span>
</template> </template>
<!-- 操作列 -->
<template #action="{ record }"> <template #action="{ record }">
<a-space> <a-space>
<a-link @click="viewDetail(record)">详情</a-link> <a-link @click="viewDetail(record)">详情</a-link>
<a-link @click="editRecord(record)" v-if="record.status === 'draft'">编辑</a-link> <a-link v-if="record.contractStatus === '未确认'" @click="editRecord(record)">编辑</a-link>
<a-link @click="approveContract(record)" v-if="record.status === 'pending'">审批</a-link> <a-link v-if="record.contractStatus === '待审批'" @click="approveContract(record)">审批</a-link>
<a-link @click="viewPayment(record)">付款记录</a-link> <a-link @click="viewPayment(record)">收款记录</a-link>
<a-link v-if="record.contractStatus !== '已签署' && record.contractStatus !== '已完成'" @click="deleteContract(record)">删除</a-link>
</a-space> </a-space>
</template> </template>
</GiTable> </GiTable>
<!-- 合同详情弹窗 -->
<a-modal
v-model:visible="showDetailModal"
title="合同详情"
:width="800"
:footer="false"
@cancel="closeDetailModal"
>
<ContractDetail v-if="showDetailModal" :contract-id="selectedContractId" />
</a-modal>
<!-- 合同编辑弹窗 -->
<a-modal
v-model:visible="showEditModal"
title="编辑合同"
:width="800"
@cancel="closeEditModal"
@before-ok="handleEditSubmit"
>
<ContractEdit
v-if="showEditModal"
:contract-data="selectedContractData"
@update:contract-data="handleContractDataUpdate"
/>
</a-modal>
</GiPageLayout> </GiPageLayout>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, onMounted } from 'vue' import { onMounted, reactive, ref } from 'vue'
import { Message } from '@arco-design/web-vue' import { Message, Modal } from '@arco-design/web-vue'
import type { TableColumnData } from '@arco-design/web-vue' import type { TableColumnData } from '@arco-design/web-vue'
import ContractEdit from './ContractEdit.vue'
import ContractDetail from './ContractDetail.vue'
import http from '@/utils/http'
//
interface ContractItem {
contractId: string
customer: string
code: string
projectId: string
type: string
productService: string
paymentDate: string | null
performanceDeadline: string | null
paymentAddress: string
amount: number
accountNumber: string
notes: string
contractStatus: string
contractText: string | null
projectName: string
salespersonName: string | null
salespersonDeptName: string
settlementAmount: number | null
receivedAmount: number | null
contractStatusLabel: string | null
createBy: string | null
updateBy: string | null
createTime: string
updateTime: string
page: number
pageSize: number
signDate: string
duration: string
}
// //
let searchForm = reactive({ const searchForm = reactive({
contractName: '', contractName: '',
contractCode: '', contractCode: '',
supplier: '', client: '',
status: '', status: '',
signDate: '', signDate: '',
page: 1, page: 1,
size: 10 size: 10,
}) })
// //
@ -89,16 +151,16 @@ const queryFormColumns = [
label: '合同名称', label: '合同名称',
type: 'input' as const, type: 'input' as const,
props: { props: {
placeholder: '请输入合同名称' placeholder: '请输入合同名称',
} },
}, },
{ {
field: 'supplier', field: 'client',
label: '供应商', label: '客户',
type: 'input' as const, type: 'input' as const,
props: { props: {
placeholder: '请输入供应商名称' placeholder: '请输入客户名称',
} },
}, },
{ {
field: 'status', field: 'status',
@ -107,147 +169,121 @@ const queryFormColumns = [
props: { props: {
placeholder: '请选择合同状态', placeholder: '请选择合同状态',
options: [ options: [
{ label: '草稿', value: 'draft' }, { label: '未确认', value: '未确认' },
{ label: '待审批', value: 'pending' }, { label: '待审批', value: '待审批' },
{ label: '已签署', value: 'signed' }, { label: '已签署', value: '已签署' },
{ label: '执行中', value: 'executing' }, { label: '执行中', value: '执行中' },
{ label: '已完成', value: 'completed' }, { label: '已完成', value: '已完成' },
{ label: '已终止', value: 'terminated' } { label: '已终止', value: '已终止' },
] ],
} },
} },
] ]
// //
const tableColumns: TableColumnData[] = [ const tableColumns: TableColumnData[] = [
{ title: '合同编号', dataIndex: 'contractCode', width: 150 }, { title: '合同编号', dataIndex: 'code', width: 150 },
{ title: '合同名称', dataIndex: 'contractName', width: 250, ellipsis: true, tooltip: true }, { title: '项目名称', dataIndex: 'projectName', width: 250, ellipsis: true, tooltip: true },
{ title: '供应商名称', dataIndex: 'supplier', width: 200, ellipsis: true, tooltip: true }, { title: '客户名称', dataIndex: 'customer', width: 200, ellipsis: true, tooltip: true },
{ title: '合同类型', dataIndex: 'contractType', width: 120 }, { title: '合同金额', dataIndex: 'amount', slotName: 'contractAmount', width: 120 },
{ title: '合同金额', dataIndex: 'contractAmount', slotName: 'contractAmount', width: 120 }, { title: '已收款金额', dataIndex: 'receivedAmount', slotName: 'receivedAmount', width: 120 },
{ title: '已付款金额', dataIndex: 'paidAmount', slotName: 'paidAmount', width: 120 }, { title: '未收款金额', dataIndex: 'pendingAmount', width: 120 },
{ title: '未付款金额', dataIndex: 'unpaidAmount', width: 120 },
{ title: '签署日期', dataIndex: 'signDate', width: 120 }, { title: '签署日期', dataIndex: 'signDate', width: 120 },
{ title: '开始日期', dataIndex: 'startDate', width: 120 }, { title: '履约期限', dataIndex: 'performanceDeadline', width: 120 },
{ title: '结束日期', dataIndex: 'endDate', width: 120 }, { title: '付款日期', dataIndex: 'paymentDate', width: 120 },
{ title: '合同状态', dataIndex: 'status', slotName: 'status', width: 100 }, { title: '合同状态', dataIndex: 'contractStatus', slotName: 'status', width: 100 },
{ title: '项目关联', dataIndex: 'relatedProject', width: 200, ellipsis: true, tooltip: true }, { title: '销售人员', dataIndex: 'salespersonName', width: 100 },
{ title: '采购负责人', dataIndex: 'purchaseManager', width: 100 }, { title: '销售部门', dataIndex: 'salespersonDeptName', width: 100 },
{ title: '付款方式', dataIndex: 'paymentMethod', width: 100 }, { title: '产品服务', dataIndex: 'productService', width: 120, ellipsis: true, tooltip: true },
{ title: '备注', dataIndex: 'remark', width: 200, ellipsis: true, tooltip: true }, { title: '备注', dataIndex: 'notes', width: 200, ellipsis: true, tooltip: true },
{ title: '操作', slotName: 'action', width: 200, fixed: 'right' } { title: '操作', slotName: 'action', width: 200, fixed: 'right' },
] ]
// //
const loading = ref(false) const loading = ref(false)
const dataList = ref([ const dataList = ref<ContractItem[]>([])
{
id: 1, // API
contractCode: 'EC2024001', const fetchContractList = async () => {
contractName: '风电检测设备采购合同', try {
supplier: '深圳市智能检测设备有限公司', loading.value = true
contractType: '设备采购', const params = {
contractAmount: 120, page: searchForm.page,
paidAmount: 60, pageSize: searchForm.size,
unpaidAmount: 60, contractName: searchForm.contractName,
signDate: '2024-02-25', code: searchForm.contractCode,
startDate: '2024-03-01', customer: searchForm.client,
endDate: '2024-03-31', contractStatus: searchForm.status,
status: 'executing', signDate: searchForm.signDate,
relatedProject: '华能新能源风电场叶片检测服务项目', }
purchaseManager: '李采购经理',
paymentMethod: '银行转账', const response = await http.get('/contract/list', params)
remark: '按合同约定分期付款'
}, if (response.code === 200) {
{ // ""
id: 2, const allContracts = response.rows || []
contractCode: 'EC2024002', const revenueContracts = allContracts.filter((item: ContractItem) => item.type === '支出合同')
contractName: '无人机检测服务外包合同',
supplier: '北京航天无人机技术有限公司', //
contractType: '服务外包', dataList.value = revenueContracts.map((item: ContractItem) => ({
contractAmount: 85, ...item,
paidAmount: 25.5, pendingAmount: (item.amount || 0) - (item.receivedAmount || 0),
unpaidAmount: 59.5, }))
signDate: '2024-03-02',
startDate: '2024-03-05', pagination.total = Number.parseInt(response.total) || 0
endDate: '2024-04-05', } else {
status: 'executing', Message.error(response.msg || '获取合同列表失败')
relatedProject: '大唐风电场防雷检测项目', dataList.value = []
purchaseManager: '王采购经理', }
paymentMethod: '分期付款', } catch (error) {
remark: '服务外包,按进度付款' console.error('获取合同列表失败:', error)
}, Message.error('获取合同列表失败')
{ dataList.value = []
id: 3, } finally {
contractCode: 'EC2024003', loading.value = false
contractName: '检测车辆租赁合同',
supplier: '上海专业车辆租赁有限公司',
contractType: '车辆租赁',
contractAmount: 15,
paidAmount: 15,
unpaidAmount: 0,
signDate: '2024-01-20',
startDate: '2024-01-25',
endDate: '2024-02-25',
status: 'completed',
relatedProject: '中广核风电场设备维护服务项目',
purchaseManager: '刘采购经理',
paymentMethod: '月付',
remark: '租赁合同已完成'
} }
]) }
const pagination = reactive({ const pagination = reactive({
current: 1, current: 1,
pageSize: 10, pageSize: 10,
total: 3, total: 0,
showTotal: true, showTotal: true,
showPageSize: true showPageSize: true,
}) })
// //
const getStatusColor = (status: string) => { const getStatusColor = (status: string) => {
const colorMap: Record<string, string> = { const colorMap: Record<string, string> = {
'draft': 'gray', 未确认: 'gray',
'pending': 'orange', 待审批: 'orange',
'signed': 'blue', 已签署: 'blue',
'executing': 'cyan', 执行中: 'cyan',
'completed': 'green', 已完成: 'green',
'terminated': 'red' 已终止: 'red',
} }
return colorMap[status] || 'gray' return colorMap[status] || 'gray'
} }
// //
const getStatusText = (status: string) => { const getStatusText = (status: string) => {
const textMap: Record<string, string> = { // contractStatusLabel使使contractStatus
'draft': '草稿', return status || '未知状态'
'pending': '待审批',
'signed': '已签署',
'executing': '执行中',
'completed': '已完成',
'terminated': '已终止'
}
return textMap[status] || status
} }
// //
const search = async () => { const search = async () => {
loading.value = true await fetchContractList()
setTimeout(() => {
loading.value = false
}, 1000)
} }
const reset = () => { const reset = () => {
Object.assign(searchForm, { Object.assign(searchForm, {
contractName: '', contractName: '',
contractCode: '', contractCode: '',
supplier: '', client: '',
status: '', status: '',
signDate: '', signDate: '',
page: 1, page: 1,
size: 10 size: 10,
}) })
pagination.current = 1 pagination.current = 1
search() search()
@ -277,23 +313,131 @@ const exportContract = () => {
Message.info('导出合同功能开发中...') Message.info('导出合同功能开发中...')
} }
const viewDetail = (record: any) => { //
Message.info(`查看合同详情: ${record.contractName}`) const showEditModal = ref(false)
const selectedContractData = ref<ContractItem | null>(null)
const editedContractData = ref<ContractItem | null>(null)
const editRecord = (record: ContractItem) => {
//
const completeRecord = {
...record,
amount: record.amount || 0,
projectId: record.projectId || '',
type: record.type || '收入合同',
contractStatus: record.contractStatus || '未确认',
}
selectedContractData.value = completeRecord
showEditModal.value = true
} }
const editRecord = (record: any) => { const closeEditModal = () => {
Message.info(`编辑合同: ${record.contractName}`) showEditModal.value = false
selectedContractData.value = null
editedContractData.value = null
} }
const approveContract = (record: any) => { const handleContractDataUpdate = (data: ContractItem) => {
Message.info(`审批合同: ${record.contractName}`) editedContractData.value = data
} }
const viewPayment = (record: any) => { const handleEditSubmit = async () => {
Message.info(`查看付款记录: ${record.contractName}`) if (!editedContractData.value) return false;
try {
const requestData = {
...editedContractData.value,
accountNumber: editedContractData.value.accountNumber || '',
amount: editedContractData.value.amount || 0,
code: editedContractData.value.code || '',
contractId: editedContractData.value.contractId,
contractStatus: editedContractData.value.contractStatus || '',
contractText: editedContractData.value.contractText || '',
customer: editedContractData.value.customer || '',
departmentId: editedContractData.value.departmentId || '',
duration: editedContractData.value.duration || '',
notes: editedContractData.value.notes || '',
paymentAddress: editedContractData.value.paymentAddress || '',
paymentDate: editedContractData.value.paymentDate || null,
performanceDeadline: editedContractData.value.performanceDeadline || null,
productService: editedContractData.value.productService || '',
projectId: editedContractData.value.projectId || '',
salespersonId: editedContractData.value.salespersonId || '',
signDate: editedContractData.value.signDate || null,
type: editedContractData.value.type || '',
};
console.log('Edited Contract Data:', requestData); // 便
// /contract PUT
const response = await http.put('/contract', requestData);
//
if (response.status === 200 && response.code === 200) {
Message.success('合同编辑成功');
closeEditModal();
search(); //
return true;
} else {
Message.error(response.msg || '合同编辑失败');
return false;
}
} catch (error) {
console.error('合同编辑失败:', error);
Message.error('合同编辑失败: ' + (error.message || '请稍后再试'));
return false;
}
}
//
const deleteContract = async (record: ContractItem) => {
try {
await Modal.confirm({
title: '确认删除',
content: `确定要删除合同 "${record.projectName}" 吗?`,
})
const response = await http.delete(`/contract/${record.contractId}`)
if (response.code === 200) {
Message.success('合同删除成功')
search() //
} else {
Message.error(response.msg || '合同删除失败')
}
} catch (error) {
//
if (error !== 'cancel') {
console.error('合同删除失败:', error)
Message.error('合同删除失败')
}
}
}
//
const showDetailModal = ref(false)
const selectedContractId = ref<string | null>(null)
const viewDetail = (record: ContractItem) => {
selectedContractId.value = record.contractId
showDetailModal.value = true
}
const closeDetailModal = () => {
showDetailModal.value = false
selectedContractId.value = null
}
const approveContract = (record: ContractItem) => {
Message.info(`审批合同: ${record.projectName}`)
}
const viewPayment = (record: ContractItem) => {
Message.info(`查看收款记录: ${record.projectName}`)
} }
onMounted(() => { onMounted(() => {
search() fetchContractList()
}) })
</script> </script>

View File

@ -8,7 +8,7 @@
5. 导入导出团队成员数据 5. 导入导出团队成员数据
--> -->
<template> <template>
<GiPageLayout> <GiPageLayout class="construction-personnel-page">
<!-- 页面头部 --> <!-- 页面头部 -->
<div class="page-header"> <div class="page-header">
<div class="header-left"> <div class="header-left">
@ -828,15 +828,22 @@ onMounted(() => {
border-radius: 8px; border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
margin-bottom: 24px; margin-bottom: 24px;
max-height: calc(100vh - 300px);
overflow: hidden;
.arco-table-container { .arco-table-container {
overflow-x: auto; overflow-x: auto;
overflow-y: visible; overflow-y: auto;
max-height: calc(100vh - 350px);
} }
.arco-table { .arco-table {
overflow: visible; overflow: visible;
} }
.arco-table-body {
overflow-y: auto;
}
} }
@ -917,6 +924,28 @@ onMounted(() => {
} }
} }
//
.construction-personnel-page {
height: 100vh;
overflow: hidden;
display: flex;
flex-direction: column;
:deep(.gi-page-layout) {
height: 100%;
overflow: hidden;
display: flex;
flex-direction: column;
}
:deep(.gi-page-layout-content) {
flex: 1;
overflow: hidden;
display: flex;
flex-direction: column;
}
}
// //
@media (max-width: 768px) { @media (max-width: 768px) {
.page-header { .page-header {

View File

@ -237,31 +237,37 @@
<!-- 团队成员明细 --> <!-- 团队成员明细 -->
<div class="detail-section"> <div class="detail-section">
<div class="section-header"> <div class="section-header team-members-header">
<h3>团队成员明细</h3> <div class="header-left">
<a-button size="small" @click="openPersonnelManagement"> <h3>团队成员明细</h3>
<span class="member-count" v-if="currentProject.teamMembers && currentProject.teamMembers.length > 0">
({{ currentProject.teamMembers.length }})
</span>
</div>
<a-button size="small" @click="openPersonnelManagement" class="add-member-btn">
<template #icon><icon-user-group /></template> <template #icon><icon-user-group /></template>
添加成员 添加成员
</a-button> </a-button>
</div> </div>
<div class="team-members"> <div class="team-members">
<div <div
v-for="member in currentProject.teamMembers" v-for="(member, index) in currentProject.teamMembers"
:key="member.id" :key="member.id"
class="member-item" class="member-item"
:style="{ animationDelay: `${index * 0.1}s` }"
@click="editMemberPosition(member)" @click="editMemberPosition(member)"
> >
<div class="member-avatar"> <div class="member-avatar">
<icon-user /> <icon-user />
</div> </div>
<div class="member-info"> <div class="member-info">
<div class="member-name">{{ member.name }}</div> <div class="member-name">{{ member.name || '未设置姓名' }}</div>
<div class="member-position">{{ member.position }}</div> <div class="member-position">{{ member.position || '未设置岗位' }}</div>
<div class="member-details"> <div class="member-details">
<span class="member-status" :class="member.status"> <span class="member-status" :class="member.status">
{{ member.status === 'available' ? '在线' : '离线' }} {{ member.status === 'available' ? '在线' : '离线' }}
</span> </span>
<span class="member-date">入职: {{ member.joinDate }}</span> <span class="member-date">入职: {{ member.joinDate || '未设置' }}</span>
</div> </div>
</div> </div>
<div class="member-actions"> <div class="member-actions">
@ -453,15 +459,18 @@ const mapProjectRespToProjectCard = (projectResp: any): any => {
// - 使 // - 使
const teamMembers = projectResp.teamMembers ? projectResp.teamMembers.map((member: any) => { const teamMembers = projectResp.teamMembers ? projectResp.teamMembers.map((member: any) => {
console.log('处理团队成员数据:', member) // console.log('处理团队成员数据:', member) //
console.log('成员userName字段:', member.userName)
console.log('成员name字段:', member.name)
const mappedMember = { const mappedMember = {
id: member.memberId, id: member.memberId,
name: member.name, // 使 name: member.userName || member.name || '未设置姓名', // 使userName
position: member.roleTypeDesc || member.jobCodeDesc, position: member.roleTypeDesc || member.jobCodeDesc || '未设置岗位',
phone: member.phone || '', // phone: member.phone || '', //
email: member.email || '', // email: member.email || '', //
status: member.status === 'ACTIVE' ? 'available' : 'offline', status: member.status === 'ACTIVE' ? 'available' : 'offline',
skills: [], // skills: [], //
joinDate: member.joinDate, joinDate: member.joinDate || '未设置',
remark: member.remark || member.jobDesc || '', remark: member.remark || member.jobDesc || '',
// //
originalData: member originalData: member
@ -533,18 +542,32 @@ const loadKanbanData = async () => {
...(response.data.pendingProjects || []) ...(response.data.pendingProjects || [])
] ]
console.log('后端返回的所有项目数据:', allProjects)
console.log('后端返回的preparingProjects:', response.data.preparingProjects)
console.log('后端返回的ongoingProjects:', response.data.ongoingProjects)
console.log('后端返回的inProgressProjects:', response.data.inProgressProjects)
console.log('后端返回的pendingProjects:', response.data.pendingProjects)
// //
allProjects.forEach(project => { allProjects.forEach(project => {
console.log('处理项目:', project.projectName || project.name)
console.log('项目团队成员:', project.teamMembers)
console.log('项目状态:', project.status, typeof project.status)
const mappedProject = mapProjectRespToProjectCard(project) const mappedProject = mapProjectRespToProjectCard(project)
console.log('映射后的项目:', mappedProject.name)
console.log('映射后的团队成员:', mappedProject.teamMembers)
// //
const status = typeof project.status === 'string' ? parseInt(project.status) : project.status const status = typeof project.status === 'string' ? parseInt(project.status) : project.status
if (status === 0) { if (status === 0) {
// status: 0 // status: 0
console.log('添加到准备中项目:', mappedProject.name)
preparingProjects.value.push(mappedProject) preparingProjects.value.push(mappedProject)
} else if (status === 1) { } else if (status === 1) {
// status: 1 // status: 1
console.log('添加到进行中项目:', mappedProject.name)
ongoingProjects.value.push(mappedProject) ongoingProjects.value.push(mappedProject)
} }
// status: // status:
@ -629,10 +652,12 @@ const openProjectDetail = async (project: any) => {
try { try {
loading.value = true loading.value = true
console.log('正在获取项目详情项目ID:', project.id) console.log('正在获取项目详情项目ID:', project.id)
console.log('传入的项目数据:', project)
// //
if (project.teamMembers && project.teamMembers.length > 0) { if (project.teamMembers && project.teamMembers.length > 0) {
console.log('项目数据已包含团队成员信息,直接使用') console.log('项目数据已包含团队成员信息,直接使用')
console.log('团队成员数据:', project.teamMembers)
currentProject.value = project currentProject.value = project
projectDetailVisible.value = true projectDetailVisible.value = true
return return
@ -643,7 +668,9 @@ const openProjectDetail = async (project: any) => {
if (response.data) { if (response.data) {
// 使 // 使
console.log('API返回的原始数据:', response.data)
currentProject.value = mapProjectRespToProjectCard(response.data) currentProject.value = mapProjectRespToProjectCard(response.data)
console.log('映射后的项目数据:', currentProject.value)
projectDetailVisible.value = true projectDetailVisible.value = true
} else { } else {
// API使 // API使
@ -1135,98 +1162,238 @@ onMounted(async () => {
} }
} }
.team-members-header {
.header-left {
display: flex;
align-items: center;
gap: 8px;
h3 {
margin: 0;
color: #1d2129;
font-size: 18px;
font-weight: 600;
}
.member-count {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 2px 8px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
}
}
.add-member-btn {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
color: white;
border-radius: 8px;
transition: all 0.3s ease;
&:hover {
background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
}
}
.team-members { .team-members {
max-height: 400px;
overflow-y: auto;
padding-right: 8px;
//
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 3px;
}
&::-webkit-scrollbar-thumb {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 3px;
&:hover {
background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}
}
.member-item { .member-item {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 12px; gap: 16px;
padding: 12px; padding: 16px;
border: 1px solid #f0f0f0; border: 1px solid #e5e6eb;
border-radius: 6px; border-radius: 12px;
margin-bottom: 8px; margin-bottom: 12px;
cursor: pointer; cursor: pointer;
transition: all 0.3s ease; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
animation: fadeInUp 0.6s ease-out forwards;
opacity: 0;
transform: translateY(20px);
@keyframes fadeInUp {
to {
opacity: 1;
transform: translateY(0);
}
}
&:hover { &:hover {
background: #f8f9fa; background: linear-gradient(135deg, #f8f9ff 0%, #e8f2ff 100%);
border-color: #667eea; border-color: #667eea;
box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);
transform: translateY(-2px);
}
&:active {
transform: translateY(0);
} }
.member-avatar { .member-avatar {
width: 40px; width: 48px;
height: 40px; height: 48px;
border-radius: 50%; border-radius: 50%;
background: #f0f0f0; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: #86909c; color: white;
font-size: 20px;
box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
position: relative;
&::after {
content: '';
position: absolute;
top: -2px;
right: -2px;
width: 12px;
height: 12px;
border-radius: 50%;
background: #52c41a;
border: 2px solid white;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}
} }
.member-info { .member-info {
flex: 1; flex: 1;
min-width: 0;
.member-name { .member-name {
font-weight: 500; font-weight: 600;
color: #1d2129; color: #1d2129;
margin-bottom: 2px; margin-bottom: 4px;
font-size: 16px;
line-height: 1.4;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
.member-position { .member-position {
font-size: 12px; font-size: 13px;
color: #86909c; color: #4e5969;
margin-bottom: 6px;
font-weight: 500;
background: linear-gradient(135deg, #f0f2f5 0%, #e5e6eb 100%);
padding: 2px 8px;
border-radius: 6px;
display: inline-block;
} }
.member-details { .member-details {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 12px;
font-size: 12px; font-size: 12px;
color: #86909c; color: #86909c;
.member-status { .member-status {
padding: 2px 6px; padding: 4px 8px;
border-radius: 4px; border-radius: 6px;
font-weight: 500; font-weight: 500;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.5px;
&.available { &.available {
background: #e3f2fd; background: linear-gradient(135deg, #e6f7ff 0%, #bae7ff 100%);
color: #2196f3; color: #1890ff;
border: 1px solid #91d5ff;
} }
&.offline { &.offline {
background: #f8f9fa; background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
color: #868e96; color: #8c8c8c;
border: 1px solid #d9d9d9;
} }
} }
.member-date {
background: #f7f8fa;
padding: 2px 6px;
border-radius: 4px;
border: 1px solid #e5e6eb;
}
} }
} }
.member-actions { .member-actions {
.arco-btn { .arco-btn {
font-size: 12px; font-size: 12px;
border-radius: 8px;
padding: 6px 12px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
color: white;
transition: all 0.3s ease;
&:hover {
background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
} }
} }
} }
.empty-state { .empty-state {
text-align: center; text-align: center;
padding: 40px 0; padding: 60px 20px;
color: #86909c; color: #86909c;
background: linear-gradient(135deg, #fafbfc 0%, #f0f2f5 100%);
border-radius: 12px;
border: 2px dashed #d9d9d9;
margin: 20px 0;
.empty-icon { .empty-icon {
font-size: 48px; font-size: 64px;
margin-bottom: 16px; margin-bottom: 20px;
color: #bfbfbf;
opacity: 0.6;
} }
.empty-text { .empty-text {
font-size: 18px; font-size: 20px;
font-weight: 500; font-weight: 600;
margin-bottom: 8px; margin-bottom: 12px;
color: #595959;
} }
.empty-desc { .empty-desc {
font-size: 14px; font-size: 14px;
color: #8c8c8c;
line-height: 1.6;
} }
} }
} }

View File

@ -5,6 +5,11 @@ import createVitePlugins from './config/plugins'
export default defineConfig(({ command, mode }) => { export default defineConfig(({ command, mode }) => {
const env = loadEnv(mode, process.cwd()) as ImportMetaEnv const env = loadEnv(mode, process.cwd()) as ImportMetaEnv
// 设置默认的WebSocket URL
if (!env.VITE_API_WS_URL) {
env.VITE_API_WS_URL = 'ws://localhost:8888'
}
return { return {
// 开发或生产环境服务的公共基础路径 // 开发或生产环境服务的公共基础路径
base: env.VITE_BASE, base: env.VITE_BASE,