<extend name="Common/layui_list" />
<!-- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 开单大师（专业的房产ERP管理系统）
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| © 2017-2022 淮南市银泰软件科技有限公司 All rights reserved
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| http://www.kaidandashi.com
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| QQ号：984784483
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<block name="title">
	<title>{$title}</title>
</block>
<block name="css">
	<style type="text/css">
		a.layui-btn{
			margin-left: 10px;
		}
		#greetings{
			position: absolute;
			height: auto;
			border-left: 1px solid rgba(0, 0, 0, 0.11);
			border-right: 1px solid rgba(0, 0, 0, 0.11);
			left: 0px;
			z-index:5555; 
		}
		#greetings ul{
			list-style: none;
			box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.44);
			-webkit-margin-before: 0em;
			-webkit-margin-after: 0em;
			-webkit-margin-start: 0px;
			-webkit-margin-end: 0px;
			-webkit-padding-start: 0px;
		}
		#greetings li{
			text-align: left;
			padding: 5px;
			font-family: inherit;
			border-bottom: 1px solid rgba(0, 0, 0, 0.16);
			height: 25px;
			width: 180px;
			line-height: 25px;
			background-color: rgba(255, 255, 255, 0.8);
			cursor: pointer;
		}
		#greetings li:hover{
			background-color: rgba(175, 42, 0, 0.52);
			color: white;
		}
		.lscxan:hover{
			{$lscxanbk}
		}
		.layui-btn-tijiao {
			background-color: {$lscx} !important;
		}
		{$lscxlist}
	</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(130)">
					<div class="layui-inline">
						<a class="layui-btn layui-btn-tijiao" href="javascript:;" onclick="k_open_leyer('添加小区','{:U('Ziyuan/addXiaoqu')}','960','540')">
							添加小区
						</a>
					</div>
				</if>
				<div class="layui-inline">
					<div class="layui-input-inline">
						<input type="text" name="sousuo" list="greetings" autocomplete="off" placeholder="请输入小区名、拼音检索" class="layui-input" id="sousuo" value="{$_GET['sousuo']}">
						<div id="greetings" >
							<ul id="tcontent"></ul>
						</div>
					</div>
				</div>
				<button class="layui-btn k-search layui-btn-primary lscxan" lay-submit="" lay-filter="search" type="submit" id="submit_one">
					搜索
				</button>
				<button class="lscxan" style="display: none;" lay-submit="" lay-filter="search_hidden" type="button" id="submit_two">
					搜索
				</button>
				<button class="layui-btn layui-btn-primary lscxan" type="reset">
					重置
				</button>
				<a class="layui-btn pull-right layui-btn-primary lscxan" href="javascript:;" onClick="parent.removeIframe()" style="text-decoration:none">
					关闭
				</a>
				<a class="layui-btn pull-right layui-btn-primary lscxan" href="javascript:location.replace(location.href);" title="刷新" style="text-decoration:none">
					刷新
				</a>
				<a data-href="" id="xiangqing" data-title="" href="javascript:;" onClick="parent.Hui_admin_tab(this)" style="display: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:'',align: 'center', templet: '#img', unresize: true}">小区图片</th>
				<th lay-data="{field:'xiaoqum',align: 'center'}">小区名称</th>
				<th lay-data="{field:'pinyinjs',align: 'center',sort: 'true'}">拼音检索</th>
				<th lay-data="{field:'pqm',align: 'center'}">所属片区</th>
				<th lay-data="{field:'xzqm',align: 'center'}">所属行政区</th>
				<th lay-data="{field:'xxm',align: 'center'}">所属学区</th>
				<th lay-data="{field:'dituzb',align: 'center'}">地图坐标</th>
				<th lay-data="{field:'whbm',align: 'center'}">维护部门</th>
				<th lay-data="{field:'whr',align: 'center'}">维护人</th>
				<th lay-data="{field:'tjr',align: 'center'}">添加人</th>
				<th lay-data="{field:'',align: 'center',fixed: 'right',width: 240,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.rbacxq == 1) { }}
			<a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="detail" title="小区详情" data-href="{:U('Ziyuan/xiaoqurr')}?id={{d.id}}" data-title="{{d.xiaoqum}}" href="javascript:;" onClick="parent.Hui_admin_tab(this)">详情</a>
		{{# } }}
		{{# 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 type="text/html" id="img">
		{{# if(d.img) { }}
			<img width="75" src="/Upload/10000/xiaoqu/{{d.id}}/t_{{d.img}}" alt="">
		{{# } else { }}
			<img width="75" src="/Public/img/default_icon.png" alt="">
		{{# } }}
	</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('delXiaoqu')}',
							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('editXiaoqu')}?id='+id,'960','540')
				} else if(layEvent === 'xxzy'){
					var id = data.id;
					k_open_leyer('小区信息转移','{:U('xxzhuanyi')}?xqid='+id,'540','540');
				}
			});
			table.on('rowDouble(table)', function(obj){
				var data=obj.data;
				if (data.rbacxq) {
					document.getElementById("xiangqing").setAttribute('data-href','{:U('ziyuan/xiaoqurr')}?id='+data.id);
					document.getElementById("xiangqing").setAttribute('data-title',data.xiaoqum);
					document.getElementById("xiangqing").click();
				}
			});
			$("#sousuo").keyup(function(){
				$("#greetings").show();
				var txt=$("#sousuo").val();
				if (txt!="") {
					$.ajax({
						url:'{:U('ajax/ss_xq')}',
						type:"get",
						data:"txt="+txt,
						dataType:"json",
						success:function(data){
							var district = data.lists;
							$("#tcontent li").remove();
							for(var i in district){
								var li=$("<li></li>");
								$(li).html(district[i]['xiaoqum']);
								$("#tcontent").append(li);
							}
						}
					});
				}
			});
			$("#tcontent").on("click","li", function() {
				$("#greetings").show();
				var Uarry=$("#tcontent li");
				var count=$(this).index(); //获取li的下标
				var Tresult=Uarry.eq(count).text();
				$("#sousuo").val(Tresult);
				$("#greetings").hide();
			});
			$("body").click(function(){
				$("#greetings").hide();
			});
		});
	</script>
</block>