<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="include/header_css::header('选择上级-通用字典')"></head>
<body>
	<div id="dpLTE" class="container-fluid" v-cloak>
		<ul id="macroTree" class="ztree"></ul>
	</div>
	<div th:include="include/footer_js::footer"></div>
	<script type="text/javascript">
	var setting = {
		data : {
			simpleData : {
				enable : true,
				idKey : "macroId",
				pIdKey : "typeId",
				rootPId : -1
			},
			key : {
				url : "nourl"
			}
		}
	};
	var ztree;

	var vm = new Vue({
		el : '#dpLTE',
		methods : {
			getMacro : function(menuId) {
				$.get('../../sys/macro/select', function(r) {
					ztree = $.fn.zTree
							.init($("#macroTree"), setting, r);
					var node = ztree.getNodeByParam("macroId", top.layerForm.vm.macro.typeId);
					ztree.selectNode(node);
					top.layerForm.vm.macro.typeName = node.name;
				})
			},
			acceptClick: function() {
				var node = ztree.getSelectedNodes();
				top.layerForm.vm.macro.typeId = node[0].macroId;
				top.layerForm.vm.macro.typeName = node[0].name;
				dialogClose();
			}
		},
		created : function() {
			this.getMacro();
		}
	})
	</script>
</body>
</html>