<!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="tag-form" class="customize-search-form">
						<div class="customize-form-group-container">
							<div class="customize-form-group">
								<label>患者信息:</label>
								<input type="text" class="styled-input" placeholder="请输入患者姓名或手机号" name="query"/>
							</div>
							<div class="customize-form-group">
								<label>MDM编码:</label>
								<input type="text"  class="styled-input" placeholder="请输入MDM编码" name="mdmCode"/>
							</div>
							<div class="customize-form-group">
								<label>门店:</label>
								<input name="storeName" class="styled-input" onclick="selectDeptTree()" id="treeName" type="text" placeholder="请选择门店">
							</div>
						</div>
					</form>
				</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 viewFlag = [[${@permission.hasPermi('dtp:configInfo:list')}]];
		var prefix = ctx + "dtp/configInfo";

		$(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 + "/storeTagList",
		        viewUrl: prefix + "/view/{id}",
		        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: "storeId",
						title: "门店id"
					},{
						field: "storeCode",
						title: "门店编码"
					},
					{
						"field": "storeName",
						"title": "门店名称"
					},{
						"field": "mdmCode",
						"title": "MDM编码"
					},{
						"field": "productName",
						"title": "药品商品名"
					},{
						"field": "genericName",
						"title": "药品通用名"
					},{
						"field": "manufacturer",
						"title": "厂家"
					},{
						"field": "specification",
						"title": "规格"
					},{
						"field": "isPrescriptionItem",
						"title": "是否为处方登记品"
					},{
						"field": "isFlipItem",
						"title": "是否为上翻品"
					},{
						"field": "isFollowUpItem",
						"title": "是否为随访品"
					},
					{
						"field": "isMandatoryRegistration",
						"title": "是否强制登记"
					},
					{
						"field": "isColdChainItem",
						"title": "是否为冷链品"
					}]
		    };
		    $.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 selectDeptTree() {
			var treeId = $("#treeId").val();
			var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
			var url = ctx + "system/user/selectDeptTree/" + deptId;
			var options = {
				title: '选择门店',
				width: "380",
				url: url,
				callBack: doSubmit
			};
			$.modal.openOptions(options);
		}

		function doSubmit(index, layero){
			var body = $.modal.getChildFrame(index);
			$("#treeId").val(body.find('#treeId').val());
			$("#treeName").val(body.find('#treeName').val());
			$.modal.close(index);
		}

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

	</script>
</body>

</html>
