jqeuryEasyUI快速构建正常改查页面

var data_statistics_service = '/api/be-oces-finance-service/v1';//数据统计服务
var get_lcenter_list_url = '/common/v1/organize/learncenters/province';
var get_export='/refund/settlementBill/export'
var indexUri = Cookies.get('localUri');
var get_credit_url = '/refund/leaveSchoolApply';//获取列表
var delete_credit_url = '/credit/delete';//删除
var dataList  = [];//临时iframe交互数据

var management = {
  init : function(){
      var that = this;
      that.panelResize();
      that.showDatagridView();//加载表格数据
      that.changeBodyHeight();
  },
  changeBodyHeight :function(){
      var windowHeight = $(window).height();
      $('body').css({'min-height':windowHeight});
  },
  panelExpand : function(){
      var that = this;
      var status = $('.search-expand-btn').data('expand');
      if (status == 1) {
          $('#toolbar').parents('.easyui-panel').panel('collapse');
          $('.search-expand-btn').data('expand','0').find('span').text('展开');
          $('.search-expand-btn').find('i').removeClass('fa-long-arrow-up').addClass('fa-long-arrow-down');
      }else if(status == 0){
          $('#toolbar').parents('.easyui-panel').panel('expand');
          $('.search-expand-btn').data('expand','1').find('span').text('收起');;
          $('.search-expand-btn').find('i').removeClass('fa-long-arrow-down').addClass('fa-long-arrow-up');
      }
      common.virtualScrollShow('table');//虚拟滚动条展示
  },
  panelResize : function(){
      $(window).resize(function () {
          var bodyHeight = $('body').height();
          var windowHeight = $(window).height();
          var warpWidth = $('.datagrid-view2').width();
          var innerWidth = $('.datagrid-view2').find('.datagrid-btable').width();
          if (bodyHeight < windowHeight || innerWidth < warpWidth) {
              $('.virtual-scroll').hide();
          }else{
              common.virtualScrollShow('table');//虚拟滚动条展示
          }
          $('body').css({'min-height':windowHeight});
      });
  },
  initializeData : function(){
      $('#lcenterCode').combobox('loadData', [{lcenterName:'全部',lcenterCode: ''}]);
  },
  changeProvince : function(newValue, oldValue){
      if (newValue == '') {
          $('#lcenterCode').combobox('clear');
          $('#lcenterCode').combobox('loadData', [{lcenterName:'全部',lcenterCode: ''}]);
          $('#lcenterCode').combobox('setValue','');
      }
  },
  getData: function(param, success, error){
      var opts = $(this).datagrid('options');
      if (!opts.url) return false;
      var ajax = {
          type: opts.method,
          url: opts.url,
          data: param,
          dataType: 'json',
          success: function(data){
              success(data);
          },
          error: function(){
              error.apply(this, arguments);
          }
      };
      agent(ajax);
  },
  loadSuccess : function(data){
      management.updateChangeStyle();
      var pager = $('#table').datagrid('getPager');
      if(data.total == 0){
          $(pager).pagination({
              displayMsg: '共 0 条记录'
          });
          $('.virtual-scroll').hide();
      }else{
          $(pager).pagination({
              beforePageText: '第',//页数文本框前显示的汉字
              afterPageText: '页    共 {pages} 页',
              displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录',
          });
          common.virtualScrollShow('table');//虚拟滚动条展示
          $('.easyui-menubutton').menubutton({
              plain:false,
          });
      }
      System.init();
  },
  loadError : function(){
      management.updateChangeStyle();
      var pager = $('#table').datagrid('getPager');
      $(pager).pagination({
          displayMsg: '共 0 条记录'
      });
      $.messager.alert('提示','<div style="padding:20px 10px;text-align: center;">获取数据失败</div>');
  },
  loadDataFilter : function(data){
      var tempList = {};
      if(data.data.content){
          tempList = {
              total:data.data.totalRecords,
              rows:data.data.content
          };
          dataList = data.data.content;
      }else{
          tempList = {
              total:0,
              rows:[]
          };
      }
      return tempList;
  },
  operationFormatter : function(value,rowData,rowIndex){
      var infoButton=""
      var printButton='<a  target="_Blank" style="margin-left: 10px;" href="'+Cookies.get('localUri')+'/admin/base/basic/univededuct/quit-study-paymentform/print.html?studentCode='+rowData.studentCode+'&changeId='+rowData.changeId+'"  class="easyui-linkbutton button-blue-model button-xs l-btn l-btn-small" title="打印" close="true" id="additional-print'+rowData.balanceRefundmentCollectId+'"><span class="l-btn-left"><span class="l-btn-text">打印</span></span></a>';
      if(rowData.auditStatus=="0"){
          infoButton='<a href="javaScript:void(0)" class="easyui-linkbutton button-blue-model button-xs l-btn l-btn-small" title="退费审批"  id="additional-style'+rowData.id+'" onclick="management.update(\''+rowData.studentCode+'\',\''+rowData.applyDate+'\',\''+rowData.loginName+'\',\''+rowData.statusType+'\',\''+rowData.batchCode+'\',\''+rowData.status+'\',\''+rowData.realName+'\',\''+rowData.changeId+'\',\''+rowData.applyId+'\',\''+rowData.studentSourceName+'\',\''+rowData.discountAmount+'\')"><span class="l-btn-left"><span class="l-btn-text">退费审批</span></span></a>';
      }else if(rowData.auditStatus=="1"){
          infoButton='<a href="javaScript:void(0)" class="easyui-linkbutton button-blue-model button-xs l-btn l-btn-small" title="退费审批" style="background: #ccc!important;cursor: not-allowed;">退费审批</span></span></a>';
      }
      return infoButton+printButton
  },
  update : function(studentCode,applyDate,loginName,statusType,batchCode,status,realName,changeId,applyId,studentSourceName,discountAmount){//班级学生管理
      var that = this;
      $.iframe.win({
          title: '退学退费审批',
          url:'./detail.html?id='+studentCode+'&applyDate='+encodeURI(encodeURI(applyDate))+'&loginName='+encodeURI(encodeURI(loginName))+'&statusType='+encodeURI(encodeURI(statusType))+'&batchCode='+encodeURI(encodeURI(batchCode))+'&status='+encodeURI(encodeURI(statusType))+'&realName='+encodeURI(encodeURI(realName))+'&changeId='+encodeURI(encodeURI(changeId))+'&applyId='+applyId+"&studentSourceName="+encodeURI(encodeURI(studentSourceName))+'&discountAmount='+discountAmount,
          maximizable: false,
          width: 830,
          height:550,
          modal: true
      });
      var evt = window.event || arguments.callee.caller.arguments[0]; // 获取event对象兼容ff
      evt.stopPropagation();//防止触发onClickRow事件
      return false;
  },
  enterPress : function (e) { //传入 event
      var that = this;
      if (e.keyCode == 13) {
          that.searchData();
      }
  },
  searchData : function() {
      // var lcenterName=$("#lcenterCode").combobox("getText");
      var lcenterCode=$("#lcenterCode").combobox("getValue");
      var statusChangeType=$("#statusChangeType").combobox("getValue");
      var auditStatus=$("#auditStatus").combobox("getValue");
      var realName=$("#realName").val();
      var studentCode=$("#studentCode").val();
      var universityStuNo=$("#universityStuNo").val();
      var applyStartDate = $('#applyStartDate').val()||"";
      var applyEndDate = $('#applyEndDate').val()||"";
      $('#table').datagrid('load',{
          lcenterName:"",
          lcenterCode:lcenterCode,
          statusChangeType:statusChangeType,
          auditStatus:auditStatus,
          realName:realName,
          studentCode:studentCode,
          universityStuNo:universityStuNo,
          applyStartDate:applyStartDate,
          applyEndDate:applyEndDate
      })
  },
  resetSearch : function(){
      $("#lcenterCode").combobox("setValue","");
      $("#statusChangeType").combobox("setValue","");
      $("#auditStatus").combobox("setValue","0");
      $("#realName").textbox("setValue","");
      $("#studentCode").textbox("setValue","");
      $("#universityStuNo").textbox("setValue","");
      $('#applyStartDate').datebox("setValue","");
      $('#applyEndDate').datebox("setValue","");
      management.searchData();
  },
  resizeVirtualScroll : function (){
      var innerWidth = $('.datagrid-view2').find('.datagrid-btable').width();
      $('.virtual-scroll').find('div').width(innerWidth + 20);
  },
  changeStyle : function(){
      var tempData = $('#table').datagrid('getSelections');
      if (tempData.length > 0) {
          $('#deleteCredit').removeClass('l-btn-disabled').addClass('button-red');
          $('#deleteCredit').linkbutton('enable');
      }else{
          $('#deleteCredit').removeClass('button-red').addClass('l-btn-disabled');
          $('#deleteCredit').linkbutton('disable');
      }
  },
  updateChangeStyle : function(){
      $('#deleteCredit').removeClass('button-red').addClass('l-btn-disabled');
      $('#deleteCredit').linkbutton('disable');
  },
  showDatagridView : function(){
      var that = this;
      var parameter = {
          lcenterName:'',
          lcenterCode:'',
          statusChangeType:'',
          auditStatus:'0',
          realName:'',
          studentCode:'',
          universityStuNo:'',
          applyStartDate:'',
          applyEndDate:''
      };
      $('#table').datagrid({
          width:'100%',
          singleSelect:false,
          collapsible:true,
          pagination:true,
          fitColumns:true,
          selectOnCheck:true,
          rownumbers: true,
          striped:true,
          scrollbarSize:0,
          pageSize:10,
          nowrap:true,
          view:emptyView,
          emptyMsg:"暂无相关数据",
          loader:that.getData,
          url:data_statistics_service + get_credit_url,
          method:'get',
          queryParams:parameter,
          onLoadSuccess:that.loadSuccess,
          onLoadError:that.loadError,
          loadFilter:that.loadDataFilter,
          onResizeColumn:that.resizeVirtualScroll,
          onSelect: that.changeStyle,
          onUnselect: that.changeStyle,
          onCheckAll: that.changeStyle,
          onUncheckAll: that.changeStyle,
          onBeforeLoad:that.onBeforeLoad,
          toolbar:'#tools',
          columns:[[
              {field:'ck',checkbox:true},
              {field:'studentCode',width:'',title:'报名编号',align:'center'},
              {field:'batchCode',width:'',title:'入学批次',align:'center'},
              {field:'loginName',width:'',title:'用户名',align:'center'},
              {field:'realName',width:'',title:'姓名',align:'center'},
              {field:'lcenterName',width:'',title:'学习中心',align:'center'},
              {field:'statusType',width:'',title:'异动类型',align:'center'},
              {field:'applyDate',width:'',title:'申请时间',align:'center'},
              {field:'feeBalance',width:'',title:'费用余额',align:'center'},
              {field:'auditStatus',width:'',title:'审批状态',align:'center',formatter:that.auditStatusFormatter},
              {field:' ', width:'200px',title:'操作',align:'center',formatter:that.operationFormatter}
          ]]
      });
  },
  //修改默认分页参数
  onBeforeLoad:function (params) {
      params["pageSize"] = params.rows;
      params["currentPage"] = params.page;
      delete params.rows;
      delete params.page;
  },
  auditStatusFormatter:function(value,rowData,rowIndex){
      var msg=""
      if(rowData.auditStatus=="0"){
          msg="退费待审批"
      }else if(rowData.auditStatus=="1"){
          msg="退费审批通过"
      }
      else if(rowData.auditStatus=="2"){
          msg="退费审批不通过"
      }
      return msg;
  },
  deleteItem : function(ids,type){
      var ids = ids;
      var tempData = $('#table').datagrid('getSelections');
      var ids = [];
      for(var i in tempData){
          ids.push(tempData[i].id);
      }
      var parameter = ids;
      var ajax = {
          type:'DELETE',
          url:data_statistics_service + delete_credit_url,
          dataType:'text',
          data:JSON.stringify(parameter),
          contentType:'application/json;charset=UTF-8',
          error:function(XMLHttpRequest,valStatus,errorThrown) { //失败
              $.messager.alert('提示',$.parseJSON(XMLHttpRequest.responseText).message, 'info');
          },
          success:function(data,valStatus) {
              if (data.length == 0) {
                  management.reloadData();
                  $.messager.alert('提示','操作成功', 'info');
              } else{
                  management.reloadData();
                  $.messager.alert('提示',$.parseJSON(data).message, 'info');
              }
          }
      };
      $.messager.confirm('删除', '确认删除这些记录信息' , function(r){
          if (r){
              agent(ajax);
          }
      });
      var evt = window.event || arguments.callee.caller.arguments[0]; // 获取event对象兼容ff
      evt.stopPropagation();//防止触发onClickRow事件
      return false;
  },
  getQueryString : function(name){
      var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
      var r = window.location.search.substr(1).match(reg);
      if (r != null) return decodeURI(r[2]);
      return null;
  },
  showComoboxPanel:function(){

  },
  exportCart:function () {
      var studyType = $('#studyType').combobox('getValue')||"";
      var universityCode = $('#universityCode').combobox('getValue')||"";
      var recruitBatchCode = $('#recruitBatchCode').combobox('getValue')||"";
      var province = $('#province').combobox('getValue')||"";
      var refundType = $('#refundType').combobox('getValue')||"";
      var arrivalStatus = $('#arrivalStatus').combobox('getValue')||"";
      var makePay = $('#makePay').combobox('getValue')||"";
      var applyStartDate = $('#applyStartDate').val()||"";
      var applyEndDate = $('#applyEndDate').val()||"";
      var stuName = $('#stuName').val()||"";
      var stuCode = $('#stuCode').val()||"";
      window.location.href=data_statistics_service+get_export+"?studyType="+studyType
          +"&universityCode="+universityCode
          +"&recruitBatchId="+recruitBatchCode
          +"&province="+province
          +"&refundType="+refundType
          +"&arrivalStatus="+arrivalStatus
          +"&makePay="+makePay
          +"&applyStartDate="+applyStartDate
          +"&applyEndDate="+applyEndDate
          +"&stuName="+stuName
          +"&stuCode="+stuCode

  },
  //确认通过
  getPaymentforms:function () {
      var payBillName=$("#payBillName").val();
      var payBillRemark=$("#payBillRemark").val();
      if(payBillName==""){
          $.messager.alert('提示',"支付单名称不能为空", 'info');
          return false;
      }
      var tempData = $('#table').datagrid('getSelections');
      var ids = [];
      for(var i in tempData){
          ids.push(tempData[i]+",");
      }
      var parameter = {
          collectIds:ids
      };
      var ajax = {
          type:'POST',
          url:data_statistics_service + get_createPayBill,
          dataType:'json',
          data:JSON.stringify(parameter),
          contentType:'application/x-www-form-urlencoded',
          error:function(XMLHttpRequest,valStatus,errorThrown) { //失败
              $.messager.alert('提示',$.parseJSON(XMLHttpRequest.responseText).message, 'info');
          },
          success:function(data,valStatus) {
              if (data.length == 0) {
                  management.reloadData();
                  $.messager.alert('提示','操作成功', 'info');
              } else{
                  management.reloadData();
                  $.messager.alert('提示',$.parseJSON(data).message, 'info');
              }
          }
      };
      $.messager.confirm('删除', '确认要确认通过吗?' , function(r){
          if (r){
              agent(ajax);
          }
      });
      var evt = window.event || arguments.callee.caller.arguments[0]; // 获取event对象兼容ff
      evt.stopPropagation();//防止触发onClickRow事件
      return false;
  },
  //取消通过
  getCancel:function () {
      var payBillName=$("#payBillName").val();
      var payBillRemark=$("#payBillRemark").val();
      if(payBillName==""){
          $.messager.alert('提示',"支付单名称不能为空", 'info');
          return false;
      }
      var tempData = $('#table').datagrid('getSelections');
      var ids = [];
      for(var i in tempData){
          ids.push(tempData[i]+",");
      }
      var parameter = {
          collectIds:ids
      };
      var ajax = {
          type:'POST',
          url:data_statistics_service + get_createPayBill,
          dataType:'json',
          data:JSON.stringify(parameter),
          contentType:'application/x-www-form-urlencoded',
          error:function(XMLHttpRequest,valStatus,errorThrown) { //失败
              $.messager.alert('提示',$.parseJSON(XMLHttpRequest.responseText).message, 'info');
          },
          success:function(data,valStatus) {
              if (data.length == 0) {
                  management.reloadData();
                  $.messager.alert('提示','操作成功', 'info');
              } else{
                  management.reloadData();
                  $.messager.alert('提示',$.parseJSON(data).message, 'info');
              }
          }
      };
      $.messager.confirm('删除', '确认要确认通过吗?' , function(r){
          if (r){
              agent(ajax);
          }
      });
      var evt = window.event || arguments.callee.caller.arguments[0]; // 获取event对象兼容ff
      evt.stopPropagation();//防止触发onClickRow事件
      return false;
  },
  //获取学习中心列表
  getLcenter: function(){
      var ajax = {
          type:'GET',
          url:commondata_service_url + get_lcenter_list_url,
          dataType:'json',
          data:{
              provinceCode:''
          },
          error:function(XMLHttpRequest,textStatus,errorThrown) { //失败
              $.messager.alert('提示',$.parseJSON(XMLHttpRequest.responseText).message, 'info');
          },
          success:function(data,valStatus) {
              if (data.code != undefined) {
                  $.messager.alert('提示',data.message, 'info');
              }else{
                  var allOption = {
                      lcenterCode:'',
                      lcenterName: '全部'
                  };
                  var list = data;
                  list.unshift(allOption);
                  $('#lcenterCode').combobox('loadData',list);
                  $('#lcenterCode').combobox('setValue','');
              }
          }
      };
      agent(ajax);
  },
}
management.init();
//页面点击事件
$(function(){
  management.getLcenter();
  management.initializeData();
  management.showComoboxPanel();
});
}
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 202,723评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,080评论 2 379
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 149,604评论 0 335
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,440评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,431评论 5 364
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,499评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,893评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,541评论 0 256
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,751评论 1 296
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,547评论 2 319
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,619评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,320评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,890评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,896评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,137评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,796评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,335评论 2 342

推荐阅读更多精彩内容