<!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('药品名单')" />
	<th:block th:include="include :: layout-latest-css" />
	<th:block th:include="include :: ztree-css" />
</head>
<body class="gray-bg">

	<div class="ui-layout-center">
		<div class="container-div">
			<div class="row">
				<div class="col-sm-12 search-collapse">
					<div class="query-condition-container">
						<h4 class="query-condition-title">查询条件</h4>
						<div class="query-buttons">
							<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="resetPre()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</div>
					</div>
					<form id="user-form"  class="customize-search-form">
						<div class="customize-form-group-container">
							<div class="customize-form-group select-time">
								<label>配送时间:</label>
								<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"><!--deliveryTimeStart-->
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"><!--deliveryTimeEnd-->
							</div>
							<div class="customize-form-group select-time">
								<label>打印申请时间:</label>
								<input type="text" class="time-input" id="startTimes" placeholder="开始时间" name="params[beginTime]"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTimes" placeholder="结束时间" name="params[endTime]"/>
							</div>
							<div class="customize-form-group">
								<label>配送人:</label>
								<input type="text" class="styled-input" placeholder="请输入配送人姓名" name="deliverer"/>
							</div>
							<div class="customize-form-group">
								<label>打印状态:</label>
								<select name="status" class="styled-input" th:with="type=${@dict.getType('sys_select_print_status')}">
									<option value="">全部</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"
									></option>
								</select>
							</div>
						</div>
					</form>
				</div>

		        <div class="btn-group-sm" id="toolbar" role="group">

		            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="sdtp:print:remove">
		                <i class="fa fa-remove"></i> 删除
		            </a>


		            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="dtp:print:export">
			            <i class="fa fa-download"></i> 打印
			        </a>
		        </div>

				<div class="col-sm-12 select-table table-striped" style="width: 100%; overflow-x: hidden;">
					<table id="bootstrap-table" class="fixed-layout-table"></table>
				</div>
			</div>
		</div>
	</div>

	<th:block th:include="include :: footer" />
	<th:block th:include="include :: layout-latest-js" />
	<th:block th:include="include :: bootstrap-table-fixed-columns-js" />
	<th:block th:include="include :: ztree-js" />
	<script th:inline="javascript">
		var editFlag = [[${@permission.hasPermi('system:user:edit')}]];
		var removeFlag = [[${@permission.hasPermi('system:user:remove')}]];
		var detailFlag = [[${@permission.hasPermi('dtp:print:view')}]];
		var prefix = ctx + "dtp/print";

		$(function() {
		    var panehHidden = false;
		    if ($(this).width() < 1590) {
		        panehHidden = true;
		    }
		    $('body').layout({ initClosed: panehHidden, west__size: 185, resizeWithWindow: false });
	     	// 回到顶部绑定
	    	if ($.fn.toTop !== undefined) {
	    		var opt = {
	    			win:$('.ui-layout-center'),
	    			doc:$('.ui-layout-center')
	    		};
	    		$('#scroll-up').toTop(opt);
	    	}
		    queryUserList();
		});

		function queryUserList() {
		    var options = {
		        url: prefix + "/list",
		        viewUrl: prefix + "/view/{id}",
		        createUrl: prefix + "/add",
		        updateUrl: prefix + "/edit/{id}",
				detailUrl: prefix + "/detail/{id}",
		        removeUrl: prefix + "/remove",
		        exportUrl: prefix + "/export",
		        sortName: "createTime",
		        sortOrder: "desc",
		        modalName: "配送单据打印信息",
				showFooter:true,  //是否显示表格底部区域。
				clickToSelect: true, //是否启用点击行时选中整行的功能。
				singleSelect: false, //是否仅允许选择一行
            fixedColumns: true,
            //fixedNumber: 3,
            fixedRightNumber: 1,
		        columns: [
					{
						field: "id",
						title: "id",
						//hidden:false
						visible: false,
					},
					{
						field: "orderId",
						title: "订单编号"
					},
					{
						field: "deliverer",
						title: "配送人"
					},
					{
						field: "deliveryTime",
						title: "配送时间"
					},
					{
						field: "printRequestTime",
						title: "打印申请时间"
					},
					{
						field: "status",
						title: "打印状态"
					},
					{
						field: "createTime",
						title: "创建时间"
					},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		                if (row.orderId) {
		                	var actions = [];
							actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-search"></i>详细</a>');
			                actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
			                return actions.join('');
		            	} else {
		                    return "";
		                }
		            }
		        }]
		    };
		    $.table.init(options);
		}



		$('#btnExpand').click(function() {
			$._tree.expandAll(true);
		    $(this).hide();
		    $('#btnCollapse').show();
		});

		$('#btnCollapse').click(function() {
			$._tree.expandAll(false);
		    $(this).hide();
		    $('#btnExpand').show();
		});

		$('#btnRefresh').click(function() {
		});
		/* 自定义重置-表单重置/隐藏框/树节点选择色/搜索 */
		function resetPre() {
			resetDate();
			$("#user-form")[0].reset();
			$("#deptId").val("");
			$("#parentId").val("");
			$(".curSelectedNode").removeClass("curSelectedNode");
			$.table.search();
		}

	</script>
</body>

</html>
