<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/include/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>移库作业</title>
<%@ include file="/WEB-INF/include/common.jsp"%>
<script type="text/javascript">
	var functionId = '${functionId}';
	var locationMoveStatusListJson = JSON
			.parse('${requestScope.locationMoveStatusListJson}');

	function locationMoveStatusFormat(value, row, index) {
		for ( var i = 0; i < locationMoveStatusListJson.length; i++) {
			var locationMoveStatusItem = locationMoveStatusListJson[i];

			if (locationMoveStatusItem != null) {
				if (value == locationMoveStatusItem.id) {
					return locationMoveStatusItem.dictionaryName;
				}
			}

		}

	};

	$(function() {
		var buttonData = '${requestScope.buttons}';
		//实例化查询表单,当前页面只能实例化一次
		var searchForm = $("#searchForm").searchForm();
		var advSearchForm = $("#advSearchForm").searchForm();
		//实例化实体List
		$.InventoryLocationMoveList = new $.AbstractList({
			entity : "InventoryLocationMove",
			searchForm : searchForm,
			advSearchForm : advSearchForm,
			functionId : functionId,
			showTopic:true,
			id : "inventoryLocationMoveId",
			autoLoad:false
		});

		$.btnSearch = $('#btnSearch').advSearch({
			functionId:'${functionId}',
			baseList:$.InventoryLocationMoveList
		});
		$("#btnReset").bind(
				"click",
				$.proxy($.InventoryLocationMoveList.reset,
						$.InventoryLocationMoveList));
		if (!$.isEmpty(buttonData)) {
			//构建权限按钮
			var jsonButtons = JSON.parse(buttonData);
			$.buildToolbar($("#toolbar"), jsonButtons);
		}
		;

		$("#btnSearch").bind(
				"click",
				$.proxy($.InventoryLocationMoveList.quickSearch,
						$.InventoryLocationMoveList));
		
		$('#customerId').combogrid({ // 货主
			url : WEBROOT + "/loadData.action?entity=customer",
			idField : 'customerId',
			textField : 'customerName',
			delay : 500,
			mode : 'remote',
			showHeader : false,
			striped : true,
			columns : [ [ {
				field : 'customerName',
				width : '150'
			} ] ],
			onBeforeLoad : function(param) { // 此设置使控件不会自动加载数据 这里不能使用this
				if (!$("#customerId").combogrid('getText')) {
					return false;
				} else {
					return true;
				}
			},
			onShowPanel : function() { // 在第一次触发下拉框事件是加载数据
				if (!$(this).combogrid('getText')) {
					$(this).combogrid({
						onBeforeLoad : function(param) {
							return true;
						}
					});
				}
			}
		});

	});
</script>
</head>
<body style="overflow-y: hidden" fit="true" scroll="no">
	<div id="tabs" class="easyui-tabs" fit="true">
		<div title="查询">
			<form id="searchForm" action="#" method="post">
				<table width="100%">
					<tr>
						<td class="title"><label for="locationMoveStatus"
							style="vertical-align: middle">处理状态:</label>
						</td>
						<td><select id="locationMoveStatus" class="easyui-combobox"
							size="8" name="locationMoveStatus" style="width: 155px"
							condition='"operator":"like"'>
								<c:forEach var="item" items="${locationMoveStatusList}">
									<option value="${item.id}">${item.dictionaryName}</option>
								</c:forEach>
						</select>
						</td>
						<td class="title"><label for="locationMoveTime"
							style="vertical-align: middle">处理时间:</label>
						</td>
						<td>
							<input class="easyui-datebox" type="text"
							style="vertical-align: middle" name="locationMoveTime" style="width: 155px"
							condition='"operator":">="' />~ <input class="easyui-datebox"
							type="text" style="vertical-align: middle" name="locationMoveTime" style="width: 155px"
							condition='"operator":"<="' />
						</td>
						<input type="hidden" name="accountId"
							value="${requestScope.accountId}" condition='"operator":"="' />
					</tr>
					<tr>
						<td class="title">货主:</td>
						<td>
							<input id="customerId" name="customerId" myType="easyui-combogrid" style="width:155px" condition='"operator":"in"'/>
						</td>
					</tr>
					<tr>
						<td align="right" colspan="6">
							<a id="btnSearch" href="#"class="easyui-linkbutton" data-options="iconCls:'icon-search'">查询</a>
						</td>
					</tr>
				</table>
			</form>

			<div id="toolbar" class="toolbar"></div>

			<table id="maingrid">
				<thead>
					<tr>
						<th data-options="field:'id',hidden:true">主键</th>
						<th data-options="field:'ck',checkbox:true">编码</th>
						<th
							data-options="field:'inventoryLocationMoveId',align:'center',width:180">移库单号</th>
						<th
							data-options="field:'locationMoveStatus',align:'center',width:100,formatter:locationMoveStatusFormat">处理状态</th>
						<th data-options="field:'warehouseName',align:'center',width:100">仓库名称</th>
						<th data-options="field:'customerName',align:'center',width:100">货主名称</th>
						<th data-options="field:'description',align:'center',width:100">备注</th>
						<th data-options="field:'locationMoveBy',align:'center',width:100">处理人</th>
						<th
							data-options="field:'locationMoveTime',align:'center',width:100">处理时间</th>
						<th data-options="field:'createdBy',align:'center',width:100">创建者</th>
						<th data-options="field:'creationTime',align:'center',width:100">创建时间</th>
						<th data-options="field:'updatedBy',align:'center',width:100">更新人</th>
						<th data-options="field:'updateTime',align:'center',width:100">更新时间</th>
					</tr>
				</thead>
			</table>

		</div>

		<div title="内容">
			<iframe id="innerFrame" name="innerTab" scrolling="auto"
				frameborder="0" style="width: 100%; height: 99.4%; border: none;"></iframe>
		</div>
	</div>
	<div id="advSearchWindow" class="popWindow">
		<%@ include
			file="/WEB-INF/pages/wms/inventoryLocationMove/inventoryLocationMoveAdvSearch.jsp"%>
	</div>
</body>
</html>