<!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" />
|
<link rel="stylesheet" th:href="@{${pubzyWebRoot} + 'BootStrap4/assets/plugins/bootstrap-datepicker/old_datepaker/datepicker.css'}" />
|
<link rel="stylesheet" href="/css/tagsinput.css"/>
|
<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} + 'media/css/uniform.default.css'}"/>
|
<link th:href="@{${pubzyWebRoot} + 'ext-4.2.1.883/resources/css/ext-all-neptune.css'}" rel="stylesheet" type="text/css"/>
|
<script th:src="@{${pubzyWebRoot} + 'BootStrap4/expand/plugins/portlet/portlet.js'}"></script>
|
<script th:src="@{${pubzyWebRoot} + 'BootStrap4/assets/plugins/bootstrap-datepicker/old_datepaker/bootstrap-datepicker.js'}"></script>
|
<script th:src="@{${pubzyWebRoot} + 'BootStrap4/assets/plugins/bootstrap-datepicker/old_datepaker/bootstrap-datepicker.zh-CN.min.js'}"></script>
|
<script th:src="@{${pubzyWebRoot} + 'media/js/jquery.form-3.51.0.js'}"></script>
|
<script th:src="@{${pubzyWebRoot} + 'media/js/validation/jquery.validate.min.js'}" type="text/javascript"></script>
|
<script th:src="@{${pubzyWebRoot} + 'media/js/validation/messages_zh.js'}" type="text/javascript"></script>
|
<script th:src="@{${pubzyWebRoot} + 'media/js/validation/additional-methods.min.js'}" type="text/javascript"></script>
|
<script th:src="@{${pubzyWebRoot} + 'media/js/yanzhen.js'}" type="text/javascript"></script>
|
|
<style>
|
body {
|
background-color: white;
|
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: 160px;
|
float: left;
|
line-height: 30px;
|
padding-right: 1.5em;
|
}
|
|
.control-group {
|
margin-bottom: 1em;
|
}
|
|
.controls {
|
margin-left: 160px;
|
}
|
|
.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;
|
}
|
. {
|
display: none;
|
}
|
.tags-wrapper {
|
width: 75%;
|
display: inline-block;
|
}
|
#tagInput {
|
width: 100%;
|
}
|
.layer-tags-wrapper {
|
z-index: 9;
|
}
|
|
td {
|
border: 1px solid #ccc;
|
}
|
#tbGKList input{
|
text-align:center;
|
width:100%;
|
min-height: 30px;
|
}
|
|
.portlet { /*资源订阅页面被底部操作栏遮挡*/
|
margin-bottom: 60px;
|
}
|
|
</style>
|
|
<script th:inline="javascript">
|
$(function () {
|
cheackForm("ziyuandingyueform");
|
var tablefields = [[${ResSubscriptions.tablefields}]];
|
//var fields = eval('('+tablefields+')');
|
var fields=JSON.parse(tablefields);//20190329 by wangqin
|
var html = ""; //showtablefields 显示的映射字段
|
html += "<table class=\"table table-bordered\">";
|
html += "<thead><tr><th>字段名称</th><th>字段类型</th><th>映射名称</th><th>映射类型</th></tr><tr></tr></thead>";
|
html += "<tbody id=\"ziDuanMapping\">";
|
for(var i = 0;i<fields.fieldMappings.length;i++) {
|
html += "<tr><td>" + fields.fieldMappings[i].fieldName + "</td><td>" + fields.fieldMappings[i].fieldType + "</td><td>" + fields.fieldMappings[i].fieldMappingName + "</td><td>" + fields.fieldMappings[i].fieldMappingType + "</td>";
|
}
|
html += "</tbody></table>";
|
$("#showtablefields").html(html);
|
$("#tablefields").val(tablefields);
|
})
|
|
</script>
|
</head>
|
<body>
|
<div id="rapp" layout:fragment="content" style="background-color: #fff;">
|
<div id="div_content" style="width: 100%;">
|
<div class="row-fluid">
|
<div class="span12">
|
<form class="form-horizontal" id="ziyuandingyueform" 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">
|
<input type="hidden" id="resourceid" name="resourceid" th:value="${ResSubscriptions.resourceid}" />
|
<input type="hidden" id="appid" name="appid" th:value="${ResSubscriptions.appid}" />
|
<input type="hidden" id="isnew" name="isnew" th:value="${ResSubscriptions.isnew}" />
|
<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 type="hidden" class="form-control col-sm-11" id="databasetype" name="databasetype" th:value="${databasetype}" />
|
<input th:value="${datasourceid}" id="datasourceid" name="datasourceid" class="form-control col-sm-8" type="hidden" required=""/>
|
<!--<input th:value="8" id="datasourceid" name="datasourceid" class="form-control col-sm-8" type="hidden" required=""/>-->
|
<input id="databasename" th:value="${Databasename}" class="form-control col-sm-7" style="width:57%" readonly="readonly" onpropertychange="" required="" />
|
<button th:if="${edit==1}" title="选择数据源" type="button" class="btn btn-primary" id="ShowDataBase" style="vertical-align:baseline; padding: 0.375em 0.7em;">选择</button>
|
<button th:if="${edit==1}" title="新增数据源" type="button" class="btn btn-primary" onclick="addDataSource();" style="vertical-align:baseline;padding: 0.375em 0.7em;">新增</button>
|
<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">
|
<div class="control-group input-icon">
|
<label class="control-label">表名称<span style="color: red;">*</span></label>
|
<div class="controls input-icon">
|
<input th:if="${edit==0}" class="form-control col-sm-6" id="tablename" name="tablename" th:value="${ResSubscriptions.tablename}" readonly="readonly"/>
|
<input th:if="${edit==1 && ResSubscriptions.isnew==1}" class="form-control col-sm-6" id="tablename" name="tablename" th:value="${ResSubscriptions.tablename}" readonly="readonly"/>
|
<input th:if="${edit==1 && ResSubscriptions.isnew!=1}" class="form-control col-sm-6" id="tablename" name="tablename" th:value="${ResSubscriptions.tablename}" required=""/>
|
<button th:if="${edit==1 && ResSubscriptions.isnew!=1}" title="选择数据库表" type="button" class="btn btn-primary" id="ShowTables" style="vertical-align:baseline; padding: 0.375em 0.7em;">选择</button>
|
|
<select th:if="${edit==1}" style="display:none;width:62.5%" class="form-control col-sm-6" id="table_name" onchange="changeTablefields(this);">
|
<option value="">选择数据库表</option>
|
<option th:each="item:${map}" th:value="${item.key}" th:text="${item.value}" th:selected="(${ResSubscriptions.tablename}==${item.value})?'true':'false'"></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">
|
<!--<div class="col-sm-6">-->
|
<!--<div class="control-group">-->
|
<!--<label class="control-label">订阅字段集</label>-->
|
<!--<div class="controls input-icon">-->
|
<!--<input class="form-control col-sm-9" type="text" id="tablefields" name="tablefields" th:value="${tablefields}" />-->
|
<!--</div>-->
|
<!--</div>-->
|
<!--</div>-->
|
<div class="col-sm-12">
|
<div class="control-group">
|
<label class="control-label">检索条件</label>
|
<div class="controls input-icon">
|
<!--<input class="form-control col-sm-11" type="text" id="querywhere" name="querywhere" th:value="${ResSubscriptions.querywhere}" />-->
|
<input th:if="${edit==0}" class="form-control col-sm-10" type="text" id="querywhere" name="querywhere" th:value="${ResSubscriptions.querywhere}" readonly="readonly"/>
|
<input th:if="${edit==1}" class="form-control col-sm-10" type="text" id="querywhere" name="querywhere" th:value="${ResSubscriptions.querywhere}"/>
|
<label th:if="${edit==1}">请规范填写。</label>
|
</div>
|
<div th:if="${edit==1}" class="controls input-icon">
|
<label>(说明) 数据源表table_A检索sql语句为:select fieldMappingName from table_A where + 检索条件 。例 : sex='男'</label><br/>
|
<label>关联table_B表范围检索:table_A.deptname in (select table_A.deptname from table_A left join table_B on table_A.id=table_B.id where table_B.name='')
|
<br/>例:username in (select username from ORG_USER left join ORG_DEPT on ORG_USER.deptid=ORG_DEPT.id where ORG_DEPT.deptname='研发一部')
|
</label>
|
</div>
|
</div>
|
</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">
|
<input th:if="${edit==0}" style="width:62.5%;" class="form-control col-sm-6" type="text" id="hangup" name="hangup" readonly="readonly" th:value="${ResSubscriptions.hangup == 1?'是':'否'}"/>
|
<input th:if="${edit==1 and ResSubscriptions.hangup==null}" th:name="hangup" type="radio" value="1" required=""/><label th:if="${edit==1 and ResSubscriptions.hangup==null}">是</label>
|
<input th:if="${edit==1 and ResSubscriptions.hangup==null}" th:name="hangup" type="radio" value="0" checked="checked" required=""/><label th:if="${edit==1 and ResSubscriptions.hangup==null}">否</label>
|
<input th:if="${edit==1 and ResSubscriptions.hangup!=null}" th:name="hangup" type="radio" value="1" th:checked="${ResSubscriptions.hangup == 1?'true':'false'}" required=""/><label th:if="${edit==1 and ResSubscriptions.hangup!=null}">是</label>
|
<input th:if="${edit==1 and ResSubscriptions.hangup!=null}" th:name="hangup" type="radio" value="0" th:checked="${ResSubscriptions.hangup == 0?'true':'false'}" required=""/><label th:if="${edit==1 and ResSubscriptions.hangup!=null}">否</label>
|
</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">
|
<input th:if="${edit==0}" style="width:62.5%;" class="form-control col-sm-6" type="text" id="cleartable" name="cleartable" readonly="readonly" th:value="${ResSubscriptions.cleartable == 1?'是':'否'}"/>
|
<input th:if="${edit==1 and ResSubscriptions.cleartable==null}" th:name="cleartable" type="radio" value="1" required=""/><label th:if="${edit==1 and ResSubscriptions.cleartable==null}">是</label>
|
<input th:if="${edit==1 and ResSubscriptions.cleartable==null}" th:name="cleartable" type="radio" value="0" checked="checked" required=""/><label th:if="${edit==1 and ResSubscriptions.cleartable==null}">否</label>
|
<input th:if="${edit==1 and ResSubscriptions.cleartable!=null}" th:name="cleartable" type="radio" value="1" th:checked="${ResSubscriptions.cleartable == 1?'true':'false'}" required=""/><label th:if="${edit==1 and ResSubscriptions.cleartable!=null}">是</label>
|
<input th:if="${edit==1 and ResSubscriptions.cleartable!=null}" th:name="cleartable" type="radio" value="0" th:checked="${ResSubscriptions.cleartable == 0?'true':'false'}" required=""/><label th:if="${edit==1 and ResSubscriptions.cleartable!=null}">否</label>
|
</div>
|
</div>
|
</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">
|
<input th:if="${edit==0}" class="form-control col-sm-8" type="text" id="synctimes" name="synctimes" th:value="${ResSubscriptions.synctimes}" readonly="readonly"/>
|
<input th:if="${edit==1}" class="form-control col-sm-8" type="text" id="synctimes" name="synctimes" th:value="${ResSubscriptions.synctimes}" required=""/>
|
<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">
|
<div class="col-sm-12">
|
<div class="control-group">
|
<label class="control-label">字段映射<span style="color: red;">*</span></label>
|
<div class="controls input-icon">
|
<div readonly="readonly" id="showtablefields" class="form-control col-sm-10" cols="20" style="height: 100%;min-height:100px;">
|
|
</div>
|
<textarea readonly="readonly" th:value="${ResSubscriptions.tablefields}" id="tablefields" name="tablefields"
|
class="form-control col-sm-10" cols="20" style="height: 300px;display: none;" required=""></textarea>
|
<button th:if="${edit==1 && ResSubscriptions.isnew!=1}" title="配置" type="button" class="btn btn-primary" onclick="setField()" style="vertical-align:baseline;padding: 0.375em 0.7em;">配置</button>
|
<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">
|
<div class="col-sm-12">
|
<div class="control-group">
|
<label class="control-label">申请理由</label>
|
<div class="controls input-icon">
|
<textarea th:if="${edit==0}" th:text="${ResSubscriptions.appreason}" name="appreason" class="form-control col-sm-10" id="appreason" cols="20" style="height:100px;" readonly="readonly"></textarea>
|
<textarea th:if="${edit==1}" th:text="${ResSubscriptions.appreason}" name="appreason" class="form-control col-sm-10" id="appreason" cols="20" style="height:100px;"></textarea>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="form-actions navbar-fixed-bottom" style="z-index: 0;">
|
<div style="float: left;">
|
<button th:if="${edit==1}" class="btn btn-primary" id="save" type="button">
|
<i class="fa fa-check"></i> 保存
|
</button>
|
<button th:if="${edit==1}" th:if="${not #lists.isEmpty(resMainInfoId)}" class="btn btn-danger" id="JCDTDelete" type="button">
|
<i class="fa fa-trash-o"></i> 删除
|
</button>
|
<button th:if="${edit==1}" class="btn btn-warning" id="close" type="button" onclick="window.close()">
|
<i class="fa fa-remove"></i> 关闭
|
</button>
|
<button th:if="${edit==0}" class="btn btn-primary" id="edit" type="button">
|
<i class="fa fa-check"></i> 编辑
|
</button>
|
</div>
|
</div>
|
</div>
|
<script>
|
//弹出数据源页面
|
$("#ShowDataBase").on("click", function () {
|
layer.open({
|
type: 2,
|
title: "选择数据源",
|
shadeClose: true,
|
area: ["900px", "590px"],
|
content: "../manage/datasource/panel_select"
|
})
|
})
|
|
$("#ShowTables").on("click", function () {
|
$("#table_name").css("display","");
|
})
|
|
function spaceShowOrHide() {
|
if($("#databasetype").val() == "Oracle" ){
|
$("#space").css("display","");
|
}
|
else {
|
$("#space").css("display","none");
|
$("#spacename").val("");
|
}
|
}
|
|
function addDataSource() {
|
layer.open({
|
type: 2,
|
title: "新增数据源",
|
shadeClose: true,
|
area: ["900px", "590px"],
|
content: "AddDataSource"
|
})
|
}
|
|
function selectSqlTablt(){
|
//获取选个数据库类型
|
var datasourceid=$("#datasourceid").val();
|
$('#ziyuandingyueform').ajaxSubmit({
|
url: '/res/ZiYuan/selectSqlTable',
|
type: 'post',
|
dataType: 'json',
|
data: {'datasourceid': datasourceid},
|
success: function (data) {
|
var json = eval(data);
|
//$("#table_name").append("<option value=\"\">选择数据库表</option>");
|
for (var i = 0; i < json.length; i++) {
|
$("#table_name").append("<option value='"+ json[i].TABLENAME+"'>" +json[i].TABLENAME+"</option>");
|
}
|
},
|
error: function (e) {
|
alert(e.message);
|
}
|
})
|
|
}
|
$("#databasename").change(function () {
|
$("#tablename").empty();
|
selectSqlTablt();
|
});
|
|
|
|
|
$(function(){
|
cheackForm("ziyuandingyueform");
|
jQuery(".date-picker").datepicker({ language: 'zh-CN',format: 'yyyy-mm-dd' });
|
})
|
|
$('#edit').on('click', function () {
|
var appid=$("#appid").val();
|
var url = "ziyuandingyue?appid=" + appid+"&edit=1";
|
window.location.replace(url);
|
})
|
|
function replace(string){
|
string = string.replace(">=","&ge;");
|
string = string.replace("<=","&le;");
|
string = string.replace("<","<");
|
string = string.replace(">",">");
|
return string;
|
}
|
|
$('#save').on('click', function () {
|
if ($('#ziyuandingyueform').valid()) {
|
var resourceid=$('#resourceid').val();
|
var appid=$('#appid').val();
|
var querywhere = $("#querywhere").val();
|
var condition = replace(querywhere);
|
var tablefields = $("#tablefields").val();
|
if(tablefields==null || tablefields==''){
|
alert("请先配置字段映射!");
|
return ;
|
}
|
$('#ziyuandingyueform').ajaxSubmit({
|
url: '/res/ressubscriptions/insertSelectiveAndUpdate?appid='+ appid +'&resourceid=' + resourceid,
|
type: 'post',
|
dataType: 'text',
|
data: {"condition":condition},
|
success: function (data) {
|
var json = eval('(' + data + ')');
|
if (json.result == "1") {
|
alert("保存成功!");
|
window.close();
|
parent.window.opener.location.reload();
|
} else {
|
alert("保存失败!");
|
}
|
},
|
error: function (e) {
|
alert(e.message);
|
}
|
});
|
} else {
|
// alert("您输入的信息存在错误,请更正后再提交!");
|
}
|
});
|
|
function changeTablefields(obj){
|
$("#tablename").val(obj.value);
|
obj.value="";
|
}
|
|
function setField(){
|
var datasourceid=$('#datasourceid').val();
|
var resourceid =$('#resourceid').val();
|
var tablename = $('#tablename').val();
|
if(tablename==""){
|
alert("请选择要打开的表");
|
return;
|
}
|
window.open("/res/ResManage/ResRegister/fieldMapping?datasourceid="+datasourceid+"&resourceid="+resourceid+"&tablename="+tablename);
|
}
|
</script>
|
</form>
|
</div>
|
</div>
|
</div>
|
</div>
|
</body>
|
</html>
|