<extend name="Common/layui_list" />
<!-- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 房开源（综合房产ERP管理系统）
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| © 2019-2023 http://www.kaidandashi.com/ All rights reserved.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 本系统由淮南市银泰软件科技有限公司提供技术支持
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 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;
		}
	</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" 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>
				<div class="layui-inline" style="width: 150px;">
					<select id="xzqid" lay-filter="xzqid" name="ssxzq">
						<option value="">区域</option>
						<foreach name="ssxzq" item="xzq">
							<option value="{$xzq.id}">{$xzq.xzqming}</option>
						</foreach>
					</select>
				</div>
				<div class="layui-inline" style="width: 150px;">
					<select id="pqid" lay-filter="pqid" name="sspianqu">
						<option value="">请先选择区域</option>
					</select>
				</div>
				<div class="layui-inline" style="width: 100px;">
					<select name="lpleixing">
						<option value="">物业类型</option>
						<option value="1">写字楼</option>
						<option value="2">商铺</option>
						<option value="3">住宅</option>
						<option value="4">混合型</option>
					</select>
				</div>
				<div class="layui-inline" style="width: 100px;">
					<select name="shtype">
						<option value="">审核类型</option>
						<option value="1">已通过</option>
						<option value="2">已驳回</option>
						<option value="3">待审核</option>
					</select>
				</div>
				<button class="layui-btn k-search" lay-submit="" lay-filter="search" type="submit" id="submit_one">
					搜索
				</button>
				<button class="" style="display: none;" lay-submit="" lay-filter="search_hidden" type="button" id="submit_two">
					搜索
				</button>
				<button class="layui-btn layui-btn-primary" type="reset">
					重置
				</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="{field:'',align: 'center', templet: '#lpbh'}">编号</th>
				<th lay-data="{field:'',align: 'center', templet: '#img', unresize: true}">楼盘外图</th>
				<th lay-data="{field:'xiaoqum',align: 'center'}">楼盘名称</th>
				<th lay-data="{field:'lxm',align: 'center'}">物业类型</th>
				<th lay-data="{field:'xzqm',align: 'center'}">区域</th>
				<th lay-data="{field:'pqm',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: 300,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.shtype == 3) { }}
			{{# if(d.rbacsh == 1) { }}
				<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="lpsh">审核</a>
			{{# } }}
		{{# } }}
		{{# if(d.shtype == 1) { }}
			{{# if(d.rbaczd == 1) { }}
				<a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="detail" title="楼盘字典" data-href="{:U('Zdxinxi/index')}?id={{d.id}}" data-title="{{d.xiaoqum}}楼盘字典" href="javascript:;" onClick="parent.Hui_admin_tab(this)">字典</a>
			{{# } }}
		{{# } }}
		{{# 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.shtype != 3) { }}
			{{# if(d.rbacgx == 1) { }}
				<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="edit">更新</a>
			{{# } }}
		{{# } }}
		{{# if(d.shtype == 1) { }}
			{{# if(d.rbaczy == 1) { }}
				<a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="xxzy">转移</a>
			{{# } }}
		{{# } }}
		{{# if(d.rbacsc == 1) { }}
			<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
		{{# } }}
	</script>
	<script type="text/html" id="img">
		{{# if(d.img) { }}
			<img width="75" src="/Upload/{{d.gongsiid}}/xiaoqu/{{d.id}}/t_{{d.img}}" alt="">
		{{# } else { }}
			<img width="75" src="/Public/images/default_icon.png" alt="">
		{{# } }}
	</script>
	<script type="text/html" id="lpbh">
		{{# if(d.rbacxq == 1) { }}
			<a title="楼盘详情" data-href="{:U('Ziyuan/xiaoqurr')}?id={{d.id}}" data-title="{{d.xiaoqum}}" href="javascript:;" onClick="parent.Hui_admin_tab(this)" style="text-decoration:none;color:red;">
		{{# } }}
		{{d.bianhao}}
		{{# if(d.rbacxq == 1) { }}
			</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('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 === 'lpsh'){
					var id = data.id;
					k_open_leyer('楼盘审核','{:U('lpshenhe')}?id='+id,'666','333');
				} 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');
				}
			});
		});
		layui.use(['form'], function(){
			var form = layui.form
			form.on('select(xzqid)', function(data){
				$('.hide1').remove();
				var xzqid = data.value;
				$.ajax({
					url:"{:U('Ajax/select_pianqu')}",
					type:"get",
					data:"xzqid="+xzqid,
					dataType:"json",
					success:function(data){
						if(data.status==0){
							var no_pianqu='<option value="">无商圈</option>';
							$("#pqid").empty();
							$("#pqid").append(no_pianqu);
							form.render('select');
						}else{
							var pq = data;
							var you_pianqu='<option value="">请选择</option>';
							for(var i in pq){
								you_pianqu +='<option value="'+pq[i].id+'" class="hide1">'+pq[i].pianqum+'</option>';
							}
							$('#pqid').html(you_pianqu);
							form.render('select');
						}
					}
				});
			});
		});
		$("#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>