diff --git a/public/assets/js/require-form.js b/public/assets/js/require-form.js index d4119177..6b85c218 100755 --- a/public/assets/js/require-form.js +++ b/public/assets/js/require-form.js @@ -242,7 +242,7 @@ define(['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], functio faselect: function (form) { //绑定fachoose选择附件事件 if ($(".faselect,.fachoose", form).size() > 0) { - $(".faselect,.fachoose", form).on('click', function () { + $(".faselect,.fachoose", form).off('click').on('click', function () { var that = this; var multiple = $(this).data("multiple") ? $(this).data("multiple") : false; var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : ''; @@ -413,6 +413,35 @@ define(['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], functio return false; }); }, + tagsinput: function (form) { + //标签输入 + $("input[data-toggle='tagsinput']").each(function () { + var setting = { + width: 'auto', + defaultText: '输入后空格确认', + minInputWidth: 110, + height: '36px', + placeholderColor: '#999', + onChange: function (row) { + $("input", $(this).next()).parent().focus(); + $("input", $(this).next()).trigger("blur.autocomplete").focus(); + }, + }; + var autocomplete = $(this).data("tagsinput-autocomplete"); + if (autocomplete) { + if (typeof autocomplete == 'string') { + autocomplete = {url: autocomplete}; + } + setting['autocomplete'] = $.extend({ + url: '', + minChars: 1, + menuClass: 'autocomplete-tags' + }, autocomplete); + } + setting = $.extend(true, setting, $(this).data("tagsinput") || {}); + $(this).tagsInput(setting); + }); + }, bindevent: function (form) { }, @@ -531,6 +560,8 @@ define(['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], functio events.slider(form); events.switcher(form); + + events.tagsinput(form); }, custom: {} },