size-property.js
2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/**
* Created by wangqianjun on 16/2/3.
*/
'use strict';
var $ = require('jquery'),
Handlebars = require('yoho.handlebars');
var dropDown=require('../common/dropDown');
require('../util/jquery.gritter');
var grid=require('../common/grid');
exports.init=function(){
function __ajax(options,callback){
$.ajax({
type: 'POST',
url: options.url,
dataType: 'json',
data:options.data||{},
success: function(res) {
res=res.data;
$("#input").val("");
$("#modal-id").modal('hide'); //影藏弹框
if (res.code === 200) {
$.gritter.add({
title: options.msg||"提交成功",
class_name: 'growl-success',
sticky: false,
time: '1000',
after_open: function() {
callback&&callback();
}
});
} else {
$.gritter.add({
title: '提交失败',
class_name: 'growl-danger',
sticky: false,
time: '1000'
});
}
}
});
}
var g=new grid({
el:'#size-property',
// 传递给后台的参数
parms:function(){
//var supplierid=!!~$.trim($('#supplier-name').val())?$('#supplier-name').val():"0",
// brandId = !!~$.trim($('#brand-name').val())?$('#brand-name').val():"0";
return {
};
},
columns:[
{display:"编号",name:"id"},
{display:"属性名",name:"attributeName"},
//{display:"包含品牌",name:"",render:function(item){
// var str='';
// $.each(item.shopRelationList,function (index,a) {
// str+='<p>'+a.brandName+'</p>';
// })
// return str;
//}},
{display:"操作",name:"", render:function(item){
return '<a class="btn btn-info add2" id="'+item.id+'" data-toggle="modal" href="#modal-id">编辑</a>'
}}
]
});
console.log($('#url').val());
g.init($('#url').val());
// 添加&编辑 尺码属性
$('#size-property').on('click','.add2',function(){
var id = $(this).attr('id');
var options = {};
if()
//__ajax({
// url: "/erpproduct/sizeattribute/propertyAdd",
// data:{
// attributeName: $('#input').val()
// }
//},function(){
// g.reload();
//});
});
}