unionShareMessageList.html
6.17 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Yoho!Buy运营平台</title>
<script src="/union/js/include.js"></script>
<script src="/union/js/ajaxfileupload.js"></script>
</head>
<body class="easyui-layout" fit="true">
<div region="north" style="padding-bottom: 35px; height: auto;">
<script>
document.write(addHead('CPS联盟管理', 'CPS消息管理'));
</script>
<div style="margin-left: 15px;margin-top: 10px">
<a id="addBtn" class="easyui-linkbutton btn-primary" style="background-color: #5CB85C;">+创建消息</a>
</div>
<form id="searchForm" method="post" accept-charset="utf-8">
<div style="margin-left: 10px;margin-top: 10px">
<label>查询时间:</label>
<input class="easyui-datetimebox" id="startTime" name="beginTime" style="width:180px;"/>~
<input class="easyui-datetimebox" id="endTime" name="endTime" style="width:180px;"/>
<a id="searchBtn" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">查询</a>
</div>
</form>
</div>
<div region="center">
<div style="margin-left: 30px;margin-top: 20px; height: 500px;">
<table id="messageListTable"></table>
</div>
</div>
<script type="text/javascript">
$("#addBtn").click(function () {
window.location.href = contextPath + "/html/unionshare/unionShareMessageAdd.html";
});
$(function () {
$("#messageListTable").myDatagrid({
fit: true,
fitColumns: true,
nowrap: false,
url: contextPath + "/UnionShareRest/queryUnionShareMessageList",
method: 'POST',
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp=null==temp?[]:temp;
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "ID",
field: "id",
width: 100,
align: "center",
}, {
title: "内容",
field: "content",
width: 200,
align: "center"
}, {
title: "图片",
field: "image",
width: 200,
align: "center",
formatter : function(value, rowData, rowIndex) {
var newData = JSON.stringify(rowData);
var imgstr="<a href='"+rowData.image+"'><img src='"+rowData.image+"' height='78px;' width='59px;' /></a>";
return imgstr;
}
}, {
title: "url",
field: "url",
width: 200,
align: "center"
}, {
title: "优先级",
field: "priority",
width: 200,
align: "center",
}, {
title: "开始时间",
field: "startTimeStr",
width: 200,
align: "center"
}, {
title: "结束时间",
field: "endTimeStr",
width: 200,
align: "center"
},{
title: "操作",
field: "asdf",
width: 200,
align: "center",
formatter: function (value, rowData, rowIndex) {
var str = "<a role='edit' dataId='"+ rowData.id +"' style='width:100px;'>编辑</a> ";
str = str + "<a role='delete' dataId='"+ rowData.id +"' style='width:100px;'>删除</a> ";
return str;
}
}
]],
cache: false,
pagination: true,
pageSize: 10,
idField: "id",
singleSelect: false,
onLoadSuccess: function (data) {
$(this).datagrid("getPanel").find("a[role='edit']").linkbutton({
onClick: function () {
var id = $(this).attr("dataId");
window.location.href = contextPath + "/html/unionshare/unionShareMessageEdit.html?id=" + id;
}
});
$(this).datagrid("getPanel").find("a[role='delete']").linkbutton({
onClick: function () {
var id = $(this).attr("dataId");
$.messager.confirm("确认", "是否确认删除?", function(flag) {
if (flag) {
$.post(contextPath + "/UnionShareRest/deleteMessage", {
id : id
}, function(data) {
if (data.code == 200) {
$("#messageListTable").datagrid("reload");
window.self.$.messager.show({
title : "提示",
msg : "成功删除!"
});
}else {
window.self.$.messager.alert("失败", "删除失败!", "error");
}
});
}
});
}
});
}
});
$("#searchBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
var startTime;
var endTime;
if ($("#startTime").datetimebox('getValue')!='')
{
startTime = parseInt(new Date($("#startTime").datetimebox('getValue')).getTime() / 1000)
}
if ($("#endTime").datetimebox('getValue')!='')
{
endTime = parseInt(new Date($("#endTime").datetimebox('getValue')).getTime() / 1000)
}
$("#messageListTable").datagrid("load", {
startTime: startTime,
endTime: endTime
});
}
});
});
</script>
</body>
</html>