ziwen 2 years ago
parent
commit
f2fa1a5bf7
2 changed files with 15 additions and 6 deletions
  1. 13 6
      controller/contract/pre_register.go
  2. 2 0
      models/fms/contract_pre_register.go

+ 13 - 6
controller/contract/pre_register.go

@@ -162,14 +162,21 @@ func (rg *PreRegisterController) Add(c *gin.Context) {
 		resp.Fail("最多只能选择两个销售", c)
 		return
 	}
+
+	var sellers []*crm.Admin
 	var pars []interface{}
-	cond := ` admin_id in (?) `
-	pars = append(pars, sellerIds)
-	sellers, e := admin.List(cond, pars)
-	if e != nil {
-		resp.FailMsg("获取销售信息失败", "获取销售信息失败, Err: "+e.Error(), c)
-		return
+	cond := ``
+	if len(sellerIds) > 0 {
+		cond = ` admin_id in (?) `
+		pars = append(pars, sellerIds)
+		sellers, e = admin.List(cond, pars)
+		if e != nil {
+			resp.FailMsg("获取销售信息失败", "获取销售信息失败, Err: "+e.Error(), c)
+			return
+		}
 	}
+	
+
 
 	//新增合同
 	ob := new(fms.ContractRegister)

+ 2 - 0
models/fms/contract_pre_register.go

@@ -97,6 +97,8 @@ func formatContractPreRegister2Item(item *ContractPreRegister) (formatItem *Cont
 	formatItem.ServiceProductId = item.ServiceProductId
 	formatItem.AdminId = item.AdminId
 	formatItem.CreateTime = utils.TimeTransferString(utils.FormatDateTime, item.CreateTime)
+	formatItem.StartDate = item.StartDate.Format(utils.FormatDate)
+	formatItem.EndDate = item.EndDate.Format(utils.FormatDate)
 	return
 }