...
|
...
|
@@ -12,7 +12,6 @@ import ( |
|
|
/*机会-自查内容*/
|
|
|
var CheckOptionsCommit = []CheckOption{{Item: "是", NeedOther: false}, {Item: "否", NeedOther: false}, {Item: "不清楚", NeedOther: false}}
|
|
|
|
|
|
//var CheckOptionsApprove = []CheckOption{{Item: "是",NeedOther:false},{Item: "否",NeedOther:true},{Item: "不清楚",NeedOther:false}}
|
|
|
//自查结果列表
|
|
|
type SelfCheckResults []selfCheckResult
|
|
|
type selfCheckResult struct {
|
...
|
...
|
@@ -21,7 +20,19 @@ type selfCheckResult struct { |
|
|
}
|
|
|
|
|
|
//自查项列表
|
|
|
func NewSelfChecks(data string) (rsp SelfChecks) {
|
|
|
if len(data) == 0 {
|
|
|
return
|
|
|
}
|
|
|
e := json.Unmarshal([]byte(data), &rsp)
|
|
|
if e != nil {
|
|
|
log.Error(e)
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
|
|
type SelfChecks []SelfCheck
|
|
|
|
|
|
type SelfCheck struct {
|
|
|
CheckItem string `json:"checkItem"`
|
|
|
GroupId int64 `json:"groupId"` //分组
|
...
|
...
|
@@ -33,17 +44,6 @@ func (c SelfCheck) Key() string { |
|
|
return fmt.Sprintf("%v-%v", c.GroupId, c.CheckItem)
|
|
|
}
|
|
|
|
|
|
func NewSelfChecks(data string) (rsp SelfChecks) {
|
|
|
if len(data) == 0 {
|
|
|
return
|
|
|
}
|
|
|
e := json.Unmarshal([]byte(data), &rsp)
|
|
|
if e != nil {
|
|
|
log.Error(e)
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
|
|
//统计自查结果
|
|
|
func (s SelfChecks) Static() SelfCheckResults {
|
|
|
if len(s) == 0 {
|
...
|
...
|
@@ -91,9 +91,9 @@ func (s SelfChecks) String() string { |
|
|
for i := range s {
|
|
|
c := s[i]
|
|
|
if len(c.Reason) == 0 {
|
|
|
buf.WriteString(fmt.Sprintf("%v:%v;\n", c.CheckItem, c.Answer))
|
|
|
buf.WriteString(fmt.Sprintf("\n%v:%v;", c.CheckItem, c.Answer))
|
|
|
} else {
|
|
|
buf.WriteString(fmt.Sprintf("%v:%v,理由:%v;\n", c.CheckItem, c.Answer, c.Reason))
|
|
|
buf.WriteString(fmt.Sprintf("\n%v:%v,理由:%v;", c.CheckItem, c.Answer, c.Reason))
|
|
|
}
|
|
|
}
|
|
|
return buf.String()
|
...
|
...
|
@@ -135,6 +135,15 @@ func (s SelfChecks) Compare(dst string) (rspChecks SelfChecks, err error) { |
|
|
}
|
|
|
|
|
|
//自查问题
|
|
|
func NewCheckQuestion(checkItem, title string, groupId int64, ops []CheckOption) *CheckQuestion {
|
|
|
return &CheckQuestion{
|
|
|
CheckItem: checkItem,
|
|
|
Title: title,
|
|
|
GroupId: groupId,
|
|
|
CheckOptions: ops,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
type CheckQuestion struct {
|
|
|
CheckItem string `json:"checkItem"`
|
|
|
Title string `json:"title"`
|
...
|
...
|
@@ -143,16 +152,7 @@ type CheckQuestion struct { |
|
|
}
|
|
|
type CheckOption struct {
|
|
|
Item string `json:"item"`
|
|
|
NeedOther bool `json:"needOther"` //是否需填写其他的内容【1:需要】【2:不需要】
|
|
|
}
|
|
|
|
|
|
func NewCheckQuestion(checkItem, title string, groupId int64, ops []CheckOption) *CheckQuestion {
|
|
|
return &CheckQuestion{
|
|
|
CheckItem: checkItem,
|
|
|
Title: title,
|
|
|
GroupId: groupId,
|
|
|
CheckOptions: ops,
|
|
|
}
|
|
|
NeedOther bool `json:"-"` //是否需填写其他的内容【1:需要】【2:不需要】
|
|
|
}
|
|
|
|
|
|
/*CheckQuestions 自查问题列表*/
|
...
|
...
|
|