<!--
|
功能描述:资源管理 - 资源注册 - 基本信息资源信息
|
-->
|
<style type="text/css">
|
.upload-file {
|
position: relative;
|
vertical-align: baseline;
|
cursor: pointer;
|
}
|
|
.upload-file input[type='file'] {
|
height: 100%;
|
width: 100%;
|
position: absolute;
|
top: 0;
|
right: 0;
|
opacity: 0;
|
filter: alpha(opacity=0);
|
cursor: pointer;
|
}
|
</style>
|
<form class="form-horizontal" id="mainfrom" xmlns:th="http://www.w3.org/1999/xhtml"
|
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
<input type="hidden" id="ZiYuanId"/>
|
<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>
|
<div class="portlet-body">
|
<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">
|
<input th:value="${mainInfo.title}" type="text" id="title" name="title"
|
class="form-control col-sm-9" required="" maxchar="50"/>
|
<span class="input-warning" data-original-title="">
|
<i class="icon-warning-sign" style="display: none;"></i>
|
</span>
|
</div>
|
</div>
|
<div class="control-group">
|
<label class="control-label">资源简称<span style="color: red;">*</span></label>
|
<div class="controls input-icon">
|
<input th:value="${mainInfo.abbreviation}" type="text" id="abbreviation" name="abbreviation"
|
class="form-control col-sm-9" required="" maxchar="20"/>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="icon-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</div>
|
</div>
|
<div class="control-group">
|
<label class="control-label">资源类型<span style="color: red;">*</span></label>
|
<div class="controls input-icon">
|
<select id="resourceclass" name="resourceclass" class="form-control col-sm-9" required="">
|
<option value="">--请选择--</option>
|
<option th:each="item:${ResourceTypeList}" th:value="${item.key}"
|
th:text="${item.value}"
|
th:selected="(${mainInfo.resourceclass}==${item.key})?'true':'false'"></option>
|
</select>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="icon-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</div>
|
</div>
|
<div class="control-group">
|
<label class="control-label">所属目录<span style="color: red;">*</span></label>
|
<div class="controls input-icon">
|
<input th:value="${mainInfo.catlogid}" type="hidden" id="catlogid" name="catlogid"/>
|
<input th:value="${mainInfo.catlogcode}" type="hidden" id="catlogcode" name="catlogcode"/>
|
<input th:value="${catlogtitle}" type="text" id="catlogtitle" name="catlogtitle"
|
readonly="readonly" class="form-control col-sm-8" required=""/>
|
<a class="btn"
|
style="background-color: #e5e5e5;vertical-align:baseline !important;color: black;"
|
title='选择所属类别' id="model1">...</a>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="icon-warning-sign" style="display: none;margin-left:34px"></i>
|
</span>
|
</div>
|
</div>
|
</div>
|
<div class="col-sm-6">
|
<div class="control-group">
|
<label class="control-label">图标</label>
|
<div class="controls">
|
<div class="fileupload fileupload-new" data-provides="fileupload"
|
style="margin-bottom:0px;">
|
<div class="fileupload-new thumbnail"
|
style="width: 262px; height: 146px;border:1px solid #ddd;" id="PhotoDiv1">
|
<img id="photo" th:src="${mainInfo.imgurl}!='' ? ${Imagelujin}:'' " alt=""
|
style="width: 262px; height: 146px;border:1px solid #ddd"/>
|
</div>
|
<div class="fileupload-preview fileupload-exists thumbnail" id="PhotoDiv2"
|
style="max-width: 262px; max-height: 146px; line-height: 20px;margin-bottom:6px;"></div>
|
<div>
|
<a class="btn btn-info" title='选择图片' id="ShowAtlas">选择图片</a>
|
<a id="dianjiUpdate" class="btn btn-info"
|
onclick="javascript:document.getElementById('uploadInput').click();">本地上传</a>
|
<input style="display: none;" id="uploadInput" type="file" multiple="multiple"/>
|
<input type="hidden" id="imgurl" name="imgurl" th:value="${mainInfo.imgurl}"/>
|
<a class="btn btn-info" onclick="DelPhoto()" data-dismiss="fileupload">移除</a>
|
<span style="color:red;font-size:12px;">(建议图片大小:262 × 146 像素)</span>
|
</div>
|
</div>
|
</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="datasources" name="datasources"
|
class="form-control col-sm-9">
|
<option value="" >--请选择--</option>
|
<option th:each="item:${datasourcelist}"
|
th:value="${item.key}"
|
th:text="${item.value}"
|
th:selected="(${mainInfo.datasources}==${item.key})?'true':'false'"
|
id="txt">
|
<!-- <input type="text" id="s" disabled="disabled">-->
|
</option>
|
</select>
|
|
<!-- <span class="input-warning tooltips" data-original-title="">-->
|
<!-- <i class="icon-warning-sign" style="display: none;margin-left:30px;"></i>-->
|
<!-- </span>-->
|
</div>
|
</div>
|
<div class="control-group" id="datasourcesText" style="display: none">
|
<label class="control-label"></label>
|
<div class="controls input-icon">
|
<input class="form-control col-sm-9" maxchar="20" placeholder="请输入数据来源" id="datasourcesValue" name="datasources" type="text" value="">
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="icon-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</div>
|
</div>
|
<div class="control-group" id="sjcssj" th:if="${mainInfo.resourceclass}!='JKFW'">
|
<label class="control-label">数据产生时间</label>
|
<div class="controls input-icon">
|
<input th:value="${productiontime}" type="text" id="productiontime" name="productiontime"
|
readonly="true" class="form-control col-sm-7 date-picker" style="width: 63%;"/>
|
<button class="btn btn-primary" onclick="javascript:$('#productiontime').val('');"
|
style="vertical-align: top;">清除
|
</button>
|
</div>
|
</div>
|
<div class="control-group">
|
<label class="control-label">发布单位<span style="color: red;">*</span></label>
|
<div class="controls input-icon">
|
<input th:value="${mainInfo.pubunitid}" type="hidden" id="pubunitid" name="pubunitid"
|
class="form-control col-sm-9" required=""/>
|
<input th:value="${unitname}" type="text" class="form-control col-sm-9" required=""
|
readonly="readonly"/>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="icon-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</div>
|
</div>
|
<div class="control-group">
|
<label class="control-label">共享协议<span style="color: red;">*</span></label>
|
<div class="controls input-icon">
|
<select id="sharprotocol" name="sharprotocol" class="form-control col-sm-7" required="">
|
<option value="">--请选择--</option>
|
<option th:each="item:${SharProtocolList}" th:value="${item.key}"
|
th:text="${item.value}"
|
th:selected="(${mainInfo.sharprotocol}==${item.key})?'true':'false'"></option>
|
</select>
|
<input type="checkbox" id="insteadaudit" name="insteadaudit" value="1"
|
th:checked="(${mainInfo.insteadaudit}==1 )? 'true':'false' "
|
style="margin-right:3px;margin-left: 15px;"/>
|
<!--<input type="checkbox" id="insteadaudit" name="insteadaudit" value="1" th:if="${mainInfo.insteadaudit}==0" style="margin-right:3px;margin-left: 15px;" />-->
|
<label for="insteadaudit" style="vertical-align: middle;">委托批复</label>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="icon-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</div>
|
</div>
|
|
<div class="control-group" id="sjfgfw" th:if="${mainInfo.resourceclass}!='JKFW'">
|
<label class="control-label">数据覆盖范围</label>
|
<div class="controls input-icon">
|
<input th:value="${mainInfo.administrativeid}" type="hidden" id="administrativeid"
|
name="administrativeid"/>
|
<input th:value="${administrativename}" type="text" id="administrativename"
|
name="administrativename" readonly="readonly" class="form-control col-sm-8"/>
|
<a class="btn"
|
style="background-color: #e5e5e5;vertical-align:baseline !important;color: black;"
|
title='选择区域' id="ShowAreaTree">...</a>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="icon-warning-sign" style="display: none;margin-left:34px"></i>
|
</span>
|
</div>
|
</div>
|
<div class="control-group" id="sjgxpl" th:if="${mainInfo.resourceclass}!='JKFW'">
|
<label class="control-label">数据更新频率</label>
|
<div class="controls input-icon">
|
<select id="updatetimes" name="updatetimes" class="form-control col-sm-9">
|
<option value="">--请选择--</option>
|
<option th:each="item:${UpdateTimesList}" th:value="${item.key}" th:text="${item.value}"
|
th:selected="(${mainInfo.updatetimes}==${item.key})?'true':'false'"></option>
|
</select>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="icon-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</div>
|
</div>
|
<div class="control-group">
|
<label class="control-label">发布人<span style="color: red;">*</span></label>
|
<div class="controls input-icon">
|
<input th:value="${mainInfo.createuserid}" type="hidden" id="createuserid"
|
name="createuserid" class="form-control col-sm-9" required=""/>
|
<input th:value="${chinesename}" type="text" class="form-control col-sm-9" required=""
|
readonly="readonly"/>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="icon-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</div>
|
</div>
|
<div class="control-group">
|
<label class="control-label">发布时间<span style="color: red;">*</span></label>
|
<div class="controls input-icon">
|
<input th:value="${Pubdate}" type="text" id="pubdate" name="pubdate" readonly="true"
|
class="form-control col-sm-9 date-picker" required=""/>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="icon-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</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" id="divGuanJianZi">
|
<input id="txtTagsGuanJianZi" name="txtTags" class="form-control col-sm-9" type="text"
|
maxchar="100"/>
|
<input th:value="${mainInfo.keywords}" type="hidden" id="keywords" name="keywords"/>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="icon-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</div>
|
</div>
|
</div>
|
<div class="col-sm-6">
|
<div class="control-group">
|
<label class="control-label">安全级别</label>
|
<div class="controls input-icon" id="divAnQuanJiBie" style="line-height: 28px;">
|
<input type="hidden" th:value="${mainInfo.securitylev}" id="securitylev"
|
name="securitylev"/>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="row">
|
<div class="col-sm-12" style="padding:0;">
|
<div class="control-group">
|
<label class="control-label">原始数据存储备注</label>
|
<div class="controls input-icon">
|
<input th:value="${mainInfo.remark}" id="remark" name="remark"
|
class="form-control col-sm-11" type="text"/>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="icon-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="row" th:if="${not #lists.isEmpty(resMainInfoId)}">
|
<div class="col-sm-12" style="padding:0;">
|
<div class="control-group">
|
<label class="control-label">自定义资源说明地址</label>
|
<div class="controls input-icon">
|
<input th:value="${mainInfo.desurl}" id="desurl" name="desurl"
|
class="form-control col-sm-11" type="text" maxchar="500"/>
|
<input type="file" name="filepath" id="filepath" style="display: none;"/>
|
<!--<button class="btn btn-primary wenjian" id="remarkfilebtn" onclick="openUploadDialog('filepath','filename','filesize','remarkfilebtn')" style="vertical-align: baseline;" type="button">-->
|
<!--<span class="fa fa-upload"></span> 上传-->
|
<!--</button>-->
|
<div class="upload-file btn btn-primary">
|
<input type="file" id="remarkfilebtn" name="filepath"
|
onchange="openUploadDialog('remarkfilebtn','filename','filesize','remarkfilebtn')">
|
<span class="fa fa-upload"></span> 上传
|
</div>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="icon-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="row">
|
<div class="col-sm-12" style="padding:0;">
|
<div class="control-group">
|
<label class="control-label">资源说明</label>
|
<div class="controls input-icon">
|
<textarea th:text="${mainInfo.description}" name="description"
|
class="form-control col-sm-11" id="description" rows="3" cols="20"
|
style="height: 70px;"></textarea>
|
<span class="input-warning tooltips" data-original-title="">
|
<i class="icon-warning-sign" style="display: none;margin-left:30px;"></i>
|
</span>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="form-actions navbar-fixed-bottom" style="z-index: 0;">
|
<div style="float: left;">
|
<button class="btn btn-primary" id="addZiYuanSave" type="button">
|
<i class="fa fa-check"></i> 保存
|
</button>
|
<button th:if="${not #lists.isEmpty(resMainInfoId)}" class="btn btn-danger" id="ZiYuandelete" type="button">
|
<i class="fa fa-trash-o"></i> 删除
|
</button>
|
<button th:if="${not #lists.isEmpty(resMainInfoId) and auditstatus eq 0}" class="btn btn-primary"
|
id="ZiYuanTiJiao" type="button">
|
<i class="fa fa-check"></i> 提交
|
</button>
|
<button th:if="${not #lists.isEmpty(resMainInfoId) and auditstatus eq 2}" class="btn btn-primary"
|
id="urlfwdw" type="button" onclick="ShowRecommendPanel();">
|
<i class="fa fa-share-alt"></i> 推送
|
</button>
|
<button th:if="${not #lists.isEmpty(resMainInfoId) and auditstatus eq 2 and mainInfo.resourcestatus ne 3}"
|
class="btn btn-danger" id="signOut" type="button">
|
<i class="fa fa-refresh"></i> 注销
|
</button>
|
<button class="btn btn-warning" id="close" type="button" onclick="window.close()">
|
<i class="fa fa-remove"></i> 关闭
|
</button>
|
<button th:if="${not #lists.isEmpty(resMainInfoId)}" class="btn btn-primary" id="ZiYuanLook" type="button"
|
onclick="OpenZiYuan()">
|
<i class="fa fa-file-text-o"></i><span style="margin-left: 4px;display:inline-block;">查看</span>
|
</button>
|
</div>
|
</div>
|
</form>
|
|
<script th:inline="javascript">
|
|
$(function () {
|
//表单验证
|
cheackForm("mainfrom");
|
//资源类型,空间服务区分大小类显示
|
$("select option").each(function () { //遍历所有option
|
var txt = $(this).val().substring(0, 3); //获取option值
|
var isKJ = $(this).text();
|
if (txt == "KJ_") {
|
if (isKJ != "空间服务") { //禁用空间服务
|
$(this).html("-- " + isKJ);
|
} else {
|
$(this).attr("disabled", true);
|
}
|
}
|
});
|
//共享协议选择“完全公开”时,委托批复设为不可操作
|
var gongxiang = $("#sharprotocol option:selected").val();
|
if (gongxiang == "完全公开") {
|
$("#insteadaudit").attr("disabled", "disabled");
|
}
|
//图标去掉外框
|
var imgurl = [[${mainInfo.imgurl}]];
|
if (imgurl != '' && imgurl != null) {
|
$("#PhotoDiv1").css("border", 0);
|
} else {
|
$("#PhotoDiv1").css("border", "1px solid #ddd !important");
|
$("#PhotoDiv1 img").css("border", 0);
|
}
|
});
|
</script>
|
|
<script th:inline="javascript">
|
$("#sharprotocol").change(function () {
|
var gongxiang = $("#sharprotocol option:selected").val();
|
if (gongxiang == "完全公开") {
|
$("#insteadaudit").attr("disabled", "disabled")
|
$("#insteadaudit").attr("checked", false);
|
} else {
|
$("#insteadaudit").removeAttr("disabled") //启用
|
}
|
});
|
$("#datasources").change(function () {
|
var gongxiang = $("#datasources option:selected").val();
|
if (gongxiang == "其它") {
|
$("#datasourcesText").show();
|
$("#datasourcesValue").attr("name","datasources");
|
$("#datasources").attr("name","disabled");
|
} else {
|
$("#datasourcesText").hide();
|
$("#datasources").attr("name","datasources");
|
$("#datasourcesValue").attr("name","disabled");
|
}
|
});
|
//如果选择图片改变那么隐藏原来的图片
|
$("#uploadInput").change(function () {
|
var image = $('#uploadInput')[0].files[0];
|
if (image != null) {
|
$("#PhotoDiv1").hide();
|
$("#PhotoDiv2").show();
|
}
|
});
|
|
//注销资源
|
$("#signOut").on('click', function () {
|
var resMainInfoId = $("#resMainInfoId").val();
|
if (resMainInfoId != "") {
|
$.ajax({
|
url: '/res/ZiYuan/SignOutResource?resourceid=' + resMainInfoId,
|
type: 'post',
|
data: {},
|
success: function (data) {
|
var json = eval('(' + data + ')');
|
alert(json.msg);
|
parent.window.close();
|
},
|
error: function (e) {
|
alert(e.message);
|
}
|
});
|
}
|
});
|
|
//弹出一个页面层
|
$('#model1').on('click', function () {
|
layer.open({
|
type: 2,
|
title: '所属目录',
|
shadeClose: true,//是否点击遮罩关闭
|
shade: 0.7,//遮罩(true、false、Number)
|
area: ['300px', '500px'],
|
content: 'MuLuShu'
|
});
|
});
|
|
//弹出数据覆盖范围目录树
|
$("#ShowAreaTree").on("click", function () {
|
layer.open({
|
type: 2,
|
title: "选择区域",
|
shadeClose: true,//是否点击遮罩关闭
|
shade: 0.7,//遮罩(true、false、Number)
|
area: ["350px", "500px"],
|
content: "AreaTree"
|
});
|
});
|
|
//删除资源代码
|
|
$('#ZiYuandelete').on('click', function () {
|
if (confirm("删除包括资源基本信息和扩展信息,确定删除吗?")) {
|
var resMainInfoId = $("#resMainInfoId").val();
|
if (resMainInfoId != "") {
|
//删除
|
$('#mainfrom').ajaxSubmit({
|
url: '/res/deleteByPrimaryKey?resourceid=' + resMainInfoId,
|
type: 'post',
|
dataType: 'text',
|
data: {},
|
success: function (data) {
|
if (data == 1) {
|
alert("删除成功,页面即将关闭");
|
parent.window.opener.location.reload();
|
parent.window.close();
|
} else {
|
alert("删除失败");
|
}
|
},
|
error: function (e) {
|
alert(e.message);
|
}
|
});
|
}
|
}
|
});
|
|
//保存页面代码
|
|
var admin = [[${admin}]];
|
var auditstatus = [[${auditstatus}]];
|
$('#addZiYuanSave').on('click', function () {
|
|
//判断当前用户是否是管理员,是管理员或是未提交的资源才可以修改资源相关信息
|
if (admin == true || auditstatus == 0 || auditstatus == null || auditstatus == -1) {
|
|
if ($('#mainfrom').valid()) {
|
var resMainInfoId = $("#resMainInfoId").val();
|
if (resMainInfoId != "") {//修改
|
SetAnQuanJiBie();
|
SetGuanJianZi();
|
//修改
|
var image = $('#uploadInput')[0].files[0];
|
if (image != null) {
|
var formdata = new FormData();
|
formdata.append('myFile', $('#uploadInput')[0].files[0]);
|
$.ajax({
|
url: "/res/testuploadimg",
|
type: "POST",
|
data: formdata,
|
cache: false,
|
async: false,
|
processData: false, // 告诉jQuery不要去处理发送的数据
|
contentType: false, // 告诉jQuery不要去设置Content-Type请求头
|
success: function (data) {
|
if (data == -1) {
|
alert("文件格式不正确,请重新上传!");
|
} else if (data == 0) {
|
alert("上传图片失败");
|
} else {
|
$("#imgurl").val(data);
|
$('#mainfrom').ajaxSubmit({
|
url: '/res/ziYuanUpdaate?resourceid=' + resMainInfoId,
|
type: 'post',
|
dataType: 'text',
|
data: {},
|
success: function (data1) {
|
var json = eval('(' + data1 + ')');
|
if (json.result == "1") {
|
alert("更新成功!");
|
parent.window.opener.location.reload(); //查看页面刷新父页面
|
parent.location.href = "ResEdit?resMainInfoId=" + json.ziyuanId;
|
} else {
|
alert("更新失败!");
|
}
|
},
|
error: function (e) {
|
alert(e.message + "121");
|
}
|
});
|
}//保存结束
|
},
|
error: function (e) {
|
alert(e.message);
|
}
|
});
|
} else {
|
$('#mainfrom').ajaxSubmit({
|
url: '/res/ziYuanUpdaate?resourceid=' + resMainInfoId,
|
type: 'post',
|
dataType: 'text',
|
data: {},
|
success: function (data1) {
|
var json = eval('(' + data1 + ')');
|
if (json.result == "1") {
|
alert("更新成功!");
|
parent.window.opener.location.reload(); //刷新父页面数据
|
parent.location.href = "ResEdit?resMainInfoId=" + json.ziyuanId;
|
} else {
|
alert("更新失败!");
|
}
|
},
|
error: function (e) {
|
alert(e.message);
|
}
|
});
|
}
|
} else { //新增
|
SetAnQuanJiBie();
|
SetGuanJianZi();
|
//判断是否有图片,如果有图片就上传
|
var image = $('#uploadInput')[0].files[0];
|
if (image != null) {
|
var formdata = new FormData();
|
formdata.append('myFile', $('#uploadInput')[0].files[0]);
|
console.log(formdata);
|
$.ajax({
|
url: "/res/testuploadimg",
|
type: "POST",
|
data: formdata,
|
cache: false,
|
async: false,
|
processData: false, // 告诉jQuery不要去处理发送的数据
|
contentType: false, // 告诉jQuery不要去设置Content-Type请求头
|
success: function (data) {
|
if (data == 0) {
|
alert("上传图片失败");
|
} else {
|
$("#imgurl").val(data);
|
$('#mainfrom').ajaxSubmit({
|
url: '/res/ziYuanInsert',
|
type: 'post',
|
dataType: 'text',
|
data: {},
|
success: function (data1) {
|
var json = eval('(' + data1 + ')');
|
if (json.result == "1") {
|
alert("保存成功!");
|
parent.window.opener.location.reload();
|
parent.location.href = "ResEdit?resMainInfoId=" + json.ziyuanId;
|
} else {
|
alert("保存失败!");
|
}
|
},
|
error: function (e) {
|
alert(e.message + "121");
|
}
|
});
|
}//保存结束
|
},
|
error: function (e) {
|
alert(e.message + "123");
|
}
|
});
|
} else {
|
$('#mainfrom').ajaxSubmit({
|
url: '/res/ziYuanInsert',
|
type: 'post',
|
dataType: 'text',
|
data: {},
|
success: function (data1) {
|
var json = eval('(' + data1 + ')');
|
if (json.result == "1") {
|
alert("保存成功!");
|
parent.window.opener.location.reload();
|
parent.location.href = "ResEdit?resMainInfoId=" + json.ziyuanId;
|
} else {
|
alert("保存失败!");
|
}
|
},
|
error: function (e) {
|
alert(e.message + "121");
|
}
|
});
|
}
|
}
|
} else {
|
// alert("您输入的信息存在错误,请更正后再提交!");
|
}
|
} else {
|
alert("注销后才可以对该资源进行修改!");
|
}
|
});
|
|
//提交资源代码
|
$('#ZiYuanTiJiao').on('click', function () {
|
var resMainInfoId = $("#resMainInfoId").val();
|
if ($('#mainfrom').valid()) {
|
SetGuanJianZi();
|
//保存
|
$('#mainfrom').ajaxSubmit({
|
url: '/res/ziYuanSubmit?resourceid=' + resMainInfoId,
|
type: 'post',
|
dataType: 'text',
|
data: {},
|
success: function (data) {
|
var json = eval('(' + data + ')');
|
if (json.result == "1") {
|
alert("提交成功!");
|
parent.location.href = "ResEdit?resMainInfoId=" + json.ziyuanId;
|
} else if (json.result == "2") {
|
alert("扩展信息未填写!");
|
} else {
|
alert('提交失败');
|
}
|
},
|
error: function (e) {
|
alert(e.message);
|
}
|
});
|
} else {
|
// alert("您输入的信息存在错误,请更正后再提交!");
|
}
|
});
|
|
$('input[name=espproxy]').click(function () {
|
$(this).attr("checked", true);//设置当前选中checkbox的状态为checked
|
$(this).siblings().attr("checked", false); //设置当前选中的checkbox同级(兄弟级)其他checkbox状态为未选中
|
});
|
|
function DelPhoto() {
|
$("#PhotoDiv1").show().css("border", "1px solid #CCCCCC");
|
$("#photo").attr("src", "");
|
$("#imgurl").val("");
|
$("#PhotoDiv2").html("");
|
}
|
|
//获取关键字
|
function GetTabValue(tabId) {
|
var gjz = "";
|
var spans = $("#" + tabId + " #addTagWrap").find("span")
|
if (spans.length > 0) {
|
spans.each(function (index, element) {
|
if (index != 0) {
|
gjz += ",";
|
}
|
gjz += spans[index].innerText;
|
});
|
} else
|
gjz = "";
|
return gjz;
|
}
|
|
//关键字赋值
|
function SetGuanJianZi() {
|
var gjz = GetTabValue('divGuanJianZi');
|
$("#keywords").val(gjz);
|
}
|
|
/*<![CDATA[*/
|
var KeywordsList = [[${KeywordsList}]];//关键字列表
|
//关键字初始化
|
function initGuanJianZi() {
|
var hotTags = "";
|
for (i = 0; i < KeywordsList.length; i++) {
|
hotTags += (hotTags == "" ? "" : "|") + KeywordsList[i];
|
}
|
var gjz = $("#keywords").val();
|
$("#txtTagsGuanJianZi")[0].value = gjz;
|
|
$("#txtTagsGuanJianZi").TagsInput({
|
usedTags: "",
|
hotTags: hotTags,
|
tagNum: 10,
|
maxWords: 10,
|
onRemoveTag: function (ele, val) {
|
|
}
|
});
|
}
|
|
//安全级别赋值
|
function SetAnQuanJiBie() {
|
$("#securitylev").val($('#divAnQuanJiBie img[data-on="yes"]').length);
|
}
|
|
//安全级别图片路径
|
var star = "/image/ZiYuan/safety.png";
|
var starOff = "/image/ZiYuan/safetyoff.png";
|
|
//初始化安全级别
|
function AnQuanJiBie() {
|
for (var i = 0; i < 5; i++) {
|
if (i < parseInt($("#securitylev").val())) {
|
$("#divAnQuanJiBie").append($('<img data-on="yes" src="/image/ZiYuan/safety.png" />'));
|
} else {
|
$("#divAnQuanJiBie").append($('<img data-on="no" src="/image/ZiYuan/safetyoff.png" />'));
|
}
|
}
|
$('#divAnQuanJiBie img').click(function () {
|
$(this).attr({"src": star, "data-on": "yes"})
|
.prevAll().each(function (index, obj) {
|
$(obj).attr({"src": starOff, "data-on": "yes"});
|
});
|
$(this).nextAll().attr(({"src": star, "data-on": "no"}));
|
}).mousemove(function () {
|
$(this).attr("src", star)
|
.prevAll().each(function (index, obj) {
|
$(obj).attr("src", star);
|
});
|
$(this).nextAll().each(function (index, obj) {
|
$(obj).attr("src", starOff);
|
});
|
}).mouseout(function () {
|
$(this).attr("src", function () {
|
if ($(this).attr("data-on") == "no") {
|
return starOff;
|
} else {
|
return star;
|
}
|
}).siblings().each(function (index, obj) {
|
$(obj).attr("src", function () {
|
if ($(this).attr("data-on") == "no") {
|
return starOff;
|
} else {
|
return star;
|
}
|
});
|
});
|
});
|
}
|
|
/*]]>*/
|
$(function () {
|
//修改状态时,资源类型设为不可操作
|
if ($('#resourceclass').val().trim() != "") {
|
$('#resourceclass').attr("disabled", true);
|
}
|
//初始化关键字
|
initGuanJianZi();
|
//安全级别
|
AnQuanJiBie();
|
//设置文本框宽度 ccr add 2018-12-30
|
setInputWidthForMainInfo();
|
//页面大小改变事件 ccr add 2018-12-30
|
$(window).resize(function () {
|
setTimeout("setInputWidthForMainInfo();", 500);
|
});
|
});
|
|
//资源推荐面板
|
function ShowRecommendPanel() {
|
var resMainInfoId = $("#resMainInfoId").val();
|
layer.open({
|
type: 2,
|
id: 'ZiYuanRecommend',
|
title: '推荐',
|
shadeClose: true,//是否点击遮罩关闭
|
shade: 0.7,//遮罩(true、false、Number)
|
area: ['350px', '500px'],
|
content: 'ZiYuanRecommend?resourceid=' + resMainInfoId
|
});
|
}
|
|
//查看资源
|
function OpenZiYuan(resourceid) {
|
var resourceid = $("#resMainInfoId").val();
|
window.location.href = "/res/ZiYuan/ZiYuanBaseInfo?resourceid=" + resourceid;
|
$.ajax({
|
url: '/res/resActionRecord/registerActionRecord',
|
type: 'post',
|
data: {'resourceid': resourceid, 'actiontype': '浏览'}
|
});
|
}
|
|
//资源类型改变事件
|
$("#resourceclass").bind("change", function () {
|
if ($(this).val() == "JKFW") {
|
$("#sjfgfw").hide();
|
$("#sjgxpl").hide();
|
$("#sjcssj").hide();
|
} else {
|
$("#sjfgfw").show();
|
$("#sjgxpl").show();
|
$("#sjcssj").show();
|
}
|
})
|
|
//打开上传文件
|
function openUploadDialog(id) {
|
document.getElementById(id).click();
|
if (document.getElementById(id).value != '') {
|
var postfix = document.getElementById(id).value.substring(document.getElementById(id).value.indexOf('.'), document.getElementById(id).value.length);
|
if (postfix != ".html" && postfix != ".htm") {
|
alert("只能上传html文件!");
|
return false;
|
}
|
var formdata = new FormData();
|
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/ZiYuan/uploadfile",
|
type: "POST",
|
data: formdata,
|
cache: false,
|
async: false,
|
processData: false, // 告诉jQuery不要去处理发送的数据
|
contentType: false, // 告诉jQuery不要去设置Content-Type请求头
|
success: function (data) {
|
var json = eval('(' + data + ')');
|
if (json.result == '0') {
|
alert("上传失败");
|
} else if (json.result == '3') {
|
alert("上传失败,此文件已存在!");
|
} else {
|
$("#desurl").val(json.Path);
|
}
|
}
|
});
|
}
|
}
|
|
//弹出图集
|
$("#ShowAtlas").on("click", function () {
|
layer.open({
|
type: 2,
|
title: "图集选择",
|
shadeClose: true,//是否点击遮罩关闭
|
shade: 0.7,//遮罩(true、false、Number)
|
area: ["953px", "600px"],
|
content: "AtkasList?resourceclass=" + $("#resourceclass").val()
|
});
|
});
|
|
//设置一些右边有按钮的文本框的宽度(让它们在不同分辨率下可以对齐,暂时使用JS实现,后面有时间再使用CSS实现) ccr add 2018-12-30
|
function setInputWidthForMainInfo() {
|
var titleWidth = $("#title").width(); //获取资源名称文本框的宽度
|
var titleRemark = $("#remark").width(); //获取资源名称文本框的宽度
|
$("#catlogtitle").width(titleWidth - 45); //所属目录
|
$("#administrativename").width(titleWidth - 45); //数据覆盖范围
|
$("#productiontime").width(titleWidth - 60); //数据产生时间
|
$("#sharprotocol").width(titleWidth - 90); //共享协议
|
$("#desurl").width(titleRemark - 78); //自定义资源说明地址
|
}
|
</script>
|
<script type="text/javascript">
|
/*修改“其他”按钮为input*/
|
/* function drop(id) {
|
// debugger;
|
var dataItem = document.getElementById(id);
|
var i = dataItem.selectedIndex;
|
var text = dataItem.options[i].text;
|
var value = dataItem.options[i].value;
|
if (value == "其他") {
|
text = "请手动输入数据来源"
|
document.getElementById("txt").disabled = false;
|
}
|
document.getElementById("txt").value = text;
|
|
}*/
|
/*
|
$('#datasources').on(change.function(){
|
console.log("select改变了")
|
function () {
|
|
}
|
var selectedOption=$("#")
|
})*/
|
|
|
/* $("#datasources").click(function (id) {
|
console.log("click");
|
var dataItem = $(this);
|
var i = dataItem.resMainInfoId;
|
var text = dataItem.options[i].text;
|
var value = dataItem.options[i].value;
|
console.log(value.key);
|
var selectedOption = $("datasources option:selected");
|
console.log("selectedOption.value(),selectedOption.text());
|
if (selectedOption.value == "其它") {
|
text = "请手动输入数据来源"
|
$("#txt").disabled = false;
|
} else ($("#s").value.type = text)
|
|
|
});
|
|
function showMeTheText(object) {
|
var selectedOption = $("datasources option:selected");
|
console.log("selectedOption.value(),selectedOption.text());
|
if (selectedOption.value == "其它") {
|
$("#txt").disabled = false;
|
} else ($("#s").value = text)
|
|
|
}
|
*/
|
// $("#datasources").bind("change", function () {
|
// var gongxiang = $("#datasources option:selected").val();
|
// if (gongxiang == "其它") {
|
// $("#testtext").show();
|
// $("#datasources").hide();
|
// } else {
|
// $("#testtext").hide();
|
// $("#datasources").show();
|
// }
|
// debugger
|
// $("#s").attr("disabled", false);
|
// var selected = $(this).find("option:selected").attr("th:selected")
|
// $("#s").val(selected);
|
|
|
|
|
/* function show(object) {
|
document.getElementById('txt').style.display = (object.value == "其它" ? "block" : "none")
|
console.log("我在这")
|
}*/
|
</script>
|