Authored by lijian

商品参数

... ... @@ -24,7 +24,8 @@ module.exports={
params:[
{name: 'id', type: 'Number'},
{name: 'standardName', type: 'String'},
{name: 'orderBy', type: 'Number'}
{name: 'standardSortId', type: 'Number'},
{name: 'orderBy', type: 'Number'}
]
},
del:{
... ...
... ... @@ -8,9 +8,9 @@
<div id="sortTree"></div>
</div>
<div class="panel-col2">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="add-btn" href="javascript:;" class="btn btn-info">新增</a>
<a id="standardType-btn" href="/erpproduct/standardSort/index" class="btn btn-primary large">参数类别管理</a>
<a id="filter-btn" href="javascript:;" class="btn btn-info" >筛选</a>
<a id="add-btn" href="javascript:;" class="btn btn-info" >新增</a>
<a id="standardType-btn" href="javascript:;" class="btn btn-primary large" >参数类别管理</a>
</div>
</div>
</div>
... ... @@ -28,10 +28,10 @@
<script type="text/template" id="template">
<div class="form-group">
<label for="stortTypeName" class="col-sm-3 control-label">分类</label>
<label for="sortTypeName" class="col-sm-3 control-label">分类</label>
<div class="col-md-6">
<input type="hidden" name="" value="[[id]]" id="id" class="form-control" value="" required="required" pattern="" title="">
<input type="text" name="" value="[[stortTypeName]]" id="stortTypeName" class="form-control" value="" required="required" pattern="" title="" maxlength="20">
<input type="text" name="" value="[[sortTypeName]]" id="sortTypeName" class="form-control" value="" required="required" pattern="" title="" maxlength="20">
</div>
</div>
... ... @@ -40,7 +40,7 @@
参数类别
</label>
<div class="col-md-6">
<select name="stortTypeId" id="stortTypeId" value="[[id]]" tabindex="-1" required="required" title="" class="form-control height40">
<select name="sortTypeId" id="sortTypeId" value="[[id]]" tabindex="-1" required="required" title="" class="form-control height40">
<option value="[[id||'-1']]">[[standardSortName||"请选择参数"]]</option>
</select>
</div>
... ...
'use strict';
var $ = require('jquery'),
common = require('../../../common/common');
window.batchOperateShelve = [];
$("#add-btn").hide();
$("#standardType-btn").hide();
window.batchOperateShelve = [];
var tabTree = new common.tabTree("#sortTree");
tabTree.init();
... ... @@ -69,6 +68,10 @@ $("#filter-btn").click(function () {
}
});
$("#standardType-btn").click(function () {
var sortId = tabTree.selected[2] ? tabTree.selected[2].id : "";
window.location.href = "/erpproduct/standardSort/index?sortId=" + sortId;
});
//删除
$('tbody').on('click', '.del-standard', function() {
var item=g.rows[$(this).data("index")];
... ... @@ -98,37 +101,47 @@ $(document).on('click', '.edit-class-btn', function () {
common.dialog.confirm("修改参数",
common.util.__template2($("#template").html(),
{id: item.id, standardName: item.standardName,
orderBy:item.orderBy, stortTypeName:sortName,standardSortName:item.standardSort.standardSortName
orderBy:item.orderBy, sortTypeName:sortName,standardSortName:item.standardSort.standardSortName
,standardSortId:item.standardSortId})
, function () {
var input = $('#standardName').val();
if (input === '' || $.trim(input) === '')
var standardName = $('#standardName').val();
var check=true;
if (standardName === '' || $.trim(standardName) === '')
{
common.util.__tip("参数名称不能为空", "warning");
return false;
check=false;
}
var stortTypeId = $('#stortTypeId').val();
if (stortTypeId === '' || $.trim(stortTypeId) === ''||stortTypeId<1)
var sortTypeId = $('#sortTypeId').val();
if (sortTypeId === '' || $.trim(sortTypeId) === ''||sortTypeId<1)
{
common.util.__tip("参数类别不能为空", "warning");
check= false;
}
if(check){
common.util.__ajax2({
url: '/erpproduct/standard/update',
data: (function () {
return {
id: item.id,
standardName: $("#standardName").val(),
orderBy: $("#orderBy").val(),
standardSortId:$("#sortTypeId").val()
};
})()
},function(rs){
if(rs.code == 200){
common.util.__tip("保存成功!", "success");
}else{
common.util.__tip(rs.message || rs.data.message);
}
g.reload();
},true)
}else {
return false;
}
common.util.__ajax2({
url: '/erpproduct/standard/update',
data: (function () {
return {
id: item.id,
standardName: $("#standardName").val(),
orderBy: $("#orderBy").val(),
standardSortId:$("#stortTypeId").val()
};
})()
}, function () {
g.reload();
});
});
new common.dropDown({
el: '#stortTypeId',
el: '#sortTypeId',
ajax: 'queryStortType',
hash: true,
params:function(){
... ... @@ -136,7 +149,7 @@ $(document).on('click', '.edit-class-btn', function () {
}
});
$('#stortTypeName').attr("disabled", true);
$('#sortTypeName').attr("disabled", true);
});
$(document).on('click', '#add-btn', function () {
... ... @@ -155,37 +168,42 @@ $(document).on('click', '#add-btn', function () {
common.dialog.confirm("新增参数",
common.util.__template2($("#template").html(),
{standardName: common.util.__input("standardName"),
orderBy: common.util.__input("orderBy"), stortId:smallSortId,stortTypeName:sortName
orderBy: common.util.__input("orderBy"), stortId:smallSortId,sortTypeName:sortName
,standardSortId:common.util.__input("standardSortId")})
, function () {
common.util.__ajax({
url: '/erpproduct/standard/add',
data: (function () {
var input = $('#standardName').val();
if (input === '' || $.trim(input) === '')
{
common.util.__tip("参数名称不能为空", "warning");
return;
}
var stortTypeId = $('#stortTypeId').val();
if (stortTypeId === '' || $.trim(stortTypeId) === ''||stortTypeId<1)
{
common.util.__tip("参数类别不能为空", "warning");
return;
}
return {
sortId:smallSortId,
standardName: $("#standardName").val(),
orderBy: $("#orderBy").val(),
standardSortId:$("#stortTypeId").val()
};
})()
}, function () {
g.reload();
});
var standardName = $('#standardName').val();
var check=true;
if (standardName === '' || $.trim(standardName) === '')
{
common.util.__tip("参数名称不能为空", "warning");
check=false;
}
var sortTypeId = $('#sortTypeId').val();
if (sortTypeId === '' || $.trim(sortTypeId) === ''||sortTypeId<1)
{
common.util.__tip("参数类别不能为空", "warning");
check= false;
}
if(check){
common.util.__ajax({
url: '/erpproduct/standard/add',
data: (function () {
return {
sortId:smallSortId,
standardName: $("#standardName").val(),
orderBy: $("#orderBy").val(),
standardSortId:$("#sortTypeId").val()
};
})()
}, function () {
g.reload();
});
}else {
return false;
}
});
new common.dropDown({
el: '#stortTypeId',
el: '#sortTypeId',
ajax: 'queryStortType',
hash: true,
params:function(){
... ... @@ -193,7 +211,7 @@ $(document).on('click', '#add-btn', function () {
}
});
$('#stortTypeName').attr("disabled", true);
$('#sortTypeName').attr("disabled", true);
});
... ...