<script type="text/html" template lay-done="layui.data.sendParams(d);">
    <div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-SysRole-editForm" id="LAY-app-SysRole-editForm">
        <input type="hidden" name="id" id="id" value="{{d.params.data.id || '' }}" />

        <div class="layui-form-item">
            <label for="roleName" class="layui-form-label">角色名称</label>
            <div class="layui-input-block">
                <input name="roleName" id="roleName" lay-verType="tips" lay-verify="required|verifyroleName" class="layui-input" placeholder="请输入角色名称" lay-reqText="请输入角色名称" value="{{d.params.data.roleName || '' }}" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="roleCode" class="layui-form-label">角色标识</label>
            <div class="layui-input-block">
                <input name="roleCode" id="roleCode" lay-verType="tips" lay-verify="required|verifyroleCode" class="layui-input" placeholder="请输入角色标识" lay-reqText="请输入角色标识" value="{{d.params.data.roleCode || '' }}" />
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label for="comments" class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea name="comments" id="comments" placeholder="请输入内容" class="layui-textarea">{{d.params.data.comments || '' }}</textarea>
            </div>
        </div>

        <div class="layui-form-item text-right">
            <input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-SysRole-editForm-submit" id="LAY-app-SysRole-editForm-submit" value="确认编辑">
        </div>
    </div>
</script>
<script>
    var debug = layui.setter.debug;
    layui.data.sendParams = function (d) {
        //开启调试情况下获取接口赋值数据
        if (debug) { console.log(d.params.data); }
        layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
            function () {
                var $ = layui.$
                    , form = layui.form
                    , admin = layui.admin
                    , laydate = layui.laydate
                    , upload = layui.upload
                    , cropperImg = layui.cropperImg
                    , coreHelper = layui.coreHelper;

                laydate.render({
                    elem: '#editTime-SysRole-createTime',
                    type: 'datetime'
                });
                laydate.render({
                    elem: '#editTime-SysRole-updateTime',
                    type: 'datetime'
                });
                form.verify({

                    verifyroleName: [/^[\S]{0,50}$/, '角色名称最大只允许输入50位字符，且不能出现空格'],
                    verifyroleCode: [/^[\S]{0,50}$/, '角色标识最大只允许输入50位字符，且不能出现空格'],
                    verifycomments: [/^[\S]{0,255}$/, '备注最大只允许输入255位字符，且不能出现空格'],
                });
                //重载form
                form.render(null, 'LAY-app-SysRole-editForm');
            })
    };
</script>