...
|
...
|
@@ -11,136 +11,136 @@ webpackJsonp([23],[ |
|
|
var $ = __webpack_require__(1);
|
|
|
var common=__webpack_require__(2);
|
|
|
|
|
|
//下拉框
|
|
|
new common.dropDown({
|
|
|
el: "#status"
|
|
|
});
|
|
|
var renderHd = false;
|
|
|
|
|
|
var g = new common.grid({
|
|
|
el: "#basicTable",
|
|
|
parms: function() {
|
|
|
return {
|
|
|
status: common.util.__input('status'), //$.trim($('#status').val()) || '',
|
|
|
};
|
|
|
},
|
|
|
columns: [{
|
|
|
display: '',
|
|
|
name: 'foler',
|
|
|
render: function(item) {
|
|
|
debugger;
|
|
|
var html = "", top = true;
|
|
|
|
|
|
if (!renderHd) {
|
|
|
html += $('#tableHdTemp').html();
|
|
|
init(item);
|
|
|
renderHd = true;
|
|
|
} else {init(item)}
|
|
|
return html;
|
|
|
|
|
|
function init(item){
|
|
|
if(top){
|
|
|
html += "<div id='category_id_"+ item.id +"' class='level-wrap clearfix'>";
|
|
|
top = false;
|
|
|
}else{
|
|
|
html += "<div id='category_id_"+ item.id +"' class='level-wrap clearfix' style='display: none'>"
|
|
|
}
|
|
|
html += common.util.__template2($('#tableTemp2').html(), item);
|
|
|
if(item.subList){
|
|
|
for(var i=0; i<item.subList.length; i++){
|
|
|
init(item.subList[i]);
|
|
|
}
|
|
|
}
|
|
|
html += "</div>";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
g.init($("#gridurl").val());
|
|
|
//g.init("/erpproduct/sort/index");
|
|
|
$("#filter-btn").click(function() {
|
|
|
renderHd = false;
|
|
|
g.reload();
|
|
|
});
|
|
|
|
|
|
//打开层级类目
|
|
|
$(document).on('click', '.folder', function() {
|
|
|
var $wrap = $(this).parent();
|
|
|
if (!$(this).hasClass('open')) {
|
|
|
if ($wrap.find('> .level-wrap').size() > 0) {
|
|
|
var position = $(this).css("background-position");
|
|
|
var a = position.substring(0,position.indexOf("px"));
|
|
|
$wrap.find('> .level-wrap').show().find(".folder").css("background-position", (parseInt(a)+36) + "px");
|
|
|
$(this).addClass('open');
|
|
|
}
|
|
|
} else {
|
|
|
$(this).removeClass('open');
|
|
|
if ($wrap.find('.level-wrap').size() > 0) {
|
|
|
$wrap.find('.level-wrap').hide().find(".folder").removeClass('open').css("background-position", "12px center");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//删除物理类目
|
|
|
$(document).on('click', '.del-class-btn', function() {
|
|
|
var sortId = $(this).parent().data('id'),
|
|
|
sortName = $(this).parent().data('name');
|
|
|
|
|
|
common.dialog.confirm("温馨提示", "确定  <b><font color='#ff0000'>删除 </font>【" + sortName + "】</b> 分类吗?", function() {
|
|
|
common.util.__ajax2({
|
|
|
url: '/erpproduct/sorter/del',
|
|
|
data: {
|
|
|
param: sortId
|
|
|
}
|
|
|
}, function(res){
|
|
|
if (res.code == 200) {
|
|
|
// g.reload();
|
|
|
$("#filter-btn").click();
|
|
|
common.util.__tip("删除成功!","success");
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
event.preventDefault();
|
|
|
});
|
|
|
|
|
|
$(document).on('click', '.open-close-btn',function() {
|
|
|
|
|
|
var status;
|
|
|
var id = $(this).parent().data('id');
|
|
|
|
|
|
if ($(this).attr('data-status') === '1') {
|
|
|
status = 0;
|
|
|
} else if ($(this).attr('data-status') === '0') {
|
|
|
status = 1;
|
|
|
}
|
|
|
|
|
|
console.log(status);
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
dataType: 'json',
|
|
|
url: status?"/erpproduct/sorter/open":"/erpproduct/sorter/close",
|
|
|
data: {
|
|
|
param: id
|
|
|
}
|
|
|
}).then(function (data) {
|
|
|
|
|
|
console.log(data);
|
|
|
|
|
|
if (data.code === 200) {
|
|
|
if ($(this).hasClass('btn-danger')) {
|
|
|
common.util.__tip("关闭成功!",'success');
|
|
|
} else {
|
|
|
common.util.__tip("开启成功!",'success');
|
|
|
}
|
|
|
// g.reload();
|
|
|
$("#filter-btn").click();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
event.preventDefault();
|
|
|
}
|
|
|
);
|
|
|
//下拉框
|
|
|
new common.dropDown({
|
|
|
el: "#status"
|
|
|
});
|
|
|
var renderHd = false;
|
|
|
|
|
|
var g = new common.grid({
|
|
|
el: "#basicTable",
|
|
|
parms: function() {
|
|
|
return {
|
|
|
status: common.util.__input('status'), //$.trim($('#status').val()) || '',
|
|
|
};
|
|
|
},
|
|
|
columns: [{
|
|
|
display: '',
|
|
|
name: 'foler',
|
|
|
render: function(item) {
|
|
|
debugger;
|
|
|
var html = "", top = true;
|
|
|
|
|
|
if (!renderHd) {
|
|
|
html += $('#tableHdTemp').html();
|
|
|
init(item);
|
|
|
renderHd = true;
|
|
|
} else {init(item)}
|
|
|
return html;
|
|
|
|
|
|
function init(item){
|
|
|
if(top){
|
|
|
html += "<div id='category_id_"+ item.id +"' class='level-wrap clearfix'>";
|
|
|
top = false;
|
|
|
}else{
|
|
|
html += "<div id='category_id_"+ item.id +"' class='level-wrap clearfix' style='display: none'>"
|
|
|
}
|
|
|
html += common.util.__template2($('#tableTemp2').html(), item);
|
|
|
if(item.subList){
|
|
|
for(var i=0; i<item.subList.length; i++){
|
|
|
init(item.subList[i]);
|
|
|
}
|
|
|
}
|
|
|
html += "</div>";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
g.init($("#gridurl").val());
|
|
|
//g.init("/erpproduct/sort/index");
|
|
|
$("#filter-btn").click(function() {
|
|
|
renderHd = false;
|
|
|
g.reload();
|
|
|
});
|
|
|
|
|
|
//打开层级类目
|
|
|
$(document).on('click', '.folder', function() {
|
|
|
var $wrap = $(this).parent();
|
|
|
if (!$(this).hasClass('open')) {
|
|
|
if ($wrap.find('> .level-wrap').size() > 0) {
|
|
|
var position = $(this).css("background-position");
|
|
|
var a = position.substring(0,position.indexOf("px"));
|
|
|
$wrap.find('> .level-wrap').show().find(".folder").css("background-position", (parseInt(a)+36) + "px");
|
|
|
$(this).addClass('open');
|
|
|
}
|
|
|
} else {
|
|
|
$(this).removeClass('open');
|
|
|
if ($wrap.find('.level-wrap').size() > 0) {
|
|
|
$wrap.find('.level-wrap').hide().find(".folder").removeClass('open').css("background-position", "12px center");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//删除物理类目
|
|
|
$(document).on('click', '.del-class-btn', function() {
|
|
|
var sortId = $(this).parent().data('id'),
|
|
|
sortName = $(this).parent().data('name');
|
|
|
|
|
|
common.dialog.confirm("温馨提示", "确定  <b><font color='#ff0000'>删除 </font>【" + sortName + "】</b> 分类吗?", function() {
|
|
|
common.util.__ajax2({
|
|
|
url: '/erpproduct/sorter/del',
|
|
|
data: {
|
|
|
param: sortId
|
|
|
}
|
|
|
}, function(res){
|
|
|
if (res.code == 200) {
|
|
|
// g.reload();
|
|
|
$("#filter-btn").click();
|
|
|
common.util.__tip("删除成功!","success");
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
event.preventDefault();
|
|
|
});
|
|
|
|
|
|
$(document).on('click', '.open-close-btn',function() {
|
|
|
|
|
|
var status;
|
|
|
var id = $(this).parent().data('id');
|
|
|
|
|
|
if ($(this).attr('data-status') === '1') {
|
|
|
status = 0;
|
|
|
} else if ($(this).attr('data-status') === '0') {
|
|
|
status = 1;
|
|
|
}
|
|
|
|
|
|
console.log(status);
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
dataType: 'json',
|
|
|
url: status?"/erpproduct/sorter/open":"/erpproduct/sorter/close",
|
|
|
data: {
|
|
|
param: id
|
|
|
}
|
|
|
}).then(function (data) {
|
|
|
|
|
|
console.log(data);
|
|
|
|
|
|
if (data.code === 200) {
|
|
|
if ($(this).hasClass('btn-danger')) {
|
|
|
common.util.__tip("关闭成功!",'success');
|
|
|
} else {
|
|
|
common.util.__tip("开启成功!",'success');
|
|
|
}
|
|
|
// g.reload();
|
|
|
$("#filter-btn").click();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
event.preventDefault();
|
|
|
}
|
|
|
);
|
|
|
|
|
|
/***/ }
|
|
|
]); |
|
|
\ No newline at end of file |
...
|
...
|
|