<!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/questions_manage.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/questions_manage.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> 
								 关键词应答数据（智能客服）管理
						</div>
						<div class="tpl-portlet-input tpl-fz-ml am-no-margintop">
							<div class="am-form-group am-fl am-no-marginbtm am-select-hover  am-no-outline" style="margin-right:10px;">
								<select onchange="window.open(this.options[this.selectedIndex].value,'_self')" data-am-selected="{searchBox: 1}" name="menu"
								 class="" style="display: none;" id="selected-searchf">
									<option {% if rule == 0 %}selected="selected"{% endif %} value="?{{url['rule']}}rule=0">匹配规则</option>
									<option {% if rule == 1 %}selected="selected"{% endif %} value="?{{url['rule']}}rule=1">广泛</option>
									<option {% if rule == 2 %}selected="selected"{% endif %} value="?{{url['rule']}}rule=2">精确</option>
								</select>
							</div>
							<div class="am-form-group am-fl am-no-marginbtm am-select-hover  am-no-outline" style="margin-right:10px;">
								<select onchange="window.open(this.options[this.selectedIndex].value,'_self')" data-am-selected="{btnSize: 'sm'}"style="display: none;">
									<option {% if sort == 0 %}selected="selected"{% endif %}value="?{{url['sort']}}sort=0">发布日期降序</option>
									<option {% if sort == 1 %}selected="selected"{% endif %}value="?{{url['sort']}}sort=1">发布日期升序</option>
								</select>
							</div>
							<div class="portlet-input input-small input-inline am-fl">
								<form action="" 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" placeholder="搜索..." name="word" value="{{word}}" id="word">
									</div>
								</form>
							</div>
							 <div class="ngar-xiugai-width portlet-input input-small input-inline " style="float: right;">
								<div class="input-icon right am-fr top-1">
									<div class="am-btn-group am-btn-group-xs">
										<a href="questions_manage?1582076950.1318655" class="am-btn am-btn-secondary ng-add-hightB"><span class="am-icon-search"></span>&nbsp;刷新</a>
										<a class="am-btn am-btn-default am-btn-warning" href="questions_update"><span class="am-icon-plus"></span>&nbsp;添加回复</a>
										<a class="am-btn am-btn-default am-btn-success" id="csv-button" href="javascript:;"><span class="am-icon-recycle"></span>&nbsp;导入Excel</a>
										<form action="" method="post" enctype="multipart/form-data" style="display: none;" id="up_csv">
											<input type="file" name="csv" style="display: none" id="csv">
											<input type="hidden" name="action" value="up_csv">
										</form>
										<a target="_blank" href="questions_manage?action=down_csv" class="am-btn am-btn-secondary ng-add-hightB"><span class="am-icon-search"></span>&nbsp;导出Excel</a>
									</div>
								</div>
								<div class="am-cf"></div>
							</div>
						</div>
					</div>
						<div class="am-g">
							<div class="am-u-sm-12">
								<form class="am-form" action="" method="post" id="am-form">
									<table class="am-table am-table-striped am-table-hover table-main">
										<thead>
											<tr>                                 
												<th class="table-check"><div class="ngjs-ziLi1 ngco-inbl-display"><input type="checkbox" id="all" onclick="kg.select_all(this.form);" class="tpl-table-fz-check" style="margin-top: 0;vertical-align: middle;"></div></th>
												<th class="table-title">ID</th>
												<th class="table-type">问题（或关键词）</th>
												<th class="table-author am-hide-sm-only">回复答案（或素材）</th>
												<th class="table-author am-hide-sm-only">比配规则</th>
												<th class="table-date am-hide-sm-only">创建日期</th>
												<th class="table-set">操作选项</th>
											</tr>
										</thead>
										<tbody>
										{% for row in data %}
											<tr>
												<td><input type="checkbox" name="id[]" value="{{row['id']}}"/></td>
												<td>{{row['id']}}</td>
												<td>{{'|'.join(row['ask'])}}</td>
												<td>{% if row['type'] == 0 %}<a href="material_update?id={{row['mid']}}">素材：{{row['material']}}</a>{% elif row['type'] == 1 %}微信素材：{{row['material']}}{% else %}{{row['answer']}}{% endif %}</td>
												<td class="am-hide-sm-only">{% if row['rule'] == 0 %}广泛{% else %}精准{% endif %}</td>
												<td class="am-hide-sm-only">{{row['addtime']}}</td>
												<td>
													<div class="am-btn-toolbar">
														<div class="am-btn-group am-btn-group-xs">
															<div class="am-btn-group am-btn-group-xs ngco-TNo-paddingLR">
																<a href="questions_update?id={{row['id']}}" title="" class="am-btn am-btn-default am-btn-xs am-text-secondary title2div" style="cursor: pointer;"><span class="am-icon-pencil-square-o"></span>&nbsp;编辑</a>
																{% if row['enable'] %}
																<a href="questions_manage?action=unenable&id={{row['id']}}" title="" class="am-btn am-btn-default am-btn-xs am-publish-bright title2div" style="cursor: pointer;"><span class="am-icon-archive"></span>&nbsp;禁用</a>
																{% else  %}
																<a href="questions_manage?action=enable&id={{row['id']}}" title="" class="am-btn am-btn-default am-btn-xs am-button-dark title2div" style="cursor: pointer;"><span class="am-icon-archive"></span>&nbsp;启用</a>
																{% endif %}
																{% if row['rule'] %}
																<a href="questions_manage?action=widely&id={{row['id']}}" title="" class="am-btn am-btn-default am-btn-xs am-hide-sm-only am-text-warning am-recom-bright title2div"><span class="am-icon-star-o "></span>&nbsp;广泛</a>
																{% else %}
																<a href="questions_manage?action=accurate&id={{row['id']}}" title="" class="am-btn am-btn-default am-btn-xs am-hide-sm-only am-text-warning am-button-dark title2div"><span class="am-icon-star-o "></span>&nbsp;精确</a>
																{% endif %}
																<a href="questions_manage?action=del&id={{row['id']}}" title="" class="am-btn am-btn-default am-btn-xs am-text-danger ngro-Jclick-shanchubi title2div"><span class="am-icon-trash-o"></span>&nbsp;删除</a>
															</div>
														</div>
													</div>
												</td>
											</tr>
										{% endfor %}
										</tbody>
									</table>
									{% if not data %}<div class="no-data"><ul>没有相关数据</ul></div>{% endif %}
									{% if page_data['total_rows'] %}
									<div class="am-u-sm-12 am-u-md-6">
										<div class="am-btn-toolbar ng-xno-borderL" id="select-handle">
											<span class="am-input-group-btn add-span">
												<a class="add am-btn am-btn-default am-select am-back ngco-Ono-radiusR" href="javascript:; ">全选</a>
											</span>
											<input type="hidden" name="action" value="" id="action">
											<select class="am-select-hover" data-am-selected="{btnSize: 'sm', dropUp: 1, maxHeight: 155}" style="display: none;">
												<option selected="selected" value='0'>将选中项：</option>
												<option value="del">删除</option>
												<option value="enable">启用</option>
												<option value="unenable">禁用</option>
												<option value="widely">广泛匹配</option>
												<option value="accurate">精确匹配</option>
											</select>
										</div>
									</div>
									{% endif %}
								</form>
								{% if page_data['total_page'] > 1 %}
								{{page_html}}
								{% endif %}
							</div>
						</div>
						<div class="am-alert am-alert-success success-info ngco-No-marginT">
								<ul class="margin-bottom-none padding-left-lg">
									<li class="am-state-info">状态说明：</li>
									<li class="am-verify">
				匹配规则-精准：只有当客户回复的字符和问题完全一致时才会采用。通常用于菜单等，如回复1向客户推送指定的菜单（元素）。<br />
				匹配规则 - 广泛：当用户发送的字符包含了定义的关键词或定义的关键词里包含了客户发送的字符时采用。<br />
				优先原则：相同的关键词出现多个答案时，以精准匹配的优先。相同的匹配规则出现相同关键词多个答案时，系统随机选取一个回复规则。<br />
				问答数据库建议使用Excel表格的形式导入。导入数据库如果与现有数据相同，系统不会被替换。可以先将系统问答数据库导出后修改（添加），然后一次性导入。<br />
				导出 Excel：将问答数据库中所有的数据导出成 CSV 格式文件，可以通用Excel打开修改。<br />
				导入 Excel：将 CSV 格式的问答文件导入到数据库中，请将Excel文件另存为CSV格式后导入。导入数据的格式请参考导出的CSV文件格式，表格的第一行为表头，导入时会被忽略。多个关键词使用相同的答案时，请将关键词用“|”分隔。
									</li>
								</ul>
						</div>
					</div>
				   {% include 'component_footer.tpl' %}
				</div>
				</div><!-- /.scrollbar-wrap -->
			</div>
	</body>
</html>
