|
|
'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);
|
|
|
});
|
|
|
|
|
|
|
...
|
...
|
|