<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>KGCMS企业应用管理平台 - Powered by KGCMS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<!-- <meta http-equiv="cache-control" content="no-siteapp" /> -->
<link rel="stylesheet" href="{{ kg['tpl_url'] }}style/log.css">
<script src="{{ kg['tpl_url'] }}script/jquery.min.js"></script>
<script src="{{ kg['server']['HTTP_HOST'] }}/tools/amazeui/js/amazeui.min.js"></script>
<script src="{{kg['tpl_url']}}script/common.js"></script>
<script src="{{ kg['tpl_url'] }}script/log.js"></script>
</head>
<body data-type="generalComponents">
	{% include 'component_header.tpl' %}
	<div class="tpl-page-container tpl-page-header-fixed">
		<div class="scrollbar-wrap">
		{% include 'component_left.tpl' %}
		<div class="tpl-content-wrapper">
			<div class="tpl-content-page-title">
				系统日志信息
			</div>
			<ol class="am-breadcrumb">
				<li><a href="./" class="am-icon-home">首页</a></li>
				<li class="am-active">系统日志信息</li>
			</ol>
			<div class="tpl-portlet-components">
				<div class="portlet-title">
					<div class="caption font-green bold">
						<span class="am-icon-code"></span>&nbsp;系统日志信息
					</div>
					<div class="tpl-portlet-input tpl-fz-ml am-no-margintop">
						<!-- 1 -->
						<div class="am-form-group am-fl am-no-marginbtm am-select-hover  am-no-outline nglo-W10-marginR nglo-qshow ngco-none-display2">
							<select onchange="window.open(this.options[this.selectedIndex].value,'_self')" data-am-selected="{searchBox: 1}" name="menu" class="ngco-none-display" id="selected-search3">
								{% for row in admin %}
								{% if row['id']==aid %}
								{% if row['username'] %}
								<option selected="selected" value="log?{{url['aid']}}aid={{row['id']}}">{{row['username']}}</option>
								{% endif %}
								{% else %}
								{% if row['username'] %}  
								<option value="log?{{url['aid']}}aid={{row['id']}}">{{row['username']}}</option>
								{% endif %}
								{% endif %}
								{% endfor %}
							</select>
						</div>
						<!-- 2 -->
						<div class="am-form-group am-fl am-no-marginbtm am-select-hover  am-no-outline nglo-W10-marginR nglo-qshow2 ngco-none-display2">
							<select onchange="window.open(this.options[this.selectedIndex].value,'_self')" data-am-selected="{btnSize: 'sm'}">
								{% for row in log_type %}
								{% if loop.index0==filter %}
								<option selected="selected" value="./log?{{url['type']}}type={{loop.index0}}">{{log_type[loop.index0]}}</option>
								{% else %}
								<option value="log?{{url['type']}}type={{loop.index0}}">{{log_type[loop.index0]}}</option>
								{% endif %}
								{% endfor %}
							</select>
						</div>
						<div class="portlet-input input-small input-inline am-fl">
							<form action="./log" method="get" id="search">
								<div class="input-icon right">
									<i class="am-icon-search log-search"></i>
									<input type="text" class="form-control form-control-solid ng-Ashousuo-radius am-hover ngco-Alo-Noborder" placeholder="搜索..." name="word" value="{{word}}" id="word">
								</div>
							</form>
						</div>
						<span class="am-input-group-btn add-span">
							<a class="add am-btn am-btn-default am-hover ngco-Oshezhi-radiusR am-hover" href="log?refresh=1">刷新</a>
						</span>
					</div>
				</div>
				<div class="tpl-block ngALL-AFenyeFu-marginT">
					<form action="#" method="get" class="ngco-Esz-mgibdr">
						<div class="am-btn-toolbar">
							<div class="am-btn-group am-btn-group-xs nglo-he-pama">
								{% set len = data|length %}
								{% if len > 0 %}
								{% if data[0]['is_del'] == 0 %}
								<input type="checkbox" class="liChild am-fl tpl-table-fz-check nglo-Nhe-maTR" value="all" disabled="disabled" name="all">
								<button type="button" class="am-btn am-btn-default am-btn-danger am-disabled"><span class="am-icon-trash-o"></span>&nbsp;删除</button>
								{% else %}
								<input type="checkbox" class="liChild am-fl tpl-table-fz-check" value="" style="margin-top: 8px;margin-right:20px;" id="all">
								<button type="submit" class="am-btn am-btn-default am-btn-danger"><span class="am-icon-trash-o"></span>&nbsp;删除</button>
								{% endif %}
								{% endif %}
							</div>
						</div>
						{% if len > 0 %}
						{% for row in data %}
						<ul class="tpl-task-list">
							<li>
								<div class="task-checkbox">
									{% if row['is_del'] == 0 %}
									<input type="checkbox" disabled="disabled" class="liChild" value="2" name="test">
									{% else %}
									<input type="checkbox" class="liChild" value="{{ row['id'] }}" name="id[]">
									{% endif %}
								</div>
								<div class="task-title">
									{% if row['state'] == 'SUCCESS' %}
									<span class="cosIco absolute title2div" title="操作成功">
										<i class="am-icon-check-circle"></i>
									</span>
									{% else %}
									<span class="cosIco label-danger absolute" title="操作失败">
										<i class="am-icon-exclamation-circle"></i>
									</span>
									{% endif %}
									<span class="task-title-sp">&nbsp;
										{% if row['loginid']['admin'] or row['loginid']['user'] %}
										{% if row['type'] > 9 %}
										{% if row['loginid']['user'] %}
										{{row['loginid']['user']}}
										{% else %}
										<em>None</em>
										{% endif %}
										{% else %}
										{% if row['loginid']['admin'] %}
										{{row['loginid']['admin']}}
										{% else %}
										<em>None</em>
										{% endif %}
										{% endif %}
										{% else %}
										<em>None</em>
										{% endif %}
										&nbsp;&nbsp;/&nbsp;&nbsp;
										{% if word %}
										{{ row['msg']|replace(word, '<b style="color:red">'+word+'</b>') }}
										{% else %}
										{{ row['msg'] }}
										{% endif %}
										&nbsp;&nbsp;/&nbsp;&nbsp;<i class="am-icon-map-marker"></i> &nbsp;&nbsp;<a href="{{ip_find}}{{ row['ip'] }}" class="title2div" title="{{row['ip']}}" target="_blank">
											{% if row['address'] == '-' or row['address'] == '' %}
											{{row['ip']}}
											{% else %}
											{{ row['address'] }}
											{% endif %}
										</a>&nbsp;&nbsp;/&nbsp;&nbsp;<i class="am-icon-clock-o"></i>&nbsp;&nbsp;{{ row['time'] }}<em class="times">{{ row['interval'] }}</em></span>
								</div>
								<div class="task-config">
									<div class="am-btn-toolbar">
										<div class="am-btn-group am-btn-group-xs">
											<button class="am-btn am-btn-default am-btn-xs am-text-secondary gg" data-value="{{ row['id'] }}" data-am-modal="{target: '#am-btn-details'}" type="button"><span class="am-icon-info"></span>&nbsp;详情</button>
											{% if row['is_del'] == 0 %}
											<button data-value="" type="button" class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only am-disabled"><span class="am-icon-trash-o"></span>&nbsp;删除</button>
											{% else %}
											<button data-value="log?{{url['button']}}action=del&id={{row['id']}}" type="button" class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"><span class="am-icon-trash-o"></span>&nbsp;删除</button>
											{% endif %}
										</div>
									</div>
								</div>
							</li>
						</ul>
						{% endfor %}
						<input type="hidden" name="action" id="action" value="del">
						{% endif %}
					</form>
					{% if not data %}<div class="no-data"><ul>没有相关数据</ul></div>{% endif %}
					<div class="am-g">
					{% if page_data['total_page'] > 1 %}
					{{branch}}
					{% endif %}
					</div>
					<div class="am-alert am-alert-success success-info">
						<ul class="margin-bottom-none padding-left-lg">
							<li class="am-verify">
								<span class="am-icon-info-circle am-icon-sm am-white"></span>&nbsp;&nbsp;为了系统安全，近期的操作日志必须保留，无法删除。<br />
							</li>
						</ul>
					</div>
				</div>
			</div>
			{% include 'component_footer.tpl' %}
			<div class="am-popup am-modal-active" id="am-btn-details" style="display: none;">
				<div class="am-popup-inner">
					<div class="am-popup-hd">
						<h4 class="am-popup-title">日志详情</h4><span data-am-modal-close="" class="am-close">×</span>
					</div>
					<div class="am-popup-bd">
						<p class="de-admin"></p>
						<p class="de-adminid"></p>
						<p class="de-user"></p>
						<p class="de-username"></p>
						<p class="de-info"></p>
						<p class="de-ip"></p>
						<p class="de-address"></p>
						<p class="de-url"></p>
						<p class="de-time"></p>
						<p class="de-state"></p>
						<p>
						</p>
						<p>
							{% if len > 0 %}
							<script>
							$('.gg').click(function() {
								var a = $(this).data().value;
								var b = {{ data }}
								for (var i = 0; i < b.length; i++) {
									$other1 = b[i]['info'].replace(/, "/gm, '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"');
									$other2 = $other1.replace(/{/gm, "{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
									$other3 = $other2.replace(/}/gm, "<br>}  ");
									$other4 = $other3.replace(/'{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/gm, "'{");
									$other5 = $other4.replace(/<br>}  '/gm, "}'");
									if (b[i]['id'] == a) {
										$('.de-adminid').html('管理员ID: ' + b[i]['adminid']);
										$('.de-info').html('日志信息: ' + $other5);
										$('.de-url').html('操作来源页面: ' + b[i]['pageurl']);
										$('.de-admin').html('ID: ' + b[i]['id']);
										$('.de-ip').html('操作者IP地址: ' + b[i]['ip']);
										$('.de-address').html('操作者的地址: ' + b[i]['address']);
										$('.de-time').html('操作时间: ' + b[i]['time']);
										$('.de-state').html('操作结果: ' + b[i]['state']);
										$('.de-username').html('用户信息: {"admin": "' + b[i]['loginid']['admin'] + '", "user": "' + b[i]['loginid']['user'] + '"}');
										console.log(b[i]['loginid'])
										if (b[i]['userid'] == 0)
											$('.de-user').html('前台用户ID: ' + 'None');
										else
											$('.de-user').html('前台用户ID: ' + b[i]['userid']);
									};
								};
							});
							</script>
							{% endif %}
						</p>
					</div>
				</div>
			</div>
		</div>
		</div><!-- /.scrollbar-wrap -->
	</div>
	<script>
	kg.title2div('title2div'); //调用此方法， 把该元素的title属性替换成div
	</script>
</body>
</html>