<!DOCTYPE html>
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:layout="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" layout:decorator="MasterPage/Layout.Empty">
|
<head>
|
<meta charset="UTF-8" />
|
<title>资源新增或修改</title>
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport" />
|
<link rel="stylesheet" th:href="@{${pubzyWebRoot} + 'BootStrap4/expand/plugins/portlet/css/portlet.css'}" />
|
<link th:href="@{${pubzyWebRoot} + 'ext-4.2.1.883/resources/css/ext-all-neptune.css'}" rel="stylesheet" type="text/css" />
|
<link th:href="@{${pubzyWebRoot} + 'zTree/css/metroStyle/metroStyle.css'}" rel="stylesheet" type="text/css" />
|
<link href="/js/jqUI/jquery-ui.min.css" rel="stylesheet" type="text/css" />
|
<script th:src="@{${pubzyWebRoot} + 'BootStrap4/expand/plugins/portlet/portlet.js'}"></script>
|
<script th:src="@{${pubzyWebRoot} + 'ext-4.2.1.883/ext-all.js'}"></script>
|
<script th:src="@{${pubzyWebRoot} + 'ext-4.2.1.883/locale/ext-lang-zh_CN.js'}"></script>
|
<script th:src="@{${pubzyWebRoot} + 'ext-4.2.1.883/PagingToolbar.js'}"></script>
|
<script th:src="@{${pubzyWebRoot} + 'media/js/jquery.form-3.51.0.js'}"></script>
|
|
<script th:src="@{${pubzyWebRoot} + 'zTree/js/jquery.ztree.all.js'}"></script>
|
<script th:src="@{${pubzyWebRoot} + 'zTree/js/jquery.ztree.core.js'}"></script>
|
<script th:src="@{${pubzyWebRoot} + 'zTree/js/jquery.ztree.exedit.js'}"></script>
|
<script th:src="@{${pubzyWebRoot} + 'zTree/js/jquery.ztree.excheck.js'}"></script>
|
<script src="/js/jqUI/jquery-ui.min.js"></script>
|
<style type="text/css">
|
body {
|
padding: 0;
|
background-color: white !important;
|
box-sizing: border-box;
|
overflow-x: hidden;
|
}
|
.form-control {
|
padding: 0.3rem 0.7rem;
|
height: 34px;
|
display: inline-block;
|
}
|
.control-label {
|
padding-top: 0 !important;
|
width: 94px;
|
float: left;
|
line-height: 30px;
|
padding-right: 1em;
|
}
|
.control-group {
|
margin-bottom: 1em;
|
}
|
.controls {
|
margin-left: 94px;
|
}
|
.row {
|
margin-left: 0;
|
margin-right: 0;
|
}
|
.col-sm-3,
|
.col-sm-6,
|
.col-sm-12 {
|
padding-left: 0;
|
padding-right: 0;
|
}
|
.fade {
|
display: none;
|
}
|
.in.fade {
|
display: block;
|
}
|
.control-group error {
|
border-color: #b94a48;
|
}
|
#button {
|
color: #fff !important;
|
background-color: #039cfd !important;
|
border-color: #039cfd !important;
|
}
|
img {
|
cursor: pointer;
|
}
|
.nav-tabs > .active > a, .nav-tabs > .active > a:hover, .nav-tabs > .active > a:focus {
|
color: #555;
|
cursor: default;
|
background-color: #fff;
|
border: 1px solid #ddd;
|
border-bottom-color: transparent;
|
}
|
.x-grid-view {
|
overflow: hidden !important;
|
}
|
.x-body{
|
overflow-x: hidden;
|
}
|
|
.ui-widget-content.ui-widget {
|
max-height: 450px;
|
overflow-y: auto;
|
overflow-x: hidden;
|
}
|
</style>
|
|
<script th:inline="javascript">
|
/*<![CDATA[*/
|
var flag = [[${flag}]];
|
var resourceid=[[${resourceid}]];
|
var lanbaseurl = [[${lanbaseurl}]];
|
/*]]>*/
|
jQuery(function() {
|
initZtree();
|
})
|
|
//加载目录树
|
function initZtree() {
|
var data = {
|
title: $("#title").val(),
|
datasources: $("#datasources").val()
|
}
|
/**
|
* zTree配置
|
*/
|
var setting = {
|
view: {
|
selectedMulti: false,
|
showTitle : true
|
},
|
check: {
|
enable: false
|
},
|
data: {
|
simpleData: {
|
enable: true
|
},
|
key: {
|
title:"title"//1 json中要有一个key是 title就可以了
|
},
|
},
|
async: {
|
enable: true,
|
url: "/res/common/getResourceSelectTree?flag=" + flag + '&resourceid=' + resourceid,
|
autoParam: ["id=parentid"],
|
otherParam:data
|
},
|
callback: {
|
onClick: ztreeonClick
|
}
|
};
|
var zNodes = {
|
id: 0,
|
name: "资源目录",
|
pId: -1,
|
isParent: true,
|
title:"",
|
iconOpen:"/image/classicons/folderOpen.png",//update:dsh(2018/12/05)
|
iconClose:"/image/classicons/folder.png"
|
};
|
var treeObj = $.fn.zTree.init($("#menuTree"), setting, zNodes); //初始化zTree
|
treeObj.reAsyncChildNodes(treeObj.getNodes()[0], "refresh", false); //强行异步加载父节点的子节点。
|
}
|
//树点击事件
|
function ztreeonClick(event, treeId, treeNode, clickFlag){
|
if(treeNode.isParent == false && treeNode.id.indexOf("_") != -1) {
|
var id = treeNode.id.split('_')[1];
|
var name = treeNode.name;
|
if (flag == "zbcx") {
|
queding(id,name);
|
} else if (flag == "gltc") {
|
AddBusinessRef(id,name);
|
}
|
}
|
}
|
|
function queding(id,name) {
|
//获取那个被选中
|
var str = id;
|
if (str != "") {
|
$.ajax({
|
url: '/res/queryaround/insert',
|
type: 'post',
|
dataType:'text',
|
data: {resourceid:resourceid,ZiYuanIdStr: str},
|
success: function (data) {
|
if(data=="1"){
|
alert('添加成功');
|
parent.ZYMLZiYuanStore.loadPage(1); //重新查询并跳转到第一页
|
parent.winparpostMsg();//跨域回调
|
closeLayer();
|
} else{
|
alert('添加失败');
|
}
|
}
|
})
|
}
|
}
|
|
function AddBusinessRef(id,name){
|
var selectModel;
|
var str = id;
|
if (str != "") {
|
// if (confirm("确定添加吗?")) {
|
$.ajax({
|
url: '/res/businessref/insertSelective',
|
type: 'post',
|
data: {
|
'resourceids':str,
|
'resourceid':resourceid
|
},
|
success: function (data) {
|
if (data == 1) {
|
alert("添加成功!");
|
window.parent.Search();
|
closeLayer();
|
}
|
else {
|
alert(data.msg);
|
}
|
}
|
})
|
// }
|
}
|
}
|
|
//关闭窗口
|
function closeLayer(){
|
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
|
parent.layer.close(index);
|
}
|
|
</script>
|
<script>
|
function findPinyinByKeyWord(){
|
var title = $("#title").val();
|
|
$("#title").autocomplete({
|
source: '/res/common/findPinyinByKeyWord?keyWord='+encodeURI(encodeURI(title)) + "&flag=" + flag + '&resourceid=' + resourceid, //请求的url
|
minLength: 1
|
});
|
}
|
</script>
|
</head>
|
<body layout:fragment="content">
|
<div class="portlet box ltblue" style="margin-bottom: 0px !important;border:none;width:100%;">
|
<input type="hidden" id="flag" th:value="${flag}" />
|
<input type="hidden" id="resMainInfoId" th:value="${resourceid}" />
|
<!--<div class="portlet-title">-->
|
<!--<div class="caption">-->
|
<!--<i class="icon-reorder"></i>查询区-->
|
<!--</div>-->
|
<!--<div class="tools"></div>-->
|
<!--</div>-->
|
<div class="portlet-body form">
|
<div id="tabBase" class="row">
|
<form id="SearchForm" style="width: 100%;">
|
<div class="row">
|
<div class="col-sm-6">
|
<label class="control-label">资源名称:</label>
|
<div class="controls">
|
<input type="text" class="form-control col-sm-11" id="title" name="title" onkeyup="findPinyinByKeyWord()" onclick="findPinyinByKeyWord()" placeholder="输入资源名称或拼音首字母查询" value="" />
|
</div>
|
</div>
|
<div class="col-sm-6">
|
<label class="control-label">数据来源:</label>
|
<div class="controls">
|
<select id="datasources" name="datasources" class="form-control col-sm-11">
|
<option value="">--请选择--</option>
|
<option th:each="item:${DataSourceList}" th:value="${item.key}" th:text="${item.value}"></option>
|
</select>
|
</div>
|
</div>
|
</div>
|
<div class="row" style="margin-top: 6px">
|
<div class="col-sm-6">
|
<!--<a class="btn btn-primary-outline" onclick="add();"><i class="fa fa-plus"></i> 新增</a>-->
|
</div>
|
<div class="col-sm-6" style="text-align: right;">
|
<a class="btn btn-primary-outline" onclick="initZtree();"><i class="fa fa-search"></i> 查询</a>
|
<!--<a class="btn btn-primary-outline" onclick="Clear();"><i class="fa fa-trash-o"></i> 清除</a>-->
|
<!--<a class="btn btn-primary-outline" onclick="addResourceSelect();" style="margin-right:32px;"><i class="fa fa-plus"></i> 确定</a>-->
|
</div>
|
</div>
|
</form>
|
</div>
|
</div>
|
</div>
|
<!--<div id="grid" style="width: 100%;float: left"></div>-->
|
<div class='my-ztree' style="height: 397px;overflow-y:auto;border-top: 1px solid #f5f5f5;">
|
<ul id='menuTree' class='ztree'></ul>
|
</div>
|
</body>
|
<!--<script src="/js/common/resource_select.js"></script>-->
|
</html>
|