Authored by xuhongyun

build

... ... @@ -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("温馨提示", "确定&nbsp;&nbsp<b><font color='#ff0000'>删除&nbsp;&nbsp;</font>【" + sortName + "】</b>&nbsp;&nbsp;分类吗?", 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("温馨提示", "确定&nbsp;&nbsp<b><font color='#ff0000'>删除&nbsp;&nbsp;</font>【" + sortName + "】</b>&nbsp;&nbsp;分类吗?", 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
... ...
... ... @@ -5,18 +5,19 @@ webpackJsonp([117],[
'use strict';
var $ = __webpack_require__(1),
common = __webpack_require__(2);
//下拉框
new common.dropDown({
el: "#state"
el: "#state"
});
var renderHd = false;
var g = new common.grid({
el: "#basicTable",
parms: function() {
return {
state: common.util.__input('state'), //$.trim($('#status').val()) || '',
};
},
parms: function() {
return {
state: common.util.__input('state'), //$.trim($('#status').val()) || '',
};
},
columns: [{
display: '',
name: 'foler',
... ... @@ -52,10 +53,11 @@ webpackJsonp([117],[
g.init($("#gridurl").val());
$("#filter-btn").click(function() {
renderHd = false;
g.reload();
renderHd = false;
g.reload();
});
//编辑排序
$(document).on('change', '.saleCategoryNumInput', function() {
if(checkNumInput($(this))){
... ... @@ -386,8 +388,9 @@ webpackJsonp([117],[
}
}, function(res){
if (res.code == 200) {
$("#category_id_" + categoryId).find(".status").html("<b style='color: #449d44'>开启</b>");
$("#category_id_" + categoryId).find(".openAndClose").html("<a class='btn btn-danger btn-xs close-category' href='javascript:;'>关闭</a>");
// $("#category_id_" + categoryId).find(".status").html("<b style='color: #449d44'>开启</b>");
// $("#category_id_" + categoryId).find(".openAndClose").html("<a class='btn btn-danger btn-xs close-category' href='javascript:;'>关闭</a>");
$("#filter-btn").click();
common.util.__tip("开启成功!","success");
} else{
common.util.__tip(res.data.message);
... ... @@ -411,8 +414,7 @@ webpackJsonp([117],[
if (res.code == 200) {
// $("#category_id_" + categoryId).find(".status").html("<b style='color: #d9534f'>关闭</b>");
// $("#category_id_" + categoryId).find(".openAndClose").html("<a class='btn btn-warning btn-xs open-category' href='javascript:;'>开启</a>");
// g.reload();
$("#filter-btn").click();
$("#filter-btn").click();
common.util.__tip("关闭成功!","success");
}else{
common.util.__tip(res.data.message);
... ... @@ -423,27 +425,27 @@ webpackJsonp([117],[
//删除销售类目
$(document).on('click', '.del-category', function() {
var categoryId = $(this).parent().data('id'),
categoryName = $(this).parent().data('name');
var categoryId = $(this).parent().data('id'),
categoryName = $(this).parent().data('name');
common.dialog.confirm("温馨提示", "确定&nbsp;&nbsp<b><font color='#ff0000'>删除&nbsp;&nbsp;</font>【" + categoryName + "】</b>&nbsp;&nbsp;分类吗?", function() {
common.util.__ajax2({
url: '/sale/salesCategory/delSC',
data: {
categoryId: categoryId
}
}, function(res){
if (res.code == 200) {
// g.reload();
$("#filter-btn").click();
common.util.__tip("删除成功!","success");
}
})
});
common.dialog.confirm("温馨提示", "确定&nbsp;&nbsp<b><font color='#ff0000'>删除&nbsp;&nbsp;</font>【" + categoryName + "】</b>&nbsp;&nbsp;分类吗?", function() {
common.util.__ajax2({
url: '/sale/salesCategory/delSC',
data: {
categoryId: categoryId
}
}, function(res){
if (res.code == 200) {
// g.reload();
$("#filter-btn").click();
common.util.__tip("删除成功!","success");
}
})
});
})
//切换状态重载列表
//切换状态重载列表
$('input[name="state"]').on('change', function() {
$(this).parent().addClass('current').siblings().removeClass('current');
g.reload();
... ...
module.exports=function(app) {
/*物理类目管理*/
app.get("/erpproduct/sort/index","category.Index","category_queryAllProductSortList",function(plist,req,res){
app.get("/erpproduct/sort/index","category.Index",function(plist,req,res){
this.$extend={
moduleName:'物理类目管理',
pageName:'物理类目管理列表',
data:plist.data
gridurl: '/erpproduct/sorter/getlist'
}
});
/*添加物理类目管理*/
... ... @@ -24,6 +24,9 @@ module.exports=function(app) {
}
return sort;
});
/*列表*/
app.post("/erpproduct/sorter/getlist","category_queryAllProductSortList");
/*【添加品类】ajax请求接口*/
app.post("/product/sort/addProductSort","category_addProductSort");
/*【修改品类】ajax请求接口*/
... ... @@ -32,4 +35,6 @@ module.exports=function(app) {
app.post("/erpproduct/sorter/open","category_publishProductSort");
/*关闭*/
app.post("/erpproduct/sorter/close","category_closeProductSort");
/*删除*/
app.post("/erpproduct/sorter/del","category_delProductSort");
}
\ No newline at end of file
... ...
... ... @@ -43,6 +43,9 @@ module.exports=function(app) {
/*开关销售类目*/
app.post("/sale/salesCategory/updateSCStatus","salecategory_updateSCStatus");
/*删除销售类目*/
app.post("/sale/salesCategory/delSC","salecategory_delSC");
/*批量添加标签接口*/
app.post("/sale/salesCategoryLabel/addSCLabel","salecategory_addSCLabel");
... ...
... ... @@ -4,6 +4,9 @@ module.exports={
queryAllProductSortList:{
title:'获取所有品类',
url: '/product/queryAllProductSortList',
params: [
{name: 'status', type: 'Number'}
]
},
addProductSort:{
title:'商品管理>【添加品类】ajax请求接口',
... ... @@ -58,6 +61,13 @@ module.exports={
params: [
{name: 'param', type: 'Number'}
]
},
delProductSort:{
title:'delProductSort',
url: '/product/delProductSort',
params: [
{name: 'param', type: 'Number'}
]
}
}
}
\ No newline at end of file
... ...
... ... @@ -82,6 +82,13 @@ module.exports={
{name: 'state', type: 'string'}
]
},
delSC:{
title: "删除销售类目",
url: '/salesCategory/delSC',
params: [
{name: 'categoryId', type: 'string'}
]
},
addSCLabel:{
title: "批量添加标签接口",
url: '/salesCategoryLabel/addSCLabel',
... ...
... ... @@ -2,11 +2,27 @@
<%include '../common/__partail/ListHeader'%>
<div class="contentpanel">
<div style="margin-bottom: 20px">
<div class="panel-body" >
<a href="/product/class/new" class="btn btn-success"><i class="fa fa-plus"></i> 添加品类</a>
</div>
<div class="panel">
<div class="panel-body">
<div class="row">
<div class="panel-col2">
<select name="status" id="status" tabindex="-1" title="" class="select2-offscreen brandBtn-group">
<option value="-1">未选择</option>
<option value="1">开启</option>
<option value="0">关闭</option>
</select>
</div>
<div class="panel-col">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="filter-all" href="/erpproduct/sort/index" class="btn btn-info">全部</a>
</div>
</div>
</div>
<div class="panel" style="display: none;">
<div class="panel-body nopadding">
<div class="table-responsive">
<table class="table table-bordered toggle-table">
... ... @@ -43,6 +59,10 @@
data-status="<%item.status%>">
<%if item.booleanStatus%>关闭<%else%>开启<%/if%>
</a>
<%if item.canDelFlag%>
<a href="/erpproduct/sorter/del/<%item.id%>"
class="btn btn-xs del-class-btn btn-danger">删除</a>
<%/if%>
</td>
</tr>
<%/each%>
... ... @@ -52,6 +72,46 @@
</div>
</div>
</div>
<div class="panel">
<div class="panel-body nopadding">
<div class="sale-category-table dataTables_wrapper no-footer" id="basicTable"></div>
</div>
</div>
</div>
<input type="hidden" id="gridurl" value="<%gridurl%>">
<script type="text/template" id="tableHdTemp">
<div class="level-hd clearfix">
<span class="folder" style="width: 10%"></span>
<span style="width: 10%">ID</span>
<span style="width: 15%">品类名称</span>
<span style="width: 10%">品类缩写</span>
<span style="width: 15%">所属分类</span>
<span class="orderby" style="width: 10%">排序</span>
<span class="status" style="width: 10%">状态</span>
<span class="operate" style="width: 20%">操作</span>
</div>
</script>
<script type="text/template" id="tableTemp2">
<span class="folder" style="width: 10%"></span>
<span style="font-size: 10px;width: 10%">[[id]]</span>
<span style="font-size: 10px;width: 15%">[[sortName]]</span>
<span style="font-size: 10px;width: 10%">[[sortInitials]]</span>
<span style="font-size: 10px;width: 15%">[[sortLevel]]级分类</span>
<span class="orderby" style="font-size: 10px;width: 10%">[[orderBy]]</span>
<span class="status" style="font-size: 10px;width: 10%">[[if status=="1"]]<b style="color: #449d44">开启</b>[[/if]][[if status=="0"]]<b style="color: #d9534f">关闭</b>[[/if]]</span>
<span class="operate" style="font-size: 10px;width: 20%" data-id="[[id]]" data-name="[[sortName]]">
<a class="btn btn-info btn-xs edit-class-btn" href="/product/class/edit/[[id]]">编辑</a>
<b class="openAndClose" data-id="[[id]]" data-name="[[sortName]]">
[[if status=="1"]]<a class="btn btn-danger open-close-btn btn-xs close-category" data-status="[[status]]" href="javascript:;">关闭</a>[[/if]]
[[if status=="0"]]<a class="btn btn-warning open-close-btn btn-xs open-category" data-status="[[status]]" href="javascript:;">开启</a>[[/if]]
</b>
[[if canDelFlag]]
<a href="/erpproduct/sorter/del/[[id]]" class="btn btn-xs del-class-btn btn-danger">删除</a>
[[/if]]
</span>
</script>
<%include '../common/__ui/footer'%>
\ No newline at end of file
... ...
... ... @@ -3,19 +3,23 @@
<div class="contentpanel">
<div class="panel panel-default" style="margin:10px 0; display: none">
<div class="panel-body nopadding">
<div class="state-select">
<strong>状态:</strong>
<label><input type="radio" name="state" value="">全部</label>
<label class="current"><input type="radio" name="state" value="1">开启</label>
<label><input type="radio" name="state" value="0">关闭</label>
<a href="javascript:;" id="add-root-category" class="btn btn-success" style="margin:10px 0;"><i class="fa fa-plus"></i> 添加根分类</a>
<div class="panel-body">
<div class="row">
<div class="panel-col2">
<select name="state" id="state" tabindex="-1" title="" class="select2-offscreen brandBtn-group">
<option value="-1">未选择</option>
<option value="1">开启</option>
<option value="0">关闭</option>
</select>
</div>
<div class="panel-col">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="filter-all" href="/sale/category/index" class="btn btn-info">全部</a>
</div>
</div>
</div>
<a href="javascript:;" id="add-root-category" class="btn btn-success" style="margin:10px 0;"><i class="fa fa-plus"></i> 添加根分类</a>
<div class="panel">
<div class="panel-body nopadding">
... ... @@ -263,7 +267,10 @@
<a class="btn btn-danger btn-xs close-category" href="javascript:;">关闭</a>
[[/if]]
[[if b.state=="0"]]
<a class="btn btn-warning btn-xs open-category" href="javascript:;">开启</a>
<a class="btn btn-warning btn-xs open-category" href="javascript:;">开启[[b.canDelFlag]]</a>
[[/if]]
[[if b.canDelFlag]]
<a class="btn btn-warning btn-xs del-category" href="javascript:;">删除</a>
[[/if]]
</span>
</div>
... ... @@ -296,6 +303,7 @@
<b class="openAndClose" data-id="[[categoryId]]" data-name="[[categoryName]]">
[[if state=="1"]]<a class="btn btn-danger btn-xs close-category" href="javascript:;">关闭</a>[[/if]]
[[if state=="0"]]<a class="btn btn-warning btn-xs open-category" href="javascript:;">开启</a>[[/if]]
[[if canDelFlag]]<a class="btn btn-danger btn-xs del-category" href="javascript:;">删除</a>[[/if]]
</b>
</span>
</script>
... ...