From 45d90d1e7ba86286e998d1ac4d2cba8e98cd059b Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期一, 12 一月 2026 20:52:30 +0800
Subject: [PATCH] feat: 优化内存
---
app/pagesTask/detail.vue | 102 ++++++++++++++++++++++++++++++++++++---------------
1 files changed, 72 insertions(+), 30 deletions(-)
diff --git a/app/pagesTask/detail.vue b/app/pagesTask/detail.vue
index 375ace9..fa8e0c4 100644
--- a/app/pagesTask/detail.vue
+++ b/app/pagesTask/detail.vue
@@ -7,6 +7,7 @@
<view class="title">浠诲姟璇︽儏</view>
<view class="edit-btn" @click="handleEdit" v-if="taskDetail && !isTaskFinished">
<uni-icons type="compose" size="20" color="#007AFF"></uni-icons>
+ <text class="edit-text">淇敼</text>
</view>
</view>
@@ -455,32 +456,32 @@
<!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
<view class="action-buttons" v-if="taskDetail">
<!-- 寰呭鐞嗙姸鎬�: 鏄剧ず鍑哄彂銆佸彇娑堛�佸己鍒跺畬鎴� -->
- <template v-if="taskDetail.taskStatus === 'PENDING'">
- <template v-if="isCurrentUserAssignee()">
- <button
- class="action-btn primary"
- @click="handleDepartAction()"
- >
- 鍑哄彂
- </button>
- <button
- class="action-btn cancel"
- @click="handleTaskAction('cancel')"
- >
- 鍙栨秷
- </button>
- <button
- class="action-btn force-complete"
- @click="showForceCompleteTimeDialog()"
- >
- 寮哄埗瀹屾垚
- </button>
- </template>
+ <template v-if="taskDetail.taskStatus === 'PENDING' ">
+ <button
+ v-if="canOperateTask()"
+ class="action-btn primary"
+ @click="handleDepartAction()"
+ >
+ 鍑哄彂
+ </button>
+ <button
+ class="action-btn cancel"
+ @click="handleTaskAction('cancel')"
+ >
+ 鍙栨秷
+ </button>
+ <button
+ v-if="canOperateTask() && showForceCompleteFeature()"
+ class="action-btn force-complete"
+ @click="showForceCompleteTimeDialog()"
+ >
+ 寮哄埗瀹屾垚
+ </button>
</template>
<!-- 鍑哄彂涓姸鎬�: 鏄剧ず宸插埌杈俱�佸己鍒剁粨鏉� -->
<template v-else-if="taskDetail.taskStatus === 'DEPARTING'">
- <template v-if="isCurrentUserAssignee()">
+ <template v-if="canOperateTask()">
<button
class="action-btn primary"
@click="handleTaskAction('arrive')"
@@ -498,7 +499,7 @@
<!-- 宸插埌杈剧姸鎬�: 鏄剧ず宸茶繑绋� -->
<template v-else-if="taskDetail.taskStatus === 'ARRIVED'">
- <template v-if="isCurrentUserAssignee()">
+ <template v-if="canOperateTask()">
<button
class="action-btn primary"
@click="handleTaskAction('return')"
@@ -510,13 +511,32 @@
<!-- 杩旂▼涓姸鎬�: 鏄剧ず宸插畬鎴� -->
<template v-else-if="taskDetail.taskStatus === 'RETURNING'">
- <template v-if="isCurrentUserAssignee()">
+ <template v-if="canOperateTask()">
<button
class="action-btn primary"
@click="handleTaskAction('complete')"
>
宸插畬鎴�
</button>
+ </template>
+ </template>
+
+ <!-- 澶勭悊涓姸鎬�: 鏄剧ず寮哄埗瀹屾垚銆佸彇娑� -->
+ <template v-else-if="taskDetail.taskStatus === 'IN_PROGRESS'">
+ <template v-if="canOperateTask()">
+ <button
+ class="action-btn primary"
+ @click="handleTaskAction('arrive')"
+ >
+ 宸插埌杈�
+ </button>
+ <button
+ v-if="showForceCompleteFeature()"
+ class="action-btn force-complete"
+ @click="showForceCompleteTimeDialog()"
+ >
+ 寮哄埗瀹屾垚
+ </button>
</template>
</template>
@@ -913,10 +933,8 @@
break;
case 'forceCancel':
- // 寮哄埗缁撴潫 -> 鐘舵�佸彉涓哄凡鍙栨秷
- this.$modal.confirm('纭畾瑕佸己鍒剁粨鏉熸浠诲姟鍚楋紵').then(() => {
- this.updateTaskStatus('CANCELLED', '浠诲姟宸插己鍒剁粨鏉�')
- }).catch(() => {});
+ // 寮哄埗缁撴潫 -> 鏄剧ず鍙栨秷鍘熷洜閫夋嫨瀵硅瘽妗�
+ this.showCancelReasonDialog();
break;
case 'return':
@@ -1421,9 +1439,14 @@
console.log('闄勪欢鍒犻櫎鎴愬姛:', attachmentId)
},
- // 鏄惁鏄剧ず鈥滃氨缁�濆姛鑳斤紙閰嶇疆寮�鍏筹級
+ // 鏄惁鏄剧ず"灏辩华"鍔熻兘锛堥厤缃紑鍏筹級
showAssigneeReadyFeature() {
return !!(config && config.features && config.features.showAssigneeReadyButton)
+ },
+
+ // 鏄惁鏄剧ず"寮哄埗瀹屾垚"鍔熻兘锛堥厤缃紑鍏筹級
+ showForceCompleteFeature() {
+ return !!(config && config.features && config.features.showForceCompleteButton)
},
// 褰撳墠鐢ㄦ埛鏄惁涓鸿鎵ц浜�
@@ -1497,6 +1520,19 @@
console.log("褰撳墠鐢ㄦ埛ID:", userId)
const list = (this.taskDetail && Array.isArray(this.taskDetail.assignees)) ? this.taskDetail.assignees : []
return list.some(a => a && (a.userId === userId || a.oaUserId === userId))
+ },
+
+ // 鏄惁褰撳墠鐢ㄦ埛鍙互鎿嶄綔浠诲姟锛堟墽琛屼汉鎴栫鐞嗗憳锛�
+ canOperateTask() {
+ // 妫�鏌ユ槸鍚︽槸绠$悊鍛橈紙canViewAllConsult === '1'锛�
+
+ const canViewAllConsult = this.$store && this.$store.state && this.$store.state.user && this.$store.state.user.canViewAllConsult
+ console.log("褰撳墠鐢ㄦ埛鏄惁鏄鐞嗗憳:", canViewAllConsult)
+ if (canViewAllConsult === '1') {
+ return true
+ }
+ // 妫�鏌ユ槸鍚︽槸浠诲姟鎵ц浜�
+ return this.isCurrentUserAssignee()
},
// 鏄惁澶氫汉鎵ц
@@ -1871,12 +1907,18 @@
}
.edit-btn {
- width: 60rpx;
+ width: 120rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
+
+ .edit-text {
+ margin-left: 8rpx;
+ font-size: 28rpx;
+ color: #007AFF;
+ }
}
}
--
Gitblit v1.9.1