save
This commit is contained in:
parent
bc15881c7e
commit
29dd1692a1
@ -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,
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
@ -3,8 +3,9 @@ layui.define(['layer', 'form'], function(exports) {
|
|||||||
form = layui.form,
|
form = layui.form,
|
||||||
$ = layui.$,
|
$ = layui.$,
|
||||||
key = '',
|
key = '',
|
||||||
js = '';
|
allJS = '',
|
||||||
module = ["form"];
|
allHtml = '';
|
||||||
|
let module = ["form"];
|
||||||
delHtml()
|
delHtml()
|
||||||
$('button').on('click', function() {
|
$('button').on('click', function() {
|
||||||
var _this = $(this),
|
var _this = $(this),
|
||||||
@ -46,7 +47,7 @@ layui.define(['layer', 'form'], function(exports) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (module.indexOf('iconPicker') === -1) module.push('iconPicker');
|
if (module.indexOf('iconPicker') === -1) module.push('iconPicker');
|
||||||
js += ' // 图标选择\n' +
|
allJS += ' // 图标选择\n' +
|
||||||
' layui.iconPicker.render({\n' +
|
' layui.iconPicker.render({\n' +
|
||||||
' elem: "#' + key + '",\n' +
|
' elem: "#' + key + '",\n' +
|
||||||
' type: "fontClass",\n' +
|
' type: "fontClass",\n' +
|
||||||
@ -66,7 +67,7 @@ layui.define(['layer', 'form'], function(exports) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (module.indexOf('xmSelect') === -1) module.push('xmSelect');
|
if (module.indexOf('xmSelect') === -1) module.push('xmSelect');
|
||||||
js += ' // 下拉多选\n' +
|
allJS += ' // 下拉多选\n' +
|
||||||
' layui.xmSelect.render({\n' +
|
' layui.xmSelect.render({\n' +
|
||||||
' el: "#' + key + '",\n' +
|
' el: "#' + key + '",\n' +
|
||||||
' name: "' + key + '",\n' +
|
' name: "' + key + '",\n' +
|
||||||
@ -88,7 +89,7 @@ layui.define(['layer', 'form'], function(exports) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (module.indexOf('xmSelect') === -1) module.push('xmSelect');
|
if (module.indexOf('xmSelect') === -1) module.push('xmSelect');
|
||||||
js += ' // 树多选\n' +
|
allJS += ' // 树多选\n' +
|
||||||
' layui.xmSelect.render({\n' +
|
' layui.xmSelect.render({\n' +
|
||||||
' el: "#' + key + '",\n' +
|
' el: "#' + key + '",\n' +
|
||||||
' name: "' + key + '",\n' +
|
' name: "' + key + '",\n' +
|
||||||
@ -114,7 +115,7 @@ layui.define(['layer', 'form'], function(exports) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (module.indexOf('xmSelect') === -1) module.push('xmSelect');
|
if (module.indexOf('xmSelect') === -1) module.push('xmSelect');
|
||||||
js += ' // 树多选\n' +
|
allJS += ' // 树多选\n' +
|
||||||
' layui.xmSelect.render({\n' +
|
' layui.xmSelect.render({\n' +
|
||||||
' el: "#' + key + '",\n' +
|
' el: "#' + key + '",\n' +
|
||||||
' name: "' + 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('upload') === -1) module.push('upload');
|
||||||
if (module.indexOf('util') === -1) module.push('util');
|
if (module.indexOf('util') === -1) module.push('util');
|
||||||
js += ' // 上传文件\n' +
|
allJS += ' // 上传文件\n' +
|
||||||
' layui.use([\'upload\'], function() {\n' +
|
' layui.use([\'upload\'], function() {\n' +
|
||||||
' let input = layui.$("#'+key+'").prev();\n' +
|
' let input = layui.$("#'+key+'").prev();\n' +
|
||||||
' input.prev().html(layui.util.escape(input.val()));\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');
|
if (module.indexOf('upload') === -1) module.push('upload');
|
||||||
js += ' // 上传图片\n' +
|
allJS += ' // 上传图片\n' +
|
||||||
' layui.use([\'upload\'], function() {\n' +
|
' layui.use([\'upload\'], function() {\n' +
|
||||||
' let input = layui.$("#'+key+'").prev();\n' +
|
' let input = layui.$("#'+key+'").prev();\n' +
|
||||||
' input.prev().attr(\'src\', input.val());\n' +
|
' input.prev().attr(\'src\', input.val());\n' +
|
||||||
@ -255,9 +256,7 @@ layui.define(['layer', 'form'], function(exports) {
|
|||||||
case 'del':
|
case 'del':
|
||||||
$('form').html("\n")
|
$('form').html("\n")
|
||||||
delHtml()
|
delHtml()
|
||||||
$('.code-show').text('')
|
return false;
|
||||||
return false
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
layer.msg('类型错误', {
|
layer.msg('类型错误', {
|
||||||
icon: 2
|
icon: 2
|
||||||
@ -271,25 +270,15 @@ layui.define(['layer', 'form'], function(exports) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function delHtml() {
|
function delHtml() {
|
||||||
layui.data('form_html', {
|
allHtml = '';
|
||||||
key: 'html',
|
allJS = '';
|
||||||
remove: true
|
$('.code-show').text('');
|
||||||
});
|
$('.js-show').text(jscode());
|
||||||
}
|
}
|
||||||
|
|
||||||
function setHtml(html) {
|
function setHtml(html) {
|
||||||
var h = layui.data('form_html');
|
allHtml += html;
|
||||||
if (h && h.html) {
|
$('.code-show').text('<form class="layui-form" action="" onsubmit="return false">\n' + allHtml + '</form>')
|
||||||
var _d = h.html + html
|
|
||||||
} else {
|
|
||||||
var _d = html
|
|
||||||
}
|
|
||||||
layui.data('form_html', {
|
|
||||||
key: 'html',
|
|
||||||
value: _d
|
|
||||||
})
|
|
||||||
$('.code-show').text('<form class="layui-form" action="" onsubmit="return false">\n' + _d + '</form>')
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function icon(size) {
|
function icon(size) {
|
||||||
@ -340,7 +329,7 @@ layui.define(['layer', 'form'], function(exports) {
|
|||||||
' <div class="layui-input-' + size + '">\n' +
|
' <div class="layui-input-' + size + '">\n' +
|
||||||
' <span></span>\n' +
|
' <span></span>\n' +
|
||||||
' <input type="text" style="display:none" name="'+key+'" value="" />\n' +
|
' <input type="text" style="display:none" name="'+key+'" value="" />\n' +
|
||||||
' <button type="button" class="pear-btn pear-btn-primary pear-btn-sm" id="'+key+'" permission="app.admin.upload.file>\n' +
|
' <button type="button" class="pear-btn pear-btn-primary pear-btn-sm" id="'+key+'" permission="app.admin.upload.file">\n' +
|
||||||
' <i class="layui-icon"></i>'+uploadWords+'\n' +
|
' <i class="layui-icon"></i>'+uploadWords+'\n' +
|
||||||
' </button>\n' +
|
' </button>\n' +
|
||||||
' <button type="button" class="pear-btn pear-btn-primary pear-btn-sm" id="attachment-choose-'+key+'" permission="app.admin.upload.attachment">\n' +
|
' <button type="button" class="pear-btn pear-btn-primary pear-btn-sm" id="attachment-choose-'+key+'" permission="app.admin.upload.attachment">\n' +
|
||||||
@ -456,7 +445,7 @@ layui.define(['layer', 'form'], function(exports) {
|
|||||||
var html = '<script>\n' +
|
var html = '<script>\n' +
|
||||||
' layui.use('+JSON.stringify(module)+', function(){\n' +
|
' layui.use('+JSON.stringify(module)+', function(){\n' +
|
||||||
' var form = layui.form;\n' +
|
' var form = layui.form;\n' +
|
||||||
''+ js +
|
''+ allJS +
|
||||||
' // 提交表单\n' +
|
' // 提交表单\n' +
|
||||||
' form.on(\'submit(formDemo)\', function(data){\n' +
|
' form.on(\'submit(formDemo)\', function(data){\n' +
|
||||||
' layer.msg(JSON.stringify(data.field));\n' +
|
' layer.msg(JSON.stringify(data.field));\n' +
|
||||||
|
Loading…
Reference in New Issue
Block a user