|
@@ -0,0 +1,527 @@
|
|
|
|
+{{include "head.html"}}
|
|
|
|
+<div class="modal fade" id="editsite" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
|
|
|
+ <div class="modal-dialog">
|
|
|
|
+ <div class="modal-content">
|
|
|
|
+ <div class="modal-header">
|
|
|
|
+ <div class="modal-header">
|
|
|
|
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="margin-top: -19px">×</button>
|
|
|
|
+ <div class="edit-form">
|
|
|
|
+ <div class="edit-info">
|
|
|
|
+ <span class="glyphicon glyphicon-edit" aria-hidden="true" style="margin-left: 20px;"></span>
|
|
|
|
+ <span class="info">编辑站点</span>
|
|
|
|
+ </div>
|
|
|
|
+ <form class="form-horizontal" role="form">
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="site" class="col-sm-2 control-label">网站名称:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="edit-site" placeholder="请输入网站名称">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="othername" class="col-sm-2 control-label">网站别名:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="edit-othername" placeholder="请输入网站别名">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="domain" class="col-sm-2 control-label">网站域名:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="edit-domain" placeholder="请输入网站域名">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="area" class="col-sm-2 control-label">省份:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="edit-area" placeholder="请输入省份">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="city" class="col-sm-2 control-label">城市:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="edit-city" placeholder="请输入城市">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="district" class="col-sm-2 control-label">区/县:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="edit-district" placeholder="请输入区/县">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="industry" class="col-sm-2 control-label">行业:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="edit-industry" placeholder="请输入行业">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="sitetype" class="col-sm-2 control-label">网站类型:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <select class="form-control" id="edit-sitetype"></select>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="psite" class="col-sm-2 control-label">父站:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="edit-psite" placeholder="请输入父站">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="ssite" class="col-sm-2 control-label">子站:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="edit-ssite" placeholder="请输入子站">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <div class="col-sm-offset-2 col-sm-10 operateStyle">
|
|
|
|
+ <input type="button" id="saveSiteId" onclick="updateSite()" class="btn btn-primary" value="保存">
|
|
|
|
+ <input type="button" onclick="cancelAdd()" class="btn btn-default" value="取消">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </form>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div><!-- /.modal-content -->
|
|
|
|
+ </div><!-- /.modal -->
|
|
|
|
+</div>
|
|
|
|
+<div class="modal fade" id="addsite" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
|
|
|
+ <div class="modal-dialog">
|
|
|
|
+ <div class="modal-content">
|
|
|
|
+ <div class="modal-header">
|
|
|
|
+ <div class="modal-header">
|
|
|
|
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="margin-top: -19px">×</button>
|
|
|
|
+ <div class="edit-form">
|
|
|
|
+ <div class="edit-info">
|
|
|
|
+ <span class="glyphicon glyphicon-save" aria-hidden="true" style="margin-left: 20px;"></span>
|
|
|
|
+ <span class="info">新增站点</span>
|
|
|
|
+ </div>
|
|
|
|
+ <form class="form-horizontal" role="form">
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="site" class="col-sm-2 control-label">网站名称:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="site" placeholder="请输入网站名称">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="othername" class="col-sm-2 control-label">网站别名:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="othername" placeholder="请输入网站别名">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="domain" class="col-sm-2 control-label">网站域名:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="domain" placeholder="请输入网站域名">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="area" class="col-sm-2 control-label">省份:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="area" placeholder="请输入省份">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="city" class="col-sm-2 control-label">城市:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="city" placeholder="请输入城市">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="district" class="col-sm-2 control-label">区/县:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="district" placeholder="请输入区/县">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="industry" class="col-sm-2 control-label">行业:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="industry" placeholder="请输入行业">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="sitetype" class="col-sm-2 control-label">网站类型:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <select class="form-control" id="sitetype"></select>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="psite" class="col-sm-2 control-label">父站:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="psite" placeholder="请输入父站">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="ssite" class="col-sm-2 control-label">子站:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <input type="text" class="form-control" id="ssite" placeholder="请输入子站">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <div class="col-sm-offset-2 col-sm-10 operateStyle">
|
|
|
|
+ <input type="button" onclick="saveSite('')" class="btn btn-primary" value="保存">
|
|
|
|
+ <input type="button" onclick="cancelAdd()" class="btn btn-default" value="取消">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </form>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div><!-- /.modal-content -->
|
|
|
|
+ </div><!-- /.modal -->
|
|
|
|
+</div>
|
|
|
|
+<div class="content-wrapper">
|
|
|
|
+<section class="content-header">
|
|
|
|
+ <h1>
|
|
|
|
+ 站点列表
|
|
|
|
+ <small>
|
|
|
|
+<!-- {{if gt (session "auth") 2}}-->
|
|
|
|
+<!-- <a class="btn btn-default btn-sm" href="/center/spider">新建爬虫</a>-->
|
|
|
|
+ <a class="btn btn-default btn-sm" id="import" onclick="importSite()">导入</a>
|
|
|
|
+ <a class="btn btn-default btn-sm" id="add" onclick="addSite()">新增</a>
|
|
|
|
+<!-- {{end}}-->
|
|
|
|
+ <iframe srcdoc="<form id='uploadform' method='post' enctype='multipart/form-data' action='/center/site/importf
|
|
|
|
+ ile'><input type='file' name='xlsx' /></form>" height=0 scrolling=no class="hide" id="fileframe">
|
|
|
|
+ </iframe>
|
|
|
|
+ </small>
|
|
|
|
+ </h1>
|
|
|
|
+ <ol class="breadcrumb">
|
|
|
|
+ <li><a href="#"><i class="fa fa-dashboard"></i> 站点</a></li>
|
|
|
|
+ <li class="active">列表</li>
|
|
|
|
+ </ol>
|
|
|
|
+ </section>
|
|
|
|
+ <section class="content">
|
|
|
|
+ <div class="box">
|
|
|
|
+ <!-- /.box-header -->
|
|
|
|
+ <div class="box-body">
|
|
|
|
+ <table id="sitelist" class="table table-bordered table-striped">
|
|
|
|
+ <thead>
|
|
|
|
+ <tr>
|
|
|
|
+ <th>站点</th>
|
|
|
|
+ <th>别名</th>
|
|
|
|
+ <th>域名</th>
|
|
|
|
+ <th>省份</th>
|
|
|
|
+ <th>城市</th>
|
|
|
|
+ <th>区县</th>
|
|
|
|
+ <th>行业</th>
|
|
|
|
+ <th>类型</th>
|
|
|
|
+ <th>父站</th>
|
|
|
|
+ <th>子站</th>
|
|
|
|
+ <th>网站状态</th>
|
|
|
|
+ <th>节点</th>
|
|
|
|
+ <th>时间</th>
|
|
|
|
+ <th>平台</th>
|
|
|
|
+ <th class="hidden-xs">操作</th>
|
|
|
|
+ </tr>
|
|
|
|
+ </thead>
|
|
|
|
+ </table>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- /.box-body -->
|
|
|
|
+ </div>
|
|
|
|
+</section>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+$(function(){
|
|
|
|
+ var sitetypes={{.T.sitetypes}};
|
|
|
|
+ $("#sitetype").append("<option value=''>--请选择网站类型--</option>");
|
|
|
|
+ $("#edit-sitetype").append("<option value=''>--请选择网站类型--</option>");
|
|
|
|
+ for(var i in sitetypes){
|
|
|
|
+ $("#sitetype").append("<option value='"+sitetypes[i]+"'>"+sitetypes[i]+"</option>")
|
|
|
|
+ $("#edit-sitetype").append("<option value='"+sitetypes[i]+"'>"+sitetypes[i]+"</option>")
|
|
|
|
+ }
|
|
|
|
+ ttable=$('#sitelist').DataTable({
|
|
|
|
+ "language": {
|
|
|
|
+ "url": "/js/dataTables.chinese.lang"
|
|
|
|
+ },
|
|
|
|
+ "columnDefs": [
|
|
|
|
+ { "orderable": false, "targets": [0,1,2,3,4,5,6,7,8,9,10,11,13,14] }
|
|
|
|
+ ],
|
|
|
|
+ "order": [[12,"desc"]],
|
|
|
|
+ "lengthChange":false,
|
|
|
|
+ "processing":true,
|
|
|
|
+ "serverSide": true,
|
|
|
|
+ "searching": true,
|
|
|
|
+ "ordering": true,
|
|
|
|
+ "info": false,
|
|
|
|
+ "autoWidth": true,
|
|
|
|
+ "ajax": {
|
|
|
|
+ "url": "/center/site/sitelist",
|
|
|
|
+ "type": "POST"
|
|
|
|
+ },
|
|
|
|
+ "columns": [
|
|
|
|
+ { "data": "site"},
|
|
|
|
+ { "data": "another_name"},
|
|
|
|
+ { "data": "domain"},
|
|
|
|
+ { "data": "area"},
|
|
|
|
+ { "data": "city"},
|
|
|
|
+ { "data": "district"},
|
|
|
|
+ { "data": "industry"},
|
|
|
|
+ { "data": "site_type"},
|
|
|
|
+ { "data": "p_site"},
|
|
|
|
+ { "data": "s_site"},
|
|
|
|
+ { "data": "spider_status",width:"28px",render:function (val,a,row) {
|
|
|
|
+ return "<a href='/center/site/getluas/"+row.site+"' style='color: #333 !important;' target='_blank'>"+val+"</a>"
|
|
|
|
+ //return '<a onclick="goToCenter(\''+row.site+'\')" style="color: #333 !important;" target="_blank">'+val+'</a>'
|
|
|
|
+ }},
|
|
|
|
+ { "data": "event",render:function (val,a,row){
|
|
|
|
+ var tmpval =val
|
|
|
|
+ if(val.length >9){
|
|
|
|
+ val = val.substring(0,9)+"..."
|
|
|
|
+ }
|
|
|
|
+ return "<span title='"+tmpval+"'>"+val+"</span>"
|
|
|
|
+ }},
|
|
|
|
+ { "data": "remarktime",width:"50px"},
|
|
|
|
+ { "data": "platform"},
|
|
|
|
+ { "data": "_id",render:function (val,a,row){
|
|
|
|
+ var div=$("<div><div class=\"btn-group\"></div></div>")
|
|
|
|
+ var buttonEdit=$('<a type="button" target="_blank" class="btn btn-sm btn-default">编辑</a>');
|
|
|
|
+ var buttonDelete=$('<a type="button" class="btn btn-sm btn-default">删除</a>');
|
|
|
|
+ buttonEdit.attr("onclick","siteEdit('"+JSON.stringify(row)+"',)");
|
|
|
|
+ buttonDelete.attr("onclick","siteDelete('"+val+"')");
|
|
|
|
+ div.find(".btn-group").append(buttonEdit);
|
|
|
|
+ div.find(".btn-group").append(buttonDelete);
|
|
|
|
+ return div.html();
|
|
|
|
+ }}
|
|
|
|
+ ],
|
|
|
|
+ "fnDrawCallback": function(table) {
|
|
|
|
+ $("ul.pagination").prepend(" 转到第 <input type='text' id='changePage' style='width:20px;'> 页 <a type='text' href='javascript:void(0);' id='dataTable-btn' style='text-align:center'>GO</a>");
|
|
|
|
+ $('#dataTable-btn').click(function(e) {
|
|
|
|
+ var redirectpage=0
|
|
|
|
+ if($("#changePage").val() && $("#changePage").val() > 0) {
|
|
|
|
+ var redirectpage = $("#changePage").val() - 1;
|
|
|
|
+ }
|
|
|
|
+ ttable.page(redirectpage).draw(false);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ "fnServerParams": function (e) {
|
|
|
|
+ var platform=$("#platform").val()
|
|
|
|
+ var event = $("#event").val();
|
|
|
|
+ var sitestype = $("#sitestype").val();
|
|
|
|
+ var area = $("#areas").val();
|
|
|
|
+ if(platform){
|
|
|
|
+ e.platform=platform
|
|
|
|
+ }else{
|
|
|
|
+ e.platform="-1"
|
|
|
|
+ }
|
|
|
|
+ if(event){
|
|
|
|
+ e.event=event
|
|
|
|
+ }else{
|
|
|
|
+ e.event="-1"
|
|
|
|
+ }
|
|
|
|
+ if(sitestype){
|
|
|
|
+ e.sitestype = sitestype;
|
|
|
|
+ }else{
|
|
|
|
+ e.sitestype="-1";
|
|
|
|
+ }
|
|
|
|
+ if(area){
|
|
|
|
+ e.area = area;
|
|
|
|
+ }else{
|
|
|
|
+ e.area="-1";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ common.setActive("index_site");
|
|
|
|
+ ttable.on('init.dt', function () {
|
|
|
|
+ //平台
|
|
|
|
+ var urgency="<div class='form-group'><label for='name'>平台:</label>"+
|
|
|
|
+ "<select id='platform' onchange='checkclick(this.value)' class='form-control input-sm'>"+
|
|
|
|
+ "<option value='-1'>全部</option>"+
|
|
|
|
+ "<option value='golua平台'>golua平台</option>"+
|
|
|
|
+ "<option value='python'>python</option>"+
|
|
|
|
+ "<option value='通用爬虫'>通用爬虫</option>"+
|
|
|
|
+ "<option value='chrome插件'>chrome插件</option>"+
|
|
|
|
+ "</select></div>"
|
|
|
|
+ $("#sitelist_filter").prepend(" ");
|
|
|
|
+ $("#sitelist_filter").prepend(urgency);
|
|
|
|
+ //节点
|
|
|
|
+ var event="<option value='-1'>全部</option>"
|
|
|
|
+ var events={{.T.events}}
|
|
|
|
+ for(k in events){
|
|
|
|
+ event+="<option value='"+events[k]+"'>"+events[k]+"</option>"
|
|
|
|
+ }
|
|
|
|
+ var selectEvent="<div class='form-group'><label for='name'>节点:</label>"+
|
|
|
|
+ "<select id='event' onchange='checkclick(this.value)' class='form-control input-sm'>"+
|
|
|
|
+ event+
|
|
|
|
+ "</select></div>"
|
|
|
|
+ $("#sitelist_filter").prepend(" ");
|
|
|
|
+ $("#sitelist_filter").prepend(selectEvent);
|
|
|
|
+ //网站类型
|
|
|
|
+ var sitestype ="<option value='-1'>全部</option>";
|
|
|
|
+ for(k in sitetypes){
|
|
|
|
+ sitestype+="<option value='"+sitetypes[k]+"'>"+sitetypes[k]+"</option>";
|
|
|
|
+ }
|
|
|
|
+ var selectStype="<div class='form-group'><label for='name'>网站类型:</label>"+
|
|
|
|
+ "<select id='sitestype' onchange='checkclick(this.value)' class='form-control input-sm'>"+
|
|
|
|
+ sitestype+
|
|
|
|
+ "</select></div>"
|
|
|
|
+ $("#sitelist_filter").prepend(" ");
|
|
|
|
+ $("#sitelist_filter").prepend(selectStype);
|
|
|
|
+ //省份
|
|
|
|
+ var area ="<option value='-1'>全部</option>";
|
|
|
|
+ var areas={{.T.areas}};
|
|
|
|
+ for(k in areas){
|
|
|
|
+ area+="<option value='"+areas[k]+"'>"+areas[k]+"</option>";
|
|
|
|
+ }
|
|
|
|
+ var selectArea="<div class='form-group'><label for='name'>省份:</label>"+
|
|
|
|
+ "<select id='areas' onchange='checkclick(this.value)' class='form-control input-sm'>"+
|
|
|
|
+ area+
|
|
|
|
+ "</select></div>"
|
|
|
|
+ $("#sitelist_filter").prepend(" ");
|
|
|
|
+ $("#sitelist_filter").prepend(selectArea);
|
|
|
|
+ //
|
|
|
|
+ $("#sitelist_wrapper .col-sm-6").css({width:"100%"})//样式
|
|
|
|
+ });
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+function addSite() {
|
|
|
|
+ $("#addsite").modal("show");
|
|
|
|
+}
|
|
|
|
+function updateSite(){
|
|
|
|
+ id = $("#saveSiteId").attr("saveid");
|
|
|
|
+ var site = $("#edit-site").val();
|
|
|
|
+ var sitetype = $("#edit-sitetype").val();
|
|
|
|
+ if(site==""||sitetype==""){
|
|
|
|
+ alert("表单填写不完整!");
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ var domain = $("#edit-domain").val();
|
|
|
|
+ var othername = $("#edit-othername").val();
|
|
|
|
+ var area = $("#edit-area").val();
|
|
|
|
+ var city = $("#edit-city").val();
|
|
|
|
+ var district = $("#edit-district").val();
|
|
|
|
+ var industry = $("#edit-industry").val();
|
|
|
|
+ var sitetype = $("#edit-sitetype").val();
|
|
|
|
+ var psite = $("#edit-psite").val();
|
|
|
|
+ var ssite = $("#edit-ssite").val();
|
|
|
|
+ $.ajax({
|
|
|
|
+ url:"/center/site/savesite",
|
|
|
|
+ type:"post",
|
|
|
|
+ data:{"id":id,"site":site,"sitetype":sitetype,"othername":othername,"domain":domain,"area":area,"city":city,"district":district,"industry":industry,"psite":psite,"ssite":ssite},
|
|
|
|
+ success:function (r){
|
|
|
|
+ if(r&&r.ok){
|
|
|
|
+ showTip("保存成功", 1000);
|
|
|
|
+ $("#editsite").modal("hide");
|
|
|
|
+ setTimeout(function (){
|
|
|
|
+ window.location.reload();
|
|
|
|
+ }, 1000);
|
|
|
|
+ }else{
|
|
|
|
+ showTip("保存失败", 1000);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+//编辑信息
|
|
|
|
+function siteEdit(rowjson){
|
|
|
|
+ var row = JSON.parse(rowjson);
|
|
|
|
+ $("#edit-site").val(row.site);
|
|
|
|
+ $("#edit-domain").val(row.domain);
|
|
|
|
+ $("#edit-othername").val(row.another_name);
|
|
|
|
+ $("#edit-area").val(row.area);
|
|
|
|
+ $("#edit-city").val(row.city);
|
|
|
|
+ $("#edit-district").val(row.district);
|
|
|
|
+ $("#edit-industry").val(row.industry);
|
|
|
|
+ if(row.site_type!=""){
|
|
|
|
+ $("#edit-sitetype option").each(function (){
|
|
|
|
+ var text = $(this).val()
|
|
|
|
+ if(text == row.site_type){
|
|
|
|
+ $(this).attr("selected",true);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ $("#psite").val(row.p_site);
|
|
|
|
+ $("#ssite").val(row.s_site);
|
|
|
|
+ $("#saveSiteId").attr("saveid",row._id);
|
|
|
|
+ $("#editsite").modal("show");
|
|
|
|
+}
|
|
|
|
+//删除站点
|
|
|
|
+function siteDelete(id){
|
|
|
|
+ showConfirm("确定删除?", function() {
|
|
|
|
+ $.ajax({
|
|
|
|
+ url:"/center/site/delete",
|
|
|
|
+ type:"post",
|
|
|
|
+ data:{"id":id},
|
|
|
|
+ success:function (r) {
|
|
|
|
+ if(r&&r.d){
|
|
|
|
+ showTip("删除成功", 1000);
|
|
|
|
+ ttable.ajax.reload();
|
|
|
|
+ }else{
|
|
|
|
+ showTip("删除失败", 1000);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+//保存站点
|
|
|
|
+function saveSite(id){
|
|
|
|
+ var site = $("#site").val();
|
|
|
|
+ var sitetype = $("#sitetype").val();
|
|
|
|
+ if(site==""||sitetype==""){
|
|
|
|
+ alert("表单填写不完整!");
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ var domain = $("#domain").val();
|
|
|
|
+ var othername = $("#othername").val();
|
|
|
|
+ var area = $("#area").val();
|
|
|
|
+ var city = $("#city").val();
|
|
|
|
+ var district = $("#district").val();
|
|
|
|
+ var industry = $("#industry").val();
|
|
|
|
+ var sitetype = $("#sitetype").val();
|
|
|
|
+ var psite = $("#psite").val();
|
|
|
|
+ var ssite = $("#ssite").val();
|
|
|
|
+ $.ajax({
|
|
|
|
+ url:"/center/site/savesite",
|
|
|
|
+ type:"post",
|
|
|
|
+ data:{"id":id,"site":site,"sitetype":sitetype,"othername":othername,"domain":domain,"area":area,"city":city,"district":district,"industry":industry,"psite":psite,"ssite":ssite},
|
|
|
|
+ success:function (r){
|
|
|
|
+ if(r&&r.ok){
|
|
|
|
+ showTip("保存成功", 1000000);
|
|
|
|
+ $("#addsite").modal("hide");
|
|
|
|
+ setTimeout(function (){
|
|
|
|
+ window.location.reload();
|
|
|
|
+ }, 1000);
|
|
|
|
+ }else{
|
|
|
|
+ showTip("保存失败", 1000);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+//导入站点
|
|
|
|
+function importSite(){
|
|
|
|
+ var f=$("#fileframe").contents().find("input");
|
|
|
|
+ f.get(0).click();
|
|
|
|
+ f.change(function(){
|
|
|
|
+ var val=$(this).val()?$(this).val():"";
|
|
|
|
+ if(val.indexOf(".xlsx")<0){
|
|
|
|
+ //alert("文件格式非法");
|
|
|
|
+ showMsg("文件格式非法", function() {});
|
|
|
|
+ }else{
|
|
|
|
+ $(this).parent().submit();
|
|
|
|
+ common.maskShow("正在导入数据");
|
|
|
|
+ var ret=setInterval(function(){
|
|
|
|
+ var f=$(window.frames[0].document).find("form");
|
|
|
|
+ if(f.length==0){
|
|
|
|
+ common.maskHide();
|
|
|
|
+ var b=$(window.frames[0].document).find("body").text();
|
|
|
|
+ $(window.frames[0].document).find("body").append("<form id='uploadform' method='post' enctype='multipart/form-data' action='/center/site/importfile'><input type='file' name='xlsx' /></form>");
|
|
|
|
+ if(b!=""&&b!=`""`){
|
|
|
|
+ showTip(b, 2000);
|
|
|
|
+ }else{
|
|
|
|
+ showTip("导入成功", 2000);
|
|
|
|
+ }
|
|
|
|
+ clearInterval(ret);
|
|
|
|
+ ttable.ajax.reload();
|
|
|
|
+ }
|
|
|
|
+ },500)
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+function checkclick(me){
|
|
|
|
+ ttable.ajax.reload();
|
|
|
|
+}
|
|
|
|
+function cancelAdd(){
|
|
|
|
+ $("#addsite").modal("hide");
|
|
|
|
+}
|
|
|
|
+</script>
|
|
|
|
+</div>
|
|
|
|
+{{include "bottom.html"}}
|