From 98a5aa3ae4aba7302837986f5b3963966d39ddb4 Mon Sep 17 00:00:00 2001
From: GuLiMmo <2820890765@qq.com>
Date: Mon, 15 Jan 2024 14:03:01 +0800
Subject: [PATCH] 修改

---
 src/views/evaluate/components/IndividualTaskPublic.vue |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/views/evaluate/components/IndividualTaskPublic.vue b/src/views/evaluate/components/IndividualTaskPublic.vue
index 9be1cfb..7d08706 100644
--- a/src/views/evaluate/components/IndividualTaskPublic.vue
+++ b/src/views/evaluate/components/IndividualTaskPublic.vue
@@ -211,9 +211,13 @@
             getEmployeeLevelList(dictKey).then((res) => {
                 const { code, data } = res.data
                 if (code !== 200) return this.$message.error('当前级别人员加载失败,请重试!!')
+                const participateInList = data.map(item => {
+                    const { id, name, deptId, deptName, postId, postName } = item
+                    return { id, name, deptId, deptName, postId, postName }
+                })
                 const params = {
                     employeeType: dictKey,
-                    participateIn: data,
+                    participateIn: participateInList,
                     notParticipateIn: []
                 }
                 if (index === -1) {
@@ -224,12 +228,22 @@
             })
         },
         addEvaluateParams(params) {
-            const index = this.form.votePersonObjInfo.findIndex(item => item.employeeType === params.employeeType)
+            const { participateIn, employeeType } = params
+            const index = this.form.votePersonObjInfo.findIndex(item => item.employeeType === employeeType)
+            const typeIndex = this.form.pollingPersons.findIndex(item => item === employeeType)
+
             if (index === -1) {
-                this.form.votePersonObjInfo.push(params)
-                this.form.pollingPersons.push(params.employeeType)
+                if (participateIn.length > 0) {
+                    this.form.votePersonObjInfo.push(params)
+                    this.form.pollingPersons.push(params.employeeType)
+                }
             } else {
-                this.form.votePersonObjInfo[index] = params
+                if (participateIn.length > 0) {
+                    this.form.votePersonObjInfo[index] = params
+                } else {
+                    this.form.votePersonObjInfo.splice(index, 1)
+                    this.form.pollingPersons.splice(typeIndex, 1)
+                }
             }
         }
     }

--
Gitblit v1.9.3