You've already forked qlg.tsgz.moe
							
							Init Repo
This commit is contained in:
		
							
								
								
									
										90
									
								
								hyhproject/admin/view/banks/banks.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										90
									
								
								hyhproject/admin/view/banks/banks.js
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,90 @@
 | 
			
		||||
var mmg;
 | 
			
		||||
function initGrid(){
 | 
			
		||||
    var h = WST.pageHeight();
 | 
			
		||||
    var cols = [
 | 
			
		||||
            {title:'银行名称', name:'bankName', width: 100},
 | 
			
		||||
            {title:'操作', name:'' ,width:70, align:'center', renderer: function(val,item,rowIndex){
 | 
			
		||||
                var h = "";
 | 
			
		||||
                if(WST.GRANT.YHGL_02)h += "<a  class='btn btn-blue' onclick='javascript:getForEdit("+item['bankId']+")'><i class='fa fa-pencil'></i>修改</a> ";
 | 
			
		||||
                if(WST.GRANT.YHGL_03)h += "<a  class='btn btn-red' onclick='javascript:toDel(" + item['bankId'] + ")'><i class='fa fa-trash-o'></i>删除</a> ";
 | 
			
		||||
                return h;
 | 
			
		||||
            }}
 | 
			
		||||
            ];
 | 
			
		||||
 
 | 
			
		||||
    mmg = $('.mmg').mmGrid({height: h-80,indexCol: true, cols: cols,method:'POST',
 | 
			
		||||
        url: WST.U('admin/banks/pageQuery'), fullWidthRows: true, autoLoad: true,
 | 
			
		||||
        plugins: [
 | 
			
		||||
            $('#pg').mmPaginator({})
 | 
			
		||||
        ]
 | 
			
		||||
    });  
 | 
			
		||||
}
 | 
			
		||||
function toDel(id){
 | 
			
		||||
	var box = WST.confirm({content:"您确定要删除该记录吗?",yes:function(){
 | 
			
		||||
	           var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
 | 
			
		||||
	           	$.post(WST.U('admin/banks/del'),{id:id},function(data,textStatus){
 | 
			
		||||
	           			  layer.close(loading);
 | 
			
		||||
	           			  var json = WST.toAdminJson(data);
 | 
			
		||||
	           			  if(json.status=='1'){
 | 
			
		||||
	           			    	WST.msg("操作成功",{icon:1});
 | 
			
		||||
	           			    	layer.close(box);
 | 
			
		||||
	           		            mmg.load();
 | 
			
		||||
	           			  }else{
 | 
			
		||||
	           			    	WST.msg(json.msg,{icon:2});
 | 
			
		||||
	           			  }
 | 
			
		||||
	           		});
 | 
			
		||||
	            }});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getForEdit(id){
 | 
			
		||||
	 var loading = WST.msg('正在获取数据,请稍后...', {icon: 16,time:60000});
 | 
			
		||||
     $.post(WST.U('admin/banks/get'),{id:id},function(data,textStatus){
 | 
			
		||||
           layer.close(loading);
 | 
			
		||||
           var json = WST.toAdminJson(data);
 | 
			
		||||
           if(json.bankId){
 | 
			
		||||
           		WST.setValues(json);
 | 
			
		||||
           		toEdit(json.bankId);
 | 
			
		||||
           }else{
 | 
			
		||||
           		WST.msg(json.msg,{icon:2});
 | 
			
		||||
           }
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function toEdit(id){
 | 
			
		||||
	var title =(id==0)?"新增":"编辑";
 | 
			
		||||
	var box = WST.open({title:title,type:1,content:$('#bankBox'),area: ['450px', '160px'],
 | 
			
		||||
		btn:['确定','取消'],end:function(){$('#bankBox').hide();},yes:function(){
 | 
			
		||||
		$('#bankForm').submit();
 | 
			
		||||
	}});
 | 
			
		||||
	$('#bankForm').validator({
 | 
			
		||||
        fields: {
 | 
			
		||||
            bankName: {
 | 
			
		||||
            	rule:"required;",
 | 
			
		||||
            	msg:{required:"银行名称不能为空"},
 | 
			
		||||
            	tip:"请输入银行名称",
 | 
			
		||||
            	ok:"",
 | 
			
		||||
            },
 | 
			
		||||
           
 | 
			
		||||
        },
 | 
			
		||||
       valid: function(form){
 | 
			
		||||
		        var params = WST.getParams('.ipt');
 | 
			
		||||
	                params.bankId = id;
 | 
			
		||||
	                var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
 | 
			
		||||
	           		$.post(WST.U('admin/banks/'+((id==0)?"add":"edit")),params,function(data,textStatus){
 | 
			
		||||
	           			  layer.close(loading);
 | 
			
		||||
	           			  var json = WST.toAdminJson(data);
 | 
			
		||||
	           			  if(json.status=='1'){
 | 
			
		||||
	           			    	WST.msg("操作成功",{icon:1});
 | 
			
		||||
	           			    	$('#bankBox').hide();
 | 
			
		||||
	           			    	$('#bankForm')[0].reset();
 | 
			
		||||
	           			    	layer.close(box);
 | 
			
		||||
	           		            mmg.load();
 | 
			
		||||
	           			  }else{
 | 
			
		||||
	           			        WST.msg(json.msg,{icon:2});
 | 
			
		||||
	           			  }
 | 
			
		||||
	           		});
 | 
			
		||||
 | 
			
		||||
    	}
 | 
			
		||||
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										33
									
								
								hyhproject/admin/view/banks/list.html
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										33
									
								
								hyhproject/admin/view/banks/list.html
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
{extend name="base" /}
 | 
			
		||||
{block name="css"}
 | 
			
		||||
<link rel="stylesheet" type="text/css" href="__ADMIN__/js/mmgrid/mmGrid.css?v={$v}" />
 | 
			
		||||
{/block}
 | 
			
		||||
{block name="js"}
 | 
			
		||||
<script src="__ADMIN__/js/mmgrid/mmGrid.js?v={$v}" type="text/javascript"></script>
 | 
			
		||||
<script src="__ADMIN__/banks/banks.js?v={$v}" type="text/javascript"></script>
 | 
			
		||||
{/block}
 | 
			
		||||
{block name="main"}
 | 
			
		||||
{if WSTGrant('YHGL_01')}
 | 
			
		||||
<div class="wst-toolbar">
 | 
			
		||||
   <button class="btn btn-success f-right" onclick='javascript:toEdit(0)'><i class='fa fa-plus'></i>新增</button>
 | 
			
		||||
   <div style="clear:both"></div>
 | 
			
		||||
{/if}
 | 
			
		||||
</div>
 | 
			
		||||
<div class='wst-grid'>
 | 
			
		||||
<div id="mmg" class="mmg"></div>
 | 
			
		||||
<div id="pg" style="text-align: right;"></div>
 | 
			
		||||
</div>
 | 
			
		||||
<div id='bankBox' style='display:none'>
 | 
			
		||||
    <form id='bankForm' autocomplete="off">
 | 
			
		||||
    <table class='wst-form wst-box-top'>
 | 
			
		||||
       <tr>
 | 
			
		||||
          <th width='100'>银行名称<font color='red'>*</font>:</th>
 | 
			
		||||
          <td><input type='text' id='bankName' name="bankName"  class='ipt' maxLength='20'/></td>
 | 
			
		||||
       </tr>
 | 
			
		||||
    </table>
 | 
			
		||||
    </form>
 | 
			
		||||
 </div>
 | 
			
		||||
<script>
 | 
			
		||||
  $(function(){initGrid()});
 | 
			
		||||
</script>
 | 
			
		||||
{/block}
 | 
			
		||||
		Reference in New Issue
	
	Block a user