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") }
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() }
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 }
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() }
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 }
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()) }
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()) }
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 }