<?php /*a:3:{s:64:"/www/wwwroot/btn.millet-mirth.com/view/admin/tablefield/add.html";i:1640827912;s:60:"/www/wwwroot/btn.millet-mirth.com/view/admin/common/top.html";i:1625466448;s:63:"/www/wwwroot/btn.millet-mirth.com/view/admin/common/bottom.html";i:1629163316;}*/ ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title><?php echo config('common.CMS_NAME'); ?></title>
<link rel="stylesheet" href="/static/tqcms/css/common.css">
<link rel="stylesheet" href="/static/tqcms/layui/css/layui.css"><!--layui css-->
<link rel="stylesheet" href="/static/tqcms/css/skin.css">
<script src="/static/tqcms/js/jquery.js"></script>
</head>
<body>

<div class="iframe_content">
	<div class="iframe_add">
    	<form action="" class="layui-form" name="TQform" id="TQform" method="post" onsubmit="return TQsubmit();">
        <input name="table" type="hidden" value="<?php echo htmlentities($table_name); ?>" />
        <input name="pid" type="hidden" value="<?php echo htmlentities($pid); ?>" />
    	<ul>
            <li><label class="layui-form-label">中文名称</label><input type="text" name="field_cn_name" value="" placeholder="" autocomplete="off" class="layui-input"></li>
            <li><label class="layui-form-label">字段名称</label><input type="text" name="field_name" value="" placeholder="" autocomplete="off" class="layui-input"></li>
            <li>
            	<label class="layui-form-label">字段模块</label>
                <div class="layui-input-block layui-pid table_field_add">
                    <select name="field_mk" lay-filter="field_mk">
                        <?php if(is_array($field_list['FIELD_ARRAY']) || $field_list['FIELD_ARRAY'] instanceof \think\Collection || $field_list['FIELD_ARRAY'] instanceof \think\Paginator): $i = 0; $__LIST__ = $field_list['FIELD_ARRAY'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                        <option value="<?php echo htmlentities($v); ?>" data-char="<?php echo htmlentities($field_list['FIELD_CHAR_ARRAY'][$key]); ?>" data-num="<?php echo htmlentities($field_list['FIELD_NUM_ARRAY'][$key]); ?>"><?php echo htmlentities($v); ?></option>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                    </select>
                </div>
            </li>
            <li><label class="layui-form-label">字段类型</label><input type="text" name="field_type" value="<?php echo htmlentities($field_list['FIELD_CHAR_ARRAY'][0]); ?>" autocomplete="off" class="layui-input"></li>
            <li><label class="layui-form-label">字段长度</label><input type="text" name="field_num" value="<?php echo htmlentities($field_list['FIELD_NUM_ARRAY'][0]); ?>" autocomplete="off" class="layui-input"></li>
            <li><label class="layui-form-label">字段默认</label><input type="text" name="field_content" value="" placeholder="默认信息或配置" autocomplete="off" class="layui-input"></li>

        </ul>
        </form>
    </div>
</div>

<div class="iframe_foot">
<input name="" type="submit" onclick="TQsubmit();" class="layui-btn" />　　
<input name="" type="button" value="关闭" onclick="open_iframe_close();" class="layui-btn layui-btn-danger" />
</div>
<script src="/static/tqcms/layui/layui.js"></script><!--layui js-->
<script src="/static/tqcms/layui/laytq.js"></script><!--layui js-->
<script src="/static/tqcms/js/common.js"></script>
<script src="/static/tqcms/js/md5.js"></script>
<script src="/static/tqcms/js/url.js"></script>
</body>
</html>
<script>
function TQsubmit(){
	$.post('insert',$("#TQform").serialize(),function(data){
		console.log(data);
		if(data.type==2){
			layer.msg(data['msg'], {icon:2,time:1000});
		}else{
			layer.msg(data['msg'], {icon:1,time:1000});
			$("body",parent.document).find('#open_iframe').val(1);
			setTimeout(function(){ window.location.reload(); },1500);
		}
    });
	return false;
}

layui.use('table', function(){
  var form = layui.form;

form.on('select(field_mk)', function(data){
	var t=$(data.elem).find("option:selected");
	var data_char=t.attr('data-char');
	var data_num=t.attr('data-num');
	$('input[name="field_type"]').val(data_char);
	$('input[name="field_num"]').val(data_num);
});


});
</script>
