From 7b8789643b13dba1f2190f3bde92a7e4fa8eaafc Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 20 Jan 2026 15:24:59 +0800
Subject: [PATCH] feat:场景类型字典值显示调整

---
 applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/index.vue |   81 +++++++++++++++++++++++++++++++---------
 1 files changed, 62 insertions(+), 19 deletions(-)

diff --git a/applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/index.vue b/applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/index.vue
index a234a92..fc5a434 100644
--- a/applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/index.vue
+++ b/applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/index.vue
@@ -36,8 +36,8 @@
 		</el-form>
 
 		<div class="gd-table-toolbar">
-			<el-button :icon="Plus" color="#4C34FF" type="primary" @click="openForm('add')">新增</el-button>
-			<el-button :icon="Delete" color="#4C34FF" :disabled="!selectedIds.length" @click="handleDelete()">删除</el-button>
+			<el-button :icon="Plus" color="#4C34FF" type="primary" @click="openForm('add')">供需填报新增</el-button>
+<!--			<el-button :icon="Delete" color="#4C34FF" :disabled="!selectedIds.length" @click="handleDelete()">删除</el-button>-->
 		</div>
 
 		<div class="gd-table-container" v-loading="loading">
@@ -54,9 +54,9 @@
 					<el-table-column prop="contactPhone" show-overflow-tooltip label="需求联系人电话" />
 					<el-table-column prop="contactEmail" show-overflow-tooltip label="需求邮箱" />
 					<el-table-column prop="demandStatus" show-overflow-tooltip label="需求状态">
-						<!-- <template v-slot="{ row }">
+						<template v-slot="{ row }">
 							{{ getDictLabel(row.demandStatus, dictObj.demandStatus) }}
-						</template> -->
+						</template>
 					</el-table-column>
 					<el-table-column prop="updateCycle" show-overflow-tooltip label="更新周期" />
 					<el-table-column prop="applyBasis" show-overflow-tooltip label="申请依据" />
@@ -75,10 +75,11 @@
 					<el-table-column prop="demandInfo" show-overflow-tooltip label="需求信息项" />
 					<el-table-column label="操作" class-name="operation-btns">
 						<template v-slot="{ row }">
-							<el-link @click="openForm('view', row)">查看</el-link>
-							<el-link @click="openForm('edit', row)">编辑</el-link>
-							<el-link @click="handleDelete(row)">删除</el-link>
-						</template>
+					<el-link @click="openForm('view', row)">查看</el-link>
+					<!-- 只对非审批状态显示编辑和删除按钮 -->
+					<el-link @click="openForm('edit', row)" v-if="!['1', '2', '3'].includes(row.demandStatus)">编辑</el-link>
+					<el-link @click="handleDelete(row)" v-if="!['1', '2', '3'].includes(row.demandStatus)">删除</el-link>
+				</template>
 					</el-table-column>
 				</el-table>
 			</div>
@@ -96,16 +97,18 @@
 		</div>
 
 		<FormDiaLog ref="dialogRef" @success="getList" v-if="dialogVisible" v-model="dialogVisible" />
+		<ApplyViewDialog ref="applyDialogRef" @success="getList" v-if="applyDialogVisible" v-model="applyDialogVisible" />
 	</basic-container>
 </template>
 <script setup>
 import { Search, RefreshRight, Plus, Delete } from '@element-plus/icons-vue'
-import { onMounted, ref } from 'vue'
+import { onMounted, ref, nextTick } from 'vue'
 import { ElMessage, ElMessageBox } from 'element-plus'
 import { getDictionaryByCode } from '@/api/system/dictbiz'
 import { getDeptTree } from '@/api/system/dept'
 import { getDictLabel } from '@ztzf/utils'
 import FormDiaLog from './FormDiaLog.vue'
+import ApplyViewDialog from './ApplyViewDialog.vue'
 import {
 	gdSupplyDemandPageApi,
 	gdSupplyDemandRemoveApi,
@@ -126,10 +129,13 @@
 const queryParamsRef = ref(null) // 查询表单实例
 const dialogRef = ref(null) // 弹框实例
 const dialogVisible = ref(false)
+const applyDialogRef = ref(null) // 申请详情弹框实例
+const applyDialogVisible = ref(false)
 const dictObj = ref({
 	requirementType: [], // 需求类型
 	sharedType: [], // 共享类型
 	appSceneType: [], // 应用场景类型
+	demandStatus: [], // 需求状态
 })
 provide('dictObj', dictObj)
 const deptTree = ref([]) // 部门树
@@ -140,12 +146,32 @@
 provide('deptTree', deptTree)
 provide('treeProps', treeProps)
 
+// 根据部门ID获取部门名称
+function getDeptNameById(deptId, deptList) {
+	if (!deptId || !Array.isArray(deptList)) return ''
+	for (const dept of deptList) {
+		if (dept.id === deptId) {
+			return dept.name
+		}
+		if (Array.isArray(dept.children) && dept.children.length > 0) {
+			const name = getDeptNameById(deptId, dept.children)
+			if (name) return name
+		}
+	}
+	return ''
+}
+
 // 获取列表
 async function getList() {
 	loading.value = true
 	try {
 		const res = await gdSupplyDemandPageApi(searchParams.value)
-		list.value = res?.data?.data?.records ?? []
+		const records = res?.data?.data?.records ?? []
+		// 为每条记录添加部门名称
+		list.value = records.map(item => ({
+			...item,
+			responsibleDeptName: item.responsibleDeptName || getDeptNameById(item.responsibleDeptId, deptTree.value)
+		}))
 		total.value = res?.data?.data?.total ?? 0
 	} finally {
 		loading.value = false
@@ -167,10 +193,27 @@
 
 // 新增/编辑/查看 弹框
 function openForm(mode, row) {
-	dialogVisible.value = true
-	nextTick(() => {
-		dialogRef.value?.open({ mode, row })
-	})
+	// 对于所有审批相关状态(申请中、审核通过、审核拒绝)都使用申请详情弹框
+	if (mode === 'view' && ['1', '2', '3'].includes(row?.demandStatus)) {
+		// 使用申请详情弹框
+		openApplyViewDialog(row)
+	} else {
+		// 其他情况使用原有弹框
+		dialogVisible.value = true
+		nextTick(() => {
+			dialogRef.value?.open({ mode, row })
+		})
+	}
+}
+
+// 打开申请详情弹框
+function openApplyViewDialog(row) {
+	if (row?.id) {
+		applyDialogVisible.value = true
+		nextTick(() => {
+			applyDialogRef.value?.open({ row })
+		})
+	}
 }
 
 // 删除
@@ -196,22 +239,22 @@
 
 // 获取字典
 function getDictList() {
-	getDictionaryByCode('requirementType,sharedType,appSceneType').then(res => {
+	return getDictionaryByCode('requirementType,sharedType,appSceneType,demandStatus').then(res => {
 		dictObj.value = res.data.data
 	})
 }
 
 // 获取部门树
 function getDeptTreeFun() {
-	getDeptTree().then(res => {
+	return getDeptTree().then(res => {
 		deptTree.value = res.data.data
 	})
 }
 
-onMounted(() => {
+onMounted(async () => {
+	// 先获取字典和部门树数据,再获取列表数据
+	await Promise.all([getDictList(), getDeptTreeFun()])
 	getList()
-	getDictList()
-	getDeptTreeFun()
 })
 </script>
 <style scoped lang="scss"></style>

--
Gitblit v1.9.3