<div class="layui-fluid">
	<div class="layui-card">
		<div class="layui-form layui-form-pane layui-card-header layuiadmin-card-header-auto" lay-filter="LAY-broker-brokerlist-search">
			<div class="layui-form-item">
				<div class="layui-inline">
					<label class="layui-form-label">电话</label>
					<div class="layui-input-block">
						<input type="text" name="mobile" placeholder="请输入" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-inline">
					<button class="layui-btn" lay-submit lay-filter="LAY-broker-brokerlist-btn">
						<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
					</button>
				</div>
			</div>
		</div>
		<div class="layui-card-body">
			<table id="LAY-broker-brokerlist-table" lay-filter="LAY-broker-brokerlist-table"></table>
		</div>
	</div>
	<script type="text/html" id="residentTpl">
		{{#  if(d.residentid != 0){ }}
		{{d.resident.title}} - {{d.resident.mobile}}
		{{#  } }}
	</script>
	<script type="text/html" id="workertitleTpl">
		{{d.workerid == 0 ? '' : d.worker.title}}
	</script>
</div>

<script>
	layui.config({
		base: '/static/echoui/' //静态资源所在路径
	}).extend({
		index: 'lib/index' //主入口模块
	}).use(['index', 'form', 'set', 'table'], function() {
		var $ = layui.$,
				setter = layui.setter,
				form = layui.form,
				table = layui.table;
		form.render();

		table.render({
			elem: '#LAY-broker-brokerlist-table',
			url: setter.baseAdminUrl + 'resident/listfollow',
			cols: [
				[
					{ field: 'id', width: 80, title: '表ID', sort: true },
					{ field: 'resident', title: '驻场老师（姓名-手机号）', templet: '#residentTpl', minWidth: 250, align: 'left' },
					{ field: 'workerid', title: '劳务公司', templet: '#workertitleTpl' },
					{ field: 'content', title: '记录', align: 'center' },
					{ field: 'createtime', title: '创建时间', width: 170 },
				]
			],
			page: true,
			limit: 50,
			cellMinWidth: 150,
			text: '对不起，加载出现异常！'
		});

		form.on('submit(LAY-broker-brokerlist-btn)', function(data) {
			table.reload('LAY-broker-brokerlist-table', {
				where: data.field,
				page: {
					curr: 1
				}
			});
		});
	});
</script>
