add.html 10.7 KB
<!DOCTYPE html>
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>后台管理系统</title>
<meta name="keywords" content="">
<meta name="description" content="">

<link rel="stylesheet" type="text/css" href="__PUB__style/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="__PUB__style/bootstrap-responsive.min.css">
<link rel="stylesheet" type="text/css" href="__PUB__style/pp.css">
<style type="text/css">
.input-xxlarge{ margin-bottom: 0px;}
.long{ width: 530px;}
.input-xxlarge1 {margin-bottom: 0px;}
td span{padding-left:8px; color:#ff0000;}
.d_value table td{border:none; padding:0;}
.d_value table td a{padding:0 6px; font-size:23px; font-weight:bold; text-decoration:none; cursor:pointer;}
</style>
<script type="text/javascript" src="__PUB__js/bootstrap.min.js"></script>
<script type="text/javascript" src="__PUB__js/jquery.min.js"></script>
</head>
<body style="margin: 10px 0px;">
<div style="margin:0 auto; width:98%;">
	<form action="__URL__/add" name="configadd" method="post">
	<table class="table table-condensed table-bordered table-hover">
	<tbody>
			<tr>
				<th colspan="4" class="pp_1">添加字段信息<span><a href="<{:U('index')}>">返回</a></span></th>
			</tr>
		
			<tr>
				<td class="w_p_15 text_right"><span class='red'>*</span>字段名</td>
				<td colspan="3"><input type="text" name="name" style='width:30%' /><span>例如:name</span></td> 
			</tr>
			<tr>   
				<td class="text_right"><span class='red'>*</span>字段说明</td>
				<td colspan="3"><input type="text" name="description" style='width:30%' /><span>例如:姓名</span></td>
			</tr>
			<tr>
				<td class="text_right">备注说明</td>
				<td colspan="3">
					<input type="text" name="note" style='width:30%' />
				</td>
			</tr>
			<tr id="ftype">
				<td class="text_right"><span class='red'>*</span>字段类型</td>
				<td colspan="3">
					<input type="radio" name="type" value='string' id='string' checked/>&nbsp;<label for="string">文本</label> 
					<input type="radio" name="type" value='bstring'id='bstring'/>&nbsp;<label for="bstring">多行文本</label> 
					<input type="radio" name="type" value='bool' id='bool'/>&nbsp;<label for="bool">布尔(Y/N) </label> 
					<input type="radio" name="type" value='number' id='number'/>&nbsp;<label for="number">数字</label>
					<input type="radio" name="type" value='t_extarea' id='t_extarea'/>&nbsp;<label for="t_extarea">文本域</label>
					<input type="radio" name="type" value='s_elect' id='s_elect'/>&nbsp;<label for="s_elect">下拉列表</label>
					<input type="radio" name="type" value='c_heckbox' id='c_heckbox'/>&nbsp;<label for="c_heckbox">多选框</label>
					<input type="radio" name="type" value='r_adio' id='r_adio'/>&nbsp;<label for="r_adio">单选框</label>
				</td>
			</tr>
			<tr class="isdate">
				<td class="text_right">调用日期组件</td>
				<td colspan="3">
					<input type="radio" name="isdate" value="0" checked />否 <input type="radio" name="isdate" value="1" />
				</td>
			</tr>
			<tr class="isupfile">
				<td class="text_right">调用上传组件</td>
				<td colspan="3">
					<input type="radio" name="upfile" value="0" checked />否 <input type="radio" name="upfile" value="1" />图片 <input type="radio" name="upfile" value="2" />文件
				</td>
			</tr>
			<tr class="text_right">
				<td class="text_right">调用JS组件</td>
				<td colspan="3">
					<select id="isjs" name="isjs">
						<option value="" selected>无JS组件</option>
						<volist name="jsarr" id='cv' key='ck'>
							<option value='<{$ck}>'><{$cv}></option>
						</volist>
					</select>
				</td>
			</tr>
			<tr class="istags">
				<td class="text_right">调用标签组件</td>
				<td colspan="3">
					<input type="radio" name="istags" value="0" checked />否 <input type="radio" name="istags" value="1" />
				</td>
			</tr>
			<tr>
				<td class="text_right">前台整行显示</td>
				<td colspan="3">
					<input type="radio" name="fline" value="2" checked />是 <input type="radio" name="fline" value="1" />
				</td>
			</tr>
			<tr>
				<td class="text_right">是否在检索中显示</td>
				<td colspan="3"><input type="radio" name="issearch" value="1" />是 <input type="radio" name="issearch" value="2" checked /></td>
			</tr>
			<tr>
				<td class="text_right">是否在导航中显示</td>
				<td colspan="3"><input type="radio" name="isheader" value="1" />是 <input type="radio" name="isheader" value="2"  checked /></td>
			</tr>
			<tr>
				<td class="text_right">是否必填</td>
				<td colspan="3"><input type="radio" name="required" value="1" checked />必填 <input type="radio" name="required" value="2" />非必填</td>
			</tr>
			<tr>
				<td class="text_right">资料填报列表是否显示</td>
				<td class="w_p_25"><input type="radio" name="isshow1" value="1" checked />显示 <input type="radio" name="isshow1" value="0" />不显示</td>
				<td class="text_right w_p_15">资料填报列表显示宽度</td>
				<td ><input type="text" name="width1" style='width:15%' /><span style="color:#000">px</span></td>
			</tr>
			<tr>
				<td class="text_right">资料审核列表是否显示</td>
				<td ><input type="radio" name="isshow2" value="1" checked />显示 <input type="radio" name="isshow2" value="0" />不显示</td>
				<td class="text_right w_p_15">资料审核列表显示宽度</td>
				<td ><input type="text" name="width2" style='width:15%' /><span style="color:#000">px</span></td>
			</tr>
			<tr>
				<td class="text_right">资料检索列表是否显示</td>
				<td ><input type="radio" name="isshow3" value="1" checked />显示 <input type="radio" name="isshow3" value="0" />不显示</td>
				<td class="text_right w_p_15">资料检索列表显示宽度</td>
				<td ><input type="text" name="width3" style='width:15%' /><span style="color:#000">px</span></td>
			</tr>
			<tr>
				<td colspan='4' style="padding-left:30%">
					<input type="submit" name="submit" value=" 保存字段 " class="coolbg np" />
				</td>  
			</tr>
	</tbody>
	</table>
	</form>
</div>

</body>
</html>
<script>
	function checkType(){
		var t_val=$(':input[name=type]:checked').val();
		if($('span.datenote').length>0) $('span.datenote').remove();	//去掉 多行调用日期控件添加备注
		if($('span.upfilenote').length>0) $('span.upfilenote').remove();	//去掉 多行调用上传控件添加备注
		switch(t_val){
			case 'bstring':
				//行数:<input type="text" name="rownum" value="" class="width_60" /> 
				if($('#rowcol').length<=0) $('#ftype').after('<tr id="rowcol"><td class="w_p_10 text_right">行/列数</td><td class="w_p_39">列数:<input type="text" name="colnum" value="" class="width_60" /></td><td class="w_p_10 text_right">列标题</td><td><input type="text" name="ctitle" value="" style="width:60%" /><span>多列,使用“#”分隔</span></td></tr>');	//行数列数
				$('tr.d_value').remove();	//移除默认值
				$('tr.isdate').css('display','table-row');	//调用日期制作
				$('tr.isupfile').css('display','table-row');	//调用上传控件
				if($('span.datenote').length<=0)$('tr.isdate td:eq(1)').append('<span class="datenote">(根据列标题匹配关键词"时间"、"日期"来调用控件)</span>');	//多行时 调用日期控件添加备注
				if($('span.upfilenote').length<=0)$('tr.isupfile td:eq(1)').append('<span class="upfilenote">(根据列标题匹配关键词"上传"来调用控件)</span>');	//多行时 调用上传控件添加备注
				$('tr.istags').css('display','none').children('td').children(':input[name="istags"]').removeAttr('checked').eq(0).prop('checked','checked');	//调用标签控件
				break;
			case 's_elect':
			case 'c_heckbox':
			case 'r_adio':
				$('#rowcol').remove();	//移除行数列数
				if($('.d_value').length<=0) $('#ftype').after("<tr class='d_value'><td class=\"text_right\">默认值</td><td colspan='3'><table><tr><td><input type=\"text\" at_pp=\"d_value\" name=\"d_value[]\" value=\"\" /></td><td><a class=\"dv1\">+</a></td></tr></table></td></tr>");	//默认值
				$('tr.isdate').css('display','none').children('td').children(':input[name="isdate"]').removeAttr('checked').eq(0).prop('checked','checked');	//调用日期制作
				$('tr.isupfile').css('display','none').children('td').children(':input[name="upfile"]').removeAttr('checked').eq(0).prop('checked','checked');	//调用上传控件
				// $(':input[name="isdate"][value="0"]').prop('checked','checked');	//隐藏调用日期控件,并默认选中不是按钮
				// $(':input[name="upfile"][value="0"]').prop('checked','checked');	//隐藏调用上传控件,并默认选中不是按钮
				$('tr.istags').css('display','none').children('td').children(':input[name="istags"]').removeAttr('checked').eq(0).prop('checked','checked');	//调用标签控件
				break;
			case 'string':
				$('#rowcol').remove();	//移除行数列数
				$('tr.d_value').remove();	//移除默认值
				$('tr.isdate').css('display','table-row');	//调用日期制作
				$('tr.isupfile').css('display','table-row');	//调用上传控件
				$('tr.istags').css('display','table-row');	//调用上传控件
				break;
			case 'bool':
			case 'number':
			case 't_extarea':
				$('#rowcol').remove();	//移除行数列数
				$('tr.d_value').remove();	//移除默认值
				$('tr.isdate').css('display','none').children('td').children(':input[name="isdate"]').removeAttr('checked').eq(0).prop('checked','checked');	//调用日期制作
				$('tr.isupfile').css('display','none').children('td').children(':input[name="upfile"]').removeAttr('checked').eq(0).prop('checked','checked');	//调用上传控件
				// $(':input[name="isdate"][value="0"]').prop('checked','checked');//隐藏调用日期控件,并默认选中不是按钮
				// $(':input[name="upfile"][value="0"]').prop('checked','checked');//隐藏调用上传控件,并默认选中不是按钮
				$('tr.istags').css('display','none').children('td').children(':input[name="istags"]').removeAttr('checked').eq(0).prop('checked','checked');	//调用标签控件
				break;
			/*default:
				$('#rowcol').html('');	//行数列数清空
				$('#ftype + tr.d_value').remove();	//移除默认值*/
		}
	}
	$(function(){
		checkType();
		$(':input[name=type]').click(function(){
			checkType();
		});
		$('.table').delegate('a.dv1','click',function(){
			// var dv=$(':input[at_pp="d_value"]').length + 1;
			$(this).parent().parent().parent().append('<tr><td><input type=\"text\" at_pp=\"d_value\" name=\"d_value[]\" value=\"\" /></td><td><a onclick=\"javascript:void(0);\" class=\"dv2\">-</a></td></tr>');
		});
		$('.table').delegate('a.dv2','click',function(){
			$(this).parent().parent().remove();
		});
	});
</script>