diff --git a/skyeye-promote/skyeye-web/src/main/resources/application.properties b/skyeye-promote/skyeye-web/src/main/resources/application.properties index d3cde4dfd08478bdf006ff14b527778a26985a7d..62632f3fbb0a3b8d3ecd60cdeca2b1e5a24ac135 100644 --- a/skyeye-promote/skyeye-web/src/main/resources/application.properties +++ b/skyeye-promote/skyeye-web/src/main/resources/application.properties @@ -46,22 +46,22 @@ activiti.database.username=root activiti.database.password=123456 #redis 1连接信息 -redis.ip1=192.168.1.140 +redis.ip1=192.168.0.140 redis.host1=9000 #redis 2连接信息 -redis.ip2=192.168.1.140 +redis.ip2=192.168.0.140 redis.host2=9001 #redis 3连接信息 -redis.ip3=192.168.1.140 +redis.ip3=192.168.0.140 redis.host3=9002 #redis 4连接信息 -redis.ip4=192.168.1.140 +redis.ip4=192.168.0.140 redis.host4=9003 #redis 5连接信息 -redis.ip5=192.168.1.140 +redis.ip5=192.168.0.140 redis.host5=9004 #redis 6连接信息 -redis.ip6=192.168.1.140 +redis.ip6=192.168.0.140 redis.host6=9005 redis.commandTimeout=1000 diff --git a/skyeye-promote/skyeye-web/src/main/resources/template/assets/lib/layui/lay/modules/form.js b/skyeye-promote/skyeye-web/src/main/resources/template/assets/lib/layui/lay/modules/form.js index 9fd93adca9cb6f65c501e1c5a138ececd7248a51..13b133dd157328a834c7f4fcecc2f4b53d41ee17 100644 --- a/skyeye-promote/skyeye-web/src/main/resources/template/assets/lib/layui/lay/modules/form.js +++ b/skyeye-promote/skyeye-web/src/main/resources/template/assets/lib/layui/lay/modules/form.js @@ -3,524 +3,918 @@ @Name:layui.form 表单组件 @Author:贤心 @License:MIT - + */ - -layui.define('layer', function(exports){ - "use strict"; - - var $ = layui.$ - ,layer = layui.layer - ,hint = layui.hint() - ,device = layui.device() - - ,MOD_NAME = 'form', ELEM = '.layui-form', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'layui-disabled' - - ,Form = function(){ - this.config = { - verify: { - required: [ - /[\S]+/ - ,'必填项不能为空' - ] - ,phone: [ - /^1\d{10}$/ - ,'请输入正确的手机号' - ] - ,email: [ - /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/ - ,'邮箱格式不正确' - ] - ,url: [ - /(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/ - ,'链接格式不正确' - ] - ,number: function(value){ - if(!value || isNaN(value)) return '只能填写数字' - } - ,date: [ - /^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/ - ,'日期格式不正确' - ] - ,identity: [ - /(^\d{15}$)|(^\d{17}(x|X|\d)$)/ - ,'请输入正确的身份证号' - ] - } - }; - }; - - //全局设置 - Form.prototype.set = function(options){ - var that = this; - $.extend(true, that.config, options); - return that; - }; - - //验证规则设定 - Form.prototype.verify = function(settings){ - var that = this; - $.extend(true, that.config.verify, settings); - return that; - }; - - //表单事件监听 - Form.prototype.on = function(events, callback){ - return layui.onevent.call(this, MOD_NAME, events, callback); - }; - - //表单控件渲染 - Form.prototype.render = function(type, filter){ - var that = this - ,elemForm = $(ELEM + function(){ - return filter ? ('[lay-filter="' + filter +'"]') : ''; - }()) - ,items = { - - //下拉选择框 - select: function(){ - var TIPS = '请选择', CLASS = 'layui-form-select', TITLE = 'layui-select-title' - ,NONE = 'layui-select-none', initValue = '', thatInput - - ,selects = elemForm.find('select'), hide = function(e, clear){ - if(!$(e.target).parent().hasClass(TITLE) || clear){ - $('.'+CLASS).removeClass(CLASS+'ed ' + CLASS+'up'); - thatInput && initValue && thatInput.val(initValue); - } - thatInput = null; - } - - ,events = function(reElem, disabled, isSearch){ - var select = $(this) - ,title = reElem.find('.' + TITLE) - ,input = title.find('input') - ,dl = reElem.find('dl') - ,dds = dl.children('dd') - - - if(disabled) return; - - //展开下拉 - var showDown = function(){ - var top = reElem.offset().top + reElem.outerHeight() + 5 - win.scrollTop() - ,dlHeight = dl.outerHeight(); - reElem.addClass(CLASS+'ed'); - dds.removeClass(HIDE); - - //上下定位识别 - if(top + dlHeight > win.height() && top >= dlHeight){ - reElem.addClass(CLASS + 'up'); - } - }, hideDown = function(choose){ - reElem.removeClass(CLASS+'ed ' + CLASS+'up'); - input.blur(); - - if(choose) return; - - notOption(input.val(), function(none){ - if(none){ - initValue = dl.find('.'+THIS).html(); - input && input.val(initValue); - } - }); - }; - - //点击标题区域 - title.on('click', function(e){ - reElem.hasClass(CLASS+'ed') ? ( - hideDown() - ) : ( - hide(e, true), - showDown() - ); - dl.find('.'+NONE).remove(); - }); - - //点击箭头获取焦点 - title.find('.layui-edge').on('click', function(){ - input.focus(); - }); - - //键盘事件 - input.on('keyup', function(e){ - var keyCode = e.keyCode; - //Tab键 - if(keyCode === 9){ - showDown(); - } - }).on('keydown', function(e){ - var keyCode = e.keyCode; - //Tab键 - if(keyCode === 9){ - hideDown(); - } else if(keyCode === 13){ //回车键 - e.preventDefault(); - } - }); - - //检测值是否不属于select项 - var notOption = function(value, callback, origin){ - var num = 0; - layui.each(dds, function(){ - var othis = $(this) - ,text = othis.text() - ,not = text.indexOf(value) === -1; - if(value === '' || (origin === 'blur') ? value !== text : not) num++; - origin === 'keyup' && othis[not ? 'addClass' : 'removeClass'](HIDE); - }); - var none = num === dds.length; - return callback(none), none; - }; - - //搜索匹配 - var search = function(e){ - var value = this.value, keyCode = e.keyCode; - - if(keyCode === 9 || keyCode === 13 - || keyCode === 37 || keyCode === 38 - || keyCode === 39 || keyCode === 40 - ){ - return false; - } - - notOption(value, function(none){ - if(none){ - dl.find('.'+NONE)[0] || dl.append('
无匹配项
'); - } else { - dl.find('.'+NONE).remove(); - } - }, 'keyup'); - - if(value === ''){ - dl.find('.'+NONE).remove(); - } - }; - - if(isSearch){ - input.on('keyup', search).on('blur', function(e){ - thatInput = input; - initValue = dl.find('.' + THIS).html(); - setTimeout(function(){ - notOption(input.val(), function(none){ - initValue || input.val(''); //none && !initValue - }, 'blur'); - }, 200); - }); - } - - //选择 - dds.on('click', function(){ - var othis = $(this), value = othis.attr('lay-value'); - var filter = select.attr('lay-filter'); //获取过滤器 - - if(othis.hasClass(DISABLED)) return false; - - if(othis.hasClass('layui-select-tips')){ - input.val(''); - } else { - input.val(othis.text()); - othis.addClass(THIS); - } - - othis.siblings().removeClass(THIS); - select.val(value).removeClass('layui-form-danger') - layui.event.call(this, MOD_NAME, 'select('+ filter +')', { - elem: select[0] - ,value: value - ,othis: reElem - }); - - hideDown(true); - return false; - }); - - reElem.find('dl>dt').on('click', function(e){ - return false; - }); - - //关闭下拉 - $(document).off('click', hide).on('click', hide); - } - - selects.each(function(index, select){ - var othis = $(this) - ,hasRender = othis.next('.'+CLASS) - ,disabled = this.disabled - ,value = select.value - ,selected = $(select.options[select.selectedIndex]) //获取当前选中项 - ,optionsFirst = select.options[0]; - - if(typeof othis.attr('lay-ignore') === 'string') return othis.show(); - - var isSearch = typeof othis.attr('lay-search') === 'string' - ,placeholder = optionsFirst ? ( - optionsFirst.value ? TIPS : (optionsFirst.innerHTML || TIPS) - ) : TIPS; - - //替代元素 - var reElem = $(['无匹配项
'); + } else { + dl.find('.' + NONE).remove(); + } + }, 'keyup'); + + if(value === '') { + dl.find('.' + NONE).remove(); + } + + followScroll(); //定位滚动条 + }; + + if(isSearch) { + if(isMulti) { + input.on('keyup', search) + } else { + input.on('keyup', search).on('blur', function(e) { + var selectedIndex = select[0].selectedIndex; + thatInput = input; //当前的 select 中的 input 元素 + var cur_option = $(select[0].options[selectedIndex]) + initValue = cur_option.attr('value') == '' ? '' : cur_option.html(); //重新获得初始选中值 + + //如果是第一项,且文本值等于 placeholder,则清空初始值 + if(selectedIndex === 0 && initValue === input.attr('placeholder')) { + initValue = ''; + }; + + setTimeout(function() { + notOption(input.val(), function(none) { + initValue || input.val(''); //none && !initValue + }, 'blur'); + }, 200); + }); + } + } + + //选择 + dds.on('click', function() { + var othis = $(this), + value = othis.attr('lay-value'); + var filter = select.attr('lay-filter'); //获取过滤器 + + if(othis.hasClass(DISABLED)) return false; + + if(isMulti) { + + var valueStr = select.val() || []; + if(othis.find("input[type='checkbox']").is(':checked')) { + if(omit) { + multiSelect.html(multiSelect.html() + "" + othis.find("span").text() + ""); + } else { + input.eq(0).val("已选择" + othis.parent().find('[type=checkbox]:checked').length + "条"); + } + valueStr.push(value); + } else { + if(omit) { + multiSelect.find("a").each(function() { + if($(this).find("span").attr('lay-value') == othis.attr('lay-value')) { + $(this).remove(); + valueStr.removeElem(value); + } + }) + } else { + var num = othis.parent().find('[type=checkbox]:checked').length; + if(num == 0) { + input.eq(0).val(""); + } else { + input.eq(0).val("已选择" + num + "条"); + } + valueStr.removeElem(value); + } + + } + select.val(valueStr).removeClass('layui-form-danger'); + layui.event.call(this, MOD_NAME, 'select(' + filter + ')', { + elem: select[0], + value: valueStr, + othis: reElem, + current_value: value + }); + that.hidePlaceholder(title, select); + } else { + if(othis.hasClass('layui-select-tips')) { + input.val(''); + } else { + input.val(othis.text()); + othis.addClass(THIS); + } + + othis.siblings().removeClass(THIS); + select.val(value).removeClass('layui-form-danger') + layui.event.call(this, MOD_NAME, 'select(' + filter + ')', { + elem: select[0], + value: value, + othis: reElem + }); + + hideDown(true); + } + return false; + }); + + reElem.find('dl>dt').on('click', function(e) { + return false; + }); + + dl.on('click', function(e) { + if(isMulti) { + e.stopPropagation(); + } + }); + + // 全选、取消、反选 + dl.find('.multiOption').on('click', function(e) { + switch($(this).data('value')) { + case 'all': + dl.find('[type=checkbox]:not(:checked)').prop('checked', true); + select.children('option[value!=""]').prop('selected', true) + handleMultiOption(); + break; + case 'none': + dl.find('[type=checkbox]:checked').prop('checked', false); + select.children('option[value!=""]').prop('selected', false); + handleMultiOption(); + break; + case 'inverse': + var checkedBox = dl.find('[type=checkbox]:checked'); + dl.find('[type=checkbox]:not(:checked)').prop('checked', true); + checkedBox.prop('checked', false) + + var selectedOption = select.children('option[value!=""]:not(:selected)') + select.children('option[value!=""]:selected').prop('selected', false) + selectedOption.prop('selected', true) + handleMultiOption(); + break; + } + + e.stopPropagation(); // 阻止事件冒泡,使下拉框长显示 + }); + + function handleMultiOption() { + form.render('checkbox'); + var valueStr = select.val() || [], + selectedOption = select.children('option:selected'), + filter = select.attr('lay-filter'); + if(omit) { + var options = []; + for(var i = 0; i < selectedOption.length; i++) { + options.push("" + selectedOption[i].text + ""); + } + multiSelect.find('a').remove(); + multiSelect.append(options.join('')); + } else { + input.eq(0).val(selectedOption.length == 0 ? "" : "已选择" + selectedOption.length + "条"); + } + + select.removeClass('layui-form-danger'); + layui.event.call(this, MOD_NAME, 'select(' + filter + ')', { + elem: select[0], + value: valueStr, + othis: reElem, + current_value: '' + }); + that.hidePlaceholder(title, select); + } + + //多选删除 + title.delegate(".multiSelect a i", "click", function(e) { + var valueStr = select.val() || []; + var _this = $(this); + e.stopPropagation(); + title.find("dd").each(function() { + if($(this).attr('lay-value') == _this.siblings("span").attr('lay-value')) { + $(this).find("input").removeAttr("checked"); + $(this).find(".layui-form-checkbox").removeClass("layui-form-checked"); + valueStr.removeElem($(this).attr("lay-value")); + select.val(valueStr); + layui.event.call(this, MOD_NAME, 'select(' + select.attr('lay-filter') + ')', { + elem: select[0], + value: valueStr, + othis: reElem, + current_value: _this.siblings("span").text() + }); + } + }); + $(this).parent("a").remove(); + that.hidePlaceholder(title, select); + }); + + $(document).off('click', hide).on('click', hide); //点击其它元素关闭 select + } + + selects.each(function(index, select) { + var othis = $(this), + hasRender = othis.next('.' + CLASS), + disabled = this.disabled, + selected = $(select.options[select.selectedIndex]), //获取当前选中项 + optionsFirst = select.options[0], + isMulti = typeof othis.attr('multiple') && typeof othis.attr('multiple') === 'string', + value = isMulti ? $(select).val() : select.value, + isTools = typeof othis.attr('lay-tools') == 'undefined' || othis.attr('lay-tools') != 'false'; + + if(typeof othis.attr('lay-ignore') === 'string') return othis.show(); + + var isSearch = typeof othis.attr('lay-search') === 'string', + placeholder = optionsFirst ? ( + optionsFirst.value ? TIPS : (optionsFirst.innerHTML || TIPS) + ) : TIPS, + inputValue = !(typeof $(select).attr("lay-omit") === 'undefined') && value != null && value.length > 0 ? '已选择' + value.length + "条" : ""; + + if(isMulti) { + var reElem = $(['