marketing.EventConfig.Index.js
4.58 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
webpackJsonp([84],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/**
* Created by zhaojun on 17/3/15.
* 配置管理
*/
var $ = __webpack_require__(1);
common = __webpack_require__(2);
var ENUM = {
StatusEnum: {
0: '失效',
1: '有效'
},
TypeEnum: {
1: '优惠卷',
2: '有货币'
}
};
//下拉框
new common.dropDown({
el: "#sel-status"
});
var g = new common.grid({
el: '#basicTable',
size: 10,
parms: function () {
return {
eventCode: common.util.__input('sel-eventCode'),
status: common.util.__input('sel-status')
};
},
columns: [
{
display: '配置名称',
name: "comments"
},
{
display: '配置编码',
name: "eventCode"
},
{
display: '配置属性',
name: "eventValue"
},
{
display: '业务类型',
render: function (item) {
return "<p>" + ENUM.TypeEnum[item.type] + "</p>";
}
},
{
display: '消息标题',
name: "msgTitle"
},
{
display: '消息内容',
name: "msgContent"
},
{
display: '状态',
render: function (item) {
return "<p>" + ENUM.StatusEnum[item.status] + "</p>";
}
},
{
display: "创建时间",
render: function (item) {
if (item.createTime && item.createTime !== 0) {
var t = new Date(item.createTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm");
return "<p>" + formatted + "</p>";
}
else {
return "";
}
}
},
{
display: '操作',
name: "status",
render: function (items) {
var HtmArr = [];
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs info-modify">编辑</a>');
return HtmArr.join('');
}
}]
});
g.init('/eventConfig/queryList');
//==================== 按钮点击事件 =====================//
$("#filter-btn").click(function () {
g.reload(1);
});
/**
* 监听输入框变化
*/
$(document).on("change", ".observe", function () {
var $this = $(this);
var name = $this.data("field");
Bll.module = common.util.__buildobj(name, '.', Bll.module, function (obj, name1) {
obj[name1] = $this.val();
});
});
/*验证*/
var edit = new common.edit2(".modal-body");
var Bll = {
module: null,
//弹框
toast: function (module, hint, url) {
Bll.module = module;
var d = new common.dialog({
title: hint + "配置管理",
content: common.util.__template2($("#template").html(), Bll.module),
width: '40%',
button: [
{
value: "保存",
callback: function () {
if (edit.validate()) {
common.util.__ajax({
url: url,
data: Bll.module
}, function (res) {
if (res.code == '200') {
g.reload();
d.close();
}
else {
common.util.__tip(res.message, "warning");
}
}, true);
}
return false;
},
css: "btn-primary"
},
{
"value": "取消",
"css": "btn-info"
}
]
});
Bll.__editRender();
},
__editRender: function () {
edit.init();
}
};
/**
* 编辑--点击事件
*/
$(document).on('click', '.info-modify', function () {
var item = g.rows[$(this).data("index")];
common.util.__ajax({
url: "/eventConfig/queryById",
data: {id: item.id}
}, function (res) {
Bll.toast(res.data, "修改", '/eventConfig/update');
}, true);
});
/***/ }
]);