AdminPanelController.groovy
上传用户:steveyhw
上传日期:2019-05-13
资源大小:307k
文件大小:4k
源码类别:
PlugIns编程
开发平台:
Java
- class AdminPanelController {
- def index = { redirect(action:list,params:params) }
- def allowedMethods = [list:['GET','POST'], check:['GET','POST'], statistical:['GET','POST'],showCheckinfo:['GET','POST']]
- def list = {
- render(view:'main')
- }
- def rosterList = {
- //需要审核的值勤信息
- if(!params.max) params.max = '2'
- if(!params.sort)params.sort = 'id'
- if(!params.offset)params.offset = '0'
- if(!params.order)params.order = 'asc'
- def results = Roster.findAll("from Roster r where r.rosState like :rosState and r.rosDel like :_rosDelState order by ${params.sort} ${params.order} ",
- [rosState:'%'+0+'%',_rosDelState:'%'+0+'%'],[max:Integer.parseInt(params.max),offset:Integer.parseInt(params.offset)])
- params.count=Roster.findAll("from Roster r where r.rosState like :rosState and r.rosDel like :_rosDelState order by ${params.sort} ${params.order} ",
- [rosState:'%'+0+'%',_rosDelState:'%'+0+'%']).size()
- render(view:'rostercheck',model:[rosterList:results])
- }
- //审核值勤申请
- def rosterCheck = {
- if(params.state){
- def roster = Roster.get(params.id)
- if(params.state=="Agree"){
- roster.rosState = '1'
- roster.save()
- println roster.rosState
- }else if(params.state=="Disagree"){
- roster.rosState = '2'
- roster.save()
- println roster.rosState
- }
- }
- render('')
- }
- //显示值勤申请信息
- def showRosterCheckinfo = {
- def roster = Roster.get( params.id )
- if(!roster) {
- flash.message = "roster.not.found"
- flash.args = [params.id]
- flash.defaultMessage = "Roster not found with id ${params.id}"
- redirect(action:rosterList)
- }
- else {
- render(view:'rostercheckinfo',model:[roster:roster])
- }
- }
- def applicatList = {
- //需要审核的申请信息
- if(!params.max) params.max = '2'
- if(!params.sort)params.sort = 'id'
- if(!params.offset)params.offset = '0'
- if(!params.order)params.order = 'asc'
- def results = Applicat.findAll("from Applicat a where a.appState = :appState and a.appDel like :_appDelState order by ${params.sort} ${params.order} ",
- [appState:Code.findByCodValue1('waitCheck'),_appDelState:'%'+0+'%'],[max:Integer.parseInt(params.max),offset:Integer.parseInt(params.offset)])
- params.count=Applicat.findAll("from Applicat a where a.appState = :appState and a.appDel like :_appDelState order by ${params.sort} ${params.order} ",
- [appState:Code.findByCodValue1('waitCheck'),_appDelState:'%'+0+'%']).size()
- render(view:'applicatcheck',model:[applicatList:results])
- }
- //显示申请信息
- def showApplicatCheckinfo = {
- def applicat = Applicat.get( params.id )
- if(!applicat) {
- flash.message = "applicat.not.found"
- flash.args = [params.id]
- flash.defaultMessage = "Applicat not found with id ${params.id}"
- redirect(action:applicatList)
- }
- else {
- render(view:'applicatcheckinfo',model:[applicat:applicat])
- }
- }
- // 审核申请
- def applicatCheck = {
- if(params.state){
- def applicat = Applicat.get(params.id)
- if(params.state=="Agree"){
- applicat.appState = Code.findByCodValue1('checkSuccess')
- applicat.save()
- println applicat.appState
- }else if(params.state=="Disagree"){
- applicat.appState = Code.findByCodValue1('checkFailure')
- applicat.save()
- println applicat.appState
- }
- }
- render('')
- }
- def statistical = {
- render(view:'statistical')
- }
- }