categoryManage.js
2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* Created by ty on 2016/5/26.
*/
var $ = require('jquery'),
common = require('../common/common');
require('../util/jquery.nestable.js');
new common.dropDown({el: "#status"});
new common.dropDown({el: "#platform"});
var Bll = {
initGrid: function () {
common.util.__ajax({
async: false,
url: "/category/getCategoryList",
data: {
platform: common.util.__input("platform"),
status: common.util.__input("status")
}
},function(res) {
$("#basicTable").html(common.util.__template2($("#grid-template").html(), res));
$('#author_id, #article_gender, #status,#tag,#is_hot,#platform').select2();
$('#nestable').nestable();
$('.dd').nestable('collapseAll');
$('div[data-toggle="category"]').on('click', function(){
var sort_id = $(this).parent().data('id');
$('#addModalBox').on('click', function(){
$.get('/cmsproduct/sortattribute/attribute', {sort_id : sort_id}, function(html){
$('.modal-dialog').html(html);
$('#addModal').modal();
$('#attribute_id').select2();
$('#addAttribute').on('click', function(){
var attribute_id = $('#attribute_id').val();
var _text = $('#attribute_id option:selected').text();
var _count = $('#attributeBox tr').length;
var _html = '<tr><td>'+_text+'<input type="hidden" name="data['+_count+'][attribute_id]" value="'+attribute_id+'" /></td><td><input type="text" name="data['+_count+'][order_by]" style="height:28px;width:60px;" value="" /></td></tr>';
$('#attributeBox').append(_html);
});
});
});
});
}, true);
}
}
Bll.initGrid();
$(document).on("click", "#filter-btn", function () {
Bll.initGrid();
});
$(document).on("click", ".updateStatus", function() {
var id = $(this).data("id");
var status = $(this).data("status");
common.util.__ajax({
url: "/category/updateCategoryStatus",
data: {
id:id,
status: status
}
},function() {
Bll.initGrid();
});
});