...
|
...
|
@@ -46,7 +46,7 @@ exports.init = function() { |
|
|
* 优惠码tab卡文字替换及默认选中
|
|
|
* @param: param(请求count接口参数), indexStatus(切换条件时选中的tab卡)
|
|
|
*/
|
|
|
function tabShow(param, indexStatus) {
|
|
|
function tabShow(param, filterStatus) {
|
|
|
var param = param || {};
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
...
|
...
|
@@ -54,37 +54,59 @@ exports.init = function() { |
|
|
url: '/getCodeCount',
|
|
|
data: param,
|
|
|
success: function(res) {
|
|
|
var tpl = Handlebars.compile($('#tab-tpl').html());
|
|
|
|
|
|
var tpl = Handlebars.compile($('#tab-tpl').html()),
|
|
|
$activeTab = null;
|
|
|
|
|
|
$('.list-tabs ul').html(tpl({
|
|
|
data: res.data.data
|
|
|
}));
|
|
|
|
|
|
$('.list-tabs').find('li').each(function() {
|
|
|
var status = $(this).data('status');
|
|
|
var urlArr = location.hash.substring(1).split('&&'),
|
|
|
urlStatus = null;
|
|
|
|
|
|
$(this).find('span').text(statusConvert(status));
|
|
|
$.each(urlArr, function(i, value){
|
|
|
var result = value.split('='),
|
|
|
key = result[0],
|
|
|
value = result[1];
|
|
|
|
|
|
if (status === 'all') {
|
|
|
$(this).addClass('active').siblings().removeClass('active');
|
|
|
if (key === 'status') {
|
|
|
urlStatus = value;
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
if (indexStatus === undefined) {
|
|
|
$('.list-tabs').find('[data-status="all"]').addClass('active').siblings().removeClass('active');
|
|
|
} else {
|
|
|
$('.list-tabs').find('[data-status="' + indexStatus + '"]').addClass('active').siblings().removeClass('active');
|
|
|
}
|
|
|
$('.list-tabs').find('li').each(function() {
|
|
|
var status = $(this).data('status');
|
|
|
$(this).find('span').text(statusConvert(status));
|
|
|
|
|
|
});
|
|
|
|
|
|
$activeTab = $('.list-tabs').find('[data-status="all"]');
|
|
|
if (urlStatus) {
|
|
|
$activeTab = $('.list-tabs').find('[data-status="' + urlStatus + '"]');
|
|
|
} else if (filterStatus) {
|
|
|
$activeTab = $('.list-tabs').find('[data-status="' + filterStatus + '"]');
|
|
|
}
|
|
|
if ($activeTab.size() <= 0) {
|
|
|
$activeTab = $('.list-tabs').find('[data-status="all"]');
|
|
|
}
|
|
|
$activeTab.addClass('active').siblings().removeClass('active');
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tabShow();
|
|
|
|
|
|
//tab卡切换列表事件
|
|
|
$('.list-tabs').on('click', 'li', function() {
|
|
|
$(this).addClass('active').siblings().removeClass('active');
|
|
|
g.reload();
|
|
|
g.reload({
|
|
|
page: 1,
|
|
|
status: parseInt($('.list-tabs').find('.active').data('status'))
|
|
|
});
|
|
|
});
|
|
|
|
|
|
var btnAuthority = JSON.parse($("#btnAuthority").val());
|
...
|
...
|
@@ -150,9 +172,11 @@ exports.init = function() { |
|
|
batchNo: $.trim($('#filter-id').val()),
|
|
|
name: $.trim($('#filter-name').val()),
|
|
|
reqDepartment:$.trim($('#filter-dep').val())
|
|
|
}, parseInt($('.list-tabs').find('.active').data('status')))
|
|
|
}, $('.list-tabs').find('.active').data('status'));
|
|
|
|
|
|
location.hash = '';
|
|
|
g.reload({
|
|
|
status: 'all',
|
|
|
page: 1
|
|
|
});
|
|
|
});
|
...
|
...
|
|