...
|
...
|
@@ -258,13 +258,14 @@ var Bll={ |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
var g=new common.grid({
|
|
|
el:"#baseTable",
|
|
|
parms:function(){
|
|
|
return {brandId: $('#brandname').val()}
|
|
|
},
|
|
|
columns:[
|
|
|
{display:"选择","checkbox":true},
|
|
|
{display:"选择","type":"checkbox"},
|
|
|
{display:"品牌",render:function(item){
|
|
|
item.brandName=$.trim($("#brandname").text().replace(/选择品牌/g,''));
|
|
|
return item.brandName;
|
...
|
...
|
@@ -305,7 +306,6 @@ e.on("render",function(){ |
|
|
});
|
|
|
|
|
|
(!!~$("#shopsType").val())?$("#modalId").prop("disabled",false):$("#modalId").prop("disabled",true);
|
|
|
|
|
|
//修改
|
|
|
if($("#shopRelationList").val()){
|
|
|
var a=JSON.parse($("#shopRelationList").val());
|
...
|
...
|
@@ -322,18 +322,39 @@ e.on("bind",function(){ |
|
|
});
|
|
|
|
|
|
$("#shopsType").change(function(){
|
|
|
(!!~$("#shopsType").val())?$("#modalId").prop("disabled",false):$("#modalId").prop("disabled",true);
|
|
|
|
|
|
if(!!~$("#shopsType").val()){
|
|
|
$("#modalId").prop("disabled",false);
|
|
|
}else{
|
|
|
$("#modalId").prop("disabled",true);
|
|
|
|
|
|
}
|
|
|
if(g2.grid){
|
|
|
g2.__rows.length=0;
|
|
|
g2.reload();
|
|
|
}
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
$("#modalId").click(function(){
|
|
|
var __feild="brandId";
|
|
|
if((+$("#shopsType").val()==1)){
|
|
|
g.options.columns[0].type="radio";
|
|
|
__feild="brandId";
|
|
|
g2.__rows.length=0;
|
|
|
}else{
|
|
|
g.options.columns[0].type="checkbox";
|
|
|
__feild="supplierId";
|
|
|
}
|
|
|
//common.util.__template($("#template").html(),{})
|
|
|
common.dialog.confirm("添加供应商关系",$("#template").html(),function(){
|
|
|
console.log(g.selected);
|
|
|
|
|
|
$.each(g.selected,function(index,item){
|
|
|
//item.supplierId
|
|
|
var i=0;
|
|
|
$.each(g2.__rows,function(index1,item1){
|
|
|
if(item1.brandId==item.brandId){
|
|
|
if(item1[__feild]==item[__feild]){
|
|
|
i++;
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -356,9 +377,7 @@ e.on("bind",function(){ |
|
|
});
|
|
|
|
|
|
$("#updateBrand").on("click",".delete",function(){
|
|
|
console.log(g2.__rows);
|
|
|
g2.__rows.splice($(this).data("index"),1);
|
|
|
console.log(g2.__rows);
|
|
|
g2.reload();
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -410,10 +429,15 @@ e.on("validate",function(){ |
|
|
});
|
|
|
|
|
|
e.on("validate",function(){
|
|
|
_arr.shopRelation=JSON.stringify(g2.rows);
|
|
|
if(!_arr.shopRelation){
|
|
|
var i=0;
|
|
|
for (var key in g2.rows) {
|
|
|
i++;
|
|
|
}
|
|
|
if(!i){
|
|
|
return "请选择关联品牌";
|
|
|
}
|
|
|
_arr.shopRelation=JSON.stringify(g2.rows);
|
|
|
|
|
|
});
|
|
|
|
|
|
e.init();
|
...
|
...
|
|