diff --git a/src/plugin/admin/config/menu.php b/src/plugin/admin/config/menu.php index 7cf2508..50b1c37 100644 --- a/src/plugin/admin/config/menu.php +++ b/src/plugin/admin/config/menu.php @@ -116,4 +116,20 @@ return [ ] ] ], + [ + 'title' => '开发辅助', + 'key' => 'dev', + 'icon' => 'layui-icon-fonts-code', + 'weight' => 500, + 'type' => 0, + 'children' => [ + [ + 'title' => '表单构建', + 'key' => 'plugin\\admin\\app\\controller\\DevController', + 'href' => '/app/admin/dev/form-build', + 'weight' => 800, + 'type' => 1, + ] + ] + ], ]; diff --git a/src/plugin/admin/public/component/pear/module/design.js b/src/plugin/admin/public/component/pear/module/design.js index 3df319a..5e6dd51 100644 --- a/src/plugin/admin/public/component/pear/module/design.js +++ b/src/plugin/admin/public/component/pear/module/design.js @@ -3,8 +3,9 @@ layui.define(['layer', 'form'], function(exports) { form = layui.form, $ = layui.$, key = '', - js = ''; - module = ["form"]; + allJS = '', + allHtml = ''; + let module = ["form"]; delHtml() $('button').on('click', function() { var _this = $(this), @@ -46,7 +47,7 @@ layui.define(['layer', 'form'], function(exports) { }); }); if (module.indexOf('iconPicker') === -1) module.push('iconPicker'); - js += ' // 图标选择\n' + + allJS += ' // 图标选择\n' + ' layui.iconPicker.render({\n' + ' elem: "#' + key + '",\n' + ' type: "fontClass",\n' + @@ -66,7 +67,7 @@ layui.define(['layer', 'form'], function(exports) { }); }); if (module.indexOf('xmSelect') === -1) module.push('xmSelect'); - js += ' // 下拉多选\n' + + allJS += ' // 下拉多选\n' + ' layui.xmSelect.render({\n' + ' el: "#' + key + '",\n' + ' name: "' + key + '",\n' + @@ -88,7 +89,7 @@ layui.define(['layer', 'form'], function(exports) { }); }); if (module.indexOf('xmSelect') === -1) module.push('xmSelect'); - js += ' // 树多选\n' + + allJS += ' // 树多选\n' + ' layui.xmSelect.render({\n' + ' el: "#' + key + '",\n' + ' name: "' + key + '",\n' + @@ -114,7 +115,7 @@ layui.define(['layer', 'form'], function(exports) { }); }); if (module.indexOf('xmSelect') === -1) module.push('xmSelect'); - js += ' // 树多选\n' + + allJS += ' // 树多选\n' + ' layui.xmSelect.render({\n' + ' el: "#' + key + '",\n' + ' name: "' + key + '",\n' + @@ -159,7 +160,7 @@ layui.define(['layer', 'form'], function(exports) { }); if (module.indexOf('upload') === -1) module.push('upload'); if (module.indexOf('util') === -1) module.push('util'); - js += ' // 上传文件\n' + + allJS += ' // 上传文件\n' + ' layui.use([\'upload\'], function() {\n' + ' let input = layui.$("#'+key+'").prev();\n' + ' input.prev().html(layui.util.escape(input.val()));\n' + @@ -220,7 +221,7 @@ layui.define(['layer', 'form'], function(exports) { }); }); if (module.indexOf('upload') === -1) module.push('upload'); - js += ' // 上传图片\n' + + allJS += ' // 上传图片\n' + ' layui.use([\'upload\'], function() {\n' + ' let input = layui.$("#'+key+'").prev();\n' + ' input.prev().attr(\'src\', input.val());\n' + @@ -255,9 +256,7 @@ layui.define(['layer', 'form'], function(exports) { case 'del': $('form').html("\n") delHtml() - $('.code-show').text('') - return false - break; + return false; default: layer.msg('类型错误', { icon: 2 @@ -271,25 +270,15 @@ layui.define(['layer', 'form'], function(exports) { }) function delHtml() { - layui.data('form_html', { - key: 'html', - remove: true - }); + allHtml = ''; + allJS = ''; + $('.code-show').text(''); + $('.js-show').text(jscode()); } function setHtml(html) { - var h = layui.data('form_html'); - if (h && h.html) { - var _d = h.html + html - } else { - var _d = html - } - layui.data('form_html', { - key: 'html', - value: _d - }) - $('.code-show').text('
\n' + _d + '
') - + allHtml += html; + $('.code-show').text('
\n' + allHtml + '
') } function icon(size) { @@ -340,7 +329,7 @@ layui.define(['layer', 'form'], function(exports) { '
\n' + ' \n' + ' \n' + - ' \n' + '