文章目录
-
-
- 实践实例
- 技术原理
- 通用方法:手动提取原始PDF地址的步骤
-
- [方法一:直接探测标准 PDF 资源路径(推荐)](#方法一:直接探测标准 PDF 资源路径(推荐))
- 方法二:从页面源码中提取后端下载接口地址
- 自动化提取脚本实战
-
实践实例
html
<!DOCTYPE html>
<html style="width:100%; height:100%">
<head>
<base href="https://law.chemicalsafety.org.cn:443/compliance/">
<!-- UTF-8解析文档 -->
<meta charset="utf-8">
<!-- 禁止缩放,去除300毫秒的响应慢问题 -->
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<!-- SAFARI的兼容问题 -->
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<!-- 360浏览器优先使用极速模式 -->
<meta name="renderer" content="webkit">
<!-- IE浏览器优先使用最新内核 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<!-- 禁用缓存,确保回退可以刷新页面 -->
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="icon" href="/compliance/org/main/getLogo.action">
<script type="text/javascript" src="/compliance/org/commons/lib/jquery/jquery-3.3.1.min.js"></script>
<link type="text/css" rel="stylesheet" href="/compliance/org/commons/lib/easyui/themes/icon.css?v=1.11"/>
<link type="text/css" rel="stylesheet" href="/compliance/org/commons/lib/easyui/themes/default/easyui.css?v=1.11"/>
<script type="text/javascript" src="/compliance/org/commons/lib/easyui/easyui-1.10.18.min.js?v=1.11"></script>
<script type="text/javascript" src="/compliance/org/commons/lib/easyui/locale/zh.js?v=1.11"></script>
<style type="text/css">
/* tabs, 面板高度计算不准确的问题 */
.tabs-panels > .panel {
width: 100%!important;
height: 100%!important;
box-sizing: border-box;
}
/* tabs, 面板宽度计算不准确的问题 */
.tabs-panels > .panel-body {
width: 100%!important;
height: 100%!important;
box-sizing: border-box;
background-color: white;
}
/* tree, 连接线断开的问题 */
.tree-indent, .tree-expanded, .tree-collapsed,
.tree-folder, .tree-file, .tree-checkbox {
margin: 0px;
height: 26px;
}
/* tree, 图标不能对齐的问题 */
.tree-checkbox0 {
background: url("/compliance/org/commons/lib/easyui/themes/default/images/tree_icons.png") no-repeat -208px -26px;
}
.tree-checkbox1 {
background: url("/compliance/org/commons/lib/easyui/themes/default/images/tree_icons.png") no-repeat -224px -26px;
}
.tree-checkbox2 {
background: url("/compliance/org/commons/lib/easyui/themes/default/images/tree_icons.png") no-repeat -240px -26px;
}
.tree-dnd-no {
background: url("/compliance/org/commons/lib/easyui/themes/default/images/tree_icons.png") no-repeat -256px -26px;
}
/* tree, 选中行的背景色 */
.tree-node-selected {
color: #000;
background: rgb(236,245,255);
}
.tree-node-hover {
color: #000;
background: rgb(245,247,250);
}
/* datagrid, 设置行高 */
.datagrid-view td {
height: 35px;
}
/* datagrid, 滚动条不能靠边的问题 */
.datagrid-body {
width: 100%!important;
}
/* datagrid, 设置checkbox大小 */
.datagrid-header-check, .datagrid-cell-check {
width: 36px;
}
.datagrid-header-check input, .datagrid-cell-check input {
width: 18px;
height: 18px;
}
.datagrid-cell {
padding: 3px 4px;
}
.datagrid-row-selected {
background-color: rgb(245, 247, 250);
}
.datagrid-row-over {
background-color: rgb(236, 245, 255);
}
/* 下拉框, 设置选项的最小高度 */
.combo-panel {
min-height: 80px;
}
.combobox-item {
padding: 4px 4px;
line-height: 18px;
}
/* 下拉框, 选中项背景颜色过于突出 */
.combobox-item-selected {
background-color: rgb(246,250,255);
color: rgb(33,150,243);
}
/* 设置按钮的样式 */
.easyui-linkbutton {
display: inline-block;
box-sizing: border-box;
min-width: 30px;
padding: 0px 8px;
font-weight: normal;
font-size: 13px;
text-align: center;
vertical-align: middle;
cursor: pointer;
color: #fff;
border: none;
border-radius: 3px;
background-image: none;
background-color: rgb(25,118,210);
}
.easyui-linkbutton:hover {
border: none;
color: #fff;
background-color: rgb(121,187,255);
}
.l-btn-plain {
padding: 2px 4px;
color: #000;
background-color: transparent;
}
.l-btn-plain:hover {
padding: 2px 4px;
border: none;
}
.l-btn-text {
margin: 0px 3px;
height: 28px;
line-height: 28px;
}
.btn-primary {
color: #fff;
background-color: rgb(25,118,210);
}
.btn-success {
color: #fff;
background-color: #5cb85c;
}
.btn-success:hover {
color: #fff;
background-color: #449d44;
}
.btn-danger {
color: #fff;
background-color: rgb(245,108,108);
}
.btn-danger:hover {
color: #fff;
background-color: rgb(248,152,152);
}
.btn-warning {
color: #fff;
background-color: rgb(230,162,60);
}
.btn-warning:hover {
color: #fff;
background-color: rgb();
}
.btn-info {
color: #fff;
background-color: #5bc0de;
}
.btn-info:hover {
color: #fff;
background-color: #31b0d5;
}
/****** 对EeayUI控件的整体风格调整 ******/
.panel-header, .panel-body, .tabs, .tabs-panels, .layout-expand {
border-color: #cbcbcb;
background: white;
}
.panel-title, .tabs-title {
color: #2779AA;
}
.tabs-header, .tabs-tool {
border-color: #cbcbcb;
background-color: white;
}
.tabs li .tabs-inner {
height: 30px!important;
line-height: 30px!important;
border-style: none;
background: white!important;
}
.tabs li.tabs-selected .tabs-inner {
border-bottom: 2px solid rgb(39,121,170);
}
.layout-split-west {
border-right: 5px solid rgb(247,247,247);
}
.combo-panel {
background-color: rgb(246,250,255);
}
/* 设置validate-box,跟textbox一致 */
.easyui-validatebox {
border-radius: 3px;
border: 1px solid #cbcbcb;
padding: 0px 6px;
}
.combo-arrow {
background-color: white;
}
.textbox {
border: 1px solid #cbcbcb;
border-radius: 3px;
}
/* 参数4px,对textarea有影响! */
.textbox .textbox-text {
padding: 4px 6px;
}
/* 验证无效时的边框和背景色 */
.textbox-invalid, .validatebox-invalid {
border: 1px solid #cbcbcb;
background-color: #FFFFEE;
}
.textbox-focused, .easyui-validatebox:focus {
border: 1px solid #6b9cde;
box-shadow: 0 0 3px 0 #95B8E7;
}
/*textbox, disabled背景色 */
.textbox-disabled .validatebox-disabled {
color: rgb(0,0,0);
background-color: rgb(247,247,247);
}
/*textbox, readonly背景色 */
.textbox-readonly .validatebox-readonly {
color: rgb(0,0,0);
background-color: rgb(247,247,247);
}
/****** 设置EasyUI控件的字体 ******/
.panel-title, .panel-body, .tabs-title, .tree-title,
.datagrid-cell, .datagrid-cell span, .datagrid-cell-rownumber {
font-size: 13px;
}
.menu-text, .easyui-linkbutton, .l-btn-text,
.textbox, .textbox-text, .textbox-prompt, .combobox-item {
font-size: 13px!important;
}
.pagination span, .pagination-info {
font-size: 12px!important;
}
</style>
<script type="text/javascript">
//添加一个正则表达式验证规则。
$.fn.validatebox.defaults.rules["reg"] = {
validator: function(value, param) {
var reg = new RegExp(param[0]);
return reg.test(value);
},
message: ""
}
//解决验证消息有时覆盖Label的问题。
$.fn.validatebox.defaults.tipPosition = "bottom";
$.fn.textbox.defaults.tipPosition = "bottom";
$.fn.combobox.defaults.tipPosition = "bottom";
//解决在默认情况下,下拉框可以随便输入的问题。
$.fn.combobox.defaults.editable = false;
//$.fn.combobox.defaults.limitToList = true;
/**
* 在英文环境下,日期控件不支持ISO格式,但后台服务器都采用的ISO格式。
* 因此提供自己的parser/formatter函数,统一按照ISO格式处理。
* 注:datebox/datetimebox控件,都走这两个方法。
*/
$.fn.datebox.defaults.parser = function(value) {
if (!value) {
return null;
} else {
return zr.basic.parseDate(value);
}
}
$.fn.datebox.defaults.formatter = function(value) {
return zr.basic.formatDateShort(value);
}
//为日期控件增加清空按钮。
$.fn.datebox.defaults.buttons.push({
text: '删除',
handler: function(target) {
$(target).datebox('setValue', '');
}
});
$.fn.datetimebox.defaults.buttons.push({
text: '删除',
handler: function(target) {
$(target).datebox('setValue', '');
}
});
</script>
<link type="text/css" rel="stylesheet" href="/compliance/org/commons/lib/layer/skin/layer.css"/>
<script type="text/javascript" src="/compliance/org/commons/lib/layer/layer.js"></script>
<style type="text/css">
.layui-layer-dialog {
min-width: 360px;
}
.layui-layer-content {
min-height: 60px;
font-size: 13px;
}
.layui-layer-title {
background-color: #fff;
}
/* notice, 提示信息框*/
.layui-layer-dialog.layui-layer-msg {
min-width: 100px;
border-radius: 3px;
border: 1px solid rgb(84, 84, 84);
background-color: rgb(84, 84, 84);
}
.layui-layer-dialog.layui-layer-msg .layui-layer-content {
color: #fff;
min-height: 20px;
padding: 8px 26px 8px 12px;
}
/* notice, 在提示信息前面插入一个图标 */
.layui-layer-dialog.layui-layer-msg .layui-layer-content::before {
content: 'notifications';
font-family: 'Material Icons';
font-style: normal;
font-weight: 600;
display: inline-block;
font-size: 14px;
transform: translate(0px, 1px);
margin-right: 6px;
}
.layui-layer-prompt .layui-layer-input {
width: 300px;
margin: 0;
border: 1px solid #dcdfe6;
border-radius: 3px;
box-shadow: none;
}
.layui-layer-prompt .layui-layer-input:focus {
border: 1px solid #409eff;
}
.layui-layer-prompt .layui-layer-input:hover {409eff
border: 1px solid #c0c4cc;
}
</style>
<script type="text/javascript" src="/compliance/org/commons/lib/management/tripledes.js"></script>
<script type="text/javascript" src="/compliance/org/commons/lib/management/management.min.js?v=1.23"></script>
<script type="text/javascript">
//在management.js中用到的一些国际化字符串。
zr.messages = {
applicationId: "8082_compliance",
button_ok: "确定",
button_cancel: "取消",
button_next: "下一步",
button_prev: "上一步",
button_done: "完成",
label_prompt: "提示",
label_message: "消息",
}
</script>
<!-- 老图标库,兼容老代码(不建议使用) -->
<link type="text/css" rel="stylesheet" href="/compliance/org/commons/lib/theme/icon/css/fontello.css"/>
<link type="text/css" rel="stylesheet" href="/compliance/org/commons/lib/theme/theme2.css?v=1.8"/>
<!-- 新的图标库,作为特殊字体引入 -->
<style type="text/css">
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(/compliance/org/commons/lib/quasar/material-icons1.13.14.woff2) format('woff2');
}
.material-icons {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
display: inline-block;
}
@font-face {
font-family: 'Material Icons Outlined';
font-style: normal;
font-weight: 400;
src: url(/compliance/org/commons/lib/quasar/material-icons-outlined1.13.14.woff2) format('woff2');
}
.material-icons-outlined {
font-family: 'Material Icons Outlined';
font-style: normal;
font-weight: 400;
display: inline-block;
}
</style>
<link type="text/css" rel="stylesheet" href="/compliance/org/commons/lib/artDialog/skins/blue.css?v=1.3"/>
<script type="text/javascript" src="/compliance/org/commons/lib/artDialog/dialog.min.js?v=1.3"></script>
<script type="text/javascript" src="/compliance/org/commons/lib/artDialog/plugins/iframeTools.js?v=1.3"></script>
<script type="text/javascript" src="/compliance/org/commons/lib/artDialog/minmax.js?v=1.3"></script>
<style type="text/css">
.aui_outer {
border-radius: 5px;
box-shadow: 0 0 6px rgb(97,97,97);
}
/* 标题栏及四周留白 */
.aui_nw, .aui_n, .aui_ne {
height: 40px;
background-color: white;
}
.aui_w, .aui_e {
width: 16px;
background-color: white;
background-image: none;
}
.aui_sw, .aui_s, .aui_se {
height: 12px;
background-color: white;
background-image: none;
}
.aui_nw { border-radius: 5px 0 0 0; }
.aui_ne { border-radius: 0 5px 0 0; }
.aui_sw { border-radius: 0 0 0 5px; }
.aui_se { border-radius: 0 0 5px 0; }
.aui_titleBar {
bottom: 40px;
}
.aui_title {
padding: 6px 75px 0 0;
font-size: 16px;
color: #333;
font-weight: 500;
text-shadow: none;
}
.aui_close {
top: 6px;
right: 0px;
color: #666;
font-size: 18px;
}
/* 最小化最大化按钮 */
.d_button {
position: absolute;
top: 7px;
width: 20px;
height: 20px;
font-size: 14px;
color: #666;
}
.d_button.min {
right: 50px;
}
.d_button.max, .d_button.restore {
right: 25px;
}
.aui_close:hover, .d_button:hover {
color: red;
background-color: rgb(238,238,238);
}
.aui_close i, .d_button i {
width: 20px;
height: 20px;
line-height:20px;
}
</style>
<link type="text/css" rel="stylesheet" href="/compliance/rmm/function/fulltext/laypage/laypage.css"/>
<script type="text/javascript" src="/compliance/rmm/function/fulltext/laypage/laypage.js"></script>
<script type="text/javascript" src="https://law.chemicalsafety.org.cn:443/compliance//rmm/RmmAPI.js.jsp"> </script>
<title>化学品安全法规标准合规平台</title>
<style type="text/css">
.filterContent {
width:900px;
}
.gridContent {
width:900px;
}
.solrContent {
width:900px;
}
@media screen and (min-width: 768px) and (max-width: 1200px) {
.filterContent {
width:700px;
}
.gridContent {
width:700px;
}
.solrContent {
width:700px;
}
}
.title-bar {
width:1200px;height:120px;background-color:rgb(47,64,87); border-radius:8px;
background-image: url(/compliance/guild/regulation/images/bg_fg@2x.debeb2b5.png);
background-repeat: no-repeat;
background-size:100%;
}
.title-bar .title{font-weight:400; font-size:24px; line-height:33px; text-align:center; color:#fff; width:100%; margin-top:10px !important;}
.property-bar {
width:1130px;height:140px;background-color:rgb(255,255,255);
margin-top:-75px !important;;margin-left:35px !important;; border-radius:8px;
box-shadow: 0 2px 3px 0 rgba(0,0,0,.15);
}
.record-property {font-weight:600;font-size:14px;line-height:20px; text-align:right; width:80px !important; min-width:80px !important;}
.text-bar {
font-weight: bolder;
font-size: 15px;
margin-left: 15px !important;
margin-top: 15px !important;
background-color: #4c75ad;
color: #fff;
line-height: 32px;
text-indent: 10px;
}
.reference {height:auto; line-height:19px; border-bottom: 1px dotted #eee; margin-bottom:0px !important;padding-bottom:5px}
.link {cursor:pointer; color:#1890ff}
.link:hover {text-decoration: underline}
/*滚动条样式*/
.scrollbar::-webkit-scrollbar {/*滚动条整体样式*/
width: 6px; /*高宽分别对应横竖滚动条的尺寸*/
height: 1px;
}
.scrollbar::-webkit-scrollbar-thumb {/*滚动条里面小方块*/
border-radius: 10px;
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
background: #bed5ec;;
}
.scrollbar::-webkit-scrollbar-track {/*滚动条里面轨道*/
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
border-radius: 10px;
background: #EDEDED;
}
.row{margin-top:5px; overflow:hidden; margin-right:13px; cursor:pointer;margin-left: 5px;}
.item{
line-height:24px;font-size:13px; float:left;;
}
.focus{border:1px solid #cbcbcb;background-color: rgb(233,242,246);}
.item : hover{color:blue; text-decoration: underline}
a{color:blue;cursor:pointer}
a:hover{text-decoration: underline;}
.nav-file {
padding-left: 0;
margin-bottom: 0;
list-style: none;
/**flex-direction: row;
display: -ms-flexbox;
display: flex;
-ms-flex-direction: column;
flex-direction: column;
**/
}
.file-item {
position: relative;
/*display: inline-block;*/
overflow: auto;
background-color: hsla(0,0%,100%,.2);
border-radius: .1875rem;
min-width: 120px;
cursor:pointer;
}
.datagrid-view td {
border-color:rgb(242,242,242);
background: white;
}
.panel-header, .panel-body {
border-color: rgb(242,242,242);
background: white;
padding-top: 10px;
}
.datagrid-header, .datagrid-toolbar, .datagrid-pager, .datagrid-footer-inner {
border-color: rgb(242,242,242);
background: white;
}
.datagrid-header-row td {
background: rgb(242,242,242);
}
.datagrid-header-row, .datagrid-row {
height: 42px;
}
</style>
<script type="text/javascript">
var moduleId = 2;
var libraryId = "3382332752445153";
var focusMenType = "countryTech";
var userId = 497836;
var account = "3382654008212160";
var nodeId = 0;
var key = "标题";
var type = "国家标准";
var keyContent = "";
var status1 = "";
var status2 = "";
var status3 = "";
var gkUnit = [];
var keysAll = "";
var isLoadGrid = false;
//查询的页码和返回记录数量。
//注意,每次查询返回一批记录(后台排序),在前端进行翻页。
var pageNo = 0;
var _pageNo = 0;
var pageSize = 10;
var reset = false;
String.prototype.replaceAll = function (from, to) {
var reg = new RegExp(from, "g"); //g 表示全部替换。
return this.replace(reg, to);
}
$(function(){
// 禁用打印、保存功能
document.addEventListener('keydown', function(e) {
if (e.key === 'Print' || e.key === 'p' || e.key === 'c' || e.key === 's'|| e.keyCode === 44) {
e.preventDefault();
}
});
var keyList = [
{"value": "标题", "text": "标题"},
{"value": "内容", "text": "内容"}
]
$('#key').combobox('loadData', keyList);
//切换类型
$("#key").combobox({
onSelect: function (row) {
},
onUnselect:function(row){
},
onHidePanel:function(){},
onLoadSuccess: function () {},
onChange:function(n,o){
if (!reset) {
if (n != o) {
/*
if (n == '标题' || $("#content").val() == "") {
key = n;
keyContent = $("#content").val();
loadCatalogTree();
} else if (n=='内容') {
key = n;
keyContent = $("#content").val();
if (keyContent.length > 1) {
loadCatalogTree();
} else {
zr.notice("检索内容长度不能小于2个字符!");
return false;
}
}
*/
key = n;
loadCatalogTree();
}
}
}
});
var gkList = [{"value":11997,"text":"全国移动电站标准化技术委员会"},...,{"value":12048,"text":"美国劳工部"}];
$('#gkUnit').combobox('loadData', gkList);
//设置下拉框可以输入
$("#gkUnit").combobox({editable: true, valueField: 'value', textField: 'text',filter: function(q, row){ var opts = $(this).combobox('options'); return row[opts.textField].indexOf(q) > -1; } });
//加载Header
//$("#Header").attr("src", "/compliance/guild/main/model/Header.jsp?focusMenu=" + focusMenType);
//加载Footer
//$("#Footer").attr("src", "/compliance/guild/main/model/Footer.jsp");
//加载Header
$("#Header").load("/compliance/guild/main/model/Header.jsp?focusMenu=" + focusMenType);
//加载Footer
$("#Footer").load("/compliance/guild/main/model/Footer.jsp");
//加载分类树
loadCatalogTree();
//切换状态
$("#btnStatusAll").click(function(){
status1 = "";
status2 = "";
status3 = "";
$("#btnStatusAll").css("background","#1787fc");
$("#btnStatusAll").css("color","white");
$("#btnStatus1").css("background","white");
$("#btnStatus1").css("color","#000");
$("#btnStatus2").css("background","white");
$("#btnStatus2").css("color","#000");
$("#btnStatus3").css("background","white");
$("#btnStatus3").css("color","#000");
loadCatalogTree();
});
$("#btnStatus1").click(function(){
if (status1 == "即将实施") {
$("#btnStatus1").css("background","white");
$("#btnStatus1").css("color","#000");
status1 = "";
if (status2 == '' && status3 == '') {
$("#btnStatusAll").css("background","#1787fc");
$("#btnStatusAll").css("color","white");
}
} else {
$("#btnStatusAll").css("background","white");
$("#btnStatusAll").css("color","#000");
$("#btnStatus1").css("background","#1787fc");
$("#btnStatus1").css("color","white");
status1 = "即将实施";
}
loadCatalogTree();
});
$("#btnStatus2").click(function(){
if (status2 == "现行") {
$("#btnStatus2").css("background","white");
$("#btnStatus2").css("color","#000");
status2 = "";
if (status1 == '' && status3 == '') {
$("#btnStatusAll").css("background","#1787fc");
$("#btnStatusAll").css("color","white");
}
} else {
$("#btnStatusAll").css("background","white");
$("#btnStatusAll").css("color","#000");
$("#btnStatus2").css("background","#1787fc");
$("#btnStatus2").css("color","white");
status2 = "现行";
}
loadCatalogTree()
});
$("#btnStatus3").click(function(){
if (status3 == "废止") {
$("#btnStatus3").css("background","white");
$("#btnStatus3").css("color","#000");
status3 = "";
if (status1 == '' && status2 == '') {
$("#btnStatusAll").css("background","#1787fc");
$("#btnStatusAll").css("color","white");
}
} else {
$("#btnStatusAll").css("background","white");
$("#btnStatusAll").css("color","#000");
$("#btnStatus3").css("background","#1787fc");
$("#btnStatus3").css("color","white");
status3 = "废止";
}
loadCatalogTree();
});
//切换归口单位
$("#gkUnit").combobox({
onSelect: function (row) {
gkUnit.push(row.value);
loadCatalogTree();
},
onUnselect:function(row){
for (var i=0;i<gkUnit.length;i++) {
if (row.value == gkUnit[i]) {
gkUnit.splice(i,1);
}
}
//loadCatalogTree();
},
onHidePanel:function(){},
onChange:function(n,o){
if (n == '') {
//loadCatalogTree();
}
}
})
//输入框支持回车事件
document.getElementById('content').addEventListener('keydown', function(event) {
if (event.key === "Enter") {
event.preventDefault(); // 阻止默认的回车提交行为
// 在这里执行你的代码
var gk = $("#gkUnit").combobox("getValue");
if (gkUnit.length == 0 && gk != "") {
$("#gkUnit").combobox("setValue","");
}
loadCatalogTree();
}
});
//查询
$("#btnSearch").click(function(){
var gk = $("#gkUnit").combobox("getValue");
if (gkUnit.length == 0 && gk != "") {
$("#gkUnit").combobox("setValue","");
}
/*
key = $("#key").combobox("getValue");
keyContent = $("#content").val();
if (key == '标题' || keyContent == ''){
$('#grid').datagrid('options').sortName = "";
$('#grid').datagrid('options').sortOder = "";
loadCatalogTree();
} else {
if (keyContent.length > 1) {
$('#grid').datagrid('options').sortName = "";
$('#grid').datagrid('options').sortOder = "";
loadCatalogTree();
} else {
zr.notice("检索内容长度不能小于2个字符!");
return false;
}
}
*/
loadCatalogTree();
});
//重置
$("#btnReset").click(function(){
reset = true;
keyContent = "";
status1 = "";
status2 = "";
status3 = "";
gkUnit = [];
keysAll = "";
$("#content").val('');
$("#btnStatusAll").css("background","#1787fc");
$("#btnStatusAll").css("color","white");
$("#btnStatus1").css("background","white");
$("#btnStatus1").css("color","#000");
$("#btnStatus2").css("background","white");
$("#btnStatus2").css("color","#000");
$("#btnStatus3").css("background","white");
$("#btnStatus3").css("color","#000");
$("input[name='searchType']").get(0).checked = true;
$("#gkUnit").combobox("setValue","");
$("#btnDateAll").css("background","#1787fc");
$("#btnDateAll").css("color","white");
$("#btnDate1").css("background","white");
$("#btnDate1").css("color","#000");
$("#btnDate2").css("background","white");
$("#btnDate2").css("color","#000");
$("#btnDate3").css("background","white");
$("#btnDate3").css("color","#000");
$("#btnDate4").css("background","white");
$("#btnDate4").css("color","#000");
$("#btnDate5").css("background","white");
$("#btnDate5").css("color","#000");
$("#ssrqStartTime").textbox("setValue","");
$("#ssrqEndTime").textbox("setValue","");
key = "标题";
//$("#solrContainer").css("display","none");
//$("#gridContainer").css("display","block");
$("#key").combobox("setValue","标题");
loadCatalogTree();
});
//切换查询模式
$("input[name='searchType']").change(function() {
var gk = $("#gkUnit").combobox("getValue");
if (gkUnit.length == 0 && gk != "") {
$("#gkUnit").combobox("setValue","");
}
/*
key = $("#key").combobox("getValue");
keyContent = $("#content").val();
if (key == '标题' || keyContent == ''){
$('#grid').datagrid('options').sortName = "";
$('#grid').datagrid('options').sortOder = "";
loadCatalogTree();
} else {
if (keyContent.length > 1) {
$('#grid').datagrid('options').sortName = "";
$('#grid').datagrid('options').sortOder = "";
loadCatalogTree();
} else {
zr.notice("检索内容长度不能小于2个字符!");
return false;
}
}
*/
loadCatalogTree();
});
//切换实施日期
$("#btnDateAll").click(function(){
$("#btnDateAll").css("background","#1787fc");
$("#btnDateAll").css("color","white");
$("#btnDate1").css("background","white");
$("#btnDate1").css("color","#000");
$("#btnDate2").css("background","white");
$("#btnDate2").css("color","#000");
$("#btnDate3").css("background","white");
$("#btnDate3").css("color","#000");
$("#btnDate4").css("background","white");
$("#btnDate4").css("color","#000");
$("#btnDate5").css("background","white");
$("#btnDate5").css("color","#000");
$("#ssrqStartTime").textbox("setValue","");
$("#ssrqEndTime").textbox("setValue","");
loadCatalogTree();
});
//近一月
$("#btnDate1").click(function(){
$("#btnDateAll").css("background","white");
$("#btnDateAll").css("color","#000");
$("#btnDate1").css("background","#1787fc");
$("#btnDate1").css("color","white");
$("#btnDate2").css("background","white");
$("#btnDate2").css("color","#000");
$("#btnDate3").css("background","white");
$("#btnDate3").css("color","#000");
$("#btnDate4").css("background","white");
$("#btnDate4").css("color","#000");
$("#btnDate5").css("background","white");
$("#btnDate5").css("color","#000");
var currentDate = new Date();
var d=new Date(currentDate);
d.setMonth(d.getMonth()-1);
var m=d.getMonth()+1;
$("#ssrqStartTime").textbox("setValue",d.getFullYear()+'-'+m+'-'+d.getDate());
var _m = currentDate.getMonth()+1;
$("#ssrqEndTime").textbox("setValue",currentDate.getFullYear()+'-'+_m+'-'+currentDate.getDate());
loadCatalogTree();
});
//近三月
$("#btnDate2").click(function(){
$("#btnDateAll").css("background","white");
$("#btnDateAll").css("color","#000");
$("#btnDate2").css("background","#1787fc");
$("#btnDate2").css("color","white");
$("#btnDate3").css("background","white");
$("#btnDate3").css("color","#000");
$("#btnDate1").css("background","white");
$("#btnDate1").css("color","#000");
$("#btnDate4").css("background","white");
$("#btnDate4").css("color","#000");
$("#btnDate5").css("background","white");
$("#btnDate5").css("color","#000");
var currentDate = new Date();
var d=new Date(currentDate);
d.setMonth(d.getMonth()-3);
var m=d.getMonth()+1;
$("#ssrqStartTime").textbox("setValue",d.getFullYear()+'-'+m+'-'+d.getDate());
var _m = currentDate.getMonth()+1;
$("#ssrqEndTime").textbox("setValue",currentDate.getFullYear()+'-'+_m+'-'+currentDate.getDate());
loadCatalogTree();
});
//近一年
$("#btnDate3").click(function(){
$("#btnDateAll").css("background","white");
$("#btnDateAll").css("color","#000");
$("#btnDate3").css("background","#1787fc");
$("#btnDate3").css("color","white");
$("#btnDate2").css("background","white");
$("#btnDate2").css("color","#000");
$("#btnDate1").css("background","white");
$("#btnDate1").css("color","#000");
$("#btnDate4").css("background","white");
$("#btnDate4").css("color","#000");
$("#btnDate5").css("background","white");
$("#btnDate5").css("color","#000");
var currentDate = new Date();
var d=new Date(currentDate);
d.setYear(d.getFullYear()-1);
var m=d.getMonth()+1;
$("#ssrqStartTime").textbox("setValue",d.getFullYear()+'-'+m+'-'+d.getDate());
var _m = currentDate.getMonth()+1;
$("#ssrqEndTime").textbox("setValue",currentDate.getFullYear()+'-'+_m+'-'+currentDate.getDate());
loadCatalogTree();
});
//近两年
$("#btnDate4").click(function(){
$("#btnDateAll").css("background","white");
$("#btnDateAll").css("color","#000");
$("#btnDate4").css("background","#1787fc");
$("#btnDate4").css("color","white");
$("#btnDate2").css("background","white");
$("#btnDate2").css("color","#000");
$("#btnDate1").css("background","white");
$("#btnDate1").css("color","#000");
$("#btnDate3").css("background","white");
$("#btnDate3").css("color","#000");
$("#btnDate5").css("background","white");
$("#btnDate5").css("color","#000");
var currentDate = new Date();
var d=new Date(currentDate);
d.setYear(d.getFullYear()-2);
var m=d.getMonth()+1;
$("#ssrqStartTime").textbox("setValue",d.getFullYear()+'-'+m+'-'+d.getDate());
var _m = currentDate.getMonth()+1;
$("#ssrqEndTime").textbox("setValue",currentDate.getFullYear()+'-'+_m+'-'+currentDate.getDate());
loadCatalogTree();
});
//近三年
$("#btnDate5").click(function(){
$("#btnDateAll").css("background","white");
$("#btnDateAll").css("color","#000");
$("#btnDate5").css("background","#1787fc");
$("#btnDate5").css("color","white");
$("#btnDate2").css("background","white");
$("#btnDate2").css("color","#000");
$("#btnDate1").css("background","white");
$("#btnDate1").css("color","#000");
$("#btnDate3").css("background","white");
$("#btnDate3").css("color","#000");
$("#btnDate4").css("background","white");
$("#btnDate4").css("color","#000");
var currentDate = new Date();
var d=new Date(currentDate);
d.setYear(d.getFullYear()-3);
var m=d.getMonth()+1;
$("#ssrqStartTime").textbox("setValue",d.getFullYear()+'-'+m+'-'+d.getDate());
var _m = currentDate.getMonth()+1;
$("#ssrqEndTime").textbox("setValue",currentDate.getFullYear()+'-'+_m+'-'+currentDate.getDate());
loadCatalogTree();
});
$('#ssrqStartTime').datebox({
onHidePanel : function() {
var start = $("#ssrqStartTime").textbox("getValue");
var end = $("#ssrqEndTime").textbox("getValue");
if (start != "" || end != "") {
$("#btnDateAll").css("background","white");
$("#btnDateAll").css("color","#000");
$("#btnDate5").css("background","white");
$("#btnDate5").css("color","#000");
$("#btnDate2").css("background","white");
$("#btnDate2").css("color","#000");
$("#btnDate1").css("background","white");
$("#btnDate1").css("color","#000");
$("#btnDate3").css("background","white");
$("#btnDate3").css("color","#000");
$("#btnDate4").css("background","white");
$("#btnDate4").css("color","#000");
loadCatalogTree();
}
if (start != "" && end != "") {
var startDate = new Date(Date.parse(start));
var endDate = new Date(Date.parse(end));
var d =new Date();
var m=d.getMonth()+1;
var sysDate = d.getFullYear()+'-'+m+'-'+d.getDate();
if (end == sysDate) {
var d1=new Date(endDate);
d1.setMonth(d1.getMonth()-1);
var m1=d1.getMonth()+1+"";
if (m1.length == 1) {
m1 = "0"+m1;
}
var start1 = d1.getFullYear()+'-'+m1+'-'+d1.getDate();
var d2=new Date(endDate);
d2.setMonth(d2.getMonth()-3);
var m2=d2.getMonth()+1+"";
if (m2.length == 1) {
m2 = "0"+m2;
}
var start2 = d2.getFullYear()+'-'+m2+'-'+d2.getDate();
//alert(start2);
var d3=new Date(endDate);
d3.setYear(d3.getFullYear()-1);
var m3=d3.getMonth()+1+"";
if (m3.length == 1) {
m3 = "0"+m3;
}
var start3 = d3.getFullYear()+'-'+m3+'-'+d3.getDate();
var d4=new Date(endDate);
d4.setYear(d4.getFullYear()-2);
var m4=d4.getMonth()+1+"";
if (m4.length == 1) {
m4 = "0"+m4;
}
var start4 = d4.getFullYear()+'-'+m4+'-'+d4.getDate();
var d5=new Date(endDate);
d5.setYear(d5.getFullYear()-3);
var m5=d5.getMonth()+1+"";
if (m5.length == 1) {
m5 = "0"+m5;
}
var start5 = d5.getFullYear()+'-'+m5+'-'+d5.getDate();
if (start1 == start) {
$("#btnDate1").css("background","#1787fc");
$("#btnDate1").css("color","white");
} else if (start2 == start) {
$("#btnDate2").css("background","#1787fc");
$("#btnDate2").css("color","white");
} else if (start3 == start) {
$("#btnDate3").css("background","#1787fc");
$("#btnDate3").css("color","white");
} else if (start4 == start) {
$("#btnDate4").css("background","#1787fc");
$("#btnDate4").css("color","white");
} else if (start5 == start) {
$("#btnDate5").css("background","#1787fc");
$("#btnDate5").css("color","white");
}
}
}
}
});
$('#ssrqEndTime').datebox({
onHidePanel : function() {
var start = $("#ssrqStartTime").textbox("getValue");
var end = $("#ssrqEndTime").textbox("getValue");
if (start != "" || end != "") {
$("#btnDateAll").css("background","white");
$("#btnDateAll").css("color","#000");
$("#btnDate5").css("background","white");
$("#btnDate5").css("color","#000");
$("#btnDate2").css("background","white");
$("#btnDate2").css("color","#000");
$("#btnDate1").css("background","white");
$("#btnDate1").css("color","#000");
$("#btnDate3").css("background","white");
$("#btnDate3").css("color","#000");
$("#btnDate4").css("background","white");
$("#btnDate4").css("color","#000");
loadCatalogTree();
}
if (start != "" && end != "") {
var startDate = new Date(Date.parse(start));
var endDate = new Date(Date.parse(end));
var d =new Date();
var m=d.getMonth()+1;
var sysDate = d.getFullYear()+'-'+m+'-'+d.getDate();
if (end == sysDate) {
var d1=new Date(endDate);
d1.setMonth(d1.getMonth()-1);
var m1=d1.getMonth()+1+"";
if (m1.length == 1) {
m1 = "0"+m1;
}
var start1 = d1.getFullYear()+'-'+m1+'-'+d1.getDate();
var d2=new Date(endDate);
d2.setMonth(d2.getMonth()-3);
var m2=d2.getMonth()+1+"";
if (m2.length == 1) {
m2 = "0"+m2;
}
var start2 = d2.getFullYear()+'-'+m2+'-'+d2.getDate();
var d3=new Date(endDate);
d3.setYear(d3.getFullYear()-1);
var m3=d3.getMonth()+1+"";
if (m3.length == 1) {
m3 = "0"+m3;
}
var start3 = d3.getFullYear()+'-'+m3+'-'+d3.getDate();
var d4=new Date(endDate);
d4.setYear(d4.getFullYear()-2);
var m4=d4.getMonth()+1+"";
if (m4.length == 1) {
m4 = "0"+m4;
}
var start4 = d4.getFullYear()+'-'+m4+'-'+d4.getDate();
var d5=new Date(endDate);
d5.setYear(d5.getFullYear()-3);
var m5=d5.getMonth()+1+"";
if (m5.length == 1) {
m5 = "0"+m5;
}
var start5 = d5.getFullYear()+'-'+m5+'-'+d5.getDate();
if (start1 == start) {
$("#btnDate1").css("background","#1787fc");
$("#btnDate1").css("color","white");
} else if (start2 == start) {
$("#btnDate2").css("background","#1787fc");
$("#btnDate2").css("color","white");
} else if (start3 == start) {
$("#btnDate3").css("background","#1787fc");
$("#btnDate3").css("color","white");
} else if (start4 == start) {
$("#btnDate4").css("background","#1787fc");
$("#btnDate4").css("color","white");
} else if (start5 == start) {
$("#btnDate5").css("background","#1787fc");
$("#btnDate5").css("color","white");
}
}
}
}
});
})
function loadCatalogTree(){
keyContent = $("#content").val();
nodeId = 0;
var queryParams = {};
if (key == "标题" || keyContent == '') {
if (isLoadGrid == true) {
$('#grid').datagrid('options').sortName = "";
$('#grid').datagrid('options').sortOder = "";
}
$("#solrContainer").css("display","none");
$("#gridContainer").css("display","block");
queryParams["moduleId"] = moduleId;
queryParams["libraryId"] = libraryId;
queryParams["nodeId"] = nodeId;
queryParams["keyContent"] = keyContent;
queryParams["status1"] = status1;
queryParams["status2"] = status2;
queryParams["status3"] = status3;
queryParams["type"] = type;
queryParams["gkUnit"] = gkUnit;
queryParams["fbUnit"] = [];
queryParams["industry"] = [];
queryParams["local"] = "";
queryParams["group"] = [];
queryParams["startDate"] = $("#ssrqStartTime").textbox("getValue").replaceAll("-","$");
queryParams["endDate"] = $("#ssrqEndTime").textbox("getValue").replaceAll("-","$");
if ($("#accurate").prop("checked")) {
queryParams["searchType"] = "精确";
} else {
queryParams["searchType"] = "模糊";
}
loadGrid();
queryTreeInfo(queryParams);
} else {
keyContent = $("#content").val().replace(/\s+/g, '');
if (keyContent.length < 2) {
zr.notice("检索内容长度不能小于2个字符!");
return false;
}
$("#solrContainer").css("display","block");
$("#gridContainer").css("display","none");
pageNo = 0;
_pageNo = 0;
doQuery();
queryParams["moduleId"] = moduleId;
queryParams["libraryId"] = libraryId;
queryParams["nodeId"] = nodeId;
queryParams["keyContent"] = keyContent;
queryParams["type"] = "技术标准";
queryParams["status1"] = status1;
queryParams["status2"] = status2;
queryParams["status3"] = status3;
queryParams["regulationType1"] = "";
queryParams["regulationType2"] = "";
queryParams["regulationType3"] = "";
queryParams["regulationType4"] = "";
queryParams["regulationType5"] = "";
queryParams["techType1"] = "国家标准";
queryParams["techType2"] = "";
queryParams["techType3"] = "";
queryParams["techType4"] = "";
queryParams["group"] = [];
queryParams["industry"] = [];
queryParams["local"] = "";
queryParams["fbUnit"] = [];
queryParams["gkUnit"] = gkUnit;
queryParams["startDate"] = $("#ssrqStartTime").textbox("getValue").replaceAll("-","$");
queryParams["endDate"] = $("#ssrqEndTime").textbox("getValue").replaceAll("-","$");
queryParams["scStartDate"] ="";
queryParams["scEndDate"] = "";
if ($("#accurate").prop("checked")) {
queryParams["searchType"] = "精确";
} else {
queryParams["searchType"] = "模糊";
}
setTimeout(function() {
queryTreeInfo(queryParams);
},900);
}
}
function queryTreeInfo(queryParams) {
_loadCatalogTree(queryParams).then(function(data) {
$("#firstCatalogLevel").html("");
var html = "";
//debugger;
for (var i=0;i<data.length;i++) {
if (i==0) {
$("#firstCatalogLevel").append("<li id = '"+data[i].id+"' class='file-item' style = 'color:white;background: #1787fc;padding:10px 5px 5px 35px;margin-top: -15px;font-size:14px' title = '"+data[i].title+"'>"+
" <span onclick=\"searchContent('"+data[i].id+"')\">"+data[i].text+"</span>"+
" </li>");
nodeId = data[i].id;
} else {
//debugger;
var state = data[i].state;
if (!state) {
html = "<li id = '"+data[i].id+"' class='file-item' style = 'color:#000;padding:10px 5px 5px 17px;' title = '"+data[i].title+"'>"+
" <i id = '"+data[i].id+"_add' class='material-icons-outlined' style='font-size:13px;' onclick=\"openCatalogItem('"+data[i].id+"')\">add</i> "+
" <i id = '"+data[i].id+"_remove' class='material-icons-outlined' style='font-size:13px;display:none' onclick=\"closeCatalogItem('"+data[i].id+"')\">remove</i> "+
" <span onclick=\"searchContent('"+data[i].id+"')\">"+data[i].text+"</span>"+
" </li>"
$("#firstCatalogLevel").append(html);
var childrenHtml = "<ul id = 'CatalogLevel_"+data[i].id+"' class='nav-file' style='min-width:10px;display:none'></ul>";
$("#firstCatalogLevel").append(childrenHtml);
/*
for (var j=0;j<childrenList.length;j++) {
html = "<li id = '"+childrenList[j].id+"' class='file-item' style = 'color:#000;padding:10px 5px 5px 45px;' title = '"+childrenList[j].title+"'>"+
" <span onclick=\"searchContent('"+childrenList[j].id+"')\">"+childrenList[j].text+"</span>"+
" </li>"
$("#CatalogLevel_"+data[i].id).append(html);
}
*/
} else {
html = "<li id = '"+data[i].id+"' class='file-item' style = 'color:#000;padding:10px 5px 5px 35px;font-size:14px' title = '"+data[i].title+"'>"+
" <span onclick=\"searchContent('"+data[i].id+"')\">"+data[i].text+"</span>"+
" </li>"
$("#firstCatalogLevel").append(html);
}
}
}
if (key == "标题" || keyContent == '') {
//loadGrid();
}
//zr.hideLoading();
reset = false;
}).catch(function(err) {
zr.alert("获取信息出错了" + zr.getErrorMsg(err));
});
}
function openCatalogItem(id){
$("#"+id+"_add").hide();
$("#"+id+"_remove").show();
//判断展开的节点是否已经存在了,存在了则直接显示
if ($("#CatalogLevel_"+id).html()!= "") {
$("#CatalogLevel_"+id).show();
} else {
//zr.showLoading();
var queryParams = {};
if (key == '标题' || keyContent == '') {
queryParams["moduleId"] = moduleId;
queryParams["libraryId"] = libraryId;
queryParams["nodeId"] = id;
queryParams["keyContent"] = keyContent;
queryParams["status1"] = status1;
queryParams["status2"] = status2;
queryParams["status3"] = status3;
queryParams["type"] = type;
queryParams["gkUnit"] = gkUnit;
queryParams["fbUnit"] = [];
queryParams["industry"] = [];
queryParams["local"] = "";
queryParams["group"] = [];
queryParams["startDate"] = $("#ssrqStartTime").textbox("getValue").replaceAll("-","$");
queryParams["endDate"] = $("#ssrqEndTime").textbox("getValue").replaceAll("-","$");
if ($("#accurate").prop("checked")) {
queryParams["searchType"] = "精确";
} else {
queryParams["searchType"] = "模糊";
}
} else {
queryParams["moduleId"] = moduleId;
queryParams["libraryId"] = libraryId;
queryParams["nodeId"] = id;
queryParams["keyContent"] = keyContent;
queryParams["type"] = "技术标准";
queryParams["status1"] = status1;
queryParams["status2"] = status2;
queryParams["status3"] = status3;
queryParams["regulationType1"] = "";
queryParams["regulationType2"] = "";
queryParams["regulationType3"] = "";
queryParams["regulationType4"] = "";
queryParams["regulationType5"] = "";
queryParams["techType1"] = "国家标准";
queryParams["techType2"] = "";
queryParams["techType3"] = "";
queryParams["techType4"] = "";
queryParams["group"] = [];
queryParams["industry"] = [];
queryParams["local"] = "";
queryParams["fbUnit"] = [];
queryParams["gkUnit"] = gkUnit;
queryParams["startDate"] = $("#ssrqStartTime").textbox("getValue").replaceAll("-","$");
queryParams["endDate"] = $("#ssrqEndTime").textbox("getValue").replaceAll("-","$");
queryParams["scStartDate"] ="";
queryParams["scEndDate"] = "";
if ($("#accurate").prop("checked")) {
queryParams["searchType"] = "精确";
} else {
queryParams["searchType"] = "模糊";
}
}
_loadCatalogTree(queryParams).then(function(data) {
var html = "";
//debugger;
//var childrenHtml = "<ul id = 'CatalogLevel_"+id+"' class='nav-file' style='min-width:10px;'></ul>";
//$("#"+id).append(childrenHtml);
for (var i=0;i<data.length;i++) {
var state = data[i].state;
if (!state) {
html = "<li id = '"+data[i].id+"' class='file-item' style = 'color:#000;padding:10px 5px 5px 45px;background:white;font-size:14px;' title = '"+data[i].title+"'>"+
" <i id = '"+data[i].id+"_add' class='material-icons-outlined' style='font-size:13px;' onclick=\"openCatalogItem('"+data[i].id+"')\">add</i> "+
" <i id = '"+data[i].id+"_remove' class='material-icons-outlined' style='font-size:13px;display:none' onclick=\"closeCatalogItem('"+data[i].id+"')\">remove</i> "+
" <span onclick=\"searchContent('"+data[i].id+"')\">"+data[i].text+"</span>"+
" </li>"
$("#CatalogLevel_"+id).append(html);
} else {
html = "<li id = '"+data[i].id+"' class='file-item' style = 'color:#000;padding:10px 5px 5px 45px;font-size:14px;background:white' title = '"+data[i].title+"'>"+
" <span onclick=\"searchContent('"+data[i].id+"')\">"+data[i].text+"</span>"+
" </li>"
$("#CatalogLevel_"+id).append(html);
}
}
//zr.hideLoading();
$("#CatalogLevel_"+id).show();
}).catch(function(err) {
zr.alert("获取信息出错了" + zr.getErrorMsg(err));
});
}
}
function closeCatalogItem(id){
$("#"+id+"_add").show();
$("#"+id+"_remove").hide();
$("#CatalogLevel_"+id).hide();
}
function searchContent(id) {
$("#"+nodeId).css("color","#000");
$("#"+nodeId).css("background","white");
$("#"+id).css("color","white");
$("#"+id).css("background","#1787fc");
nodeId = id;
$('#grid').datagrid('options').sortName = "";
$('#grid').datagrid('options').sortOder = "";
if (key == '标题' || keyContent == '') {
if (isLoadGrid == true) {
$('#grid').datagrid('options').sortName = "";
$('#grid').datagrid('options').sortOder = "";
}
loadGrid();
} else {
pageNo = 0;
_pageNo = 0;
doQuery();
}
}
function loadGrid(){
isLoadGrid = true;
$("#grid").datagrid({
title: "",
pageSize:10,
pageList:[10,20,50],
pageNumber:1,
fit: true,
nowrap:false,
pagination :true,
rownumbers : false,
scrollbarSize : 0 ,
singleSelect : true,
remoteSort : true,
checkOnSelect : false,
selectOnCheck : false,
showFooter : true,
columns:[[
{field: 'order', title: "序号", width: 60, align: "center", halign: "center",
formatter:function(cellvalue,row,index){
if(row.status == '01'){
return "<a style='color:#0cc50c; text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>" + cellvalue + "</a>";
} else if (row.status == '03') {
return "<a style='color:#fe6666; text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>" + cellvalue + "</a>";
} else {
return "<a style='color:#000;text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>" + cellvalue + "</a>";
}
}
},
{field: 'number', title: "文件编号", width:220, align: "left", halign: "left",sortable:true,order:'asc',
formatter:function(cellvalue,row,index){
if (cellvalue && cellvalue != "undefined") {
if ($("#accurate").prop("checked")) {
cellvalue = cellvalue.replaceAll(keyContent, "<font color='red' style='font-weight:bold'>" + keyContent + "</font>");
} else {
for (var j=0;j<keysAll.length;j++) {
cellvalue = cellvalue.replaceAll(keysAll[j], "<font color='red' style='font-weight:bold'>" + keysAll[j] + "</font>");
}
}
}
if(row.status == '01'){
return "<a style='color:#0cc50c; text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>" + cellvalue + "</a>";
//return "<span style='color:#0cc50c;'>"+cellvalue+"</span>";
} else if (row.status == '03') {
//return "<span style='color:#fe6666'>"+cellvalue+"</span>";
return "<a style='color:#fe6666; text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>" + cellvalue + "</a>"
} else if (row.status == '02'){
//return cellvalue;
return "<a style='color:#000;text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>" + cellvalue + "</a>"
} else {
return cellvalue;
}
}
},
{field: 'title', title: "文件名称", width: 380, align: "left", halign: "left",sortable:true,order:'asc',
formatter:function(cellvalue,row,index){
var titles = "";
if (cellvalue != null && cellvalue != "undefined") {
if ($("#accurate").prop("checked")) {
cellvalue = cellvalue.replaceAll(keyContent, "<font color='red' style='font-weight:bold'>" + keyContent + "</font>");
} else {
for (var j=0;j<keysAll.length;j++) {
cellvalue = cellvalue.replaceAll(keysAll[j], "<font color='red' style='font-weight:bold'>" + keysAll[j] + "</font>");
}
}
var number = row.number;
if (number) {
number = number.replaceAll("\"", "'");
} else {
number = "";
}
var title = row.title;
if (title) {
title = title.replaceAll("\"", "'");
} else {
title = "";
}
var enTitle = row.englishTitle;
if (enTitle) {
enTitle = enTitle.replaceAll("\"", "'");
} else {
enTitle = "";
}
titles = "<span style='font-weight:bold;font-size:13px'>文件编号:</span><span style='font-size:13px'>"+number+"</span><br>"+
"<span style='font-weight:bold;font-size:13px'>文件名称:</span><span style='font-size:13px'>"+title+"</span><br>"+
"<span style='font-weight:bold;font-size:13px'>英文名称:</span><span style='font-size:13px'>"+enTitle+"</span><br>"+
"<span style='font-weight:bold;font-size:13px'>发布部门:</span><span style='font-size:13px'>"+row.fbjgs+"<br>"+
"<span style='font-weight:bold;font-size:13px'>发布日期:</span><span style='font-size:13px'>"+row.fbrq+"<br>"+
"<span style='font-weight:bold;font-size:13px'>实施日期:</span><span style='font-size:13px'>"+row.ssrq;
}
if(row.status == '01'){
return "<a title = \""+titles+"\" class='tip' style='color:#0cc50c; text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>" + cellvalue + "</a>";
//return "<span style='color:#0cc50c;'>"+cellvalue+"</span>";
} else if (row.status == '03') {
//return "<span style='color:#fe6666'>"+cellvalue+"</span>";
return "<a title = \""+titles+"\" class='tip' style='color:#fe6666; text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>" + cellvalue + "</a>";
} else {
//return cellvalue;
return "<a title = \""+titles+"\" class='tip' style='color:#000;text-decoration:none;' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>" + cellvalue + "</a>";
}
}
},
{field: 'ssrq', title: "实施日期", width: 90, align: "center", halign: "left",sortable:true,order:'desc',
formatter:function(cellvalue,row,index){
if(row.status == '01'){
return "<a style='color:#0cc50c; text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>" + cellvalue + "</a>";
} else if (row.status == '03') {
//return "<span style='color:#fe6666'>"+cellvalue+"</span>";
return "<a style='color:#fe6666; text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>" + cellvalue + "</a>";
} else {
//return cellvalue;
return "<a style='color:#000;text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>" + cellvalue + "</a>";
}
}
},
{field: 'status', title: "状态", width: 70, align: "center", halign: "left",sortable:true,order:'desc',
formatter:function(cellvalue,row,index){
if(row.status == '01'){
return "<a style='color:#0cc50c; text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>即将生效</a>";
} else if (row.status == '03') {
//return "<span style='color:#fe6666'>"+cellvalue+"</span>";
return "<a style='color:#fe6666; text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>废止</a>";
} else {
//return cellvalue;
return "<a style='color:#000;text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>现行</a>";
}
}
},
{field: 'count', title: "点击量", width: 60, align: "center", halign: "left",sortable:true,order:'desc',
formatter:function(cellvalue,row,index){
if(row.status == '01'){
return "<a style='color:#0cc50c; text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>" + cellvalue + "</a>";
} else if (row.status == '03') {
//return "<span style='color:#fe6666'>"+cellvalue+"</span>";
return "<a style='color:#fe6666; text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>" + cellvalue + "</a>";
} else {
//return cellvalue;
return "<a style='color:#000;text-decoration:none' href='javascript:openDynAttachmentTech(\"" + row.id + "\",\"" + row.attId + "\")'>" + cellvalue + "</a>";
}
}
}
]],
rowStyler: function(index, row) {
//此处可以添加条件
return 'background-color:white;';
},
onSelect: function (index,row) {
},
onLoadSuccess: function (data) {
if(data.rows.length > 0) {
var height = 140;
for(var i=0;i<data.rows.length;i++){
height = height + 42;
}
$("#gridContainer").css("height",height+"px");
$("#gridContainer").css("margin-bottom","0px");
$("#grid").datagrid("resize");
} else {
$("#gridContainer").css("height","150px");
$("#gridContainer").css("margin-bottom","-10px");
$("#grid").datagrid("resize");
}
//var info = $(".pagination-info").html();
$(".datagrid-header-row td div span").each(function(i,th){
var val = $(th).text();
$(th).html("<label style='font-weight:bolder;'>"+val+"</label>");
});
if (data.rows == 0) {
//zr.notice("暂无数据!");
//添加一个新数据行,第一列的值为你需要的提示信息,然后将其他列合并到第一列来,注意修改colspan参数为你columns配置的总列数
$(this).datagrid('appendRow', {order: '<div style="text-align:center;color:black;font-size:15px">暂无数据!</div>' }).datagrid('mergeCells', { index: 0, field: 'order', colspan: 6 })
//隐藏分页导航条,这个需要熟悉datagrid的html结构,直接用jquery操作DOM对象,easyui datagrid没有提供相关方法隐藏导航条
//$(this).closest('div.datagrid-wrap').find('div.datagrid-pager').hide();
} else {
//鼠标放上进行浮动显示
$(".tip").tooltip({
onShow: function(){
$(this).tooltip('tip').css({
width:'350',
height:'auto',
padding:'10',
'line-height':'1.6',
'background-color':'white',
boxShadow: '1px 1px 3px #292929'
});
}
});
}
},
loader : function (params,success,error) {
var queryParams = {};
var index = (params.page - 1) * params.rows;
var count = params.rows;
queryParams["index"] = index;
queryParams["count"] = count;
if (params.sort) {
queryParams["sortName"] = params.sort;
} else {
queryParams["sortName"] = "";
}
if (params.order) {
queryParams["sortOrder"] = params.order;
} else {
queryParams["sortOrder"] = "";
}
queryParams["libraryId"] = "3382332752445153";
queryParams["moduleId"] = 2;
queryParams["nodeId"] = nodeId;
//queryParams["key"] = key;
queryParams["keyContent"] = keyContent;
queryParams["status1"] = status1;
queryParams["status2"] = status2;
queryParams["status3"] = status3;
queryParams["type"] = type;
queryParams["gkUnit"] = gkUnit;
queryParams["fbUnit"] = [];
queryParams["industry"] = [];
queryParams["local"] = "";
queryParams["group"] = [];
queryParams["startDate"] = $("#ssrqStartTime").textbox("getValue").replaceAll("-","$");
queryParams["endDate"] = $("#ssrqEndTime").textbox("getValue").replaceAll("-","$");
if ($("#accurate").prop("checked")) {
queryParams["searchType"] = "精确";
} else {
queryParams["searchType"] = "模糊";
}
_loadGrid(queryParams).then(function(data) {
keysAll = data.keysAll.split(",");
var easyuiData = {};
easyuiData.rows = data.rows;
easyuiData.total = data.total;
success(easyuiData);
}).catch(function(err) {
zr.alert("获取信息出错了" + zr.getErrorMsg(err));
});
}
});
}
//*********************************全文检索查询*******************************************//
//查询,每次返回一批记录。
function doQuery() {
//zr.showLoading();
var queryParams = {};
var index = _pageNo * pageSize;
var count = pageSize;
queryParams["index"] = index;
queryParams["count"] = count;
queryParams["libraryId"] = libraryId;
queryParams["moduleId"] = moduleId;
queryParams["nodeId"] = nodeId;
queryParams["keyContent"] = keyContent;
queryParams["type"] = "技术标准";
queryParams["status1"] = status1;
queryParams["status2"] = status2;
queryParams["status3"] = status3;
queryParams["regulationType1"] = "";
queryParams["regulationType2"] = "";
queryParams["regulationType3"] = "";
queryParams["regulationType4"] = "";
queryParams["regulationType5"] = "";
queryParams["techType1"] = "国家标准";
queryParams["techType2"] = "";
queryParams["techType3"] = "";
queryParams["techType4"] = "";
queryParams["group"] = [];
queryParams["industry"] = [];
queryParams["local"] = "";
queryParams["fbUnit"] = [];
queryParams["gkUnit"] = gkUnit;
queryParams["startDate"] = $("#ssrqStartTime").textbox("getValue").replaceAll("-","$");
queryParams["endDate"] = $("#ssrqEndTime").textbox("getValue").replaceAll("-","$");
queryParams["scStartDate"] ="";
queryParams["scEndDate"] = "";
if ($("#accurate").prop("checked")) {
queryParams["searchType"] = "精确";
} else {
queryParams["searchType"] = "模糊";
}
_loadGrid(queryParams).then(function(data) {
$("#solrContent").empty();
$("#solrContainer").css("height","auto");
if (data.listTotal == 0) {
var html = "<div style='margin-top:30px; font-size:15px;text-align:center'>暂无数据!</div>";
$("#solrContent").html(html);
$("#layPage").empty();
return;
}
//debugger;
var queryResult = data.list;
var solrKeyWords = data.queryWordList.split(",");
//console.log(data.listTotal);
var html = "<div style='margin-top:-10px;margin-bottom:10px;font-size:15px;color:#00AA91'>共:"+data.listTotal+"条数据</div>";
for (var i = 0; i < queryResult.length; i++) {
html += '<div style="margin-bottom:20px;">';
//记录标题
var recordTitle = zr.htmlCoder.forHtml(queryResult[i].title);
if ($("#accurate").prop("checked")) {
recordTitle = recordTitle.replaceAll(keyContent, "<font color='red' style='font-weight:bold'>" + keyContent + "</font>");
} else {
for (var j=0;j<solrKeyWords.length;j++) {
recordTitle = recordTitle.replaceAll(solrKeyWords[j], "<font color='red' style='font-weight:bold'>" + solrKeyWords[j] + "</font>");
}
}
/*
var titles = "<span style='font-weight:bold;font-size:13px'>文件编号:</span><span style='font-size:13px'>"+queryResult[i].number.replaceAll("\"", "'")+"</span><br>"+
"<span style='font-weight:bold;font-size:13px'>文件名称:</span><span style='font-size:13px'>"+queryResult[i].title.replaceAll("\"", "'")+"</span><br>"+
"<span style='font-weight:bold;font-size:13px'>英文名称:</span><span style='font-size:13px'>"+queryResult[i].englishTitle.replaceAll("\"", "'")+"</span><br>"+
"<span style='font-weight:bold;font-size:13px'>发布部门:</span><span style='font-size:13px'>"+queryResult[i].fbjgs+"<br>"+
"<span style='font-weight:bold;font-size:13px'>发布日期:</span><span style='font-size:13px'>"+queryResult[i].fbrq+"<br>"+
"<span style='font-weight:bold;font-size:13px'>实施日期:</span><span style='font-size:13px'>"+queryResult[i].ssrq;
*/
html += ' <div style="font-size:16px; line-height:22px; margin-bottom:4px;">' +
' <a title = "文件编号:'+queryResult[i].number.replaceAll("\"", "'")+'" class="tip" style="color:#000; cursor:pointer; text-decoration:none;" onclick="openDynAttachmentTechSolr(\'' + queryResult[i].id + '\',\'' + queryResult[i].attId + '\')">' + recordTitle + '</a>';
//if (showLibrary) {
//html += ' <span style="color:#2440b3; margin-left:20px;">- ' + zr.htmlCoder.forHtml(rows[i].libraryName) +'</span>';
//}
//状态
if (zr.htmlCoder.forHtml(queryResult[i].status) == '02') {
html += ' <div style = "width:70px;background-color: rgb(29, 150, 224);float:right"><span style="color:white; margin-left:20px;font-size:14px;">现行</span></div>';
} else if (zr.htmlCoder.forHtml(queryResult[i].status) == '03') {
html += ' <div style = "width:70px;background-color: rgb(255, 0, 0);float:right"><span style="color:white; margin-left:20px;font-size:14px;">废止</span></div>';
} else {
html += ' <div style = "width:70px;background-color: rgb(12, 197, 12);float:right"><span style="color:white; margin-left:5px;font-size:14px;">即将生效</span></div>';
}
html += ' </div>';
//摘要
if (queryResult[i].highlights) {
var highlight = zr.htmlCoder.forHtml(queryResult[i].highlights);
//替换掉图片格式的文件识别出来的乱码问题,后续可能还会累加排除
highlight = highlight.replace("!> ••·••<I","");
highlight = highlight.replace(/@key-start/g, "<span style='color:red;font-weight:bold'>").replace(/@key-end/g, "</span>");
html += '<div style="line-height:20px; font-size:13px;">' +
highlight +
'</div>';
}
//其他属性
var text = "发布部门: " + queryResult[i].fbjgs+ ", ";
text += "发布日期: " + queryResult[i].fbrq+ ", ";
text += "实施日期: " + queryResult[i].ssrq;
html += '<div style="line-height:20px; font-size:13px; color:#999999;margin-top:5px;width:850px"> '+
'<span>' + zr.htmlCoder.forHtml(text) + '</span> '+
'<span style="float:right"><i class="material-icons" style="font-size:14px;width:20px;">back_hand</i>点击量: '+zr.htmlCoder.forHtml(queryResult[i].count)+ '</span> '+
'</div>';
html += '</div>';
}
$("#solrContent").html(html);
//zr.hideLoading();
$("#layPage").append('<div id="page"></div>');
var nums = pageSize; //每页出现的数量
var pages = Math.ceil(data.listTotal/nums); //得到总页数
//调用分页
laypage({
cont: 'page',
pages: pages,
skip: true, //是否开启跳页
skin: 'molv',
groups: 5, //连续显示分页数
curr: pageNo || 1, //当前页
jump: function(obj, first){
if (!first){
pageNo = obj.curr;
_pageNo = obj.curr - 1;
doQuery();
}
}
});
}).catch(function(err) {
zr.alert("获取信息出错了" + zr.getErrorMsg(err));
});
}
//鼠标放上进行浮动显示
$(".solrTip").tooltip({
onShow: function(){
$(this).tooltip('solrTip').css({
width:'350',
height:'auto',
padding:'10',
'line-height':'1.6',
'background-color':'white',
boxShadow: '1px 1px 3px #292929'
});
}
});
function openDynAttachmentTech(_recordId,_attachmentId) {
window.open(zr.basic.getBasePath()+"/guild/tech/TechBrowse.jsp?moduleId="+moduleId+"&recordId="+_recordId+"&libraryId="+libraryId+"&attachmentId="+_attachmentId);
}
function openDynAttachmentTechSolr(_recordId,_attachmentId) {
//window.open(zr.basic.getBasePath()+"/guild/tech/TechBrowse.jsp?moduleId="+moduleId+"&recordId="+_recordId+"&libraryId="+libraryId+"&attachmentId="+_attachmentId);
if (_attachmentId == 0) {
return false;
}
window.open("/compliance/guild/browser/Convert.jsp?attachmentId=" + _attachmentId + "&storeFileId=0&recordId=" + _recordId + "&libraryId=" + libraryId+"&moduleId=" + moduleId + "&style=old");
}
//************************************************前后台交互方法***********************************************************//
function _loadCatalogTree(_params) {
var basePath = zr.getBasePath();
//模块名:guild, 服务名:CustomerSearchService, 方法名:getCategoryTreeByTech
var command = 'CMMF70EDB9F095022BA2F04F37BA700898DA00E2FD4BC353A49FC4211D223FF93C57DE846BE0C7EC4D0D63F85E2928F8E482DF9425E7CF3C0033442AA8A1B5ABFDF';
if (key == '内容' && keyContent != '') {
//模块名:guild, 服务名:CustomerSearchService, 方法名:getCategoryTreeBySolr
command = 'CMMF70EDB9F095022BA2F04F37BA700898DA00E2FD4BC353A49FC4211D223FF93C57DE846BE0C7EC4D0D63F85E2928F8E4836F2870A880AB67E274F0E03EDA3A587';
}
return zr.zrBasic.callService$(basePath, command, null, [_params], 'json', null,40000).then(function(data) {
if (data) {
return JSON.parse(data);
} else {
return null;
}
});
}
function _loadGrid(_params) {
var basePath = zr.getBasePath();
//模块名:guild, 服务名:CustomerSearchService, 方法名:getTechInfo
var command = 'CMMF70EDB9F095022BA2F04F37BA700898DA00E2FD4BC353A49FC4211D223FF93C5FAED3FC6ADA3751358B5AE46FF751BD8';
if (key == '内容' && keyContent != '') {
//模块名:guild, 服务名:CustomerSearchService, 方法名:getSearchSolrInfo
command = 'CMMF70EDB9F095022BA2F04F37BA700898DA00E2FD4BC353A49FC4211D223FF93C584B02D4B2C8572F61F4E005098BD520B5F90B2D96B834BD7';
}
return zr.zrBasic.callService$(basePath, command, null, [_params], 'json', null,40000).then(function(data) {
if (data) {
return JSON.parse(data);
} else {
return null;
}
});
}
</script>
</head>
<body class="flexbox-v height100" style="background-color:rgb(242,242,242)">
<div class="flex1" style="margin-bottom:0px">
<div id="Header" frameborder="0" scrolling="no" style="box-sizing:border-box;width:100%;height:115px;margin:0px; padding:0px;"></div>
</div>
<div class="flexbox-h" style="margin-bottom:0px">
<div class="flex1" ></div>
<div id="mainCatalogList" class="flexbox-v scrollbar" style="width:250px;height:auto;margin-top:10px;overflow:auto;border-radius: 5px;background: #fff;box-shadow: 0 2px 3px 0 rgba(0,0,0,.15);">
<ul id = "firstCatalogLevel" class="nav-file" style="min-width:250px">
</ul>
</div>
<div class="flexbox-v" style="">
<div class="flexbox-h filterContent" style = "height:180px;background-color:rgb(255,255,255);margin-left:15px;margin-top:10px;border-top: 5px solid #1587fc;box-shadow: 0 2px 3px 0 rgba(0,0,0,.15);">
<form id="form" class="flexbox-v flex1" style="padding-right:30px;padding-top:20px;">
<div class="flexbox-h" style = "padding-top:5px;margin-left:-30px">
<label class="form-label" style="font-weight: bolder;font-size:14px;">关键字:</label>
<input class="easyui-combobox" id="key" name="key" data-options="value:'标题'" style=""/>
<div class="flexbox-h flex4" >
<input class=input-text id="content" name="content" autocomplete = "off" placeholder="请输入检索内容" data-options="" style=""/>
<a class="easyui-linkbutton btn-primary l-btn" id="btnSearch" style="background:#1787fc"><i class='material-icons' style='font-size:14px;width:20px;'>search</i><span style="font-size:14px">查询</span></a>
<a class="easyui-linkbutton l-btn" id="btnReset" style="background:white;color:#000;border:1px solid #cbcbcb"><i class='material-icons' style='font-size:14pxwidth:20px;'>loop</i><span style="font-size:14px">重置</span></a>
</div>
<div class="flexbox-h flex2" >
<div class="input-groupbox">
<label><input id="accurate" name="searchType" type="radio" class="checkbox-align" checked/>精确查询</label>
<label><input id="vague" name="searchType" type="radio" class="checkbox-align"/>模糊查询</label>
</div>
</div>
</div>
<div class="flexbox-h" style = "margin-left:-30px">
<label class="form-label" style="font-weight: bolder;font-size:14px;">标准状态:</label>
<a class="easyui-linkbutton btn-primary l-btn" id="btnStatusAll" style="background:#1787fc;color:white"><span style="font-size:14px">全部</span></a>
<a class="easyui-linkbutton l-btn" id="btnStatus1" style="background:white;color:#000;"><span style="font-size:14px">即将实施</span></a>
<a class="easyui-linkbutton l-btn" id="btnStatus2" style="background:white;color:#000;"><span style="font-size:14px">现行</span></a>
<a class="easyui-linkbutton l-btn" id="btnStatus3" style="background:white;color:#000;"><span style="font-size:14px">废止</span></a>
<label class="form-label" style="font-weight: bolder;font-size:14px;">归口单位:</label>
<input class="easyui-combobox" id="gkUnit" name="gkUnit" data-options="" style="width:300px"/>
</div>
<div class="flexbox-h" style = "margin-left:-30px">
<label class="form-label" style="font-weight: bolder;font-size:14px;">实施日期:</label>
<a class="easyui-linkbutton btn-primary l-btn" id="btnDateAll" style="background:#1787fc;color:white"><span style="font-size:14px">全部</span></a>
<a class="easyui-linkbutton l-btn" id="btnDate1" style="background:white;color:#000;"><span style="font-size:14px">近一月</span></a>
<a class="easyui-linkbutton l-btn" id="btnDate2" style="background:white;color:#000;"><span style="font-size:14px">近三月</span></a>
<a class="easyui-linkbutton l-btn" id="btnDate3" style="background:white;color:#000;"><span style="font-size:14px">近一年</span></a>
<a class="easyui-linkbutton l-btn" id="btnDate4" style="background:white;color:#000;"><span style="font-size:14px">近两年</span></a>
<a class="easyui-linkbutton l-btn" id="btnDate5" style="background:white;color:#000;"><span style="font-size:14px">近三年</span></a>
<input id="ssrqStartTime" name="ssrqStartTime" class="easyui-datebox"/>
<span style="line-height:30px" style="">~</span>
<input id="ssrqEndTime" name="ssrqEndTime" class="easyui-datebox" />
</div>
</form>
</div>
<div id="gridContainer" class="flexbox-h gridContent" style = "background-color:rgb(255,255,255);margin-top:0px;margin-left:15px;box-shadow: 0 2px 3px 0 rgba(0,0,0,.15);height:510px;">
<table id="grid" style = ""></table>
</div>
<div id="solrContainer" class="solrContent" style="background-color:rgb(255,255,255);margin-top:0px;margin-left:15px;box-shadow: 0 2px 3px 0 rgba(0,0,0,.15);height:510px;overflow:hide;">
<div id="solrContent" style = "padding: 15px;"></div>
<div class="flexbox-h" style="height:26px;margin-bottom:5px">
<div id="layPage"></div>
<!--
<a id="btnNextPage" class="easyui-linkbutton btn-danger" style="height:24px; margin-left:30px;display:none;">下一批</a>
-->
</div>
</div>
</div>
<div class="flex1"></div>
</div>
<div class="flex1" style="margin-bottom:0px">
<div id="Footer" frameborder="0" scrolling="no" style="box-sizing:border-box;width:100%;height:100%;margin:0px; padding:0px;"></div>
</div>
</body>
</html>
技术原理
概述
该PDF提取方法的本质是"利用前端为渲染内容必须暴露的资源信息,绕开表层交互限制,直接对接后台资源接口 "。其可行性的根本原因在于:前端的交互限制(如禁用右键、屏蔽快捷键、隐藏按钮等)仅作用于用户操作层面,无法实现真正的资源隔离。
更重要的是,在当前实现模式下,后端若未采用额外的安全控制手段------例如将PDF动态转换为图片、切分为自定义的页面碎片(page fragments)、或通过流式加密传输等方式------就几乎不可避免地需要将完整的原始PDF资源地址暴露给前端。因为无论是预览还是下载,浏览器最终都必须能向后端发起一个可独立访问的请求来获取文件内容。
因此,只要后端仍以标准PDF文件形式提供服务,且依赖前端传递明文参数(如 attachmentId)来构造下载链接,那么这些关键信息就必然存在于页面源码或网络请求中,从而为从前端提取原始PDF文件提供了天然且难以规避的入口。
前端表层权限限制的非隔离性
目标页面虽做了前端操作限制,但这类限制仅作用于用户交互层面,不具备真正的资源隔离能力,具体表现为:
- 事件拦截的局限性 :页面通过
document.addEventListener('keydown', ...)拦截了Print、p、c、s等按键事件,禁用了打印、复制、保存等基础操作,同时可能隐藏了右键菜单。但这类拦截仅针对DOM事件流,无法阻止开发者直接通过控制台操作DOM、提取脚本中的数据,也无法隐藏已加载到前端的资源路径与参数。 - 前端校验的可绕过性 :页面的PDF访问入口(
openDynAttachmentTech、openDynAttachmentTechSolr函数)仅做了前端页面跳转逻辑,未对后台资源接口做额外加密或权限校验(本例中:后台仅验证了用户登录态,未验证细分的如VIP权限等),这为直接提取资源接口提供了前提。 - 表层防护的核心目的 :这类前端限制的核心是增加普通用户的操作门槛,而非阻止技术人员获取资源,后台的PDF资源隔离仍依赖于
attachmentId、libraryId等唯一参数,而非前端的交互限制。
原始PDF资源接口与关键参数的挖掘逻辑
提取PDF的核心是从前端源码中挖掘后台PDF资源的访问接口与必要参数,核心步骤如下:
- 访问入口函数溯源 :通过分析页面源码,可找到PDF的前端访问入口函数
openDynAttachmentTech和openDynAttachmentTechSolr,这两个函数接收_recordId(记录ID)和_attachmentId(附件ID)两个核心参数,拼接后跳转至PDF预览页面(TechBrowse.jsp、Convert.jsp)。 - 后台下载接口的匹配 :目标站点的原始PDF下载接口遵循固定格式(
/compliance/rmm/function/record/downloadFile.action?attachmentId=xxx),该接口会硬编码在前端脚本中,或通过后台接口返回至前端。通过正则表达式(/\/compliance\/rmm\/function\/record\/downloadFile\.action\?attachmentId=[\w\d]+/)可遍历页面所有脚本标签,匹配出完整的接口路径(包含唯一attachmentId参数)。 - 关键参数的提取与确认 :访问后台PDF资源的必要参数均已在前端暴露:
attachmentId:PDF附件的唯一标识,从页面行数据、交互函数参数或脚本中提取;libraryId、moduleId:站点资源库与模块标识,在前端全局变量中直接定义(如var libraryId = "3382332752445153";);- 这些参数是后台定位具体PDF资源的核心,缺少任一参数均无法获取有效资源。
完整PDF访问URL的拼接原理
挖掘到接口路径与关键参数后,需拼接成可直接访问的绝对URL,核心逻辑如下:
- 根域名补全 :页面
<head>标签中定义了base href="https://law.chemicalsafety.org.cn:443/compliance/",提取根域名(https://law.chemicalsafety.org.cn),与匹配到的后台接口路径(如/compliance/rmm/function/record/downloadFile.action?attachmentId=xxx)拼接,形成完整的绝对URL。 - 参数完整性校验 :确保拼接后的URL包含所有必要参数(核心为
attachmentId),后台通过这些参数查询对应PDF资源,返回文件流供查看或下载。 - URL的可用性验证 :拼接后的URL具备两种核心能力:
- 直接在浏览器新窗口打开(
window.open),触发后台返回PDF预览页面或原始文件流; - 通过
<a>标签的download属性,触发浏览器直接下载PDF文件,并可自定义下载文件名。
- 直接在浏览器新窗口打开(
通用方法:手动提取原始PDF地址的步骤
方法一:直接探测标准 PDF 资源路径(推荐)
该方法适用于目标站点将PDF文件以标准格式存放在可预测路径下,或在页面加载/预览过程中直接请求原始PDF资源的场景。由于无需依赖特定接口逻辑,且能绕过前端交互限制,此方法在多数现代Web应用中具有较高成功率。
操作步骤如下:
-
打开开发者工具并监控网络请求
- 按
F12打开开发者工具,切换到 Network(网络)面板; - 勾选 Preserve log(保留日志),防止页面跳转清空记录;
- 刷新页面,确保完整加载文档内容。
- 按
-
捕获 PDF 资源请求
- 在 Network 面板的筛选器中输入
pdf或选择 Media / Doc 类型; - 查找 Type 为
application/pdf的请求条目; - 若存在,直接右键该请求 → "Open in new tab" 即可获取原始PDF。
- 在 Network 面板的筛选器中输入
-
分析预览资源路径以推测PDF位置
-
若页面使用图片或HTML方式预览(如 pdf2htmlEX),观察其资源URL结构:
https://example.com/upload/pages/GB50160-2008_1.jpg -
尝试将路径中的
_1.jpg替换为.pdf,构造候选地址:https://example.com/upload/GB50160-2008.pdf
-
-
利用页面变量辅助构造路径
-
在 Console 中执行:
jsconsole.log({ recordId, title, libraryId, attachmentId }); -
结合常见命名规则(如
{title}.pdf、{recordId}.pdf)生成可能的URL。
-
-
批量验证候选地址
- 将构造出的URL在新标签页中打开;
- 若返回PDF内容(HTTP 200 + 正确MIME类型),即为有效地址。
方法二:从页面源码中提取后端下载接口地址
该方法适用于系统通过统一文件服务接口(如 downloadFile.action)提供下载,且关键参数(如 attachmentId)以明文形式嵌入前端脚本的场景。
操作步骤如下:
-
定位"下载"按钮及其点击事件逻辑
-
在页面上找到"下载"按钮(即使被禁用或隐藏);
-
右键该按钮 → "检查"(Inspect),在 Elements 面板中查看其 ID 或 class(如
#btn3); -
切换到 Console,执行:
jsgetEventListeners(document.querySelector('#btn3'))(需安装 Chrome 插件或使用内置调试工具)
-
或直接在 Sources 面板 中搜索按钮ID(如
btn3.click),定位绑定的事件处理函数。
-
-
查看事件处理函数中的下载逻辑
-
在事件函数内部寻找类似代码:
jsvar src = "/xxxxx/downloadFile.action?attachmentId=DABF6C52FA37F0BD"; $("body").append("<iframe src='" + src + "' ...>"); -
提取其中的
attachmentId值(通常为16位十六进制字符串)。
-
-
备选:全局搜索页面源码
- 若无法定位按钮事件,可查看页面源码(
Ctrl+U); - 搜索关键词:
downloadFile.action、attachmentId=、.action?attachmentId=; - 从
<script>标签中提取完整的URL或参数。
- 若无法定位按钮事件,可查看页面源码(
-
拼接完整下载地址
-
将提取到的
attachmentId与站点域名拼接:https://xxx.com/xxxxx/downloadFile.action?attachmentId=DABF6C52FA37F0BD
-
-
验证地址有效性
- 在新标签页中打开该URL;
- 若当前会话有效,浏览器将触发下载或预览。
自动化提取脚本实战
提取PDF脚本:完整功能版
js
// PDF下载地址提取脚本(完整功能版,适配目标站点详情页)
(function() {
try {
// 步骤1:提取下载接口路径(从页面JS中匹配硬编码的下载地址)
let downloadPath = '';
// 正则匹配下载接口格式:/compliance/...?attachmentId=xxx
const downloadReg = /\/compliance\/rmm\/function\/record\/downloadFile\.action\?attachmentId=[\w\d]+/;
// 遍历所有脚本标签,提取匹配的路径
const scriptTags = document.querySelectorAll('script');
for (let script of scriptTags) {
const scriptContent = script.textContent || '';
const matchResult = scriptContent.match(downloadReg);
if (matchResult && matchResult[0]) {
downloadPath = matchResult[0];
break;
}
}
// 容错:未找到下载地址
if (!downloadPath) {
alert('❌ 未找到PDF下载地址!请确认页面是否包含下载按钮。');
return;
}
// 步骤2:拼接完整PDF下载URL(拼接目标域名)
const baseDomain = 'https://law.chemicalsafety.org.cn';
const fullPdfUrl = baseDomain + downloadPath;
// 提取附件ID作为文件名(用于下载命名)
const attachmentId = downloadPath.split('attachmentId=')[1] || 'unknown_file';
const pdfFileName = `危险化学品企业特殊作业安全规范_${attachmentId}.pdf`;
// 步骤3:复制PDF链接到剪贴板(现代方法优先,失败则降级)
function copyToClipboard(text) {
// 现代剪贴板API(安全上下文下可用)
if (navigator.clipboard && window.isSecureContext) {
return navigator.clipboard.writeText(text)
.then(() => true)
.catch(() => fallbackCopy(text));
} else {
// 降级方案:创建临时文本框
return fallbackCopy(text);
}
}
// 降级复制方法(兼容旧浏览器/非安全上下文)
function fallbackCopy(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
// 隐藏文本框(防止页面抖动)
textArea.style.position = 'fixed';
textArea.style.top = '0';
textArea.style.left = '0';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.focus();
textArea.select(); // 选中文本
try {
const successful = document.execCommand('copy');
return successful;
} catch (err) {
console.error('降级复制失败:', err);
return false;
} finally {
document.body.removeChild(textArea); // 移除临时元素
}
}
// 执行复制操作并获取结果
let isCopySuccess = false;
const copyPromise = copyToClipboard(fullPdfUrl);
// 处理Promise和同步返回值
if (copyPromise instanceof Promise) {
copyPromise.then(success => {
isCopySuccess = success;
}).catch(() => {
isCopySuccess = false;
});
} else {
isCopySuccess = copyPromise;
}
// 步骤4:创建「查看PDF」按钮(绿色,右上角顶部)
const viewBtn = document.createElement('a');
viewBtn.href = '#'; // 阻止默认跳转
viewBtn.style.cssText = `
position: fixed; top: 20px; right: 20px; z-index: 9999;
padding: 12px 20px; background: #4CAF50; color: white;
text-decoration: none; border-radius: 4px; font-size: 14px;
cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
`;
viewBtn.textContent = `查看 PDF 文件`;
// 点击事件:新页面打开PDF
viewBtn.addEventListener('click', function(e) {
e.preventDefault();
window.open(fullPdfUrl, '_blank');
alert('✅ 已在新窗口打开PDF文件!\n若未弹出,请检查浏览器弹窗拦截设置。');
});
document.body.appendChild(viewBtn);
// 步骤5:创建「下载PDF」按钮(蓝色,查看按钮下方)
const downloadBtn = document.createElement('a');
downloadBtn.href = fullPdfUrl;
downloadBtn.download = pdfFileName;
downloadBtn.style.cssText = `
position: fixed; top: 70px; right: 20px; z-index: 9999;
padding: 12px 20px; background: #2196F3; color: white;
text-decoration: none; border-radius: 4px; font-size: 14px;
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
`;
downloadBtn.textContent = `下载 PDF 文件`;
// 点击事件:附加提示(可选,增强体验)
downloadBtn.addEventListener('click', function() {
setTimeout(() => {
alert('✅ 已触发PDF下载!\n若未开始下载,请检查浏览器下载设置或网络状态。');
}, 500);
});
document.body.appendChild(downloadBtn);
// 步骤6:友好的弹窗提示(详细版)
const alertMessage = isCopySuccess
? `✅ 操作成功!
🔗 PDF完整下载地址已复制到剪贴板:
${fullPdfUrl}
👀 页面右上角新增「查看 PDF 文件」按钮(绿色),点击可在新页面打开;
📥 「下载 PDF 文件」按钮(蓝色)在查看按钮下方,可直接下载命名后的PDF。`
: `⚠️ PDF地址提取成功,但复制到剪贴板失败!
🔗 PDF完整下载地址:
${fullPdfUrl}
👀 页面右上角新增「查看 PDF 文件」按钮(绿色),点击可在新页面打开;
📥 「下载 PDF 文件」按钮(蓝色)在查看按钮下方,可直接下载命名后的PDF。`;
alert(alertMessage);
// 控制台日志(便于调试和二次提取)
console.log('✅ 提取到的完整PDF下载地址:', fullPdfUrl);
console.log(`✅ 剪贴板复制状态:${isCopySuccess ? '成功' : '失败'}`);
console.log(`✅ 拟下载文件名称:${pdfFileName}`);
console.log('✅ 页面已生成「查看」和「下载」按钮,位于右上角!');
} catch (error) {
console.error('❌ 提取失败:', error);
alert(`❌ 提取PDF下载地址失败:\n${error.message}`);
}
})();
提取PDF脚本:精简版
(function(){try{let e="",t=/\/compliance\/rmm\/function\/record\/downloadFile\.action\?attachmentId=[\w\d]+/;const n=document.querySelectorAll("script");for(let o of n){const a=o.textContent||"";const i=a.match(t);if(i&&i[0]){e=i[0];break}}if(!e)return alert("❌ 未找到PDF下载地址!"),!1;const r="https://law.chemicalsafety.org.cn",s=r+e,c=document.createElement("a");c.href=s,c.download=`危险化学品规范_${e.split("attachmentId=")[1]}.pdf`,c.style.cssText="position:fixed;top:20px;right:20px;z-index:9999;padding:12px 20px;background:#2196F3;color:#fff;text-decoration:none;border-radius:4px;font-size:14px;box-shadow:0 2px 4px rgba(0,0,0,0.2)",c.textContent="查看/下载 PDF",c.addEventListener("click",function(){window.open(s,"_blank");setTimeout(()=>{alert("✅ 已触发PDF查看/下载!")},300)}),document.body.appendChild(c),console.log("✅ PDF完整地址:",s),alert(`✅ PDF地址提取成功!
🔗 地址:${s}
👉 右上角已生成「查看/下载 PDF」按钮`)}catch(o){console.error("❌ 提取失败:",o),alert(`❌ 提取失败:\n${o.message}`)}})();
脚本使用方法
-
打开目标法规详情页
- 访问具体文档页面(确保页面包含"下载"按钮)。
- 登录账号。
-
打开Chrome浏览器开发者工具
- 在页面上右键 → 选择"检查" ,或直接按键盘快捷键
F12或Ctrl+Shift+I(Windows/Linux) /Cmd+Option+I(Mac)。
- 在页面上右键 → 选择"检查" ,或直接按键盘快捷键
-
切换到 Console(控制台)面板
- 在开发者工具顶部标签栏中点击 "Console"。
-
粘贴脚本代码
- 将 完整功能版 或 精简版 的 JavaScript 代码完整复制;
- 在 Console 中右键 → 选择"粘贴" ,或使用快捷键
Ctrl+V/Cmd+V。
-
执行脚本
- 按下键盘上的
Enter键运行代码。
- 按下键盘上的
-
查看结果
- 页面右上角将自动出现两个按钮:
- "查看PDF":点击在新标签页预览 PDF;
- "下载PDF":点击直接下载文件。
- 同时会弹出提示框,显示提取到的完整 PDF 下载地址。
- 页面右上角将自动出现两个按钮:
💡 建议:首次使用推荐 完整功能版 ,便于查看错误信息和调试;熟悉后可使用 精简版 快速操作。
注意事项
本文分享的方法与脚本,仅适用于个人学习、研究或获取有权限的文档。在使用过程中,需严格遵守相关法律法规和网站的用户协议,不得用于非法获取受版权保护的文档,避免侵权风险。