<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('物料列表')" />
</head>
<body class="gray-bg">
     <input type="hidden" id="rowIds">
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								<label>客户编号：</label>
								<input type="text" name="customerId"/>
							</li>
							<li>
								<label>客户名称：</label>
								<input type="text" name="customerName"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
		var prefix = ctx + "business/customer";

        $(function() {
            var options = {
                url: prefix + "/list",
		        showSearch: false,
		        showRefresh: false,
		        showToggle: false,
		        showColumns: false,
				fixedColumns: true,
				fixedNumber: 3,
                columns: [{
		            radio: true
		        },
				{
					field: 'customerId',
					title: '客户编号'
				},
				{
					field: 'customerName',
					title: '客户名称'
				},
				{
					field: 'customerShortName',
					title: '客户简称'
				},
				{
					field: 'pyName',
					title: '拼音简称'
				},
				{
					field: 'cusTypeId',
					title: '客户分类编号'
				},
				{
					field: 'linkman',
					title: '联系人'
				},
				{
					field: 'telephone',
					title: '手机号'
				},
				{
					field: 'phone',
					title: '联系电话'
				},
				{
					field: 'fax',
					title: '联系传真'
				},
				{
					field: 'status',
					title: '状态 0：正常 1：停用'
				},
				{
					field: 'remark',
					title: '备注'
				}
				]
            };
            $.table.init(options);
        });
        
        /* 添加物料-选择物料-提交 */
		function submitHandler() {
			var rows = $.table.selectFirstColumns();
			if (rows.length == 0) {
       			$.modal.alertWarning("请至少选择一条记录");
       			return;
       		}
			alert(rows.join());
		}

		/* 添加用户-选择用户-提交(回调形式-父页面调用子页面) */
		function getSelections() {
			return $.table.selectFirstColumns();
		}

		$("#bootstrap-table").on("check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table", function (e, rowsAfter, rowsBefore) {
			var rows = $.common.equals("uncheck-all", e.type) ? rowsBefore : rowsAfter;
			var rowIds = $.table.affectedRowIds(rows);
			$("#rowIds").val(rowIds);
		});
    </script>
</body>
</html>