作者 tangxvhui
不能预览此文件类型
... ... @@ -11,6 +11,7 @@ type PerformanceApplicationForm struct {
Weight string //权重
Standard string //标准
Task string //任务、指标
Definition string //定义
}
type PerformanceDimension struct {
... ... @@ -26,7 +27,8 @@ type PerformanceModule struct {
}
type PerformanceTarget struct {
Task string `json:"task"`
Task string `json:"task"`
Definition string `json:"definition"`
}
func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error) {
... ... @@ -55,8 +57,14 @@ func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error)
//指标任务
if len(item) > 4 && item[4] != "" {
taskName = item[4]
} else {
taskName = "填写自评反馈"
}
form.Task = taskName
//定义
if len(item) > 5 {
form.Definition = strings.TrimSpace(item[5])
}
//权重
if len(item) > 6 && item[6] != "" {
weightName = item[6]
... ... @@ -66,6 +74,11 @@ func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error)
if len(item) > 7 && item[7] != "" {
standardName = item[7]
}
if key < len(rows)-1 {
if len(rows[key+1]) > 1 && rows[key+1][1] != "" {
standardName = ""
}
}
form.Standard = standardName
formRows = append(formRows, form)
}
... ... @@ -192,7 +205,7 @@ func getStandard(items []*PerformanceApplicationForm) (string, error) {
func getTasks(items []*PerformanceApplicationForm) ([]*PerformanceTarget, error) {
tasks := make([]*PerformanceTarget, 0)
for _, item := range items {
target := &PerformanceTarget{Task: item.Task}
target := &PerformanceTarget{Task: item.Task, Definition: item.Definition}
tasks = append(tasks, target)
}
return tasks, nil
... ...
... ... @@ -41,7 +41,10 @@ func (controller *ImportController) Import() {
formType := controller.GetString("type")
switch formType {
case "PerformanceDimension":
dimensions, _ := domain.LoadPerformanceDimensions(rows)
dimensions, err := domain.LoadPerformanceDimensions(rows)
if err != nil {
controller.Response(nil, application.ThrowError(application.ARG_ERROR, err.Error()))
}
list := controller.parseTemplateNodeContent(dimensions)
controller.Response(tool_funs.SimpleWrapGridMap(int64(len(list)), list), nil)
default:
... ... @@ -103,8 +106,8 @@ func (controller *ImportController) parseTemplateNodeContent(data []*domain.Perf
for i3 := range module.Target {
target := module.Target[i3]
nc.EntryItems = append(nc.EntryItems, &domain.EntryItem{
Title: target.Task, // 输入型标题
HintText: "", // 输入项提示文本
Title: target.Task, // 输入型标题
HintText: target.Definition, // 输入项提示文本
})
}
// 没有任何输入项时,默认1个
... ...