size-property.js
2 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
/**
* Created by wangqianjun on 16/2/3.
*/
'use strict';
var $ = require('jquery'),
common = require('../common/common');
var g = new common.grid({
el: '#size-property',
columns: [
{display: "编号", name: "id"},
{display: "属性名", name: "attributeName"},
{
display: "操作", name: "", render: function (item) {
return '<a class="btn btn-info add2" data-index="' + item.__index + '">编辑</a>';
}
}
]
});
g.init($('#url').val());
$('#size-property').on('click', '.add2', function () {
var item = g.rows[$(this).data("index")];
common.dialog.confirm("修改尺码属性",
common.util.__template($("#template").html(), {id: item.id, input: item.attributeName})
, function () {
common.util.__ajax({
url: '/erpproduct/sizeattribute/propertyModify',
data: (function () {
var input = $('#input').val();
if (input === '' || $.trim(input) === '') return "尺码名不能为空";
return {
id: item.id,
attributeName: $("#input").val()
};
})()
}, function () {
g.reload();
});
});
});
// 添加&编辑 尺码属性
$('#add').on('click', function () {
common.dialog.confirm("添加尺码属性",
common.util.__template($("#template").html(), {id: "", input: ""})
, function () {
common.util.__ajax({
url: '/erpproduct/sizeattribute/propertyAdd',
data: (function () {
var input = $('#input').val();
if (input === '' || $.trim(input) === '') return "尺码名不能为空";
return {
attributeName: input
};
})()
}, function () {
g.reload();
});
});
});