<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<meta charset="UTF-8">
	<th:block th:include="include :: header('药品信息')" />
	<th:block th:include="include :: layout-latest-css" />
	<th:block th:include="include :: ztree-css" />
</head>

<body><div class="main-content">


				<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="请输入MDM编码或药品商品名" name="query" style="width: 350px;"/>
								</div>
							</div>
						</form>
					</div>

				</div>
				<div class="row">
					<div class="col-sm-12 select-table table-striped">
						<table id="bootstrap-table"></table>
					</div>
				</div>
</div>

<th:block th:include="include :: footer" />
<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",//storeTagListByproductNameAndMdmCode
			viewUrl: prefix + "/view/{id}",
			exportUrl: prefix + "/export",
			sortName: "createTime",
			sortOrder: "desc",
			modalName: "药品信息",
			showFooter:true,  //是否显示表格底部区域。
			clickToSelect: true, //是否启用点击行时选中整行的功能。
			singleSelect: true, //是否仅允许选择一行
			fixedColumns: true,
			//fixedNumber: 3,
			//fixedRightNumber: 1,
			columns: [{
				checkbox: true
			},
				{
					field: "id",
					title: "id",
					//hidden:false
					visible: true,
				},
				{
					"field": "storeName",
					"title": "门店名称"
				},{
					"field": "mdmCode",
					"title": "MDM编码"
				},{
					"field": "productName",
					"title": "药品商品名"
				},{
					"field": "genericName",
					"title": "药品通用名"
				},{
					"field": "specification",
					"title": "规格"
				},{
					"field": "isPrescriptionItem",
					"title": "是否为处方登记品"
				},{
					"field": "isFlipItem",
					"title": "是否为上翻品"
				},{
					"field": "isFollowUpItem",
					"title": "是否为随访品"
				}]
		};
		$.table.init(options);
	}

	/* 自定义重置-表单重置/隐藏框/树节点选择色/搜索 */
	function resetPre() {
		resetDate();
		$("#tag-form")[0].reset();
		$("#deptId").val("");
		$("#parentId").val("");
		$(".curSelectedNode").removeClass("curSelectedNode");
		$.table.search();
	}
	/* 添加用户-选择用户-提交(子页面调用父页面形式) */
	function submitHandler(index, layero) {
		debugger
		var rows = $.table.selectFirstColumns();

		if (rows.length == 0) {
			$.modal.alertWarning("请至少选择一条记录");
			return;
		}
		$.modal.close();
		// 父页面的方法
		// activeWindow().selectUsers();
		// 父页面的变量
		activeWindow().$('#userids').html('我是通过方式一来的：' + rows.join());
	}

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

	function selectTableObject() {
		var productName = $.table.selectColumns('productName');
		var mdmCode = $.table.selectColumns('mdmCode');
		var genericName = $.table.selectColumns('genericName');
		var specification = $.table.selectColumns('specification');
		var isFlipItem = $.table.selectColumns('isFlipItem');
		var productId = $.table.selectColumns('id');
		var column = [{productName:productName,genericName:genericName,mdmCode:mdmCode,specification:specification,isFlipItem:isFlipItem,productId:productId}];
		return column;
	}
	/*回调返回所有的选中行数据*/
	function selectColumns2() {
		return $.table.selectColumns2();
	}
	$("#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>
