diff --git a/admin-core/src/main/resources/static/js/common.js b/admin-core/src/main/resources/static/js/common.js index 65c15f8f..2f800ee1 100644 --- a/admin-core/src/main/resources/static/js/common.js +++ b/admin-core/src/main/resources/static/js/common.js @@ -46,6 +46,55 @@ $.ajaxSetup({ }, }); +if(typeof Object.assign != 'function') { + (function() { + Object.assign = function(target) { + 'use strict'; + if(target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var output = Object(target); + for(var index = 1; index < arguments.length; index++) { + var source = arguments[index]; + if(source !== undefined && source !== null) { + for(var nextKey in source) { + if(source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey]; + } + } + } + } + return output; + }; + })(); +} + +// 增加IE对Object.assign 的支持 +if(typeof Object.assign != 'function') { + (function() { + Object.assign = function(target) { + 'use strict'; + if(target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var output = Object(target); + for(var index = 1; index < arguments.length; index++) { + var source = arguments[index]; + if(source !== undefined && source !== null) { + for(var nextKey in source) { + if(source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey]; + } + } + } + } + return output; + }; + })(); +} + //日期格式化 Date.prototype.format = function (format) { var d = this, o = { @@ -107,15 +156,21 @@ var Common = { } }, error: function (rsp) { - if(rsp.responseJSON?.msg) - Common.error(rsp.responseJSON?.msg); + if(rsp.responseJSON && rsp.responseJSON.msg) + Common.error(rsp.responseJSON.msg); else Common.error('服务器错误,请联系管理员'); } }) }, - downLoad: function (url, data = {}, method = 'POST') { + downLoad: function (url, data, method) { + if(!method) { + method = 'POST'; + } + if(!data) { + data = {}; + } var form = $('
'); $.each(data, function (k, v) { form.append($(' /^input-/g.test(item))[0]; + var classAttr; + $(this)[0].classList.forEach(function (value, key) { + if(/^input-/g.test(value) && classAttr == null) { + classAttr = value; + } + }); + var options = $(this).data('options'); try { options = JSON.parse(options || '{}')