Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄庭坚
jinfa-platform
Commits
a831cc6d
Commit
a831cc6d
authored
Jul 09, 2021
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改考评权重问题
parent
2832c0cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
add.tsx
src/pages/member/memberEvaluate/createEvaluate/add.tsx
+12
-6
add.tsx
src/pages/member/memberEvaluate/schema/add.tsx
+1
-2
No files found.
src/pages/member/memberEvaluate/createEvaluate/add.tsx
View file @
a831cc6d
import
React
,
{
useEffect
,
useMemo
,
useState
}
from
'react'
;
import
{
Card
,
Button
}
from
'antd'
;
import
{
Card
,
Button
,
message
}
from
'antd'
;
import
{
history
}
from
'umi'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
LinkOutlined
,
PlusOutlined
,
SaveOutlined
}
from
'@ant-design/icons'
;
...
...
@@ -98,8 +98,11 @@ const EvaluateAdd = (props) => {
const
onSubmit
=
async
(
values
:
SubmitDataType
)
=>
{
const
{
items
,
appraisalDayStart
,
appraisalDayEnd
,
attachments
,
selectedProject
,
verifySteps
,
history
:
anyHistory
,
currentStep
,
...
rest
}
=
values
// 计算权重
let
totalScoreWeight
=
0
const
projectList
=
items
.
map
((
_item
)
=>
{
const
{
sendAppraisal
,
memberName
,
score
,
templates
,
reports
,
type
,
...
otherProps
}
=
_item
;
totalScoreWeight
+=
+
_item
.
scoreWeight
;
return
{
userId
:
_item
.
memberName
.
userId
,
userName
:
_item
.
memberName
.
name
,
...
...
@@ -116,6 +119,10 @@ const EvaluateAdd = (props) => {
...
otherProps
}
})
if
(
totalScoreWeight
>
100
)
{
message
.
error
(
`添加的评估项目的权重和为
${
totalScoreWeight
}
, 大于100, 请修改`
);
return
}
const
tempPostData
=
{
...
rest
,
...
...
@@ -186,7 +193,6 @@ const EvaluateAdd = (props) => {
}))
||
[]
// const withProjectId = new Set(tempData.map((_item) => _item.id));
const
dataSource
=
formActions
.
getFieldValue
(
'tabs.tab-2.items'
)
||
[];
console
.
log
(
"dataSource"
,
dataSource
);
// 对比两个数据, 如果dataSource 中 有 tempData 的值, 那么保留,如果没有择去除(没有id项)
const
dataSourceKey
=
new
Set
(
Array
.
from
(
dataSource
?.
map
((
_item
)
=>
_item
.
type
)).
filter
(
Boolean
));
// 获取新增组
...
...
@@ -215,9 +221,10 @@ const EvaluateAdd = (props) => {
const
numberIndex
=
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`
${
$1
}
`
});
const
scoreWeight
=
formActions
.
getFieldValue
(
`items.
${
numberIndex
}
.grade`
)
||
0
const
grade
=
formActions
.
getFieldValue
(
`items.
${
numberIndex
}
.scoreWeight`
)
||
0
;
formActions
.
setFieldValue
(
`items.
${
numberIndex
}
.score`
,
scoreWeight
*
grade
/
100
);
const
scoreWeight
=
formActions
.
getFieldValue
(
`items.
${
numberIndex
}
.scoreWeight`
)
||
0
const
grade
=
formActions
.
getFieldValue
(
`items.
${
numberIndex
}
.grade`
)
||
0
;
console
.
log
(
scoreWeight
)
formActions
.
setFieldValue
(
`items.
${
numberIndex
}
.score`
,
+
scoreWeight
!==
0
?
scoreWeight
*
grade
/
100
:
grade
);
})
}
...
...
@@ -261,7 +268,6 @@ const EvaluateAdd = (props) => {
type
:
_row
.
type
,
}
})
console
.
log
(
itmesList
)
return
{
appraisalDayStart
:
moment
(
appraisalDayEnd
,
'YYYY-MM-DD'
),
appraisalDayEnd
:
moment
(
appraisalDayEnd
,
'YYYY-MM-DD'
),
...
...
src/pages/member/memberEvaluate/schema/add.tsx
View file @
a831cc6d
...
...
@@ -92,9 +92,8 @@ export const evaluateAddSchema: ISchema = {
},
attachments
:
{
title
:
'附件'
,
type
:
'
object
'
,
type
:
'
array
'
,
'x-component'
:
'FormilyUploadFiles'
,
required
:
true
,
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment