<style type="text/css">
|
td {
|
border: 1px solid #ccc;
|
}
|
|
#ZXFSList input {
|
text-align: center;
|
width: 100%;
|
min-height: 30px;
|
}
|
</style>
|
<form class="form-horizontal" id="ZXFSform" 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>
|
<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="ZXFSList" style="width:80%;margin:auto">
|
<tr style="text-align:center;height:30px;width:100%;background-color: transparent;color:#999;">
|
<td style="width:15%;background-color:#DDD;color:#666">展现方式</td>
|
<td style="width:40%;background-color:#DDD;color:#666">文件展示</td>
|
<td style="width:30%;background-color:#DDD;color:#666">文件夹展示</td>
|
<td style="width:15%;background-color:#DDD;color:#666">操作
|
<img id="tdOper" src="/image/Plus.gif" onclick="AddRow2()" style="cursor:pointer;" />
|
</td>
|
</tr>
|
<tr th:each="FileSource:${FileSourceWay}">
|
<td>
|
<input type="text" name="ShowWay" class="m-warp span12" th:value="${FileSource.showway}" style="border:0px;" onblur="TextBlur(this)" onfocus="TextFocus(this)" />
|
</td>
|
<td>
|
<input type="text" name="Url" class="m-warp span12" th:value="${FileSource.url}" style="border:0px;" onblur="TextBlur(this)" onfocus="TextFocus(this)" />
|
</td>
|
<td>
|
<input type="text" name="ReMark" class="m-warp span12" th:value="${FileSource.remark}" style="border:0px;" onblur="TextBlur(this)" onfocus="TextFocus(this)" />
|
</td>
|
<td style="text-align:center;">
|
<img src="/image/wrong.gif" alt="删除" style="cursor:pointer;" onclick="DeleteRowData2(this)" />
|
</td>
|
</tr>
|
</table>
|
<div style="height:20px;"></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="save" type="button">
|
<i class="fa fa-check"></i> 保存
|
</button>
|
<button th:if="${not #lists.isEmpty(resMainInfoId)}" class="btn btn-danger" id="JCDTDelete" type="button">
|
<i class="fa fa-trash-o"></i> 删除
|
</button>
|
<button class="btn btn-warning" id="close" type="button" onclick="window.close()">
|
<i class="fa fa-remove"></i> 关闭
|
</button>
|
</div>
|
</div>
|
</form>
|
<div id="resCopyInfo" style="display:none;padding:10px;">
|
<div class="col-sm-10">
|
<div class="control-group">
|
<label class="control-label">资源名称:</label>
|
<div class="controls input-icon">
|
<input id="copyname" name="copyname" class="form-control col-sm-10" value="" />
|
</div>
|
</div>
|
</div>
|
<div style="margin-top:25px;float:right;">
|
<button class="btn btn-primary" onclick="copyRes()" type="button">
|
<i class="fa fa-check"></i> 保存
|
</button>
|
<button class="btn btn-warning" id="close" type="button" onclick="colseLayer()">
|
<i class="fa fa-remove"></i> 关闭
|
</button>
|
</div>
|
</div>
|
<script>
|
$(function () {
|
cheackForm("ZXFSform");
|
if ($("#basemaptype").val() != "影像") {
|
$("#jingdu").css("display", "none");
|
};
|
});
|
|
//复制弹框
|
function reflayerCopy() {
|
//弹出一个页面层
|
layer.open({
|
type: 1,
|
title: '复制',
|
shadeClose: true,
|
shade: false,
|
maxmin: false, //开启最大化最小化按钮
|
area: ['650px', '170px'],
|
content: jQuery("#resCopyInfo")
|
});
|
}
|
|
//关闭复制弹框
|
function colseLayer() {
|
$(".layui-layer-close1").click();
|
}
|
</script>
|
<script th:inline="javascript">
|
var removedOpts = [];
|
/*<![CDATA[*/
|
var typeandurladdrowlist = [];
|
|
$(function () {
|
|
});
|
/*]]>*/
|
var resMainInfoId = $("#resMainInfoId").val();
|
//保存事件
|
/*<![CDATA[*/
|
$('#save').on('click', function () {
|
if ($('#ZXFSform').valid()) {
|
var str1 = "";
|
$("#ZXFSList").find('tr').each(function (i, item) {
|
if (i != 0 && $(item).find("[name=ShowWay]").val() != "" && $(item).find("[name=ShowWay]").val() != "--") {
|
var ShowWay = $(item).find("[name=ShowWay]").val();
|
var Url = $(item).find("[name=Url]").val();
|
if (Url == "--") {
|
Url == "";
|
}
|
var ReMark = $(item).find("[name=ReMark]").val();
|
str1 += ShowWay + "," + Url + "," + ReMark + "|";
|
}
|
});
|
|
$('#ZXFSform').ajaxSubmit({
|
url: '/res/ResManage/ResRegister/insertSelectiveAndUpdate?resourceid=' + resMainInfoId,
|
type: 'post',
|
dataType: 'text',
|
data: {'extMapUrlStr': str1},
|
success: function (data) {
|
if (data == "1") {
|
alert("保存成功!");
|
parent.FTabPages.resetTab();
|
} else {
|
alert("保存失败!");
|
}
|
},
|
error: function (e) {
|
alert(e.message);
|
}
|
});
|
} else {
|
// alert("您输入的信息存在错误,请更正后再提交!");
|
}
|
});
|
|
//新增行
|
function AddRow2() {
|
var html = "<tr><td>" +
|
"<input type=\"text\" name=\"ShowWay\" class=\"m-warp span12\" style=\"border:0px;\" onblur=\"TextBlur(this)\" onfocus=\"TextFocus(this)\" />"
|
|
html +=
|
"</td><td><input type=\"text\" value =\"--\" name=\"Url\" class=\"m-warp span12\" style=\"border:0px;\" onblur=\"TextBlur(this)\" onfocus=\"TextFocus(this)\" /></td>"
|
+ "<td>\n" +
|
"<input type=\"text\" name=\"ReMark\" value =\"--\" class=\"m-warp span12\" style=\"border:0px;\" onblur=\"TextBlur(this)\" onfocus=\"TextFocus(this)\" />" +
|
"</td>"
|
+ "<td style='text-align:center;'>"
|
+ "<img src='" + "/image/wrong.gif" + "' alt='删除' style='cursor:pointer;' onclick='DeleteRowData2(this)' />"
|
$("#ZXFSList").append(html);
|
}
|
/*]]>*/
|
|
//删除扩展信息
|
$("#JCDTDelete").click(function () {
|
if (confirm("删除包括资源基本信息和扩展信息,确定删除吗?")) {
|
$.ajax({
|
url: '/res/resExtBaseMap/deleteByPrimaryKey?resourceid=' + resMainInfoId,
|
type: 'post',
|
dataType: 'json',
|
data: {},
|
success: function (data) {
|
if (data == "1") {
|
alert("删除成功!");
|
parent.FTabPages.resetTab();
|
} else {
|
alert("删除失败!");
|
}
|
},
|
error: function (e) {
|
alert(e.message)
|
}
|
})
|
}
|
});
|
|
//鼠标失去焦点事件
|
function TextBlur(obj) {
|
if (obj.value == '') {
|
obj.value = '--';
|
obj.style.color = '#999';
|
}
|
}
|
|
//鼠标得到焦点事件
|
function TextFocus(obj) {
|
if (obj.value == '--') {
|
obj.value = '';
|
obj.style.color = '#000';
|
}
|
}
|
|
/*<![CDATA[*/
|
//删除协议与地址行数据
|
function DeleteRowData2(obj) {
|
var tbList = document.getElementById("ZXFSList");
|
var temRow = obj.parentNode.parentNode;
|
var select = temRow.children[0].children[0];
|
$('#ZXFSList').find('tr').each(function (i, item) {
|
if (i != 0 && $(select).val() != '') {
|
$(item).find('[name=typeandurl]').append("<option value='" + $(select).val() + "'>" + $(select).find('option:selected').text() + "</option>");
|
}
|
});
|
tbList.deleteRow(temRow.rowIndex);
|
}
|
/*]]>*/
|
|
/*<![CDATA[*/
|
function Downrow(obj) {
|
var index = obj.parentElement.parentElement.rowIndex;
|
var table = $("#ZXFSList")[0];
|
if (index < table.rows.length - 1 && index > 0) {
|
switchRow(table, parseInt(index), parseInt(index) + 1);
|
}
|
}
|
|
//向上移动
|
function Uprow(obj) {
|
var index = obj.parentElement.parentElement.rowIndex;
|
var table = $("#ZXFSList")[0];
|
if (index > 1) {
|
switchRow(table, parseInt(index), parseInt(index) - 1);
|
}
|
}
|
|
function ChangeBiLi(obj) {
|
if (obj.value != "") {
|
var biliend = document.getElementById("xianshibiliEnd");
|
biliend.disabled = "";
|
biliend.innerHTML = "";
|
for (i = Number(obj.value) + 1; i < 21; i++) {
|
biliend.innerHTML += "<option value='" + i + "'>" + i + "</option>"
|
}
|
} else {
|
var biliend = document.getElementById("xianshibiliEnd");
|
biliend.disabled = true;
|
biliend.innerHTML = "";
|
biliend.innerHTML += "<option value=''>" + "--请选择--" + "</option>"
|
}
|
}
|
|
function switchRow(table, frow, trow) {
|
for (var i = 0; i < table.rows[0].cells.length; i++) {
|
switch (i) {
|
case 0:
|
var tempArray = [];
|
var fselect = table.rows[frow].cells[i].children[0];
|
for (var j = 0; j < fselect.options.length; j++) {
|
tempArray.push({value: fselect.options[j].value, text: fselect.options[j].text});
|
}
|
var selectedindex = fselect.selectedIndex;
|
var tselect = table.rows[trow].cells[i].children[0];
|
//清空下拉框选项
|
for (var j = fselect.options.length - 1; j >= 0; j--) {
|
fselect.options[j] = null;
|
}
|
//交换下拉框选项
|
for (var j = 0; j < tselect.options.length; j++) {
|
fselect.options.add(new Option(tselect.options[j].text, tselect.options[j].value));
|
}
|
fselect.selectedIndex = tselect.selectedIndex;
|
for (var j = tselect.options.length - 1; j >= 0; j--) {
|
tselect.options[j] = null;
|
}
|
tempArray.forEach(function (item, i, arr) {
|
tselect.options.add(new Option(item.text, item.value));
|
})
|
tselect.selectedIndex = selectedindex;
|
break;
|
case 1:
|
var temp = "";
|
var ftext = table.rows[frow].cells[i].children[0];
|
var ttext = table.rows[trow].cells[i].children[0];
|
temp = ftext.value;
|
ftext.value = ttext.value;
|
ttext.value = temp;
|
}
|
}
|
}
|
|
/*]]>*/
|
//复制
|
function copyRes() {
|
if ($("#copyname").val() == "") {
|
alert("资源名称不能为空!");
|
return false;
|
}
|
$.ajax({
|
url: '/res/ZiYuan/copyMainInfoAndKZ',
|
type: 'post',
|
dataType: 'json',
|
data: {
|
"resourceid": resMainInfoId,
|
"copyname": $("#copyname").val(),
|
"copyurl": "",
|
"type": "ExtBaseMap"
|
},
|
success: function (data) {
|
if (data != 0) {
|
alert("复制成功!")
|
parent.location.href = "/res/ResManage/ResRegister/ResEdit?resMainInfoId=" + data;
|
}
|
},
|
error: function (e) {
|
alert(e.message)
|
}
|
});
|
}
|
|
function esbselect() {
|
var onselect = document.getElementById("espproxy");
|
var onval = onselect.options[onselect.selectedIndex].value;
|
if (onval == 1) {
|
$(".token").css("display", "none");
|
$(".username").css("display", "none");
|
$(".password").css("display", "none");
|
}
|
else {
|
$(".token").css("display", "block");
|
$(".username").css("display", "block");
|
$(".password").css("display", "block");
|
}
|
}
|
</script>
|