|
@@ -154,7 +154,7 @@
|
|
|
</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" id="saveSiteId" onclick="editSiteSave()" class="btn btn-primary" value="保存">
|
|
|
<input type="button" data-dismiss="modal" class="btn btn-default" value="取消">
|
|
|
</div>
|
|
|
</div>
|
|
@@ -364,10 +364,13 @@
|
|
|
<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>信息类型</th>
|
|
|
<th>平台</th>
|
|
|
<th>时间</th>
|
|
@@ -382,6 +385,9 @@
|
|
|
|
|
|
<script>
|
|
|
var siteTypesMap = {};
|
|
|
+var areas = {{.T.areas}};
|
|
|
+var provinces = {{.T.provinces}};
|
|
|
+var citys = {{.T.citys}};
|
|
|
$(function(){
|
|
|
siteTypesMap = {{.T.sitetypes}};
|
|
|
// $("#edit-site_type").append("<option value=''>--请选择网站一级类型--</option>");
|
|
@@ -395,8 +401,9 @@ $(function(){
|
|
|
"url": "/js/dataTables.chinese.lang"
|
|
|
},
|
|
|
"columnDefs": [
|
|
|
- { "orderable": false, "targets": [0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18] },
|
|
|
- {"targets":[5], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
|
|
|
+ { "orderable": false, "targets": [0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17] },
|
|
|
+ //重点
|
|
|
+ {"targets":[5], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
|
|
|
var aInput;
|
|
|
$(cell).click(function () {
|
|
|
$(this).html(selectImportant(rowData._id));
|
|
@@ -419,7 +426,113 @@ $(function(){
|
|
|
ttable.cell(cell).data(text);
|
|
|
cellData = text;
|
|
|
});
|
|
|
- }}
|
|
|
+ }},
|
|
|
+ //一级类型
|
|
|
+ {"targets":[9], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
|
|
|
+ var aInput;
|
|
|
+ $(cell).click(function () {
|
|
|
+ $(this).html(selectClassOneSiteTypes(rowData._id));
|
|
|
+ var aInput = $(this).find(":input");
|
|
|
+ aInput.focus().val(cellData);
|
|
|
+ });
|
|
|
+ $(cell).on("click", ":input", function (e) {
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ $(cell).on("change", ":input", function () {
|
|
|
+ $(this).blur();
|
|
|
+ });
|
|
|
+ $(cell).on("blur", ":input", function () {
|
|
|
+ var text = $(this).find("option:selected").text();
|
|
|
+ ttable.cell(cell).data(text);
|
|
|
+ cellData = text;
|
|
|
+ });
|
|
|
+ }},
|
|
|
+ //二级类型
|
|
|
+ {"targets":[10], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
|
|
|
+ var aInput;
|
|
|
+ $(cell).click(function () {
|
|
|
+ $(this).html(selectClassTwoSiteTypes(rowData._id,rowData.site_type));
|
|
|
+ var aInput = $(this).find(":input");
|
|
|
+ aInput.focus().val(cellData);
|
|
|
+ });
|
|
|
+ $(cell).on("click", ":input", function (e) {
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ $(cell).on("change", ":input", function () {
|
|
|
+ $(this).blur();
|
|
|
+ });
|
|
|
+ $(cell).on("blur", ":input", function () {
|
|
|
+ var text = $(this).find("option:selected").text();
|
|
|
+ ttable.cell(cell).data(text);
|
|
|
+ cellData = text;
|
|
|
+ });
|
|
|
+ }},
|
|
|
+ //发布省份
|
|
|
+ {"targets":[11], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
|
|
|
+ var aInput;
|
|
|
+ $(cell).click(function () {
|
|
|
+ $(this).html(selectArea(rowData._id));
|
|
|
+ var aInput = $(this).find(":input");
|
|
|
+ aInput.focus().val(cellData);
|
|
|
+ });
|
|
|
+ $(cell).on("click", ":input", function (e) {
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ $(cell).on("change", ":input", function () {
|
|
|
+ $(this).blur();
|
|
|
+ });
|
|
|
+ $(cell).on("blur", ":input", function () {
|
|
|
+ var text = $(this).find("option:selected").text();
|
|
|
+ ttable.cell(cell).data(text);
|
|
|
+ cellData = text;
|
|
|
+ });
|
|
|
+ }},
|
|
|
+ //发布城市
|
|
|
+ {"targets":[12], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
|
|
|
+ var aInput;
|
|
|
+ $(cell).click(function () {
|
|
|
+ $(this).html(selectCity(rowData._id,rowData.f_area));
|
|
|
+ var aInput = $(this).find(":input");
|
|
|
+ aInput.focus().val(cellData);
|
|
|
+ });
|
|
|
+ $(cell).on("click", ":input", function (e) {
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ $(cell).on("change", ":input", function () {
|
|
|
+ $(this).blur();
|
|
|
+ });
|
|
|
+ $(cell).on("blur", ":input", function () {
|
|
|
+ var text = $(this).find("option:selected").text();
|
|
|
+ if(text == "--请选择--"){
|
|
|
+ text = "";
|
|
|
+ }
|
|
|
+ ttable.cell(cell).data(text);
|
|
|
+ cellData = text;
|
|
|
+ });
|
|
|
+ }},
|
|
|
+ //发布县区
|
|
|
+ {"targets":[13], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
|
|
|
+ var aInput;
|
|
|
+ $(cell).click(function () {
|
|
|
+ $(this).html(selectDistrict(rowData._id,rowData.f_area,rowData.f_city));
|
|
|
+ var aInput = $(this).find(":input");
|
|
|
+ aInput.focus().val(cellData);
|
|
|
+ });
|
|
|
+ $(cell).on("click", ":input", function (e) {
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ $(cell).on("change", ":input", function () {
|
|
|
+ $(this).blur();
|
|
|
+ });
|
|
|
+ $(cell).on("blur", ":input", function () {
|
|
|
+ var text = $(this).find("option:selected").text();
|
|
|
+ if(text == "--请选择--"){
|
|
|
+ text = "";
|
|
|
+ }
|
|
|
+ ttable.cell(cell).data(text);
|
|
|
+ cellData = text;
|
|
|
+ });
|
|
|
+ }},
|
|
|
],
|
|
|
"order": [[3,"desc"]],
|
|
|
"lengthChange":false,
|
|
@@ -449,7 +562,8 @@ $(function(){
|
|
|
{ "data": "site"},
|
|
|
// { "data": "another_name"},
|
|
|
{ "data": "domain",render:function(val,a,row){
|
|
|
- return "<a href='http://"+val+"' target='_blank' style='color: #333'>"+val+"</a>"
|
|
|
+ return val;
|
|
|
+ // return "<a href='http://"+val+"' target='_blank' style='color: #333'>"+val+"</a>"
|
|
|
}},
|
|
|
{ "data": "important",render:function(val,a,row){
|
|
|
if(val == 1){
|
|
@@ -464,19 +578,22 @@ $(function(){
|
|
|
// { "data": "industry"},
|
|
|
{ "data": "site_type"},
|
|
|
{ "data": "second_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": "f_area"},
|
|
|
+ { "data": "f_city"},
|
|
|
+ { "data": "f_district"},
|
|
|
+ // { "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": "infotype",render:function (val,a,row) {
|
|
|
if(val){
|
|
|
return val;
|
|
@@ -574,7 +691,7 @@ $(function(){
|
|
|
$("#sitelist_filter").prepend(selectEvent);
|
|
|
//省份
|
|
|
var area ="<option value='-1'>全部</option>";
|
|
|
- var areas={{.T.areas}};
|
|
|
+ // var areas={{.T.areas}};
|
|
|
for(k in areas){
|
|
|
area+="<option value='"+areas[k]+"'>"+areas[k]+"</option>";
|
|
|
}
|
|
@@ -664,9 +781,13 @@ function format_X(d) {
|
|
|
'<table id="nestable" style="border-spacing: 9px;border-collapse: separate;background: aliceblue;">' +
|
|
|
'<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>' +
|
|
@@ -683,15 +804,19 @@ function format_X(d) {
|
|
|
'</td>' +
|
|
|
|
|
|
'<td>' +
|
|
|
- data.f_area +
|
|
|
+ data.p_site +
|
|
|
'</td>' +
|
|
|
|
|
|
'<td>' +
|
|
|
- data.f_city +
|
|
|
+ data.s_site +
|
|
|
'</td>' +
|
|
|
|
|
|
'<td>' +
|
|
|
- data.f_district +
|
|
|
+ "<a href='/center/site/getluas/"+data.site+"' style='color: #333 !important;' target='_blank'>"+data.spider_status+"</a>" +
|
|
|
+ '</td>' +
|
|
|
+
|
|
|
+ '<td>' +
|
|
|
+ data.event +
|
|
|
'</td>' +
|
|
|
|
|
|
'<td>' +
|
|
@@ -740,7 +865,7 @@ function addSite() {
|
|
|
}
|
|
|
$("#addsite").modal("show");
|
|
|
}
|
|
|
-function updateSite(){
|
|
|
+function editSiteSave(){
|
|
|
var formdataMap = common.form.serializeArray("edit-form");
|
|
|
if(formdataMap.site=="" || formdataMap.isneedregister == "-1" || formdataMap.isregistered == "-1"){
|
|
|
alert("表单填写不完整!");
|
|
@@ -755,9 +880,10 @@ function updateSite(){
|
|
|
if(r&&r.ok){
|
|
|
showTip("保存成功", 1000);
|
|
|
$("#editsite").modal("hide");
|
|
|
- setTimeout(function (){
|
|
|
- window.location.reload();
|
|
|
- }, 1000);
|
|
|
+ ttable.draw(false)//只刷新信息,不重置页面(返回第一页)
|
|
|
+ // setTimeout(function (){
|
|
|
+ // window.location.reload();
|
|
|
+ // }, 1000);
|
|
|
}else{
|
|
|
showTip("保存失败", 1000);
|
|
|
}
|
|
@@ -955,17 +1081,68 @@ function selectrow(me){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//
|
|
|
+//重点网站筛选
|
|
|
function selectImportant(id){
|
|
|
var siteImportant="<option value=1>是</option><option value=0>否</option>";
|
|
|
- return "<select onchange='updateImportant(this.value,\""+id+"\")' class='form-control input-sm'>"+siteImportant+"</select>"
|
|
|
+ return "<select onchange='updateSite(\"important\",this.value,\""+id+"\")' class='form-control input-sm'>"+siteImportant+"</select>"
|
|
|
+};
|
|
|
+//一级类型网站筛选
|
|
|
+function selectClassOneSiteTypes(id){
|
|
|
+ var classOneSiteTypes = "";
|
|
|
+ for(var k in siteTypesMap){
|
|
|
+ classOneSiteTypes += "<option value="+k+">"+k+"</option>"
|
|
|
+ }
|
|
|
+ return "<select onchange='updateSite(\"classone\",this.value,\""+id+"\")' class='form-control input-sm'>"+classOneSiteTypes+"</select>"
|
|
|
+};
|
|
|
+//二级类型网站筛选
|
|
|
+function selectClassTwoSiteTypes(id,siteType){
|
|
|
+ var classTwoSiteTypes = "";
|
|
|
+ for(var k in siteTypesMap[siteType]){
|
|
|
+ classTwoSiteTypes += "<option value="+siteTypesMap[siteType][k]+">"+siteTypesMap[siteType][k]+"</option>"
|
|
|
+ }
|
|
|
+ return "<select onchange='updateSite(\"classtwo\",this.value,\""+id+"\")' class='form-control input-sm'>"+classTwoSiteTypes+"</select>"
|
|
|
+};
|
|
|
+
|
|
|
+//发布省份选择
|
|
|
+function selectArea(id){
|
|
|
+ console.log(id)
|
|
|
+ var areasOptions = "";
|
|
|
+ for(k in areas){
|
|
|
+ areasOptions+="<option value='"+areas[k]+"'>"+areas[k]+"</option>";
|
|
|
+ }
|
|
|
+ return "<select onchange='updateSite(\"area\",this.value,\""+id+"\")' class='form-control input-sm'>"+areasOptions+"</select>"
|
|
|
+};
|
|
|
+
|
|
|
+//发布城市选择
|
|
|
+function selectCity(id,area){
|
|
|
+ console.log(id)
|
|
|
+ var cityOptions ="<option value=''>--请选择--</option>";
|
|
|
+ if(area != "全国" && area != ""){
|
|
|
+ for(k in provinces[area]){
|
|
|
+ cityOptions+="<option value='"+provinces[area][k]+"'>"+provinces[area][k]+"</option>";
|
|
|
+ }
|
|
|
+ return "<select onchange='updateSite(\"city\",this.value,\""+id+"\")' class='form-control input-sm'>"+cityOptions+"</select>"
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+//发布县区选择
|
|
|
+function selectDistrict(id,area,city){
|
|
|
+ console.log(id)
|
|
|
+ var districtOptions ="<option value=''>--请选择--</option>";
|
|
|
+ if(area != "全国" && area != "" && city != ""){
|
|
|
+ for(k in citys[city]){
|
|
|
+ districtOptions+="<option value='"+citys[city][k]+"'>"+citys[city][k]+"</option>";
|
|
|
+ }
|
|
|
+ return "<select onchange='updateSite(\"district\",this.value,\""+id+"\")' class='form-control input-sm'>"+districtOptions+"</select>"
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
-function updateImportant(val,id) {
|
|
|
+function updateSite(updatetype,val,id) {
|
|
|
$.ajax({
|
|
|
- url:"/center/site/updateimportant",
|
|
|
+ url:"/center/site/updatesite",
|
|
|
type:"post",
|
|
|
data:{
|
|
|
+ "updatetype":updatetype,
|
|
|
"val":val,
|
|
|
"id":id
|
|
|
},
|