...
|
...
|
@@ -246,14 +246,15 @@ var Bll={ |
|
|
});
|
|
|
});
|
|
|
},
|
|
|
addInput:function(label,name){
|
|
|
addInput:function(name,label,value){
|
|
|
var $input=$("<input />");
|
|
|
$input.attr("type","text");
|
|
|
$input.attr("name",name);
|
|
|
$input.attr("placeholder",label);
|
|
|
$input.attr("placeholder",label.replace(':',''));
|
|
|
$input.addClass("form-control");
|
|
|
$input.css("margin-bottom","15px");
|
|
|
$("#"+name).append($input);
|
|
|
value&&$input.val(value);
|
|
|
$("#"+name+"-list").append($input);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -282,12 +283,20 @@ var g2=new common.grid({ |
|
|
}}
|
|
|
]
|
|
|
});
|
|
|
g2.__rows=[];
|
|
|
|
|
|
e.on("render",function(){
|
|
|
$(".urlAdd").each(function(){
|
|
|
var label=$(this).parents(".form-group").find("label").text().replace(':','');
|
|
|
var name=$(this).prev("div").attr("id");
|
|
|
Bll.addInput(label,name);
|
|
|
|
|
|
|
|
|
$("#otherUrl").add("#websiteUrl").add("#shopAddress").each(function(){
|
|
|
var label=$(this).parents(".form-group").find("label").text();
|
|
|
var name=$(this).attr("id");
|
|
|
var value=$(this).val()?$(this).val():'[]';
|
|
|
|
|
|
var data=JSON.parse(value);
|
|
|
$.each(data,function(i,item){
|
|
|
Bll.addInput(name,label,item);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
(!!~$("#shopsType").val())?$("#modalId").prop("disabled",false):$("#modalId").prop("disabled",true);
|
...
|
...
|
@@ -295,15 +304,16 @@ e.on("render",function(){ |
|
|
//修改
|
|
|
if($("#shopRelationList").val()){
|
|
|
var a=JSON.parse($("#shopRelationList").val());
|
|
|
g2.init(a);
|
|
|
Array.prototype.push.apply(g2.__rows, a)
|
|
|
g2.init(g2.__rows);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
e.on("bind",function(){
|
|
|
$(".urlAdd").click(function(){
|
|
|
var label=$(this).parents(".form-group").find("label").text();
|
|
|
var name=$(this).prev("div").attr("id");
|
|
|
Bll.addInput(label,name);
|
|
|
var name=$(this).parent("div").next(":hidden").attr("id");
|
|
|
Bll.addInput(name,label);
|
|
|
});
|
|
|
|
|
|
$("#shopsType").change(function(){
|
...
|
...
|
@@ -313,7 +323,21 @@ e.on("bind",function(){ |
|
|
$("#modalId").click(function(){
|
|
|
//common.util.__template($("#template").html(),{})
|
|
|
common.dialog.confirm("添加供应商关系",$("#template").html(),function(){
|
|
|
g2.init(g.selected);
|
|
|
console.log(g.selected);
|
|
|
$.each(g.selected,function(index,item){
|
|
|
//item.supplierId
|
|
|
var i=0;
|
|
|
$.each(g2.__rows,function(index1,item1){
|
|
|
if(item1.supplierId==item.supplierId){
|
|
|
i++;
|
|
|
}
|
|
|
});
|
|
|
if(i==0){
|
|
|
g2.__rows.push(item);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
g2.init(g2.__rows);
|
|
|
});
|
|
|
new common.dropDown({
|
|
|
el: "#brandname",
|
...
|
...
|
@@ -327,7 +351,7 @@ e.on("bind",function(){ |
|
|
});
|
|
|
|
|
|
$("#updateBrand").on("click",".delete",function(){
|
|
|
delete g.selected[$(this).data("index")];
|
|
|
delete g2.__rows[$(this).data("index")];
|
|
|
g2.reload();
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -381,7 +405,8 @@ var submit=function(callback){ |
|
|
res=res.data;
|
|
|
if(res.code=="200"){
|
|
|
e.$tip('提交成功',function(){
|
|
|
location.href="/supplier/store/index";
|
|
|
// location.href="/supplier/store/index";
|
|
|
history.go(-1);
|
|
|
},'growl-success');
|
|
|
}else{
|
|
|
e.$tip(res.message);
|
...
|
...
|
|