mirror of https://gitee.com/karson/fastadmin.git
Merge pull request !5 from PPPSCN/master
commit
862f93ce88
|
|
@ -38,6 +38,7 @@ return [
|
||||||
'Reset' => '重置',
|
'Reset' => '重置',
|
||||||
'Execute' => '执行',
|
'Execute' => '执行',
|
||||||
'Close' => '关闭',
|
'Close' => '关闭',
|
||||||
|
'Choose' => '选择',
|
||||||
'Search' => '搜索',
|
'Search' => '搜索',
|
||||||
'Refresh' => '刷新',
|
'Refresh' => '刷新',
|
||||||
'First' => '首页',
|
'First' => '首页',
|
||||||
|
|
@ -84,6 +85,7 @@ return [
|
||||||
'Network error' => '网络错误!',
|
'Network error' => '网络错误!',
|
||||||
'Issues & Wiki' => '问题交流',
|
'Issues & Wiki' => '问题交流',
|
||||||
'Advanced search' => '高级搜索',
|
'Advanced search' => '高级搜索',
|
||||||
|
'Common search' => '普通搜索',
|
||||||
'%d second%s ago' => '%d秒前',
|
'%d second%s ago' => '%d秒前',
|
||||||
'%d minute%s ago' => '%d分钟前',
|
'%d minute%s ago' => '%d分钟前',
|
||||||
'%d hour%s ago' => '%d小时前',
|
'%d hour%s ago' => '%d小时前',
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@ return [
|
||||||
*/
|
*/
|
||||||
'uploadurl' => 'ajax/upload',
|
'uploadurl' => 'ajax/upload',
|
||||||
/**
|
/**
|
||||||
* 又拍云或本机的CDN地址
|
* 本机的CDN地址或又拍云http://yourbucketname.b0.upaiyun.com
|
||||||
*/
|
*/
|
||||||
'cdnurl' => 'http://yourbucketname.b0.upaiyun.com',
|
'cdnurl' => '',
|
||||||
/**
|
/**
|
||||||
* 上传成功后的通知地址
|
* 上传成功后的通知地址
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,10 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table', 'config'], function (
|
||||||
{field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime},
|
{field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime},
|
||||||
{field: 'operate', title: __('Operate'), events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
{field: 'operate', title: __('Operate'), events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||||
]
|
]
|
||||||
]
|
],
|
||||||
|
//普通搜索
|
||||||
|
commonSearch: true,
|
||||||
|
titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
|
||||||
});
|
});
|
||||||
|
|
||||||
// 为表格绑定事件
|
// 为表格绑定事件
|
||||||
|
|
@ -56,7 +59,8 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table', 'config'], function (
|
||||||
thumb: function (value, row, index) {
|
thumb: function (value, row, index) {
|
||||||
//console.log(row);
|
//console.log(row);
|
||||||
if (row.mimetype.indexOf("image") > -1) {
|
if (row.mimetype.indexOf("image") > -1) {
|
||||||
if (Config.upload.bucket.replace(/^\s+|\s+$/gm, '').length === 0) {
|
var reg = /ajax\/upload$/;
|
||||||
|
if (reg.test(Config.upload.uploadurl)) {
|
||||||
return '<a href="' + Config.upload.cdnurl + value + '" target="_blank"><img src="' + Config.upload.cdnurl + value + '" alt="" style="max-height:90px;max-width:120px"></a>';
|
return '<a href="' + Config.upload.cdnurl + value + '" target="_blank"><img src="' + Config.upload.cdnurl + value + '" alt="" style="max-height:90px;max-width:120px"></a>';
|
||||||
} else {
|
} else {
|
||||||
return '<a href="' + Config.upload.cdnurl + value + '" target="_blank"><img src="' + Config.upload.cdnurl + value + '!/fwfh/50x50" alt=""></a>';
|
return '<a href="' + Config.upload.cdnurl + value + '" target="_blank"><img src="' + Config.upload.cdnurl + value + '!/fwfh/50x50" alt=""></a>';
|
||||||
|
|
|
||||||
|
|
@ -23,25 +23,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
columns: [
|
columns: [
|
||||||
[
|
[
|
||||||
{field: 'state', checkbox: true},
|
{field: 'state', checkbox: true},
|
||||||
{field: 'id', title: __('Id')},
|
{field: 'id', title: __('Id'), operate: false},
|
||||||
{field: 'category_id', title: __('Category_id')},
|
{field: 'category_id', title: __('Category_id'), operate: '='},
|
||||||
{field: 'title', title: __('Title')},
|
{field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '标题,模糊搜索', style: 'width:200px'},
|
||||||
{field: 'keywords', title: __('Keywords')},
|
{field: 'keywords', title: __('Keywords'), operate: 'LIKE %...%', placeholder: '关键字,模糊搜索'},
|
||||||
{field: 'flag', title: __('Flag'), formatter: Table.api.formatter.flag},
|
{field: 'flag', title: __('Flag'), formatter: Table.api.formatter.flag, operate: false},
|
||||||
{field: 'image', title: __('Image'), formatter: Table.api.formatter.image},
|
{field: 'image', title: __('Image'), formatter: Table.api.formatter.image, operate: false},
|
||||||
{field: 'icon', title: __('Icon'), formatter: Table.api.formatter.icon},
|
{field: 'icon', title: __('Icon'), formatter: Table.api.formatter.icon, operate: false},
|
||||||
{field: 'views', title: __('Views')},
|
{field: 'views', title: __('Views'), operate: false},
|
||||||
{field: 'comments', title: __('Comments')},
|
{field: 'comments', title: __('Comments'), operate: false},
|
||||||
{field: 'weigh', title: __('Weigh')},
|
{field: 'weigh', title: __('Weigh'), operate: false},
|
||||||
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status},
|
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {'normal': '正常', 'hidden': '隐藏'}, style: 'min-width:100px;'},
|
||||||
|
{field: 'createtime', title: __('Create Time'), formatter: Table.api.formatter.datetime, operate: 'BETWEEN', type: 'datetime', addclass: 'datetimepicker', data: 'data-date-format="YYYY-MM-DD"'},
|
||||||
{field: 'operate', title: __('Operate'), events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
{field: 'operate', title: __('Operate'), events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||||
]
|
]
|
||||||
]
|
],
|
||||||
|
//普通搜索
|
||||||
|
commonSearch: true,
|
||||||
|
titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
|
||||||
});
|
});
|
||||||
|
|
||||||
// 为表格绑定事件
|
// 为表格绑定事件
|
||||||
Table.api.bindevent(table);
|
Table.api.bindevent(table);
|
||||||
parent.window.Backend.api.sidebar({'auth/admin':44});
|
|
||||||
},
|
},
|
||||||
add: function () {
|
add: function () {
|
||||||
Controller.api.bindevent();
|
Controller.api.bindevent();
|
||||||
|
|
|
||||||
|
|
@ -152,19 +152,19 @@
|
||||||
});
|
});
|
||||||
$.extend($.fn.bootstrapTable.locales, {
|
$.extend($.fn.bootstrapTable.locales, {
|
||||||
formatAdvancedSearch: function () {
|
formatAdvancedSearch: function () {
|
||||||
return 'Advanced search';
|
return __('Advanced search');
|
||||||
},
|
},
|
||||||
formatAdvancedSubmitButton: function () {
|
formatAdvancedSubmitButton: function () {
|
||||||
return "Submit";
|
return __("Submit");
|
||||||
},
|
},
|
||||||
formatAdvancedResetButton: function () {
|
formatAdvancedResetButton: function () {
|
||||||
return "Reset";
|
return __("Reset");
|
||||||
},
|
},
|
||||||
formatAdvancedCloseButton: function () {
|
formatAdvancedCloseButton: function () {
|
||||||
return "Close";
|
return __("Close");
|
||||||
},
|
},
|
||||||
formatAdvancedChoose: function () {
|
formatAdvancedChoose: function () {
|
||||||
return "Choose";
|
return __("Choose");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,324 @@
|
||||||
|
/**
|
||||||
|
* @author: pppscn <35696959@qq.com>
|
||||||
|
* @version: v0.0.1
|
||||||
|
*
|
||||||
|
* @update 2017-05-07 <http://git.oschina.net/pp/fastadmin>
|
||||||
|
*/
|
||||||
|
|
||||||
|
!function ($) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var firstLoad = false;
|
||||||
|
|
||||||
|
var sprintf = $.fn.bootstrapTable.utils.sprintf;
|
||||||
|
|
||||||
|
var showCommonSearch = function (pColumns, that) {
|
||||||
|
|
||||||
|
var vFormCommon = createFormCommon(pColumns, that), timeoutId = 0;
|
||||||
|
|
||||||
|
var vModal = sprintf("<div id=\"commonSearchModalContent_%s\" class=\"well bs-component\">", that.options.idTable);
|
||||||
|
vModal += vFormCommon.join('');
|
||||||
|
vModal += "</div>";
|
||||||
|
$("#myTabContent").before($(vModal));
|
||||||
|
|
||||||
|
if (that.options.sidePagination != 'server' || !that.options.url) {
|
||||||
|
$('#' + that.options.idForm).off('keyup blur', 'input').on('keyup blur', 'input', function (event) {
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
timeoutId = setTimeout(function () {
|
||||||
|
that.onColumnCommonSearch(event);
|
||||||
|
}, that.options.searchTimeOut);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//绑定日期时间元素事件
|
||||||
|
var form = $("#" + that.options.idForm);
|
||||||
|
if ($(".datetimepicker", form).size() > 0) {
|
||||||
|
require(['bootstrap-datetimepicker'], function () {
|
||||||
|
$('.datetimepicker', form).parent().css('position', 'relative');
|
||||||
|
$('.datetimepicker', form).datetimepicker({
|
||||||
|
//format: 'YYYY-MM-DD',
|
||||||
|
icons: {
|
||||||
|
time: 'fa fa-clock-o',
|
||||||
|
date: 'fa fa-calendar',
|
||||||
|
up: 'fa fa-chevron-up',
|
||||||
|
down: 'fa fa-chevron-down',
|
||||||
|
previous: 'fa fa-chevron-left',
|
||||||
|
next: 'fa fa-chevron-right',
|
||||||
|
today: 'fa fa-history',
|
||||||
|
clear: 'fa fa-trash',
|
||||||
|
close: 'fa fa-remove'
|
||||||
|
},
|
||||||
|
showTodayButton: true,
|
||||||
|
showClose: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交搜索
|
||||||
|
$("#btnSubmitCommon" + "_" + that.options.idTable).click(function (event) {
|
||||||
|
that.onColumnCommonSearch();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 重置搜索
|
||||||
|
$("#btnResetCommon" + "_" + that.options.idTable).click(function () {
|
||||||
|
$("#commonSearchModalContent" + "_" + that.options.idTable + " form")[0].reset();
|
||||||
|
that.onColumnCommonSearch();
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var createFormCommon = function (pColumns, that) {
|
||||||
|
var htmlForm = [];
|
||||||
|
var opList = ['=', '>', '>=', '<', '<=', '!=', 'LIKE', 'LIKE %...%', 'NOT LIKE', 'IN(...)', 'NOT IN(...)', 'BETWEEN', 'NOT BETWEEN', 'IS NULL', 'IS NOT NULL'];
|
||||||
|
//var selectList = [];
|
||||||
|
//for (var i = 0; i < opList.length; i++) {
|
||||||
|
// selectList.push("<option value='" + opList[i] + "'>" + opList[i] + "</option>");
|
||||||
|
//}
|
||||||
|
//var selectHtml = selectList.join('');
|
||||||
|
htmlForm.push(sprintf('<form class="form-inline" id="%s" action="%s" >', that.options.idForm, that.options.actionForm));
|
||||||
|
htmlForm.push('<fieldset>');
|
||||||
|
if (that.options.titleForm.length > 0)
|
||||||
|
htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
|
||||||
|
for (var i in pColumns) {
|
||||||
|
var vObjCol = pColumns[i];
|
||||||
|
if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.visible && vObjCol.searchable && vObjCol.operate !== false) {
|
||||||
|
htmlForm.push('<div class="form-group" style="margin:0 5px;">');
|
||||||
|
htmlForm.push(sprintf('<label for="%s" class="control-label" style="padding:0 10px">%s</label>', vObjCol.field, vObjCol.title));
|
||||||
|
if (that.options.sidePagination == 'server' && that.options.url) {
|
||||||
|
//htmlForm.push('<div class="col-sm-2">');
|
||||||
|
//htmlForm.push(sprintf('<select class="form-control" name="field-%s" data-name="%s">%s</select>', vObjCol.field, vObjCol.field, selectHtml));
|
||||||
|
vObjCol.operate = (typeof vObjCol.operate === 'undefined' || $.inArray(vObjCol.operate, opList) === -1) ? '=' : vObjCol.operate;
|
||||||
|
htmlForm.push(sprintf('<input type="hidden" class="form-control operate" name="field-%s" data-name="%s" value="%s" readonly>', vObjCol.field, vObjCol.field, vObjCol.operate));
|
||||||
|
//htmlForm.push('</div>');
|
||||||
|
}
|
||||||
|
|
||||||
|
//htmlForm.push('<div class="col-sm-8">');
|
||||||
|
var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style);
|
||||||
|
if (vObjCol.searchList) {
|
||||||
|
if (typeof vObjCol.searchList == 'function') {
|
||||||
|
htmlForm.push(vObjCol.searchList.call(this, vObjCol));
|
||||||
|
} else {
|
||||||
|
var isArray = vObjCol.searchList.constructor === Array;
|
||||||
|
var searchList = [];
|
||||||
|
searchList.push(sprintf('<option value="">%s</option>', $.fn.bootstrapTable.locales.formatCommonChoose()));
|
||||||
|
$.each(vObjCol.searchList, function (key, value) {
|
||||||
|
searchList.push("<option value='" + (isArray ? value : key) + "'>" + value + "</option>");
|
||||||
|
});
|
||||||
|
htmlForm.push(sprintf('<select class="form-control" name="%s" %s>%s</select>', vObjCol.field, style, searchList.join('')));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder;
|
||||||
|
var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type;
|
||||||
|
var addclass = typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass;
|
||||||
|
var data = typeof vObjCol.data === 'undefined' ? '' : vObjCol.data;
|
||||||
|
htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" placeholder="%s" id="%s" %s %s>', type, addclass, vObjCol.field, placeholder, vObjCol.field, style, data));
|
||||||
|
var reg = /BETWEEN$/;
|
||||||
|
if (reg.test(vObjCol.operate)) {
|
||||||
|
htmlForm.push(sprintf(' - <input type="%s" class="%s" name="%s" placeholder="%s" id="%s" %s %s>', type, addclass, vObjCol.field, placeholder, vObjCol.field, style, data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//htmlForm.push('</div>');
|
||||||
|
htmlForm.push('</div>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
htmlForm.push('<div class="form-group" style="margin:0 5px;">');
|
||||||
|
htmlForm.push(createFormBtn(that).join(''));
|
||||||
|
htmlForm.push('</div>');
|
||||||
|
htmlForm.push('</fieldset>');
|
||||||
|
htmlForm.push('</form>');
|
||||||
|
|
||||||
|
return htmlForm;
|
||||||
|
};
|
||||||
|
|
||||||
|
var createFormBtn = function (that) {
|
||||||
|
var htmlBtn = [];
|
||||||
|
var searchSubmit = that.options.formatCommonSubmitButton();
|
||||||
|
var searchReset = that.options.formatCommonResetButton();
|
||||||
|
var searchClose = that.options.formatCommonCloseButton();
|
||||||
|
htmlBtn.push('<div class="form-group">');
|
||||||
|
htmlBtn.push('<div class="col-sm-12 text-center">');
|
||||||
|
if (that.options.sidePagination == 'server' && that.options.url) {
|
||||||
|
htmlBtn.push(sprintf('<button type="button" id="btnSubmitCommon%s" class="btn btn-success" >%s</button> ', "_" + that.options.idTable, searchSubmit));
|
||||||
|
htmlBtn.push(sprintf('<button type="button" id="btnResetCommon%s" class="btn btn-default" >%s</button> ', "_" + that.options.idTable, searchReset));
|
||||||
|
} else {
|
||||||
|
htmlBtn.push(sprintf('<button type="button" id="btnCloseCommon%s" data-dismiss="modal" class="btn btn-default" >%s</button> ', "_" + that.options.idTable, searchClose));
|
||||||
|
}
|
||||||
|
htmlBtn.push('</div>');
|
||||||
|
htmlBtn.push('</div>');
|
||||||
|
return htmlBtn;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.defaults, {
|
||||||
|
commonSearch: false,
|
||||||
|
idForm: 'commonSearch',
|
||||||
|
titleForm: __("Common search"),
|
||||||
|
actionForm: '',
|
||||||
|
idTable: undefined,
|
||||||
|
onColumnCommonSearch: function (field, text) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.defaults.icons, {
|
||||||
|
commonSearchIcon: 'glyphicon-search'
|
||||||
|
});
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
|
||||||
|
'column-common-search.bs.table': 'onColumnCommonSearch'
|
||||||
|
});
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.locales, {
|
||||||
|
formatCommonSearch: function () {
|
||||||
|
return __("Common search");
|
||||||
|
},
|
||||||
|
formatCommonSubmitButton: function () {
|
||||||
|
return __("Submit");
|
||||||
|
},
|
||||||
|
formatCommonResetButton: function () {
|
||||||
|
return __("Reset");
|
||||||
|
},
|
||||||
|
formatCommonCloseButton: function () {
|
||||||
|
return __("Close");
|
||||||
|
},
|
||||||
|
formatCommonChoose: function () {
|
||||||
|
return __("Choose");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
|
||||||
|
|
||||||
|
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||||
|
_initToolbar = BootstrapTable.prototype.initToolbar,
|
||||||
|
_load = BootstrapTable.prototype.load,
|
||||||
|
_initSearch = BootstrapTable.prototype.initSearch;
|
||||||
|
|
||||||
|
BootstrapTable.prototype.initToolbar = function () {
|
||||||
|
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
|
||||||
|
|
||||||
|
if (!this.options.search) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.options.commonSearch) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.options.idTable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var that = this;
|
||||||
|
|
||||||
|
showCommonSearch(that.columns, that);
|
||||||
|
};
|
||||||
|
|
||||||
|
BootstrapTable.prototype.load = function (data) {
|
||||||
|
_load.apply(this, Array.prototype.slice.apply(arguments));
|
||||||
|
|
||||||
|
if (!this.options.commonSearch) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof this.options.idTable === 'undefined') {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if (!firstLoad) {
|
||||||
|
var height = parseInt($(".bootstrap-table").height());
|
||||||
|
height += 10;
|
||||||
|
$("#" + this.options.idTable).bootstrapTable("resetView", {height: height});
|
||||||
|
firstLoad = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
BootstrapTable.prototype.initSearch = function () {
|
||||||
|
_initSearch.apply(this, Array.prototype.slice.apply(arguments));
|
||||||
|
|
||||||
|
if (!this.options.commonSearch) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var that = this;
|
||||||
|
var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
|
||||||
|
this.data = fp ? $.grep(this.data, function (item, i) {
|
||||||
|
for (var key in fp) {
|
||||||
|
var fval = fp[key].toLowerCase();
|
||||||
|
var value = item[key];
|
||||||
|
value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
|
||||||
|
that.header.formatters[$.inArray(key, that.header.fields)],
|
||||||
|
[value, item, i], value);
|
||||||
|
|
||||||
|
if (!($.inArray(key, that.header.fields) !== -1 &&
|
||||||
|
(typeof value === 'string' || typeof value === 'number') &&
|
||||||
|
(value + '').toLowerCase().indexOf(fval) !== -1)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}) : this.data;
|
||||||
|
};
|
||||||
|
|
||||||
|
BootstrapTable.prototype.onColumnCommonSearch = function (event) {
|
||||||
|
if (typeof event === 'undefined') {
|
||||||
|
var op = {};
|
||||||
|
var filter = {};
|
||||||
|
$("#commonSearchModalContent_" + this.options.idTable + " input.operate").each(function () {
|
||||||
|
var name = $(this).data("name");
|
||||||
|
var sym = $(this).val();
|
||||||
|
var obj = $("[name='" + name + "']");
|
||||||
|
if (obj.size() == 0)
|
||||||
|
return true;
|
||||||
|
if (obj.size() > 1) {
|
||||||
|
if (/BETWEEN$/.test(sym)) {
|
||||||
|
var value_begin = $.trim($("[name='" + name + "']:first").val()), value_end = $.trim($("[name='" + name + "']:last").val());
|
||||||
|
if (!value_begin.length || !value_end.length) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//datetime类型字段转换成时间戳
|
||||||
|
if ($("[name='" + name + "']:first").attr('type') === 'datetime') {
|
||||||
|
var datetimestamp = Date.parse(value_begin).toString();
|
||||||
|
value_begin = datetimestamp.substr(0, datetimestamp.length - 3) - 28800; //TODO:Date.parse导致的时区差
|
||||||
|
|
||||||
|
datetimestamp = Date.parse(value_end).toString();
|
||||||
|
value_end = datetimestamp.substr(0, datetimestamp.length - 3) - 28800; //TODO:Date.parse导致的时区差
|
||||||
|
}
|
||||||
|
var value = value_begin + ',' + value_end;
|
||||||
|
} else {
|
||||||
|
var value = $("[name='" + name + "']:checked").val();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var value = obj.val();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value == '' && sym.indexOf("NULL") == -1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
op[name] = sym;
|
||||||
|
filter[name] = value;
|
||||||
|
});
|
||||||
|
// 追加查询关键字
|
||||||
|
this.options.pageNumber = 1;
|
||||||
|
this.refresh({query: {filter: JSON.stringify(filter), op: JSON.stringify(op)}});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
var text = $.trim($(event.currentTarget).val());
|
||||||
|
var $field = $(event.currentTarget)[0].id;
|
||||||
|
|
||||||
|
if ($.isEmptyObject(this.filterColumnsPartial)) {
|
||||||
|
this.filterColumnsPartial = {};
|
||||||
|
}
|
||||||
|
if (text) {
|
||||||
|
this.filterColumnsPartial[$field] = text;
|
||||||
|
} else {
|
||||||
|
delete this.filterColumnsPartial[$field];
|
||||||
|
}
|
||||||
|
this.options.pageNumber = 1;
|
||||||
|
this.onSearch(event);
|
||||||
|
// this.updatePagination();
|
||||||
|
this.trigger('column-common-search', $field, text);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}(jQuery);
|
||||||
|
|
@ -34,6 +34,7 @@ require.config({
|
||||||
'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
|
'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
|
||||||
'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
|
'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
|
||||||
'bootstrap-table-advancedsearch': 'bootstrap-table-advancedsearch',
|
'bootstrap-table-advancedsearch': 'bootstrap-table-advancedsearch',
|
||||||
|
'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch',
|
||||||
'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
|
'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
|
||||||
'typeahead': '../libs/typeahead.js/dist/typeahead.jquery.min',
|
'typeahead': '../libs/typeahead.js/dist/typeahead.jquery.min',
|
||||||
'bloodhound': '../libs/typeahead.js/dist/bloodhound.min',
|
'bloodhound': '../libs/typeahead.js/dist/bloodhound.min',
|
||||||
|
|
@ -78,6 +79,10 @@ require.config({
|
||||||
deps: ['bootstrap-table'],
|
deps: ['bootstrap-table'],
|
||||||
exports: '$.fn.bootstrapTable.defaults'
|
exports: '$.fn.bootstrapTable.defaults'
|
||||||
},
|
},
|
||||||
|
'bootstrap-table-commonsearch': {
|
||||||
|
deps: ['bootstrap-table'],
|
||||||
|
exports: '$.fn.bootstrapTable.defaults'
|
||||||
|
},
|
||||||
'tableexport': {
|
'tableexport': {
|
||||||
deps: ['jquery'],
|
deps: ['jquery'],
|
||||||
exports: '$.fn.extend'
|
exports: '$.fn.extend'
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -34,6 +34,7 @@ require.config({
|
||||||
'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
|
'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
|
||||||
'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
|
'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
|
||||||
'bootstrap-table-advancedsearch': 'bootstrap-table-advancedsearch',
|
'bootstrap-table-advancedsearch': 'bootstrap-table-advancedsearch',
|
||||||
|
'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch',
|
||||||
'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
|
'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
|
||||||
'typeahead': '../libs/typeahead.js/dist/typeahead.jquery.min',
|
'typeahead': '../libs/typeahead.js/dist/typeahead.jquery.min',
|
||||||
'bloodhound': '../libs/typeahead.js/dist/bloodhound.min',
|
'bloodhound': '../libs/typeahead.js/dist/bloodhound.min',
|
||||||
|
|
@ -78,6 +79,10 @@ require.config({
|
||||||
deps: ['bootstrap-table'],
|
deps: ['bootstrap-table'],
|
||||||
exports: '$.fn.bootstrapTable.defaults'
|
exports: '$.fn.bootstrapTable.defaults'
|
||||||
},
|
},
|
||||||
|
'bootstrap-table-commonsearch': {
|
||||||
|
deps: ['bootstrap-table'],
|
||||||
|
exports: '$.fn.bootstrapTable.defaults'
|
||||||
|
},
|
||||||
'tableexport': {
|
'tableexport': {
|
||||||
deps: ['jquery'],
|
deps: ['jquery'],
|
||||||
exports: '$.fn.extend'
|
exports: '$.fn.extend'
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ require.config({
|
||||||
'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
|
'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
|
||||||
'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
|
'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
|
||||||
'bootstrap-table-advancedsearch': 'bootstrap-table-advancedsearch',
|
'bootstrap-table-advancedsearch': 'bootstrap-table-advancedsearch',
|
||||||
|
'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch',
|
||||||
'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
|
'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
|
||||||
'typeahead': '../libs/typeahead.js/dist/typeahead.jquery.min',
|
'typeahead': '../libs/typeahead.js/dist/typeahead.jquery.min',
|
||||||
'bloodhound': '../libs/typeahead.js/dist/bloodhound.min',
|
'bloodhound': '../libs/typeahead.js/dist/bloodhound.min',
|
||||||
|
|
@ -95,6 +96,10 @@ require.config({
|
||||||
deps: ['bootstrap-table'],
|
deps: ['bootstrap-table'],
|
||||||
exports: '$.fn.bootstrapTable.defaults'
|
exports: '$.fn.bootstrapTable.defaults'
|
||||||
},
|
},
|
||||||
|
'bootstrap-table-commonsearch': {
|
||||||
|
deps: ['bootstrap-table'],
|
||||||
|
exports: '$.fn.bootstrapTable.defaults'
|
||||||
|
},
|
||||||
'tableexport': {
|
'tableexport': {
|
||||||
deps: ['jquery'],
|
deps: ['jquery'],
|
||||||
exports: '$.fn.extend'
|
exports: '$.fn.extend'
|
||||||
|
|
@ -203,7 +208,7 @@ define('../libs/require-css/css.min',[],function(){if("undefined"==typeof window
|
||||||
@Author:贤心
|
@Author:贤心
|
||||||
@Site:http://layer.layui.com
|
@Site:http://layer.layui.com
|
||||||
@License:LGPL
|
@License:LGPL
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
;!function(window, undefined){
|
;!function(window, undefined){
|
||||||
|
|
@ -239,39 +244,39 @@ var layer = {
|
||||||
layer.cache = ready.config = $.extend({}, ready.config, options);
|
layer.cache = ready.config = $.extend({}, ready.config, options);
|
||||||
layer.path = ready.config.path || layer.path;
|
layer.path = ready.config.path || layer.path;
|
||||||
typeof options.extend === 'string' && (options.extend = [options.extend]);
|
typeof options.extend === 'string' && (options.extend = [options.extend]);
|
||||||
|
|
||||||
if(ready.config.path) layer.ready();
|
if(ready.config.path) layer.ready();
|
||||||
|
|
||||||
if(!options.extend) return this;
|
if(!options.extend) return this;
|
||||||
|
|
||||||
isLayui
|
isLayui
|
||||||
? layui.addcss('modules/layer/' + options.extend)
|
? layui.addcss('modules/layer/' + options.extend)
|
||||||
: layer.link('skin/' + options.extend);
|
: layer.link('skin/' + options.extend);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
//载入CSS配件
|
//载入CSS配件
|
||||||
link: function(href, fn, cssname){
|
link: function(href, fn, cssname){
|
||||||
|
|
||||||
//未设置路径,则不主动加载css
|
//未设置路径,则不主动加载css
|
||||||
if(!layer.path) return;
|
if(!layer.path) return;
|
||||||
|
|
||||||
var head = $('head')[0], link = document.createElement('link');
|
var head = $('head')[0], link = document.createElement('link');
|
||||||
if(typeof fn === 'string') cssname = fn;
|
if(typeof fn === 'string') cssname = fn;
|
||||||
var app = (cssname || href).replace(/\.|\//g, '');
|
var app = (cssname || href).replace(/\.|\//g, '');
|
||||||
var id = 'layuicss-'+app, timeout = 0;
|
var id = 'layuicss-'+app, timeout = 0;
|
||||||
|
|
||||||
link.rel = 'stylesheet';
|
link.rel = 'stylesheet';
|
||||||
link.href = layer.path + href;
|
link.href = layer.path + href;
|
||||||
link.id = id;
|
link.id = id;
|
||||||
|
|
||||||
if(!$('#'+ id)[0]){
|
if(!$('#'+ id)[0]){
|
||||||
head.appendChild(link);
|
head.appendChild(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typeof fn !== 'function') return;
|
if(typeof fn !== 'function') return;
|
||||||
|
|
||||||
//轮询css是否加载完毕
|
//轮询css是否加载完毕
|
||||||
(function poll() {
|
(function poll() {
|
||||||
if(++timeout > 8 * 1000 / 100){
|
if(++timeout > 8 * 1000 / 100){
|
||||||
|
|
@ -280,14 +285,14 @@ var layer = {
|
||||||
parseInt($('#'+id).css('width')) === 1989 ? fn() : setTimeout(poll, 100);
|
parseInt($('#'+id).css('width')) === 1989 ? fn() : setTimeout(poll, 100);
|
||||||
}());
|
}());
|
||||||
},
|
},
|
||||||
|
|
||||||
ready: function(callback){
|
ready: function(callback){
|
||||||
var cssname = 'skinlayercss', ver = '1110';
|
var cssname = 'skinlayercss', ver = '1110';
|
||||||
isLayui ? layui.addcss('modules/layer/default/layer.css?v='+layer.v+ver, callback, cssname)
|
isLayui ? layui.addcss('modules/layer/default/layer.css?v='+layer.v+ver, callback, cssname)
|
||||||
: layer.link('skin/default/layer.css?v='+layer.v+ver, callback, cssname);
|
: layer.link('skin/default/layer.css?v='+layer.v+ver, callback, cssname);
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
//各种快捷引用
|
//各种快捷引用
|
||||||
alert: function(content, options, yes){
|
alert: function(content, options, yes){
|
||||||
var type = typeof options === 'function';
|
var type = typeof options === 'function';
|
||||||
|
|
@ -296,9 +301,9 @@ var layer = {
|
||||||
content: content,
|
content: content,
|
||||||
yes: yes
|
yes: yes
|
||||||
}, type ? {} : options));
|
}, type ? {} : options));
|
||||||
},
|
},
|
||||||
|
|
||||||
confirm: function(content, options, yes, cancel){
|
confirm: function(content, options, yes, cancel){
|
||||||
var type = typeof options === 'function';
|
var type = typeof options === 'function';
|
||||||
if(type){
|
if(type){
|
||||||
cancel = yes;
|
cancel = yes;
|
||||||
|
|
@ -311,7 +316,7 @@ var layer = {
|
||||||
btn2: cancel
|
btn2: cancel
|
||||||
}, type ? {} : options));
|
}, type ? {} : options));
|
||||||
},
|
},
|
||||||
|
|
||||||
msg: function(content, options, end){ //最常用提示层
|
msg: function(content, options, end){ //最常用提示层
|
||||||
var type = typeof options === 'function', rskin = ready.config.skin;
|
var type = typeof options === 'function', rskin = ready.config.skin;
|
||||||
var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg';
|
var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg';
|
||||||
|
|
@ -336,9 +341,9 @@ var layer = {
|
||||||
options.skin = skin + ' ' + (options.skin||'layui-layer-hui');
|
options.skin = skin + ' ' + (options.skin||'layui-layer-hui');
|
||||||
}
|
}
|
||||||
return options;
|
return options;
|
||||||
}()));
|
}()));
|
||||||
},
|
},
|
||||||
|
|
||||||
load: function(icon, options){
|
load: function(icon, options){
|
||||||
return layer.open($.extend({
|
return layer.open($.extend({
|
||||||
type: 3,
|
type: 3,
|
||||||
|
|
@ -346,8 +351,8 @@ var layer = {
|
||||||
resize: false,
|
resize: false,
|
||||||
shade: 0.01
|
shade: 0.01
|
||||||
}, options));
|
}, options));
|
||||||
},
|
},
|
||||||
|
|
||||||
tips: function(content, follow, options){
|
tips: function(content, follow, options){
|
||||||
return layer.open($.extend({
|
return layer.open($.extend({
|
||||||
type: 4,
|
type: 4,
|
||||||
|
|
@ -362,7 +367,7 @@ var layer = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var Class = function(setings){
|
var Class = function(setings){
|
||||||
var that = this;
|
var that = this;
|
||||||
that.index = ++layer.index;
|
that.index = ++layer.index;
|
||||||
that.config = $.extend({}, that.config, ready.config, setings);
|
that.config = $.extend({}, that.config, ready.config, setings);
|
||||||
|
|
@ -388,7 +393,7 @@ Class.pt.config = {
|
||||||
area: 'auto',
|
area: 'auto',
|
||||||
closeBtn: 1,
|
closeBtn: 1,
|
||||||
time: 0, //0表示不自动关闭
|
time: 0, //0表示不自动关闭
|
||||||
zIndex: 19891014,
|
zIndex: 19891014,
|
||||||
maxWidth: 360,
|
maxWidth: 360,
|
||||||
anim: 0,
|
anim: 0,
|
||||||
icon: -1,
|
icon: -1,
|
||||||
|
|
@ -403,15 +408,15 @@ Class.pt.vessel = function(conType, callback){
|
||||||
var that = this, times = that.index, config = that.config;
|
var that = this, times = that.index, config = that.config;
|
||||||
var zIndex = config.zIndex + times, titype = typeof config.title === 'object';
|
var zIndex = config.zIndex + times, titype = typeof config.title === 'object';
|
||||||
var ismax = config.maxmin && (config.type === 1 || config.type === 2);
|
var ismax = config.maxmin && (config.type === 1 || config.type === 2);
|
||||||
var titleHTML = (config.title ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">'
|
var titleHTML = (config.title ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">'
|
||||||
+ (titype ? config.title[0] : config.title)
|
+ (titype ? config.title[0] : config.title)
|
||||||
+ '</div>' : '');
|
+ '</div>' : '');
|
||||||
|
|
||||||
config.zIndex = zIndex;
|
config.zIndex = zIndex;
|
||||||
callback([
|
callback([
|
||||||
//遮罩
|
//遮罩
|
||||||
config.shade ? ('<div class="layui-layer-shade" id="layui-layer-shade'+ times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; background-color:'+ (config.shade[1]||'#000') +'; opacity:'+ (config.shade[0]||config.shade) +'; filter:alpha(opacity='+ (config.shade[0]*100||config.shade*100) +');') +'"></div>') : '',
|
config.shade ? ('<div class="layui-layer-shade" id="layui-layer-shade'+ times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; background-color:'+ (config.shade[1]||'#000') +'; opacity:'+ (config.shade[0]||config.shade) +'; filter:alpha(opacity='+ (config.shade[0]*100||config.shade*100) +');') +'"></div>') : '',
|
||||||
|
|
||||||
//主体
|
//主体
|
||||||
'<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + (config.fixed ? '' : ';position:absolute;') +'">'
|
'<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + (config.fixed ? '' : ';position:absolute;') +'">'
|
||||||
+ (conType && config.type != 2 ? '' : titleHTML)
|
+ (conType && config.type != 2 ? '' : titleHTML)
|
||||||
|
|
@ -446,22 +451,22 @@ Class.pt.creat = function(){
|
||||||
,content = config.content
|
,content = config.content
|
||||||
,conType = typeof content === 'object'
|
,conType = typeof content === 'object'
|
||||||
,body = $('body');
|
,body = $('body');
|
||||||
|
|
||||||
if($('#'+config.id)[0]) return;
|
if($('#'+config.id)[0]) return;
|
||||||
|
|
||||||
if(typeof config.area === 'string'){
|
if(typeof config.area === 'string'){
|
||||||
config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];
|
config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];
|
||||||
}
|
}
|
||||||
|
|
||||||
//anim兼容旧版shift
|
//anim兼容旧版shift
|
||||||
if(config.shift){
|
if(config.shift){
|
||||||
config.anim = config.shift;
|
config.anim = config.shift;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(layer.ie == 6){
|
if(layer.ie == 6){
|
||||||
config.fixed = false;
|
config.fixed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(config.type){
|
switch(config.type){
|
||||||
case 0:
|
case 0:
|
||||||
config.btn = ('btn' in config) ? config.btn : ready.btn[0];
|
config.btn = ('btn' in config) ? config.btn : ready.btn[0];
|
||||||
|
|
@ -486,7 +491,7 @@ Class.pt.creat = function(){
|
||||||
config.tipsMore || layer.closeAll('tips');
|
config.tipsMore || layer.closeAll('tips');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//建立容器
|
//建立容器
|
||||||
that.vessel(conType, function(html, titleHTML, moveElem){
|
that.vessel(conType, function(html, titleHTML, moveElem){
|
||||||
body.append(html[0]);
|
body.append(html[0]);
|
||||||
|
|
@ -516,12 +521,12 @@ Class.pt.creat = function(){
|
||||||
config.type == 4 && that.tips();
|
config.type == 4 && that.tips();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
config.time <= 0 || setTimeout(function(){
|
config.time <= 0 || setTimeout(function(){
|
||||||
layer.close(that.index)
|
layer.close(that.index)
|
||||||
}, config.time);
|
}, config.time);
|
||||||
that.move().callback();
|
that.move().callback();
|
||||||
|
|
||||||
//为兼容jQuery3.0的css动画影响元素尺寸计算
|
//为兼容jQuery3.0的css动画影响元素尺寸计算
|
||||||
if(doms.anim[config.anim]){
|
if(doms.anim[config.anim]){
|
||||||
that.layero.addClass(doms.anim[config.anim]).data('anim', true);
|
that.layero.addClass(doms.anim[config.anim]).data('anim', true);
|
||||||
|
|
@ -546,7 +551,7 @@ Class.pt.auto = function(index){
|
||||||
elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding'))|0));
|
elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding'))|0));
|
||||||
}
|
}
|
||||||
switch(config.type){
|
switch(config.type){
|
||||||
case 2:
|
case 2:
|
||||||
setHeight('iframe');
|
setHeight('iframe');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -570,12 +575,12 @@ Class.pt.offset = function(){
|
||||||
var type = typeof config.offset === 'object';
|
var type = typeof config.offset === 'object';
|
||||||
that.offsetTop = (win.height() - area[1])/2;
|
that.offsetTop = (win.height() - area[1])/2;
|
||||||
that.offsetLeft = (win.width() - area[0])/2;
|
that.offsetLeft = (win.width() - area[0])/2;
|
||||||
|
|
||||||
if(type){
|
if(type){
|
||||||
that.offsetTop = config.offset[0];
|
that.offsetTop = config.offset[0];
|
||||||
that.offsetLeft = config.offset[1]||that.offsetLeft;
|
that.offsetLeft = config.offset[1]||that.offsetLeft;
|
||||||
} else if(config.offset !== 'auto'){
|
} else if(config.offset !== 'auto'){
|
||||||
|
|
||||||
if(config.offset === 't'){ //上
|
if(config.offset === 't'){ //上
|
||||||
that.offsetTop = 0;
|
that.offsetTop = 0;
|
||||||
} else if(config.offset === 'r'){ //右
|
} else if(config.offset === 'r'){ //右
|
||||||
|
|
@ -599,20 +604,20 @@ Class.pt.offset = function(){
|
||||||
} else {
|
} else {
|
||||||
that.offsetTop = config.offset;
|
that.offsetTop = config.offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!config.fixed){
|
if(!config.fixed){
|
||||||
that.offsetTop = /%$/.test(that.offsetTop) ?
|
that.offsetTop = /%$/.test(that.offsetTop) ?
|
||||||
win.height()*parseFloat(that.offsetTop)/100
|
win.height()*parseFloat(that.offsetTop)/100
|
||||||
: parseFloat(that.offsetTop);
|
: parseFloat(that.offsetTop);
|
||||||
that.offsetLeft = /%$/.test(that.offsetLeft) ?
|
that.offsetLeft = /%$/.test(that.offsetLeft) ?
|
||||||
win.width()*parseFloat(that.offsetLeft)/100
|
win.width()*parseFloat(that.offsetLeft)/100
|
||||||
: parseFloat(that.offsetLeft);
|
: parseFloat(that.offsetLeft);
|
||||||
that.offsetTop += win.scrollTop();
|
that.offsetTop += win.scrollTop();
|
||||||
that.offsetLeft += win.scrollLeft();
|
that.offsetLeft += win.scrollLeft();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(layero.attr('minLeft')){
|
if(layero.attr('minLeft')){
|
||||||
that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0);
|
that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0);
|
||||||
that.offsetLeft = layero.css('left');
|
that.offsetLeft = layero.css('left');
|
||||||
|
|
@ -632,10 +637,10 @@ Class.pt.tips = function(){
|
||||||
top: follow.offset().top,
|
top: follow.offset().top,
|
||||||
left: follow.offset().left
|
left: follow.offset().left
|
||||||
}, tipsG = layero.find('.layui-layer-TipsG');
|
}, tipsG = layero.find('.layui-layer-TipsG');
|
||||||
|
|
||||||
var guide = config.tips[0];
|
var guide = config.tips[0];
|
||||||
config.tips[1] || tipsG.remove();
|
config.tips[1] || tipsG.remove();
|
||||||
|
|
||||||
goal.autoLeft = function(){
|
goal.autoLeft = function(){
|
||||||
if(goal.left + layArea[0] - win.width() > 0){
|
if(goal.left + layArea[0] - win.width() > 0){
|
||||||
goal.tipLeft = goal.left + goal.width - layArea[0];
|
goal.tipLeft = goal.left + goal.width - layArea[0];
|
||||||
|
|
@ -644,16 +649,16 @@ Class.pt.tips = function(){
|
||||||
goal.tipLeft = goal.left;
|
goal.tipLeft = goal.left;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
//辨别tips的方位
|
//辨别tips的方位
|
||||||
goal.where = [function(){ //上
|
goal.where = [function(){ //上
|
||||||
goal.autoLeft();
|
goal.autoLeft();
|
||||||
goal.tipTop = goal.top - layArea[1] - 10;
|
goal.tipTop = goal.top - layArea[1] - 10;
|
||||||
tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]);
|
tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]);
|
||||||
}, function(){ //右
|
}, function(){ //右
|
||||||
goal.tipLeft = goal.left + goal.width + 10;
|
goal.tipLeft = goal.left + goal.width + 10;
|
||||||
goal.tipTop = goal.top;
|
goal.tipTop = goal.top;
|
||||||
tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]);
|
tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]);
|
||||||
}, function(){ //下
|
}, function(){ //下
|
||||||
goal.autoLeft();
|
goal.autoLeft();
|
||||||
goal.tipTop = goal.top + goal.height + 10;
|
goal.tipTop = goal.top + goal.height + 10;
|
||||||
|
|
@ -664,7 +669,7 @@ Class.pt.tips = function(){
|
||||||
tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]);
|
tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]);
|
||||||
}];
|
}];
|
||||||
goal.where[guide-1]();
|
goal.where[guide-1]();
|
||||||
|
|
||||||
/* 8*2为小三角形占据的空间 */
|
/* 8*2为小三角形占据的空间 */
|
||||||
if(guide === 1){
|
if(guide === 1){
|
||||||
goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2]();
|
goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2]();
|
||||||
|
|
@ -677,11 +682,11 @@ Class.pt.tips = function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
layero.find('.'+doms[5]).css({
|
layero.find('.'+doms[5]).css({
|
||||||
'background-color': config.tips[1],
|
'background-color': config.tips[1],
|
||||||
'padding-right': (config.closeBtn ? '30px' : '')
|
'padding-right': (config.closeBtn ? '30px' : '')
|
||||||
});
|
});
|
||||||
layero.css({
|
layero.css({
|
||||||
left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0),
|
left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0),
|
||||||
top: goal.tipTop - (config.fixed ? win.scrollTop() : 0)
|
top: goal.tipTop - (config.fixed ? win.scrollTop() : 0)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -695,7 +700,7 @@ Class.pt.move = function(){
|
||||||
,moveElem = layero.find(config.move)
|
,moveElem = layero.find(config.move)
|
||||||
,resizeElem = layero.find('.layui-layer-resize')
|
,resizeElem = layero.find('.layui-layer-resize')
|
||||||
,dict = {};
|
,dict = {};
|
||||||
|
|
||||||
if(config.move){
|
if(config.move){
|
||||||
moveElem.css('cursor', 'move');
|
moveElem.css('cursor', 'move');
|
||||||
}
|
}
|
||||||
|
|
@ -711,7 +716,7 @@ Class.pt.move = function(){
|
||||||
ready.moveElem.css('cursor', 'move').show();
|
ready.moveElem.css('cursor', 'move').show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
resizeElem.on('mousedown', function(e){
|
resizeElem.on('mousedown', function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
dict.resizeStart = true;
|
dict.resizeStart = true;
|
||||||
|
|
@ -722,7 +727,7 @@ Class.pt.move = function(){
|
||||||
];
|
];
|
||||||
ready.moveElem.css('cursor', 'se-resize').show();
|
ready.moveElem.css('cursor', 'se-resize').show();
|
||||||
});
|
});
|
||||||
|
|
||||||
_DOC.on('mousemove', function(e){
|
_DOC.on('mousemove', function(e){
|
||||||
|
|
||||||
//拖拽移动
|
//拖拽移动
|
||||||
|
|
@ -730,35 +735,35 @@ Class.pt.move = function(){
|
||||||
var X = e.clientX - dict.offset[0]
|
var X = e.clientX - dict.offset[0]
|
||||||
,Y = e.clientY - dict.offset[1]
|
,Y = e.clientY - dict.offset[1]
|
||||||
,fixed = layero.css('position') === 'fixed';
|
,fixed = layero.css('position') === 'fixed';
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
dict.stX = fixed ? 0 : win.scrollLeft();
|
dict.stX = fixed ? 0 : win.scrollLeft();
|
||||||
dict.stY = fixed ? 0 : win.scrollTop();
|
dict.stY = fixed ? 0 : win.scrollTop();
|
||||||
|
|
||||||
//控制元素不被拖出窗口外
|
//控制元素不被拖出窗口外
|
||||||
if(!config.moveOut){
|
if(!config.moveOut){
|
||||||
var setRig = win.width() - layero.outerWidth() + dict.stX
|
var setRig = win.width() - layero.outerWidth() + dict.stX
|
||||||
,setBot = win.height() - layero.outerHeight() + dict.stY;
|
,setBot = win.height() - layero.outerHeight() + dict.stY;
|
||||||
X < dict.stX && (X = dict.stX);
|
X < dict.stX && (X = dict.stX);
|
||||||
X > setRig && (X = setRig);
|
X > setRig && (X = setRig);
|
||||||
Y < dict.stY && (Y = dict.stY);
|
Y < dict.stY && (Y = dict.stY);
|
||||||
Y > setBot && (Y = setBot);
|
Y > setBot && (Y = setBot);
|
||||||
}
|
}
|
||||||
|
|
||||||
layero.css({
|
layero.css({
|
||||||
left: X
|
left: X
|
||||||
,top: Y
|
,top: Y
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//Resize
|
//Resize
|
||||||
if(config.resize && dict.resizeStart){
|
if(config.resize && dict.resizeStart){
|
||||||
var X = e.clientX - dict.offset[0]
|
var X = e.clientX - dict.offset[0]
|
||||||
,Y = e.clientY - dict.offset[1];
|
,Y = e.clientY - dict.offset[1];
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
layer.style(that.index, {
|
layer.style(that.index, {
|
||||||
width: dict.area[0] + X
|
width: dict.area[0] + X
|
||||||
,height: dict.area[1] + Y
|
,height: dict.area[1] + Y
|
||||||
|
|
@ -776,7 +781,7 @@ Class.pt.move = function(){
|
||||||
ready.moveElem.hide();
|
ready.moveElem.hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -793,7 +798,7 @@ Class.pt.callback = function(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
layer.ie == 6 && that.IE6(layero);
|
layer.ie == 6 && that.IE6(layero);
|
||||||
|
|
||||||
//按钮
|
//按钮
|
||||||
layero.find('.'+ doms[6]).children('a').on('click', function(){
|
layero.find('.'+ doms[6]).children('a').on('click', function(){
|
||||||
var index = $(this).index();
|
var index = $(this).index();
|
||||||
|
|
@ -810,29 +815,29 @@ Class.pt.callback = function(){
|
||||||
close === false || layer.close(that.index);
|
close === false || layer.close(that.index);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//取消
|
//取消
|
||||||
function cancel(){
|
function cancel(){
|
||||||
var close = config.cancel && config.cancel(that.index, layero);
|
var close = config.cancel && config.cancel(that.index, layero);
|
||||||
close === false || layer.close(that.index);
|
close === false || layer.close(that.index);
|
||||||
}
|
}
|
||||||
|
|
||||||
//右上角关闭回调
|
//右上角关闭回调
|
||||||
layero.find('.'+ doms[7]).on('click', cancel);
|
layero.find('.'+ doms[7]).on('click', cancel);
|
||||||
|
|
||||||
//点遮罩关闭
|
//点遮罩关闭
|
||||||
if(config.shadeClose){
|
if(config.shadeClose){
|
||||||
$('#layui-layer-shade'+ that.index).on('click', function(){
|
$('#layui-layer-shade'+ that.index).on('click', function(){
|
||||||
layer.close(that.index);
|
layer.close(that.index);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//最小化
|
//最小化
|
||||||
layero.find('.layui-layer-min').on('click', function(){
|
layero.find('.layui-layer-min').on('click', function(){
|
||||||
var min = config.min && config.min(layero);
|
var min = config.min && config.min(layero);
|
||||||
min === false || layer.min(that.index, config);
|
min === false || layer.min(that.index, config);
|
||||||
});
|
});
|
||||||
|
|
||||||
//全屏/还原
|
//全屏/还原
|
||||||
layero.find('.layui-layer-max').on('click', function(){
|
layero.find('.layui-layer-max').on('click', function(){
|
||||||
if($(this).hasClass('layui-layer-maxmin')){
|
if($(this).hasClass('layui-layer-maxmin')){
|
||||||
|
|
@ -854,11 +859,11 @@ ready.reselect = function(){
|
||||||
$.each($('select'), function(index , value){
|
$.each($('select'), function(index , value){
|
||||||
var sthis = $(this);
|
var sthis = $(this);
|
||||||
if(!sthis.parents('.'+doms[0])[0]){
|
if(!sthis.parents('.'+doms[0])[0]){
|
||||||
(sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show();
|
(sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show();
|
||||||
}
|
}
|
||||||
sthis = null;
|
sthis = null;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Class.pt.IE6 = function(layero){
|
Class.pt.IE6 = function(layero){
|
||||||
//隐藏select
|
//隐藏select
|
||||||
|
|
@ -874,7 +879,7 @@ Class.pt.IE6 = function(layero){
|
||||||
//需依赖原型的对外方法
|
//需依赖原型的对外方法
|
||||||
Class.pt.openLayer = function(){
|
Class.pt.openLayer = function(){
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
//置顶当前窗口
|
//置顶当前窗口
|
||||||
layer.zIndex = that.config.zIndex;
|
layer.zIndex = that.config.zIndex;
|
||||||
layer.setTop = function(layero){
|
layer.setTop = function(layero){
|
||||||
|
|
@ -892,7 +897,7 @@ ready.record = function(layero){
|
||||||
var area = [
|
var area = [
|
||||||
layero.width(),
|
layero.width(),
|
||||||
layero.height(),
|
layero.height(),
|
||||||
layero.position().top,
|
layero.position().top,
|
||||||
layero.position().left + parseFloat(layero.css('margin-left'))
|
layero.position().left + parseFloat(layero.css('margin-left'))
|
||||||
];
|
];
|
||||||
layero.find('.layui-layer-max').addClass('layui-layer-maxmin');
|
layero.find('.layui-layer-max').addClass('layui-layer-maxmin');
|
||||||
|
|
@ -917,7 +922,7 @@ window.layer = layer;
|
||||||
//获取子iframe的DOM
|
//获取子iframe的DOM
|
||||||
layer.getChildFrame = function(selector, index){
|
layer.getChildFrame = function(selector, index){
|
||||||
index = index || $('.'+doms[4]).attr('times');
|
index = index || $('.'+doms[4]).attr('times');
|
||||||
return $('#'+ doms[0] + index).find('iframe').contents().find(selector);
|
return $('#'+ doms[0] + index).find('iframe').contents().find(selector);
|
||||||
};
|
};
|
||||||
|
|
||||||
//得到当前iframe层的索引,子iframe时使用
|
//得到当前iframe层的索引,子iframe时使用
|
||||||
|
|
@ -949,24 +954,24 @@ layer.style = function(index, options, limit){
|
||||||
,titHeight = layero.find(doms[1]).outerHeight() || 0
|
,titHeight = layero.find(doms[1]).outerHeight() || 0
|
||||||
,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0
|
,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0
|
||||||
,minLeft = layero.attr('minLeft');
|
,minLeft = layero.attr('minLeft');
|
||||||
|
|
||||||
if(type === ready.type[3] || type === ready.type[4]){
|
if(type === ready.type[3] || type === ready.type[4]){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!limit){
|
if(!limit){
|
||||||
if(parseFloat(options.width) <= 260){
|
if(parseFloat(options.width) <= 260){
|
||||||
options.width = 260;
|
options.width = 260;
|
||||||
};
|
};
|
||||||
|
|
||||||
if(parseFloat(options.height) - titHeight - btnHeight <= 64){
|
if(parseFloat(options.height) - titHeight - btnHeight <= 64){
|
||||||
options.height = 64 + titHeight + btnHeight;
|
options.height = 64 + titHeight + btnHeight;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
layero.css(options);
|
layero.css(options);
|
||||||
btnHeight = layero.find('.'+doms[6]).outerHeight();
|
btnHeight = layero.find('.'+doms[6]).outerHeight();
|
||||||
|
|
||||||
if(type === ready.type[2]){
|
if(type === ready.type[2]){
|
||||||
layero.find('iframe').css({
|
layero.find('iframe').css({
|
||||||
height: parseFloat(options.height) - titHeight - btnHeight
|
height: parseFloat(options.height) - titHeight - btnHeight
|
||||||
|
|
@ -986,16 +991,16 @@ layer.min = function(index, options){
|
||||||
,titHeight = layero.find(doms[1]).outerHeight() || 0
|
,titHeight = layero.find(doms[1]).outerHeight() || 0
|
||||||
,left = layero.attr('minLeft') || (181*ready.minIndex)+'px'
|
,left = layero.attr('minLeft') || (181*ready.minIndex)+'px'
|
||||||
,position = layero.css('position');
|
,position = layero.css('position');
|
||||||
|
|
||||||
ready.record(layero);
|
ready.record(layero);
|
||||||
|
|
||||||
if(ready.minLeft[0]){
|
if(ready.minLeft[0]){
|
||||||
left = ready.minLeft[0];
|
left = ready.minLeft[0];
|
||||||
ready.minLeft.shift();
|
ready.minLeft.shift();
|
||||||
}
|
}
|
||||||
|
|
||||||
layero.attr('position', position);
|
layero.attr('position', position);
|
||||||
|
|
||||||
layer.style(index, {
|
layer.style(index, {
|
||||||
width: 180
|
width: 180
|
||||||
,height: titHeight
|
,height: titHeight
|
||||||
|
|
@ -1008,7 +1013,7 @@ layer.min = function(index, options){
|
||||||
layero.find('.layui-layer-min').hide();
|
layero.find('.layui-layer-min').hide();
|
||||||
layero.attr('type') === 'page' && layero.find(doms[4]).hide();
|
layero.attr('type') === 'page' && layero.find(doms[4]).hide();
|
||||||
ready.rescollbar(index);
|
ready.rescollbar(index);
|
||||||
|
|
||||||
if(!layero.attr('minLeft')){
|
if(!layero.attr('minLeft')){
|
||||||
ready.minIndex++;
|
ready.minIndex++;
|
||||||
}
|
}
|
||||||
|
|
@ -1020,9 +1025,9 @@ layer.restore = function(index){
|
||||||
var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(',');
|
var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(',');
|
||||||
var type = layero.attr('type');
|
var type = layero.attr('type');
|
||||||
layer.style(index, {
|
layer.style(index, {
|
||||||
width: parseFloat(area[0]),
|
width: parseFloat(area[0]),
|
||||||
height: parseFloat(area[1]),
|
height: parseFloat(area[1]),
|
||||||
top: parseFloat(area[2]),
|
top: parseFloat(area[2]),
|
||||||
left: parseFloat(area[3]),
|
left: parseFloat(area[3]),
|
||||||
position: layero.attr('position'),
|
position: layero.attr('position'),
|
||||||
overflow: 'visible'
|
overflow: 'visible'
|
||||||
|
|
@ -1085,16 +1090,16 @@ layer.close = function(index){
|
||||||
layero.remove();
|
layero.remove();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if(layero.data('anim')){
|
if(layero.data('anim')){
|
||||||
layero.addClass(closeAnim);
|
layero.addClass(closeAnim);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#layui-layer-moves, #layui-layer-shade' + index).remove();
|
$('#layui-layer-moves, #layui-layer-shade' + index).remove();
|
||||||
layer.ie == 6 && ready.reselect();
|
layer.ie == 6 && ready.reselect();
|
||||||
ready.rescollbar(index);
|
ready.rescollbar(index);
|
||||||
typeof ready.end[index] === 'function' && ready.end[index]();
|
typeof ready.end[index] === 'function' && ready.end[index]();
|
||||||
delete ready.end[index];
|
delete ready.end[index];
|
||||||
if(layero.attr('minLeft')){
|
if(layero.attr('minLeft')){
|
||||||
ready.minIndex--;
|
ready.minIndex--;
|
||||||
ready.minLeft.push(layero.attr('minLeft'));
|
ready.minLeft.push(layero.attr('minLeft'));
|
||||||
|
|
@ -1114,7 +1119,7 @@ layer.closeAll = function(type){
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
拓展模块,layui开始合并在一起
|
拓展模块,layui开始合并在一起
|
||||||
|
|
||||||
|
|
@ -1122,15 +1127,15 @@ layer.closeAll = function(type){
|
||||||
|
|
||||||
var cache = layer.cache||{}, skin = function(type){
|
var cache = layer.cache||{}, skin = function(type){
|
||||||
return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : '');
|
return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : '');
|
||||||
};
|
};
|
||||||
|
|
||||||
//仿系统prompt
|
//仿系统prompt
|
||||||
layer.prompt = function(options, yes){
|
layer.prompt = function(options, yes){
|
||||||
var style = '';
|
var style = '';
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
if(typeof options === 'function') yes = options;
|
if(typeof options === 'function') yes = options;
|
||||||
|
|
||||||
if(options.area){
|
if(options.area){
|
||||||
var area = options.area;
|
var area = options.area;
|
||||||
style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"';
|
style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"';
|
||||||
|
|
@ -1139,7 +1144,7 @@ layer.prompt = function(options, yes){
|
||||||
var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style +'>' + (options.value||'') +'</textarea>' : function(){
|
var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style +'>' + (options.value||'') +'</textarea>' : function(){
|
||||||
return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input" value="'+ (options.value||'') +'">';
|
return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input" value="'+ (options.value||'') +'">';
|
||||||
}();
|
}();
|
||||||
|
|
||||||
return layer.open($.extend({
|
return layer.open($.extend({
|
||||||
type: 1
|
type: 1
|
||||||
,btn: ['确定','取消']
|
,btn: ['确定','取消']
|
||||||
|
|
@ -1215,7 +1220,7 @@ layer.photos = function(options, loop, key){
|
||||||
var photos = type ? options.photos : {}, data = photos.data || [];
|
var photos = type ? options.photos : {}, data = photos.data || [];
|
||||||
var start = photos.start || 0;
|
var start = photos.start || 0;
|
||||||
dict.imgIndex = (start|0) + 1;
|
dict.imgIndex = (start|0) + 1;
|
||||||
|
|
||||||
options.img = options.img || 'img';
|
options.img = options.img || 'img';
|
||||||
|
|
||||||
if(!type){ //页面直接获取
|
if(!type){ //页面直接获取
|
||||||
|
|
@ -1232,13 +1237,13 @@ layer.photos = function(options, loop, key){
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
pushData();
|
pushData();
|
||||||
|
|
||||||
if (data.length === 0) return;
|
if (data.length === 0) return;
|
||||||
|
|
||||||
loop || parent.on('click', options.img, function(){
|
loop || parent.on('click', options.img, function(){
|
||||||
var othis = $(this), index = othis.attr('layer-index');
|
var othis = $(this), index = othis.attr('layer-index');
|
||||||
layer.photos($.extend(options, {
|
layer.photos($.extend(options, {
|
||||||
photos: {
|
photos: {
|
||||||
start: index,
|
start: index,
|
||||||
|
|
@ -1249,14 +1254,14 @@ layer.photos = function(options, loop, key){
|
||||||
}), true);
|
}), true);
|
||||||
pushData();
|
pushData();
|
||||||
})
|
})
|
||||||
|
|
||||||
//不直接弹出
|
//不直接弹出
|
||||||
if(!loop) return;
|
if(!loop) return;
|
||||||
|
|
||||||
} else if (data.length === 0){
|
} else if (data.length === 0){
|
||||||
return layer.msg('没有图片');
|
return layer.msg('没有图片');
|
||||||
}
|
}
|
||||||
|
|
||||||
//上一张
|
//上一张
|
||||||
dict.imgprev = function(key){
|
dict.imgprev = function(key){
|
||||||
dict.imgIndex--;
|
dict.imgIndex--;
|
||||||
|
|
@ -1265,7 +1270,7 @@ layer.photos = function(options, loop, key){
|
||||||
}
|
}
|
||||||
dict.tabimg(key);
|
dict.tabimg(key);
|
||||||
};
|
};
|
||||||
|
|
||||||
//下一张
|
//下一张
|
||||||
dict.imgnext = function(key,errorMsg){
|
dict.imgnext = function(key,errorMsg){
|
||||||
dict.imgIndex++;
|
dict.imgIndex++;
|
||||||
|
|
@ -1275,7 +1280,7 @@ layer.photos = function(options, loop, key){
|
||||||
}
|
}
|
||||||
dict.tabimg(key)
|
dict.tabimg(key)
|
||||||
};
|
};
|
||||||
|
|
||||||
//方向键
|
//方向键
|
||||||
dict.keyup = function(event){
|
dict.keyup = function(event){
|
||||||
if(!dict.end){
|
if(!dict.end){
|
||||||
|
|
@ -1290,7 +1295,7 @@ layer.photos = function(options, loop, key){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//切换
|
//切换
|
||||||
dict.tabimg = function(key){
|
dict.tabimg = function(key){
|
||||||
if(data.length <= 1) return;
|
if(data.length <= 1) return;
|
||||||
|
|
@ -1298,7 +1303,7 @@ layer.photos = function(options, loop, key){
|
||||||
layer.close(dict.index);
|
layer.close(dict.index);
|
||||||
layer.photos(options, true, key);
|
layer.photos(options, true, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
//一些动作
|
//一些动作
|
||||||
dict.event = function(){
|
dict.event = function(){
|
||||||
dict.bigimg.hover(function(){
|
dict.bigimg.hover(function(){
|
||||||
|
|
@ -1306,24 +1311,24 @@ layer.photos = function(options, loop, key){
|
||||||
}, function(){
|
}, function(){
|
||||||
dict.imgsee.hide();
|
dict.imgsee.hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){
|
dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
dict.imgprev();
|
dict.imgprev();
|
||||||
});
|
});
|
||||||
|
|
||||||
dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){
|
dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
dict.imgnext();
|
dict.imgnext();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('keyup', dict.keyup);
|
$(document).on('keyup', dict.keyup);
|
||||||
};
|
};
|
||||||
|
|
||||||
//图片预加载
|
//图片预加载
|
||||||
function loadImage(url, callback, error) {
|
function loadImage(url, callback, error) {
|
||||||
var img = new Image();
|
var img = new Image();
|
||||||
img.src = url;
|
img.src = url;
|
||||||
if(img.complete){
|
if(img.complete){
|
||||||
return callback(img);
|
return callback(img);
|
||||||
}
|
}
|
||||||
|
|
@ -1334,9 +1339,9 @@ layer.photos = function(options, loop, key){
|
||||||
img.onerror = function(e){
|
img.onerror = function(e){
|
||||||
img.onerror = null;
|
img.onerror = null;
|
||||||
error(e);
|
error(e);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
dict.loadi = layer.load(1, {
|
dict.loadi = layer.load(1, {
|
||||||
shade: 'shade' in options ? false : 0.9,
|
shade: 'shade' in options ? false : 0.9,
|
||||||
scrollbar: false
|
scrollbar: false
|
||||||
|
|
@ -1348,7 +1353,7 @@ layer.photos = function(options, loop, key){
|
||||||
area: function(){
|
area: function(){
|
||||||
var imgarea = [img.width, img.height];
|
var imgarea = [img.width, img.height];
|
||||||
var winarea = [$(window).width() - 100, $(window).height() - 100];
|
var winarea = [$(window).width() - 100, $(window).height() - 100];
|
||||||
|
|
||||||
//如果 实际图片的宽或者高比 屏幕大(那么进行缩放)
|
//如果 实际图片的宽或者高比 屏幕大(那么进行缩放)
|
||||||
if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){
|
if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){
|
||||||
var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例
|
var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例
|
||||||
|
|
@ -1360,8 +1365,8 @@ layer.photos = function(options, loop, key){
|
||||||
imgarea[1] = imgarea[1]/wh[1];
|
imgarea[1] = imgarea[1]/wh[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [imgarea[0]+'px', imgarea[1]+'px'];
|
return [imgarea[0]+'px', imgarea[1]+'px'];
|
||||||
}(),
|
}(),
|
||||||
title: false,
|
title: false,
|
||||||
shade: 0.9,
|
shade: 0.9,
|
||||||
|
|
@ -1393,8 +1398,8 @@ layer.photos = function(options, loop, key){
|
||||||
}, function(){
|
}, function(){
|
||||||
layer.close(dict.loadi);
|
layer.close(dict.loadi);
|
||||||
layer.msg('当前图片地址异常<br>是否继续查看下一张?', {
|
layer.msg('当前图片地址异常<br>是否继续查看下一张?', {
|
||||||
time: 30000,
|
time: 30000,
|
||||||
btn: ['下一张', '不看了'],
|
btn: ['下一张', '不看了'],
|
||||||
yes: function(){
|
yes: function(){
|
||||||
data.length > 1 && dict.imgnext(true,true);
|
data.length > 1 && dict.imgnext(true,true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
define(['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'moment', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-mobile', 'bootstrap-table-export', 'bootstrap-table-advancedsearch'], function ($, undefined, Backend, Config, Toastr, Moment) {
|
define(['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'moment', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-mobile', 'bootstrap-table-export', 'bootstrap-table-advancedsearch', 'bootstrap-table-commonsearch'], function ($, undefined, Backend, Config, Toastr, Moment) {
|
||||||
|
|
||||||
var Table = {
|
var Table = {
|
||||||
list: {},
|
list: {},
|
||||||
|
|
@ -10,7 +10,9 @@ define(['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'moment', 'bootstr
|
||||||
toolbar: "#toolbar",
|
toolbar: "#toolbar",
|
||||||
search: true,
|
search: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
advancedSearch: true,
|
advancedSearch: false,
|
||||||
|
commonSearch: false,
|
||||||
|
titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
|
||||||
idTable: 'advancedTable',
|
idTable: 'advancedTable',
|
||||||
showExport: true,
|
showExport: true,
|
||||||
exportDataType: "all",
|
exportDataType: "all",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue