Beispiel #1
0
func (c *ProjectController) ViewProjectDetail() {
	id := c.Ctx.Input.Param(":id")

	c.Data["CreateJobStatus"] = "active"
	c.TplNames = "project/detail.tpl"

	project := project.NewProject()
	project, _ = project.GetOne(id)

	c.Data["Project"] = project.GetModelProject()
}
Beispiel #2
0
func (c *ProjectController) DelProject() {
	data := make(map[string]interface{})

	id := c.Ctx.Input.Param(":id")
	data["project_id"] = id
	_, err := project.NewProject().UpdateProjectStatus(data)
	if err != nil {
		c.SetJsonResponse("error", err.Error())
	}
	c.GetJsonResponse().ServeJson()

}
Beispiel #3
0
func (c *ProjectController) Export() {
	//获取导出条件
	filter := c.GetExportFilter()

	//查询结果
	Projects, err := project.NewProjectList().GetList(filter)
	if err == nil {
		records := project.GetExportData(Projects)
		//导出结果
		c.Ctx.Output.Download(project.NewProjectExport().MakeFile(records).GetFilePath(), project.NewProject().GetOutName(filter))
	}

}
Beispiel #4
0
func (c *ProjectController) EditProject() {
	id := c.Ctx.Input.Param(":id")
	var retJson = make(map[string]interface{})
	retJson["result"] = 0
	retJson["msg"] = ""

	var params = make(map[string]interface{})

	params["id"] = id
	params["name"] = c.GetString("name")
	params["scale"] = c.GetString("scale")
	params["started"] = c.GetString("started")
	params["priority"] = c.GetString("priority")
	params["clientName"] = c.GetString("client_name")
	params["contractNo"] = c.GetString("contract_no")
	params["serviceItem"] = c.GetString("service_item")
	params["bussinessUser"] = c.GetString("bussiness_user")
	params["progress"] = c.GetString("progress")

	params["regStartDate"] = c.GetString("reg_start_date")
	params["gameDate"] = c.GetString("game_date")

	params["regCloseDate"] = c.GetString("reg_close_date")
	params["artUser"] = c.GetString("art_user")
	params["techUser"] = c.GetString("tech_user")
	//登记人
	params["registrant"] = c.currentUser.GetUser().Id

	project, err := project.NewProject().GetOne(id)
	if err != nil {
		retJson["result"] = -102
		retJson["msg"] = "can't find the project"
		goto END
	}
	err = project.Update(params)
	if err != nil {
		retJson["result"] = -103
		retJson["msg"] = "update the project failed"
	}

END:
	c.Data["json"] = retJson
	c.ServeJson()
}
Beispiel #5
0
func (c *ProjectController) CreateProject() {
	var retJson = make(map[string]interface{})
	retJson["result"] = 0
	retJson["msg"] = ""

	var params = make(map[string]interface{})

	params["name"] = c.GetString("name")
	params["started"] = c.GetString("started")
	params["scale"] = c.GetString("scale")

	params["priority"] = c.GetString("priority")
	params["clientName"] = c.GetString("client_name")
	params["bussinessUser"] = c.GetString("bussiness_user")
	params["progress"] = c.GetString("progress")
	params["contractNo"] = c.GetString("contract_no")
	params["serviceItem"] = c.GetString("service_item")
	params["regStartDate"] = c.GetString("reg_start_date")
	params["gameDate"] = c.GetString("game_date")

	params["regCloseDate"] = c.GetString("reg_close_date")
	params["artUser"] = c.GetString("art_user")
	if params["artUser"] == "" {
		params["artUser"] = "******"
	}
	params["techUser"] = c.GetString("tech_user")

	if params["techUser"] == "" {
		params["techUser"] = "******"
	}
	//登记人
	params["registrant"] = c.currentUser.GetUser().Id
	project := project.NewProject()
	err, projectId := project.Create(params)
	if err != nil {
		retJson["result"] = -101
		retJson["msg"] = err.Error()
		fmt.Printf("err---->%v\n", err)
	}
	retJson["id"] = projectId
	c.Data["json"] = retJson
	c.ServeJson()
}
Beispiel #6
0
func (c *ProjectController) HandleFilter() map[string]interface{} {
	filter := make(map[string]interface{})
	filter["limit"] = 10
	filter["offset"] = 0
	id := c.GetString("project_name")
	if id != "" {
		filter["id"] = id
		p, _ := project.NewProject().GetOne(id)
		c.Data["project_default"] = p.GetModelProject()
	}
	bussiness_user := c.GetString("bussiness_user")
	if bussiness_user != "" {
		filter["bussiness_user_id"] = bussiness_user
		user_id, _ := strconv.Atoi(bussiness_user)
		user, _ := user.NewUserWithId(uint(user_id))
		c.Data["bussiness_user_default"] = user.GetUser()
	}

	progress_filter := c.GetString("progress")
	if progress_filter != "" {
		filter["progress"] = progress_filter
		progress, _ := project.NewProgress().GetProgressById(progress_filter)
		c.Data["progress_default"] = progress.GetModelProgress()
	}

	start_date := c.GetString("start_date")
	if start_date != "" {
		filter["start_date"] = start_date
		c.Data["start_date_default"] = start_date
	}

	end_date := c.GetString("end_date")
	if end_date != "" {
		filter["end_date"] = end_date
		c.Data["end_date_default"] = end_date
	}

	p, _ := c.GetInt("p")
	if p > 1 {
		filter["offset"] = (p - 1) * filter["limit"].(int)
	}
	return filter
}
Beispiel #7
0
func (c *ProjectController) ViewEditProject() {
	id := c.Ctx.Input.Param(":id")

	c.TplNames = "project/edit.tpl"

	project := project.NewProject()
	project, _ = project.GetOne(id)

	c.Data["Project"] = project.GetModelProject()

	users := user.NewUserList()
	c.Data["Priority"] = c.GetPriority()
	c.Data["return"] = 1
	err, progress := models.GetProgressList()
	if err == nil {
		c.Data["Progress"] = progress
	}

	c.Data["BussinessUser"] = users.GetRoleList(user.BussinessMen) //[]map[string]string{{"Id": "1", "Name": "许航"}}
	c.Data["ArtUser"] = users.GetRoleList(user.ArtGuy)             // []map[string]string{{"Id": "1", "Name": "许航"}}
	c.Data["TechUser"] = users.GetRoleList(user.TechGuy)           //[]map[string]string{{"Id": "1", "Name": "许航"}}
	c.Data["Id"] = id
}