|
@@ -7,53 +7,72 @@ var $ = require('jquery'), |
|
@@ -7,53 +7,72 @@ var $ = require('jquery'), |
7
|
require('../util/datepicker');
|
7
|
require('../util/datepicker');
|
8
|
|
8
|
|
9
|
|
9
|
|
10
|
- //下拉框
|
|
|
11
|
- new common.dropDown({el: "#status"});
|
|
|
12
|
- new common.dropDown({el: "#brand-level"});
|
|
|
13
|
- new common.dropDown({
|
|
|
14
|
- el:'#brand-id',
|
|
|
15
|
- ajax:'brand'
|
|
|
16
|
- });
|
10
|
+//下拉框
|
|
|
11
|
+new common.dropDown({
|
|
|
12
|
+ el: "#status"
|
|
|
13
|
+});
|
|
|
14
|
+new common.dropDown({
|
|
|
15
|
+ el: "#brand-level"
|
|
|
16
|
+});
|
|
|
17
|
+new common.dropDown({
|
|
|
18
|
+ el: '#brand-id',
|
|
|
19
|
+ ajax: 'brand'
|
|
|
20
|
+});
|
17
|
|
21
|
|
18
|
- //日期插件
|
|
|
19
|
- $('.hasDatepicker').fdatepicker({
|
22
|
+//日期插件
|
|
|
23
|
+$('.hasDatepicker').fdatepicker({
|
20
|
format: 'yyyy-mm-dd'
|
24
|
format: 'yyyy-mm-dd'
|
21
|
- });
|
25
|
+});
|
22
|
|
26
|
|
23
|
- var btnAuthority=JSON.parse($("#btnAuthority").val());
|
27
|
+var btnAuthority = JSON.parse($("#btnAuthority").val());
|
24
|
|
28
|
|
25
|
|
29
|
|
26
|
- var g = new common.grid({
|
30
|
+var g = new common.grid({
|
27
|
el: '#basicTable',
|
31
|
el: '#basicTable',
|
28
|
size: 10,
|
32
|
size: 10,
|
29
|
parms: function() {
|
33
|
parms: function() {
|
30
|
|
34
|
|
31
|
return {
|
35
|
return {
|
32
|
- brandId:common.util.__input('brand-id'),// $.trim($('#brand-id').val()) || '',
|
|
|
33
|
- status: common.util.__input('status'),//$.trim($('#status').val()) || '',
|
|
|
34
|
- brandLevel: common.util.__input('brand-level'),//$.trim($('#brand-level').val()) || '',
|
|
|
35
|
- startTime: common.util.__input('starttime'),//$.trim($('#starttime').val()) || '',
|
|
|
36
|
- endTime: common.util.__input('endtime')//$.trim($('#endtime').val()) || ''
|
36
|
+ brandId: common.util.__input('brand-id'), // $.trim($('#brand-id').val()) || '',
|
|
|
37
|
+ status: common.util.__input('status'), //$.trim($('#status').val()) || '',
|
|
|
38
|
+ brandLevel: common.util.__input('brand-level'), //$.trim($('#brand-level').val()) || '',
|
|
|
39
|
+ startTime: common.util.__input('starttime'), //$.trim($('#starttime').val()) || '',
|
|
|
40
|
+ endTime: common.util.__input('endtime') //$.trim($('#endtime').val()) || ''
|
37
|
};
|
41
|
};
|
38
|
},
|
42
|
},
|
39
|
- columns: [
|
|
|
40
|
- {display: "LOGO", name: "brandIco",render:function(item){
|
|
|
41
|
- return '<img src="'+item.brandIco+'" width="100" height="60"/>'
|
|
|
42
|
- }},
|
|
|
43
|
- {display: '品牌名称', name: "brandName"},
|
|
|
44
|
- {display: '英文名称', name: "brandNameEn"},
|
|
|
45
|
- {display: '品牌级别', name: "brandLevel"},
|
|
|
46
|
- {display: '调性分', name: "brandTonality"},
|
|
|
47
|
- {display: '创建时间', name: "createTime", render: function(item) {
|
43
|
+ columns: [{
|
|
|
44
|
+ display: "LOGO",
|
|
|
45
|
+ name: "brandIco",
|
|
|
46
|
+ render: function(item) {
|
|
|
47
|
+ return '<img src="' + item.brandIco + '" width="100" height="60"/>'
|
|
|
48
|
+ }
|
|
|
49
|
+ }, {
|
|
|
50
|
+ display: '品牌名称',
|
|
|
51
|
+ name: "brandName"
|
|
|
52
|
+ }, {
|
|
|
53
|
+ display: '英文名称',
|
|
|
54
|
+ name: "brandNameEn"
|
|
|
55
|
+ }, {
|
|
|
56
|
+ display: '品牌级别',
|
|
|
57
|
+ name: "brandLevel"
|
|
|
58
|
+ }, {
|
|
|
59
|
+ display: '调性分',
|
|
|
60
|
+ name: "brandTonality"
|
|
|
61
|
+ }, {
|
|
|
62
|
+ display: '创建时间',
|
|
|
63
|
+ name: "createTime",
|
|
|
64
|
+ render: function(item) {
|
48
|
var date = new Date(item.createTime * 1000);
|
65
|
var date = new Date(item.createTime * 1000);
|
49
|
- return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' '
|
|
|
50
|
- + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
|
|
|
51
|
- }},
|
|
|
52
|
- {display: '操作', name:"status", render: function(items) {
|
66
|
+ return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
|
|
|
67
|
+ }
|
|
|
68
|
+ }, {
|
|
|
69
|
+ display: '操作',
|
|
|
70
|
+ name: "status",
|
|
|
71
|
+ render: function(items) {
|
53
|
var HtmArr = [];
|
72
|
var HtmArr = [];
|
54
|
|
73
|
|
55
|
if (btnAuthority.edit) {
|
74
|
if (btnAuthority.edit) {
|
56
|
- HtmArr.push('<a href="/erpproduct/brands/edit/'+ items.id+'"" class="btn btn-info btn-xs">编辑</a>');
|
75
|
+ HtmArr.push('<a href="/erpproduct/brands/edit/' + items.id + '"" class="btn btn-info btn-xs">编辑</a>');
|
57
|
}
|
76
|
}
|
58
|
if (items.status === 0) {
|
77
|
if (items.status === 0) {
|
59
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-warning btn-xs open-brand">开启品牌</a>');
|
78
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-warning btn-xs open-brand">开启品牌</a>');
|
|
@@ -62,37 +81,40 @@ require('../util/datepicker'); |
|
@@ -62,37 +81,40 @@ require('../util/datepicker'); |
62
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs close-brand">关闭品牌</a>');
|
81
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs close-brand">关闭品牌</a>');
|
63
|
}
|
82
|
}
|
64
|
return HtmArr.join('');
|
83
|
return HtmArr.join('');
|
65
|
- }}
|
|
|
66
|
- ]
|
|
|
67
|
- })
|
84
|
+ }
|
|
|
85
|
+ }]
|
|
|
86
|
+})
|
68
|
|
87
|
|
69
|
- g.init($("#gridurl").val());
|
88
|
+g.init($("#gridurl").val());
|
70
|
|
89
|
|
71
|
- $("#filter-btn").click(function(){
|
90
|
+$("#filter-btn").click(function() {
|
72
|
g.reload(1);
|
91
|
g.reload(1);
|
73
|
- });
|
92
|
+});
|
74
|
|
93
|
|
75
|
|
94
|
|
76
|
- //关闭品牌操作
|
|
|
77
|
- $('tbody').on('click', '.close-brand', function() {
|
|
|
78
|
- var item=g.rows[$(this).data("index")];
|
95
|
+//关闭品牌操作
|
|
|
96
|
+$('tbody').on('click', '.close-brand', function() {
|
|
|
97
|
+ var item = g.rows[$(this).data("index")];
|
79
|
common.util.__ajax({
|
98
|
common.util.__ajax({
|
80
|
- url:'/brand/edit',
|
|
|
81
|
- data:{id:item.id,status:0}
|
|
|
82
|
- },function(){
|
99
|
+ url: '/brand/edit',
|
|
|
100
|
+ data: {
|
|
|
101
|
+ id: item.id,
|
|
|
102
|
+ status: 0
|
|
|
103
|
+ }
|
|
|
104
|
+ }, function(res) {
|
83
|
g.reload();
|
105
|
g.reload();
|
84
|
});
|
106
|
});
|
85
|
- });
|
|
|
86
|
- //开启品牌操作
|
|
|
87
|
- $('tbody').on('click', '.open-brand', function() {
|
|
|
88
|
- var item=g.rows[$(this).data("index")];
|
107
|
+});
|
|
|
108
|
+//开启品牌操作
|
|
|
109
|
+$('tbody').on('click', '.open-brand', function() {
|
|
|
110
|
+ var item = g.rows[$(this).data("index")];
|
89
|
common.util.__ajax({
|
111
|
common.util.__ajax({
|
90
|
- url:'/brand/edit',
|
|
|
91
|
- data:{id:item.id,status:1}
|
|
|
92
|
- },function(){
|
112
|
+ url: '/brand/edit',
|
|
|
113
|
+ data: {
|
|
|
114
|
+ id: item.id,
|
|
|
115
|
+ status: 1
|
|
|
116
|
+ }
|
|
|
117
|
+ }, function() {
|
93
|
g.reload();
|
118
|
g.reload();
|
94
|
});
|
119
|
});
|
95
|
- });
|
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
- |
120
|
+}); |