123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338 |
- {include file="public/layout" /}
- <body style="background-color: #FFF; overflow: auto;">
- <div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
- <div id="append_parent"></div>
- <div id="ajaxwaitid"></div>
- <div class="page" style="box-shadow:none;">
-
- <form class="form-horizontal" id="post_form" action="{:url('Form/attribute_edit')}" method="post" onsubmit="return false;">
- <div class="ncap-form-default">
- <dl class="row">
- <dt class="tit">
- <label for="typeid"><em>*</em>所属表单</label>
- </dt>
- <dd class="opt">
- {$formdata['form_name']|default='该表单不存在'}
- <input type="hidden" name="typeid" id="typeid" value="{$field.typeid|default=''}">
- <span class="err" id="err_typeid" style="color:#F00; display:none;"></span>
- <p class="notic"></p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label for="ac_name"><em>*</em>字段名称</label>
- </dt>
- <dd class="opt">
- <input type="text" name="attr_name" value="{$field.attr_name}" id="attr_name" class="input-txt" autocomplete="off">
- <span class="err" id="err_attr_name" style="color:#F00; display:none;"></span>
- <p class="notic"></p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label for="attr_input_type"><em>*</em>字段类型</label>
- </dt>
- <dd class="opt">
- {if condition="$main_lang == $admin_lang || !empty($global['language_split'])"}
- {volist name='$attrInputTypeArr' id='vo'}
- <div style="width: 150px; float: left;">
- <label><input type="radio" name="attr_input_type" value="{$key}" {eq name="$field.attr_input_type" value="$key"} checked="checked" {/eq}>{$vo}</label>
- </div>
- {if condition="$i % 4 == 0"}<br/>{/if}
- {/volist}
- <span class="err" id="err_attr_input_type" style="color:#F00; display:none;"></span>
- <p class="notic"></p>
- <p class="red {if condition="!in_array($field.attr_input_type, [6,7])"} none {/if}" id="validate_type"><br/>前台表单输入框的格式验证标签调用,<a href="javascript:void(0);" onclick="click_to_eyou_1575506523('https://www.eyoucms.com/plus/view.php?aid=8973&origin_eycms=1','标签调用');">请点击这里查看教程</a></p>
- {else /}
- {volist name='$attrInputTypeArr' id='vo'}
- {eq name="$field.attr_input_type" value="$key"}
- {$vo}
- <input type="hidden" name="attr_input_type" value="{$key}">
- {/eq}
- {/volist}
- {/if}
- </dd>
- </dl>
- <dl class="row attr_input_type2 {notin name='field.attr_input_type' value='1,3,4'}none{/notin}">
- <dt class="tit">
- <label for="attr_values"><em>*</em>可选值列表</label>
- </dt>
- <dd class="opt">
- <textarea rows="10" cols="30" name="attr_values" id="attr_values" class="input-txt" style="height:100px;" placeholder="一行代表一个可选值" onkeyup="this.value=this.value.replace(/[\|]/g,'');" onpaste="this.value=this.value.replace(/[\|]/g,'');">{$field.attr_values}</textarea>
- <span id="err_attr_values" class="err" style="color:#F00; display:none;"></span>
- <p class="notic">一行代表一个可选值</p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label>后台列表显示</label>
- </dt>
- <dd class="opt">
- <div class="onoff">
- <label for="is_showlist1" class="cb-enable {eq name='$field.is_showlist' value='1'}selected {/eq}" id="is_showlist1_label" data-is_showlist="1" onclick="ajax_attribute_show(this);">显示</label>
- <input id="is_showlist1" name="is_showlist" value="1" type="radio" {eq name='$field.is_showlist' value='1'}checked="checked"{/eq}>
-
- <label for="is_showlist0" class="cb-disable {eq name='$field.is_showlist' value='0'}selected {/eq}" id="is_showlist0_label" data-is_showlist="0" onclick="ajax_attribute_show(this);">隐藏</label>
- <input id="is_showlist0" name="is_showlist" value="0" type="radio" {eq name='$field.is_showlist' value='0'}checked="checked"{/eq}>
- </div>
-
- <span class="err"></span>
- <p class="notic">默认在列表显示前4个字段,全部字段可点击查看</p>
- </dd>
- </dl>
- <div id='region_div' {neq name="$field.attr_input_type" value="9"}style="display: none;"{/neq}>
- <dl class="row">
- <dt class="tit">
- <label for="region"><em>*</em>区域选择</label>
- </dt>
- <dd class="opt">
- <select id="province" onchange="GetRegionData(this,'province');">
- <option value="-1">请选择</option>
- {volist name='$Province' id='P_V'}
- <option {if condition="$P_V.id == $region.parent_id"} selected {/if} value="{$P_V.id}">{$P_V.name}</option>
- {/volist}
- </select>
-
- <span id='CityId'>
- <select id="city" onchange="GetRegionData(this,'city');">
- <option value="{$region.parent_id}">请选择</option>
- {volist name='$City' id='C_V'}
- <option {if condition="$C_V.id == $region.region_id"} selected {/if} value="{$C_V.id}">{$C_V.name}</option>
- {/volist}
- </select>
- </span>
-
- <span class="err"></span>
- <p class="notic"></p>
- </dd>
- <input type="hidden" id="GetRegionDataUrl" value="{:url('Field/ajax_get_region_data')}">
- <input type="hidden" name="region_data[region_id]" id="RegionId" value="{$region.region_id}">
- </dl>
-
- <dl class="row">
- <dt class="tit">
- <label><em>*</em>默认值</label>
- </dt>
- <dd class="opt">
- <textarea rows="5" cols="60" name="region_data[region_names]" id="region_names" readonly='readonly' placeholder="这里会自动区域选择之后的下级区域列表" style="height:110px; background-color: #f5f5f5;">{$region.region_names}</textarea>
- <span class="err"></span>
- <p class="notic">这里会自动区域选择之后的下级区域列表</p>
- </dd>
- <input type="hidden" name="region_data[region_ids]" id='region_ids' value='{$region.region_ids}' style="width: 100%;">
- </dl>
- </div>
- <dl class="row">
- <dt class="tit">
- <label>前台必填</label>
- </dt>
- <dd class="opt">
- <div class="onoff">
- <label for="required1" class="cb-enable {eq name='$field.required' value='1'}selected {/eq}" >是</label>
- <input id="required1" name="required" value="1" type="radio" {eq name='$field.required' value='1'}checked="checked"{/eq}>
-
- <label for="required0" class="cb-disable {eq name='$field.required' value='0'}selected {/eq}">否</label>
- <input id="required0" name="required" value="0" type="radio" {eq name='$field.required' value='0'}checked="checked"{/eq}>
- </div>
-
- <span class="err"></span>
- <p class="notic">用于控制前台用户提交是否必填验证</p>
- </dd>
- </dl>
- <dl class="row" id="realValidate" {if condition="!in_array($field.attr_input_type, [6])"} style="display: none;" {/if}>
- <dt class="tit"> <label>真实验证</label> </dt>
- <dd class="opt">
- <div class="onoff">
- <label for="real_validate1" class="cb-enable {eq name='$field.real_validate' value='1'} selected {/eq}" >是</label>
- <input id="real_validate1" name="real_validate" value="1" type="radio" {eq name='$field.real_validate' value='1'}checked="checked"{/eq}>
- <label for="real_validate0" class="cb-disable {eq name='$field.real_validate' value='0'} selected {/eq}">否</label>
- <input id="real_validate0" name="real_validate" value="0" type="radio" {eq name='$field.real_validate' value='0'}checked="checked"{/eq}>
- </div>
-
- <span class="err"></span>
- <p class="notic">用于控制前台用户提交的内容是否进行真实验证</p>
- <p style="line-height: 1;" class="red {if condition="!in_array($field.attr_input_type, [6,7])"} none {/if}" id="real_validate_type"><br/>前台表单手机验证码调用标签,<a href="javascript:void(0);" onclick="click_to_eyou_1575506523('https://www.eyoucms.com/plus/view.php?aid=28608&origin_eycms=1','标签调用');">请点击这里查看教程</a></p>
- </dd>
- </dl>
- <div class="bot">
- <input type="hidden" name="attr_id" value="{$field.attr_id}">
- <a href="JavaScript:void(0);" onclick="check_submit('post_form');" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
- </div>
- </div>
- </form>
- </div>
- <script type="text/javascript">
- $(function(){
- // 判断是否隐藏第二级地区选择栏
- var parent_array = {$parent_array};
- if (parent_array) {
- var region_id = $('#RegionId').val();
- if (0 <= $.inArray(region_id, parent_array)) {
- $('#CityId').hide();
- }
- }
-
- $('input[name=attr_input_type]').click(function(){
- var val = parseInt($(this).val());
- $('#validate_type').hide();
- $('#real_validate_type').hide();
- $('#realValidate').hide();
- if (-1 < $.inArray(val, [1,3,4])) {
- $('.attr_input_type2').show();
- } else {
- $('.attr_input_type2').hide();
- if (-1 < $.inArray(val, [6,7])) {
- $('#validate_type').show();
- $('#real_validate_type').show();
- // 如果点击的是手机号码字段则执行
- if (val == 6) $('#realValidate').show();
- }
- }
- if (9 == val) {
- $('#region_div').show();
- $('#dl_dfvalue').hide();
- } else {
- $('#dl_dfvalue').show();
- ClearAreaData();
- }
- });
- });
- // 当切换其他类型时清空所有关于区域选择的数据
- function ClearAreaData(){
- $('#region_div').hide();
- $('#RegionId').val('');
- $('#region_dfvalue').empty();
- }
-
- // 获取联动地址
- function GetRegionData(t,type){
- var parent_id = $(t).val();
- if(!parent_id){
- return false;
- }
-
- var url = $('#GetRegionDataUrl').val();
- $.ajax({
- url: url,
- data: {parent_id:parent_id,_ajax:1},
- type:'post',
- dataType:'json',
- success:function(res){
- // 判断是否隐藏第二级地区选择栏
- if (0 <= $.inArray(parent_id, res.parent_array)) {
- $('#CityId').hide();
- }else{
- $('#CityId').show();
- }
- // 加载城市名称数据到textarea
- $('#region_names').empty().html(res.region_names);
- // 加载城市ID数据到input
- $('#region_ids').val(res.region_ids);
- // 加载ID到input
- $('#RegionId').val(parent_id);
- // 输出下一级城市选项
- if ('province' == type) {
- res = '<option value='+parent_id+'>请选择</option>'+ res.region_html;
- $('#city').empty().html(res);
- }
- },
- error : function(e) {
- layer.closeAll();
- showErrorAlert(e.responseText);
- }
- });
- }
- var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- /**
- * ajax 提交字段 到后台去验证然后回到前台提示错误
- * 验证通过后,再通过 form 自动提交
- */
- function check_submit(form_id)
- {
- if ($('#typeid').val() == 0) {
- showErrorMsg('请选择表单…!');
- $('#typeid').focus();
- return false;
- }
- if($.trim($('input[name=attr_name]').val()) == ''){
- showErrorMsg('字段名称不能为空!');
- $('input[name=attr_name]').focus();
- return false;
- }
- var attr_input_type = parseInt($('input[name=attr_input_type]:checked').val());
- if (-1 < $.inArray(attr_input_type, [1,3,4]) && $.trim($('#attr_values').val()) == '') {
- showErrorMsg('可选值列表不能为空!');
- $('#attr_values').focus();
- return false;
- }
-
- layer_loading('正在处理');
- $.ajax({
- type : "POST",
- url : "{:url('Form/attribute_edit', ['_ajax'=>1])}",
- data : $('#'+form_id).serialize(),// 你的formid
- dataType: "JSON",
- success: function(res) {
- layer.closeAll();
- if(res.status == 1)
- {
- var _parent = parent;
- _parent.layer.close(parentObj);
- if(res.hasOwnProperty('data')){
- if(res.data.hasOwnProperty('url')){
- _parent.layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
- _parent.gourl(res.data.url);
- });
- }else{
- _parent.layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
- _parent.window.location.reload();
- });
- }
- }else{
- _parent.layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
- _parent.window.location.reload();
- });
- }
- return true;
- } else {
- showErrorMsg(res.msg);
- return false;
- }
- },
- error: function(e) {
- layer.closeAll();
- showErrorAlert(e.responseText);
- return false;
- }
- });
- }
-
- function ajax_attribute_show(obj) {
- var is_showlist = $(obj).attr('data-is_showlist');
- var typeid = $('#typeid').val();
- if (typeid == 0) {
- showErrorMsg('请选择表单…!');
- $('#typeid').focus();
- return false;
- }
- $.ajax({
- type : 'post',
- url : "{:url('Field/ajax_attribute_show')}",
- data : {typeid:typeid,is_showlist:is_showlist, _ajax:1},
- dataType : 'json',
- success : function(res){
- if (res.code != 1) {
- $('#is_showlist1_label').removeClass('selected');
- $('#is_showlist0_label').addClass('selected');//添加一个class
- $("input:radio[name=is_showlist]").eq(0).attr("checked",false);
- $("input:radio[name=is_showlist]").eq(1).attr("checked",true);
- showErrorAlert(res.msg);
- }
- },
- error:function(e){
- showErrorAlert(e.responseText);
- }
- });
- }
- </script>
-
- {include file="public/footer" /}
|