`

extjs

 
阅读更多



 

   
   
   
  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  <head>
  <base href="http://www.zidaiwang.com:80/">
  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="pragma" content="no-cache">
  <meta http-equiv="cache-control" content="no-cache">
  <meta http-equiv="expires" content="0">
  <link rel="stylesheet" href="resources/admin/css/ext-all.css" type="text/css"></link>
  <link rel="stylesheet" href="resources/admin/css/animated-dataview.css" type="text/css"></link>
  <link rel="stylesheet" href="resources/admin/css/fileuploadfield.css" type="text/css"></link>
  <link rel="stylesheet" href="resources/admin/css/Spinner.css" type="text/css"></link>
  <link rel="stylesheet" href="resources/admin/css/ext-smt.css" type="text/css"></link>
  <link rel="stylesheet" href="resources/admin/css/costmon.css" type="text/css">
  <link rel="stylesheet" href="resources/admin/css/grid-examples.css" type="text/css">
  <script type="text/javascript" src="resources/admin/js/ext-base.js"></script>
  <script type="text/javascript" src="resources/admin/js/ext-all.js"></script>
  <script type="text/javascript" src="resources/admin/js/ext-lang-zh_CN.js"></script>
  <script type="text/javascript" src="resources/admin/js/FileUploadField.js"></script>
  <script type="text/javascript" src="resources/admin/js/DateTimeField.js"></script>
  <script type="text/javascript" src="resources/admin/js/ComboBoxTree.js"></script>
  <script type="text/javascript" src="resources/admin/js/TreeCheckNodeUI.js"></script>
  <script type="text/javascript" src="resources/admin/js/ProgressBarPager.js"></script>
  <script type="text/javascript" src="resources/admin/js/constant.js"></script>
  <script type="text/javascript" src="resources/admin/js/util.js"></script>
   
  <style type="text/css">
  .title_a{
  height: 20px;
  font-size: 13px;
  width: 60px;
  }
  .title_b{
  height: 20px;
  width: 60px;
  }
  #btn_div{
  height: 20px;
  width: 140px;
  margin-left:85%;
  margin-top: 40px;
  position: absolute;
  }
  #user{
  float:right;
  font-size: 14px;
  color: black;
  margin-top: 10px;
  margin-left:74%;
  position: absolute;
  }
   
  </style>
  <title>自贷网</title>
  </head>
  <body class="icon-male">
  <script type="text/javascript"><!--
  Ext.onReady(function(){
   
  Ext.QuickTips.init();// 浮动信息提示
  Ext.BLANK_IMAGE_URL = 'resources/admin/images/default/s.gif';// 替换图片文件地址为本地
   
  //借款标数据源
  var masterStore = new Ext.data.JsonStore({
  url: '/loanSign/list',
  root: 'data',
  totalProperty: 'totalCount',
  idProperty: 'id',
  autoDestroy: true,
  baseParams: {
  conditions: ''
  },
  fields: [
  {name: 'id'},
  {name: 'loanNumber'},
  {name: 'loanTitle'},
  {name: 'borrower_id'},
  {name: 'borrower_name'},
  {name: 'borrower_credit'},
  {name: 'loanUnit'},
  {name: 'thisIssueLoan'},
  {name: 'assure'},
  {name: 'bidReward'},
  {name: 'rateYear'},
  {name: 'loanCount'},
  {name: 'unassureWay'},
  {name: 'reward'},
  {name: 'residue'},
  {name: 'refundWay'},
  {name: 'loanState'},
  {name: 'isCredit'},
  {name: 'creditTime'},
  {name: 'isShow'},
  {name: 'isRecommand'},
  {name: 'overview'},
  {name: 'behoof'},
  {name: 'loanOrigin'},
  {name: 'riskCtrlWay'},
  {name: 'speech'},
  {name: 'refundDeadline'},
  {name: 'riskAssess'},
  {name: 'Mfeeratio'},
  {name: 'Mfeetop'},
  {name: 'Pmfeeratio'},
  {name: 'Pmfeetop'},
  {name: 'loanSignTime'}
  ]
  });
   
   
  //7Day数据源
  var masterStore2 = new Ext.data.JsonStore({
  url: '/loanSign/expireLoanSign',
  root: 'data',
  totalProperty: 'totalCount',
  idProperty: 'id',
  autoDestroy: true,
  fields: [
  {name: 'id'},
  {name: 'loanNumber'},
  {name: 'loanTitle'},
  {name: 'borrower_id'},
  {name: 'borrower_name'},
  {name: 'borrower_credit'},
  {name: 'loanUnit'},
  {name: 'thisIssueLoan'},
  {name: 'assure'},
  {name: 'bidReward'},
  {name: 'rateYear'},
  {name: 'loanCount'},
  {name: 'unassureWay'},
  {name: 'reward'},
  {name: 'residue'},
  {name: 'refundWay'},
  {name: 'loanState'},
  {name: 'isCredit'},
  {name: 'creditTime'},
  {name: 'isShow2'},
  {name: 'isRecommand2'},
  {name: 'overview'},
  {name: 'behoof'},
  {name: 'loanOrigin'},
  {name: 'riskCtrlWay'},
  {name: 'speech'},
  {name: 'refundDeadline'},
  {name: 'riskAssess'}
  ]
  });
   
   
  //附件数据源
  var accessoryStore = new Ext.data.JsonStore({
  url: '/loanSign/attaList',
  root: 'data',
  totalProperty: 'totalCount',
  idProperty: 'id',
  autoDestroy: true,
  fields: [
  { name: 'id' },
  { name: 'attachmentName' },
  { name: 'attachmentType' },
  { name: 'attachmentSize' },
  { name: 'uploadTime' },
  { name: 'uploader_name' }
  ]
  });
   
   
  //评论数据源
  var commentStore = new Ext.data.JsonStore({
  url: '/loanSign/commentList',
  root: 'data',
  totalProperty: 'totalCount',
  idProperty: 'id',
  autoDestroy: true,
  fields: [
  { name: 'id' },
  { name: 'commentator_name' },
  { name: 'cmtContent' },
  { name: 'cmtReply' },
  { name: 'cmtIsShow' }
  ]
  });
   
   
  //还款记录数据源
  var repayRdStore = new Ext.data.JsonStore({
  url: '/loanSign/repayRdList',
  root: 'data',
  totalProperty: 'totalCount',
  idProperty: 'id',
  autoDestroy: true,
  fields: [
  { name: 'id' },
  { name: 'periods' },
  { name: 'preRepayDate' },
  { name: 'preRepayMoney' },
  { name: 'repayState' },
  { name: 'repayTime' },
  { name: 'overdueState' }
  ]
  });
   
   
  //出借记录数据源
  var loanRdStore = new Ext.data.JsonStore({
  url: '/loanSign/loanRdList',
  root: 'data',
  totalProperty: 'totalCount',
  idProperty: 'id',
  autoDestroy: true,
  fields: [
  { name: 'id' },
  { name: 'lender_name' },
  { name: 'loanSign_refundDeadline' },
  { name: 'loanSign_rateYear' },
  { name: 'tenderMoney' },
  { name: 'isSucceed' },
  { name: 'tenderTime' }
  ]
  });
   
   
  //借款人数据源
  var loanPersonStore = new Ext.data.JsonStore({
  url: '/loanSign/loanPersonList',
  root: 'data',
  totalProperty: 'totalCount',
  idProperty: 'id',
  autoDestroy: true,
  fields: [
  { name: 'id' },
  { name: 'user_name' },
  { name: 'userName'},
  { name: 'cardId'},
  { name: 'credit'}
  ]
  });
   
   
  //强行添加借款人数据源
  var bgdLoanPersonStore = new Ext.data.JsonStore({
  url: '/loanSign/bgdLoanPersonList',
  root: 'data',
  totalProperty: 'totalCount',
  idProperty: 'id',
  autoDestroy: true,
  fields: [
  { name: 'guid' },
  { name: 'name' },
  { name: 'cardId'},
  { name: 'nickName'},
  { name: 'Address'},
  { name: 'createTime'},
  { name: 'credit'}
  ]
  });
   
  var showLoanPersonList = new Ext.Action({
  text: '借款人管理',
  iconCls: 'stm-returns',
  handler: function(){
  bgdLoanPersonStore.load({
  params:{
  start:0,
  limit:10
  },
  waitTitle:'提示',waitMsg: '数据加载请稍后...',
  failure: function() {
  Ext.Msg.alert('提示', '读取数据失败!');
  }
  });
  loanPersonListWindow.show();
  }
  });
   
   
  var form1ReturnAction = new Ext.Action({
  text: '返回',
  iconCls: 'stm-returns',
  handler: function(){
  form1Window.hide();
  }
  });
   
   
  //新增按钮
  var addAction = new Ext.Action({
  text: Constant.btn_add_text,
  iconCls: 'stm_add',
  scale: 'small',
  handler: function(){
  Ext.getCmp('borrowerName2').enable();
  Ext.getCmp('loanNumber').enable();
  Ext.getCmp('loanTitle').enable();
  Ext.getCmp('rateYear').enable();
  Ext.getCmp('assure').enable();
  Ext.getCmp('bidReward').enable();
  Ext.getCmp('unassureWay').enable();
  Ext.getCmp('overview').enable();
  Ext.getCmp('behoof').enable();
  Ext.getCmp('loanOrigin').enable();
  Ext.getCmp('riskCtrlWay').enable();
  Ext.getCmp('speech').enable();
  Ext.getCmp('thisIssueLoan').enable();
  Ext.getCmp('reward').enable();
  Ext.getCmp('loanUnitBox').enable();
  Ext.getCmp('riskAssessBox').enable();
  Ext.getCmp('rdBox').enable();
  Ext.getCmp('refundWayBox').enable();
  form1Window.show();
   
  form1Window.setTitle('新增借款标');
  Ext.getCmp('Mfeeratio').getEl().up('.x-form-item').setDisplayed(false);
  Ext.getCmp('Mfeetop').getEl().up('.x-form-item').setDisplayed(false);
  Ext.getCmp('Pmfeeratio').getEl().up('.x-form-item').setDisplayed(false);
  Ext.getCmp('Pmfeetop').getEl().up('.x-form-item').setDisplayed(false);
   
  form1.getForm().reset();
  form1SaveAction.show();
   
  }
  });
   
  //借款人列表确认按钮
  var loanPersonSureAction = new Ext.Action({
  text: '确认',
  //iconCls: 'stm_add',
  scale: 'small',
  handler: function(){
  //如果已选择信息
  if (Ext.getCmp('loanPersonGrid').getSelectionModel().hasSelection()){
  var record = Ext.getCmp('loanPersonGrid').getSelectionModel().getSelected();
  if(record.length > 1) {
  Ext.Msg.alert('只能选择一个借款人');
  }
  Ext.getCmp('borrowerName2').setValue(record.get('user_name'));
   
  loanPersonWindow.hide();
  }
   
  }
  });
   
   
   
  //查看内容返回按钮
  var lookUpReturnAction = new Ext.Action({
  text: '返回',
  //iconCls: 'stm_add',
  scale: 'small',
  handler: function(){
  lookUpWindow.hide();
  }
  });
   
   
  //查看内容按钮
  var lookUpAction = new Ext.Action({
  text: '查看内容',
  iconCls: 'smt-userInquires',
  scale: 'small',
  disabled: true,
  handler: function(){
  var reord = Ext.getCmp('myGrid').getSelectionModel().getSelected();
   
  Ext.getCmp('speech33').setValue(reord.get('speech'));
  Ext.getCmp('riskCtrlWay33').setValue(reord.get('riskCtrlWay'));
  Ext.getCmp('loanOrigin33').setValue(reord.get('loanOrigin'));
  Ext.getCmp('behoof33').setValue(reord.get('behoof'));
  Ext.getCmp('overview33').setValue(reord.get('overview'));
  Ext.getCmp('isRecommand33').setValue(reord.get('isRecommand'));
  Ext.getCmp('isShow33').setValue(reord.get('isShow'));
  Ext.getCmp('unassureWay33').setValue(reord.get('unassureWay'));
  Ext.getCmp('assure33').setValue(reord.get('assure'));
  Ext.getCmp('reward33').setValue(reord.get('reward'));
  Ext.getCmp('bidReward33').setValue(reord.get('bidReward'));
  Ext.getCmp('rateYear33').setValue(reord.get('rateYear'));
  Ext.getCmp('loanTitle33').setValue(reord.get('loanTitle'));
  Ext.getCmp('loanNumber33').setValue(reord.get('loanNumber'));
  Ext.getCmp('id33').setValue(reord.get('id'));
  Ext.getCmp('thisIssueLoan33').setValue(reord.get('thisIssueLoan'));
  Ext.getCmp('borrowerName33').setValue(reord.get('borrower_name'));
   
  Ext.getCmp('loanUnitBox33').setValue(reord.get('loanUnit'));
  Ext.getCmp('riskAssessBox33').setValue(reord.get('riskAssess'));
  Ext.getCmp('rdBox33').setValue(reord.get('refundDeadline'));
  Ext.getCmp('refundWayBox33').setValue(reord.get('refundWay'));
   
  Ext.getCmp('Mfeeratio33').setValue(reord.get('Mfeeratio'));
  Ext.getCmp('Mfeetop33').setValue(reord.get('Mfeetop'));
  Ext.getCmp('Pmfeeratio33').setValue(reord.get('Pmfeeratio'));
  Ext.getCmp('Pmfeetop33').setValue(reord.get('Pmfeetop'));
   
  lookUpWindow.show();
   
  if(reord.get('loanState')!='未发布') {
  Ext.getCmp('Mfeeratio33').getEl().up('.x-form-item').setDisplayed(true);
  Ext.getCmp('Mfeetop33').getEl().up('.x-form-item').setDisplayed(true);
  Ext.getCmp('Pmfeeratio33').getEl().up('.x-form-item').setDisplayed(true);
  Ext.getCmp('Pmfeetop33').getEl().up('.x-form-item').setDisplayed(true);
  }else{
  Ext.getCmp('Mfeeratio33').getEl().up('.x-form-item').setDisplayed(false);
  Ext.getCmp('Mfeetop33').getEl().up('.x-form-item').setDisplayed(false);
  Ext.getCmp('Pmfeeratio33').getEl().up('.x-form-item').setDisplayed(false);
  Ext.getCmp('Pmfeetop33').getEl().up('.x-form-item').setDisplayed(false);
  }
   
   
  }
  });
   
   
  //编辑按钮
  //除了'是否显示'和'是否推荐',其他数据只能在该标处于'未发布'状态下修改
  var editAction = new Ext.Action({
  text: Constant.btn_edit_text,
  iconCls: 'stm-edit',
  scale: 'small',
  disabled: true,
  handler: function(){
  var record = myGrid.getSelectionModel().getSelected();
  form1Window.show();
  if(record.get('loanState') != '未发布') {
  Ext.getCmp('borrowerName2').disable();
  Ext.getCmp('loanNumber').disable();
  Ext.getCmp('loanTitle').disable();
  Ext.getCmp('rateYear').disable();
  Ext.getCmp('assure').disable();
  Ext.getCmp('bidReward').disable();
  Ext.getCmp('unassureWay').disable();
  Ext.getCmp('overview').disable();
  Ext.getCmp('behoof').disable();
  Ext.getCmp('loanOrigin').disable();
  Ext.getCmp('riskCtrlWay').disable();
  Ext.getCmp('speech').disable();
  Ext.getCmp('thisIssueLoan').disable();
  Ext.getCmp('reward').disable();
  Ext.getCmp('loanUnitBox').disable();
  Ext.getCmp('riskAssessBox').disable();
  Ext.getCmp('rdBox').disable();
  Ext.getCmp('refundWayBox').disable();
   
  Ext.getCmp('Mfeeratio').getEl().up('.x-form-item').setDisplayed(true);
  Ext.getCmp('Mfeetop').getEl().up('.x-form-item').setDisplayed(true);
  Ext.getCmp('Pmfeeratio').getEl().up('.x-form-item').setDisplayed(true);
  Ext.getCmp('Pmfeetop').getEl().up('.x-form-item').setDisplayed(true);
   
  } else {
  Ext.getCmp('borrowerName2').enable();
  Ext.getCmp('loanNumber').enable();
  Ext.getCmp('loanTitle').enable();
  Ext.getCmp('rateYear').enable();
  Ext.getCmp('assure').enable();
  Ext.getCmp('bidReward').enable();
  Ext.getCmp('unassureWay').enable();
  Ext.getCmp('overview').enable();
  Ext.getCmp('behoof').enable();
  Ext.getCmp('loanOrigin').enable();
  Ext.getCmp('riskCtrlWay').enable();
  Ext.getCmp('speech').enable();
  Ext.getCmp('thisIssueLoan').enable();
  Ext.getCmp('reward').enable();
  Ext.getCmp('loanUnitBox').enable();
  Ext.getCmp('riskAssessBox').enable();
  Ext.getCmp('rdBox').enable();
  Ext.getCmp('refundWayBox').enable();
   
  Ext.getCmp('Mfeeratio').getEl().up('.x-form-item').setDisplayed(false);
  Ext.getCmp('Mfeetop').getEl().up('.x-form-item').setDisplayed(false);
  Ext.getCmp('Pmfeeratio').getEl().up('.x-form-item').setDisplayed(false);
  Ext.getCmp('Pmfeetop').getEl().up('.x-form-item').setDisplayed(false);
  }
   
  form1Window.setTitle(Constant.btn_edit_text);
  loanUnitBox.setValue(record.get('loanUnit'));
  riskAssessBox.setValue(record.get('riskAssess'));
  rdBox.setValue(record.get('refundDeadline'));
  refundWayBox.setValue(record.get('refundWay'));
  Ext.getCmp('borrowerName2').setValue(record.get('borrower_name'));
  form1.getForm().loadRecord(record);
  }
  });
   
   
  //删除按钮
  var delAction = new Ext.Action({
  id: 'workDel',
  text: Constant.btn_del_text,
  iconCls: 'stm-delete',
  scale: 'small',
  disabled: true,
  handler: function(){
  if (myGrid.getSelectionModel().hasSelection()) {
  var flag = true;
  Ext.Msg.confirm('删除确认', '是否删除选择的记录?', function(aButton){
  if (aButton == 'yes'){
  var id = '';
  var records = myGrid.getSelectionModel().getSelections();
  for(var i = 0, len = records.length; i < len; i ++) {
  id = id + records[i].id + ',';
  if(records[i].get('loanState') != '未发布') {
  flag = false;
  break;
  }
  }
  if(!flag) {
  Ext.Msg.alert('提示', '只能删除未发布的标');
  return;
  }
  Ext.Ajax.request({
  url: '/loanSign/del',
  params: {
  _ids: id
  },
  success: function(resp, opts){
  masterStore.reload({callback: myGridUpdateAction});
  Ext.MessageBox.alert('提示', Constant.delete_sucess);
  },
  failure: function(resp, opts){
  var respText = Ext.util.JSON.decode(resp.responseText);
  Ext.MessageBox.alert('提示', respText.msg);
  }
  })
  }
  });
  }
  }
  });
   
   
  var fabuAction = new Ext.Action({
  text: '发布',
  iconCls: 'smt-book_go',
  scale: 'small',
  disabled: true,
  handler: function(){
  var record = myGrid.getSelectionModel().getSelected();
  var _loanSignId = record.get('id');
  if(record.get('loanState') != '未发布') {
  Ext.Msg.alert('提示', '只有未发布的标才能发布');
  return;
  }
   
  Ext.Msg.confirm('发布确认', '是否发布?', function(aButton){
  if (aButton == 'yes'){
  Ext.Ajax.request({
  url: '/loanSign/publish',
  params: {
  _loanSignId: _loanSignId
  },
  success: function(resp, opts){
  masterStore.reload({callback: myGridUpdateAction});
  var respText = Ext.util.JSON.decode(resp.responseText);
  Ext.getCmp('s1').setText('未发布:'+respText.s1);
  Ext.getCmp('s2').setText('进行中:'+respText.s2);
  Ext.MessageBox.alert('提示', '发布成功');
  },
  failure: function(resp, opts){
  var respText = Ext.util.JSON.decode(resp.responseText);
  Ext.MessageBox.alert('提示', respText.msg);
  }
  })
  }
  });
  }
  });
   
   
  var daoqiAction = new Ext.Action({
  text: '即将到期还款标',
  iconCls: 'smt-systemTime',
  scale: 'small',
  //disabled: true,
  handler: function(){
  sDayWindow.show();
  masterStore2.load();
  }
  });
   
   
  var fangkuanAction = new Ext.Action({
  text: '放款完成',
  iconCls: 'smt-quanxuan',
  scale: 'small',
  disabled: true,
  handler: function(){
  var record = myGrid.getSelectionModel().getSelected();
  var _loanSignId = record.get('id');
   
  if(record.get('loanState') != '进行中') {
  Ext.Msg.alert('提示', '放款失败,该标未处于进行中');
  return;
  }
  if(record.get('isCredit') == '已放款') {
  Ext.Msg.alert('提示', '放款失败,该标已放款');
  return;
  }
   
  Ext.Msg.confirm('放款确认', '是否放款?', function(aButton){
  if (aButton == 'yes'){
  Ext.Ajax.request({
  url: '/loanSign/credit',
  params: {
  _loanSignId: _loanSignId
  },
  success: function(resp, opts){
  masterStore.reload({callback: myGridUpdateAction});
  var respText = Ext.util.JSON.decode(resp.responseText);
  Ext.getCmp('s2').setText('进行中:'+respText.s2);
  Ext.getCmp('s4').setText('回款中:'+respText.s4);
  Ext.MessageBox.alert('提示', '放款完成');
  },
  failure: function(resp, opts){
  var respText = Ext.util.JSON.decode(resp.responseText);
  Ext.MessageBox.alert('提示', respText.msg);
  }
  })
  }
  });
  }
  });
   
   
  //导出
  var daochuAction = new Ext.Action({
  text: '导出',
  iconCls: 'smt-export',
  scale: 'small',
  handler: function(){
  var thisForm = document.createElement('form');
  thisForm.method = 'post';
  thisForm.action = '/loanSign/export';
  document.body.appendChild(thisForm);
  thisForm.submit();
  }
  });
   
   
  //出借记录导出
  var daochu2Action = new Ext.Action({
  text: '导出',
  iconCls: 'smt-export',
  scale: 'small',
  handler: function(){
  var _loanSignId;
  if(Ext.getCmp('myGrid').getSelectionModel().hasSelection()){
  _loanSignId = myGrid.getSelectionModel().getSelected().get('id');
  }else{
  Ext.Msg.alert('提示', '请选择一条借款标');
  return;
  }
  var thisForm = document.createElement('form');
  thisForm.method = 'post';
  thisForm.action = '/loanSign/exportLoanRecord?_loanSignId='+_loanSignId;
  document.body.appendChild(thisForm);
  thisForm.submit();
  }
  });
   
   
  //评论编辑按钮
  var editForCmtAction = new Ext.Action({
  text: Constant.btn_edit_text,
  iconCls: 'stm-edit',
  scale: 'small',
  disabled: true,
  handler: function(){
  var record = myGrid4.getSelectionModel().getSelected();
  cmtFormWindow.show();
  commentForm.getForm().loadRecord(record);
  }
  });
   
   
  var anshiAction = new Ext.Action({
  text: '按时还款',
  iconCls: 'smt-userAdd',
  scale: 'small',
  disabled: true,
  handler: function(){
  var record = myGrid3.getSelectionModel().getSelected();
  if(record.get('repayState')!='') {
  Ext.Msg.alert('提示', '该记录已还款');
  return;
  }
   
  var _loanSignId = myGrid.getSelectionModel().getSelected().get('id');
  var _preRepayDate = record.get('preRepayDate');
  Ext.Ajax.request({
  url: '/loanSign/check',
  params: {
  _loanSignId: _loanSignId,
  _preRepayDate: _preRepayDate
  },
  success: function(aResponse, aOptions){
  Ext.Msg.confirm('还款确认', '确定跳过未还款记录?', function(aButton){
  if(aButton=='yes') {
  anshiForm.getForm().reset();
  anshiWindow.show();
  Ext.getCmp('periods').setValue(record.get('periods'));
  }
  });
  },
  failure: function(aResponse, aOptions){
  anshiForm.getForm().reset();
  anshiWindow.show();
  Ext.getCmp('periods').setValue(record.get('periods'));
  }
  });
  }
  });
   
   
  var dianfuAction = new Ext.Action({
  text: '逾期还款(垫付)',
  iconCls: 'smt-userDelete',
  scale: 'small',
  disabled: true,
  handler: function(){
  var record = myGrid3.getSelectionModel().getSelected();
  if(record.get('repayState')!='') {
  Ext.Msg.alert('提示', '该记录已还款');
  return;
  }
   
  var _loanSignId = myGrid.getSelectionModel().getSelected().get('id');
  var _preRepayDate = record.get('preRepayDate');
  Ext.Ajax.request({
  url: '/loanSign/check',
  params: {
  _loanSignId: _loanSignId,
  _preRepayDate: _preRepayDate
  },
  success: function(aResponse, aOptions){
  Ext.Msg.confirm('还款确认', '确定跳过未还款记录?', function(aButton){
  if(aButton=='yes') {
  dianfuForm.getForm().reset();
  dianfuWindow.show();
  Ext.getCmp('periods2').setValue(record.get('periods'));
  }
  });
  },
  failure: function(aResponse, aOptions){
  dianfuForm.getForm().reset();
  dianfuWindow.show();
  Ext.getCmp('periods2').setValue(record.get('periods'));
  }
  });
  }
  });
   
   
  var tiqianAction = new Ext.Action({
  text: '提前还款',
  id: 'tiqianAction',
  hidden: true,
  disabled: true,
  iconCls: 'smt-user_edit',
  scale: 'small',
  handler: function(){
  var record = myGrid3.getSelectionModel().getSelected();
  if(record.get('repayState')!='') {
  Ext.Msg.alert('提示', '该记录已还款');
  return;
  }
   
  tiqianForm.getForm().reset();
  tiqianWindow.show();
  Ext.getCmp('periods3').setValue(record.get('periods'));
  }
  });
   
   
   
  var stateData = new Ext.data.SimpleStore({
  fields:['key', 'value'],
  data:[
  [ '1', '回款中'],
  [ '2', '进行中'],
  [ '3', '未发布']
  ]
  });
   
  // 下拉列表框控件
  var stateBox = new Ext.form.ComboBox({
  fieldLabel : '状态',
  id : 'stateBox',
  width:100,
  store : stateData,
  editable:false,
  displayField : 'value',
  valueField : 'key',
  mode : 'local',
  triggerAction : 'all',
  emptyText : '请选择...'
  });
   
   
  var searchButton = {
  xtype:'button',
  iconCls: 'smt-userInquires',
  text: Constant.btn_edit_query,
  handler:function(){
  var _loanTitle=Ext.getCmp('_loanTitle').getRawValue();
  var _loanNumber=Ext.getCmp('_loanNumber').getRawValue();
  var _borrowerName=Ext.getCmp('_borrowerName').getRawValue();
  var _loanState=Ext.getCmp('stateBox').getRawValue();
  var _beginTime=Ext.util.Format.date(Ext.getCmp('_beginTime').getValue(), 'Y-m-d');
  var _endTime=Ext.util.Format.date(Ext.getCmp('_endTime').getValue(), 'Y-m-d');
   
  Ext.apply(masterStore.baseParams,{
  conditions:'{_loanTitle:"'+_loanTitle+'",_loanNumber:"'+_loanNumber+'",_borrowerName:"'+_borrowerName+'",_beginTime:"'+_beginTime+ '",_endTime:"'+_endTime+'",_loanState:"'+_loanState+'"}'
  });
  masterStore.load({
  params:{
  start:0,
  limit:10
  },
  waitTitle:'提示',waitMsg: '数据加载请稍后...',
  failure: function() {
  Ext.Msg.alert('提示', '读取数据失败!');
  }
  });
  Ext.getCmp('_loanTitle').setValue();
  Ext.getCmp('_loanNumber').setValue();
  Ext.getCmp('_borrowerName').setValue();
  Ext.getCmp('stateBox').setValue();
  Ext.getCmp('_beginTime').setValue();
  Ext.getCmp('_endTime').setValue();
  }
  };
   
  var oneTbar=new Ext.Toolbar({
  items:[
  '标题:',
  {
  xtype:'textfield',
  width:80,
  id:'_loanTitle'
  },
  '借款标号:',
  {
  xtype:'textfield',
  width:80,
  id:'_loanNumber'
  },
  '借款人名称:',
  {
  xtype:'textfield',
  width:80,
  id:'_borrowerName'
  },
  '状态:',
  stateBox,
  '发布时间:',
  {
  //fieldLabel: '发布时间',
  xtype: 'datefield',
  editable: false,
  format: 'Y-m-d',
  id: '_beginTime'
  },
  '至',
  {
  //fieldLabel: '发布时间',
  xtype: 'datefield',
  editable: false,
  format: 'Y-m-d',
  id: '_endTime'
  },
  searchButton
  ]
  });
   
   
   
   
  var myGridLoadAction = new Ext.Action({
  text: '刷新',
  iconCls:'btn_del',
  scale:'small',
  disabled: true,
  handler: function(){
  //masterStore.setBaseParam('masterId', aMasterId);
  masterStore.load({
  params:{
  start:0,
  limit:10
  },
  waitTitle:'提示',waitMsg: '数据加载请稍后...',
  failure: function() {
  Ext.Msg.alert('提示', '读取数据失败!');
  }
  });
  }
  });
   
   
  function myGridUpdateAction (){
  if(myGrid.getSelectionModel().hasSelection()){
  //var record = myGrid.getSelectionModel().getSelected();
  var records = myGrid.getSelectionModel().getSelections();
  var loanSignId = records[0].get('id');
  var thisIssueLoan = records[0].get('thisIssueLoan');
  var residue = records[0].get('residue');
  Ext.getCmp('txtThisIssueLoan').setText('本期借款额:'+thisIssueLoan);
  Ext.getCmp('txtResidue').setText('剩余份数:'+residue);
   
  editAction.enable();
  delAction.enable();
  fabuAction.enable();
  fangkuanAction.enable();
  lookUpAction.enable();
   
  if(records.length>0) {
  Ext.getCmp('btn_upload').enable();
  }
  if(records[0].get('loanState') == '未发布') {
  //delAction.enable();
  //fabuAction.enable();
  }
  if(records[0].get('isCredit') == '') {
  //fangkuanAction.enable();
  }
  if(records[0].get('refundWay')== '到期一次性还本息') {
  Ext.getCmp('tiqianAction').show();
  }
   
  accessoryStore.load({
  params:{
  start:0,
  limit:10,
  _loanSignId: loanSignId
  }
  });
  commentStore.load({
  params:{
  start:0,
  limit:10,
  _loanSignId: loanSignId
  }
  });
  repayRdStore.load({
  params:{
  start:0,
  limit:12,
  _loanSignId: loanSignId
  }
  });
  loanRdStore.load({
  params:{
  start:0,
  limit:10,
  _loanSignId: loanSignId
  }
  });
  }else{
  Ext.getCmp('btn_upload').disable();
  delAction.disable();
  editAction.disable();
  fabuAction.disable();
  fangkuanAction.disable();
  Ext.getCmp('tiqianAction').hide();
  lookUpAction.disable();
  }
  };
   
   
   
   
  //借款标列表
  var myGrid = new Ext.grid.GridPanel({
  id: 'myGrid',
  region:'north',
  height: 200,
  store: masterStore,
  sm: new Ext.grid.RowSelectionModel(),
  frame: true,
  trackMouseOver: false,
  disableSelection: false,
  loadMask: true,
  columns: [
  {
  header: '序号',
  sortable: true,
  dataIndex: 'id'
  //hidden: true
  },
  {
  header: '借款标创建时间',
  sortable: true,
  dataIndex: 'loanSignTime',
  hidden: true
  },
  {
  header: '管理费比例',
  sortable: true,
  dataIndex: 'Mfeeratio',
  hidden: true
  },
  {
  header: '管理费上限',
  sortable: true,
  dataIndex: 'Mfeetop',
  hidden: true
  },
  {
  header: '特权用户管理费比例',
  sortable: true,
  dataIndex: 'Pmfeeratio',
  hidden: true
  },
  {
  header: '特权用户管理费上限',
  sortable: true,
  dataIndex: 'Pmfeetop',
  hidden: true
  },
  {
  header: '借款标号',
  sortable: true,
  dataIndex: 'loanNumber'
  },
  {
  header: '标题',
  sortable: true,
  dataIndex: 'loanTitle'
  },
  {
  header: '借款人名称',
  sortable: true,
  dataIndex: 'borrower_name'
  },
  {
  hidden: true,
  header: '借款人名称',
  sortable: true,
  dataIndex: 'borrower_credit'
  },
  {
  header: '最小出借单位',
  sortable: true,
  dataIndex: 'loanUnit'
  },
  {
  header: '本期借款额',
  sortable: true,
  dataIndex: 'thisIssueLoan'
  },
  {
  header: '年化利率',
  sortable: true,
  dataIndex: 'rateYear'
  },
  {
  header: '自贷网奖励',
  sortable: true,
  dataIndex: 'reward'
  },
  {
  header: '成功借入份数',
  sortable: true,
  dataIndex: 'loanCount'
  },
  {
  header: '剩余份数',
  sortable: true,
  dataIndex: 'residue'
  },
  {
  header: '还款方式',
  width: 120,
  sortable: true,
  dataIndex: 'refundWay'
  },
  {
  header: '状态',
  sortable: true,
  dataIndex: 'loanState'
  },
  {
  header: '是否放款',
  sortable: true,
  dataIndex: 'isCredit'
  },
  {
  header: '放款时间',
  width: 130,
  sortable: true,
  dataIndex: 'creditTime'
  },
  {
  header: '是否显示',
  sortable: true,
  dataIndex: 'isShow'
  },
  {
  header: '推荐到首页',
  sortable: true,
  dataIndex: 'isRecommand'
  },
  {
  header: '借款方商业概述',
  sortable: true,
  dataIndex: 'overview',
  hidden: true
   
  },
  {
  header: '借款方借款用途',
  sortable: true,
  dataIndex: 'behoof',
  hidden: true
  },
  {
  header: '借款方还款来源',
  sortable: true,
  dataIndex: 'loanOrigin',
  hidden: true
  },
  {
  header: '风险控制措施',
  sortable: true,
  dataIndex: 'riskCtrlWay',
  hidden: true
  },
  {
  header: '借款人感言',
  sortable: true,
  dataIndex: 'speech',
  hidden: true
  },
  {
  header: '还款期限',
  sortable: true,
  dataIndex: 'refundDeadline',
  hidden: true
  }
  ],
  tbar: [
  addAction,'-',
  editAction,'-',
  delAction,'-',
  fabuAction,'-',
  fangkuanAction,'-',
  daoqiAction,'-',
  daochuAction,'-',
  lookUpAction,'-',
  showLoanPersonList,
  '->',{
  id: 's1',
  text : '未发布:0'
  },'-',{
  id: 's2',
  text : '进行中:0'
  },'-',{
  id: 's4',
  text : '回款中:2'
  },'-'
  ],
  listeners : {
  'render' : function(){
  oneTbar.render(this.tbar);
  }
  },
  bbar: new Ext.PagingToolbar({
  pageSize: 10,
  store: masterStore,
  displayInfo: true,
  displayMsg: '显示: {0} - {1} / 总数: {2}',
  emptyMsg: '没有记录'
  })
  });
   
   
  //即将到期还款列表
  var sDay = new Ext.grid.GridPanel({
  id: 'sDay',
  region:'north',
  height: 200,
  store: masterStore2,
  sm: new Ext.grid.RowSelectionModel(),
  frame: true,
  trackMouseOver: false,
  disableSelection: false,
  loadMask: true,
  columns: [
  {
  header: '序号',
  sortable: true,
  dataIndex: 'id'
  //hidden: true
  },
  {
  header: '借款标号',
  sortable: true,
  dataIndex: 'loanNumber'
  },
  {
  header: '标题',
  sortable: true,
  dataIndex: 'loanTitle'
  },
  {
  header: '借款人名称',
  sortable: true,
  dataIndex: 'borrower_name'
  },
  {
  hidden: true,
  header: '借款人名称',
  sortable: true,
  dataIndex: 'borrower_credit'
  },
  {
  header: '最小出借单位',
  sortable: true,
  dataIndex: 'loanUnit'
  },
  {
  header: '本期借款额',
  sortable: true,
  dataIndex: 'thisIssueLoan'
  },
  {
  header: '年化利率',
  sortable: true,
  dataIndex: 'rateYear'
  },
  {
  header: '自贷网奖励',
  sortable: true,
  dataIndex: 'reward'
  },
  {
  header: '成功借入份数',
  sortable: true,
  dataIndex: 'loanCount'
  },
  {
  header: '剩余份数',
  sortable: true,
  dataIndex: 'residue'
  },
  {
  header: '还款方式',
  sortable: true,
  dataIndex: 'refundWay'
  },
  {
  header: '状态',
  sortable: true,
  dataIndex: 'loanState'
  },
  {
  header: '是否放款',
  sortable: true,
  dataIndex: 'isCredit'
  },
  {
  header: '放款时间',
  sortable: true,
  dataIndex: 'creditTime'
  },
  {
  header: '是否显示',
  sortable: true,
  dataIndex: 'isShow2'
  },
  {
  header: '推荐到首页',
  sortable: true,
  dataIndex: 'isRecommand2'
   
  },
  {
  header: '借款方借款用途',
  sortable: true,
  dataIndex: 'behoof',
  hidden: true
  },
  {
  header: '借款方还款来源',
  sortable: true,
  dataIndex: 'loanOrigin',
  hidden: true
  },
  {
  header: '风险控制措施',
  sortable: true,
  dataIndex: 'riskCtrlWay',
  hidden: true
  },
  {
  header: '借款人感言',
  sortable: true,
  dataIndex: 'speech',
  hidden: true
  },
  {
  header: '还款期限',
  sortable: true,
  dataIndex: 'refundDeadline',
  hidden: true
  }
  ],
  bbar: new Ext.PagingToolbar({
  pageSize: 10,
  store: masterStore2,
  displayInfo: true,
  displayMsg: '显示: {0} - {1} / 总数: {2}',
  emptyMsg: '没有记录'
  })
  });
   
   
  myGrid.getSelectionModel().addListener(
  'selectionchange',
  myGridUpdateAction
  );
   
   
  // 借款标保存
  var form1SaveAction = new Ext.Action({
  text: '保存',
  iconCls: 'saves',
  handler: function(){
  if(form1.getForm().isValid()){
  Ext.getCmp('borrowerName2').enable();
  Ext.getCmp('loanNumber').enable();
  Ext.getCmp('loanTitle').enable();
  Ext.getCmp('rateYear').enable();
  Ext.getCmp('assure').enable();
  Ext.getCmp('bidReward').enable();
  Ext.getCmp('unassureWay').enable();
  Ext.getCmp('overview').enable();
  Ext.getCmp('behoof').enable();
  Ext.getCmp('loanOrigin').enable();
  Ext.getCmp('riskCtrlWay').enable();
  Ext.getCmp('speech').enable();
  Ext.getCmp('thisIssueLoan').enable();
  Ext.getCmp('reward').enable();
  Ext.getCmp('loanUnitBox').enable();
  Ext.getCmp('riskAssessBox').enable();
  Ext.getCmp('rdBox').enable();
  Ext.getCmp('refundWayBox').enable();
   
  var tmp1 = Ext.getCmp('thisIssueLoan').getValue() / Ext.getCmp('loanUnitBox').getRawValue();
  var reCat = /^-?\d+$/;
   
  if(!reCat.test(tmp1)) {
  Ext.Msg.alert('提示', '请输入能计算出整份数的数据');
  return;
  }
   
  var flag;
  var memberId;
  var record = Ext.getCmp('loanPersonGrid').getSelectionModel().getSelected();
  var myRecord = Ext.getCmp('myGrid').getSelectionModel().getSelected();
   
  var loanUnit = Ext.getCmp('loanUnitBox').getRawValue();
  var riskAssess = Ext.getCmp('riskAssessBox').getRawValue();
  var rd = Ext.getCmp('rdBox').getValue();
  var refundWay = Ext.getCmp('refundWayBox').getRawValue();
   
  if(Ext.getCmp('loanPersonGrid').getSelectionModel().hasSelection()) {//新增
  memberId = record.get('id');
  if((Ext.getCmp('thisIssueLoan').getValue() - record.get('credit')) >0)
  flag = true;
  else
  flag = false;
  }else{//编辑
  memberId = myRecord.get('borrower_id');
  if((Ext.getCmp('thisIssueLoan').getValue() - myRecord.get('borrower_credit')) >0)
  flag = true;
  else
  flag = false;
  }
   
  //本期借款额大于该借款人的授信额度,则提示
  if(flag) {
  Ext.Msg.alert('保存失败', '本期借款额不能大于该借款人的授信额度');
  return;
  }
  //否则不提示
  else {
  form1.getForm().submit({
  url: '/loanSign/saveOrUpdate',
  params: {
  _loanUnit: loanUnit,
  _riskAssess: riskAssess,
  _rd: rd,
  _refundWay: refundWay,
  _memberId: memberId
  },
  waitTitle: '请等待',
  waitMsg: '正在处理数据...',
  timeout: 10,
  success: function(aForm, aAction){
  Ext.getCmp('s1').setText('未发布:'+aAction.result.s1);
  form1Window.hide();
  masterStore.reload({callback: myGridUpdateAction});
  Ext.MessageBox.alert('提示', aAction.result.msg);
  },
  failure: function(aForm, aAction) {
  var result = Ext.decode(aAction.response.responseText);
  Ext.MessageBox.alert('提示', result.msg);
  }
  });
  }
  }
  }
  });
   
   
   
  // 最小出借单位下拉框
  var loanUnitData = new Ext.data.SimpleStore({
  fields:['key', 'value'],
  data:[
  [ '1', '100'],
  [ '2', '200'],
  [ '3', '300'],
  [ '4', '500'],
  [ '5', '1000']
  ]
  });
   
  var loanUnitBox = new Ext.form.ComboBox({
  fieldLabel : '最小出借单位',
  id : 'loanUnitBox',
  width: 100,
  store : loanUnitData,
  editable: false,
  allowBlank: false,
  displayField : 'value',
  valueField : 'key',
  mode : 'local',
  triggerAction : 'all',
  emptyText : '请选择...'
  });
   
   
  // 风险评估下拉框
  var riskAssessData = new Ext.data.SimpleStore({
  fields:['key', 'value'],
  data:[
  [ '1', '低'],
  [ '2', '中'],
  [ '3', '高']
  ]
  });
   
  var riskAssessBox = new Ext.form.ComboBox({
  fieldLabel : '风险评估',
  id : 'riskAssessBox',
  width: 100,
  store : riskAssessData,
  editable: false,
  allowBlank: false,
  displayField : 'value',
  valueField : 'key',
  mode : 'local',
  triggerAction : 'all',
  emptyText : '请选择...'
  });
   
   
  // 还款期限下拉框
  var rdData = new Ext.data.SimpleStore({
  fields:['key', 'value'],
  data:[
  [ '1', '1个月'],
  [ '2', '2个月'],
  [ '3', '3个月'],
  [ '4', '4个月'],
  [ '5', '5个月'],
  [ '6', '6个月'],
  [ '7', '7个月'],
  [ '8', '8个月'],
  [ '9', '9个月'],
  [ '10', '10个月'],
  [ '11', '11个月'],
  [ '12', '12个月']
  ]
  });
   
  var rdBox = new Ext.form.ComboBox({
  fieldLabel : '还款期限',
  id : 'rdBox',
  width: 100,
  store : rdData,
  editable: false,
  allowBlank: false,
  displayField : 'value',
  valueField : 'key',
  mode : 'local',
  triggerAction : 'all',
  emptyText : '请选择...'
  });
   
   
  var refundWayData = new Ext.data.SimpleStore({
  fields:['key', 'value'],
  data:[
  [ '1', '每月还本息'],
  [ '2', '每月付息到期还本'],
  [ '3', '到期一次性还本息']
  ]
  });
   
   
  // 还款方式下拉框
  var refundWayBox = new Ext.form.ComboBox({
  fieldLabel : '还款方式',
  id : 'refundWayBox',
  width: 100,
  store : refundWayData,
  editable: false,
  allowBlank: false,
  displayField : 'value',
  valueField : 'key',
  mode : 'local',
  triggerAction : 'all',
  emptyText : '请选择...'
  });
   
   
  // 附件类型下拉框
  var attaTypeData = new Ext.data.SimpleStore({
  fields:['key', 'value'],
  data:[
  [ '1', '标图'],
  [ '2', '借款方相关资料'],
  [ '3', '借款标合同']
  ]
  });
   
   
  var attaTypeBox = new Ext.form.ComboBox({
  fieldLabel : '附件类型',
  id : 'attaTypeBox',
  width: 100,
  store : attaTypeData,
  editable: false,
  allowBlank: false,
  displayField : 'value',
  valueField : 'key',
  mode : 'local',
  triggerAction : 'all',
  emptyText : '请选择...'
  });
   
   
  // 查看借款标
  var lookUpForm = new Ext.form.FormPanel({
  id: 'lookUpForm',
  bodyStyle: 'padding:5px',
  autoScroll: true,
  frame: true,
  labelAlign: 'right',
  items: [{
  layout: 'column',
  items: [
  {
  columnWidth: .5,
  layout: 'form',
  labelWidth: 100,
  defaultType: 'textfield',
  defaults: {
  width: 180,
  msgTarget: 'side'
  },
  items: [
  {
  fieldLabel: '借款人',
  readOnly: true,
  id: 'borrowerName33'
  },
  {
  fieldLabel: '本期借款额',
  readOnly: true,
  id: 'thisIssueLoan33'
  },
  {
  inputType: 'hidden',
  fieldLabel: '*编号',
  id: 'id33'
  },
  {
  fieldLabel: '借款标号',
  readOnly: true,
  id: 'loanNumber33'
  },
  {
  fieldLabel: '借款标题',
  readOnly: true,
  id: 'loanTitle33'
  },
  {
  fieldLabel: '年化利率',
  readOnly: true,
  id: 'rateYear33',
  listeners: {
  render: function(obj) {
  var font=document.createElement("font");
  var redStar=document.createTextNode('%');
  font.appendChild(redStar);
  obj.el.dom.parentNode.appendChild(font);
  }
  }
  },
  {
  fieldLabel: '发标人投标奖励',
  readOnly: true,
  id: 'bidReward33',
  listeners: {
  render: function(obj) {
  var font=document.createElement("font");
  var redStar=document.createTextNode('%');
  font.appendChild(redStar);
  obj.el.dom.parentNode.appendChild(font);
  }
  }
  },
  {
  fieldLabel: '自贷网奖励',
  readOnly: true,
  id: 'reward33',
  listeners: {
  render: function(obj) {
  var font=document.createElement("font");
  var redStar=document.createTextNode('%');
  font.appendChild(redStar);
  obj.el.dom.parentNode.appendChild(font);
  }
  }
  },
  {
  fieldLabel: '担保方',
  readOnly: true,
  id: 'assure33'
  },
  {
  fieldLabel: '反担保方式',
  readOnly: true,
  id: 'unassureWay33'
  }
  ]
  },
  {
  columnWidth: .5,
  layout: 'form',
  labelWidth: 100,
  defaultType: 'textfield',
  defaults: {
  width: 180,
  msgTarget: 'side'
  },
  items: [
  {
  fieldLabel : '还款方式',
  xtype: 'combo',
  id : 'refundWayBox33',
  width: 150,
  store : refundWayData,
  readOnly: true,
  displayField : 'value',
  valueField : 'key',
  mode : 'local',
  triggerAction : 'all',
  emptyText : '请选择...'
  },
  {
  fieldLabel : '最小出借单位',
  xtype: 'combo',
  id : 'loanUnitBox33',
  width: 150,
  store : loanUnitData,
  readOnly: true,
  displayField : 'value',
  valueField : 'key',
  mode : 'local',
  triggerAction : 'all',
  emptyText : '请选择...'
  },
  {
  fieldLabel : '还款期限',
  id : 'rdBox33',
  width: 150,
  xtype: 'combo',
  store : rdData,
  readOnly: true,
  displayField : 'value',
  valueField : 'key',
  mode : 'local',
  triggerAction : 'all',
  emptyText : '请选择...'
  },
  {
  fieldLabel : '风险评估',
  id : 'riskAssessBox33',
  xtype: 'combo',
  width: 150,
  store : riskAssessData,
  readOnly: true,
  displayField : 'value',
  valueField : 'key',
  mode : 'local',
  triggerAction : 'all',
  emptyText : '请选择...'
  },
  {
  fieldLabel: '是否显示',
  xtype: 'radiogroup',
  //disabled : true,
  id: 'isShow33',
  items : [
  {
  boxLabel: '显示',
  name: 'isShow',
  inputValue:'显示',
  checked : true
  },
  {
  boxLabel: '不显示',
  name: 'isShow',
  inputValue:'不显示'
  }
  ]
  },
  {
  fieldLabel: '推荐到首页',
  xtype: 'radiogroup',
  //disabled : true,
  id: 'isRecommand33',
  items : [
  {
  boxLabel: '推荐',
  name: 'isRecommand',
  inputValue:'推荐',
  checked : true
  },
  {
  boxLabel: '不推荐',
  name: 'isRecommand',
  inputValue:'不推荐'
  }
  ]
  },
  {
  fieldLabel: '普通管理费比例',
  readOnly: true,
  id: 'Mfeeratio33'
  },
  {
  fieldLabel: '普通管理费上限',
  readOnly: true,
  id: 'Mfeetop33'
  },
  {
  fieldLabel: '特权管理费比例',
  readOnly: true,
  id: 'Pmfeeratio33'
  },
  {
  fieldLabel: '特权管理费上限',
  readOnly: true,
  id: 'Pmfeetop33'
  }
  ]
  }
  ]
  },
  {
  fieldLabel: '借款方商业概述',
  xtype:'textarea',
  width: 500,
  height: 150,
  readOnly: true,
  id: 'overview33'
  },
  {
  fieldLabel: '借款方借款用途',
  xtype:'textarea',
  width: 500,
  height: 150,
  readOnly: true,
  id: 'behoof33'
  },
  {
  fieldLabel: '借款方还款来源',
  xtype:'textarea',
  width: 500,
  height: 150,
  readOnly: true,
  id: 'loanOrigin33'
  },
  {
  fieldLabel: '风险控制措施',
  xtype:'textarea',
  width: 500,
  height: 150,
  readOnly: true,
  id: 'riskCtrlWay33'
  },
  {
  fieldLabel: '借款人感言',
  xtype:'textarea',
  width: 500,
  height: 150,
  readOnly: true,
  id: 'speech33'
  }
  ]
  });
   
   
  // 新增借款标
  var form1 = new Ext.form.FormPanel({
  id: 'form1',
  bodyStyle: 'padding:5px',
  autoScroll: true,
  frame: true,
  labelAlign: 'right',
  items: [{
  layout: 'column',
  items: [
  {
  columnWidth: .5,
  layout: 'form',
  labelWidth: 100,
  defaultType: 'textfield',
  defaults: {
  width: 180,
  msgTarget: 'side'
  },
  items: [
  {
  fieldLabel: '借款人',
  allowBlank: false,
  id: 'borrowerName2',
  listeners: {
  focus: function(obj) {
  Ext.apply(loanPersonStore.baseParams,{
  conditions:''
  });
  loanPersonStore.load({
  params: {
  start: 0,
  limit: 20
  },
  waitTitle:'提示',waitMsg: '数据加载请稍后...',
  failure: function() {
  Ext.Msg.alert('提示', '读取数据失败!');
  }
  });
  loanPersonWindow.show();
  }
  }
  },
  {
  fieldLabel: '本期借款额',
  regex:/^(0|[1-9][0-9]*)$/,
  allowBlank: false,
  id: 'thisIssueLoan'
  },
  {
  inputType: 'hidden',
  fieldLabel: '*编号',
  id: 'id'
  },
  {
  inputType: 'hidden',
  id: 'haha'
  },
  {
  fieldLabel: '借款标号',
  maxLength: 20,
  msgTarget: "under",
  maxLengthText: '长度超出20字符',
  allowBlank: false,
  id: 'loanNumber'
  },
  {
  fieldLabel: '借款标题',
  maxLength: 20,
  msgTarget: "under",
  maxLengthText: '长度超出20字符',
  allowBlank: false,
  id: 'loanTitle'
  },
  {
  fieldLabel: '年化利率',
  regex:/^(0|0\.[0-9]{0,2}|[1-9][0-9]*?|[1-9][0-9]*\.[0-9]{0,2})$/,
  //regex:/^(0|0\.[0-9]*?[1-9]+?[0-9]*|[1-9][0-9]*?|[1-9][0-9]*\.[0-9]*)$/,
  allowBlank: false,
  id: 'rateYear',
  listeners: {
  render: function(obj) {
  var font=document.createElement("font");
  var redStar=document.createTextNode('%');
  font.appendChild(redStar);
  obj.el.dom.parentNode.appendChild(font);
  }
  }
  },
  {
  fieldLabel: '发标人投标奖励',
  allowBlank: false,
  regex:/^(0|0\.[0-9]*?[1-9][0-9]*?|[1-4]\.[0-9]*|[1-5]|5\.0*)$/,
  id: 'bidReward',
  listeners: {
  render: function(obj) {
  var font=document.createElement("font");
  var redStar=document.createTextNode('%');
  font.appendChild(redStar);
  obj.el.dom.parentNode.appendChild(font);
  }
  }
  },
  {
  fieldLabel: '自贷网奖励',
  allowBlank: false,
  regex:/^(0|0\.[0-9]*?[1-9][0-9]*?|[1-4]\.[0-9]*|[1-5]|5\.0*)$/,
  id: 'reward',
  listeners: {
  render: function(obj) {
  var font=document.createElement("font");
  var redStar=document.createTextNode('%');
  font.appendChild(redStar);
  obj.el.dom.parentNode.appendChild(font);
  }
  }
  },
  {
  fieldLabel: '担保方',
  maxLength: 20,
  msgTarget: "under",
  maxLengthText: '长度超出20字符',
  id: 'assure'
  },
  {
  fieldLabel: '反担保方式',
  maxLength: 20,
  msgTarget: "under",
  maxLengthText: '长度超出20字符',
  id: 'unassureWay'
  }
  ]
  },
  {
  columnWidth: .5,
  layout: 'form',
  labelWidth: 100,
  defaultType: 'textfield',
  defaults: {
  width: 180,
  msgTarget: 'side'
  },
  items: [
  refundWayBox,
  loanUnitBox,
  rdBox,
  riskAssessBox,
  {
  fieldLabel: '是否显示',
  xtype: 'radiogroup',
  id: 'isShow',
  items : [
  {
  boxLabel: '显示',
  name: 'isShow',
  inputValue:'显示',
  checked : true
  },
  {
  boxLabel: '不显示',
  name: 'isShow',
  inputValue:'不显示'
  }
  ]
  },
  {
  fieldLabel: '推荐到首页',
  xtype: 'radiogroup',
  id: 'isRecommand',
  items : [
  {
  boxLabel: '推荐',
  name: 'isRecommand',
  inputValue:'推荐',
  checked : true
  },
  {
  boxLabel: '不推荐',
  name: 'isRecommand',
  inputValue:'不推荐'
  }
  ]
  },
  {
  fieldLabel: '普通管理费比例',
  readOnly: true,
  value: 0,
  id: 'Mfeeratio'
  },
  {
  fieldLabel: '普通管理费上限',
  readOnly: true,
  value: 0,
  id: 'Mfeetop'
  },
  {
  fieldLabel: '特权管理费比例',
  readOnly: true,
  value: 0,
  id: 'Pmfeeratio'
  },
  {
  fieldLabel: '特权管理费上限',
  readOnly: true,
  value: 0,
  id: 'Pmfeetop'
  }
  ]
  }
  ]
  },
  {
  fieldLabel: '借款方商业概述',
  xtype:'textarea',
  allowBlank: false,
  regex:/[\S][\s]*/,
  maxLength: 200,
  msgTarget: "under",
  maxLengthText: '长度超出200字符',
  width: 500,
  height: 150,
  id: 'overview'
  },
  {
  fieldLabel: '借款方借款用途',
  xtype:'textarea',
  allowBlank: false,
  regex:/[\S][\s]*/,
  maxLength: 200,
  msgTarget: "under",
  maxLengthText: '长度超出200字符',
  width: 500,
  height: 150,
  id: 'behoof'
  },
  {
  fieldLabel: '借款方还款来源',
  xtype:'textarea',
  allowBlank: false,
  regex:/[\S][\s]*/,
  maxLength: 200,
  msgTarget: "under",
  maxLengthText: '长度超出200字符',
  width: 500,
  height: 150,
  id: 'loanOrigin'
  },
  {
  fieldLabel: '风险控制措施',
  xtype:'textarea',
  allowBlank: false,
  regex:/[\S][\s]*/,
  maxLength: 200,
  msgTarget: "under",
  maxLengthText: '长度超出200字符',
  width: 500,
  height: 150,
  id: 'riskCtrlWay'
  },
  {
  fieldLabel: '借款人感言',
  xtype:'textarea',
  allowBlank: false,
  regex:/[\S][\s]*/,
  maxLength: 200,
  msgTarget: "under",
  maxLengthText: '长度超出200字符',
  width: 500,
  height: 150,
  id: 'speech'
  }
  ]
  });
   
   
  var filePanel=new Ext.FormPanel({
  id: 'filePanel',
  frame: true,
  fileUpload: true,
  items: [
  {
  xtype:'fileuploadfield',
  anchor:'95%',
  name:'uploadFilePath',
  id:'uploadFilePath',
  fieldLabel: '选择附件',
  allowBlank: false,
  buttonCfg: {
  text: '选择文件'
  }
  },
  attaTypeBox
  ]
  });
   
   
  //上传附件窗口
  var uploadWindow = new Ext.Window({
  width: 400,
  height: 150,
  title: '上传附件',
  closeAction:'hide',
  bodyStyle: 'padding:5px;',
  buttonAlign: 'center',
  items: [
  filePanel
  ],
  buttons: [
  {
  text: '确定',
  iconCls:'saves',
  handler: function(){
  if(filePanel.getForm().isValid()){
  var record = myGrid.getSelectionModel().getSelected();
  var _loanId = record.get('id');
  var _attaType = attaTypeBox.getRawValue();
   
  filePanel.getForm().submit({
  url: '/loanSign/upload',
  params: {
  _loanId: _loanId,
  _attaType: _attaType
  },
  waitTitle: '请等待',
  waitMsg: '正在处理数据...',
  timeout: 10,
  success: function(aForm, aAction){
  uploadWindow.hide();
  masterStore.reload();
  Ext.MessageBox.alert('提示', aAction.result.msg);
  },
  failure: function(aForm, aAction) {
  Ext.MessageBox.alert('提示', aAction.result.msg);
  }
  });
  }
  }
  },{
  text: '取消',
  iconCls: 'stm-returns',
  handler:function(){
  uploadWindow.hide();
  }
  }
  ]
  });
   
   
  var fileGridDeleteAction = new Ext.Action({
  id:'btn_del',
  text: '删除附件',
  iconCls: 'stm-delete',
  scale: 'small',
  disabled:true,
  handler: function(){
  var fileGrid = Ext.getCmp('fileGrid');
  if (fileGrid.getSelectionModel().hasSelection()) {
  Ext.Msg.confirm('提示', '确定删除?', function(aButton){
  if (aButton == 'yes'){
  var id = ''
  var records = Ext.getCmp('fileGrid').getSelectionModel().getSelections();
  for(var i = 0, len = records.length; i < len; i ++) {
  id = id + records[i].id + ',';
  }
   
  Ext.Ajax.request({
  url: '/loanSign/delAllAttachment',
  params: {
  _ids: id
  },
  success: function(aResponse, aOptions){
  //myGridLoadAction.execute();
  masterStore.reload({callback: myGridUpdateAction});
  var result = Ext.decode(aResponse.responseText);
  //Ext.MessageBox.alert(bundle.getMsg('tip'), result.msg);
  },
  failure: function(aResponse, aOptions){
  myGridLoadAction.execute();
  var result = Ext.decode(aResponse.responseText);
  //Ext.MessageBox.alert(bundle.getMsg('tip'), result.msg);
  }
  })
  }
  });
  }
  }
  });
   
   
  //附件面板
  var fileGrid = new Ext.grid.GridPanel({
  id: 'fileGrid',
  height:200,
  title: '附件信息',
  store: accessoryStore,
  sm: new Ext.grid.RowSelectionModel(),
  frame:true,
  trackMouseOver: false,
  disableSelection: false,
  loadMask: true,
  columns: [
  {
  header: '编号',
  sortable: true,
  hidden:true,
  dataIndex: 'id'
  },
  {
  header: '附件名称',
  sortable: true,
  dataIndex: 'attachmentName'
  },
  {
  header: '附件类型',
  sortable: true,
  dataIndex: 'attachmentType'
  },
  {
  header: '附件大小',
  sortable: true,
  dataIndex: 'attachmentSize'
  },
  {
  header: '上传时间',
  width: 130,
  sortable: true,
  dataIndex: 'uploadTime'
  },
  {
  header: '上传人',
  sortable: true,
  dataIndex: 'uploader_name'
  }
  ],
  tbar:[
  {
  text: '上传附件',
  id: 'btn_upload',
  disabled: true,
  iconCls: 'smt-up',
  handler:function(){
  filePanel.getForm().reset();
  var records = myGrid.getSelectionModel().getSelections();
  if(records.length>1) {
  Ext.Msg.alert("提示", "一次只能为一只标上传附件");
  return;
  }
  uploadWindow.show();
  }
  },'-',
  {
  text: '下载附件',
  id:'btn_down',
  iconCls: 'smt-next',
  disabled: true,
  handler:function(){
  var fileGrid = Ext.getCmp('fileGrid');
  if (fileGrid.getSelectionModel().hasSelection()) {
  var id = fileGrid.getSelectionModel().getSelected().get('id');
  var url = '/loanSign/downloan?id='+id;
  var ecurl = encodeURI(encodeURI(url));
  location.href = ecurl;
  }
  }
  },'-',
  fileGridDeleteAction
  ],
  bbar: new Ext.PagingToolbar({
  pageSize: 10,
  store: accessoryStore,
  displayMsg: '显示: {0} - {1} / 总数: {2}',
  emptyMsg: '没有记录'
  })
  });
   
   
   
  //出借记录grid
  var myGrid2 = new Ext.grid.GridPanel({
  id: 'myGrid2',
  height:200,
  title: '出借记录',
  store: loanRdStore,
  sm: new Ext.grid.RowSelectionModel(),
  frame:true,
  trackMouseOver: false,
  disableSelection: false,
  loadMask: true,
  columns: [
  {
  header: 'id',
  hidden:true,
  sortable: true,
  dataIndex: 'id'
  },
  {
  header: '出借人',
  sortable: true,
  dataIndex: 'lender_name'
  },
  {
  header: '年化利率',
  sortable: true,
  dataIndex: 'loanSign_refundDeadline'
  },
  {
  header: '投标金额',
  sortable: true,
  dataIndex: 'tenderMoney'
  },
  {
  header: '支付状态',
  sortable: true,
  dataIndex: 'isSucceed'
  },
  {
  header: '投标时间',
  sortable: true,
  dataIndex: 'tenderTime'
  }
  ],
  tbar:[
  daochu2Action,
  '->',{
  id: 'txtThisIssueLoan'
  },'-',{
  id: 'txtResidue'
  },'-'
  ],
  bbar: new Ext.PagingToolbar({
  pageSize: 20,
  store: loanRdStore,
  displayMsg: '显示: {0} - {1} / 总数: {2}',
  emptyMsg: '没有记录'
  })
  });
   
   
  Ext.getCmp('fileGrid').getSelectionModel().addListener(
  'selectionchange',
  fileGridUpdateAction
  );
  function fileGridUpdateAction (){
  if(Ext.getCmp('fileGrid').getSelectionModel().hasSelection()){
  Ext.getCmp('btn_down').enable();
  fileGridDeleteAction.enable();
  }else{
  Ext.getCmp('btn_down').disable();
  fileGridDeleteAction.disable();
  }
  };
   
   
  //评论管理---begin---
  var myGrid4 = new Ext.grid.GridPanel({
  id: 'myGrid4',
  height:200,
  title: '评论信息',
  store: commentStore,
  sm: new Ext.grid.RowSelectionModel(),
  frame:true,
  trackMouseOver: false,
  disableSelection: false,
  loadMask: true,
  columns: [
  {
  header: 'id',
  hidden:true,
  sortable: true,
  dataIndex: 'id'
  },
  {
  header: '评论',
  width: 170,
  sortable: true,
  dataIndex: 'cmtContent'
  },
  {
  header: '评论人',
  sortable: true,
  dataIndex: 'commentator_name'
  },
  {
  header: '回复',
  sortable: true,
  dataIndex: 'cmtReply'
  },
  {
  header: '是否显示',
  sortable: true,
  dataIndex: 'cmtIsShow'
  }
  ],
  tbar:[
  editForCmtAction
  ],
  bbar: new Ext.PagingToolbar({
  pageSize: 20,
  store: commentStore,
  displayMsg: '显示: {0} - {1} / 总数: {2}',
  emptyMsg: '没有记录'
  })
  });
   
   
  var searchLoanPersonButton = {
  xtype:'button',
  iconCls: 'smt-userInquires',
  text: Constant.btn_edit_query,
  handler:function(){
  var _userName=Ext.getCmp('_userName').getRawValue();
  var _cardId=Ext.getCmp('_cardId').getRawValue();
   
  Ext.apply(loanPersonStore.baseParams,{
  conditions:'{_cardId:"'+_cardId+'",_userName:"'+_userName+'"}'
  });
  loanPersonStore.load({
  params:{
  start:0,
  limit:10
  },
  waitTitle:'提示',waitMsg: '数据加载请稍后...',
  failure: function() {
  Ext.Msg.alert('提示', '读取数据失败!');
  }
  });
  Ext.getCmp('_userName').setValue();
  Ext.getCmp('_cardId').setValue();
  }
  }
   
   
  //借款人搜索工具栏
  var searchLoanPersonTbar=new Ext.Toolbar({
  items:[
  '用户名:',
  {
  xtype:'textfield',
  width:80,
  id:'_userName'
  },
  '身份证号码:',
  {
  xtype:'textfield',
  width:80,
  id:'_cardId'
  },
  searchLoanPersonButton
  ]
  });
   
   
   
  //借款人列表
  var loanPersonGrid = new Ext.grid.GridPanel({
  id: 'loanPersonGrid',
  height: 200,
  store: loanPersonStore,
  sm: new Ext.grid.RowSelectionModel(),
  frame:true,
  trackMouseOver: false,
  disableSelection: false,
  loadMask: true,
  columns: [
  {
  header: 'id',
  hidden:true,
  sortable: true,
  dataIndex: 'id'
  },
  {
  header: '借款人',
  sortable: true,
  dataIndex: 'user_name'
  },
  {
  header: '用户名',
  sortable: true,
  dataIndex: 'userName'
  },
  {
  header: '身份证号码',
  width: 170,
  sortable: true,
  dataIndex: 'cardId'
  },
  {
  header: '授信额度',
  hidden:true,
  sortable: true,
  dataIndex: 'credit'
  }
  ],
  tbar:[
  searchLoanPersonTbar,
  loanPersonSureAction
  ],
  bbar: new Ext.PagingToolbar({
  pageSize: 20,
  store: loanPersonStore,
  displayMsg: '显示: {0} - {1} / 总数: {2}',
  emptyMsg: '没有记录'
  }),
  listeners:{
  rowdblclick:function(thegrid, rowIndex, e) {
  //如果已选择信息
  if (loanPersonGrid.getSelectionModel().hasSelection()){
  var record = loanPersonGrid.getSelectionModel().getSelected();
  if(record.length > 1) {
  Ext.Msg.alert('只能选择一个借款人');
  }
  Ext.getCmp('borrowerName2').setValue(record.get('user_name'));
  Ext.getCmp('haha').setValue(record.get('id'));
   
  loanPersonWindow.hide();
  }
   
  }
  }
  });
   
   
  myGrid4.getSelectionModel().addListener(
  'selectionchange',
  function myGrid4UpdateAction (){
  if(myGrid4.getSelectionModel().hasSelection()){
  editForCmtAction.enable();
  }else{
  editForCmtAction.disable();
  }
  }
  );
   
   
  //评论表单
  var commentForm = new Ext.form.FormPanel({
  id: 'commentForm',
  bodyStyle: 'padding:5px',
  frame: true,
  fileUpload: true,
  labelAlign: 'right',
  items: [{
  layout: 'column',
  items: [
  {
  columnWidth: .5,
  layout: 'form',
  labelWidth: 100,
  defaultType: 'textfield',
  defaults: {
  width: 180,
  msgTarget: 'side'
  },
  items: [
  {
  inputType: 'hidden',
  fieldLabel: 'id',
  id: 'id'
  },
  {
  fieldLabel: '评论人',
  allowBlank: false,
  disabled: true,
  id: 'commentator_name'
  }
  ]
  },
  {
  columnWidth: .5,
  layout: 'form',
  labelWidth: 100,
  defaultType: 'textfield',
  defaults: {
  width: 180,
  msgTarget: 'side'
  },
  items: [
  {
  fieldLabel: '是否显示',
  xtype: 'radiogroup',
  id: 'cmtIsShow',
  items : [{
  boxLabel: '显示',
  name: 'cmtIsShow',
  id: 'cmtIsShow1',
  inputValue: '显示',
  checked : true
  },{
  boxLabel: '屏蔽',
  name: 'cmtIsShow',
  id: 'cmtIsShow2',
  inputValue: '屏蔽'
  }]
  }
  ]
  }
  ]
  },
  {
  fieldLabel: '评论',
  xtype:'textarea',
  allowBlank: false,
  regex:/[\S][\s]*/,
  width: 500,
  height: 150,
  disabled: true,
  id: 'cmtContent'
  },
  {
  fieldLabel: '回复',
  xtype:'textarea',
  allowBlank: false,
  regex:/[\S][\s]*/,
  width: 500,
  height: 150,
  id: 'cmtReply'
  }
  ]
  });
   
   
  //评论保存
  var saveCmtAction = new Ext.Action({
  text: '保存',
  iconCls: 'saves',
  handler: function(){
  if(commentForm.getForm().isValid()){
  commentForm.getForm().submit({
  url: '/loanSign/cmtUpdate',
  params: {
  },
  waitTitle: '请等待',
  waitMsg: '正在处理数据...',
  timeout: 10,
  success: function(aForm, aAction){
  cmtFormWindow.hide();
  masterStore.reload({callback: myGridUpdateAction});
  Ext.MessageBox.alert('提示', Constant.save_success);
  },
  failure: function(aForm, aAction) {
  Ext.MessageBox.alert('提示', Constant.save_fail);
  }
  });
  }
  }
  });
   
  var returnCmtAction = new Ext.Action({
  text: '返回',
  iconCls: 'stm-returns',
  handler: function(){
  cmtFormWindow.hide();
  }
  });
   
  var cmtFormWindow = new Ext.Window({
  width: 700,
  height: 440,
  modal: true,
  layout: 'fit',
  plain: true,
  bodyStyle: 'padding:5px;',
  buttonAlign: 'center',
  items: commentForm,
  closeAction: 'hide',
  buttons: [
  saveCmtAction,
  returnCmtAction
  ]
  });
  //评论管理---End---
   
   
  //后台添加借款人---begin---
   
  //新增借款人表单
  var addLoanPersonForm = new Ext.form.FormPanel({
  id: 'addLoanPersonForm',
  bodyStyle: 'padding:5px',
  frame: true,
  labelAlign: 'right',
  defaultType: 'textfield',
  items: [
  {
  inputType: 'hidden',
  fieldLabel: 'id',
  id: 'guid'
  },
  {
  fieldLabel: '借款人真实姓名',
  allowBlank: false,
  id: 'name'
  },
  {
  fieldLabel: '身份证号码',
  regex:/^([0-9]{15}|[0-9]{17}([0-9]|X|x))$/,
  allowBlank: false,
  id: 'cardId'
  },
  {
  fieldLabel: '昵称',
  allowBlank: false,
  id: 'nickName'
  },
  {
  fieldLabel: '注册地名',
  allowBlank: false,
  id: 'Address'
  },
  {
  fieldLabel: '注册时间',
  xtype: 'datefield',
  width: 125,
  editable: false,
  allowBlank: false,
  format: 'Y-m-d',
  id: '_createTime'
  },
  {
  fieldLabel: '授信总额度',
  regex:/^(0|[1-9][0-9]*)$/,
  allowBlank: false,
  id: 'credit'
  }
  ]
  });
   
  var addLoanPersonSureAction = new Ext.Action({
  text: '确认',
  iconCls: 'stm-returns',
  handler: function(){
  if (addLoanPersonForm.getForm().isValid()) {
  addLoanPersonForm.getForm().submit({
  url: '/loanSign/addOrModifyLoanPerson',
  waitTitle: '请等待',
  waitMsg: '正在处理数据...',
  timeout: 10,
  success: function(aForm, aAction){
  Ext.MessageBox.alert('提示', aAction.result.msg);
  addLoanPersonWindow.hide();
  bgdLoanPersonStore.reload();//{callback: updateYiXiaO}
   
  },
  failure: function(aForm, aAction) {
  Ext.MessageBox.alert('提示', aAction.result.msg);
  }
  });
  }
  }
  });
   
  var addLoanPersonReturn = new Ext.Action({
  text: '返回',
  iconCls: 'stm-returns',
  handler: function(){
  addLoanPersonWindow.hide();
  }
  });
   
  var addLoanPersonAction = new Ext.Action({
  text: '新增',
  iconCls: 'stm-returns',
  handler: function(){
  //addLoanPersonForm.getForm().reset();
  Ext.getCmp('guid').setValue();
  Ext.getCmp('name').setValue();
  Ext.getCmp('cardId').setValue();
  Ext.getCmp('nickName').setValue();
  Ext.getCmp('Address').setValue();
  Ext.getCmp('_createTime').setValue();
  Ext.getCmp('credit').setValue();
  addLoanPersonWindow.show();
  addLoanPersonWindow.setTitle('添加借款人');
  }
  });
   
  var editLoanPersonAction = new Ext.Action({
  text: '编辑',
  iconCls: 'stm-returns',
  disabled: true,
  handler: function(){
  var record = bgdLoanPersonGrid.getSelectionModel().getSelected();
  addLoanPersonForm.getForm().loadRecord(record);
  addLoanPersonWindow.setTitle('编辑借款人');
  Ext.getCmp('_createTime').setValue(record.get('createTime'));
  addLoanPersonWindow.show();
  }
  });
   
   
  var bgdLoanPersonGrid = new Ext.grid.GridPanel({
  id: 'bgdLoanPerson',
  store: bgdLoanPersonStore,
  sm: new Ext.grid.RowSelectionModel(),
  frame:true,
  trackMouseOver: false,
  disableSelection: false,
  loadMask: true,
  columns: [
  {
  header: 'id',
  hidden:true,
  sortable: true,
  dataIndex: 'id'
  },
  {
  header: '借款人真实姓名',
  sortable: true,
  dataIndex: 'name'
  },
  {
  header: '身份证号码',
  width: 150,
  sortable: true,
  dataIndex: 'cardId'
  },
  {
  header: '昵称',
  sortable: true,
  dataIndex: 'nickName'
  },
  {
  header: '注册地名',
  sortable: true,
  dataIndex: 'Address'
  },
  {
  header: '注册时间',
  sortable: true,
  dataIndex: 'createTime'
  },
  {
  header: '授信总额度',
  sortable: true,
  dataIndex: 'credit'
  }
  ],
  tbar:[
  addLoanPersonAction,
  editLoanPersonAction
  ],
  bbar: new Ext.PagingToolbar({
  pageSize: 20,
  store: bgdLoanPersonStore,
  displayMsg: '显示: {0} - {1} / 总数: {2}',
  emptyMsg: '没有记录'
  })
  });
   
  bgdLoanPersonGrid.getSelectionModel().addListener(
  'selectionchange',
  function updateYiXiaO() {
  if(bgdLoanPersonGrid.getSelectionModel().getSelected()) {
  editLoanPersonAction.enable();
  } else {
  editLoanPersonAction.disable();
  }
  }
  );
   
  var addLoanPersonWindow = new Ext.Window({
  title: '添加借款人',
  width: 370,
  height: 270,
  modal: true,
  layout: 'fit',
  plain: true,
  bodyStyle: 'padding:5px;',
  buttonAlign: 'center',
  closeAction: 'hide',
  items: addLoanPersonForm,
  buttons: [
  addLoanPersonSureAction,
  addLoanPersonReturn
  ]
  });
   
  var loanPersonListWindow = new Ext.Window({
  title: '后台添加借款人列表',
  width: 740,
  height: 400,
  modal: true,
  layout: 'fit',
  plain: true,
  bodyStyle: 'padding:5px;',
  buttonAlign: 'center',
  closeAction: 'hide',
  items: bgdLoanPersonGrid
  });
  //后台添加借款人---end---
   
   
   
  //还款记录---begin---
   
  var yuqiHuanAction = new Ext.Action({
  id: 'yuqiHuanAction',
  text: '逾期还款',
  iconCls: 'stm-returns',
  disabled: true,
  handler: function(){
   
  var record = Ext.getCmp('myGrid3').getSelectionModel().getSelected();
  var _repaymentRecordId = record.get('id');
  if(record.get('overdueState')==2) {
  Ext.Msg.alert('提示', '该记录已还款');
  return;
  }
   
  Ext.Msg.confirm('提示', '确定还款?', function(aButton){
  if(aButton=='yes') {
  Ext.Ajax.request({
  url: '/loanSign/overdueRefund',
  params: {
  _repaymentRecordId: _repaymentRecordId
  },
  success: function(resp, opts){
  masterStore.reload({callback: myGridUpdateAction});
  Ext.MessageBox.alert('提示', '还款成功');
  },
  failure: function(resp, opts){
  var respText = Ext.util.JSON.decode(resp.responseText);
  Ext.MessageBox.alert('提示', '还款失败');
  }
  });
  }
  });
  }
  });
   
  var myGrid3 = new Ext.grid.GridPanel({
  id: 'myGrid3',
  height: 230,
  title: '还款记录',
  store: repayRdStore,
  sm: new Ext.grid.RowSelectionModel(),
  frame:true,
  trackMouseOver: false,
  disableSelection: false,
  loadMask: true,
  columns: [
  {
  header: 'id',
  hidden:true,
  sortable: true,
  dataIndex: 'id'
  },
  {
  header: '期数',
  sortable: true,
  dataIndex: 'periods'
  },
  {
  header: '预计还款日期',
  width: 170,
  sortable: true,
  dataIndex: 'preRepayDate'
  },
  {
  header: '预计还款金额',
  sortable: true,
  dataIndex: 'preRepayMoney'
  },
  {
  header: '还款状态',
  sortable: true,
  dataIndex: 'repayState'
  },
  {
  header: '还款时间',
  sortable: true,
  dataIndex: 'repayTime'
  },
  {
  header: '是否逾期还款',
  sortable: true,
  dataIndex: 'overdueState',
  renderer:function(value){
  if(value == 1){
  return '逾期未还款';
  }else if(value == 2){
  return '逾期已还款';
  }
  }
  }
  ],
  tbar:[
  anshiAction,'-',
  dianfuAction,'-',
  tiqianAction,'-',
  yuqiHuanAction
  ],
  bbar: new Ext.PagingToolbar({
  pageSize: 20,
  store: repayRdStore,
  displayMsg: '显示: {0} - {1} / 总数: {2}',
  emptyMsg: '没有记录'
  })
  });
   
   
  myGrid3.getSelectionModel().addListener(
  'selectionchange',
  function myGrid3UpdateAction (){
  if(myGrid3.getSelectionModel().hasSelection()){
  var record = myGrid3.getSelectionModel().getSelected();
  var repayState = record.data.repayState;
  if(repayState=='') {
  anshiAction.enable();
  dianfuAction.enable();
  tiqianAction.enable();
  }
  if(repayState=='自贷网垫付' && record.data.overdueState==1) {
  yuqiHuanAction.enable();
  }
  }else{
  anshiAction.disable();
  dianfuAction.disable();
  tiqianAction.disable();
  yuqiHuanAction.disable();
  }
  }
  );
   
  //提前还款SureAciton
  var tiqianSureAction = new Ext.Action({
  text: '确定',
  iconCls: 'stm-returns',
  handler: function(){
  if(tiqianForm.getForm().isValid()) {
  var _loanSignId = myGrid.getSelectionModel().getSelected().get('id');
  var _repaymentRecordId = myGrid3.getSelectionModel().getSelected().get('id');
  var datetime = Ext.getCmp('huankuanTime').getValue();
  var _repayTime = Ext.util.Format.date(datetime, 'Y-m-d');
  var tqbx = Ext.getCmp('tqbx').getValue();
   
  Ext.Ajax.request({
  url: '/loanSign/aheadOfTimeRepay',
  params: {
  _loanSignId: _loanSignId,
  _repaymentRecordId: _repaymentRecordId,
  _repayTime: _repayTime,
  tqbx: tqbx
  },
  success: function(resp, opts){
  tiqianWindow.hide();
  masterStore.reload({callback: myGridUpdateAction});
  Ext.MessageBox.alert('提示', '还款成功');
  },
  failure: function(resp, opts){
  var respText = Ext.util.JSON.decode(resp.responseText);
  Ext.MessageBox.alert('提示', respText.msg);
  }
  });
  tiqianWindow.hide();
  }
  }
  });
   
   
  //提前还款ReturnAciton
  var tiqianReturnAction = new Ext.Action({
  text: '返回',
  iconCls: 'stm-returns',
  handler: function(){
  tiqianWindow.hide();
  }
  });
   
   
  var anshiSureAction = new Ext.Action({
  text: '确定',
  iconCls: 'stm-returns',
  handler: function(){
  if(anshiForm.getForm().isValid()) {
  var _loanSignId = myGrid.getSelectionModel().getSelected().get('id');
  var _currentperiod = myGrid3.getSelectionModel().getSelected().get('periods');
  var _repaymentRecordId = myGrid3.getSelectionModel().getSelected().get('id');
  var _repayTime = Ext.util.Format.date(Ext.getCmp('_repayTime').getValue(), 'Y-m-d');
   
  Ext.Ajax.request({
  url: '/loanSign/onTimeRepay',
  params: {
  _repaymentRecordId: _repaymentRecordId,
  _loanSignId: _loanSignId,
  _currentperiod: _currentperiod,
  _repayTime: _repayTime
  },
  success: function(resp, opts){
  anshiWindow.hide();
  masterStore.reload({callback: myGridUpdateAction});
  Ext.MessageBox.alert('提示', '还款成功');
  },
  failure: function(resp, opts){
  var respText = Ext.util.JSON.decode(resp.responseText);
  Ext.MessageBox.alert('提示', respText.msg);
  }
  });
  anshiWindow.hide();
  }
  }
  });
   
  var anshiReturnAction = new Ext.Action({
  text: '返回',
  iconCls: 'stm-returns',
  handler: function(){
  anshiWindow.hide();
  }
  });
   
  //垫付确定按钮
  var dianfuSureAction = new Ext.Action({
  text: '确定',
  iconCls: 'stm-returns',
  handler: function(){
  if(dianfuForm.getForm().isValid()) {
  var _loanSignId = myGrid.getSelectionModel().getSelected().get('id');
  var _currentperiod = myGrid3.getSelectionModel().getSelected().get('periods');
  var _repaymentRecordId = myGrid3.getSelectionModel().getSelected().get('id');
  var _preRepayMoney = myGrid3.getSelectionModel().getSelected().get('preRepayMoney');
  var _repayTime = Ext.util.Format.date(Ext.getCmp('_repayTime2').getValue(), 'Y-m-d');
   
  Ext.Ajax.request({
  url: '/loanSign/advances',
  params: {
  _repaymentRecordId: _repaymentRecordId,
  _loanSignId: _loanSignId,
  _currentperiod: _currentperiod,
  _repayTime: _repayTime,
  _preRepayMoney: _preRepayMoney
  },
  success: function(resp, opts){
  dianfuWindow.hide();
  masterStore.reload({callback: myGridUpdateAction});
  Ext.MessageBox.alert('提示', '还款成功');
  },
  failure: function(resp, opts){
  var respText = Ext.util.JSON.decode(resp.responseText);
  Ext.MessageBox.alert('提示', respText.msg);
  }
  });
  dianfuWindow.hide();
  }
  }
  });
   
  var dianfuReturnAction = new Ext.Action({
  text: '返回',
  iconCls: 'stm-returns',
  handler: function(){
  dianfuWindow.hide();
  }
  });
   
   
  //按时还款form
  var anshiForm = new Ext.form.FormPanel({
  id: 'anshiForm',
  bodyStyle: 'padding:5px',
  frame: true,
  labelAlign: 'right',
  items: [
  {
  fieldLabel: '还款期数',
  xtype: 'textfield',
  allowBlank: false,
  readOnly: true,
  id: 'periods'
  },
  {
  fieldLabel: '还款时间',
  xtype: 'datefield',
  width: 125,
  editable: false,
  allowBlank: false,
  format: 'Y-m-d',
  id: '_repayTime'
  }
  ]
  });
   
   
  //逾期还款form
  var dianfuForm = new Ext.form.FormPanel({
  id: 'dianfuForm',
  bodyStyle: 'padding:5px',
  frame: true,
  labelAlign: 'right',
  items: [
  {
  fieldLabel: '还款期数',
  xtype: 'textfield',
  allowBlank: false,
  readOnly: true,
  id: 'periods2'
  },
  {
  fieldLabel: '还款时间',
  xtype: 'datefield',
  width: 125,
  editable: false,
  allowBlank: false,
  format: 'Y-m-d',
  id: '_repayTime2'
  }
  ]
  });
   
  //提前还款form
  var tiqianForm = new Ext.form.FormPanel({
  id: 'tiqianForm',
  bodyStyle: 'padding:5px',
  frame: true,
  labelAlign: 'right',
  items: [
  {
  fieldLabel: '还款期数',
  xtype: 'textfield',
  allowBlank: false,
  readOnly: true,
  id: 'periods3'
  },
  {
  fieldLabel: '还款时间',
  id: 'huankuanTime',
  xtype: 'datefield',
  width: 125,
  editable: false,
  allowBlank: false,
  format: 'Y-m-d',
  listeners:{
  select:function(thisDate, date) {
  var _loanSignId = myGrid.getSelectionModel().getSelected().get('id');
  var _repayTime = Ext.util.Format.date(date, 'Y-m-d');
   
  Ext.Ajax.request({
  url: '/loanSign/setBeginTime',
  params: {
  _loanSignId: _loanSignId,
  _repayTime: _repayTime
   
  },
  success: function(resp, opts){
  var respText = Ext.util.JSON.decode(resp.responseText);
  Ext.getCmp('szts').setValue(respText.shijitianshu);
  Ext.getCmp('yjsy').setValue(respText.yujilixi);
  Ext.getCmp('sjsy').setValue(respText.shijilixi);
  Ext.getCmp('lxce').setValue(respText.lixichae);
  Ext.getCmp('tqbx').setValue(respText.tiqianbenxi);
  },
  failure: function(resp, opts){
  var respText = Ext.util.JSON.decode(resp.responseText);
  Ext.Msg.alert('提示', respText.msg);
  Ext.getCmp('szts').setValue();
  Ext.getCmp('yjsy').setValue();
  Ext.getCmp('sjsy').setValue();
  Ext.getCmp('lxce').setValue();
  Ext.getCmp('tqbx').setValue();
  }
  })
  }
  }
  },
  {
  fieldLabel: '实际借款天数',
  xtype: 'textfield',
  allowBlank: false,
  readOnly : true,
  id: 'szts'
  },
  {
  fieldLabel: '预计利息收益',
  xtype: 'textfield',
  allowBlank: false,
  readOnly : true,
  id: 'yjsy'
  },
  {
  fieldLabel: '实际利息收益',
  xtype: 'textfield',
  allowBlank: false,
  readOnly : true,
  id: 'sjsy'
  },
  {
  fieldLabel: '利息收益差额',
  xtype: 'textfield',
  allowBlank: false,
  readOnly : true,
  id: 'lxce'
  },
  {
  fieldLabel: '提前还款本息',
  xtype: 'textfield',
  allowBlank: false,
  readOnly : true,
  id: 'tqbx'
  }
  ]
  });
   
   
   
  //按时还款window
  var anshiWindow = new Ext.Window({
  title: '按时还款',
  width: 350,
  height: 180,
  modal: true,
  layout: 'fit',
  plain: true,
  bodyStyle: 'padding:5px;',
  buttonAlign: 'center',
  closeAction: 'hide',
  items: anshiForm,
  buttons: [
  anshiSureAction,
  anshiReturnAction
  ]
  });
  //自贷网垫付window
  var dianfuWindow = new Ext.Window({
  title: '自贷网垫付',
  width: 350,
  height: 180,
  modal: true,
  layout: 'fit',
  plain: true,
  bodyStyle: 'padding:5px;',
  buttonAlign: 'center',
  closeAction: 'hide',
  items: dianfuForm,
  buttons: [
  dianfuSureAction,
  dianfuReturnAction
  ]
  });
  //提前还款window
  var tiqianWindow = new Ext.Window({
  title: '提前还款',
  width: 350,
  height: 300,
  modal: true,
  layout: 'fit',
  plain: true,
  bodyStyle: 'padding:5px;',
  buttonAlign: 'center',
  closeAction: 'hide',
  items: tiqianForm,
  buttons: [
  tiqianSureAction,
  tiqianReturnAction
  ]
  });
  //还款记录---end---
   
   
  var form1Window = new Ext.Window({
  title: '新增借款标',
  width: 700,
  height: 450,
  modal: true,
  layout: 'fit',
  plain: true,
  draggable:true,
  resizable:false,
  closeAction:'hide',
  bodyStyle: 'padding:5px;',
  buttonAlign: 'center',
  items: form1,
  closeAction: 'hide',
  buttons: [
  form1SaveAction,
  form1ReturnAction
  ]
  });
   
  var lookUpWindow = new Ext.Window({
  title: '查看借款标',
  width: 700,
  height: 450,
  modal: true,
  layout: 'fit',
  plain: true,
  draggable:true,
  resizable:false,
  closeAction:'hide',
  bodyStyle: 'padding:5px;',
  buttonAlign: 'center',
  items: lookUpForm,
  closeAction: 'hide',
  buttons: [
  lookUpReturnAction
  ]
  });
   
   
  var loanPersonWindow = new Ext.Window({
  title: '借款人浏览',
  width: 450,
  height: 400,
  modal: true,
  layout: 'fit',
  plain: true,
  bodyStyle: 'padding:5px;',
  buttonAlign: 'center',
  closeAction: 'hide',
  items: loanPersonGrid
  });
   
   
  var sDayWindow = new Ext.Window({
  title: '即将到期还款标',
  width: 800,
  height: 400,
  modal: true,
  layout: 'fit',
  plain: true,
  bodyStyle: 'padding:5px;',
  buttonAlign: 'center',
  closeAction: 'hide',
  items: sDay
  });
   
   
  var allPanel=new Ext.Panel({
  autoScroll:true,
  layout:'form',
  monitorResize: true,
  items:[
  {
  height: 355,
  layout:'fit',
  items: myGrid
  },
  {
  height: 355,
  layout:'fit',
  autoScroll:true,
  items: fileGrid
  },
  {
  height: 355,
  layout:'fit',
  autoScroll:true,
  items: myGrid2
  },
  {
  height: 375,
  layout:'fit',
  autoScroll:true,
  items: myGrid3
  },
  {
  height: 355,
  hidden: true,
  layout:'fit',
  autoScroll:true,
  items: myGrid4
  }
  ]
  });
   
   
   
  var viewport = new Ext.Viewport ({
  layout: 'fit',
  border: false,
  autoScroll:true,
  items: [
  allPanel
  ]
  });
   
  myGridLoadAction.execute();
  });
  --></script>
  </body></html>
   
 
  • 大小: 34.1 KB
分享到:
评论

相关推荐

    extjs流程界面设计器参考_ExtJS工作流设计器_extjs工作流_extjs_

    ExtJS是一种广泛使用的JavaScript库,专门用于构建富客户端的Web应用程序。它提供了丰富的组件和工具,使得开发者可以创建出功能强大、用户界面友好的Web应用。在“extjs流程界面设计器参考”中,我们主要关注的是...

    extJs3升级extjs4方案

    ExtJS3 升级到 ExtJS4 方案 ExtJS3 升级到 ExtJS4 需要修改大量代码,主要是因为 ExtJS4 配备了一类新的系统,不向后兼容。在 ExtJS 3 里生成表的几个框架组件,ExtJS4 大多生成 div,这使得 CSS classes 将会失败...

    轻松搞定Extjs 带目录

    本书作为Extjs的中文教程,旨在帮助读者快速上手Extjs,其内容涉及Extjs的基础知识和实际应用。 #### 2. JavaScript基础知识 - **类的定义**: Extjs中的类继承于JavaScript原生类,通过Ext.extend来定义。这是...

    包含各种类型的extjs小图标,Extjs4小图标

    ExtJS 是一个流行的JavaScript框架,主要用于构建富客户端的Web应用程序。它提供了丰富的组件库、数据管理功能以及强大的用户界面(UI)元素。在标题和描述中提到的“Extjs4小图标”指的是ExtJS 4版本中使用的一系列...

    ExtJS 7.6 SDK trial

    ExtJS 是一个流行的JavaScript框架,用于构建富客户端的Web应用程序。它提供了丰富的用户界面组件、数据绑定机制和强大的API,使开发者能够创建功能强大的、响应式的桌面和移动应用。7.6版本是ExtJS的一个重要更新,...

    ExtJs3.3中文API.CHM_extjs3.3中文文档_

    ExtJS是一个广泛使用的JavaScript库,专门用于构建富客户端应用程序。版本3.3是该库的一个稳定版本,提供了许多功能和组件,使得Web开发者能够创建功能丰富的、交互性强的用户界面。这个“ExtJS3.3中文API.CHM”文档...

    Extjs4.1 小例子(适合extjs初学者学习使用)

    ExtJS 是一个强大的JavaScript前端框架,用于构建富客户端应用程序。版本4.1是该框架的一个重要里程碑,提供了许多新功能和改进。对于初学者来说,理解并掌握ExtJS 4.1的基础和特性是非常有益的。 标题中的"Extjs...

    EXTJS讲解个人项目经历

    EXTJS 是一个强大的JavaScript前端框架,它主要用于构建富客户端应用,提供丰富的用户界面组件和灵活的可定制性。EXTJS 的核心在于其组件化的架构,允许开发者构建复杂的UI布局和功能丰富的应用程序。以下是对EXTJS...

    ExtJS 界面设计器

    ExtJS是一款强大的JavaScript库,主要用于构建富客户端的Web应用程序。其界面设计器,正如标题所示,是一种可视化的开发工具,能够极大地提升开发效率和用户体验。这个工具允许开发者通过拖放组件和直观地调整属性来...

    extjs 3.4 开发前准备

    【EXTJS 3.4 开发前准备】 EXTJS 是一款强大的JavaScript库,主要用于构建桌面级的Web应用程序,提供丰富的用户界面组件和交互效果。3.4版本是EXTJS的一个重要里程碑,它提供了稳定的基础和丰富的组件库。本文将...

    EXTJS 多文件上传

    EXTJS 是一个强大的JavaScript 框架,专用于构建富客户端Web应用程序。在EXTJS中,`MultiFileUploadField` 是一个组件,它允许用户在单个操作中选择并上传多个文件,极大地提升了用户交互体验。这个功能对于处理大量...

    extjs4.2 desktop 拓展

    ExtJS 4.2 Desktop 拓展是一个用于构建桌面样式的Web应用程序的框架,它提供了丰富的用户界面组件和交互效果。这个拓展是基于ExtJS 4.2版本,一个非常强大的JavaScript库,用于创建数据驱动、富客户端的Web应用。在...

    Extjs6示例中文版

    ### Extjs6示例中文版知识点详解 #### 1. ExtJS6简介及学习动机 ExtJS6是一款功能强大的客户端JavaScript框架,适用于构建复杂的企业级Web应用程序。由于中文学习资源较少,作者决定翻译一本名为《ExtJS6 By ...

    ExtJS经典皮肤集合

    ExtJS是一款功能强大的JavaScript前端框架,它为开发者提供了构建富客户端Web应用的工具。这款框架以其丰富的组件库、可定制的界面和强大的数据绑定机制而闻名。标题中的"ExtJS经典皮肤集合"指的是该框架中包含的一...

    extjs中文文档大全

    ExtJS是一种基于JavaScript的开源富客户端框架,用于构建桌面级的Web应用程序。它提供了一整套组件化的用户界面元素和强大的数据绑定机制,使得开发者能够创建功能丰富的、交互性强的Web应用。本文档集合包括了...

    extjs 2000个 icon 图标素材

    ExtJS 是一个强大的JavaScript应用程序框架,它提供了丰富的用户界面组件和功能,用于构建富客户端Web应用。在ExtJS中,图标(icon)是用于增强UI视觉效果和用户体验的重要元素。这些图标通常用在按钮、菜单项、工具...

    基于EXTJS 的在线EXCEL编辑器

    EXTJS 是一个强大的JavaScript 框架,专用于构建富客户端Web应用程序。它提供了一整套组件化的用户界面元素和丰富的交互功能。基于EXTJS 的在线EXCEL编辑器,是利用EXTJS的强大功能来实现对Excel文件的在线创建、...

    中文的Extjs的api手册

    ExtJS是一种基于JavaScript的开源富客户端框架,用于构建桌面级的Web应用程序。它提供了一套完整的组件模型、数据绑定机制以及强大的布局管理器,使得开发者能够创建功能丰富的、交互性强的用户界面。3.3版本虽然...

    ExtJS之实现华丽的皮肤主题更换

    extjs的默认皮肤很好看 但是我们还可以变换样式切换其他皮肤  1 直接添加其他css文件换肤 好多皮肤上网就可以收到的  如皮肤文件:xtheme olive zip下载  把皮肤文件解压 把css文件 如xtheme olive css 拷贝到...

    extjs单元格无法复制

    ExtJS GridPanel 单元格无法复制问题解决方案 ExtJS 是一个功能强大的 JavaScript 框架,广泛应用于 Web 开发中。但是,在使用 ExtJS 的 GridPanel 组件时,可能会遇到单元格无法选中复制的问题,特别是在 IE ...

Global site tag (gtag.js) - Google Analytics