<#include "/public/macro.html">
<div class="uk-layui-form">
	<form class="layui-form" action="/apps/report/cubelevel/update.html" method="post">
		<input type="hidden" name="cubeid" value="${cubeLevel.cubeid!''}">
		<input type="hidden" name="dimid" value="${cubeLevel.dimid!''}">
		<input type="hidden" name="id" value="${cubeLevel.id!''}">
		<div class="layui-collapse">
			<div class="layui-colla-item">
				<div class="layui-colla-content layui-show">
					<div class="layui-form-item">
						<!-- <div class="layui-inline">
							<label class="layui-form-label">数据表：</label>
							<div class="layui-input-inline">
								<select lay-ignore class="ukefu-select" name="tablename" id="fktable" style="width: 100%">
									<option value="">选择数据表</option>
								 	<#if fktableList??>
								 	<#list fktableList as fktable>
								 	<option value="${fktable.tb.name!''}" idval="${fktable.tb.id!''}" <#if fktable.tb.name == cubeLevel.tablename>selected="selected"</#if> >${fktable.tb.name!''}</option>
								 	</#list>
								 	</#if> 
								</select>
							</div>
						</div> -->
						<div class="layui-inline" id="fktableiddiv">
							<#include "/apps/business/report/cube/cubelevel/fktableiddiv.html">
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">名称：</label>
							<div class="layui-input-inline">
								<input type="text" name="name"  lay-verify="required" autocomplete="off"
									class="layui-input" value="${cubeLevel.name!''}">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">创建索引：</label>
							<div class="layui-input-inline">
								<input type="radio" name="uniquemembers" value="1" title="是" <#if cubeLevel.uniquemembers?? && cubeLevel.uniquemembers>checked</#if>> 
								<input type="radio" name="uniquemembers" value="0" title="否" <#if cubeLevel.uniquemembers?? && !cubeLevel.uniquemembers>checked</#if>>
							</div>
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label" >数据类型：</label>
							<div class="layui-input-inline" style="width:218px;margin-right:0px;padding-top:9px;">
								<@select "com.dic.cubelevel.type" "type" cubeLevel.type!'' "lay-ignore"/>
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label" >时间粒度：</label>
							<div class="layui-input-inline">
								<@select "com.dic.cubelevel.leveltype" "leveltype" cubeLevel.leveltype!''  "lay-ignore"/>
							</div>
						</div>
					</div>
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label" >格式化代码：</label>
							<div class="layui-input-inline">
								<input type="text" name="formatstr"  
									class="layui-input" value="${cubeLevel.formatstr!''}">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label" >排序位置：</label>
							<div class="layui-input-inline">
								<input type="text" name="sortindex" value="1"
									class="layui-input" value="${cubeLevel.sortindex!''}">
							</div>
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">属性编码：
								<br/>
								<div><a href="javascript:void(0)" style="margin-right:20px;margin-top:20px;" onclick="return false;" id="attributedemo">样例代码</a></div>
							</label>
							<div class="layui-input-inline" style="width: 520px;">
								<textarea name="attribue" id="attribute" class="layui-textarea" style="resize:none;">${cubeLevel.attribue!''}</textarea>
							</div>
						</div>
					</div>
					<!-- 
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">描述：</label>
							<div class="layui-input-inline" style="width: 520px;">
								<textarea name="description" class="layui-textarea" style="resize:none;">${cubeLevel.description!''}</textarea>
							</div>
						</div>
					</div>
					 -->
				</div>
			</div>
		</div>

		<div class="layui-form-button">
			<div class="layui-button-block">
				<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>
</div>

<script>
	$(document).ready(function(){
		if("日期" == $('#type option:selected').text()){
			$("#leveltype").removeAttr("disabled");
		}else{
			$('#leveltype').attr("disabled", "disabled");
		}
	})
	/* $('#fktable').change(function(){
		loadURL('/apps/report/cubelevel/fktableid.html?tableid='+$('#fktable option:selected').attr("idval"), '#fktableiddiv');
	}) */
	$('#type').change(function(){
		if("日期" == $('#type option:selected').text()){
			$("#leveltype").removeAttr("disabled");
		}else{
			$('#leveltype').attr("disabled", "disabled");
		}
	})
	layui.use('form', function() {
		var form = layui.form();
		form.render(); //更新全部
	});
	layui.use('element', function(){
		var element = layui.element();
	});
	$('#attributedemo').on("click",function(){
		if($('#attribute').val() == ""){
			$('#attribute').val($('#attributetext').text());
		}else{
			top.layer.alert('属性已有内容', {icon: 1});
		}
		return false ;
	});
</script>
<script type="text/html" id="attributetext"><KeyExpression>
	<SQL>
		
	</SQL>
</KeyExpression>
</script>