切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
庄敏学
2 years ago
提交
cd1b36d04c78347941c138a5316e0ecca10f721a
1 个父辈
cfdda487
增加导入字段是否必填
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
35 行增加
和
1 行删除
go_build_main_go
pkg/domain/performance_application_form.go
pkg/port/beego/controllers/import_controller.go
templates/.~tpl_template_question.xlsx
go_build_main_go
查看文件 @
cd1b36d
不能预览此文件类型
pkg/domain/performance_application_form.go
查看文件 @
cd1b36d
...
...
@@ -12,6 +12,7 @@ type PerformanceApplicationForm struct {
Standard
string
//标准
Task
string
//任务、指标
Definition
string
//定义
Required
string
// 是否必填 是 否
}
type
PerformanceDimension
struct
{
...
...
@@ -24,6 +25,7 @@ type PerformanceModule struct {
Weight
string
`json:"weight"`
//权重
Standard
string
`json:"standard"`
//标准(结构化的成果描述)
Target
[]
*
PerformanceTarget
`json:"performanceTarget"`
//任务\指标
Required
int
`json:"required"`
// 是否必填
}
type
PerformanceTarget
struct
{
...
...
@@ -34,6 +36,7 @@ type PerformanceTarget struct {
func
LoadPerformanceDimensions
(
rows
[][]
string
)
([]
*
PerformanceDimension
,
error
)
{
formRows
:=
make
([]
*
PerformanceApplicationForm
,
0
)
var
dimensionName
,
moduleName
,
taskName
,
weightName
,
standardName
string
required
:=
"是"
for
key
,
item
:=
range
rows
{
if
key
<
3
{
continue
...
...
@@ -80,6 +83,11 @@ func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error)
}
}
form
.
Standard
=
standardName
//是否必填
if
len
(
item
)
>
9
&&
item
[
9
]
!=
""
{
required
=
strings
.
TrimSpace
(
item
[
9
])
}
form
.
Required
=
required
formRows
=
append
(
formRows
,
form
)
}
dimensions
:=
make
([]
*
PerformanceDimension
,
0
)
...
...
@@ -144,11 +152,16 @@ func loadPerformanceModule(forms []*PerformanceApplicationForm) ([]*PerformanceM
if
err
!=
nil
{
return
modules
,
err
}
required
,
err
:=
getRequired
(
item
)
if
err
!=
nil
{
return
modules
,
err
}
module
:=
&
PerformanceModule
{
ModuleName
:
moduleName
,
Weight
:
weightName
,
Standard
:
standardName
,
Target
:
tasks
,
Required
:
required
,
}
modules
=
append
(
modules
,
module
)
}
...
...
@@ -201,6 +214,27 @@ func getStandard(items []*PerformanceApplicationForm) (string, error) {
return
name
,
nil
}
// 获取是否必填
func
getRequired
(
items
[]
*
PerformanceApplicationForm
)
(
int
,
error
)
{
if
len
(
items
)
<=
0
{
return
NodeRequiredYes
,
nil
}
var
name
string
for
_
,
item
:=
range
items
{
if
name
==
""
{
name
=
item
.
Required
}
if
name
!=
item
.
Required
{
return
NodeRequiredYes
,
errors
.
New
(
item
.
ModuleName
+
" 对应的是否必填不一致"
)
}
}
if
name
==
"否"
{
return
NodeRequiredNo
,
nil
}
else
{
return
NodeRequiredYes
,
nil
}
}
// 获取任务
func
getTasks
(
items
[]
*
PerformanceApplicationForm
)
([]
*
PerformanceTarget
,
error
)
{
tasks
:=
make
([]
*
PerformanceTarget
,
0
)
...
...
pkg/port/beego/controllers/import_controller.go
查看文件 @
cd1b36d
...
...
@@ -121,7 +121,7 @@ func (controller *ImportController) parseTemplateNodeContent(data []*domain.Perf
}
// 必填项
nc
.
Required
=
domain
.
NodeRequiredYes
nc
.
Required
=
module
.
Required
nodeContents
=
append
(
nodeContents
,
nc
)
}
}
...
...
templates/.~tpl_template_question.xlsx
0 → 100644
查看文件 @
cd1b36d
不能预览此文件类型
请
注册
或
登录
后发表评论