1
This commit is contained in:
@@ -0,0 +1,775 @@
|
||||
|
||||
requirejs.config({
|
||||
//urlArgs: "v=" + (new Date()).getTime(),
|
||||
urlArgs: "v=" + (location.host == 'q.sjqqzc.top' ? (new Date()).getTime() : require.s.contexts._.config.config.version),
|
||||
baseUrl: require.s.contexts._.config.config.cdnurl+'/app/admin/js/',
|
||||
packages: [{
|
||||
name: 'moment',
|
||||
location: '../libs/moment',
|
||||
main: 'moment'
|
||||
}],
|
||||
paths: {
|
||||
'fast': '../libs/fast',
|
||||
'upload': '../libs/require-upload',
|
||||
'form': '../libs/require-form',
|
||||
'dropzone': '../libs/dropzone.min',
|
||||
'table': '../libs/require-table',
|
||||
'jquery': '../libs/jquery.min',
|
||||
'bootstrap': '../libs/bootstrap.min',
|
||||
'bootstrap-table': '../libs/bootstrap-table/bootstrap-table',
|
||||
'bootstrap-table-export': '../libs/bootstrap-table/extensions/export/bootstrap-table-export.min',
|
||||
'bootstrap-table-fixed-columns': '../libs/bootstrap-table/extensions/fixed-columns/bootstrap-table-fixed-columns.min',
|
||||
'bootstrap-table-mobile': '../libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile',
|
||||
'bootstrap-table-lang': '../libs/bootstrap-table/locale/bootstrap-table-zh-CN',
|
||||
'bootstrap-table-jumpto': '../libs/bootstrap-table/extensions/page-jump-to/bootstrap-table-page-jump-to.min',
|
||||
'bootstrap-datepicker': '../libs/bootstrap-datepicker/bootstrap-datepicker',
|
||||
'bootstrap-datetimepicker': '../libs/bootstrap-datetimepicker/bootstrap-datetimepicker',
|
||||
'bootstrap-colorpicker': '../libs/bootstrap-colorpicker/bootstrap-colorpicker.min',
|
||||
'bootstrap-table-template': '../libs/bootstrap-table-template',
|
||||
'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',
|
||||
'validator': '../libs/nice-validator-1.1.5/jquery.validator',
|
||||
'dragsort': '../libs/jquery.dragsort',
|
||||
//'layer': '../libs/layer/dist/layer',
|
||||
'layer': '../libs/layer.2.11.0/layer',
|
||||
'moment': '../libs/moment/dist/moment',
|
||||
'template': '../libs/art-template/dist/template-native',
|
||||
'bootstrap-table-treegrid': '../libs/bootstrap-table/extensions/treegrid/bootstrap-table-treegrid.min',
|
||||
'treegrid': '../libs/jquery-treegrid/jquery.treegrid.min',
|
||||
'tagsinput': '../libs/jquery-tags-input/jquery.tagsinput.min',
|
||||
'froala_lang':'../libs/froala/js/languages',
|
||||
'froala-editor':'../libs/froala/js/froala_editor.pkgd.min',
|
||||
'cxselect': '../libs/cxselect/js/jquery.cxselect.min',
|
||||
'selectpage': '../libs/selectpage/selectpage',
|
||||
'bootstrap-select': '../libs/bootstrap-select/dist/js/bootstrap-select.min',
|
||||
'bootstrap-select-lang': '../libs/bootstrap-select/dist/js/i18n/defaults-zh_CN',
|
||||
'yntree': '../libs/yntree/yntree',
|
||||
'multitabs':'../libs/bootstrap-multitabs/multitabs',
|
||||
'qrcode':'../libs/jquery.qrcode.min'
|
||||
},
|
||||
map: {
|
||||
'*': {
|
||||
'css': '/app/admin/libs/require-css.min.js' // or whatever the path to require-css is
|
||||
}
|
||||
},
|
||||
shim: {
|
||||
'bootstrap': [
|
||||
'jquery'
|
||||
],
|
||||
'tagsinput': {
|
||||
deps: [
|
||||
'jquery',
|
||||
'css!/app/admin/libs/jquery-tags-input/jquery.tagsinput.min.css'
|
||||
]
|
||||
},
|
||||
'yntree': {
|
||||
deps: [
|
||||
'css!../libs/yntree/yntree.css'
|
||||
]
|
||||
},
|
||||
'bootstrap-select': {
|
||||
deps: [
|
||||
'css!/app/admin/libs/bootstrap-select/dist/css/bootstrap-select.min.css'
|
||||
]
|
||||
},
|
||||
'bootstrap-select-lang': ['bootstrap-select'],
|
||||
'bootstrap-table': {
|
||||
deps: [
|
||||
'bootstrap'
|
||||
],
|
||||
exports: '$.fn.bootstrapTable'
|
||||
},
|
||||
// 'bootstrap-table-treegrid': {
|
||||
// deps: ['bootstrap-table'],
|
||||
// exports: '$.fn.bootstrapTable.defaults'
|
||||
// },
|
||||
'bootstrap-table-treegrid': ['bootstrap-table'],
|
||||
'bootstrap-table-lang': {
|
||||
deps: ['bootstrap-table'],
|
||||
exports: '$.fn.bootstrapTable.defaults'
|
||||
},
|
||||
'bootstrap-table-export': {
|
||||
deps: ['bootstrap-table'],
|
||||
exports: '$.fn.bootstrapTable.defaults'
|
||||
},
|
||||
'bootstrap-table-fixed-columns': {
|
||||
deps: ['bootstrap-table'],
|
||||
exports: '$.fn.bootstrapTable.defaults'
|
||||
},
|
||||
'bootstrap-table-mobile': {
|
||||
deps: ['bootstrap-table'],
|
||||
exports: '$.fn.bootstrapTable.defaults'
|
||||
},
|
||||
'bootstrap-table-advancedsearch': {
|
||||
deps: ['bootstrap-table'],
|
||||
exports: '$.fn.bootstrapTable.defaults'
|
||||
},
|
||||
'bootstrap-table-commonsearch': {
|
||||
deps: ['bootstrap-table'],
|
||||
exports: '$.fn.bootstrapTable.defaults'
|
||||
},
|
||||
'bootstrap-table-template': {
|
||||
deps: ['bootstrap-table', 'template'],
|
||||
exports: '$.fn.bootstrapTable.defaults'
|
||||
},
|
||||
'bootstrap-table-jumpto': {
|
||||
deps: ['bootstrap-table'],
|
||||
exports: '$.fn.bootstrapTable.defaults'
|
||||
},
|
||||
'tableexport': {
|
||||
deps: ['jquery'],
|
||||
exports: '$.fn.extend'
|
||||
},
|
||||
'moment': [
|
||||
'libs/moment/locale/zh-cn',
|
||||
],
|
||||
'froala-editor':{
|
||||
deps: [
|
||||
'jquery',
|
||||
'css!../libs/froala/css/froala_editor.pkgd.min.css'
|
||||
]
|
||||
},
|
||||
'bootstrap-datetimepicker':{
|
||||
deps: [
|
||||
'jquery',
|
||||
'css!/app/admin/libs/bootstrap-datetimepicker/style.css'
|
||||
]
|
||||
}
|
||||
},
|
||||
});
|
||||
window.filterData = {};
|
||||
define('notify', ['jquery'], function ($) {
|
||||
// Create the defaults once
|
||||
var defaults = {
|
||||
element: 'body',
|
||||
position: null,
|
||||
type: "info",
|
||||
allow_dismiss: true,
|
||||
newest_on_top: false,
|
||||
showProgressbar: false,
|
||||
placement: {
|
||||
from: "top",
|
||||
align: "right"
|
||||
},
|
||||
offset: 20,
|
||||
spacing: 10,
|
||||
z_index: 1031,
|
||||
delay: 5000,
|
||||
timer: 1000,
|
||||
url_target: '_blank',
|
||||
mouse_over: null,
|
||||
animate: {
|
||||
enter: 'animated fadeInDown',
|
||||
exit: 'animated fadeOutUp'
|
||||
},
|
||||
onShow: null,
|
||||
onShown: null,
|
||||
onClose: null,
|
||||
onClosed: null,
|
||||
icon_type: 'class',
|
||||
template: '<div data-notify="container" class="col-xs-11 col-sm-4 alert alert-{0}" role="alert"><button type="button" aria-hidden="true" class="close" data-notify="dismiss">×</button><span data-notify="icon"></span> <span data-notify="title">{1}</span> <span data-notify="message">{2}</span><div class="progress" data-notify="progressbar"><div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div></div><a href="{3}" target="{4}" data-notify="url"></a></div>'
|
||||
};
|
||||
|
||||
String.format = function () {
|
||||
var str = arguments[0];
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
str = str.replace(RegExp("\\{" + (i - 1) + "\\}", "gm"), arguments[i]);
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
function Notify(element, content, options) {
|
||||
// Setup Content of Notify
|
||||
var content = {
|
||||
content: {
|
||||
message: typeof content == 'object' ? content.message : content,
|
||||
title: content.title ? content.title : '',
|
||||
icon: content.icon ? content.icon : '',
|
||||
url: content.url ? content.url : '#',
|
||||
target: content.target ? content.target : '-'
|
||||
}
|
||||
};
|
||||
|
||||
options = $.extend(true, {}, content, options);
|
||||
this.settings = $.extend(true, {}, defaults, options);
|
||||
this._defaults = defaults;
|
||||
if (this.settings.content.target == "-") {
|
||||
this.settings.content.target = this.settings.url_target;
|
||||
}
|
||||
this.animations = {
|
||||
start: 'webkitAnimationStart oanimationstart MSAnimationStart animationstart',
|
||||
end: 'webkitAnimationEnd oanimationend MSAnimationEnd animationend'
|
||||
}
|
||||
|
||||
if (typeof this.settings.offset == 'number') {
|
||||
this.settings.offset = {
|
||||
x: this.settings.offset,
|
||||
y: this.settings.offset
|
||||
};
|
||||
}
|
||||
|
||||
this.init();
|
||||
};
|
||||
|
||||
$.extend(Notify.prototype, {
|
||||
init: function () {
|
||||
var self = this;
|
||||
|
||||
this.buildNotify();
|
||||
if (this.settings.content.icon) {
|
||||
this.setIcon();
|
||||
}
|
||||
if (this.settings.content.url != "#") {
|
||||
this.styleURL();
|
||||
}
|
||||
this.placement();
|
||||
this.bind();
|
||||
|
||||
this.notify = {
|
||||
$ele: this.$ele,
|
||||
update: function (command, update) {
|
||||
var commands = {};
|
||||
if (typeof command == "string") {
|
||||
commands[command] = update;
|
||||
} else {
|
||||
commands = command;
|
||||
}
|
||||
for (var command in commands) {
|
||||
switch (command) {
|
||||
case "type":
|
||||
this.$ele.removeClass('alert-' + self.settings.type);
|
||||
this.$ele.find('[data-notify="progressbar"] > .progress-bar').removeClass('progress-bar-' + self.settings.type);
|
||||
self.settings.type = commands[command];
|
||||
this.$ele.addClass('alert-' + commands[command]).find('[data-notify="progressbar"] > .progress-bar').addClass('progress-bar-' + commands[command]);
|
||||
break;
|
||||
case "icon":
|
||||
var $icon = this.$ele.find('[data-notify="icon"]');
|
||||
if (self.settings.icon_type.toLowerCase() == 'class') {
|
||||
$icon.removeClass(self.settings.content.icon).addClass(commands[command]);
|
||||
} else {
|
||||
if (!$icon.is('img')) {
|
||||
$icon.find('img');
|
||||
}
|
||||
$icon.attr('src', commands[command]);
|
||||
}
|
||||
break;
|
||||
case "progress":
|
||||
var newDelay = self.settings.delay - (self.settings.delay * (commands[command] / 100));
|
||||
this.$ele.data('notify-delay', newDelay);
|
||||
this.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', commands[command]).css('width', commands[command] + '%');
|
||||
break;
|
||||
case "url":
|
||||
this.$ele.find('[data-notify="url"]').attr('href', commands[command]);
|
||||
break;
|
||||
case "target":
|
||||
this.$ele.find('[data-notify="url"]').attr('target', commands[command]);
|
||||
break;
|
||||
default:
|
||||
this.$ele.find('[data-notify="' + command + '"]').html(commands[command]);
|
||||
};
|
||||
}
|
||||
var posX = this.$ele.outerHeight() + parseInt(self.settings.spacing) + parseInt(self.settings.offset.y);
|
||||
self.reposition(posX);
|
||||
},
|
||||
close: function () {
|
||||
self.close();
|
||||
}
|
||||
};
|
||||
},
|
||||
buildNotify: function () {
|
||||
var content = this.settings.content;
|
||||
this.$ele = $(String.format(this.settings.template, this.settings.type, content.title, content.message, content.url, content.target));
|
||||
this.$ele.attr('data-notify-position', this.settings.placement.from + '-' + this.settings.placement.align);
|
||||
if (!this.settings.allow_dismiss) {
|
||||
this.$ele.find('[data-notify="dismiss"]').css('display', 'none');
|
||||
}
|
||||
if ((this.settings.delay <= 0 && !this.settings.showProgressbar) || !this.settings.showProgressbar) {
|
||||
this.$ele.find('[data-notify="progressbar"]').remove();
|
||||
}
|
||||
},
|
||||
setIcon: function () {
|
||||
if (this.settings.icon_type.toLowerCase() == 'class') {
|
||||
this.$ele.find('[data-notify="icon"]').addClass(this.settings.content.icon);
|
||||
} else {
|
||||
if (this.$ele.find('[data-notify="icon"]').is('img')) {
|
||||
this.$ele.find('[data-notify="icon"]').attr('src', this.settings.content.icon);
|
||||
} else {
|
||||
this.$ele.find('[data-notify="icon"]').append('<img src="' + this.settings.content.icon + '" alt="Notify Icon" />');
|
||||
}
|
||||
}
|
||||
},
|
||||
styleURL: function () {
|
||||
this.$ele.find('[data-notify="url"]').css({
|
||||
backgroundImage: 'url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)',
|
||||
height: '100%',
|
||||
left: '0px',
|
||||
position: 'absolute',
|
||||
top: '0px',
|
||||
width: '100%',
|
||||
zIndex: this.settings.z_index + 1
|
||||
});
|
||||
this.$ele.find('[data-notify="dismiss"]').css({
|
||||
position: 'absolute',
|
||||
right: '10px',
|
||||
top: '5px',
|
||||
zIndex: this.settings.z_index + 2
|
||||
});
|
||||
},
|
||||
placement: function () {
|
||||
var self = this,
|
||||
offsetAmt = this.settings.offset.y,
|
||||
css = {
|
||||
display: 'inline-block',
|
||||
margin: '0px auto',
|
||||
position: this.settings.position ? this.settings.position : (this.settings.element === 'body' ? 'fixed' : 'absolute'),
|
||||
transition: 'all .5s ease-in-out',
|
||||
zIndex: this.settings.z_index
|
||||
},
|
||||
hasAnimation = false,
|
||||
settings = this.settings;
|
||||
|
||||
$('[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])').each(function () {
|
||||
return offsetAmt = Math.max(offsetAmt, parseInt($(this).css(settings.placement.from)) + parseInt($(this).outerHeight()) + parseInt(settings.spacing));
|
||||
});
|
||||
if (this.settings.newest_on_top == true) {
|
||||
offsetAmt = this.settings.offset.y;
|
||||
}
|
||||
css[this.settings.placement.from] = offsetAmt + 'px';
|
||||
|
||||
switch (this.settings.placement.align) {
|
||||
case "left":
|
||||
case "right":
|
||||
css[this.settings.placement.align] = this.settings.offset.x + 'px';
|
||||
break;
|
||||
case "center":
|
||||
css.left = 0;
|
||||
css.right = 0;
|
||||
break;
|
||||
}
|
||||
this.$ele.css(css).addClass(this.settings.animate.enter);
|
||||
$.each(Array('webkit', 'moz', 'o', 'ms', ''), function (index, prefix) {
|
||||
self.$ele[0].style[prefix + 'AnimationIterationCount'] = 1;
|
||||
});
|
||||
|
||||
$(this.settings.element).append(this.$ele);
|
||||
|
||||
if (this.settings.newest_on_top == true) {
|
||||
offsetAmt = (parseInt(offsetAmt) + parseInt(this.settings.spacing)) + this.$ele.outerHeight();
|
||||
this.reposition(offsetAmt);
|
||||
}
|
||||
|
||||
if ($.isFunction(self.settings.onShow)) {
|
||||
self.settings.onShow.call(this.$ele);
|
||||
}
|
||||
|
||||
this.$ele.one(this.animations.start, function (event) {
|
||||
hasAnimation = true;
|
||||
}).one(this.animations.end, function (event) {
|
||||
if ($.isFunction(self.settings.onShown)) {
|
||||
self.settings.onShown.call(this);
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
if (!hasAnimation) {
|
||||
if ($.isFunction(self.settings.onShown)) {
|
||||
self.settings.onShown.call(this);
|
||||
}
|
||||
}
|
||||
}, 600);
|
||||
},
|
||||
bind: function () {
|
||||
var self = this;
|
||||
|
||||
this.$ele.find('[data-notify="dismiss"]').on('click', function () {
|
||||
self.close();
|
||||
})
|
||||
|
||||
this.$ele.mouseover(function (e) {
|
||||
$(this).data('data-hover', "true");
|
||||
}).mouseout(function (e) {
|
||||
$(this).data('data-hover', "false");
|
||||
});
|
||||
this.$ele.data('data-hover', "false");
|
||||
|
||||
if (this.settings.delay > 0) {
|
||||
self.$ele.data('notify-delay', self.settings.delay);
|
||||
var timer = setInterval(function () {
|
||||
var delay = parseInt(self.$ele.data('notify-delay')) - self.settings.timer;
|
||||
if ((self.$ele.data('data-hover') === 'false' && self.settings.mouse_over == "pause") || self.settings.mouse_over != "pause") {
|
||||
var percent = ((self.settings.delay - delay) / self.settings.delay) * 100;
|
||||
self.$ele.data('notify-delay', delay);
|
||||
self.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', percent).css('width', percent + '%');
|
||||
}
|
||||
if (delay <= -(self.settings.timer)) {
|
||||
clearInterval(timer);
|
||||
self.close();
|
||||
}
|
||||
}, self.settings.timer);
|
||||
}
|
||||
},
|
||||
close: function () {
|
||||
var self = this,
|
||||
$successors = null,
|
||||
posX = parseInt(this.$ele.css(this.settings.placement.from)),
|
||||
hasAnimation = false;
|
||||
|
||||
this.$ele.data('closing', 'true').addClass(this.settings.animate.exit);
|
||||
self.reposition(posX);
|
||||
|
||||
if ($.isFunction(self.settings.onClose)) {
|
||||
self.settings.onClose.call(this.$ele);
|
||||
}
|
||||
|
||||
this.$ele.one(this.animations.start, function (event) {
|
||||
hasAnimation = true;
|
||||
}).one(this.animations.end, function (event) {
|
||||
$(this).remove();
|
||||
if ($.isFunction(self.settings.onClosed)) {
|
||||
self.settings.onClosed.call(this);
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
if (!hasAnimation) {
|
||||
self.$ele.remove();
|
||||
if (self.settings.onClosed) {
|
||||
self.settings.onClosed(self.$ele);
|
||||
}
|
||||
}
|
||||
}, 600);
|
||||
},
|
||||
reposition: function (posX) {
|
||||
var self = this,
|
||||
notifies = '[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])',
|
||||
$elements = this.$ele.nextAll(notifies);
|
||||
if (this.settings.newest_on_top == true) {
|
||||
$elements = this.$ele.prevAll(notifies);
|
||||
}
|
||||
$elements.each(function () {
|
||||
$(this).css(self.settings.placement.from, posX);
|
||||
posX = (parseInt(posX) + parseInt(self.settings.spacing)) + $(this).outerHeight();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$.notify = function (content, options) {
|
||||
var plugin = new Notify(this, content, options);
|
||||
return plugin.notify;
|
||||
};
|
||||
$.notifyDefaults = function (options) {
|
||||
defaults = $.extend(true, {}, defaults, options);
|
||||
return defaults;
|
||||
};
|
||||
$.notifyClose = function (command) {
|
||||
if (typeof command === "undefined" || command == "all") {
|
||||
$('[data-notify]').find('[data-notify="dismiss"]').trigger('click');
|
||||
} else {
|
||||
$('[data-notify-position="' + command + '"]').find('[data-notify="dismiss"]').trigger('click');
|
||||
}
|
||||
};
|
||||
return $.notify;
|
||||
});
|
||||
define('lightyear', ['notify'], function (notify) {
|
||||
var lightyear = function () {
|
||||
|
||||
/**
|
||||
* 页面loading
|
||||
*/
|
||||
var pageLoader = function ($mode) {
|
||||
var $loadingEl = jQuery('#lyear-loading');
|
||||
$mode = $mode || 'show';
|
||||
if ($mode === 'show') {
|
||||
if ($loadingEl.length) {
|
||||
$loadingEl.fadeIn(250);
|
||||
} else {
|
||||
jQuery('body').prepend('<div id="lyear-loading"><div class="spinner-border text-primary" role="status"><span class="sr-only">Loading...</span></div></div>');
|
||||
}
|
||||
} else if ($mode === 'hide') {
|
||||
if ($loadingEl.length) {
|
||||
$loadingEl.fadeOut(250);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* 页面小提示
|
||||
* @param $msg 提示信息
|
||||
* @param $type 提示类型:'info', 'success', 'warning', 'danger'
|
||||
* @param $delay 毫秒数,例如:1000
|
||||
* @param $icon 图标,例如:'fa fa-user' 或 'glyphicon glyphicon-warning-sign'
|
||||
* @param $from 'top' 或 'bottom'
|
||||
* @param $align 'left', 'right', 'center'
|
||||
* @param $url 跳转链接 例如: https://www.xxxx.com
|
||||
* @author CaiWeiMing <314013107@qq.com>
|
||||
*/
|
||||
var tips = function ($msg, $type, $delay, $icon, $from, $align, $url) {
|
||||
$type = $type || 'info';
|
||||
$delay = $delay || 1000;
|
||||
$from = $from || 'top';
|
||||
$align = $align || 'center';
|
||||
$enter = $type == 'danger' ? 'animated shake' : 'animated fadeInUp';
|
||||
$url = $url || url;
|
||||
jQuery.notify({
|
||||
icon: $icon,
|
||||
message: $msg
|
||||
},
|
||||
{
|
||||
element: 'body',
|
||||
type: $type,
|
||||
allow_dismiss: true,
|
||||
newest_on_top: true,
|
||||
showProgressbar: false,
|
||||
placement: {
|
||||
from: $from,
|
||||
align: $align
|
||||
},
|
||||
offset: 20,
|
||||
spacing: 10,
|
||||
z_index: 10800,
|
||||
delay: $delay,
|
||||
//timer: 1000,
|
||||
animate: {
|
||||
enter: $enter,
|
||||
exit: 'animated fadeOutDown'
|
||||
}
|
||||
});
|
||||
if ($url != '') {
|
||||
setTimeout(function () {
|
||||
window.location.href = $url;
|
||||
}, $delay);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var url = '';
|
||||
|
||||
return {
|
||||
// 页面小提示
|
||||
notify: function ($msg, $type, $delay, $icon, $from, $align, $url) {
|
||||
tips($msg, $type, $delay, $icon, $from, $align, $url);
|
||||
},
|
||||
url: function ($url) {
|
||||
url = $url;
|
||||
},
|
||||
// 页面加载动画
|
||||
loading: function ($mode) {
|
||||
pageLoader($mode);
|
||||
}
|
||||
};
|
||||
}();
|
||||
return lightyear;
|
||||
});
|
||||
define(['jquery', 'bootstrap-datepicker', 'fast','tagsinput','moment','bootstrap-datetimepicker'], function ($, a, Fast,ss,momen) {
|
||||
var App = {
|
||||
init: function () {
|
||||
// 提示
|
||||
if ($('[data-toggle="tooltip"]')[0]) {
|
||||
$('[data-toggle="tooltip"]').tooltip({
|
||||
"container": 'body',
|
||||
});
|
||||
}
|
||||
|
||||
// 弹出框
|
||||
if ($('[data-toggle="popover"]')[0]) {
|
||||
$('[data-toggle="popover"]').popover();
|
||||
}
|
||||
|
||||
// 标签
|
||||
$('.js-tags-input,[data-role="tagsinput"]').each(function () {
|
||||
var $this = $(this);
|
||||
$this.tagsInput({
|
||||
height: $this.data('height') ? $this.data('height') : '38px',
|
||||
width: '100%',
|
||||
defaultText: $this.attr("placeholder"),
|
||||
removeWithBackspace: true,
|
||||
delimiter: [$this.data('delimiter') || ',']
|
||||
});
|
||||
});
|
||||
|
||||
// 日期时间选择
|
||||
$('.js-datepicker,.js-datetimepicker').each(function () {
|
||||
var $input = $(this);
|
||||
$input.datetimepicker({
|
||||
format: $input.data('format') ? $input.data('format') : ($input.hasClass('js-datetimepicker') ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'),
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// 复选框全选
|
||||
$("#check-all").change(function () {
|
||||
if ($boxname = $(this).data('name')) {
|
||||
$(this).closest('table').find("input[name='" + $boxname + "']").prop('checked', $(this).prop("checked"));
|
||||
} else {
|
||||
$(this).closest('table').find(".lyear-checkbox input[type='checkbox']").prop('checked', $(this).prop("checked"));
|
||||
}
|
||||
});
|
||||
|
||||
// iframe打开tab
|
||||
$(document).on('click', '.js-create-tab', function () {
|
||||
parent.$(parent.document).data('multitabs').create({
|
||||
iframe: true,
|
||||
title: $(this).data('title') ? $(this).data('title') : '标题',
|
||||
url: $(this).data('url') ? $(this).data('url') : 'lyear-main.html'
|
||||
}, true);
|
||||
});
|
||||
$(document).on('click', '.btn-dialog,.dialogit', function (e) {
|
||||
var that = this;
|
||||
var options = $.extend({}, $(that).data() || {});
|
||||
var url = Fast.api.replaceids(that, $(that).data("url") || $(that).attr('href'));
|
||||
var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
|
||||
var button = Fast.api.gettablecolumnbutton(options);
|
||||
if (button && typeof button.callback === 'function') {
|
||||
options.callback = button.callback;
|
||||
}
|
||||
//console.log(options)
|
||||
if (typeof options.confirm !== 'undefined') {
|
||||
Layer.confirm(options.confirm, function (index) {
|
||||
Fast.api.open(url, title, options);
|
||||
Layer.close(index);
|
||||
});
|
||||
} else {
|
||||
window[$(that).data("window") || 'self'].Fast.api.open(url, title, options);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//点击包含.btn-addtabs的元素时新增选项卡
|
||||
$(document).on('click', '.btn-addtabs,.addtabsit', function (e) {
|
||||
var that = this;
|
||||
var options = $.extend({}, $(that).data() || {});
|
||||
var url = BacFastkend.api.replaceids(that, $(that).data("url") || $(that).attr('href'));
|
||||
var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
|
||||
var icon = $(that).attr("icon") || $(that).data("icon");
|
||||
if (typeof options.confirm !== 'undefined') {
|
||||
Layer.confirm(options.confirm, function (index) {
|
||||
Fast.api.addtabs(url, title, icon);
|
||||
Layer.close(index);
|
||||
});
|
||||
} else {
|
||||
Fast.api.addtabs(url, title, icon);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//点击包含.btn-ajax的元素时发送Ajax请求
|
||||
$(document).on('click', '.btn-ajax', function (e) {
|
||||
var that = this;
|
||||
var options = $.extend({}, $(that).data() || {});
|
||||
if (typeof options.url === 'undefined' && $(that).attr("href")) {
|
||||
options.url = $(that).attr("href");
|
||||
}
|
||||
options.url = Fast.api.replaceids(this, options.url);
|
||||
var success = typeof options.success === 'function' ? options.success : null;
|
||||
var error = typeof options.error === 'function' ? options.error : null;
|
||||
var button = Fast.api.gettablecolumnbutton(options);
|
||||
if(button){
|
||||
delete options.success;
|
||||
delete options.error;
|
||||
if (button) {
|
||||
if (typeof button.success === 'function') {
|
||||
success = button.success;
|
||||
}
|
||||
if (typeof button.error === 'function') {
|
||||
error = button.error;
|
||||
}
|
||||
}
|
||||
}
|
||||
//如果未设备成功的回调,设定了自动刷新的情况下自动进行刷新
|
||||
if (!success && typeof options.tableId !== 'undefined' && typeof options.refresh !== 'undefined' && options.refresh) {
|
||||
success = function () {
|
||||
$("#" + options.tableId).bootstrapTable('refresh');
|
||||
}
|
||||
}
|
||||
if (typeof options.confirm !== 'undefined') {
|
||||
Layer.confirm(options.confirm, function (index) {
|
||||
Fast.api.ajax(options, success, error);
|
||||
Layer.close(index);
|
||||
});
|
||||
} else {
|
||||
Fast.api.ajax(options, success, error);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$(document).on('click', '.btn-click,.clickit', function (e) {
|
||||
var that = this;
|
||||
var options = $.extend({}, $(that).data() || {});
|
||||
var row = {};
|
||||
if (typeof options.tableId !== 'undefined') {
|
||||
var index = parseInt(options.rowIndex);
|
||||
var data = $("#" + options.tableId).bootstrapTable('getData');
|
||||
row = typeof data[index] !== 'undefined' ? data[index] : {};
|
||||
}
|
||||
var button = Fast.api.gettablecolumnbutton(options);
|
||||
var click = typeof button.click === 'function' ? button.click : $.noop;
|
||||
|
||||
if (typeof options.confirm !== 'undefined') {
|
||||
Layer.confirm(options.confirm, function (index) {
|
||||
click.apply(that, [options, row, button]);
|
||||
Layer.close(index);
|
||||
});
|
||||
} else {
|
||||
click.apply(that, [options, row, button]);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$(document).on('click', '.previewitem .btn-preview', function (e) {
|
||||
var that = this;
|
||||
var srcs = [];
|
||||
var index = $(this).parents('ul').find('li .img-responsive').index($(this).parents('li').find('.img-responsive'))
|
||||
$(this).parents('ul').find('li .img-responsive').each(function(v,k){
|
||||
srcs.push({
|
||||
"src": $(this).attr('data-url'),
|
||||
"alt": "图片名",
|
||||
"pid":k,
|
||||
"thumb": $(this).attr('data-url')
|
||||
});
|
||||
});
|
||||
(parent ? parent.layer : layer).photos({
|
||||
zIndex:19891033,
|
||||
photos: { // 图片层的数据源
|
||||
"title": "", // 相册标题
|
||||
"id": 123, // 相册 id
|
||||
"start": index, // 初始显示的图片序号,默认 0
|
||||
"data": srcs
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}).on('click', '.previewitem .btn-remove', function (e) {
|
||||
var that = this;
|
||||
var src = $(this).parents('li').find('.img-responsive').attr('data-url');
|
||||
var ipt = $(this).parents('ul').siblings('[type=hidden]');
|
||||
var val = ipt.val().split(',');
|
||||
var newval = [];
|
||||
for (let i = 0; i < val.length; i++) {
|
||||
const element = val[i];
|
||||
if(src != val[i]){
|
||||
newval.push(val[i]);
|
||||
}
|
||||
}
|
||||
ipt.val(newval.join(',')).trigger('change');
|
||||
return false;
|
||||
});
|
||||
//修复含有fixed-footer类的body边距
|
||||
if ($(".fixed-footer").length > 0) {
|
||||
$(document.body).css("padding-bottom", $(".fixed-footer").outerHeight());
|
||||
}
|
||||
//修复不在iframe时layer-footer隐藏的问题
|
||||
if ($(".layer-footer").length > 0 && self === top) {
|
||||
$(".layer-footer").show();
|
||||
}
|
||||
//tooltip和popover
|
||||
if (!('ontouchstart' in document.documentElement)) {
|
||||
$('body').tooltip({ selector: '[data-toggle="tooltip"]', trigger: 'hover' });
|
||||
}
|
||||
$('body').popover({ selector: '[data-toggle="popover"]' });
|
||||
}
|
||||
}
|
||||
var Config = requirejs.s.contexts._.config.config;
|
||||
//将Config渲染到全局
|
||||
window.Config = Config;
|
||||
App.init();
|
||||
requirejs([Config.controller.toLowerCase()], function (app) {
|
||||
if (app[Config.action]) { app[Config.action](); }
|
||||
});
|
||||
return App;
|
||||
});
|
||||
Reference in New Issue
Block a user