<style type="text/css">
|
td {
|
border: 1px solid #ccc;
|
}
|
|
#tbGKList input {
|
text-align: center;
|
width: 100%;
|
min-height: 30px;
|
}
|
|
#tbGKListYuanCheng tr {
|
text-align: center;
|
width: 100%;
|
min-height: 30px;
|
}
|
</style>
|
<form class="form-horizontal" id="wdsjform" method="post" xmlns:th="http://www.w3.org/1999/xhtml">
|
<div class="portlet box ltblue">
|
<div class="portlet-title">
|
文档数据信息
|
<div class="caption">
|
<i class="fa fa-reorder"></i>
|
</div>
|
<div class="tools">
|
<a class="collapse" onclick="portlet_body_ShowOrHide(this);"></a>
|
</div>
|
</div>
|
<input id="ncSyncStorageUrl" name="ncSyncStorageUrl" th:value="${ncSyncStorageUrl}" class="form-control col-sm-7" type="hidden" />
|
<input id="readNcFileURL" name="readNcFileURL" th:value="${readNcFileURL}" class="form-control col-sm-7" type="hidden" />
|
<div class="portlet-body">
|
<div id="div_upload" style="text-align:center;display:none">
|
<img src="/image/loading.gif" alt='正在上传' />
|
</div>
|
<div id="div_id" style="text-align:center;display:none">
|
<input id="input_logs" value="1" type="hidden" />
|
<img id="img_load" src="/image/loading.gif" alt='正在加载' />
|
<a id="showlog" onclick="showLog();">正在分析中...</a>
|
<div id="logs_div" style="overflow-y:auto;width:100%;height:150px;display:none">
|
<table style="border-spacing: 0px 0px;">
|
<tbody id="logs"></tbody>
|
</table>
|
</div>
|
</div>
|
<div class="row">
|
<div class="col-sm-6">
|
<div class="control-group">
|
<label class="control-label">文件资源类型<span style="color: red;">*</span></label>
|
<div class="controls input-icon">
|
<select id="sourcetype" name="sourcetype" class="form-control col-sm-9" required="" onchange="changeLX(this);">
|
<option value="">--请选择--</option>
|
<option th:selected="(${Res_ExtFileSource.sourcetype} == '文件')?'true':'false'" value="文件">文件</option>
|
<option th:selected="(${Res_ExtFileSource.sourcetype} == '文件夹')?'true':'false'" value="文件夹">文件目录</option>
|
</select>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
<input type="file" name="filepath" id="filesourcepath" style="display:none;" />
|
</div>
|
</div>
|
</div>
|
<div class="col-sm-6">
|
<div class="control-group">
|
<label class="control-label">存储方式</label>
|
<div class="controls input-icon">
|
<select id="storagemode" name="storagemode" class="form-control col-sm-9" onchange="changeCCFS(this);">
|
<option value="">--请选择--</option>
|
<option th:selected="(${Res_ExtFileSource.storagemode}=='本地')?'true':'false'" value="本地">本地</option>
|
<option th:selected="(${Res_ExtFileSource.storagemode}=='远程')?'true':'false'" value="远程">远程</option>
|
</select>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="row wenjian">
|
<div class="col-sm-6">
|
<div class="control-group">
|
<label class="control-label">文件名称</label>
|
<div class="controls input-icon">
|
<input th:value="${Res_ExtFileSource.filename}" id="filename" name="filename" type="text" class="form-control col-sm-8" />
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
<input type="file" name="filepath2" id="filepath2" style="display:none;" onchange="uploadfile('filepath2')" />
|
<button type="button" id="filebutton" class="btn btn-primary wenjian" style="vertical-align: baseline;" onclick="openDialog('filepath2')">
|
<span class="fa fa-upload"></span> 上传
|
</button>
|
</div>
|
</div>
|
</div>
|
<div class="col-sm-6">
|
<div class="control-group">
|
<label class="control-label">文档页数</label>
|
<div class="controls input-icon">
|
<input th:value="${Res_ExtFileSource.filepages}" id="filepages" name="filepages" type="text" class="form-control col-sm-9" />
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="row">
|
<div class="col-sm-6">
|
<div class="control-group">
|
<label class="control-label">文件类型</label>
|
<div class="controls input-icon">
|
<select id="filetype" name="filetype" class="form-control col-sm-9">
|
<option value="">--请选择--</option>
|
<option th:each="item:${filetypelist}" th:value="${item.key}" th:text="${item.value}" th:selected="(${Res_ExtFileSource.filetype}==${item.key})?'true':'false'"></option>
|
</select>
|
</div>
|
</div>
|
</div>
|
<div class="col-sm-6">
|
<div class="control-group">
|
<label class="control-label">大小<span style="color: red;">*</span></label>
|
<div class="controls input-icon" th:switch="${unitConvert}">
|
<input th:case="1" th:value="${Res_ExtFileSource.filesize*1000}" type="text" id="filesize" name="filesize" class="form-control col-sm-7" required="" />
|
<input th:case="2" th:value="${Res_ExtFileSource.filesize}" type="text" id="filesize" name="filesize" class="form-control col-sm-7" required="" />
|
<input th:case="3" th:value="${Res_ExtFileSource.filesize/1000}" type="text" id="filesize" name="filesize" class="form-control col-sm-7" required="" />
|
<input th:case="4" th:value="${Res_ExtFileSource.filesize/(1000*1000)}" type="text" id="filesize" name="filesize" class="form-control col-sm-7" required="" />
|
<input th:case="5" value="" type="text" id="filesize" name="filesize" class="form-control col-sm-7" required="" />
|
<select id="unit" name="unit" class="form-control col-sm-2" style="width:15%">
|
<option th:selected="(${unit}=='bytes')?'true':'false'" vaule="bytes">B</option>
|
<option th:selected="(${unit}=='KB')?'true':'false'" value="KB">KB</option>
|
<option th:selected="(${unit}=='MB')?'true':'false'" value="MB">MB</option>
|
<option th:selected="(${unit}=='GB')?'true':'false'" value="GB">GB</option>
|
</select>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="row yuancheng">
|
<div class="col-sm-12">
|
<div class="control-group">
|
<label class="control-label">服务地址</label>
|
<div class="controls input-icon">
|
<input th:value="${Res_ExtFileSource.serverurl}" id="serverurl" name="serverurl" class="form-control col-sm-10" style="width:93%" />
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="row" style="display: none;">
|
<div class="col-sm-6">
|
<div class="control-group">
|
<label class="control-label">下载方式</label>
|
<div class="controls input-icon">
|
<select id="downloadmodel" name="downloadmodel" class="form-control col-sm-9" onchange="DownLoadModeChange(this)">
|
<option value="">--请选择--</option>
|
<option th:selected="(${Res_ExtFileSource.downloadmodel}=='FTP')?'true':'false'" value="FTP">FTP</option>
|
<option th:selected="(${Res_ExtFileSource.downloadmodel}=='HTTP')?'true':'false'" value="HTTP">HTTP</option>
|
</select>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</div>
|
</div>
|
</div>
|
<div class="col-sm-6" id="httpType">
|
<div class="control-group">
|
<div class="control-group">
|
<label class="control-label">获取方式</label>
|
<div class="controls input-icon">
|
<select id="gettype" name="gettype" class="form-control col-sm-9">
|
<option value="">--请选择--</option>
|
<option th:selected="(${Res_ExtFileSource.gettype}=='跳转')?'true':'false'" value="跳转">跳转</option>
|
<option th:selected="(${Res_ExtFileSource.gettype}=='代理')?'true':'false'" value="代理">代理</option>
|
</select>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="row" id="XiaZaiSet" style="display: none">
|
<div class="col-sm-6">
|
<div class="control-group">
|
<label class="control-label">FTP用户名</label>
|
<div class="controls input-icon">
|
<input th:value="${Res_ExtFileSource.ftpusername}" id="ftpusername" name="ftpusername" type="text" class="form-control col-sm-9" />
|
</div>
|
</div>
|
</div>
|
<div class="col-sm-6">
|
<div class="control-group">
|
<label class="control-label">FTP密码</label>
|
<div class="controls input-icon">
|
<input th:value="${Res_ExtFileSource.ftppwd}" id="ftppwd" name="ftppwd" type="password" class="form-control col-sm-9" />
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div id="div_ncconfig" style="margin-left: 80px;display:none;">
|
<button class="btn btn-primary" type="button" onclick="ncSet();" style="width:100px;">
|
<i class="icon-save"></i>NC配置
|
</button>
|
<button class="btn btn-primary" onclick="storageSet()" type="button" style="width:100px;">
|
<i class="icon-save"></i>入库配置
|
</button>
|
</div>
|
</div>
|
<div class="portlet box ltblue yuancheng">
|
<div class="portlet-title">
|
文件列表
|
<div class="caption">
|
<i class="fa fa-reorder"></i>
|
</div>
|
<div class="tools">
|
<a class="collapse" onclick="portlet_body_ShowOrHide(this);"></a>
|
</div>
|
</div>
|
<div class="portlet-body">
|
<div style="width:100%;text-align: center;">
|
<table id="tbGKListYuanCheng" style="width:80%;margin:auto">
|
<tr style="text-align:center;height:30px;width:100%;background-color: transparent;color:#999;">
|
<td style="width:5%;background-color:#DDD;color:#666;">序号</td>
|
<td style="width:30%;background-color:#DDD;color:#666;">文件名称</td>
|
<td style="width:20%;background-color:#DDD;color:#666">文件大小</td>
|
<td style="width:15%;background-color:#DDD;color:#666">数据生成</td>
|
<td style="width:15%;background-color:#DDD;color:#666">入库</td>
|
</tr>
|
</table>
|
<div style="height:20px;"></div>
|
</div>
|
</div>
|
</div>
|
<div class="portlet box ltblue wenjianjia">
|
<div class="portlet-title">
|
文件列表
|
<div class="caption">
|
<i class="fa fa-reorder"></i>
|
</div>
|
<div class="tools">
|
<a class="collapse" onclick="portlet_body_ShowOrHide(this);"></a>
|
</div>
|
</div>
|
<div class="portlet-body">
|
<div style="width:100%;text-align: center;">
|
<div style="text-align:center;height:40px;line-height:40px;font-size:15px;margin-top:5px;"></div>
|
<table id="tbGKList" style="width:80%;margin:auto">
|
<tr style="text-align:center;height:30px;width:100%;background-color: transparent;color:#999;">
|
<td style="width:5%;background-color:#DDD;color:#666;">序号</td>
|
<td style="width:25%;background-color:#DDD;color:#666;">文件名称</td>
|
<td style="width:15%;background-color:#DDD;color:#666">文件大小</td>
|
<td style="width:15%;background-color:#DDD;color:#666">数据生成</td>
|
<td style="width:15%;background-color:#DDD;color:#666">入库</td>
|
<td style="width:25%;background-color:#DDD;color:#666">操作
|
</td>
|
</tr>
|
<tr th:each="file,fileStat:${filelist}">
|
<td style="padding: 2px">
|
<input type="text" th:value="${fileStat.count}" id="count" name="count" class="m-warp span12" style="border:0px;" />
|
</td>
|
<td style="padding: 2px">
|
<input type="text" th:value="${file.name}" id="upfilename" name="upfilename" class="m-warp span12" style="border:0px;" />
|
</td>
|
<td>
|
<input type="text" th:value="${file.size}" id="upfilesize" name="upfilesize" class="m-warp span12" style="border:0px;" />
|
</td>
|
<td>
|
<input type="text" th:value="${file.ncjson}" id="ncjson" name="ncjson" class="m-warp span12" style="border:0px;" />
|
</td>
|
<td>
|
<input type="text" th:value="${file.storageConfig}" id="storageConfig" name="storageConfig" class="m-warp span12" style="border:0px;" />
|
</td>
|
<td style="text-align:center;padding: 2px">
|
<button type="button" th:value="${file.name}" id="delectFile" class="btn btn-primary btn-sm" style="vertical-align: baseline;" onclick="deletefile(this)">
|
<i class="fa"></i> 删除
|
</button>
|
<button class="btn btn-primary btn-sm" style="vertical-align: baseline;" type="button" onclick="dataGeneration(this);">
|
<i class="fa"></i>数据生成
|
</button>
|
<button class="btn btn-primary btn-sm" style="vertical-align: baseline;" name="storage" onclick="findParams(this);" type="button">
|
<i class="fa"></i>入库
|
</button>
|
<input type="file" id="upfilepath" name="upfilepath" style="display: none;" />
|
</td>
|
</tr>
|
</table>
|
<div style="padding: 10px">
|
<input type="file" name="upfilepath1" id="upfilepath1" style="display: none;" multiple="multiple" onchange="uploadfile('upfilepath1')" />
|
<button type="button" id="piliang" class="btn btn-primary" style="vertical-align: baseline;margin-left: 63%;" onclick="openDialog('upfilepath1')">
|
<i class="fa fa-upload"></i>批量上传
|
</button>
|
<button class="btn btn-primary" id="generation" type="button" onclick="dataAllGeneration();" style="width:80px;display:none!important;">
|
<i class="icon-save"></i>全部生成
|
</button>
|
<button class="btn btn-primary" id="allstorage" type="button" onclick="AllStorage();" style="width:80px;display:none!important;">
|
<i class="icon-save"></i>全部入库
|
</button>
|
</div>
|
<div style="height:20px;"></div>
|
</div>
|
</div>
|
</div>
|
</form>
|
<form id="nc_form" style="display:none;" xmlns:th="http://www.w3.org/1999/xhtml">
|
<div>
|
<input id="uploadPath" name="uploadPath" th:value="${uploadPath}" class="form-control col-sm-7" type="hidden" />
|
<input id="fileName" name="fileName" class="form-control col-sm-7" type="hidden" />
|
<input id="resourceType" name="resourceType" th:value="2" class="form-control col-sm-7" type="hidden" />
|
<input id="absolutePath" name="absolutePath" th:value="${absolutePath}" class="form-control col-sm-7" type="hidden" />
|
<input id="lonName" name="lonName" class="form-control col-sm-7" type="hidden" />
|
<input id="timeName" name="timeName" class="form-control col-sm-7" type="hidden" />
|
<input id="uName" name="uName" class="form-control col-sm-7" type="hidden" />
|
<input id="latName" name="latName" class="form-control col-sm-7" type="hidden" />
|
<input id="vName" name="vName" class="form-control col-sm-7" type="hidden" />
|
<input id="type" name="type" class="form-control col-sm-7" type="hidden" />
|
</div>
|
</form>
|
<script>
|
var isExit = true;
|
$(function () {
|
cheackForm("wdsjform");
|
var filename = $("#filename").val();
|
if (filename == '') {
|
isExit = false;
|
}
|
if (filename.indexOf(".nc") != -1) {
|
$("#div_ncconfig").css("display", "");
|
$("#generation").css("display", "");
|
$("#allstorage").css("display", "");
|
}
|
var xiazai = $("#downloadmodel").val();
|
if (xiazai == "FTP") {
|
$('#XiaZaiSet').css('display', '');
|
$('#httpType').css("display", "none");
|
} else if (xiazai == "HTTP") {
|
$('#XiaZaiSet').css('display', 'none');
|
$('#httpType').css("display", "");
|
} else if (xiazai == null || xiazai == "") {
|
$('#XiaZaiSet').css('display', 'none');
|
$('#httpType').css("display", "none");
|
}
|
|
var leixing = $("#sourcetype").val();
|
var ccfs = $("#storagemode").val();
|
if (leixing == "文件") {
|
$(".wenjianjia").css("display", "none");
|
if (ccfs == "远程") {
|
$('.wenjian').css("display", "none");
|
$('.yuancheng').css("display", "");
|
}
|
if (ccfs == "本地") {
|
$('.wenjian').css("display", "");
|
$('.yuancheng').css("display", "none");
|
}
|
}
|
if (leixing == "文件夹") {
|
$('.wenjian').css("display", "none");
|
if (ccfs == "远程") {
|
$(".wenjianjia").css("display", "none");
|
$('.yuancheng').css("display", "");
|
}
|
if (ccfs == "本地") {
|
$(".wenjianjia").css("display", "");
|
$('.yuancheng').css("display", "none");
|
}
|
}
|
if (leixing == "" || leixing == null) {
|
$('.wenjian').css("display", "none");
|
$(".wenjianjia").css("display", "none");
|
}
|
if (ccfs == null || ccfs == "") {
|
$('.yuancheng').css("display", "none");
|
}
|
|
var FuWuUrl = $("#serverurl").val();
|
//判断服务地址有没有,如果有
|
|
if (ccfs == "远程" && FuWuUrl != "") {
|
$.ajax({
|
url: '/res/resExtFileSource/getUrlList?url=' + FuWuUrl,
|
type: 'post',
|
dataType: 'text',
|
data: {},
|
success: function (data) {
|
var json = eval('(' + data + ')');
|
if (json.length == 1) {
|
if (json[0].filename == "无法获取该地址下的目录!") {
|
alert(json[0].filename);
|
return false;
|
}
|
}
|
for (var i = 0; i < json.length; i++) {
|
var html = "<tr>" +
|
"<td style=\"padding: 2px\">" + i + "</td >" +
|
"<td style=\"padding: 2px\">" + json[i].filename + "</td >" +
|
"<td style=\"padding: 2px\">" + json[i].size + "</td ></tr>";
|
|
$("#tbGKListYuanCheng").append(html);
|
}
|
},
|
error: function (e) {
|
alert(e.message);
|
}
|
});
|
}
|
});
|
|
//新增行
|
function AddFile() {
|
var lg = $("#tbGKList").find("tr").length;
|
var html =
|
"<tr><td style=\"padding: 2px\">" +
|
"<input type=\"text\" value=\"" + lg + "\" class=\"m-warp span12\" style=\"border:0px;\" />" +
|
"</td>" +
|
"<tr><td style=\"padding: 2px\">" +
|
"<input type=\"text\" id=\"filename" + lg + "\" name=\"filename" + lg + "\" class=\"m-warp span12\" style=\"border:0px;\" />" +
|
"</td>" +
|
"<td style=\"padding: 2px\">" +
|
"<input type=\"text\" id=\"filesize" + lg + "\" name=\"filesize" + lg + "\" class=\"m-warp span12\" style=\"border:0px;\" />" +
|
"</td>" +
|
"<td class='savebutton' style=\"text-align:center;padding: 2px\">" +
|
"<input type=\"file\" id=\"filepath" + lg + "\" name=\"filepath" + lg + "\" style=\"display: none;\" multiple=\"true\" />" +
|
"</td>" +
|
"<td class='delbutton' style=\"text-align:center;display: none;padding: 2px\">" +
|
"<button type=\"button\" class=\"btn btn-primary btn-sm\" style=\"vertical-align: baseline;\" onclick=\"deletefile(this)\">" +
|
"<i class=\"fa\"></i> 删除" +
|
"</button>" +
|
"<input type=\"file\" id=\"upfilepath\" name=\"upfilepath\" style=\"display: none;\"/>" +
|
"</td></tr>";
|
|
$("#tbGKList").append(html);
|
}
|
|
function DownLoadModeChange(obj) {
|
if ($(obj).val() == "FTP") {
|
$('#XiaZaiSet').css('display', '');
|
$('#httpType').css("display", "none");
|
} else if ($(obj).val() == "HTTP") {
|
$('#XiaZaiSet').css('display', 'none');
|
$('#httpType').css("display", "");
|
} else if ($(obj).val() == "") {
|
$('#XiaZaiSet').css('display', 'none');
|
$('#httpType').css("display", "none");
|
}
|
}
|
|
function openDialog(id) {
|
document.getElementById(id).click();
|
}
|
|
function uploadfile(id) {
|
var resMainInfoId = $("#resMainInfoId").val();
|
if(id == "upfilepath1" && resMainInfoId == "") {
|
return;
|
}
|
$("#div_upload").css("display", "");
|
setTimeout("upload_file('" + id + "')", 2000);//延迟二秒
|
}
|
|
function upload_file(id) {
|
if (document.getElementById(id).value != '') {
|
var formdata = new FormData();
|
formdata.append('sourcetype', $("#sourcetype").val());
|
formdata.append('resourceid', $("#resMainInfoId").val());
|
var fileName = document.getElementById(id).value;
|
formdata.append("json_filesNameArray", fileName);
|
var files = document.getElementById(id).files;
|
for (var i = 0; i < files.length; i++) {
|
formdata.append("myFile", files[i]); // 文件对象
|
}
|
$.ajax({
|
url: "/res/resExtFileSource/uploadfile",
|
type: "POST",
|
data: formdata,
|
cache: false,
|
async: false,
|
processData: false, // 告诉jQuery不要去处理发送的数据
|
contentType: false, // 告诉jQuery不要去设置Content-Type请求头
|
success: function (data) {
|
$("#div_upload").css("display", "none");
|
var json = eval('(' + data + ')');
|
|
if (json.result == '0') {
|
alert("上传失败");
|
} else if (json.result == '3') {
|
alert("上传失败,此文件名已存在!");
|
} else {
|
var names = json.name.replace("[", "").replace("]", "").split(",");
|
var finasizess = json.finasizes.replace("[", "").replace("]", "").split(",");
|
for (var j = 1; j < names.length + 1; j++) {
|
//添加html 因为原先有一个,所以要循环少一次
|
var lg = $("#tbGKList").find("tr").length;
|
var html = "<tr>" +
|
"<td style=\"padding: 2px\">" +
|
"<input type=\"text\" class=\"m-warp span12\" style=\"border:0px;\" value=\"" + lg + "\"/>" +
|
"</td>" +
|
"<td style=\"padding: 2px\">" +
|
"<input type=\"text\" id=\"filename" + lg + "\" name=\"filename" + lg + "\" class=\"m-warp span12\" style=\"border:0px;\" value=\"" + names[j - 1].trim() + "\"/>" +
|
"</td>" +
|
"<td style=\"padding: 2px\">" +
|
"<input type=\"text\" id=\"filesize" + lg + "\" name=\"filesize" + lg + "\" class=\"m-warp span12\" style=\"border:0px;\" value=\"" + finasizess[j - 1].trim() + "\" />" +
|
"</td>" +
|
"<td class='savebutton' style=\"text-align:center;padding: 2px\">" +
|
"<input type=\"file\" id=\"filepath" + lg + "\" name=\"filepath" + lg + "\" style=\"display: none;\" multiple=\"true\" />" +
|
"</td>" +
|
"<td>" +
|
"<input type='text' value='' id='ncjson' name='ncjson' class='m-warp span12' style='border:0px;' />" +
|
"</td>" +
|
"<td>" +
|
"<input type='text' value='' id='storageConfig' name='storageConfig' class='m-warp span12' style='border:0px;' />" +
|
"</td>" +
|
"<td class='delbutton' style=\"text-align:center;display: none;padding: 2px\">" +
|
"<button type=\"button\" id='buttonname" + lg + "' class=\"btn btn-primary btn-sm\" style=\"vertical-align: baseline;\" value=\"" + names[j - 1].trim() + "\" onclick=\"deletefile(this)\">" +
|
"<i class=\"fa\"></i> 删除" +
|
"</button>" +
|
"<input type=\"file\" id=\"upfilepath\" name=\"upfilepath\" style=\"display: none;\"/>" +
|
"</td></tr>";
|
|
$("#tbGKList").append(html);
|
}
|
$("#filename").val(names);
|
$('#filesize').val(json.size);
|
$('#serverurl').val(json.Path);
|
$('#unit').val(json.unit);
|
$(".delbutton").css("display", "");
|
$(".savebutton").css("display", "none");
|
if (isExit) {
|
clearStorage();
|
openDialog('addZiYuanWDSJSave');
|
}
|
}
|
}
|
});
|
}
|
}
|
|
function changeLX(obj) {
|
if ($(obj).val() == "文件夹") {
|
$(".wenjian").css("display", "none");
|
if ($("#storagemode").val() == "本地") {
|
$(".wenjianjia").css("display", "");
|
}
|
} else if ($(obj).val() == "文件") {
|
$(".wenjianjia").css("display", "none");
|
if ($("#storagemode").val() == "本地") {
|
$(".wenjian").css("display", "");
|
}
|
}
|
}
|
|
function changeCCFS(obj) {
|
if ($(obj).val() == "本地") {
|
$(".yuancheng").css("display", "none");
|
if ($("#sourcetype").val() == "文件夹") {
|
$(".wenjianjia").css("display", "");
|
}
|
if ($("#sourcetype").val() == "文件") {
|
$(".wenjian").css("display", "");
|
}
|
}
|
else if ($(obj).val() == "远程") {
|
$(".yuancheng").css("display", "");
|
$('#serverurl').val("");
|
$(".wenjianjia").css("display", "none");
|
$(".wenjian").css("display", "none");
|
}
|
}
|
|
function fileSizeTest(size) {
|
//如果字节数少于1024,则直接以B为单位,否则先除于1024,后3位因太少无意义
|
if (size < 1024) {
|
return size.toString() + "B";
|
} else {
|
size = size / 1024;
|
}
|
//如果原字节数除于1024之后,少于1024,则可以直接以KB作为单位
|
//因为还没有到达要使用另一个单位的时候
|
//接下去以此类推
|
if (size < 1024) {
|
return size.toString() + "KB";
|
} else {
|
size = size / 1024;
|
}
|
if (size < 1024) {
|
//因为如果以MB为单位的话,要保留最后1位小数,
|
//因此,把此数乘以100之后再取余
|
size = size * 100;
|
return (size / 100).toString() + "." + (size % 100).toString() + "MB";
|
} else {
|
//否则如果要以GB为单位的,先除于1024再作同样的处理
|
size = size * 100 / 1024;
|
return (size / 100).toString() + "." + (size % 100).toString() + "GB";
|
}
|
}
|
|
function deletefile(obj) {
|
var sourcetype = $("#leixing").val();
|
var serverurl = $("#path").val();
|
$.ajax({
|
url: '/res/resExtFileSource/deletefile?resourceid=' + resMainInfoId,
|
type: 'post',
|
dataType: 'text',
|
data: {'filepath': serverurl, 'sourcetype': sourcetype, 'name': $(obj).val()},
|
success: function (data) {
|
var json = eval('(' + data + ')');
|
if (json.result == "true") {
|
alert("删除成功!");
|
parent.FTabPages.resetTab();
|
} else {
|
alert("删除失败!");
|
}
|
},
|
error: function (e) {
|
alert(e.message);
|
}
|
})
|
}
|
|
function ncSet() {
|
var resMainInfoId = $("#resMainInfoId").val();
|
var sourcetype = $("#sourcetype").val();
|
var resourceType;
|
if (sourcetype == '文件') {
|
resourceType = 1;//文件
|
if (filename == '') {
|
alert("文件名称不能为空");
|
return;
|
}
|
} else {
|
resourceType = 2;//文件夹
|
}
|
var filePath = $('#serverurl').val();
|
|
var left = (screen.availWidth - 1200) / 2;//居中
|
var top = (screen.availHeight - 600) / 2;//居中
|
var ncSetUrl = "/res/ResManage/ResRegister/NcFileConfig?resourceType=" + resourceType + "&resourceid=" + resMainInfoId + "&filePath=" + filePath;
|
window.open(ncSetUrl, "", "height=600,width=1200,left=" + left + ",top=" + top + "");
|
}
|
|
function storageSet() {
|
var resMainInfoId = $("#resMainInfoId").val();
|
var sourcetype = $("#sourcetype").val();
|
var resourceType;
|
if (sourcetype == '文件') {
|
resourceType = 1;//文件
|
if (filename == '') {
|
alert("文件名称不能为空");
|
return;
|
}
|
} else {
|
resourceType = 2;//文件夹
|
}
|
|
var filePath = $('#serverurl').val();
|
|
var left = (screen.availWidth - 1200) / 2;//居中
|
var top = (screen.availHeight - 600) / 2;//居中
|
var storageSetUrl = "/res/ResManage/ResRegister/StorageConfig?filePath=" + filePath + "&resourceType=" + resourceType + "&resourceid=" + resMainInfoId;
|
window.open(storageSetUrl, "", "height=600,width=1200,left=" + left + ",top=" + top + "");
|
}
|
|
function dataAllGeneration() {
|
$("#fileName").val("");
|
$("#type").val(2);
|
var storage_buts = $("#tbGKList").find("[name='storage']");
|
for (var i = 0; i < storage_buts.length; i++) {
|
var tr = $(storage_buts[i]).parent("td").parent("tr");
|
var fileName = tr.find("[name='upfilename']").val();
|
nc_files.push(fileName);
|
}
|
var resourceid = $("#resMainInfoId").val();
|
$.ajax({
|
type: 'post',
|
url: '/res/ResManage/ResRegister/getNcConfig?resourceid=' + resourceid,
|
success: function (data) {
|
if (data == null || data == '') {
|
alert("暂无配置,请补充!");
|
$("#div_id").css("display", "none");
|
} else {
|
getData(data);
|
}
|
},
|
error: function () {
|
alert("请求失败,网络异常!");
|
$("#div_id").css("display", "none");
|
}
|
})
|
}
|
|
function dataGeneration(obj) {
|
var tr = $(obj).parent("td").parent("tr");
|
var fileName = tr.find("[name='upfilename']").val();
|
nc_fileName = fileName;
|
$("#fileName").val(fileName);
|
$("#type").val(1);
|
var resourceid = $("#resMainInfoId").val();
|
$.ajax({
|
type: 'post',
|
url: '/res/ResManage/ResRegister/getNcConfig?resourceid=' + resourceid,
|
success: function (data) {
|
if (data == null || data == '') {
|
alert("暂无配置,请补充!");
|
$("#div_id").css("display", "none");
|
} else {
|
$("#div_id").css("display", "");
|
getData(data);
|
}
|
},
|
error: function () {
|
alert("请求失败,网络异常!");
|
$("#div_id").css("display", "none");
|
}
|
})
|
}
|
|
function getData(data) {
|
data = JSON.parse(data);
|
var resourceid = $("#resMainInfoId").val();
|
$("#lonName").val(data.ncconfig[0].lonName);
|
$("#timeName").val(data.ncconfig[0].timeName);
|
$("#latName").val(data.ncconfig[0].latName);
|
$("#vName").val(data.ncconfig[0].vName);
|
$("#uName").val(data.ncconfig[0].uName);
|
var readNcFileURL = $("#readNcFileURL").val();
|
$('#nc_form').ajaxSubmit({
|
url: readNcFileURL,
|
type: 'post',
|
dataType: 'text',
|
success: function (data) {
|
data = JSON.parse(data);
|
var ncjsonattribute = JSON.stringify(data.ncjsonattribute);
|
$("#div_id").css("display", "none");
|
if (ncjsonattribute != null && ncjsonattribute != '') {
|
$.ajax({
|
url: "/res/ResManage/ResRegister/updateNcJsonPath?ncjsonpath=" + data.ncjsonpath + "&resourceid=" + resourceid + "&ncjsonattribute=" + encodeURIComponent(ncjsonattribute) + "&ncconfig=" + "",
|
type: 'post',
|
async: false,
|
dataType: 'text',
|
success: function (result) {
|
if (result > 0) {
|
alert("数据生成成功!");
|
}
|
$("#div_id").css("display", "none");
|
insertStorageRelation();
|
},
|
error: function () {
|
alert("数据生成成功,配置保存失败!");
|
$("#div_id").css("display", "none");
|
}
|
})
|
} else {
|
alert("数据生成失败!");
|
$("#div_id").css("display", "none");
|
}
|
},
|
error: function () {
|
$("#div_id").css("display", "none");
|
alert("请求服务失败,网络异常!");
|
}
|
});
|
}
|
|
function AllStorage() {
|
storageNumber = 1;
|
var storage_buts = $("#tbGKList").find("[name='storage']");
|
for (var i = 0; i < storage_buts.length; i++) {
|
storageButlen = storage_buts.length;
|
findParams(storage_buts[index_totals]);
|
break;
|
}
|
}
|
|
function findParams(obj) {
|
storage_botton = obj;
|
var resourceid = $("#resMainInfoId").val();
|
$.ajax({
|
url: '/res/ResManage/ResRegister/findParams?resourceid=' + resourceid,
|
type: 'post',
|
success: function (data) {
|
if (data == '') {
|
$("#div_id").css("display", "none");
|
alert("暂无入库配置信息,请先配置!");
|
return;
|
} else {
|
$("#div_id").css("display", "");
|
var result = JSON.parse(data);
|
if (result.length > 0) {
|
for (var i = 0; i < result.length; i++) {
|
if (result[i].nc_data_var != null && result[i].nc_data_var != "" && result[i].nc_data_var != "undefined" && result[i].open_cbx == 1) {
|
params.push(JSON.stringify(result[i]));
|
}
|
if (result[i].uvariables != null && result[i].uvariables != "" && result[i].uvariables != "undefined" && result[i].open_cbx == 1) {
|
params.push(JSON.stringify(result[i]));
|
}
|
}
|
saveStorage(obj);
|
return;
|
}
|
}
|
},
|
error: function () {
|
alert("请求失败,网络异常!");
|
$("#div_id").css("display", "none");
|
}
|
})
|
}
|
|
function saveStorage(obj) {
|
$("#showlog").text("正在分析中...");
|
$("#img_load").css("display", "");
|
var param;
|
var resourceid = $("#resMainInfoId").val();
|
var tr = $(obj).parent("td").parent("tr");
|
var fileName = tr.find("[name='upfilename']").val();
|
storage_fileName = fileName;
|
if (params.length > 0) {
|
for (var j = 0; j < params.length; j++) {
|
param = params[index_storage];
|
break;
|
}
|
} else {
|
alert("暂无启用配置!");
|
$("#div_id").css("display", "none");
|
return;
|
}
|
$.ajax({
|
url: '/res/ResManage/ResRegister/saveStorage?fileName=' + fileName + '¶m=' + encodeURIComponent(param) + '&resourceid=' + resourceid,
|
type: 'post',
|
dataType: 'text',
|
async: true,
|
success: function (data) {
|
var result = JSON.parse(data);
|
var falg = true;
|
if (result.code == 1) {
|
scheduled = window.setInterval("syncSaveStorage('" + result.jobids[0] + "')", 3000);
|
return;
|
} else {
|
if (index_totals == storageButlen - 1) {
|
if (result.message == "error") {
|
falg = false;
|
alert("入库失败!");
|
index_storage = 0;
|
params = new Array();
|
index_totals = 0;
|
storageNumber = 0;
|
$("#showlog").text("错误信息");
|
$("#img_load").css("display", "none");
|
}
|
if (falg) {
|
if (index_storage == params.length - 1) {
|
alert("入库成功!");
|
index_totals = 0;
|
storageNumber = 0;
|
params = new Array();
|
$("#div_id").css("display", "none");
|
saveStorageRelation();
|
} else {
|
index_storage++;
|
saveStorage(storage_botton);
|
}
|
}
|
} else {
|
index_totals++;
|
index_storage = 0;
|
params = new Array();
|
AllStorage();
|
}
|
}
|
}
|
})
|
}
|
|
function syncSaveStorage(id) {
|
var url = $("#ncSyncStorageUrl").val() + id + "?f=pjson";
|
$.ajax({
|
url: url,
|
type: 'post',
|
async: false,
|
success: function (result) {
|
var json = JSON.parse(result).messages;
|
var jsontext = "";
|
for (var i = 0; i < json.length; i++) {
|
jsontext += "<tr><td style='border:0px;'><span style='font-size:11pt;'>" + json[i].description + "</span></td></tr>";
|
}
|
$("#logs").html(jsontext);
|
$("#logs_div").scrollTop($("#logs_div")[0].scrollHeight);
|
if (result.indexOf("esriJobSucceeded") != -1) {
|
window.clearInterval(scheduled); //清除定时器
|
if (storageNumber == 1) { //全部入库
|
if (index_storage == params.length - 1) {
|
if (index_totals == storageButlen - 1) {
|
alert("入库成功!");
|
index_storage = 0;
|
index_totals = 0;
|
storageNumber = 0;
|
params = new Array();
|
$("#div_id").css("display", "none");
|
saveStorageRelation();
|
} else {
|
index_totals++;
|
index_storage = 0;
|
params = new Array();
|
saveStorageRelation();
|
AllStorage();
|
}
|
} else {
|
index_storage++;
|
saveStorage(storage_botton);
|
}
|
} else {
|
if (index_storage == params.length - 1) {
|
alert("入库成功!");
|
index_storage = 0;
|
index_totals = 0;
|
storageNumber = 0;
|
params = new Array();
|
$("#div_id").css("display", "none");
|
saveStorageRelation();
|
} else {
|
index_storage++;
|
saveStorage(storage_botton);
|
}
|
}
|
}
|
if (result.indexOf("esriJobFailed") != -1) {
|
window.clearInterval(scheduled); //清除定时器
|
alert("入库失败!");
|
index_storage = 0;
|
index_totals = 0;
|
storageNumber = 0;
|
params = new Array();
|
$("#showlog").text("错误信息");
|
$("#img_load").css("display", "none");
|
}
|
},
|
error: function () {
|
window.clearInterval(scheduled);
|
index_storage = 0;
|
index_totals = 0;
|
storageNumber = 0;
|
params = new Array();
|
$("#showlog").text("错误信息");
|
$("#img_load").css("display", "none");
|
alert("请求失败,网络异常!");
|
}
|
})
|
}
|
|
function showLog() {
|
var input_logs = $("#input_logs").val();
|
if (input_logs == '1') {
|
$("#logs_div").css("display", "");
|
$("#input_logs").val(2);
|
} else {
|
$("#logs_div").css("display", "none");
|
$("#input_logs").val(1);
|
}
|
}
|
|
function clearStorage() {
|
var resMainInfoId = $("#resMainInfoId").val();
|
$.ajax({
|
type: 'post',
|
url: '/res/ResManage/ResRegister/clearConfig?resourceid=' + resMainInfoId + "&type=3"
|
})
|
}
|
|
function saveStorageRelation() {
|
var resourceid = $("#resMainInfoId").val();
|
$.ajax({
|
type: 'post',
|
url: '/res/ResManage/ResRegister/saveStorageRelation?resourceid=' + resourceid + "&filename=" + storage_fileName
|
})
|
}
|
|
function insertStorageRelation() {
|
var resourceid = $("#resMainInfoId").val();
|
if (nc_files.length > 0) {
|
for (var i = 0; i < nc_files.length; i++) {
|
$.ajax({
|
type: 'post',
|
url: '/res/ResManage/ResRegister/insertStorageRelation?resourceid=' + resourceid + "&filename=" + nc_files[i]
|
})
|
}
|
nc_files = new Array();
|
} else {
|
$.ajax({
|
type: 'post',
|
url: '/res/ResManage/ResRegister/insertStorageRelation?resourceid=' + resourceid + "&filename=" + nc_fileName
|
})
|
}
|
}
|
|
var params = new Array(); //存所有的入库配置
|
var index_storage = 0;//当前入库到第几条 index_storage=params.length-1结束入库
|
var storage_botton;//当前入库对象,主要获取文件名
|
var scheduled;//定时器
|
var storageButlen = 1;//入库按钮总个数
|
var index_totals = 0;//当前入库到第几个文件
|
var storageNumber = 0;//0代表点击入库 1代表点击全部入库
|
var storage_fileName = "";//当前入库文件名
|
var nc_files = new Array();//全部数据生成文件名
|
var nc_fileName = "";//当前数据生成文件名
|
</script>
|