email.html 18.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 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">

<head th:replace="../templates/common/head::head"></head>
<style type="text/css">
    .fixed-table-toolbar .bs-bars, .fixed-table-toolbar .columns, .fixed-table-toolbar .search{margin-top: 0px;}
    .table{margin-bottom:0;}
    
    
 .switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {display:none;}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: red;
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: #2196F3;
}

input:focus + .slider {
  box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}

/* Rounded sliders */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

</style>
<body class="skin-blue sidebar-mini">

<div class="wrapper">

    <div th:replace="../templates/common/frame::frame"></div>

    <div class="content-wrapper" style="min-height: 788px;">
        <section class="content-header">
            <h1>
               邮件消息管理
            </h1>
            <ol class="breadcrumb">
                <li>首页</li>
                <li>系统管理</li>
                <li class="active">邮件消息管理</li>
            </ol>
        </section>
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
						<div class="box box-info">
							<div class="box-body">
								<div class="btn-group margin-bottom " style="padding: 0; width: 98%; float: right;">
									<div class="columns columns-right btn-group "> 
                                        <button class="btn btn-success" onclick="javascript:add()" type="button" name="refresh" title="添加" id="email_addS">添加</button>
                                	</div>
									<div class="col-md-6 pull-right" style="padding: 0; width: 5%;">
										<button class="btn btn-default" type="button" name="refresh"
											title="搜索" id="emailQuery">搜索</button>
									</div>
									<div class="col-md-6 pull-right" style="padding: 0; width: 20%;">
										<label for="mobile" class="control-label cb-toolbar"
											style="font-size: 15px; top: 8px; font-weight: 100;">邮件地址:</label>
										<div class="col-sm-7" style="padding: 0;">
											<input class="form-control" type="text" th:value="${param.email}" id="email_query">
										</div>
									</div>
									<div class="col-md-5 pull-right" style="padding: 0; width: 15%;">
										<label for="sp_id" class="control-label cb-toolbar"
											style="font-size: 15px; top: 8px; font-weight: 100;">邮件人:</label>
										<div class="col-sm-7" style="padding: 0;">
											<input class="form-control" type="text" th:value="${param.remark}" id="remark_query">
										</div>
									</div>
								</div>
								


								<div class="fixed-table-container" style="padding-bottom: 0px;">
									<div class="fixed-table-body">
										<table data-toggle="table" data-pagination="true" data-search="false" data-show-refresh="true"
											data-show-toggle="true" data-show-columns="true" data-toolbar="#toolbar" class="table table-hover">
											<thead>
												<tr>
													<th style="text-align: center; width: 5%;" data-field="sp_id" tabindex="0">
														<div class="th-inner ">ID</div>
														<div class="fht-cell"></div>
													</th>
													<th style="text-align: center; width: 12%;" data-field="sp_id_brief" tabindex="0">
														<div class="th-inner ">邮件地址</div>
														<div class="fht-cell"></div>
													</th>
													<th style="text-align: center; width: 8%;" data-field="type" tabindex="0">
														<div class="th-inner ">邮件人</div>
														<div class="fht-cell"></div>
													</th>
													<th style="text-align: center; width: 12%;" data-field="type" tabindex="0">
														<div class="th-inner ">通知类型</div>
														<div class="fht-cell"></div>
													</th>
													<th style="text-align: center; width: 6%;" data-field="type" tabindex="0">
														<div class="th-inner ">使用状态</div>
														<div class="fht-cell"></div>
													</th>
													<th style="text-align: center; width: 8%;" data-field="type" tabindex="0">
														<div class="th-inner ">修改人</div>
														<div class="fht-cell"></div>
													</th>
													<th style="text-align: center; width: 12%;" data-field="upload_time" tabindex="0">
														<div class="th-inner ">创建时间</div>
														<div class="fht-cell"></div>
													</th>
													<th style="text-align: center; width: 12%;" data-field="updated_at" tabindex="0">
														<div class="th-inner ">更新时间</div>
														<div class="fht-cell"></div>
													</th>
													<th style="text-align: center; width: 10%;" data-field="action" tabindex="0">
														<div class="th-inner ">操作</div>
														<div class="fht-cell"></div>
													</th>
												</tr>
											</thead>
											<tbody>
												<tr th:data-index="${emailStat.index}" th:each="email : ${emailPage.list}">
													<td style="text-align: center; width: 5%;" th:text="${email.id}">82</td>
													<td style="text-align: center; width: 12%;" th:text="${email.email}">视讯中国</td>
													<td style="text-align: center; width: 8%;" th:text="${email.remark}">用户名</td>
													<td style="text-align: center; width: 12%;" th:text="${email.email_type_name}"></td>
													<td style="text-align: center; width: 6%;" th:if="${email.is_enable==true}">
														<label class="switch"><input type="checkbox" checked th:id="'id'+${email.id}"><span class="slider round" th:id="${email.id}"></span></label>
													</td>
													<td style="text-align: center; width: 6%;" th:if="${email.is_enable!=true}">
														<label class="switch"><input type="checkbox" th:id="'id'+${email.id}"><span class="slider round" th:id="${email.id}"></span></label>
													</td>
													<td style="text-align: center; width: 8%;" th:text="${email.updater}"></td>
													<td style="text-align: center; width: 12%;" th:text="${#dates.format(email.created_at, 'yyyy-MM-dd HH:mm:ss')}">2018-11-22
														23:08:48</td>
													<td style="text-align: center; width: 12%;" th:text="${#dates.format(email.updated_at, 'yyyy-MM-dd HH:mm:ss')}">2016-08-03
														14:27:17</td>
													<td style="text-align: center; width: 10%;">
														<span>&nbsp;</span>
														<a class="edit" th:href="'javascript:edit('+${email.id}+',\''+${email.email}+'\',\''+${email.remark}+'\',\''+${email.notice_type} +'\')'">
														<button class="btn btn-primary btn-xs">修改</button>
														</a><span> </span><span>&nbsp;</span>
														<span>&nbsp;</span>
														<a class="delete" th:href="'javascript:deleted('+${email.id}+')'">
														<button class="btn btn-danger btn-xs">删除</button>
														</a><span> </span><span>&nbsp;</span></td>
												</tr>

											</tbody>
										</table>
									</div>

									<div class="fixed-table-pagination" style="display: block;">
										<div class="pull-left pagination-detail">
											<span class="pagination-info"
												th:text="'共 '+${emailPage.total}+' 条记录,每页显示'">共 0 条记录</span>
											<select class="" id="pageSize" name="pageSize"
												onchange="selectPageSize()">
												<option value="10" th:selected="${pageSize==10}">10</option>
												<option value="20" th:selected="${pageSize==20}">20</option>
												<option value="50" th:selected="${pageSize==50}">50</option>
												<option value="100" th:selected="${pageSize==100}">100</option>
											</select> <span class="pagination-info">条记录</span>
										</div>
										<div class="pull-right pagination">
											<ul class="pagination" th:if="${emailPage.pages>1}">
												<li class="page-pre"><a
													th:href="'javascript:fanye(1);'">‹‹</a></li>
												<li class="page-pre" th:if="${!emailPage.isFirstPage}"><a
													th:onclick="'javascript:fanye(\''+${emailPage.pageNum-1}+'\');'"></a>
												</li>

												<li class="page-number" th:if="${emailPage.pageNum-3>=1}"><a
													th:onclick="'javascript:fanye(\''+${emailPage.pageNum-3}+'\');'"
													th:text="${emailPage.pageNum-3}">2</a></li>
												<li class="page-number" th:if="${emailPage.pageNum-2>=1}"><a
													th:onclick="'javascript:fanye(\''+${emailPage.pageNum-2}+'\');'"
													th:text="${emailPage.pageNum-2}">2</a></li>
												<li class="page-number" th:if="${emailPage.pageNum-1>=1}"><a
													th:onclick="'javascript:fanye(\''+${emailPage.pageNum-1}+'\');'"
													th:text="${emailPage.pageNum-1}">2</a></li>
												<li class="page-number active"><a
													href="javaScript:void(0);" th:text="${emailPage.pageNum}">2</a></li>
												<li class="page-number"
													th:if="${emailPage.pageNum+1<=emailPage.pages}"><a
													th:onclick="'javascript:fanye(\''+${emailPage.pageNum+1}+'\');'"
													th:text="${emailPage.pageNum+1}">2</a></li>
												<li class="page-number"
													th:if="${emailPage.pageNum+2<=emailPage.pages}"><a
													th:onclick="'javascript:fanye(\''+${emailPage.pageNum+2}+'\');'"
													th:text="${emailPage.pageNum+2}">2</a></li>
												<li class="page-number"
													th:if="${emailPage.pageNum+3<=emailPage.pages}"><a
													th:onclick="'javascript:fanye(\''+${emailPage.pageNum+3}+'\');'"
													th:text="${emailPage.pageNum+3}">2</a></li>

												<li class="page-next" th:if="${!emailPage.isLastPage}"><a
													th:onclick="'javascript:fanye(\''+${emailPage.pageNum+1}+'\');'"></a>
												</li>
												<li class="page-next"><a
													th:onclick="'javascript:fanye(\''+${emailPage.pages}+'\');'">››</a>
												</li>
											</ul>
										</div>
									</div>
								</div>
							</div>
							<div class="clearfix"></div>
						</div>
					</div>
                </div>
        </section>
    </div>

<!-- 模态框(Modal) -->
<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content" style="margin-top: 30%;">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">编辑邮件消息</h4>
            </div>
            <div class="modal-body">
               <form action="/email/write" method="post" id="editWrite">
               <input type="text" name="redirect_url" value="" class="hide" id="redirect_url"/>
                <div class="form-group hide">
                    <label class="control-label col-sm-3" style="font-size: 15px;" >Id:</label>
                    <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;">
                        <input class="form-control" style="width:30%;" type="text" value="" id="id" name="id">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-sm-3" style="font-size: 15px;">邮件地址:</label>
                    <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;">
                        <input class="form-control" style="width:40%;" type="text" value="" id="email_edit" name="email">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-sm-3" style="font-size: 15px;">邮件人:</label>
                    <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;">
                        <input class="form-control" style="width:20%;" type="text" value="" id="remark_edit" name="remark">
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-sm-3" style="font-size: 15px;">邮件类型:</label>
                        <div class="col-sm-9" style="float: left">
                            <div th:each="bu:${email_message}" style="padding-right: 30px;" class="write_check">
                                <span th:text="${bu.value}" style="font-size: 15px"></span>
                                <input type="checkbox" name="write_business" th:value="${bu.key}" th:id="'write_check_'+${bu.key}">
                            </div>
                        </div>
                </div>

              </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" onclick="javascript:$('#editWrite').submit();">提交</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<!-- /.modal -->
    <script>
        //打开编辑窗口
        function edit(Id,email,remark,write_business){
        	$("#myModalLabel").text("编辑邮件消息");
            $("#id").val(Id);
            $("#email_edit").val(email);
            $("#email_edit").attr("readonly","true");
            $("#remark_edit").val(remark);
            $("#redirect_url").val(location.pathname+location.search);
            $(".write_check input").prop("checked",false);
             if($.trim(write_business)!=''){
                 var array =  write_business.split(",")
                 for (var i=0;i<array.length;i++){
                     $("#write_check_"+array[i]).prop("checked",true);
                 }
             }
            $('#editModal').modal('show');
        }
        
        //打开添加窗口 
        function add(){
        	$("#id").val("");
            $("#email_edit").val("");
            $("#email_edit").removeAttr("readonly");
            $("#remark_edit").val("");
            $(".write_check input").prop("checked",false);
        	
            $("#redirect_url").val(location.pathname+location.search);
            $("#myModalLabel").text("添加邮件消息");
            $('#editModal').modal('show');
        }

        //删除操作 
        function deleted(id){
        	var r = confirm("您确定删除本条内容吗?"); 
            if (r == true) {
            	$.post("/email/deleted?id=" + id, function (data) {
                    if (data.errorCode == 0) {
                        alert(data.errorMessage);
                        location.href = location.href;
                    } else {
                        alert(data.errorMessage);
                    }
                })
            }
        }
        
      
        //开关的点击事件
		$(".slider").on('click',function(e){
			var myId=$(this).prop("id");
		//     var myIndex = $(".slider").index($(this));
		    var checked=$("#id"+myId).prop("checked");//获取当前状态,下一个状态用!checked表示
			$.post("/email/updateState?id=" + myId+"&isEnable="+!checked, function (data) {
                if (data.errorCode == 0) {
                    alert(data.errorMessage);
                    location.href = location.href;
                } else {
                    alert(data.errorMessage);
                    location.href = location.href;
                }
            })
		})

        //翻页函数
        function fanye(page) {
            var param = location.search;
            if (param.indexOf("page=") != -1) {
            	var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
                var split = se.split("&");
                var h = "";
                for (var i = 0; i < split.length; i++) {
                    var s = split[i];
                    if (s.indexOf("page=") < 0) h = h + "&" + split[i];
                }
                h = h.substring(1, h.length);
                window.location.href = "/email/page?" + h + "&page=" + page;
            } else {
                param = param.substring(1, param.length);
                window.location.href = "/email/page?" + param + "&page=" + page;
            }
        }
        
        //选择每页数量触发函数
        function selectPageSize(){
        	var pageSize=$("#pageSize").val();
        	 var param = location.search;
             if (param.indexOf("pageSize=") != -1) {
             	var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
                 var split = se.split("&");
                 var h = "";
                 for (var i = 0; i < split.length; i++) {
                     var s = split[i];
                     if (s.indexOf("pageSize=") < 0 &&s.indexOf("page=") < 0) h = h + "&" + split[i];
                 }
                 h = h.substring(1, h.length);
                 window.location.href = "/email/page?" + h + "&page="+ 1 + "&pageSize=" + pageSize;
             } else {
            	 var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
                 var split = se.split("&");
                 var h = "";
                 for (var i = 0; i < split.length; i++) {
                     var s = split[i];
                     if (s.indexOf("page=") < 0) h = h + "&" + split[i];
                 }
                 h = h.substring(1, h.length);
                 window.location.href = "/email/page?" + h + "&page="+ 1 + "&pageSize=" + pageSize;
             }
        }
        
        //搜索
        $('#emailQuery').click(function () {
        	var email = $("#email_query").val();
        	var remark = $("#remark_query").val();
        	var pageSize = $("#pageSize").val();
        	window.location.href = "/email/page?email=" + email + "&remark=" + remark + "&page="+ 1 + "&pageSize=" + pageSize;
		});

      //鼠标回车事件
        $(document).keyup(function(event){
        	  if(event.keyCode ==13){
        	    $("#emailQuery").trigger("click");
        	  }
        	});
    </script>

    <footer th:replace="../templates/common/foot::foot" ></footer>


    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg" style="position: fixed; height: auto;"></div>

</div><!-- ./wrapper -->


<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script type="text/javascript">
    $('div.alert').not('.alert-danger').delay(3000).slideUp(300);
</script>

<!-- AdminLTE App -->
<script src="../../static/js/app.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../../static/js/sidebar.js"></script>


</body>
</html>