adList.jsp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <%@ page language="java" contentType="text/html;charset=GBK" pageEncoding="GBK"%>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html;charset=GBK">
  6. <title>广告发布列表</title>
  7. <link href="${pageContext.request.contextPath}/main.css" rel="stylesheet" type="text/css" />
  8. <link href="${pageContext.request.contextPath }/liger/lib/ligerUI/skins/${sessionScope.css}/css/ligerui-all.css" rel="stylesheet" type="text/css" />
  9. <script src="${pageContext.request.contextPath }/liger/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
  10. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
  11. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
  12. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
  13. <script type="text/javascript" src="/shares/js/constant.js"></script>
  14. <script type="text/javascript" src="/shares/js/common.js"></script>
  15. <script type="text/javascript" src="/shares/js/file.js"></script>
  16. <script type="text/javascript" src="/shares/datePicker/WdatePicker.js"></script>
  17. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>
  18. <script type="text/javascript">
  19. var grid = null;
  20. var isNeedCheck = '${isNeedCheck}';
  21. $(function() {
  22. searchByKword();
  23. });
  24. function initTargetGrid(params) {
  25. var columns = [
  26. {
  27. display : '广告图片',
  28. name : 'photo_doc_id',
  29. width : 210,
  30. render : function(row) {
  31. var html = '';
  32. if(null==row.path){
  33. html += '<img src="'+row.path+'" width="200px;" height="150px;" alt="图片不存在"></img>';
  34. return html;
  35. }else{
  36. html += '<img src="'+row.path+'" width="200px;" height="150px;" onclick="view_img('+row.photo_doc_id+');"></img>';
  37. return html;
  38. }
  39. }
  40. }, {
  41. display : '广告投放位置',
  42. name : 'position_name',
  43. width : 100,
  44. render : function(row) {
  45. var html = '';
  46. html += '<span style="text-align:center;line-height:150px;">'+row.position_name+'</span>';
  47. return html;
  48. }
  49. }, {
  50. display : '发布范围',
  51. name : 'scope_name',
  52. width : 100,
  53. render : function(row) {
  54. var html = '';
  55. html += '<span style="text-align:center;line-height:150px;">'+row.scope_name+'</span>';
  56. return html;
  57. }
  58. },{
  59. display : '开始日期',
  60. name : 'start_date',
  61. width : 100,
  62. render : function(row) {
  63. var start_date = row.start_date;
  64. if(null!=start_date){
  65. start_date = start_date.substring(0,10);
  66. }else{
  67. start_date="";
  68. }
  69. var html = '';
  70. html += '<span style="text-align:center;line-height:150px;">'+start_date+'</span>';
  71. return html;
  72. }
  73. },{
  74. display : '截止日期',
  75. name : 'end_date',
  76. width : 100,
  77. render : function(row) {
  78. var end_date = row.end_date;
  79. if(null!=end_date){
  80. end_date = end_date.substring(0,10);
  81. }else{
  82. end_date="";
  83. }
  84. var html = '';
  85. html += '<span style="text-align:center;line-height:150px;">'+end_date+'</span>';
  86. return html;
  87. }
  88. },{
  89. display : '发布人',
  90. name : 'create_user_name',
  91. width : 80,
  92. render : function(row) {
  93. var html = '';
  94. html += '<span style="text-align:center;line-height:150px;">'+row.create_user_name+'</span>';
  95. return html;
  96. }
  97. },{
  98. display : '发布时间',
  99. name : 'create_time',
  100. width : 150,
  101. render : function(row) {
  102. var create_time = row.create_time;
  103. /* create_time = create_time.substring(0,10); */
  104. var html = '';
  105. html += '<span style="text-align:center;line-height:150px;">'+create_time+'</span>';
  106. return html;
  107. }
  108. },{
  109. display : '广告状态',
  110. name : 'state_name',
  111. width : 80,
  112. render : function(row) {
  113. var html = '';
  114. html += '<span style="text-align:center;line-height:150px;">'+row.state_name+'</span>';
  115. return html;
  116. }
  117. }
  118. ];
  119. if('true'==isNeedCheck){
  120. columns.push({
  121. display : '审核状态',
  122. name : 'au_state_name',
  123. width : 80,
  124. render : function(row) {
  125. var au_note = row.au_note ;
  126. var au_user_name = row.au_user_name;
  127. var au_time = row.au_time;
  128. if(null==au_user_name){
  129. au_user_name = "";
  130. }
  131. if(null==au_time){
  132. au_time = "";
  133. }
  134. if(null==au_note){
  135. au_note = "";
  136. }
  137. var html = '';
  138. if("0"==row.au_state){
  139. html += ''+'<span style="text-align:center;line-height:150px;">'+row.au_state_name+'</span>';
  140. }else{
  141. html += '<a style="color:blue;line-height:150px;" title="'
  142. +'审核人:'+au_user_name+'&#10;'
  143. +'审核时间:'+au_time+'&#10;'
  144. +'审核意见:'+au_note
  145. +'">'+row.au_state_name+'</a>';
  146. }
  147. return html;
  148. }
  149. });
  150. }
  151. columns
  152. .push({
  153. display : '操作',
  154. width : 130,
  155. isAllowHide : false,
  156. render : function(row) {
  157. var html = '';
  158. if('2'==row.state&&'1'==row.au_state){
  159. html += '<a style="line-height:150px;" href=\"#\" onclick=\"publishAd('+ row.universalid + ')\"><font color=blue>发布</font></a>&nbsp;';
  160. html += '<a style="line-height:150px;" href=\"#\" onclick=\"editAd('+ row.universalid + ')\"><font color=blue>编辑</font></a>&nbsp;';
  161. html += '<a style="line-height:150px;" href=\"#\" onclick=\"delAd('+ row.universalid + ')\"><font color=blue>删除</font></a>&nbsp;';
  162. }else if('0'==row.state&&('0'==row.au_state||'2'==row.au_state)){
  163. html += '<a style="line-height:150px;" href=\"#\" onclick=\"editAd('+ row.universalid + ')\"><font color=blue>编辑</font></a>&nbsp;';
  164. html += '<a style="line-height:150px;" href=\"#\" onclick=\"delAd('+ row.universalid + ')\"><font color=blue>删除</font></a>&nbsp;';
  165. }else if('1'==row.state&&'1'==row.au_state){
  166. html += '<a style="line-height:150px;" href=\"#\" onclick=\"backAd('+ row.universalid + ')\"><font color=blue>撤销</font></a>&nbsp;';
  167. }
  168. return html;
  169. }
  170. });
  171. grid = $("#maingrid4")
  172. .ligerGrid(
  173. {
  174. columns : columns,
  175. pageSize : getPageSize(grid),
  176. url : 'opAdAction.do?task=adPageList&time=' + new Date().getTime() + params,
  177. pageParmName : 'p', //页索引参数名,(提交给服务器)
  178. pagesizeParmName : 'pSize', //页记录数参数名,(提交给服务器)
  179. width : '99.9%',
  180. height : '99%',
  181. rowHeight : 150
  182. });
  183. $("#pageloading").hide();
  184. $(".l-grid-hd-cell-btn-checkbox").css("display", "none"); //隱藏checkAll
  185. }
  186. function getPageSize(grid){
  187. if(grid){
  188. return grid.get("pageSize");
  189. }else{
  190. return 20;
  191. }
  192. }
  193. //查询
  194. function searchByKword() {
  195. var s = "";
  196. var position_id = $("#position_id").val(); //广告投放位置
  197. if (position_id != "" && typeof (position_id) != "undefined") {
  198. s += "&position_id=" + encodeURI(encodeURI(position_id));
  199. }
  200. var state = $("#state").val();//广告状态
  201. if (state != "" && typeof (state != "undefined")) {
  202. s += "&state=" + encodeURI(encodeURI(state));
  203. }
  204. var create_time_start = $("#create_time_start").val();//发布日期开始
  205. if (create_time_start != "" && typeof (create_time_start) != "undefined") {
  206. s += "&create_time_start=" + create_time_start ;
  207. }
  208. var create_time_end = $("#create_time_end").val();//发布日期结束
  209. if (create_time_end != "" && typeof (create_time_end) != "undefined") {
  210. s += "&create_time_end=" + create_time_end;
  211. }
  212. if(null!=grid){
  213. grid.set("newPage","1");
  214. }
  215. initTargetGrid(s);
  216. }
  217. function view_img(fileId){
  218. viewFile(fileId, null)
  219. }
  220. function f_select() {
  221. var rows = grid.getCheckedRows();
  222. return rows;
  223. }
  224. /**
  225. * 发布广告
  226. */
  227. function publishAd(universalid){
  228. $.ligerDialog.confirm('确定要发布广告吗?', function (yes)
  229. {
  230. if(yes){
  231. $.ajax({
  232. type:"POST",
  233. url:"opAdAction.do?task=publishAd",
  234. data : {"universalid":universalid},
  235. timeout:10000,
  236. cache:false,
  237. dataType:"json",
  238. success:function(data){
  239. var success = data.success;
  240. if(success){
  241. $.ligerDialog.success(success);
  242. searchByKword();
  243. }else{
  244. showAjaxError(null, data.error);
  245. }
  246. },
  247. error:showAjaxError
  248. });
  249. }
  250. });
  251. }
  252. /**
  253. * 撤销广告
  254. */
  255. function backAd(universalid){
  256. $.ligerDialog.confirm('确定要撤销广告吗?', function (yes)
  257. {
  258. if(yes){
  259. $.ajax({
  260. type:"POST",
  261. url:"opAdAction.do?task=backAd",
  262. data : {"universalid":universalid},
  263. timeout:10000,
  264. cache:false,
  265. dataType:"json",
  266. success:function(data){
  267. var success = data.success;
  268. if(success){
  269. $.ligerDialog.success(success);
  270. searchByKword();
  271. }else{
  272. showAjaxError(null, data.error);
  273. }
  274. },
  275. error:showAjaxError
  276. });
  277. }
  278. });
  279. }
  280. /**
  281. * 删除广告
  282. */
  283. function delAd(universalid){
  284. $.ligerDialog.confirm('确定要删除广告吗?', function (yes)
  285. {
  286. if(yes){
  287. $.ajax({
  288. type:"POST",
  289. url:"opAdAction.do?task=delAd",
  290. data : {"universalid":universalid},
  291. timeout:10000,
  292. cache:false,
  293. dataType:"json",
  294. success:function(data){
  295. var success = data.success;
  296. if(success){
  297. $.ligerDialog.success(success);
  298. searchByKword();
  299. }else{
  300. showAjaxError(null, data.error);
  301. }
  302. },
  303. error:showAjaxError
  304. });
  305. }
  306. });
  307. }
  308. /**
  309. * 编辑广告信息
  310. */
  311. function editAd(universalid){
  312. addTab('editAd' + getCurrentTabId(), '编辑广告', '${pageContext.request.contextPath }/opAdAction.do?task=toEditAd&universalid='
  313. + universalid + '&tabid=' + getCurrentTabId(),true,true);
  314. }
  315. /**
  316. * 查看广告信息
  317. */
  318. function viewAd(universalid){
  319. addTab('viewAd' + getCurrentTabId(), '查看广告', '${pageContext.request.contextPath }/opAdAction.do?task=viewAd&universalid='
  320. + universalid + '&tabid=' + getCurrentTabId(),true,true);
  321. }
  322. </script>
  323. </head>
  324. <body>
  325. <%@ include file="/include/message.jsp"%>
  326. <div class="container-layout">
  327. <div id="title" class="form-button">
  328. <input type="button" class="l-button" value="新增广告" onclick="addTab('toAddAd'+getCurrentTabId(), '新增广告', '${pageContext.request.contextPath }/opAdAction.do?task=toAddAd&tabid=' + getCurrentTabId(),true,true);" style="width: 90px"/>
  329. </div>
  330. <div class="default_search" >
  331. <ul class="list_search" >
  332. <li class="title" style="width:100px;">广告投放位置:</li>
  333. <li class="text">
  334. <select id="position_id" name="position_id">
  335. <option value="">--请选择--</option>
  336. <c:forEach items="${positionList }" var="pos">
  337. <option value="${pos.universalid }">${pos.position_name }</option>
  338. </c:forEach>
  339. </select>
  340. </li>
  341. </ul>
  342. <ul class="list_search" >
  343. <li class="title">广告状态:</li>
  344. <li class="text">
  345. <select id="state" name="state">
  346. <option value="">--请选择--</option>
  347. <c:forEach items="${adStateList }" var="state">
  348. <option value="${state.dvalue }">${state.dname }</option>
  349. </c:forEach>
  350. </select>
  351. </li>
  352. </ul>
  353. <ul class="list_search" >
  354. <li class="title"> 发布日期:</li>
  355. <li class="text" >
  356. <input type="text" class="Wdate" name="create_time_start" id="create_time_start" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'create_time_end\',{d:-1})}'})">
  357. <input type="text" class="Wdate" name="create_time_end" id="create_time_end" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'create_time_start\',{d:1})}'})">
  358. </li>
  359. </ul>
  360. <ul >
  361. <li class="search-button">
  362. <input type="button" class='l-button'
  363. name="search" onclick="searchByKword()" value="查询" /></li>
  364. </ul>
  365. </div>
  366. <div style="clear:both;"></div>
  367. <div id="searchbar">
  368. <div style="overflow: hidden; clear: both;">
  369. <div id="maingrid4" style="margin: 0; padding: 0"></div>
  370. </div>
  371. </div>
  372. </div>
  373. </body>
  374. </html>