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 *ComplaintController) ViewMyCompliant() { c.GetInitData() c.TplNames = "complaint/my_complaint_list.tpl" p, _ := c.GetInt("p") complaintList := complaint.NewComplaintList(p, 10).SetCode(c.GetString("code")).SetProjectName(c.GetString("project")).SetDepartment(c.GetString("department")). SetEmployeeId(c.GetString("employee_id")).SetFinishTimeFrom(c.GetString("end_time_from")).SetFinishTimeTo(c.GetString("end_time_to")).SetResponse(c.GetString("response")). SetConditions("del_status", 0) err := complaintList.GetComplainList() if err != nil { c.Data["error"] = err.Error() } c.Data["complains"] = complaintList.GetComplaints() c.Data["count"] = complaintList.GetCount() c.Data["paginator"] = utils.NewPaginator(c.Ctx.Request, int(10), complaintList.GetCount()) c.Data["job__code"] = c.GetString("code") c.Data["project__name"] = c.GetString("project") c.Data["job__department"] = c.GetString("department") c.Data["response"] = c.GetString("response") employee_id := c.GetString("employee_id") if employee_id == "" { c.Data["employee_id"] = strconv.Itoa(int(c.currentUser.GetUser().Id)) } else { c.Data["employee_id"] = employee_id } c.Data["end_time__gte"] = c.GetString("end_time_from") c.Data["end_time__lte"] = c.GetString("end_time_to") }
func (c *ProjectController) ProjectList() { c.TplNames = "project/list.tpl" filter := c.HandleFilter() getAll := make(map[string]interface{}) allProjects, err := project.NewProjectList().GetList(getAll) if err == nil { c.Data["AllProjects"] = allProjects } projects, err := project.NewProjectList().GetList(filter) if err == nil { c.Data["Projects"] = projects } users := user.NewUserList() c.Data["BussinessUser"] = users.GetRoleList(user.BussinessMen) err, progress := project.GetProgressList() if err == nil { c.Data["Progress"] = progress } c.Data["paginator"] = utils.NewPaginator(c.Ctx.Request, int(10), len(allProjects)) }
func (c *UserController) List() { c.GetViewData() p, _ := c.GetInt("p") userList := user.NewUserList().IncludeDeleted(true) c.Data["users"] = userList.SetCondition("company__code", c.GetString("company")).SetCondition("limit", 10).SetCondition("offset", p). SetCondition("id", c.GetString("user_id")).SetCondition("roles", c.GetString("role")). SetCondition("email", c.GetString("email")).SetCondition("mobile", c.GetString("mobile")).GetList() c.Data["count"] = userList.GetCount() c.Data["paginator"] = utils.NewPaginator(c.Ctx.Request, int(10), userList.GetCount()) c.TplNames = "users/list.tpl" }
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 *IndexController) SetProjectsDate() { filter := make(map[string]interface{}) filter["limit"] = 10 filter["offset"] = 0 p, _ := c.GetInt("p") if p > 1 { filter["offset"] = (p - 1) * filter["limit"].(int) } manager_user_id := c.currentUser.GetUser().Id filter["user"] = manager_user_id pl := project.NewProjectList() projects, err := pl.GetList(filter) if err != nil { c.Data["error"] = err.Error() return } c.Data["Projects"] = projects count := pl.Count() c.Data["paginator"] = utils.NewPaginator(c.Ctx.Request, int(10), count) }
func (c *JobController) makePaginator(jl *job.JobList) { c.Data["jobs"] = jl.GetJobs() c.Data["count"] = jl.GetCount() c.Data["paginator"] = utils.NewPaginator(c.Ctx.Request, int(10), jl.GetCount()) c.Data["role"] = c.currentUser.GetRole() }