<extend name="Common/layui_list" />
<!-- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 开单大师（专业的房产ERP管理系统）
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| © 2017-2023 淮南市银泰软件科技有限公司 All rights reserved
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| http://www.kaidandashi.com
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| QQ号：984784483
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<block name="title">
	<title>{$title}</title>
</block>
<block name="css">
	<style type="text/css">
		#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}
		}
		{$lscxlist}
	</style>
</block>
<block name="content">
	<form class="layui-form">
		<blockquote class="layui-elem-quote" style="padding: 5px;">
			<!-- 排序所需要的两个字段 开始 -->
			<input type="hidden" name="field">
			<input type="hidden" name="order">
			<!-- 排序所需要的两个字段 结束 -->
			<div class="layui-form-item" style="margin-top: 5px;">
				<div class="layui-inline" style="float:left;margin-left: 20px;">
					<div class="layui-input-inline" style="width:400px;">
						<input type="text" name="sousuo" list="greetings" autocomplete="off" placeholder="请输入员工名、电话号码、房源编号、钥匙编号" class="layui-input" id="sousuo">
						<div id="greetings">
							<ul id="tcontent"></ul>
						</div>
					</div>
					<div class="layui-input-inline" style="width:180px;">
						<select name="bumen" id="bumen" lay-verify="">
							<option value="">存钥部门</option>
							{$select_categorys}
						</select>
					</div>
					<div class="layui-inline" style="width: 210px;">
						<input type="text" name="shijian" id="test1" autocomplete="off" class="layui-input" placeholder="添加时间" readonly="">
					</div>
				</div>
				<button class="layui-btn k-search" 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>
				<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>
			</div>
		</blockquote>
	</form>
	<table id="table" lay-filter="table" class="layui-table" lay-data="{height:'full-84', 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:'status',align: 'center'}">状态</th>
				<th lay-data="{field:'ys_time',align: 'center',sort: 'true'}">收钥时间</th>
				<th lay-data="{field:'fybianhao',align: 'center',templet: '#fybh',sort: 'true'}">房源编号</th>
				<th lay-data="{field:'ygmingcheng',align: 'center'}">收钥人</th>
				<th lay-data="{field:'ybumen',align: 'center'}">存钥部门</th>
				<th lay-data="{field:'ys_bianhao',align: 'center'}">钥匙编号</th>
				<th lay-data="{field:'ys_menjin',align: 'center',sort: 'true'}">是否有门禁</th>
				<th lay-data="{field:'ys_weizhihao',align: 'center'}">钥匙位置号</th>
				<th lay-data="{field:'beizhu',align: 'center'}">看房备注</th>
				<th lay-data="{field:'xbumen',align: 'center'}">钥匙目前位置</th>
				<th lay-data="{field:'tjren',align: 'center'}">添加人</th>
				<th lay-data="{field:'addtime',align: 'center',sort: 'true'}">添加时间</th>
				<th lay-data="{field:'',align: 'center',fixed: 'right',width: 180,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="ysxq">详情</a>
		{{# } }}
		{{# if(d.rbacgx == 1) { }}
			<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="ysgx">修改</a>
		{{# } }}
		{{# if(d.rbacsc == 1) { }}
			<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="yssc">删除</a>
		{{# } }}
	</script>
	<script type="text/html" id="fybh">
		{{# if(d.fyxqqx == 1) { }}
			<a title="房源详情" data-href="{{d.fyxqlj}}" data-title="{{d.fybh}}" href="javascript:;" onClick="parent.Hui_admin_tab(this)" class="lianjie">
		{{# } }}
		{{d.fybh}}
		{{# if(d.fyxqqx == 1) { }}
			</a>
		{{# } }}
	</script>
	<script>
		$(document).ready(function(){
			$(document).bind("contextmenu",function(e){
				return false;
			});
			//监听工具条
			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 === 'ysxq'){ //审核
					var id = data.id;
					k_open_leyer('钥匙详情','{:U('content')}?id='+id,'960','480');
				} else if(layEvent === 'ysgx'){
					var id = data.id;
					k_open_leyer('钥匙更新','{:U('edityaoshi')}?id='+id,'960','480');
				} else if(layEvent === 'yssc'){ //删除
					layer.confirm('确定要删除吗？', function(index){
						var a = $(tr).find('a[lay-event=del]');
						k_submit_start(a); //开启 按钮锁定 和 loading 显示
						$.ajax({
							url:'{:U('delyaoshi')}',
							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}); //错误提示
							}
						});
					});
				}
			});
			var laydate = layui.laydate;
			laydate.render({
				elem: '#test1'
				,range: true
				,max: '{:date("Y-m-d",time())}'
			});
			$("#sousuo").keyup(function(){
				$("#greetings").show();
				var txt=$("#sousuo").val();
				if (txt!="") {
					$.ajax({
						url:'{:U('ajax/get_rsyonghu')}',
						type:"get",
						data:{'txt': txt,'node': 747},
						dataType:"json",
						success:function(data){
							var district = data.district;
							$("#tcontent li").remove();
							for(var i in district){
								var li=$("<li></li>");
								$(li).html(district[i]['ygmingcheng']);
								$("#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>