123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649 |
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="renderer" content="webkit|ie-comp|ie-stand">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
- <meta http-equiv="Cache-Control" content="no-siteapp" />
- <!--[if lt IE 9]>
- <script type="text/javascript" src="${ctx}/assets/lib/html5.js"></script>
- <script type="text/javascript" src="${ctx}/assets/lib/respond.min.js"></script>
- <script type="text/javascript" src="${ctx}/assets/lib/PIE_IE678.js"></script>
- <![endif]-->
- <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui/css/H-ui.min.css" />
- <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/css/H-ui.admin.css" />
- <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/Hui-iconfont/1.0.7/iconfont.css" />
- <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/icheck/icheck.css" />
- <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/skin/default/skin.css" id="skin" />
- <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/css/style.css" />
- <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" >
- <script type="text/ecmascript" src="${ctx}/assets/lib/jquery/1.9.1/jquery.js"></script>
- <script type="text/javascript" src="${ctx}/assets/static/h-ui/js/H-ui.js"></script>
- <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqueryui/jquery-ui.css" />
- <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqgrid/css/ui.jqgrid.css" />
- <script type="text/ecmascript" src="${ctx}/assets/lib/jqueryui/jquery-ui.js"></script>
- <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/i18n/grid.locale-cn.js"></script>
- <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/jquery.jqGrid.min.js"></script>
- <script type="text/javascript" src="${ctx}/assets/js/base.js"></script>
- <script type="text/javascript" src="${ctx}/assets/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
- <script type="text/javascript" src="${ctx}/assets/lib/layer/3.0.3/layer.js"></script>
- <!--[if IE 6]>
- <script type="text/javascript" src="${ctx}/assets/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
- <script>DD_belatedPNG.fix('*');</script>
- <![endif]-->
- <script type="text/javascript">
- $(function() {
- $(window).resize(function(){
- $("#jqGrid").setGridWidth($(window).width()-40);
- });
- $.crawlerTypeInit=function(){
- var crawlerType=$("#crawlertype").val();
- if(crawlerType=='list'){
- $("#tr_infolinkselect").show();
- $("#tr_releasetimeselect").show();
- }else{
- $("#tr_infolinkselect").hide();
- $("#tr_releasetimeselect").hide();
- }
- }
- $("#jqGrid").jqGrid({
- url : '${ctx}/myconsole/crawler/getByPage',
- editurl:"${ctx}/myconsole/crawler/saveOrUpdate",
- mtype : "POST",
- datatype : "json",
- caption:'信息采集',
- //multiselect: true,
- prmNames : {
- id: "keyid",
- oper:"oper",
- addoper:"add",
- editoper:"edit",
- deloper:"del"
- },
- colModel : [ {
- label : '编号',
- name : 'keyid',
- hidden : true,
- key : true,
- width : 50
- }, {
- label : '模板名称',
- name : 'crawlername',
- editable: true,
- editrules:{required:true},
- formoptions:{
- elmsuffix:'*'
- },
- width : 80
- },{
- label : '模板描述',
- name : 'crawlerdesc',
- editable: true,
- width : 80
- },{
- label : '采集引擎',
- name : 'crawlermode',
- editable: true,
- formatter:"select",
- edittype: "select",
- editoptions: {
- value: "${crawlerMode}"
- },
- stype:"select",
- searchoptions:{
- value: "${crawlerMode}"
- },
- width : 50
- },{
- label : '模板类型',
- name : 'crawlertype',
- editable: true,
- formatter:"select",
- edittype: "select",
- editoptions: {
- value: "${crawlerType}"
- },
- stype:"select",
- searchoptions:{
- value: "${crawlerType}"
- },
- width : 50
- },{
- label : '信息链接选择器',
- name : 'infolinkselect',
- editable: true,
- width : 140
- },{
- label : '发布时间选择器',
- name : 'releasetimeselect',
- editable: true,
- width : 140,
- formoptions:{
- elmsuffix:'选择器采用链接选择器相对路径;优先使用内容页发布时间,获取不到时将使用列表页发布时间'
- }
- },{
- label : '更新时间',
- name : 'updatetime',
- editable: false,
- width : 50
- }],
- rownumbers : true,//添加左侧行号
- viewrecords : true,//是否在浏览导航栏显示记录总数
- rowNum : 10,//每页显示记录数
- rowList : [10,15,20,30,40,50,1000],//用于改变显示行数的下拉列表框的元素数组。
- autowidth : true,
- height : 'auto',
- onSelectRow : function( rowid ) {
- if(rowid.length>10){
- var row = $(this).getRowData(rowid);
- $("#jqGrid1").setColProp('crawlerid',{editoptions:{value:rowid+":a"}});
- $("#jqGrid1").setCaption("内容页元素--"+row.crawlername);
- $("#jqGrid1").jqGrid('setGridParam',{url: "${ctx}/myconsole/crawlerfield/getByPage?crawlerID="+rowid});
- $("#jqGrid1").trigger("reloadGrid");
-
-
- $("#jqGrid2").setColProp('crawlerid',{editoptions:{value:rowid+":a"}});
- $("#jqGrid2").setCaption("栏目数据--"+row.crawlername);
- $("#jqGrid2").jqGrid('setGridParam',{url: "${ctx}/myconsole/crawlercolumn/getByPage?crawlerID="+rowid});
- $.ajax({
- async: false,
- type : "POST",
- url : "${ctx}/myconsole/crawler/getColumnOptions?crawlerID="+rowid,
- dataType : 'text',
- success : function(data) {
- $("#jqGrid2").setColProp('columnid', {editoptions:{value:data} });
- }
- });
- $.ajax({
- async: false,
- type : "POST",
- url : "${ctx}/myconsole/crawler/getSiteOptions?crawlerID="+rowid,
- dataType : 'text',
- success : function(data) {
- $("#jqGrid2").setColProp('siteid', {editoptions:{value:data} });
- }
- });
- $("#jqGrid2").trigger("reloadGrid");
- }
- },
- pager : "#jqGridPager"
- });
- $('#jqGrid').navGrid('#jqGridPager',
- // the buttons to appear on the toolbar of the grid
- {
- edit : true,
- add : true,
- del : true,
- search : true,
- refresh : true,
- view : true,
- position : "left",
- cloneToTop : true
- },
- // options for the Edit Dialog
- {
- recreateForm : true,
- checkOnUpdate : true,
- checkOnSubmit : true,
- closeAfterEdit : true,
- width:800,
- afterShowForm : function(formid) {
- $.crawlerTypeInit();
- $("#crawlertype").change(function(){
- $.crawlerTypeInit();
- })
- },
- serializeEditData: function(postdata) {
- //myconsole.log(postdata);
- $.each(postdata,function (index, value) {
- //myconsole.log(index);
- if(index!="jqGrid_id" && index!="oper" && index!="keyid"){
- modifyJosnKey(postdata,index,"crawler."+index);
- }
- if(index=="keyid"){
- postdata["crawler."+index]=value
- }
- })
- //myconsole.log(postdata);
- return postdata;
- },
- errorTextFormat : function(data) {
- return 'Error: ' + data.responseText
- }
- },
- // options for the Add Dialog
- {
- closeAfterAdd : true,
- recreateForm : true,
- width:800,
- afterShowForm : function(formid) {
- $.crawlerTypeInit();
- $("#crawlertype").change(function(){
- $.crawlerTypeInit();
- })
- },
- beforeSubmit: function(postdata, formid){
- $.each(postdata,function (index, value) {
- if(index!="jqGrid_id" && index!="oper"){
- modifyJosnKey(postdata,index,"crawler."+index);
- }
- })
- return[true,''];
- },
- errorTextFormat : function(data) {
- return 'Error: ' + data.responseText
- }
- },
- // options for the Delete Dailog
- {
- errorTextFormat : function(data) {
- return 'Error: ' + data.responseText
- }
- },{
- // search options 这里支持多条件查询
- multipleSearch: true,
- sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
- afterSubmit: function(r, data) {
- var messageString = r.responseText;
- var mesObj = eval('(' + messageString + ')');
- return [mesObj.state, mesObj.message];
- }
- }
- );
- /////////////////////////////////////////////////////////////////////////////////////////////////
- $(window).resize(function(){
- $("#jqGrid1").setGridWidth($(window).width()-40);
- });
- $("#jqGrid1").jqGrid({
- url : '${ctx}/myconsole/crawlerfield/getByPage',
- editurl:"${ctx}/myconsole/crawlerfield/saveOrUpdate",
- mtype : "POST",
- datatype : "json",
- caption:'内容页元素',
- prmNames : {
- id: "keyid",
- oper:"oper",
- addoper:"add",
- editoper:"edit",
- deloper:"del"
- },
- colModel : [ {
- label : '编号',
- name : 'keyid',
- hidden : true,
- key : true,
- width : 50
- }, {
- label : '采集任务编号',
- name : 'crawlerid',
- hidden : true,
- editable : true,
- edittype :"select",
- editoptions:{value:"a:a"}
- },{
- label : '信息属性名称',
- name : 'crawlerfieldname',
- editable: true,
- formatter:"select",
- edittype: "select",
- editoptions: {
- value: "${crawlerFieldName}"
- },
- stype:"select",
- searchoptions:{
- value: "${crawlerFieldName}"
- },
- width : 50
- }, {
- label : '信息属性选择器',
- name : 'crawlerfieldselect',
- editable: true,
- width : 180
- }, {
- label : '更新时间',
- name : 'updatetime',
- editable: false,
- width : 80
- }],
- rownumbers : true,//添加左侧行号
- viewrecords : true,//是否在浏览导航栏显示记录总数
- rowNum : 10,//每页显示记录数
- rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
- autowidth : true,
- height : 'auto',
- pager : "#jqGridPager1"
- });
- $('#jqGrid1').navGrid('#jqGridPager1',
- // the buttons to appear on the toolbar of the grid
- {
- edit : true,
- add : true,
- del : true,
- search : true,
- refresh : true,
- view : true,
- position : "left",
- cloneToTop : true
- },
- // options for the Edit Dialog
- {
- recreateForm : true,
- checkOnUpdate : true,
- checkOnSubmit : true,
- closeAfterEdit : true,
- onInitializeForm:function(formid) {
- },
- serializeEditData: function(postdata) {
- //myconsole.log(postdata);
- $.each(postdata,function (index, value) {
- //myconsole.log(index);
- if(index!="jqGrid_id" && index!="oper" && index!="keyid"){
- modifyJosnKey(postdata,index,"crawlerField."+index);
- }
- if(index=="keyid"){
- postdata["crawlerField."+index]=value
- }
- })
- //myconsole.log(postdata);
- return postdata;
- },
- errorTextFormat : function(data) {
- return 'Error: ' + data.responseText
- }
- },
- // options for the Add Dialog
- {
- closeAfterAdd : true,
- recreateForm : true,
- beforeSubmit: function(postdata, formid){
- $.each(postdata,function (index, value) {
- if(index!="jqGrid_id" && index!="oper"){
- modifyJosnKey(postdata,index,"crawlerField."+index);
- }
- })
- return[true,''];
- },
- errorTextFormat : function(data) {
- return 'Error: ' + data.responseText
- }
- },
- // options for the Delete Dailog
- {
- errorTextFormat : function(data) {
- return 'Error: ' + data.responseText
- }
- },{
- // search options 这里支持多条件查询
- multipleSearch: true,
- sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
- afterSubmit: function(r, data) {
- var messageString = r.responseText;
- var mesObj = eval('(' + messageString + ')');
- return [mesObj.state, mesObj.message];
- }
- }
- );
- /////////////////////////////////////////////////////////////////////////////////////////
- $(window).resize(function(){
- $("#jqGrid2").setGridWidth($(window).width()-40);
- });
- $("#jqGrid2").jqGrid({
- url : '${ctx}/myconsole/crawlercolumn/getByPage',
- editurl:"${ctx}/myconsole/crawlercolumn/saveOrUpdate",
- mtype : "POST",
- datatype : "json",
- caption:'栏目数据',
- multiselect: true,
- prmNames : {
- id: "keyid",
- oper:"oper",
- addoper:"add",
- editoper:"edit",
- deloper:"del"
- },
- colModel : [ {
- label : '编号',
- name : 'keyid',
- hidden : true,
- key : true,
- width : 50
- }, {
- label : '采集任务编号',
- name : 'crawlerid',
- hidden : true,
- editable : true,
- edittype :"select",
- editoptions:{value:"a:a"}
- },{
- label :'所属站点',
- name :'siteid',
- editable: true,
- width : 50,
- editrules:{required:true},
- edittype :"select",
- formatter:"select",
- editoptions:{
- dataInit: function(elem){
- $(elem).width(225);
- },
- value:""},
-
- formoptions:{
- elmsuffix:'*'
- }
- },{
- label : '选择栏目',
- name : 'columnid',
- editable: true,
- width : 50,
- editrules:{required:true},
- edittype :"select",
- formatter:"select",
- editoptions: {
- dataInit: function(elem){
- $(elem).width(225);
- },
- value:"",
- maxlength: 10,
- },
- formoptions:{
- elmsuffix:'*'
- }
- },{
- label : '入口地址',
- name : 'accessurl',
- editable: true,
- width : 80,
- hidden : true,
- editrules:{
- required:true,
- edithidden:true
- },
- formoptions:{
- elmsuffix:'*'
- }
- },{
- label : '采集页数',
- name : 'pagenum',
- editable: true,
- width : 20,
- editrules:{required:true,integer:true,minValue:1},
- formoptions:{
- elmsuffix:'*'
- }
- }, {
- label : '更新时间',
- name : 'updatetime',
- editable: false,
- width : 20
- },{
- label : '操作',
- name:'operMod',
- index:'operMod',
- align:"center",
- width:20,
- formatter: function (cellvalue, options, rowdata) {
- var html = "<button class='btn btn-success radius size-S' onclick=crawlerOne('"+rowdata.keyid+"')>执行</button>";
- return html;
- }
- }],
- rownumbers : true,//添加左侧行号
- viewrecords : true,//是否在浏览导航栏显示记录总数
- rowNum : 50,//每页显示记录数
- rowList : [10,15,20,30,40,50,100 ],//用于改变显示行数的下拉列表框的元素数组。
- autowidth : true,
- height : 'auto',
- pager : "#jqGridPager2"
- });
- $('#jqGrid2').navGrid('#jqGridPager2',
- // the buttons to appear on the toolbar of the grid
- {
- edit : true,
- add : true,
- del : true,
- search : true,
- refresh : true,
- view : true,
- position : "left",
- cloneToTop : true
- },
- // options for the Edit Dialog
- {
- recreateForm : true,
- checkOnUpdate : true,
- checkOnSubmit : true,
- closeAfterEdit : true,
- afterShowForm : function(formid) {
- $("#siteid").change(function(){
- /* var siteid=$('#siteid').val; */
- $("#columnid").empty().append("<option>请选择</option>");
- var siteid=this.value;
- $.ajax({
- async: false,
- type : "POST",
- url : "${ctx}/myconsole/crawler/getColumnOptionsBySite?siteid="+siteid,
- dataType : 'text',
- success : function(data) {
- $("#columnid").append(data);
- }
- });
-
- });
- },
- serializeEditData: function(postdata) {
- //myconsole.log(postdata);
- $.each(postdata,function (index, value) {
- //myconsole.log(index);
- if(index!="jqGrid_id" && index!="oper" && index!="keyid"){
- modifyJosnKey(postdata,index,"crawlerColumn."+index);
- }
- if(index=="keyid"){
- postdata["crawlerColumn."+index]=value
- }
- })
- //myconsole.log(postdata);
- return postdata;
- },
- errorTextFormat : function(data) {
- return 'Error: ' + data.responseText
- }
- },
-
- // options for the Add Dialog
- {
- closeAfterAdd : true,
- recreateForm : true,
- afterShowForm : function(formid) {
-
- $("#columnid").empty().append("<option>请选择</option>");
- $("#siteid").change(function(){
- /* var siteid=$('#siteid').val; */
- $("#columnid").empty().append("<option>请选择</option>");
- var siteid=this.value;
- $.ajax({
- async: false,
- type : "POST",
- url : "${ctx}/myconsole/crawler/getColumnOptionsBySite?siteid="+siteid,
- dataType : 'text',
- success : function(data) {
- $("#columnid").append(data);
- }
- });
-
- });
- },
- beforeSubmit: function(postdata, formid){
- $.each(postdata,function (index, value) {
- if(index!="jqGrid_id" && index!="oper"){
- modifyJosnKey(postdata,index,"crawlerColumn."+index);
- }
- })
- return[true,''];
- },
- errorTextFormat : function(data) {
- return 'Error: ' + data.responseText
- }
- },
- // options for the Delete Dailog
- {
- errorTextFormat : function(data) {
- return 'Error: ' + data.responseText
- }
- },{
- // search options 这里支持多条件查询
- multipleSearch: true,
- sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
- afterSubmit: function(r, data) {
- var messageString = r.responseText;
- var mesObj = eval('(' + messageString + ')');
- return [mesObj.state, mesObj.message];
- }
- }
- );
-
- $("#crawlerAll").click(function(){
- var columnKeyIDs = $('#jqGrid2').jqGrid('getGridParam','selarrrow');
- $.post("${ctx}/myconsole/crawler/all",{"columnKeyIDs":columnKeyIDs},function(data){
- layer.alert(data);
- })
- })
- })
- function crawlerOne(keyid){
- $.get("${ctx}/myconsole/crawler/run",{"columnKeyID":keyid},function(data){
- layer.alert(data);
- })
- }
- </script>
- <title>我的桌面</title>
- </head>
- <body>
- <div class="page-container">
- <table id="jqGrid"></table>
- <div id="jqGridPager"></div>
- <div> </div>
- <table id="jqGrid1"></table>
- <div id="jqGridPager1"></div>
- <div> </div>
-
- <div style="text-align:right">
- <button id="crawlerAll" class="btn btn-primary radius" type="button"><i class="Hui-iconfont"></i>批量采集</button>
- </div>
- <table id="jqGrid2"></table>
- <div id="jqGridPager2"></div>
- </div>
- <footer class="footer mt-20">
- <div class="container">
- <p></p>
- </div>
- </footer>
- </body>
- </html>
|