LogIndex.js
5.9 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/**
* 促销管理
*/
'use strict';
var $ = require('jquery'),
common = require('../../../common/common');
require('../../../common/util/datepicker');
var addEdit=require("./partials/Add");
var jsonUtils=require("./partials/jsonUtils");
var LogList;
var g = new common.grid({
el: '#basicTable',
size: 10,
parms: function() {
return {
type:$("#type").val(),
promotionId:common.util.__input('promotionId')
};
},
columns: [{
display: "ID",
name: "id"
}, {
display: "促销id",
name: "promotionId"
}, {
display: '操作人',
render: function(item){
return item.operatorName + "["+ item.operatorId +"]";
}
}, {
display: '编辑时间',
name: "editTime",
render: function(item) {
var date = new Date(item.editTime * 1000);
return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
}
}, {
display: '促销信息',
name: "promotionInfo"
}, {
display: '操作类型',
name: "type",
render: function(item) {
var name;
switch(item.type){
case 1:
name="新增";
break;
case 2: name="修改基本信息";break;
case 3: name="删除";break;
case 4: name="修改互斥";break;
case 5: name="修改限制";break;
case 6: name="修改操作";break;
case 7: name="修改条件";break;
case 8: name="修改显示";break;
case 9: name="修改多档";break;
}
return name;
}
}, {
display: '操作',
name: "",
render: function(items) {
var HtmArr = [];
HtmArr.push("<a href=\"javascript:;\" onclick=\"View.view(" + items.__index + "," + items.type +")\" class=\"btn btn-info btn-xs\">查看</a>");
return HtmArr.join('');
}
}]
})
g.init('/promotionInfo/log/list');
//查询
$("#filter-btn").click(function() {
g.reload(1);
});
var view={
view: function(_index){
if(!g.response || !g.response.list){
return;
}
LogList=g.response.list;
if(!LogList || LogList.length===0 || _index>LogList.length || _index<0){
return;
}
var column_data = LogList[_index];
var type=column_data.type;
if(!type){
return;
}
/**
* <option value="1">新增</option>
<option value="2">修改基本信息</option>
<option value="3">删除</option>
<option value="4">修改互斥</option>
<option value="5">修改限制</option>
<option value="6">修改操作</option>
<option value="7">修改条件</option>
<option value="8">修改显示</option>
*/
var tempId, loadData=$.extend(true,{},column_data.promotionInfoBo);
var content;
var appendHtml="";
switch(type){
case 1:
case 2:
tempId="fm_baseInfo";
break;
case 4:
tempId="fm_reject";
if(typeof column_data.promotionInfoBo.promotionParams.rejectParam == 'string'){
var rejectParam= JSON.parse(column_data.promotionInfoBo.promotionParams.rejectParam);
loadData.promotionParams.rejectParam = rejectParam;
}
break;
case 5:
tempId="fm_limit";
break;
case 6:
tempId="fm_operation";
if(typeof column_data.promotionInfoBo.promotionParams.actionParam == 'string'){
var actionParam=JSON.parse(column_data.promotionInfoBo.promotionParams.actionParam);
loadData.promotionParams.actionParam = actionParam;
}
break;
case 7:
tempId="fm_condition";
var conditionParam=JSON.parse(column_data.promotionInfoBo.promotionParams.conditionParam);
loadData.promotionParams.conditionParam = conditionParam;
break;
case 8:
tempId="fm_display";
if(loadData.commonBanner){
var commonBanner_span = $("<span>促销页图片<br/></span>");
var commonBanner_image= $("<image />");
commonBanner_image.attr("src",loadData.commonBanner);
commonBanner_span.append(commonBanner_image);
appendHtml += commonBanner_span.prop("outerHTML");
appendHtml += "<br/>";
}
if(loadData.shoppingCartBanner){
var shoppingCartBanner_span = $("<span>促销页图片<br/></span>");
var shoppingCartBanner_image= $("<image />");
shoppingCartBanner_image.attr("src",loadData.shoppingCartBanner);
shoppingCartBanner_span.append(shoppingCartBanner_image);
appendHtml += shoppingCartBanner_span.prop("outerHTML");
}
break;
case 9:
tempId="fm_multi";
if(typeof column_data.promotionInfoBo.promotionParams.multiParam == 'string'){
var multiParam= JSON.parse(column_data.promotionInfoBo.promotionParams.multiParam);
loadData.promotionParams.multiParam = multiParam;
}
break;
}
var formatData = jsonUtils.formatJson(loadData);
content ="<p>"+formatData+"</p>";
if(appendHtml != ""){
content+=appendHtml;
}
common.dialog.open({
title: '促销操作数据回放',
width: 900,
content: content,
backdrop: true
});
}
}
document.View=view;