$(function(){ var fieldtype=$(".fieldtype").val(); fieldtype_set(fieldtype); var formtype=$(".formtype").val(); formtype_set(formtype); $(".fieldtype").change(function(){ fieldtype_set($(this).val()); }) $(".formtype").change(function(){ formtype_set($(this).val()); }) }) //字段类型 function fieldtype_set(val){ if(val=="varchar"||val=="char"||val=="tinyint"||val=="smallint"||val=="int"||val=="bigint"||val=="float"){ $(".fieldlen_i").show(); }else{ $(".fieldlen_i").hide(); } } //表单类型 function formtype_set(val){ if(val=="text"||val=="password"||val=="select"||val=="file"||val=="date"){ $(".formtype_i_w").show(); $(".formtype_i_h").hide(); }else if(val=="textarea"||val=="editor"){ $(".formtype_i_w").show(); $(".formtype_i_h").show(); }else{ $(".formtype_i_w").hide(); $(".formtype_i_h").hide(); } //隐藏或显示select_tip if(val=="select"||val=="radio"||val=="checkbox"){ $(".select_tip").show(); }else{ $(".select_tip").hide(); } //显示隐藏,上传图片的时候自动压缩图片尺寸 if(val=="editor"||val=="image"||val=="morepic"){ $(".formtype_i_imgw").show(); $(".formtype_i_imgh").show(); }else{ $(".formtype_i_imgw").hide(); $(".formtype_i_imgh").hide(); } } //模型里选择字段 $(function(){ $.uniform.update($("input[name='name[]']").prop("checked", true)); $(".thischeck_all").click(function(){ var y=$(this).attr("val"); var objname=$(this).attr("objname"); if(y==0){ $.uniform.update($("input[name='"+objname+"[]']").prop("checked", false)); y=1; }else if(y==1){ $.uniform.update($("input[name='"+objname+"[]']").prop("checked", true)); y=0; } $(this).attr("val",y); }) })