<?php /*a:4:{s:78:"E:\phpstudy_pro\WWW\data\hkcms\template\admin\adminlte\routine\config\add.html";i:1715617489;s:74:"E:\phpstudy_pro\WWW\data\hkcms\template\admin\adminlte\common\default.html";i:1715617489;s:71:"E:\phpstudy_pro\WWW\data\hkcms\template\admin\adminlte\common\meta.html";i:1715617489;s:73:"E:\phpstudy_pro\WWW\data\hkcms\template\admin\adminlte\common\script.html";i:1715617489;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta name="csrf-token" content="<?php echo token(); ?>">

    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="referrer" content="never">
<meta name="renderer" content="webkit">
<title><?php echo $site['title']; ?> - <?php echo lang("Backstage panel"); ?></title>

<link rel="Shortcut Icon" href="<?php echo $site['favicon']; ?>?v=<?php echo env('APP_DEBUG')?time():$site['version']; ?>" type="image/x-icon" />

<!-- Font Awesome 5.13.0 字体图标库 -->
<link rel="stylesheet" href="/static/libs/fontawesome-free/css/all.min.css">
<!-- AdminLTE v3.2.0 | Bootstrap v4.6.0 CSS框架 -->
<link rel="stylesheet" href="/static/module/admin/adminlte/css/adminlte.css?v=<?php echo env('APP_DEBUG')?time():$site['version']; ?>">
<link rel="stylesheet" href="/static/module/admin/adminlte/css/common.css?v=<?php echo env('APP_DEBUG')?time():$site['version']; ?>">

<script type="text/javascript">
    window.Config = <?php echo json_encode($site); ?>;
    window.Lang = <?php echo json_encode($tempLang); ?>;
    window.Tpl = <?php echo json_encode($Tpl); ?>;
</script>

    <style>
        html,body,.wrapper {
            height: 100% !important;
        }
        .content {
            min-height: 100%;
            height: auto;
            padding-bottom: 20px;
            background-color: #f2f3f5;
        }
        .operatePage .card-footer {
            width: 100%;
            position: fixed;
            bottom: 0;
            z-index: 99;
        }
    </style>

    {__STYLE__}

</head>
<body class="sidebar-mini layout-top-nav overlayScrollbars" >

    <?php if(empty($popup)): ?>
    <!-- 子页 -->
    <div class="wrapper">
        <div class="content">
            <div class="container-fluid" style="padding-top: 16px">
                <style>
    .type-table {display: none;}
    .settings-item .row {
        margin: 0 0 8px 0;
    }
    .settings-item .row .row-form-label {
        padding-right: 0;
    }
</style>

<form role="form" action="" class="frm-operate" method="post">
    <div class="card card-primary">
        <div class="card-body">
            <div class="form-group row">
                <label class="col-sm-2 row-form-label"><?php echo lang('Type'); ?>: </label>
                <div class="col-sm-8">
                    <?php echo build_select('row[type]',config('base.form_type'),'',['id'=>'frm-form_type','class'=>'form-control']); ?>
                </div>
            </div>
            <div class="form-group row">
                <label for="frm-field_group" class="col-sm-2 row-form-label"><?php echo lang("Grouping"); ?>: </label>
                <div class="col-sm-8">
                    <input type="text" id="frm-field_group"
                           class="form-control selectpage"
                           name="row[group]"
                           value=""
                           data-select-only="true"
                           data-key-field="name"
                           data-pagination="false"
                           data-show-field="title"
                           data-multiple="false"
                           data-data="<?php echo url('/routine.config/fieldGroup'); ?>" placeholder="<?php echo lang('Please choose'); ?>">
                </div>
            </div>
            <div class="form-group row">
                <label for="frm-field_name" class="col-sm-2 row-form-label"><?php echo lang("Field"); ?>: </label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" id="frm-field_name" name="row[name]" placeholder="<?php echo lang('Only letters, numbers and underscores are supported'); ?>" data-rule="required">
                </div>
            </div>
            <div class="form-group row">
                <label for="frm-field_title" class="col-sm-2 row-form-label"><?php echo lang("Title"); ?>: </label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" id="frm-field_title" name="row[title]" placeholder="" data-rule="required">
                </div>
            </div>

            <!--动态下拉配置-->
            <div id="selectpage-setting"></div>
            <script type="text/html" id="selectpage-setting-html">
                <div class="form-group row">
                    <label class="col-sm-2 row-form-label"><?php echo lang("Config"); ?>: </label>
                    <div class="col-sm-8 ">
                        <div class="border rounded settings-item">
                            <div class="row">
                                <label class="col-sm-2 row-form-label"><?php echo __("Data source"); ?>: </label>
                                <div class="col-sm-10">
                                    <div class="radio-group">
                                        <div class="radio-item"><input type="radio" id="frm-data_list_type1" name="row[data_list][type]" value="url" checked><label for="frm-data_list_type1"><?php echo __("URL"); ?></label></div>
                                        <div class="radio-item"><input type="radio" id="frm-data_list_type2" name="row[data_list][type]" value="table"><label for="frm-data_list_type2"><?php echo __("Association Table"); ?></label></div>
                                    </div>
                                </div>
                            </div>

                            <section class="type-url">
                                <div class="row">
                                    <label for="frm-selectpage-url" class="col-sm-2 row-form-label"><?php echo __("URL"); ?>: </label>
                                    <div class="col-sm-10">
                                        <input id="frm-selectpage-url" type="text" class="form-control" name="row[data_list][url]">
                                    </div>
                                </div>
                                <div class="row">
                                    <label for="frm-selectpage-show-field" class="col-sm-2 row-form-label"><?php echo __("Show fields"); ?>: </label>
                                    <div class="col-sm-4">
                                        <input id="frm-selectpage-show-field" type="text" class="form-control" name="row[data_list][url-show-field]" placeholder="<?php echo __('Default'); ?>：title">
                                    </div>
                                    <label for="frm-selectpage-key-field" class="col-sm-2 row-form-label"><?php echo __("Storage field"); ?>: </label>
                                    <div class="col-sm-4">
                                        <input id="frm-selectpage-key-field" type="text" class="form-control" name="row[data_list][url-key-field]" placeholder="<?php echo __('Default'); ?>：id">
                                    </div>
                                </div>
                                <div class="row">
                                    <label for="frm-selectpage-search-field" class="col-sm-2 row-form-label"><?php echo __("Search field"); ?>: </label>
                                    <div class="col-sm-10"><input id="frm-selectpage-search-field" type="text" class="form-control" name="row[data_list][url-search-field]" placeholder="<?php echo __('Default'); ?>：title"></div>
                                </div>
                            </section>

                            <section class="type-table">
                                <div class="row">
                                    <label class="col-sm-2 row-form-label"><?php echo __("Datasheet"); ?>: </label>
                                    <div class="col-sm-10">
                                        <select id="J-selectpage-table" class="form-control" name="row[data_list][table]">
                                            <option value=""><?php echo lang('Please choose'); ?></option>
                                            <?php if(is_array($table) || $table instanceof \think\Collection || $table instanceof \think\Paginator): $i = 0; $__LIST__ = $table;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                            <option value="<?php echo $vo; ?>"><?php echo $vo; ?></option>
                                            <?php endforeach; endif; else: echo "" ;endif; ?>
                                        </select>
                                    </div>
                                </div>
                                <div class="row">
                                    <label class="col-md-2 row-form-label"><?php echo __("Show fields"); ?>: </label>
                                    <div class="col-md-4">
                                        <select class="form-control J-field" name="row[data_list][show-field]">
                                            <option value=""><?php echo lang('Please choose'); ?></option>
                                        </select>
                                    </div>
                                    <label class="col-md-2 row-form-label"><?php echo __("Storage field"); ?>: </label>
                                    <div class="col-md-4">
                                        <select class="form-control J-field" name="row[data_list][key-field]">
                                            <option value=""><?php echo lang('Please choose'); ?></option>
                                        </select>
                                        <input type="hidden" name="row[data_list][delete_time]" value="0">
                                    </div>
                                </div>
                                <div class="row">
                                    <label class="col-md-2 row-form-label" for="frm-search-field"><?php echo __("Search field"); ?>: </label>
                                    <div class="col-sm-10">
                                        <select class="form-control selectpicker J-field" id="frm-search-field" data-width="60%" data-max-options="3" name="row[data_list][search-field][]" multiple></select>
                                    </div>
                                </div>
                            </section>

                            <div class="row">
                                <label class="col-sm-2 row-form-label"><?php echo __("Query method"); ?>: </label>
                                <div class="col-sm-4">
                                    <input type="text" class="form-control" name="row[data_list][and-or]" placeholder="<?php echo __('Default'); ?>：and">
                                </div>
                                <label class="col-sm-2 row-form-label"><?php echo __("Weigh"); ?>: </label>
                                <div class="col-sm-4">
                                    <input type="text" class="form-control" name="row[data_list][order-by]" placeholder="id desc">
                                </div>
                            </div>
                            <div class="row">
                                <label class="col-sm-2 row-form-label"><?php echo __("Additional conditions"); ?>: </label>
                                <div class="col-sm-10">
                                    <div class="row mb-0">
                                        <div class="col-sm-5 row-form-label" style="text-align: left"><?php echo __('Field'); ?></div>
                                        <div class="col-sm-5 row-form-label" style="text-align: left"><?php echo __('Value'); ?></div>
                                    </div>
                                    <div class="" id="J-groups">
                                        <div class="row del1">
                                            <div class="col-sm-5">
                                                <input type="text" class="form-control" value="" name="row[data_list][param][]">
                                            </div>
                                            <div class="col-sm-5">
                                                <input type="text" class="form-control" value="" name="row[data_list][param][]">
                                            </div>
                                            <div class="col-sm-2 d-flex align-items-center">
                                                <a href="#" class="btn btn-default btn-xs btn-groups-del" data-class=".del1"><i class="fas fa-times"></i></a>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row mb-0">
                                        <div class="col-sm-12">
                                            <a href="#" class="btn btn-xs btn-default btn-groups"><i class="fas fa-plus"></i> <?php echo lang('Append'); ?></a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <label class="col-sm-2 row-form-label"><?php echo __("More options"); ?>: </label>
                                <div class="col-sm-10 d-flex">
                                    <label class="row-form-label d-flex align-items-center mr-1"><input type="checkbox" name="row[data_list][multiple]" value="1"><span class="ml-1"><?php echo __("Enable multiple selection"); ?></span></label>
                                    <label class="row-form-label d-flex align-items-center mr-1"><input type="checkbox" name="row[data_list][pagination]" value="1"><span class="ml-1"><?php echo __("Turn off pagination"); ?></span></label>
                                    <label class="row-form-label d-flex align-items-center mr-1"><input type="checkbox" name="row[data_list][select-only]" value="1"><span class="ml-1"><?php echo __("Select mode only"); ?></span></label>
                                    <label class="row-form-label d-flex align-items-center mr-1"><input type="checkbox" name="row[data_list][enable-lang]" value="1"><span class="ml-1"><?php echo __("Multilingual filter"); ?></span></label>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </script>
            <!--动态下拉配置结束-->

            <div class="form-group row">
                <label for="frm-default_value" class="col-sm-2 row-form-label"><?php echo lang("Defaults"); ?>: </label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" id="frm-default_value" name="row[value]">
                </div>
            </div>

            <div id="other-option"></div>

            <div class="form-group row">
                <label for="frm-tips" class="col-sm-2 row-form-label"><?php echo lang("Rule"); ?>: </label>
                <div class="col-sm-8">
                    <input type="text" id="frm-rules"
                           class="form-control selectpage"
                           name="row[rules]"
                           data-select-only="true"
                           data-key-field="name"
                           data-pagination="false"
                           data-show-field="title"
                           data-multiple="true"
                           data-data="<?php echo url('/cms.model_field/getRules'); ?>">
                </div>
            </div>
            <div class="form-group row">
                <label for="frm-tips" class="col-sm-2 row-form-label"><?php echo lang("Tips"); ?>: </label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" id="frm-tips" name="row[tips]">
                </div>
            </div>
            <div class="form-group row">
                <label for="frm-error_tips" class="col-sm-2 row-form-label"><?php echo lang("Error tips"); ?>: </label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" id="frm-error_tips" name="row[error_tips]">
                </div>
            </div>
            <div class="form-group row">
                <label for="frm-extend" class="col-sm-2 row-form-label"><?php echo __("HTML attr"); ?>: </label>
                <div class="col-sm-8">
                    <textarea class="form-control" id="frm-extend" name="row[extend]" rows="3" placeholder="<?php echo lang('Add or overlay HTML attributes, and separate multiple attributes with English commas.'); ?><?php echo lang('Example:'); ?>data-title=&quot;ceshi&quot;,class=&quot;form-control selectpage&quot;"></textarea>
                </div>
            </div>
        </div>
        <div class="card-footer">
            <div class="row justify-content-around">
                <div class="col-sm-8">
                    <button type="submit" class="btn btn-primary btn-submit"><?php echo __('Submit'); ?></button>
                    <button type="reset" class="btn btn-default"><?php echo __('Reset'); ?></button>
                </div>
            </div>
        </div>
    </div>
</form>

{block:script}
<script>
    require(['admin','form'], function (admin, Form) {
        $(function () {
            Form.api.init();
            $(document).on('change', '#frm-form_type', function (e) {
                if ($.inArray($(this).val(),['radio','checkbox','select','selects'])>-1) {
                    $('#other-option').html('<div class="form-group row" id="data_list">\n' +
                        '                    <label for="frm-data_list" class="col-sm-2 row-form-label"><?php echo lang("Option list"); ?>: </label>\n' +
                        '                    <div class="col-sm-8">\n' +
                        '                    <textarea class="form-control" id="frm-data_list" name="row[data_list]" rows="3" placeholder="" data-rule="required">key1|标题\n' +
                        'key2|标题</textarea>\n' +
                        '                    </div>\n' +
                        '                </div>');
                } else if ($.inArray($(this).val(), ['images','downfiles'])>-1) {
                    var html = '<div class="form-group row">\n' +
                        '                    <label for="frm-decimals" class="col-sm-2 row-form-label"><?php echo lang("Limit suffix"); ?>: </label>\n' +
                        '                    <div class="col-sm-8">\n' +
                        '                        <input type="text" class="form-control" name="row[setting][ext]" value="" placeholder="<?php echo lang('Limit the upload format,when empty,the attachment configuration will be used. Multiple suffixes are separated by "|"'); ?>">\n' +
                    '                    </div>\n' +
                    '                </div>';
                    html += '<div class="form-group row">\n' +
                        '                    <label for="frm-decimals" class="col-sm-2 row-form-label"><?php echo lang("Limit size"); ?>: </label>\n' +
                        '                    <div class="col-sm-8">\n' +
                        '                        <input type="number" class="form-control" name="row[setting][filesize]" value="" placeholder="<?php echo lang("When empty, the content of the attachment configuration will be used"); ?>"><div class="pt-1 pl-1"><span class="text-muted"><?php echo lang('Unit:Byte'); ?>(b)</span></div>\n' +
                    '                    </div>\n' +
                    '                </div>';
                    $('#other-option').html(html+'<div class="form-group row" id="max_number">\n' +
                        '                    <label for="frm-max_number" class="col-sm-2 row-form-label"><?php echo lang("Greatest amount"); ?>: </label>\n' +
                        '                    <div class="col-sm-8">\n' +
                        '                        <input type="number" class="form-control" id="frm-max_number" name="row[max_number]" value="" data-rule="required|digits">\n' +
                        '                    </div>\n' +
                        '                </div>');
                } else if ($.inArray($(this).val(),['downfile','image'])>-1) {
                    var html = '<div class="form-group row">\n' +
                        '                    <label for="frm-decimals" class="col-sm-2 row-form-label"><?php echo lang("Limit size"); ?>: </label>\n' +
                        '                    <div class="col-sm-8">\n' +
                        '                        <input type="number" class="form-control" name="row[setting][filesize]" value="" placeholder="<?php echo lang("When empty, the content of the attachment configuration will be used"); ?>"><div class="pt-1 pl-1"><span class="text-muted"><?php echo lang('Unit:Byte'); ?>(b)</span></div>\n' +
                    '                    </div>\n' +
                    '                </div>';
                    $('#other-option').html('<div class="form-group row">\n' +
                        '                    <label for="frm-decimals" class="col-sm-2 row-form-label"><?php echo lang("Limit suffix"); ?>: </label>\n' +
                        '                    <div class="col-sm-8">\n' +
                        '                        <input type="text" class="form-control" name="row[setting][ext]" value="" placeholder="<?php echo lang('Limit the upload format,when empty,the attachment configuration will be used. Multiple suffixes are separated by "|"'); ?> (png|jpg|zip)">\n' +
                    '                    </div>\n' +
                    '                </div>'+html);
                } else if ($(this).val()=='number') {
                    // $('#frm-length').val('');
                    // $('#other-option').html('<div class="form-group row" id="max_number">\n' +
                    //     '                    <label for="frm-decimals" class="col-sm-2 row-form-label"><?php echo lang("Decimal places"); ?>: </label>\n' +
                    //     '                    <div class="col-sm-8">\n' +
                    //     '                        <input type="number" class="form-control" id="frm-decimals" name="row[decimals]" value="0" data-rule="required|digits">\n' +
                    //     '                    </div>\n' +
                    //     '                </div>');
                } else if ($(this).val()=='array') {
                    $('#other-option').html('<div class="form-group row">\n' +
                        '                <label for="frm-key_name_alias" class="col-sm-2 row-form-label"><?php echo lang("Key name alias"); ?>: </label>\n' +
                        '                <div class="col-sm-8">\n' +
                        '                    <input type="text" class="form-control" id="frm-key_name_alias" name="row[key_name_alias]" value="<?php echo lang('Key name'); ?>">\n' +
                        '                </div>\n' +
                        '            </div>\n' +
                        '            <div class="form-group row">\n' +
                        '                <label for="frm-key_value_alias" class="col-sm-2 row-form-label"><?php echo lang("Key value name"); ?>: </label>\n' +
                        '                <div class="col-sm-8">\n' +
                        '                    <input type="text" class="form-control" id="frm-key_value_alias" name="row[key_value_alias]" value="<?php echo lang('Key value'); ?>">\n' +
                        '                </div>\n' +
                        '            </div>');
                } else if ($(this).val()=='selectpage') {
                    $('#other-option').html('');
                    $('#selectpage-setting').html($('#selectpage-setting-html').html());

                    Form.event.selectpicker($('.frm-operate'));
                } else {
                    $('#other-option').html('');
                }
            });

            // 动态下拉配置删除
            $(document).on('click','.btn-groups-del',function (e) {
                $($(this).data('class')).remove();
                e.preventDefault();
            });
            var item = 2;
            $(document).on('click','.btn-groups',function (e) {
                $('#J-groups').append('<div class="row mt-1 del'+item+'"><div class="col-sm-5">\n' +
                    '      <input type="text" class="form-control" value="" name="row[data_list][param][]">\n' +
                    '  </div>\n' +
                    '  <div class="col-sm-5">\n' +
                    '      <input type="text" class="form-control" value="" name="row[data_list][param][]">\n' +
                    '  </div>\n' +
                    '  <div class="col-sm-2 pt-1">\n' +
                    '      <a href="#" class="btn btn-default btn-xs btn-groups-del" data-class=".del'+item+'"><i class="fas fa-times"></i></a>\n' +
                    '  </div></div>');
                item++;
                e.preventDefault();
            });

            // 数据源值改变
            $(document).on('change', 'input[name="row[data_list][type]"]', function (e) {
                var val = $(this).val();
                if (val=='table') {
                    $('.type-url').hide();
                    $('.type-table').show();
                } else {
                    $('.type-url').show();
                    $('.type-table').hide();
                }
            });
            // 数据表更换事件
            $(document).on('change', '#J-selectpage-table', function (e) {
                var val = $(this).val();
                $.get('<?php echo url("/cms.model_field/getFields"); ?>'+'?t='+val,function (data) {
                    if (data.code==200) {
                        var html = '';
                        var is_delete_time = 0;
                        $.each(data.data.field, function (idx, val) {
                            if (val=='delete_time') {
                                is_delete_time = 1;
                            }
                            html += '<option value="'+val+'">'+val+'</option>';
                        })
                        $('select.J-field').html(html);
                        $('input[name="row[data_list][delete_time]"]').val(is_delete_time);
                        $('.selectpicker').selectpicker('refresh');
                    } else {
                        layer.msg(data.msg);
                    }
                })
            })

            $('#frm-form_type').trigger('change');
        })
    })
</script>
{/block:script}
            </div>
        </div>
    </div>

    <?php else: ?>
    <div class="operatePage">
        <style>
    .type-table {display: none;}
    .settings-item .row {
        margin: 0 0 8px 0;
    }
    .settings-item .row .row-form-label {
        padding-right: 0;
    }
</style>

<form role="form" action="" class="frm-operate" method="post">
    <div class="card card-primary">
        <div class="card-body">
            <div class="form-group row">
                <label class="col-sm-2 row-form-label"><?php echo lang('Type'); ?>: </label>
                <div class="col-sm-8">
                    <?php echo build_select('row[type]',config('base.form_type'),'',['id'=>'frm-form_type','class'=>'form-control']); ?>
                </div>
            </div>
            <div class="form-group row">
                <label for="frm-field_group" class="col-sm-2 row-form-label"><?php echo lang("Grouping"); ?>: </label>
                <div class="col-sm-8">
                    <input type="text" id="frm-field_group"
                           class="form-control selectpage"
                           name="row[group]"
                           value=""
                           data-select-only="true"
                           data-key-field="name"
                           data-pagination="false"
                           data-show-field="title"
                           data-multiple="false"
                           data-data="<?php echo url('/routine.config/fieldGroup'); ?>" placeholder="<?php echo lang('Please choose'); ?>">
                </div>
            </div>
            <div class="form-group row">
                <label for="frm-field_name" class="col-sm-2 row-form-label"><?php echo lang("Field"); ?>: </label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" id="frm-field_name" name="row[name]" placeholder="<?php echo lang('Only letters, numbers and underscores are supported'); ?>" data-rule="required">
                </div>
            </div>
            <div class="form-group row">
                <label for="frm-field_title" class="col-sm-2 row-form-label"><?php echo lang("Title"); ?>: </label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" id="frm-field_title" name="row[title]" placeholder="" data-rule="required">
                </div>
            </div>

            <!--动态下拉配置-->
            <div id="selectpage-setting"></div>
            <script type="text/html" id="selectpage-setting-html">
                <div class="form-group row">
                    <label class="col-sm-2 row-form-label"><?php echo lang("Config"); ?>: </label>
                    <div class="col-sm-8 ">
                        <div class="border rounded settings-item">
                            <div class="row">
                                <label class="col-sm-2 row-form-label"><?php echo __("Data source"); ?>: </label>
                                <div class="col-sm-10">
                                    <div class="radio-group">
                                        <div class="radio-item"><input type="radio" id="frm-data_list_type1" name="row[data_list][type]" value="url" checked><label for="frm-data_list_type1"><?php echo __("URL"); ?></label></div>
                                        <div class="radio-item"><input type="radio" id="frm-data_list_type2" name="row[data_list][type]" value="table"><label for="frm-data_list_type2"><?php echo __("Association Table"); ?></label></div>
                                    </div>
                                </div>
                            </div>

                            <section class="type-url">
                                <div class="row">
                                    <label for="frm-selectpage-url" class="col-sm-2 row-form-label"><?php echo __("URL"); ?>: </label>
                                    <div class="col-sm-10">
                                        <input id="frm-selectpage-url" type="text" class="form-control" name="row[data_list][url]">
                                    </div>
                                </div>
                                <div class="row">
                                    <label for="frm-selectpage-show-field" class="col-sm-2 row-form-label"><?php echo __("Show fields"); ?>: </label>
                                    <div class="col-sm-4">
                                        <input id="frm-selectpage-show-field" type="text" class="form-control" name="row[data_list][url-show-field]" placeholder="<?php echo __('Default'); ?>：title">
                                    </div>
                                    <label for="frm-selectpage-key-field" class="col-sm-2 row-form-label"><?php echo __("Storage field"); ?>: </label>
                                    <div class="col-sm-4">
                                        <input id="frm-selectpage-key-field" type="text" class="form-control" name="row[data_list][url-key-field]" placeholder="<?php echo __('Default'); ?>：id">
                                    </div>
                                </div>
                                <div class="row">
                                    <label for="frm-selectpage-search-field" class="col-sm-2 row-form-label"><?php echo __("Search field"); ?>: </label>
                                    <div class="col-sm-10"><input id="frm-selectpage-search-field" type="text" class="form-control" name="row[data_list][url-search-field]" placeholder="<?php echo __('Default'); ?>：title"></div>
                                </div>
                            </section>

                            <section class="type-table">
                                <div class="row">
                                    <label class="col-sm-2 row-form-label"><?php echo __("Datasheet"); ?>: </label>
                                    <div class="col-sm-10">
                                        <select id="J-selectpage-table" class="form-control" name="row[data_list][table]">
                                            <option value=""><?php echo lang('Please choose'); ?></option>
                                            <?php if(is_array($table) || $table instanceof \think\Collection || $table instanceof \think\Paginator): $i = 0; $__LIST__ = $table;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                            <option value="<?php echo $vo; ?>"><?php echo $vo; ?></option>
                                            <?php endforeach; endif; else: echo "" ;endif; ?>
                                        </select>
                                    </div>
                                </div>
                                <div class="row">
                                    <label class="col-md-2 row-form-label"><?php echo __("Show fields"); ?>: </label>
                                    <div class="col-md-4">
                                        <select class="form-control J-field" name="row[data_list][show-field]">
                                            <option value=""><?php echo lang('Please choose'); ?></option>
                                        </select>
                                    </div>
                                    <label class="col-md-2 row-form-label"><?php echo __("Storage field"); ?>: </label>
                                    <div class="col-md-4">
                                        <select class="form-control J-field" name="row[data_list][key-field]">
                                            <option value=""><?php echo lang('Please choose'); ?></option>
                                        </select>
                                        <input type="hidden" name="row[data_list][delete_time]" value="0">
                                    </div>
                                </div>
                                <div class="row">
                                    <label class="col-md-2 row-form-label" for="frm-search-field"><?php echo __("Search field"); ?>: </label>
                                    <div class="col-sm-10">
                                        <select class="form-control selectpicker J-field" id="frm-search-field" data-width="60%" data-max-options="3" name="row[data_list][search-field][]" multiple></select>
                                    </div>
                                </div>
                            </section>

                            <div class="row">
                                <label class="col-sm-2 row-form-label"><?php echo __("Query method"); ?>: </label>
                                <div class="col-sm-4">
                                    <input type="text" class="form-control" name="row[data_list][and-or]" placeholder="<?php echo __('Default'); ?>：and">
                                </div>
                                <label class="col-sm-2 row-form-label"><?php echo __("Weigh"); ?>: </label>
                                <div class="col-sm-4">
                                    <input type="text" class="form-control" name="row[data_list][order-by]" placeholder="id desc">
                                </div>
                            </div>
                            <div class="row">
                                <label class="col-sm-2 row-form-label"><?php echo __("Additional conditions"); ?>: </label>
                                <div class="col-sm-10">
                                    <div class="row mb-0">
                                        <div class="col-sm-5 row-form-label" style="text-align: left"><?php echo __('Field'); ?></div>
                                        <div class="col-sm-5 row-form-label" style="text-align: left"><?php echo __('Value'); ?></div>
                                    </div>
                                    <div class="" id="J-groups">
                                        <div class="row del1">
                                            <div class="col-sm-5">
                                                <input type="text" class="form-control" value="" name="row[data_list][param][]">
                                            </div>
                                            <div class="col-sm-5">
                                                <input type="text" class="form-control" value="" name="row[data_list][param][]">
                                            </div>
                                            <div class="col-sm-2 d-flex align-items-center">
                                                <a href="#" class="btn btn-default btn-xs btn-groups-del" data-class=".del1"><i class="fas fa-times"></i></a>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row mb-0">
                                        <div class="col-sm-12">
                                            <a href="#" class="btn btn-xs btn-default btn-groups"><i class="fas fa-plus"></i> <?php echo lang('Append'); ?></a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <label class="col-sm-2 row-form-label"><?php echo __("More options"); ?>: </label>
                                <div class="col-sm-10 d-flex">
                                    <label class="row-form-label d-flex align-items-center mr-1"><input type="checkbox" name="row[data_list][multiple]" value="1"><span class="ml-1"><?php echo __("Enable multiple selection"); ?></span></label>
                                    <label class="row-form-label d-flex align-items-center mr-1"><input type="checkbox" name="row[data_list][pagination]" value="1"><span class="ml-1"><?php echo __("Turn off pagination"); ?></span></label>
                                    <label class="row-form-label d-flex align-items-center mr-1"><input type="checkbox" name="row[data_list][select-only]" value="1"><span class="ml-1"><?php echo __("Select mode only"); ?></span></label>
                                    <label class="row-form-label d-flex align-items-center mr-1"><input type="checkbox" name="row[data_list][enable-lang]" value="1"><span class="ml-1"><?php echo __("Multilingual filter"); ?></span></label>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </script>
            <!--动态下拉配置结束-->

            <div class="form-group row">
                <label for="frm-default_value" class="col-sm-2 row-form-label"><?php echo lang("Defaults"); ?>: </label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" id="frm-default_value" name="row[value]">
                </div>
            </div>

            <div id="other-option"></div>

            <div class="form-group row">
                <label for="frm-tips" class="col-sm-2 row-form-label"><?php echo lang("Rule"); ?>: </label>
                <div class="col-sm-8">
                    <input type="text" id="frm-rules"
                           class="form-control selectpage"
                           name="row[rules]"
                           data-select-only="true"
                           data-key-field="name"
                           data-pagination="false"
                           data-show-field="title"
                           data-multiple="true"
                           data-data="<?php echo url('/cms.model_field/getRules'); ?>">
                </div>
            </div>
            <div class="form-group row">
                <label for="frm-tips" class="col-sm-2 row-form-label"><?php echo lang("Tips"); ?>: </label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" id="frm-tips" name="row[tips]">
                </div>
            </div>
            <div class="form-group row">
                <label for="frm-error_tips" class="col-sm-2 row-form-label"><?php echo lang("Error tips"); ?>: </label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" id="frm-error_tips" name="row[error_tips]">
                </div>
            </div>
            <div class="form-group row">
                <label for="frm-extend" class="col-sm-2 row-form-label"><?php echo __("HTML attr"); ?>: </label>
                <div class="col-sm-8">
                    <textarea class="form-control" id="frm-extend" name="row[extend]" rows="3" placeholder="<?php echo lang('Add or overlay HTML attributes, and separate multiple attributes with English commas.'); ?><?php echo lang('Example:'); ?>data-title=&quot;ceshi&quot;,class=&quot;form-control selectpage&quot;"></textarea>
                </div>
            </div>
        </div>
        <div class="card-footer">
            <div class="row justify-content-around">
                <div class="col-sm-8">
                    <button type="submit" class="btn btn-primary btn-submit"><?php echo __('Submit'); ?></button>
                    <button type="reset" class="btn btn-default"><?php echo __('Reset'); ?></button>
                </div>
            </div>
        </div>
    </div>
</form>

{block:script}
<script>
    require(['admin','form'], function (admin, Form) {
        $(function () {
            Form.api.init();
            $(document).on('change', '#frm-form_type', function (e) {
                if ($.inArray($(this).val(),['radio','checkbox','select','selects'])>-1) {
                    $('#other-option').html('<div class="form-group row" id="data_list">\n' +
                        '                    <label for="frm-data_list" class="col-sm-2 row-form-label"><?php echo lang("Option list"); ?>: </label>\n' +
                        '                    <div class="col-sm-8">\n' +
                        '                    <textarea class="form-control" id="frm-data_list" name="row[data_list]" rows="3" placeholder="" data-rule="required">key1|标题\n' +
                        'key2|标题</textarea>\n' +
                        '                    </div>\n' +
                        '                </div>');
                } else if ($.inArray($(this).val(), ['images','downfiles'])>-1) {
                    var html = '<div class="form-group row">\n' +
                        '                    <label for="frm-decimals" class="col-sm-2 row-form-label"><?php echo lang("Limit suffix"); ?>: </label>\n' +
                        '                    <div class="col-sm-8">\n' +
                        '                        <input type="text" class="form-control" name="row[setting][ext]" value="" placeholder="<?php echo lang('Limit the upload format,when empty,the attachment configuration will be used. Multiple suffixes are separated by "|"'); ?>">\n' +
                    '                    </div>\n' +
                    '                </div>';
                    html += '<div class="form-group row">\n' +
                        '                    <label for="frm-decimals" class="col-sm-2 row-form-label"><?php echo lang("Limit size"); ?>: </label>\n' +
                        '                    <div class="col-sm-8">\n' +
                        '                        <input type="number" class="form-control" name="row[setting][filesize]" value="" placeholder="<?php echo lang("When empty, the content of the attachment configuration will be used"); ?>"><div class="pt-1 pl-1"><span class="text-muted"><?php echo lang('Unit:Byte'); ?>(b)</span></div>\n' +
                    '                    </div>\n' +
                    '                </div>';
                    $('#other-option').html(html+'<div class="form-group row" id="max_number">\n' +
                        '                    <label for="frm-max_number" class="col-sm-2 row-form-label"><?php echo lang("Greatest amount"); ?>: </label>\n' +
                        '                    <div class="col-sm-8">\n' +
                        '                        <input type="number" class="form-control" id="frm-max_number" name="row[max_number]" value="" data-rule="required|digits">\n' +
                        '                    </div>\n' +
                        '                </div>');
                } else if ($.inArray($(this).val(),['downfile','image'])>-1) {
                    var html = '<div class="form-group row">\n' +
                        '                    <label for="frm-decimals" class="col-sm-2 row-form-label"><?php echo lang("Limit size"); ?>: </label>\n' +
                        '                    <div class="col-sm-8">\n' +
                        '                        <input type="number" class="form-control" name="row[setting][filesize]" value="" placeholder="<?php echo lang("When empty, the content of the attachment configuration will be used"); ?>"><div class="pt-1 pl-1"><span class="text-muted"><?php echo lang('Unit:Byte'); ?>(b)</span></div>\n' +
                    '                    </div>\n' +
                    '                </div>';
                    $('#other-option').html('<div class="form-group row">\n' +
                        '                    <label for="frm-decimals" class="col-sm-2 row-form-label"><?php echo lang("Limit suffix"); ?>: </label>\n' +
                        '                    <div class="col-sm-8">\n' +
                        '                        <input type="text" class="form-control" name="row[setting][ext]" value="" placeholder="<?php echo lang('Limit the upload format,when empty,the attachment configuration will be used. Multiple suffixes are separated by "|"'); ?> (png|jpg|zip)">\n' +
                    '                    </div>\n' +
                    '                </div>'+html);
                } else if ($(this).val()=='number') {
                    // $('#frm-length').val('');
                    // $('#other-option').html('<div class="form-group row" id="max_number">\n' +
                    //     '                    <label for="frm-decimals" class="col-sm-2 row-form-label"><?php echo lang("Decimal places"); ?>: </label>\n' +
                    //     '                    <div class="col-sm-8">\n' +
                    //     '                        <input type="number" class="form-control" id="frm-decimals" name="row[decimals]" value="0" data-rule="required|digits">\n' +
                    //     '                    </div>\n' +
                    //     '                </div>');
                } else if ($(this).val()=='array') {
                    $('#other-option').html('<div class="form-group row">\n' +
                        '                <label for="frm-key_name_alias" class="col-sm-2 row-form-label"><?php echo lang("Key name alias"); ?>: </label>\n' +
                        '                <div class="col-sm-8">\n' +
                        '                    <input type="text" class="form-control" id="frm-key_name_alias" name="row[key_name_alias]" value="<?php echo lang('Key name'); ?>">\n' +
                        '                </div>\n' +
                        '            </div>\n' +
                        '            <div class="form-group row">\n' +
                        '                <label for="frm-key_value_alias" class="col-sm-2 row-form-label"><?php echo lang("Key value name"); ?>: </label>\n' +
                        '                <div class="col-sm-8">\n' +
                        '                    <input type="text" class="form-control" id="frm-key_value_alias" name="row[key_value_alias]" value="<?php echo lang('Key value'); ?>">\n' +
                        '                </div>\n' +
                        '            </div>');
                } else if ($(this).val()=='selectpage') {
                    $('#other-option').html('');
                    $('#selectpage-setting').html($('#selectpage-setting-html').html());

                    Form.event.selectpicker($('.frm-operate'));
                } else {
                    $('#other-option').html('');
                }
            });

            // 动态下拉配置删除
            $(document).on('click','.btn-groups-del',function (e) {
                $($(this).data('class')).remove();
                e.preventDefault();
            });
            var item = 2;
            $(document).on('click','.btn-groups',function (e) {
                $('#J-groups').append('<div class="row mt-1 del'+item+'"><div class="col-sm-5">\n' +
                    '      <input type="text" class="form-control" value="" name="row[data_list][param][]">\n' +
                    '  </div>\n' +
                    '  <div class="col-sm-5">\n' +
                    '      <input type="text" class="form-control" value="" name="row[data_list][param][]">\n' +
                    '  </div>\n' +
                    '  <div class="col-sm-2 pt-1">\n' +
                    '      <a href="#" class="btn btn-default btn-xs btn-groups-del" data-class=".del'+item+'"><i class="fas fa-times"></i></a>\n' +
                    '  </div></div>');
                item++;
                e.preventDefault();
            });

            // 数据源值改变
            $(document).on('change', 'input[name="row[data_list][type]"]', function (e) {
                var val = $(this).val();
                if (val=='table') {
                    $('.type-url').hide();
                    $('.type-table').show();
                } else {
                    $('.type-url').show();
                    $('.type-table').hide();
                }
            });
            // 数据表更换事件
            $(document).on('change', '#J-selectpage-table', function (e) {
                var val = $(this).val();
                $.get('<?php echo url("/cms.model_field/getFields"); ?>'+'?t='+val,function (data) {
                    if (data.code==200) {
                        var html = '';
                        var is_delete_time = 0;
                        $.each(data.data.field, function (idx, val) {
                            if (val=='delete_time') {
                                is_delete_time = 1;
                            }
                            html += '<option value="'+val+'">'+val+'</option>';
                        })
                        $('select.J-field').html(html);
                        $('input[name="row[data_list][delete_time]"]').val(is_delete_time);
                        $('.selectpicker').selectpicker('refresh');
                    } else {
                        layer.msg(data.msg);
                    }
                })
            })

            $('#frm-form_type').trigger('change');
        })
    })
</script>
{/block:script}
    </div>
    <?php endif; ?>

    <script src="/static/libs/require/require.js"></script>
<script src="/static/module/admin/adminlte/js/main.js?v=<?php echo env('APP_DEBUG')?time():$site['version']; ?>"></script>

<!-- // 加载插件JS-->
<?php echo load_js(); ?>



    {__SCRIPT__}
    
</body>
</html>