From def80005702fd12eb17a6e53554d56624c15b04c Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期二, 03 十一月 2026 17:18:59 +0800
Subject: [PATCH] 部分改动
---
src/views/projectManagement/Management/projectDetail.vue | 448 +++++++-------------------------------------------------
1 files changed, 56 insertions(+), 392 deletions(-)
diff --git a/src/views/projectManagement/Management/projectDetail.vue b/src/views/projectManagement/Management/projectDetail.vue
index f8d9f9c..c25dabb 100644
--- a/src/views/projectManagement/Management/projectDetail.vue
+++ b/src/views/projectManagement/Management/projectDetail.vue
@@ -1,423 +1,87 @@
<template>
- <div class="app-container">
- <el-card class="header-card" shadow="never">
+ <div class="app-container" v-loading="loading">
+ <el-card shadow="never" class="header-card">
<div class="header-row">
- <div class="header-title">椤圭洰璇︽儏</div>
- <div class="header-actions">
- <el-button style="color: white;background: #002FA7;" @click="openProgressReport">杩涘害姹囨姤</el-button>
- <el-button @click="goBack">杩斿洖</el-button>
- </div>
- </div>
- <div v-if="stageSteps.length > 0" class="progress-block">
- <el-steps :active="activeStep" align-center finish-status="success">
- <el-step v-for="(s, idx) in stageSteps" :key="idx" :title="s.name" />
- </el-steps>
- <div class="progress-percent">
- <span class="progress-label">鏁翠綋杩涘害</span>
- <el-progress :percentage="overallProgress" :stroke-width="12" style="flex: 1" />
+ <div><div class="title">{{ info.title || '椤圭洰璇︽儏' }}</div><div class="subtitle">{{ info.no || '-' }} 路 {{ info.source || '鎵嬪姩鍒涘缓' }}</div></div>
+ <div>
+ <el-tag :type="phaseTagType" size="large">{{ info.currentPhase || '鏈紑濮�' }}</el-tag>
+ <el-button v-if="info.currentPhase === '鏈紑濮�'" type="primary" @click="openStart">寮�濮嬮」鐩�</el-button>
+ <el-button v-if="info.currentPhase === '鏈紑濮�'" @click="openEdit">缂栬緫绔嬮」淇℃伅</el-button>
+ <el-button v-else @click="adjustExecutors">璋冩暣椤圭洰鎵ц浜�</el-button>
+ <el-button v-if="nextStage" type="success" @click="advanceStage">杩涘叆{{ nextStage }}</el-button>
+ <el-button @click="router.back()">杩斿洖</el-button>
</div>
</div>
</el-card>
-
- <el-card class="content-card" shadow="never" v-loading="loading">
- <el-tabs v-model="activeTab">
- <el-tab-pane label="鍩虹璧勬枡" name="base">
- <el-descriptions :column="4" border>
- <el-descriptions-item label="鍗曟嵁缂栧彿">{{ info.no || '-' }}</el-descriptions-item>
- <el-descriptions-item label="椤圭洰鍚嶇О">{{ info.title || '-' }}</el-descriptions-item>
- <el-descriptions-item label="瀹㈡埛鍚嶇О">{{ info.clientName || '-' }}</el-descriptions-item>
- <el-descriptions-item label="椤圭洰鍒嗙被">{{ info.projectClassification || '-' }}</el-descriptions-item>
- <el-descriptions-item label="鐖堕」鐩�">{{ parentProjectLabel }}</el-descriptions-item>
- <el-descriptions-item label="绔嬮」鏃ユ湡">{{ info.establishTime || '-' }}</el-descriptions-item>
- <el-descriptions-item label="椤圭洰鏉ユ簮">{{ info.source || '-' }}</el-descriptions-item>
- <el-descriptions-item label="褰撳墠闃舵">{{ currentStageName }}</el-descriptions-item>
- <el-descriptions-item label="瀹℃牳鐘舵��">
- <dict-tag :options="project_management" :value="String(info.reviewStatus ?? '')" />
- </el-descriptions-item>
- </el-descriptions>
-
- <el-descriptions v-if="isFromContract" :column="3" border style="margin-top: 14px;">
- <el-descriptions-item label="鍚堝悓瀹㈡埛">{{ info.clientName || '-' }}</el-descriptions-item>
- <el-descriptions-item label="鍚堝悓閲戦(鍏�)">{{ info.orderAmount ?? '-' }}</el-descriptions-item>
- <el-descriptions-item label="鍚堝悓鏃ユ湡">{{ info.orderDate || '-' }}</el-descriptions-item>
- </el-descriptions>
-
- <div class="attachment-block" v-if="attachments.length > 0">
- <div class="attachment-title">闄勪欢</div>
- <div class="attachment-list">
- <div v-for="(att, idx) in attachments" :key="att.id || att.url || idx" class="attachment-item">
- <el-icon><Document /></el-icon>
- <span class="attachment-name">{{ att.name || att.fileName || att.url || '闄勪欢' }}</span>
- <el-button link type="primary" size="small" @click="downloadAttachment(att)">涓嬭浇</el-button>
- </div>
- </div>
- </div>
- </el-tab-pane>
-
- <el-tab-pane label="椤圭洰闃舵" name="stage">
- <el-table :data="stageNodeRows" border style="margin-top: 14px;">
- <el-table-column align="center" label="搴忓彿" type="index" width="60" />
- <el-table-column label="闃舵" prop="stageName" min-width="160" show-overflow-tooltip />
- <el-table-column label="鎻忚堪" prop="description" min-width="220" show-overflow-tooltip />
- <el-table-column label="瀹為檯璐熻矗浜�" prop="actualLeaderName" width="140" show-overflow-tooltip />
- <el-table-column label="杩涘害(%)" prop="progress" width="110" />
- <el-table-column label="璁″垝寮�濮�" prop="planStartTime" width="120" />
- <el-table-column label="璁″垝缁撴潫" prop="planEndTime" width="120" />
- <el-table-column label="瀹為檯寮�濮�" prop="actualStartTime" width="120" />
- <el-table-column label="瀹為檯缁撴潫" prop="actualEndTime" width="120" />
- <el-table-column label="鏈杩涘害鏃ユ湡" prop="reportDate" width="130" />
- <el-table-column label="闄勪欢" width="90" align="center">
- <template #default="{ row }">
- <span>{{ row.attachmentCount }}</span>
- </template>
- </el-table-column>
- <el-table-column v-if="false" label="鎿嶄綔" width="100" align="center" fixed="right">
- <template #default="{ row }">
- <el-button link type="danger" size="small" @click="handleDeleteStage(row)">鍒犻櫎</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-tab-pane>
- </el-tabs>
+ <el-card shadow="never" class="content-card">
+ <el-descriptions title="椤圭洰鍩烘湰鎯呭喌" :column="4" border>
+ <el-descriptions-item label="椤圭洰鍚嶇О">{{ info.title || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="瀹㈡埛鍚嶇О">{{ info.clientName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="椤圭洰鏉ユ簮">{{ info.source || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="椤圭洰鍒嗙被">{{ info.projectClassification || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="棰勮寮�濮�">{{ info.planStartTime || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="棰勮缁撴潫">{{ info.planEndTime || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="椤圭洰璐熻矗浜�">{{ info.projectLeaderName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="椤圭洰缁忕悊">{{ (info.projectManagerNames || []).join('銆�') || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="椤圭洰鎵ц浜�" :span="2">{{ (info.projectExecutorNames || []).join('銆�') || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="璺熻繘鍛ㄦ湡">{{ followCycleLabel }}</el-descriptions-item>
+ <el-descriptions-item label="璺熻繘瑕佹眰" :span="3">{{ info.followDetail || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="椤圭洰澶囨敞" :span="4">{{ info.remark || '-' }}</el-descriptions-item>
+ </el-descriptions>
+ <div v-if="attachments.length" class="attachment-block">
+ <div class="section-title">椤圭洰闄勪欢</div>
+ <el-button v-for="(file,index) in attachments" :key="file.id || index" link type="primary" @click="download(file)">{{ file.name || file.fileName || `闄勪欢${index + 1}` }}</el-button>
+ </div>
</el-card>
+ <el-card shadow="never" class="content-card"><ProjectExecutionPanel v-if="info.id" ref="executionRef" :project-id="info.id" :project-info="info" /></el-card>
+ <FormDia ref="formDiaRef" @completed="loadDetail" />
</div>
-
- <ProgressReportDialog
- v-model="progressReportVisible"
- :project-id="info.id"
- :project-info="info"
- :plan-nodes="planNodeRows"
- :stage-records="stageNodeRows"
- :default-plan-node-id="defaultPlanNodeId"
- @submitted="handleProgressSubmitted"
- />
</template>
<script setup name="ProjectManagementDetail">
import { computed, getCurrentInstance, onMounted, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
-import { Document } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox } from 'element-plus'
-import { getProject, saveStage, listStage, deleteStage, updateProject } from '@/api/projectManagement/project'
-import { listPlan } from '@/api/projectManagement/projectType'
-import ProgressReportDialog from '@/components/ProjectManagement/ProgressReportDialog.vue'
-import useUserStore from '@/store/modules/user'
+import { getProject } from '@/api/projectManagement/project'
+import { transitionProjectStage } from '@/api/projectManagement/workflow'
+import ProjectExecutionPanel from './components/ProjectExecutionPanel.vue'
+import FormDia from './components/formDia.vue'
const { proxy } = getCurrentInstance()
const route = useRoute()
const router = useRouter()
-const { project_management } = proxy.useDict('project_management')
-
const loading = ref(false)
-const activeTab = ref('base')
-const progressReportVisible = ref(false)
-const userStore = useUserStore()
-
const info = ref({})
const attachments = ref([])
-const projectTypeMap = ref(new Map())
-const planNodeRows = ref([])
-const stageNodeRows = ref([])
-
-const isFromContract = computed(() => info.value?.source === '涓氬姟瀹℃壒')
-
-const parentProjectLabel = computed(() => {
- return (
- info.value?.parentTitle ||
- info.value?.projectManagementInfoParentName ||
- info.value?.projectManagementInfoParentId ||
- '-'
- )
-})
-
-// 鍚勯樁娈靛綋鍓嶈繘搴︼紙鍚屼竴闃舵澶氭姹囨姤鍙栨渶澶у�硷級
-const stageProgressMap = computed(() => {
- const map = {}
- stageNodeRows.value.forEach(r => {
- const key = String(r.projectManagementPlanNodeId ?? '')
- if (!key) return
- map[key] = Math.max(map[key] || 0, Number(r.progress) || 0)
- })
- return map
-})
-
-// 闃舵杩涘害鏉℃暟鎹細浼樺厛浣跨敤椤圭洰涓婂悓姝ョ殑 planStage
-const stageSteps = computed(() => {
- const planStages = Array.isArray(info.value?.planStage) ? info.value.planStage : []
- if (planStages.length > 0) {
- return [...planStages]
- .sort((a, b) => Number(a.sort ?? 0) - Number(b.sort ?? 0))
- .map(i => ({
- id: i.id,
- name: i.name || String(i.id ?? ''),
- status: Number(i.planStageEnum) || 1,
- progress: stageProgressMap.value[String(i.id)] ?? 0
- }))
- }
- const nodes = [...(planNodeRows.value || [])].sort((a, b) => Number(a.sort ?? 0) - Number(b.sort ?? 0))
- return nodes.map(n => {
- const progress = stageProgressMap.value[String(n.id)] ?? 0
- return {
- id: n.id,
- name: n.name || n.workContent || String(n.id ?? ''),
- status: progress >= 100 ? 3 : progress > 0 ? 2 : 1,
- progress
- }
- })
-})
-
-const activeStep = computed(() => {
- const idx = stageSteps.value.findIndex(s => s.status !== 3)
- return idx === -1 ? stageSteps.value.length : idx
-})
-
-const currentStageName = computed(() => {
- const current = stageSteps.value.find(s => s.status === 2) || stageSteps.value[activeStep.value]
- return current?.name || '-'
-})
-
-const overallProgress = computed(() => {
- const list = stageSteps.value
- if (list.length === 0) return 0
- const sum = list.reduce((acc, s) => acc + (Number(s.progress) || 0), 0)
- return Math.round(sum / list.length)
-})
-
-const defaultPlanNodeId = computed(() => {
- const next = stageSteps.value.find(s => s.status !== 3)
- return next?.id ?? stageSteps.value[stageSteps.value.length - 1]?.id
-})
-
-function goBack() {
- router.back()
-}
-
-function openProgressReport() {
- progressReportVisible.value = true
-}
-
-async function saveTeamIfNeeded(teamList) {
- if (!Array.isArray(teamList)) return
- const attachmentIds = attachments.value
- .map(a => a.id ?? a.fileId)
- .filter(v => v !== undefined && v !== null && v !== '')
- .map(String)
- const res = await updateProject({
- info: {
- id: info.value?.id,
- no: info.value?.no,
- title: info.value?.title,
- projectManagementPlanId: info.value?.projectManagementPlanId,
- teamList,
- attachmentIds
- }
- })
- if (res?.code !== 200) throw new Error(res?.msg || '鍥㈤槦淇濆瓨澶辫触')
-}
-
-async function handleProgressSubmitted(payload) {
- try {
- if (Array.isArray(payload.teamList)) {
- await saveTeamIfNeeded(payload.teamList)
- }
- const nodes = Array.isArray(planNodeRows.value) ? planNodeRows.value : []
- const node = nodes.find(n => String(n.id) === String(payload.planNodeId)) || {}
- const description = payload.remark
- ? `${payload.reportDate || ''} ${payload.remark}`.trim()
- : `${payload.reportDate || ''} 杩涘害姹囨姤`.trim()
- const req = {
- id: null,
- projectManagementPlanNodeId: payload.planNodeId,
- projectManagementInfoId: info.value?.id,
- description,
- actualLeaderId: userStore.id || info.value?.managerId,
- actualLeaderName: userStore.nickName || info.value?.managerName || '',
- estimatedDuration: Number(node.estimatedDuration ?? 0) || 0,
- planStartTime: payload.planStartTime || info.value?.planStartTime,
- planEndTime: payload.planEndTime || info.value?.planEndTime,
- actualStartTime: payload.actualStartTime || null,
- actualEndTime: payload.actualEndTime || null,
- progress: Number(payload.completionProgress ?? payload.totalProgress ?? 0) || 0,
- storageBlobDTOs: Array.isArray(payload.storageBlobDTOs) ? payload.storageBlobDTOs : []
- }
- const res = await saveStage(req)
- if (res?.code === 200) {
- ElMessage.success('鎻愪氦鎴愬姛')
- await Promise.all([loadDetail(), loadStageList()])
- return
- }
- ElMessage.error(res?.msg || '鎻愪氦澶辫触')
- } catch (e) {
- ElMessage.error(e?.message || '鎻愪氦澶辫触')
- }
-}
-
-function downloadAttachment(row) {
- if (row?.url) {
- try {
- proxy.$download.byUrl(row.url, row.originalFilename)
- return
- } catch (e) {}
- }
- ElMessage.warning('闄勪欢鏆傛棤涓嬭浇鍦板潃')
-}
-
-async function loadProjectTypeMap() {
- try {
- const res = await listPlan({ current: 1, size: 999 })
- const records = res?.data?.records || res?.records || res?.rows || []
- projectTypeMap.value = new Map((records || []).map(r => [Number(r.id), r]))
- } catch {
- projectTypeMap.value = new Map()
- }
-}
-
-function getPlanNodeName(planNodeId) {
- const list = Array.isArray(planNodeRows.value) ? planNodeRows.value : []
- const node = list.find(n => String(n.id) === String(planNodeId))
- return node?.name || node?.workContent || String(planNodeId ?? '')
-}
-
-async function loadStageList() {
- const projectId = info.value?.id
- if (!projectId) {
- stageNodeRows.value = []
- return
- }
- try {
- const res = await listStage(projectId)
- const data = res?.data?.data ?? res?.data ?? res
- const list = data?.records || data?.rows || data?.list || data || []
- const records = Array.isArray(list) ? list : []
- stageNodeRows.value = records.map(r => {
- const attachmentList = Array.isArray(r.attachmentList) ? r.attachmentList : []
- const blobList = Array.isArray(r.storageBlobVOs) ? r.storageBlobVOs : []
- return {
- ...r,
- stageName: getPlanNodeName(r.projectManagementPlanNodeId),
- reportDate: r.createTime ? String(r.createTime).slice(0, 10) : '',
- attachmentCount: attachmentList.length || blobList.length || 0
- }
- })
- } catch {
- stageNodeRows.value = []
- }
-}
-
-async function handleDeleteStage(row) {
- const stageId = row?.id
- if (!stageId) return
- try {
- await ElMessageBox.confirm('鏄惁纭鍒犻櫎璇ラ」鐩樁娈碉紵', '鎻愮ず', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- })
- const res = await deleteStage(stageId)
- if (res?.code === 200) {
- ElMessage.success('鍒犻櫎鎴愬姛')
- await loadStageList()
- return
- }
- ElMessage.error(res?.msg || '鍒犻櫎澶辫触')
- } catch {}
-}
-
-function syncProjectPlan() {
- const id = info.value?.projectManagementPlanId
- if (id === undefined || id === null || id === '') {
- planNodeRows.value = []
- return
- }
- const plan = projectTypeMap.value.get(Number(id)) || {}
- planNodeRows.value = Array.isArray(plan?.planNodeList) ? plan.planNodeList : []
-}
+const formDiaRef = ref()
+const executionRef = ref()
+const followCycleLabel = computed(() => ({ MONTH: '姣忔湀', QUARTER: '姣忓搴�', YEAR: '姣忓勾' }[info.value.followCycle] || '-'))
+const phaseTagType = computed(() => info.value.currentPhase === '宸插畬鎴�' ? 'success' : info.value.currentPhase === '鏈紑濮�' ? 'info' : 'warning')
+const nextStage = computed(() => ({ '绔嬮」': '鐢虫姤', '寮�鍙�': '鐢虫姤', '鐢虫姤': '鐢虫姤缁撴灉', '鐢虫姤缁撴灉': '楠屾敹', '楠屾敹': '宸插畬鎴�' }[info.value.currentPhase] || ''))
async function loadDetail() {
- const id = route.params?.id
- if (!id) return
loading.value = true
try {
- const res = await getProject(id)
+ const res = await getProject(route.params.id)
const detail = res?.data?.data ?? res?.data ?? res
info.value = detail?.info || {}
- attachments.value = Array.isArray(detail?.info?.attachmentList) ? detail.info.attachmentList : []
- syncProjectPlan()
- await loadStageList()
- } finally {
- loading.value = false
- }
+ attachments.value = info.value.attachmentList || []
+ await executionRef.value?.refresh?.()
+ } catch { ElMessage.error('鑾峰彇椤圭洰璇︽儏澶辫触') } finally { loading.value = false }
}
-
-onMounted(async () => {
- await loadProjectTypeMap()
+function openEdit() { formDiaRef.value?.openDialog({ operationType: 'edit', row: { id: info.value.id }, startProject: false }) }
+function openStart() { formDiaRef.value?.openDialog({ operationType: 'edit', row: { id: info.value.id }, startProject: true }) }
+function adjustExecutors() { formDiaRef.value?.openDialog({ operationType: 'edit', row: { id: info.value.id }, personnelOnly: true }) }
+async function advanceStage() {
+ await ElMessageBox.confirm(`纭灏嗛」鐩帹杩涘埌鈥�${nextStage.value}鈥濆悧锛焋, '椤圭洰闃舵鎺ㄨ繘', { type: 'warning' })
+ await transitionProjectStage({ projectId: info.value.id, targetStage: nextStage.value })
+ ElMessage.success(`宸茶繘鍏�${nextStage.value}闃舵`)
await loadDetail()
-})
+}
+function download(file) { if (!file?.url) return ElMessage.warning('闄勪欢鏆傛棤涓嬭浇鍦板潃'); proxy.$download.byUrl(file.url, file.name || file.fileName) }
+onMounted(loadDetail)
</script>
-<style scoped lang="scss">
-.header-card {
- margin-bottom: 14px;
-}
-
-.header-row {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 12px;
-}
-
-.header-title {
- font-weight: 600;
- font-size: 16px;
-}
-
-.progress-block {
- padding-top: 6px;
-}
-
-.progress-percent {
- display: flex;
- align-items: center;
- gap: 12px;
- margin-top: 16px;
-}
-
-.progress-label {
- font-size: 13px;
- color: #606266;
- white-space: nowrap;
-}
-
-.content-card {
- border-radius: 8px;
-}
-
-.attachment-block {
- margin-top: 14px;
-}
-
-.attachment-title {
- font-weight: 600;
- margin-bottom: 8px;
-}
-
-.attachment-list {
- display: flex;
- flex-direction: column;
- gap: 8px;
-}
-
-.attachment-item {
- display: flex;
- align-items: center;
- gap: 8px;
-}
-
-.attachment-name {
- max-width: 520px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
+<style scoped>
+.app-container { padding: 20px; }.header-card,.content-card { margin-bottom: 16px; }.header-row { display:flex;align-items:center;justify-content:space-between;gap:16px; }.title { font-size:22px;font-weight:600;color:#1f2d3d; }.subtitle { margin-top:6px;color:#909399; }.header-row>div:last-child { display:flex;align-items:center;gap:10px; }.attachment-block { margin-top:18px; }.section-title { margin-bottom:10px;font-weight:600; }
</style>
--
Gitblit v1.9.3