Authored by lijian

Merge branch 'hotfix-商品参数' of http://git.yoho.cn/fe/yohobuy-portal-fe2 into hotfix-商品参数

... ... @@ -29,5 +29,21 @@ module.exports=function(app) {
pageName:'产品参数类别管理'
}
});
/*商品参数类别*/
app.get("/erpproduct/standardVal/index","baserule.parameterMake.Index",function(){
this.$extend={
moduleName:'商品基础规则',
pageName:'产品参数值管理'
}
});
/*参数类别列表*/
app.post("/erpproduct/standardVal/list","parameterMake_list");
/*参数类别添加*/
app.post("/erpproduct/standardVal/add","parameterMake_add");
/*参数类别修改*/
app.post("/erpproduct/standardVal/update","parameterMake_update");
/*参数类别删除*/
app.post("/erpproduct/standardVal/del","parameterMake_del");
}
\ No newline at end of file
... ...
module.exports={
namespace:"parameterMake",
apis:{
list:{
title:'查询产品参数值列表',
url: '/standard/getAllParameterMakeByStandardId',
params: [
{name: 'standardId', type: 'Number'}
]
},
add:{
title:'增加',
url: '/standard/addParameterMake',
params:[
{name: 'standardId', type: 'Number'},
{name: 'parameterValue', type: 'String'}
]
},
update:{
title:'修改',
url: '/standard/updateParameterMake',
params:[
{name: 'id', type: 'Number'},
{name: 'parameterValue', type: 'String'}
]
},
del:{
title:'删除',
url: '/standard/deleteParameterMake',
params:[
{name: 'id', type: 'Number'}
]
}
}
}
\ No newline at end of file
... ...
<%include '../../../common/views/__ui/header'%>
<%include '../../../common/views/__partail/ListHeader'%>
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<div class="row">
<div class="panel-col">
<a id="add-btn" href="javascript:;" class="btn btn-success" >添加参数值</a>
</div>
</div>
</div>
</div>
<div class="panel">
<div class="panel-body nopadding">
<div class="dataTab_wrapper" id="basicTab" style="margin-bottom: 10px"></div>
<div class="dataTables_wrapper no-footer" id="basicTable"></div>
</div>
</div>
</div>
<script type="text/template" id="edit-template">
<input type="hidden" name="" value="[[id]]" id="id" class="form-control" value="" required="required" pattern="" title="">
<div class="form-group">
<label for="parameterValue" class="col-sm-3 control-label">参数值</label>
<div class="col-md-6">
<input type="text" name="" value="[[parameterValue]]" id="parameterValue" class="form-control" value="" required="required" pattern="" title="" maxlength="20">
</div>
</div>
</script>
<%include '../../../common/views/__ui/footer'%>
\ No newline at end of file
... ...
var $ = require('jquery'),
common = require('../../../common/common');
var reqParams = GetRequestParams();
var g = new common.grid({
el: "#basicTable",
usepagesize:true,
parms: function () {
return {
standardId reqParams.standardId,
standardName : reqParams.standardName
};
},
columns: [ {
display: 'ID',
name: 'id',
}, {
display: '参数值',
render: function(item) {
return item.parameterValue;
}
}, {
display: '所属参数',
render: function(item) {
return appendAllSortName(parmList);
}
}, {
display: '操作',
render: function(items) {
var HtmArr = [];
HtmArr.push('<a data-index="'+ items.__index+ '" href="JavaScript:;" class="btn btn-info btn-xs edit-class-btn">编辑</a>');
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs del-standardVal">删除</a>');
return HtmArr.join('');
}
}]
});
g.init("/erpproduct/standardVal/list");
//删除
$('tbody').on('click', '.del-standardVal', function() {
var item=g.rows[$(this).data("index")];
common.dialog.confirm("温馨提示", "你确定要删除吗?", function () {
common.util.__ajax({
url:'/erpproduct/standardVal/del',
data:{id:item.id}
},function(){
g.reload();
});
});
});
/**
修改
**/
$(document).on('click', '.edit-class-btn', function () {
var item = g.rows[$(this).data("index")];
var standardVal = {
id: item.id,
parameterValue: item.parameterValue
};
common.dialog.confirm("修改参数",
common.util.__template2($("#edit-template").html(),standardVal)
, function () {
common.util.__ajax({
url: '/erpproduct/standardVal/update',
data: (function () {
var input = $('#parameterValue').val();
if (input === '' || $.trim(input) === ''){
return "参数值不能为空";
}
return {
id: item.id,
parameterValue: $("#parameterValue").val(),
standardId: $("#standardId").val()
};
})()
}, function () {
g.reload();
});
});
});
/**
新增
**/
$(document).on('click', '#add-btn', function () {
var item = g.rows[$(this).data("index")];
var standardVal = {
id: item.id,
parameterValue: common.util.__input("parameterValue")
};
common.dialog.confirm("新增参数类别",
common.util.__template2($("#edit-template").html(),standardVal),
function () {
common.util.__ajax({
url: '/erpproduct/standardVal/add',
data: (function () {
var parameterValue = $('#parameterValue').val();
if (parameterValue === '' || $.trim(parameterValue) === '')
{
//common.util.__tip("参数类别名称不能为空", "warning");
return "参数类别名称不能为空";
}
return {
standardId: reqParams.standardId,
parameterValue: $("#parameterValue").val()
};
})()
}, function () {
g.reload();
});
});
new common.dropDown({
el: '#stortTypeId',
ajax: 'queryStortType',
hash: true,
params:function(){
return {standardId : reqParams.standardId};
}
});
});
var GetRequestParams = function() {
var url = location.search; //获取url中"?"符后的字串
var theRequest = {};
if (url.indexOf("?") != -1) {
var str = url.substr(1);
strs = str.split("&");
for(var i = 0; i < strs.length; i ++) {
var paramNameVal = strs[i].split("=");
theRequest[paramNameVal[0]] = unescape(paramNameVal[1]);
}
}
return theRequest;
}
\ No newline at end of file
... ...
... ... @@ -51,6 +51,7 @@ var g = new common.grid({
render: function(items) {
var HtmArr = [];
HtmArr.push('<a data-index="'+ items.__index+ '" href="JavaScript:;" class="btn btn-info btn-xs edit-class-btn">编辑</a>');
HtmArr.push('<a data-index="'+ items.__index+ '" href="JavaScript:;" class="btn btn-info btn-xs param-val">参数值管理</a>');
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs del-standard">删除</a>');
return HtmArr.join('');
}
... ... @@ -93,6 +94,22 @@ $('tbody').on('click', '.del-standard', function() {
});
});
/**参数值管理
**/
$('tbody').on('click', '.param-val', function() {
var item = g.rows[$(this).data("index")];
var standardId = item.id;
var standardName = item.standardName;
var url = "/erpproduct/standardVal/index"+"?"
+ "standardId=" + standardId
+"&" + "standardName=" + standardName ;
window.location.href= url;
});
$(document).on('click', '.edit-class-btn', function () {
var item = g.rows[$(this).data("index")];
var sortName="";
... ...