作者 tangxvhui

修复 excel导出错误

@@ -158,19 +158,21 @@ func newExportData3() *exportData3 { @@ -158,19 +158,21 @@ func newExportData3() *exportData3 {
158 158
159 func (e *exportData3) FormatTableHead(param []dao.DataEvaluationItemUsed2) { 159 func (e *exportData3) FormatTableHead(param []dao.DataEvaluationItemUsed2) {
160 userNameMap := map[string]struct{}{} //员工名字过滤 160 userNameMap := map[string]struct{}{} //员工名字过滤
161 - projectIdMap := map[string]struct{}{} //项目id 161 + projectIdMap := map[string]struct{}{} //项目id过滤
162 for _, val := range param { 162 for _, val := range param {
163 // 163 //
164 - if _, ok := userNameMap[val.TargetUserId]; !ok { 164 + if _, ok := e.userProjcetMap[val.TargetUserId]; !ok {
165 e.userProjcetMap[val.TargetUserId] = []string{} 165 e.userProjcetMap[val.TargetUserId] = []string{}
166 } 166 }
167 //处理一个员工多项目的情况 167 //处理一个员工多项目的情况
168 if _, ok := projectIdMap[val.EvaluationProjectId]; !ok { 168 if _, ok := projectIdMap[val.EvaluationProjectId]; !ok {
169 e.userProjcetMap[val.TargetUserId] = append(e.userProjcetMap[val.TargetUserId], val.EvaluationProjectId) 169 e.userProjcetMap[val.TargetUserId] = append(e.userProjcetMap[val.TargetUserId], val.EvaluationProjectId)
  170 + projectIdMap[val.EvaluationProjectId] = struct{}{}
170 } 171 }
171 //处理员工的名称 172 //处理员工的名称
172 if _, ok := e.userIdName[val.TargetUserId]; !ok { 173 if _, ok := e.userIdName[val.TargetUserId]; !ok {
173 if _, ok := userNameMap[val.TargetUserName]; ok { 174 if _, ok := userNameMap[val.TargetUserName]; ok {
  175 + //员工重名
174 uname := fmt.Sprintf("%s(%d)", val.TargetUserName, len(userNameMap)) 176 uname := fmt.Sprintf("%s(%d)", val.TargetUserName, len(userNameMap))
175 e.userIdName[val.TargetUserId] = uname 177 e.userIdName[val.TargetUserId] = uname
176 userNameMap[uname] = struct{}{} 178 userNameMap[uname] = struct{}{}