From c08e32e4cd02ecf7ed794a1b9493bbe6f5b8d04c Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Mon, 19 Jan 2026 17:40:55 +0800
Subject: [PATCH] feat:申请提交

---
 applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/index.vue |   71 ++++++++++++++++++++++++++++-------
 1 files changed, 56 insertions(+), 15 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 4c1fefe..43e7c61 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">
@@ -76,8 +76,8 @@
 					<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>
+							<el-link @click="openForm('edit', row)" v-if="row.demandStatus !== '1'">编辑</el-link>
+							<el-link @click="handleDelete(row)" v-if="row.demandStatus !== '1'">删除</el-link>
 						</template>
 					</el-table-column>
 				</el-table>
@@ -96,16 +96,18 @@
 		</div>
 
 		<FormDiaLog ref="dialogRef" @success="getList" v-if="dialogVisible" v-model="dialogVisible" />
+		<ApplyViewDialog ref="applyDialogRef" 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 +128,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 +145,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 +192,26 @@
 
 // 新增/编辑/查看 弹框
 function openForm(mode, row) {
-	dialogVisible.value = true
-	nextTick(() => {
-		dialogRef.value?.open({ mode, row })
-	})
+	if (mode === 'view' && row?.demandStatus === '1') {
+		// 如果是查看申请中的记录,使用申请详情弹框
+		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 +237,22 @@
 
 // 获取字典
 function getDictList() {
-	getDictionaryByCode('requirementType,sharedType,appSceneType,demandStatus').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