483 lines
14 KiB
HTML
Executable File
483 lines
14 KiB
HTML
Executable File
<div class="xpageDW-wrap" id = "xpageDW-wrap">
|
||
<style>
|
||
.showURLInfo {
|
||
color: #1976D2;
|
||
cursor: pointer;
|
||
font-size: 13px;
|
||
margin-left: 2px;
|
||
margin-right: 2px;
|
||
font-weight: 800;
|
||
}
|
||
|
||
.app-box-select {
|
||
margin-top: 2px;
|
||
width: 234px;
|
||
height: 40px;
|
||
}
|
||
|
||
.app-img-select {
|
||
float: left;
|
||
}
|
||
|
||
.app-img-select img {
|
||
width: 35px;
|
||
}
|
||
|
||
.app-info-select {
|
||
width: 190px;
|
||
height: 38px;
|
||
float: right;
|
||
}
|
||
|
||
.app-name-select {
|
||
font-size: 13px;
|
||
font-weight: bold;
|
||
word-break: normal;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
|
||
.app-id-select {
|
||
word-break: normal;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
|
||
</style>
|
||
<script name="xpagejsContext">
|
||
function formatState(data) {
|
||
if (!data.id) {
|
||
return "";
|
||
}
|
||
var option = "<div class=\"app-box-select\">";
|
||
option += "<div class=\"app-img-select\">";
|
||
option += "<img src=\"" + data.img + "\">";
|
||
option += "</div>";
|
||
option += "<div class=\"app-info-select\">";
|
||
option += "<div class=\"app-name-select\" title=\"" + data.text + "\">" + data.text + "</div>";
|
||
option += "<div class=\"app-id-select\" title='" + data.id + "'>" + data.id + "</div>";
|
||
option += "</div></div>";
|
||
return $(option);
|
||
}
|
||
|
||
var urltool = {
|
||
xpageInit: function () {
|
||
$("#xpageDWtable .awsui-checkbox").check();
|
||
this.initSelect3();
|
||
},
|
||
initSelect3: function () {
|
||
var that = this;
|
||
$("#appSel").change(function () {
|
||
var val = $(this).val();
|
||
for (var i = 0, size_i = that.selectList.length; i < size_i; i++) {
|
||
var data = that.selectList[i];
|
||
if (data.id == val) {
|
||
var sel = $("#category");
|
||
try {
|
||
if(sel.hasClass("select2-hidden-accessible")){
|
||
sel.select2('destroy');
|
||
sel.find("option").remove();
|
||
}
|
||
} catch (e) {
|
||
}
|
||
sel.select2({
|
||
data: data.categoryList,
|
||
allowClear: false
|
||
});
|
||
if (that.defaultValue != null) {
|
||
sel.val(that.defaultValue.category);
|
||
}
|
||
sel.trigger("change");
|
||
break;
|
||
}
|
||
}
|
||
});
|
||
$("#category").change(function () {
|
||
var val = $(this).val();
|
||
for (var i = 0, size_i = that.selectList.length; i < size_i; i++) {
|
||
var data = that.selectList[i];
|
||
if (data.id == $("#appSel").val()) {
|
||
for (var j = 0, size_j = data.categoryList.length; j < size_j; j++) {
|
||
var datum = data.categoryList[j];
|
||
if (datum.id == val) {
|
||
var sel = $("#dataView");
|
||
try {
|
||
if(sel.hasClass("select2-hidden-accessible")){
|
||
sel.select2('destroy');
|
||
sel.find("optgroup").remove();
|
||
sel.find("option").remove();
|
||
}
|
||
} catch (e) {
|
||
}
|
||
sel.select2({
|
||
data: datum.viewList,
|
||
allowClear: false
|
||
});
|
||
if (that.defaultValue != null) {
|
||
sel.val(that.defaultValue.dwViewId);
|
||
}
|
||
sel.trigger("change");
|
||
break;
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
});
|
||
$("#dataView").change(function () {
|
||
that.refreshUrl();
|
||
});
|
||
that.getDataViewSel({
|
||
callback: function (list) {
|
||
that.selectList = list;
|
||
$("#appSel").select2({
|
||
data: list,
|
||
templateResult: formatState,
|
||
matcher: function (params, data) {
|
||
if (params.term) {
|
||
var val = params.term.toUpperCase()
|
||
if (data.id.toUpperCase().indexOf(val) > -1 || data.text.toUpperCase().indexOf(val) > -1) {
|
||
return data;
|
||
}
|
||
return null;
|
||
}
|
||
return data;
|
||
},
|
||
allowClear: false
|
||
});
|
||
var baseUrl = $("#cwUrl").val();
|
||
var baseUrlobj = urltool.getParams($("#cwUrl").val());
|
||
var isInitValue = false;
|
||
//是否需要初始化默认值
|
||
if (baseUrlobj != null && baseUrlobj.cmd != null && baseUrlobj.cmd == "CLIENT_DW_PORTAL") {
|
||
//不刷新
|
||
that.defaultValue = {
|
||
appId: baseUrlobj.appId,
|
||
dwViewId: baseUrlobj.dwViewId
|
||
}
|
||
$("#appSel").val(baseUrlobj.appId);
|
||
var category = null;
|
||
for (var i = 0, size_i = urltool.selectList.length; i < size_i; i++) {
|
||
var data = that.selectList[i];
|
||
if (data.id == baseUrlobj.appId) {
|
||
for (var j = 0, size_j = data.categoryList.length; j < size_j; j++) {
|
||
var datum = data.categoryList[j];
|
||
for (var k = 0, size_k = datum.viewList.length; k < size_k; k++) {
|
||
var viewListElement = datum.viewList[k];
|
||
for (var l = 0, size_l = viewListElement.children.length; l < size_l; l++) {
|
||
var views = viewListElement.children[l];
|
||
if (views.id == baseUrlobj.dwViewId) {
|
||
category = datum.id;
|
||
break;
|
||
}
|
||
}
|
||
if (category != null) {
|
||
break;
|
||
}
|
||
}
|
||
if (category != null) {
|
||
break;
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
that.defaultValue.category = category;
|
||
$("#appSel").val(that.defaultValue.appId);
|
||
isInitValue = true;
|
||
}
|
||
$("#appSel").trigger("change");
|
||
if (isInitValue) {
|
||
that.defaultValue = null;
|
||
if(!baseUrlobj.st){
|
||
baseUrl+="&st={t:'xpages'}"
|
||
$("#xpageDW-wrap").find(".xpagesContent").val(baseUrl);
|
||
}
|
||
$("#urlText").val(baseUrl);
|
||
//check
|
||
if (baseUrlobj.hideSearcher != "true") {
|
||
$("#includeSearcher").check("option", "checked", false);
|
||
}
|
||
if (baseUrlobj.hideTitle != "true") {
|
||
$("#hideTitle").check("option", "checked", false);
|
||
}
|
||
if (baseUrlobj.hideToolbar != "true") {
|
||
$("#includeToolbar").check("option", "checked", false);
|
||
}
|
||
if (baseUrlobj.hideTab != "true") {
|
||
$("#hideTab").check("option", "checked", false);
|
||
}
|
||
}
|
||
}
|
||
});
|
||
},
|
||
refreshUrl: function () {
|
||
if (this.defaultValue == null) {
|
||
var data = $("#dataView").select2("data")[0];
|
||
this.url = "&cmd=CLIENT_DW_PORTAL&processGroupId=" + data.processGroupId + "&appId=" + $("#appSel").val() + "&dwViewId=" + data.id + "&st={t:'xpages'}";
|
||
this.setText(true);
|
||
}
|
||
},
|
||
init: function (opt) {
|
||
this.xpageInit();
|
||
this.relativeHead = "./w";
|
||
var that = this;
|
||
$("#overallUrl").on("ifChanged", function () {
|
||
that.setText();
|
||
});
|
||
$("#includeSearcher").on("ifChanged", function () {
|
||
that.setText();
|
||
});
|
||
$("#includeToolbar").on("ifChanged", function () {
|
||
that.setText();
|
||
});
|
||
$("#hideTitle").on("ifChanged", function () {
|
||
that.setText();
|
||
});
|
||
$("#hideTab").on("ifChanged", function () {
|
||
that.setText();
|
||
});
|
||
$("#urlText").click(function () {
|
||
});
|
||
$(".showURLInfo").click(function () {
|
||
that.showInfo();
|
||
});
|
||
$("#currentSID").on("ifChanged", function () {
|
||
that.setText();
|
||
$("#urlText").focus();
|
||
$("#urlText").select();
|
||
});
|
||
},
|
||
showInfo: function () {
|
||
$("#showURLconditionDiv").css({
|
||
top: $(window).height() / 2 - 500 / 2 - 30,
|
||
left: $(window).width() / 2 - 640 / 2,
|
||
width: 600
|
||
});
|
||
$("#showURLconditionDiv").show().find("div").show();
|
||
$("#showURLconditionDiv .msg").css("max-width", "1200px");
|
||
},
|
||
setText: function (reset) {
|
||
var str = $("#overallUrl").prop("checked") ? this.overallHead : this.relativeHead;
|
||
if (reset || $.trim($("#urlText").val()) == "") {
|
||
str = str + ($("#currentSID").prop("checked") ? ("?sid=" + sid) : "?sid=@sid");
|
||
str += this.url;
|
||
str += $("#includeSearcher").prop("checked") ? "&hideSearcher=true" : "";
|
||
str += $("#includeToolbar").prop("checked") ? "&hideToolbar=true" : "";
|
||
str += $("#hideTitle").prop("checked") ? "&hideTitle=true" : "";
|
||
str += $("#hideTab").prop("checked") ? "&hideTab=true" : "";
|
||
} else {
|
||
var params = this.getParams($("#urlText").val());
|
||
params.sid = $("#currentSID").prop("checked") ? sid : "@sid";
|
||
if ($("#includeSearcher").prop("checked")) {
|
||
params.hideSearcher = true;
|
||
} else if (params.hideSearcher) {
|
||
delete params.hideSearcher;
|
||
}
|
||
if ($("#includeToolbar").prop("checked")) {
|
||
params.hideToolbar = true;
|
||
} else if (params.hideToolbar) {
|
||
delete params.hideToolbar;
|
||
}
|
||
if ($("#hideTitle").prop("checked")) {
|
||
params.hideTitle = true;
|
||
} else if (params.hideTitle) {
|
||
delete params.hideTitle;
|
||
}
|
||
if ($("#hideTab").prop("checked")) {
|
||
params.hideTab = true;
|
||
} else if (params.hideTab) {
|
||
delete params.hideTab;
|
||
}
|
||
params.sid = $("#currentSID").prop("checked") ? sid : "@sid";
|
||
if(!params.st){
|
||
params.st = "{t:'xpages'}"
|
||
}
|
||
str += "?";
|
||
var i = 0;
|
||
for (var k in params) {
|
||
if (i != 0) {
|
||
str += "&";
|
||
}
|
||
str += k + "=" + params[k];
|
||
i++;
|
||
}
|
||
}
|
||
$("#urlText").val(str);
|
||
$("#xpageDW-wrap").find(".xpagesContent").val(str);
|
||
},
|
||
getParams: function (url) {
|
||
var params = {};
|
||
try {
|
||
var ps = url.split("?")[1].split("&");
|
||
for (var i = 0, size_i = ps.length; i < size_i; i++) {
|
||
var paramStr = ps[i];
|
||
var map = paramStr.split("=");
|
||
if (map.length == 2) {
|
||
params[map[0]] = map[1];
|
||
}
|
||
}
|
||
} catch (e) {
|
||
}
|
||
return params;
|
||
},
|
||
getDataViewSel: function (opt) {
|
||
var value = opt.value;
|
||
if (value == "")
|
||
return;
|
||
var send = {}
|
||
var param = {
|
||
url: './jd',
|
||
type: 'POST',
|
||
dataType: "json",
|
||
data: {
|
||
cmd: "com.actionsoft.apps.addons.xpages_dw",
|
||
sid: sid,
|
||
option: JSON.stringify(send),
|
||
},
|
||
alert: false,
|
||
success: function (ro) {
|
||
if (ro.result == "ok") {
|
||
urltool.overallHead = ro.data.urlHead + "/r/w";
|
||
if (opt.callback) {
|
||
opt.callback(ro.data.list);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
awsui.ajax.request(param);
|
||
}
|
||
};
|
||
</script>
|
||
<textarea style="display: none;" class="xpagesContent"></textarea>
|
||
<table id="xpageDWtable" style="font-size:13px;width:100%;">
|
||
<colgroup>
|
||
<col width="24%"/>
|
||
<col width="76%"/>
|
||
</colgroup>
|
||
<tr>
|
||
<td>应用ID</td>
|
||
<td>
|
||
<select id="appSel" style="width: 360px;"></select>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>模型分类</td>
|
||
<td>
|
||
<select id="category" style="width:360px;"></select>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>视图名称</td>
|
||
<td>
|
||
<select id="dataView" style="width:360px;"></select>
|
||
</td>
|
||
</tr>
|
||
<tr class="urladdress-tr-cls">
|
||
<td>URL地址</td>
|
||
<td><textarea id="urlText" type="text" class="txt awsui-textbox" style="height:131px;resize: none;width:360px;" spellcheck="false"></textarea></td>
|
||
</tr>
|
||
<tr>
|
||
<td style="padding-top:3px;">选项</td>
|
||
<td style="padding-top:3px;">
|
||
<!--<input type="checkbox" class="awsui-checkbox" id="overallUrl">-->
|
||
<!--<label for="overallUrl" style=" margin-right: 65px;">全局</label> -->
|
||
<!--<input type="checkbox" class="awsui-checkbox" id="currentSID">-->
|
||
<!--<label for="currentSID">当前SID</label>-->
|
||
<!--<br>-->
|
||
<table style="width:100%;">
|
||
<tr>
|
||
<td>
|
||
<input type="checkbox" class="awsui-checkbox" id="includeSearcher" checked>
|
||
<label for="includeSearcher">隐藏查询条件区</label>
|
||
</td>
|
||
<td>
|
||
<input type="checkbox" class="awsui-checkbox" id="includeToolbar" checked>
|
||
<label for="includeToolbar" >隐藏工具条</label>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
<input type="checkbox" class="awsui-checkbox" id="hideTitle" checked>
|
||
<label for="hideTitle">隐藏标题栏</label>
|
||
</td>
|
||
<td>
|
||
<input type="checkbox" class="awsui-checkbox" id="hideTab" checked>
|
||
<label for="hideTab">隐藏视图导航</label>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td colspan="2" style="line-height: 18px; padding-top:8px;">
|
||
URL支持查询条件传参,请点击<span class="showURLInfo">此处</span>查看参数规则。
|
||
<br>
|
||
建议无标题风格且页面内边距设置为0px 0px 5px 5px。
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<div id="showURLconditionDiv" class="confirm-window awsui-dialog ui-draggable" style="position: fixed; top: 92.5px; left: 539px; display:none;">
|
||
<h2 class="dlg-title"></h2>
|
||
<div class="msg">
|
||
<table id="showURLcondition" class="table table-bordered " width="100%">
|
||
<colgroup>
|
||
<col width="11%"/>
|
||
<col width="27%"/>
|
||
<col width="63%"/>
|
||
</colgroup>
|
||
<tr>
|
||
<td colspan="3">
|
||
在URL追加参数condition,可以指定字段的条件,多个字段条件可以查询范围(多个条件可以是同个字段名,条件之间为并且关系)。<br>
|
||
例如:<br>
|
||
单个条件时:<br>
|
||
condition=[{ cp: 'like', fd: 'NAMEOBJ_FAF1569E1992444BA4B351C702E747CC', cv: '1'}];<br>
|
||
多个条件时:<br>
|
||
condition=[<br>
|
||
{ tp: 'num', cp: '<', fd: 'NUMOBJ_FAF1569E1992444BA4B351C702E737CC', cv: '100'},<br>
|
||
{ tp: 'num', cp: '>=', fd: 'NUMOBJ_FAF1569E1992444BA4B351C702E737CC', cv: '50'},<br>
|
||
];
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th>参数</th>
|
||
<th>描述</th>
|
||
<th>说明</th>
|
||
</tr>
|
||
<tr>
|
||
<td align="center">tp</td>
|
||
<td>数据类型,选填</td>
|
||
<td>可填写 str、num、date,默认str</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center">cp</td>
|
||
<td>比较运算符,必填</td>
|
||
<td>可填写 =、!=、<、>、<=、>=、like、not like</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center">fd</td>
|
||
<td>字段名称,必填</td>
|
||
<td>要求大写,支持2种格式:<br>
|
||
1.大写字段名。<br>
|
||
2.大写字段名+查询器条件查询组件标识ID。<br>
|
||
第2种格式时,如果页面上有此条件查询器项,将会回填此值到元素上。
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center">cv</td>
|
||
<td>值,必填</td>
|
||
<td>字段的值</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div class="dlg-close" style="display: block;" onclick="$('#showURLconditionDiv').hide();"></div>
|
||
<div class="dialog-button-wrap" style="text-align:center">
|
||
<div class="dlg-button">
|
||
<button type="button" class="button" onclick="$('#showURLconditionDiv').hide();">关闭</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
urltool.init();
|
||
</script>
|
||
</div> |