<extend name="Common/layui_list" />
<!-- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 开单大师（专业的房产ERP管理系统）
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| © 2018 http://www.kaidandashi.com All rights reserved.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 本系统由淮南市银泰软件科技有限公司提供技术支持
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| QQ号：1264399051
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<block name="title">
	<title>{$title}</title>
</block>
<block name="css">
	<style type="text/css">
		a.layui-btn{
			margin-left: 10px;
		}
	</style>
</block>
<block name="content">
	<form class="layui-form">
		<blockquote class="layui-elem-quote">
			<!-- 排序所需要的两个字段 开始 -->
			<input type="hidden" name="field">
			<input type="hidden" name="order">
			<!-- 排序所需要的两个字段 结束 -->
			<div class="layui-form-item">
				<if condition="_rbac_node_show(373)">
					<div class="layui-inline">
						<a class="layui-btn" href="javascript:;" onclick="k_open_leyer('添加行政区','{:U('Ziyuan/addxzq')}','810','500')">
							添加行政区
						</a>
					</div>
				</if>
				<button style="display: none;" lay-submit="" lay-filter="search" type="submit" id="submit_one">
					搜索
				</button>
				<button style="display: none;" lay-submit="" lay-filter="search_hidden" type="button" id="submit_two">
					搜索
				</button>
				<a class="layui-btn pull-right layui-btn-primary" href="javascript:;" onClick="parent.removeIframe()" style="text-decoration:none">
					关闭
				</a>
				<a class="layui-btn pull-right layui-btn-primary" href="javascript:location.replace(location.href);" title="刷新" style="text-decoration:none">
					刷新
				</a>
			</div>
		</blockquote>
		<div class="more-search">
			<div class="layui-form-item"></div>
		</div>
	</form>
	<table id="table" lay-filter="table" class="layui-table" lay-data="{height:'full-100', url:'__ACTION__?is_ajax=1',limit:30,limits:[30,60,90],page:true, id:'table',request: {pageName: 'p'}}" >
		<thead>
			<tr>
				<th lay-data="{type:'numbers',align: 'center'}">序号</th>
				<th lay-data="{field:'xzqming',align: 'center'}">行政区名</th>
				<th lay-data="{field:'dituzb',align: 'center'}">地图坐标</th>
				<th lay-data="{field:'tjr',align: 'center'}">添加人</th>
				<th lay-data="{field:'',align: 'center',fixed: 'right',width: 200,templet: '#btn',unresize: true}">操作</th>
			</tr>
		</thead>
	</table>
	<input type="hidden" id="zifujiyemian">
</block>
<block name="js">
	<script type="text/html" id="btn">
		{{# if(d.rbacgx == 1) { }}
			<a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="edit">更新</a>
		{{# } }}
		{{# if(d.rbaczy == 1) { }}
			<a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="xxzy">转移</a>
		{{# } }}
		{{# if(d.rbacsc == 1) { }}
			<a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="del">删除</a>
		{{# } }}
	</script>
	<script>
		$(document).ready(function(){
			//监听工具条
			table.on('tool(table)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
				var data = obj.data; //获得当前行数据
				var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
				var tr = obj.tr; //获得当前行 tr 的DOM对象
				if(layEvent === 'del'){ //删除
					layer.confirm('确定要删除吗？', function(index){
						var a = $(tr).find('a[lay-event=del]');
						k_submit_start(a); //开启 按钮锁定 和 loading 显示
						$.ajax({
							url:'{:U('delxzq')}',
							type:"post",
							data:{id:data.id},
							dataType:"json",
							success:function(r){
								k_submit_end(a); //取消按钮锁定 和 loading 显示
								if (r.status==1) {
									layer.msg(r.info); //父级页面提示成功信息
									obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
									layer.close(index); //关闭弹出的子页面窗口
								}else{
									layer.msg(r.info,{anim: 6}); //错误提示
								}
							},
							error:function(){
								k_submit_end(a); //取消 按钮锁定 和 loading 显示
								layer.msg('网络错误！',{anim: 6}); //错误提示
							}
						});
					});
				} else if(layEvent === 'edit'){
					var id = data.id;
					k_open_leyer('更新行政区','{:U('editxzq')}?id='+id,'810','500')
				} else if(layEvent === 'xxzy'){
					var id = data.id;
					k_open_leyer('行政区信息转移','{:U('xxzhuanyi')}?xzqid='+id,'540','540');
				}
			});
		});
	</script>
</block>