|
@@ -7,92 +7,114 @@ var $ = require('jquery'), |
|
@@ -7,92 +7,114 @@ 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
|
- });
|
|
|
17
|
-
|
|
|
18
|
- //日期插件
|
|
|
19
|
- $('.hasDatepicker').fdatepicker({
|
|
|
20
|
- format: 'yyyy-mm-dd'
|
|
|
21
|
- });
|
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
|
+});
|
22
|
|
21
|
|
23
|
- var btnAuthority=JSON.parse($("#btnAuthority").val());
|
|
|
24
|
-
|
22
|
+//日期插件
|
|
|
23
|
+$('.hasDatepicker').fdatepicker({
|
|
|
24
|
+ format: 'yyyy-mm-dd'
|
|
|
25
|
+});
|
25
|
|
26
|
|
26
|
- var g = new common.grid({
|
|
|
27
|
- el: '#basicTable',
|
|
|
28
|
- size: 10,
|
|
|
29
|
- parms: function() {
|
27
|
+var btnAuthority = JSON.parse($("#btnAuthority").val());
|
30
|
|
28
|
|
31
|
- 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()) || ''
|
|
|
37
|
- };
|
|
|
38
|
- },
|
|
|
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) {
|
|
|
48
|
- 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) {
|
|
|
53
|
- var HtmArr = [];
|
|
|
54
|
|
29
|
|
55
|
- if (btnAuthority.edit) {
|
|
|
56
|
- HtmArr.push('<a href="/erpproduct/brands/edit/'+ items.id+'"" class="btn btn-info btn-xs">编辑</a>');
|
|
|
57
|
- }
|
|
|
58
|
- if (items.status === 0) {
|
|
|
59
|
- HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-warning btn-xs open-brand">开启品牌</a>');
|
|
|
60
|
- }
|
|
|
61
|
- if (items.status === 1) {
|
|
|
62
|
- HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs close-brand">关闭品牌</a>');
|
|
|
63
|
- }
|
|
|
64
|
- return HtmArr.join('');
|
|
|
65
|
- }}
|
|
|
66
|
- ]
|
|
|
67
|
- })
|
|
|
68
|
-
|
|
|
69
|
- g.init($("#gridurl").val());
|
30
|
+var g = new common.grid({
|
|
|
31
|
+ el: '#basicTable',
|
|
|
32
|
+ size: 10,
|
|
|
33
|
+ parms: function() {
|
70
|
|
34
|
|
71
|
- $("#filter-btn").click(function(){
|
|
|
72
|
- g.reload(1);
|
|
|
73
|
- });
|
35
|
+ return {
|
|
|
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()) || ''
|
|
|
41
|
+ };
|
|
|
42
|
+ },
|
|
|
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) {
|
|
|
65
|
+ var date = new Date(item.createTime * 1000);
|
|
|
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) {
|
|
|
72
|
+ var HtmArr = [];
|
74
|
|
73
|
|
75
|
-
|
|
|
76
|
- //关闭品牌操作
|
|
|
77
|
- $('tbody').on('click', '.close-brand', function() {
|
|
|
78
|
- var item=g.rows[$(this).data("index")];
|
|
|
79
|
- common.util.__ajax({
|
|
|
80
|
- url:'/brand/edit',
|
|
|
81
|
- data:{id:item.id,status:0}
|
|
|
82
|
- },function(){
|
|
|
83
|
- g.reload();
|
|
|
84
|
- });
|
|
|
85
|
- });
|
|
|
86
|
- //开启品牌操作
|
|
|
87
|
- $('tbody').on('click', '.open-brand', function() {
|
|
|
88
|
- var item=g.rows[$(this).data("index")];
|
|
|
89
|
- common.util.__ajax({
|
|
|
90
|
- url:'/brand/edit',
|
|
|
91
|
- data:{id:item.id,status:1}
|
|
|
92
|
- },function(){
|
|
|
93
|
- g.reload();
|
|
|
94
|
- });
|
|
|
95
|
- });
|
74
|
+ if (btnAuthority.edit) {
|
|
|
75
|
+ HtmArr.push('<a href="/erpproduct/brands/edit/' + items.id + '"" class="btn btn-info btn-xs">编辑</a>');
|
|
|
76
|
+ }
|
|
|
77
|
+ if (items.status === 0) {
|
|
|
78
|
+ HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-warning btn-xs open-brand">开启品牌</a>');
|
|
|
79
|
+ }
|
|
|
80
|
+ if (items.status === 1) {
|
|
|
81
|
+ HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs close-brand">关闭品牌</a>');
|
|
|
82
|
+ }
|
|
|
83
|
+ return HtmArr.join('');
|
|
|
84
|
+ }
|
|
|
85
|
+ }]
|
|
|
86
|
+})
|
96
|
|
87
|
|
|
|
88
|
+g.init($("#gridurl").val());
|
97
|
|
89
|
|
98
|
- |
90
|
+$("#filter-btn").click(function() {
|
|
|
91
|
+ g.reload(1);
|
|
|
92
|
+});
|
|
|
93
|
+
|
|
|
94
|
+
|
|
|
95
|
+//关闭品牌操作
|
|
|
96
|
+$('tbody').on('click', '.close-brand', function() {
|
|
|
97
|
+ var item = g.rows[$(this).data("index")];
|
|
|
98
|
+ common.util.__ajax({
|
|
|
99
|
+ url: '/brand/edit',
|
|
|
100
|
+ data: {
|
|
|
101
|
+ id: item.id,
|
|
|
102
|
+ status: 0
|
|
|
103
|
+ }
|
|
|
104
|
+ }, function(res) {
|
|
|
105
|
+ g.reload();
|
|
|
106
|
+ });
|
|
|
107
|
+});
|
|
|
108
|
+//开启品牌操作
|
|
|
109
|
+$('tbody').on('click', '.open-brand', function() {
|
|
|
110
|
+ var item = g.rows[$(this).data("index")];
|
|
|
111
|
+ common.util.__ajax({
|
|
|
112
|
+ url: '/brand/edit',
|
|
|
113
|
+ data: {
|
|
|
114
|
+ id: item.id,
|
|
|
115
|
+ status: 1
|
|
|
116
|
+ }
|
|
|
117
|
+ }, function() {
|
|
|
118
|
+ g.reload();
|
|
|
119
|
+ });
|
|
|
120
|
+}); |