From 59998e28182e4c26737a0d7c23100d74f5a2fa71 Mon Sep 17 00:00:00 2001
From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com>
Date: Sat, 24 Jan 2026 14:07:19 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/dataManage/workerEfficiency.js | 9 ++
src/views/dataManage/energySaving/index.vue | 12 ++-
src/views/dataManage/projectManage/index.vue | 13 ++-
src/views/dataManage/resourceUse/index.vue | 13 ++-
.../dataManage/workerEfficiency/index.vue | 99 ++++++++++++++++---
5 files changed, 129 insertions(+), 17 deletions(-)
diff --git a/src/api/dataManage/workerEfficiency.js b/src/api/dataManage/workerEfficiency.js
index d2ffb94..511584a 100644
--- a/src/api/dataManage/workerEfficiency.js
+++ b/src/api/dataManage/workerEfficiency.js
@@ -71,3 +71,12 @@ export function deleteAnalysisReminderAPI(data) {
data,
})
}
+
+// 获取班组人员列表
+export function getTeamUserListAPI(data) {
+ return request({
+ url: '/background/sj/workTeam/userList',
+ method: 'get',
+ params: data,
+ })
+}
diff --git a/src/views/dataManage/energySaving/index.vue b/src/views/dataManage/energySaving/index.vue
index fa36b8b..03c9791 100644
--- a/src/views/dataManage/energySaving/index.vue
+++ b/src/views/dataManage/energySaving/index.vue
@@ -224,11 +224,19 @@
-
+ /> -->
+
+
+
+
-
+ /> -->
+
+
+
+
+
-
+ /> -->
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
{
if (this.$refs.taskFormRef) {
this.$refs.taskFormRef.clearValidate()
@@ -691,6 +707,7 @@ export default {
}
this.taskForm = {
bidCode: row.bidCode || '',
+ userId: row.userId || '',
userName: row.userName || '',
teamId: row.teamId || '',
teamName: row.teamName || '',
@@ -706,6 +723,12 @@ export default {
if (this.teamList.length === 0) {
this.getTeamSelectList()
}
+ // 如果有班组ID,加载人员列表
+ if (row.teamId) {
+ this.getTeamUserList(row.teamId)
+ } else {
+ this.userList = []
+ }
this.$nextTick(() => {
if (this.$refs.taskFormRef) {
this.$refs.taskFormRef.clearValidate()
@@ -803,6 +826,16 @@ export default {
) {
params.taskStatus = String(params.taskStatus)
}
+ // 确保userId和userName都传递
+ // 如果选择了人员但没有userName,从userList中获取
+ if (params.userId && !params.userName) {
+ const selectedUser = this.userList.find(
+ (item) => item.id == params.userId,
+ )
+ if (selectedUser) {
+ params.userName = selectedUser.name || ''
+ }
+ }
if (this.taskEditId) {
params.id = this.taskEditId
}
@@ -964,13 +997,57 @@ export default {
// 班组的change事件
handleTeamChange(value) {
+ // 切换班组或清空班组时,先清空人员选择
+ this.taskForm.userId = ''
+ this.taskForm.userName = ''
+
const selectedTeam = this.teamList.find(
(item) => item.teamId == value,
)
if (selectedTeam) {
this.taskForm.teamName = selectedTeam.teamName || ''
+ // 选择班组后,加载该班组的人员列表
+ if (value) {
+ this.getTeamUserList(value)
+ } else {
+ this.userList = []
+ }
} else {
this.taskForm.teamName = ''
+ this.userList = []
+ }
+ },
+
+ // 人员的change事件
+ handleUserChange(value) {
+ const selectedUser = this.userList.find((item) => item.id == value)
+ if (selectedUser) {
+ this.taskForm.userName = selectedUser.name || ''
+ } else {
+ this.taskForm.userName = ''
+ }
+ },
+
+ // 获取班组人员列表
+ async getTeamUserList(teamId) {
+ if (!teamId) {
+ this.userList = []
+ return
+ }
+ try {
+ const res = await getTeamUserListAPI({
+ pageNum: 1,
+ pageSize: 9999,
+ teamId: teamId,
+ })
+ if (res.code === 200) {
+ this.userList = res.rows || res.data || []
+ } else {
+ this.userList = []
+ }
+ } catch (error) {
+ this.userList = []
+ console.error('获取人员列表失败', error)
}
},