From 6c4bd2467bb6651c6edcf8a9741dcd4e9b1aa6d3 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Fri, 30 Jan 2026 14:42:36 +0800
Subject: [PATCH] feat:权限按钮

---
 applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/index.vue           |   22 +++++++++++++++++-----
 applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue |   26 ++++++++++++++++++--------
 2 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue b/applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue
index 006b0ac..6f482ac 100644
--- a/applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue
+++ b/applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue
@@ -68,7 +68,7 @@
 						</el-row>
 				</div>
 				<!--				申请中-->
-				<div v-if="detailDemandStatus === '1' && !requesterProvider">
+				<div v-if="detailDemandStatus === '1' && (permissionList.approvedBtn || permissionList.rejectBtn)">
 					<div class="detail-title" :style="{ marginTop:pxToRem(10)}">数据上传</div>
 					<div class="upload-container">
 						<el-upload
@@ -106,16 +106,16 @@
 			</div>
 		</div>
 		<template #footer>
-			<template v-if="detailDemandStatus === '1' && !requesterProvider">
-				<el-button color="#F2F3F5" :loading="submitting || uploading" :disabled="submitting || uploading" @click="rejectTheApplication">拒绝申请</el-button>
-				<el-button class="" color="#4C34FF" :loading="submitting || uploading" :disabled="submitting || uploading" @click="approvedByTheReview">审核通过</el-button>
+			<template v-if="detailDemandStatus === '1' ">
+				<el-button v-if="permissionList.rejectBtn" color="#F2F3F5" :loading="submitting || uploading" :disabled="submitting || uploading" @click="rejectTheApplication">拒绝申请</el-button>
+				<el-button v-if="permissionList.approvedBtn" class="" color="#4C34FF" :loading="submitting || uploading" :disabled="submitting || uploading" @click="approvedByTheReview">审核通过</el-button>
 			</template>
 			<template v-if="detailDemandStatus === '2'">
 				<el-button class="" color="#4C34FF" @click="downloadAllFiles">全部下载</el-button>
 			</template>
-			<template v-if="detailDemandStatus === '3'">
-				<el-button class="" color="#4C34FF" @click="visible =false">关闭</el-button>
-			</template>
+<!--			<template v-if="detailDemandStatus === '3'">-->
+<!--				<el-button class="" color="#4C34FF" @click="visible =false">关闭</el-button>-->
+<!--			</template>-->
 		</template>
 	</el-dialog>
 
@@ -142,7 +142,7 @@
 import AuditRecord from '@/views/orderView/orderDataManage/supplyAdd/auditRecord.vue' // 导入新组件
 import { useStore } from 'vuex'
 const store = useStore()
-const requesterProvider = computed(() => store.state.user.userInfo?.role_id === '2014158512610869250')
+const permission = computed(() => store.state.user.permission);
 const emit = defineEmits(['success'])
 const dictObj = inject('dictObj')
 const deptTree = inject('deptTree')
@@ -156,6 +156,16 @@
 const responseData = ref(null)
 const submitting = ref(false) // 提交中状态
 const uploading = ref(false) // 文件上传中状态
+function validData(value, defaultValue) {
+	return value !== undefined ? value : defaultValue
+}
+const permissionList = computed(() => {
+	return {
+		addBtn: validData(permission.value.orderData_addDemand, false),
+		rejectBtn: validData(permission.value.orderData_rejectApplication, false),
+		approvedBtn: validData(permission.value.orderData_approved, false),
+	}
+})
 // 自定义上传请求函数
 const handleHttpRequest = async (options) => {
 	uploading.value = true
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 76d54e2..ac44ba2 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
@@ -35,7 +35,7 @@
 			</el-form-item>
 		</el-form>
 
-		<div class="gd-table-toolbar">
+		<div class="gd-table-toolbar" v-if="permissionList.addBtn">
 			<el-button :icon="Plus" color="#4C34FF" type="primary" @click="openForm('add')">供需填报新增</el-button>
 		</div>
 
@@ -79,9 +79,8 @@
 					<el-table-column label="操作" class-name="operation-btns" width="150">
 						<template v-slot="{ row }">
 							<el-link  type="primary"  @click="openForm('view', row)">查看</el-link>
-							<!-- 只对非审批状态显示编辑和删除按钮 -->
-							<el-link  type="primary"  @click="openForm('edit', row)" v-if="!['1', '2', '3'].includes(row.demandStatus)">编辑</el-link>
-							<el-link  type="primary"  @click="handleDelete(row)" v-if="!['1', '2', '3'].includes(row.demandStatus)">删除</el-link>
+							<el-link  type="primary"  @click="openForm('edit', row)" v-if="!['1', '2', '3'].includes(row.demandStatus) && permissionList.addBtn">编辑</el-link>
+							<el-link  type="primary"  @click="handleDelete(row)" v-if="!['1', '2', '3'].includes(row.demandStatus) && permissionList.deleteBtn">删除</el-link>
 						</template>
 					</el-table-column>
 				</el-table>
@@ -116,7 +115,9 @@
 	gdSupplyDemandPageApi,
 	gdSupplyDemandRemoveApi,
 } from '@/views/orderView/orderDataManage/supplyAdd/supplyAddApi'
-
+import { useStore } from 'vuex'
+const store = useStore()
+const permission = computed(() => store.state.user.permission);
 // 初始化查询参数
 const initSearchParams = () => ({
 	demandName: '', // 需求名称
@@ -151,6 +152,17 @@
 provide('detailDemandStatus', detailDemandStatus)
 const reasonForRejection = ref('') //拒绝原因
 provide('reasonForRejection', reasonForRejection)
+
+function validData(value, defaultValue) {
+	return value !== undefined ? value : defaultValue
+}
+const permissionList = computed(() => {
+	return {
+		addBtn: validData(permission.value.orderData_addDemand, false),
+		deleteBtn: validData(permission.value.orderData_delete, false),
+	}
+})
+
 // 根据部门ID获取部门名称
 function getDeptNameById(deptId, deptList) {
 	if (!deptId || !Array.isArray(deptList)) return ''

--
Gitblit v1.9.3