예제 #1
0
파일: produce.go 프로젝트: zbzzbd/beego
func (c *ProduceController) Get() {
	c.GetInitData()

	c.TplNames = "job/index.tpl"

	p, _ := c.GetInt("p")
	jobList := job.NewJobList(p, 10).SetCode(c.GetString("code")).SetProjectName(c.GetString("project")).
		SetDepartment(c.GetString("department")).SetType(c.GetString("type")).SetEmployeeId(c.GetString("employee_id")).
		SetFinishTimeFrom(c.GetString("finish_time_from")).SetFinishTimeTo(c.GetString("finish_time_to"))

	err := jobList.GetList()
	if err != nil {
		c.Data["error"] = err.Error()
	}

	c.Data["jobs"] = jobList.GetJobs()
	c.Data["count"] = jobList.GetCount()

	c.Data["paginator"] = utils.NewPaginator(c.Ctx.Request, int(10), jobList.GetCount())

	c.Data["code"] = c.GetString("code")
	c.Data["project__name"] = c.GetString("project")
	c.Data["department"] = c.GetString("department")
	c.Data["type"] = c.GetString("type")
	c.Data["employee_id"] = c.GetString("employee_id")
	c.Data["finish_time__gte"] = c.GetString("finish_time_from")
	c.Data["finish_time__lte"] = c.GetString("finish_time_to")
}
예제 #2
0
파일: job_valid.go 프로젝트: zbzzbd/beego
func (c *JobValidationController) Show() {
	c.TplNames = "job_valid/show.tpl"

	id := c.Ctx.Input.Param(":id")
	c.getJobCards(id)

	c.Data["job"], _ = job.NewJobList(1, 1).SetCondition("id", id).GetOne()
}
예제 #3
0
파일: job.go 프로젝트: zbzzbd/beego
func (c *JobController) ViewEditJob() {
	c.ViewCreateJob()
	c.Data["Job"], _ = job.NewJobList(1, 1).SetCondition("id", c.Ctx.Input.Param(":id")).GetOne()
	//c.Data["JobFiles"], _ = upload.NewQueryFile().SetCondition("rel_id", c.Ctx.Input.Param(":id")).GetJobAllFiles()

	c.Data["post_url"] = "/job/edit/" + c.Ctx.Input.Param(":id")

	c.Data["is_edit"] = true
}
예제 #4
0
파일: job.go 프로젝트: zbzzbd/beego
func (c *JobController) DelJob() {
	data := make(map[string]interface{})
	data["Job_id"] = c.Ctx.Input.Param(":id")
	_, err := job.NewJobList(1, -1).UpdateJobDelStatus(data, models.Job_DelStatus_invalid)

	if err != nil {
		c.SetJsonResponse("error", err.Error())
	}
	c.GetJsonResponse().ServeJson()
}
예제 #5
0
파일: job_assign.go 프로젝트: zbzzbd/beego
func (c *JobAssignController) Get() {
	c.TplNames = "produce/job_assign.tpl"
	id := c.GetString("id")
	jobItem, _ := job.NewJobList(1, 1).SetCondition("id", id).GetOne()
	c.Data["error"] = ""
	c.getJobCards(id)
	users, _ := c.GetUserList(jobItem.Department)
	c.Data["toUsers"] = users
	c.Data["jobId"] = id
}
예제 #6
0
파일: job.go 프로젝트: zbzzbd/beego
func (c *JobController) Export() {
	c.getInitData()
	p, _ := c.GetInt("p")
	del_status, _ := c.GetInt("delstatus")
	jobList := job.NewJobList(p, -1).SetCode(c.GetString("code")).SetProjectName(c.GetString("project")).
		SetDepartment(c.GetString("department")).SetType(c.GetString("type")).SetEmployeeId(c.GetString("employee_id")).
		SetFinishTimeFrom(c.GetString("finish_time_from")).SetFinishTimeTo(c.GetString("finish_time_to")).
		SetCondition("submit_time__gte", c.GetString("submit_time_from")).SetCondition("submit_time__lte", c.GetString("submit_time_to")).
		SetCondition("create_user_id", c.GetString("create_user_id")).SetCondition("del_status", del_status)

	err := jobList.GetList()
	if err != nil {
		c.Data["error"] = err.Error()
	}
	records := jobList.GetExportData()
	c.Ctx.Output.Download(export.NewExporteFile(jobList).MakeCsvFile(records).GetFilePath(), jobList.GetOutFileName())
}
예제 #7
0
파일: produce.go 프로젝트: zbzzbd/beego
func (c *ProduceController) SubmitList() {
	c.GetInitData()

	c.TplNames = "produce/submit.tpl"
	c.Data["ClearUrl"] = "/produce/job/submit"

	filter := make(map[string]interface{})

	filter["code"] = c.GetString("code")
	filter["project__name"] = c.GetString("project")
	filter["department"] = c.GetString("department")
	filter["type"] = c.GetString("type")
	employee_id := c.GetString("employee_id")
	if employee_id == "" {
		filter["employee_id"] = strconv.Itoa(int(c.currentUser.GetUser().Id))

	} else {
		filter["employee_id"] = employee_id
	}
	filter["finish_time__gte"] = c.GetString("finish_time_from")
	filter["finish_time__lte"] = c.GetString("finish_time_to")
	filter["valid_status"] = 1
	filter["claim_status"] = 1
	filter["submit_status__in"] = []int{0, 2}
	filter["del_status"] = models.Job_DelStatus_effective
	for k, v := range filter {
		c.Data[k] = v
	}

	p, _ := c.GetInt("p")
	jobList := job.NewJobList(p, 10).SetConditions(filter)

	err := jobList.GetList()
	if err != nil {
		c.Data["error"] = err.Error()
	}

	c.Data["jobs"] = jobList.GetJobs()
	c.Data["count"] = jobList.GetCount()

	c.Data["paginator"] = utils.NewPaginator(c.Ctx.Request, int(10), jobList.GetCount())
}
예제 #8
0
파일: job.go 프로젝트: zbzzbd/beego
func (c *JobController) findJobList(params map[string]interface{}) (jl *job.JobList, err error) {

	p, _ := c.GetInt("p")
	status := c.GetString("status")
	jl = job.NewJobList(p, 10).SetCode(c.GetString("code")).SetProjectName(c.GetString("project")).
		SetDepartment(c.GetString("department")).SetType(c.GetString("type")).SetEmployeeId(c.GetString("employee_id")).
		SetFinishTimeFrom(c.GetString("finish_time_from")).SetFinishTimeTo(c.GetString("finish_time_to")).
		SetCondition("submit_time__gte", c.GetString("submit_time_from")).SetCondition("submit_time__lte", c.GetString("submit_time_to")).
		SetCondition("create_user_id", c.GetString("create_user_id"))

	if len(params) > 0 {
		jl.SetConditions(params)
	}

	if status != "" {
		jl.GetStatusValueByDesc(status)
	}

	err = jl.GetList()
	if err != nil {
		c.Data["error"] = err.Error()
	}
	return
}