<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" trimDirectiveWhitespaces="true" %>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
|
<%
|
String path = request.getContextPath();
|
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
|
+ path + "/";
|
request.setAttribute("VEnter", "\r\n");
|
%>
|
|
<!DOCTYPE HTML>
|
<html>
|
<head>
|
<base href="<%=basePath%>">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<title>${view.viewName}</title>
|
<!--[if !IE]><!-->
|
<link href="static/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
|
<!--<![endif]-->
|
<!--[if gt IE 8]>
|
<link href="static/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
|
<![endif]-->
|
<link href="static/plugins/jquery-easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css">
|
<link rel="stylesheet" href="static/styles/material-teal.css" type="text/css">
|
<link rel="stylesheet" href="static/styles/initialize.css" type="text/css">
|
<link rel="stylesheet" href="static/styles/common.css" type="text/css">
|
<link rel="stylesheet" href="static/plugins/layer/skin/default/layer.css" type="text/css">
|
|
<script type="text/javascript" src="static/plugins/jquery/jquery.min.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui/jquery.easyui.min.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui-edatagrid/jquery.edatagrid.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui-datagrid-dnd/datagrid-dnd.js"></script>
|
<script type="text/javascript" src="static/scripts/easyuiExtend.js"></script>
|
<script type="text/javascript" src="static/scripts/jquery-extend.js"></script>
|
|
<script type="text/javascript" src="static/plugins/layer/layer.js"></script>
|
<script type="text/javascript" src="static/plugins/slimScroll/jquery.slimscroll.min.js"></script>
|
<script type="text/javascript" src="static/plugins/spinjs/spin.js"></script>
|
<script type="text/javascript" src="static/plugins/spinjs/jquery.spin.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery.blockUI.js"></script>
|
|
<script type="text/javascript" src="static/wcp/scripts/wcp.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.layer.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.blockUI.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.spin.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.jquery.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery.redirect.js"></script>
|
<!--[if lt IE 9]>
|
<script type="text/javascript" src="static/plugins/json2.js"></script>
|
<![endif]-->
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.infoPicker.js"></script>
|
|
<script type="text/javascript" src="static/plugins/crypto-js/core.js"></script>
|
<script type="text/javascript" src="static/plugins/crypto-js/enc-base64.js"></script>
|
|
<style>
|
html, body {
|
height: 100%;
|
width: 100%;
|
overflow: hidden;
|
}
|
|
.radioSpan {
|
position: relative;
|
border: 1px solid #95B8E7;
|
background-color: #fff;
|
vertical-align: middle;
|
display: inline-block;
|
overflow: hidden;
|
white-space: nowrap;
|
margin: 0;
|
padding: 0;
|
-moz-border-radius: 5px 5px 5px 5px;
|
-webkit-border-radius: 5px 5px 5px 5px;
|
border-radius: 5px 5px 5px 5px;
|
display: block;
|
}
|
|
.layout-split-west {
|
border-right: 5px solid #fff;
|
}
|
|
.layout-split-south {
|
border-top: 5px solid #fff;
|
}
|
|
.tabs-wrap {
|
border-width: 1px 1px 0px 1px;
|
border-style: solid;
|
border-color: #d4d4d4;
|
}
|
</style>
|
<script>
|
function computeHeight() {
|
computeBtns();
|
|
var wh = $(window).height();
|
var searchHeight = 0;
|
var tooltipHeight = 0;
|
<c:if test="${fromPageType==null}">
|
searchHeight = $("#div_search").height(); //搜索条高度
|
</c:if>
|
if ($("#div_tooltip").length > 0) {
|
tooltipHeight = $("#div_tooltip").height() + 10 + 16 + 2;
|
}
|
var topHeight = $(".pt-main-top").height(); //头部信息高度
|
if (topHeight > 0) {
|
topHeight += 24 + 8 + 1; //加上padding和margin-bottom
|
} else {
|
topHeight = 1;
|
}
|
|
var tmpHeight = wh - topHeight - searchHeight - tooltipHeight;
|
|
<c:if test="${view.enableNavClassify}">
|
//tmpHeight -= 5;
|
$('#layout_navigation').layout('resize', {
|
height: tmpHeight
|
});
|
</c:if>
|
//$("#right").height(tmpheight);
|
|
$('#right').layout('resize', {
|
height: tmpHeight
|
});
|
|
if ($("#div_subtabs").length > 0) {
|
$('#div_subtabs').tabs('resize', {
|
plain: true,
|
width: '100%',
|
height: tmpHeight / 2 - 5
|
});
|
|
var iframeHeight = tmpHeight / 2 - 32 - 7 - 2;
|
$("#div_subtabs").find("iframe").height(iframeHeight);
|
}
|
}
|
|
function subtabResize(width, height) {
|
if (height != "50%") {
|
$('#div_subtabs').tabs('resize', {
|
plain: true,
|
width: '100%',
|
height: height - 5
|
});
|
|
$("#div_subtabs").find("iframe").height(height - 32 - 7 - 1);
|
}
|
}
|
|
$(function () {
|
computeHeight();
|
});
|
</script>
|
</head>
|
<body class="pt-tree">
|
<c:if test="${fromPageType==null || fromPageType!='iframe_view'}">
|
<div class="margin-lr">
|
</c:if>
|
<c:if test="${fromPageType!=null && fromPageType=='iframe_view'}">
|
<div>
|
</c:if>
|
<c:if test="${fromPageType==null}">
|
<div class="pt-main-top clear">
|
<div class="pt-nav pt-nav-xs">
|
<span class="pt-title-icon">
|
<i class="${module.moduleIcon}"></i>
|
</span>
|
<div class="pt-title">
|
<div>
|
<h4>${view.viewName}</h4>
|
</div>
|
</div>
|
</div>
|
</c:if>
|
<c:if test="${fromPageType!=null}">
|
<div id="div_toolbar" style="padding:6px 22px;height:auto">
|
<div class="clear">
|
</c:if>
|
<div class="pt-search pt-search-xs">
|
<p class="pt-retrieval">
|
<input id="txtKeySearch" type="text" placeholder="${view.defaultSearchPrompt}">
|
<button id="btnKeySearch">
|
<i class="fa fa-search"></i>
|
</button>
|
</p>
|
<div class="pt-btnList">
|
<c:forEach items="${operations}" var="operation">
|
<c:if test="${operation.enableSystemOperation}">
|
<!-- 若启用流程,并且为新增按钮,多个流程序需要收缩,单个流程不收缩 -->
|
<c:if test="${operation.operationName=='SysAdd' && isShowFlowInForm}">
|
<c:if test="${flowDefinitionList.size()>1}">
|
<a class="easyui-menubutton ${operation.operationCss}"
|
data-options="menu:'#div_Add'">
|
<i class="${operation.operationIcon}"></i>
|
${operation.displayName}
|
</a>
|
<div id="div_Add" style="width:150px;">
|
<c:forEach items="${flowDefinitionList}" var="flowDefinition">
|
<div data-options="iconCls:'fa fa-plus-square'"
|
onclick="rowClickEvent(null, null, null, '${flowDefinition.flowId}')">${flowDefinition.flowName}</div>
|
</c:forEach>
|
</div>
|
</c:if>
|
<c:if test="${flowDefinitionList.size()==1}">
|
<button id="${operation.operationName}" opid="${operation.operationId}"
|
class="pt-btn ${operation.operationCss}"
|
onclick="rowClickEvent(null, null, null, '${flowDefinitionList.get(0).flowId}')">
|
<i class="${operation.operationIcon}"></i>
|
${operation.displayName}
|
</button>
|
</c:if>
|
</c:if>
|
<!-- 若不为新增按钮,或者未启用流程情况 -->
|
<c:if test="${'SysAdd'.equals(operation.operationName)==false || !isShowFlowInForm}">
|
<c:if test="${operation.operationName=='SysAdd'}">
|
<button id="${operation.operationName}" opid="${operation.operationId}"
|
class="pt-btn ${operation.operationCss}"
|
onclick="rowClickEvent(null, null)">
|
<i class="${operation.operationIcon}"></i>
|
${operation.displayName}
|
</button>
|
</c:if>
|
<c:if test="${'SysAdd'.equals(operation.operationName)==false}">
|
<button id="${operation.operationName}" opid="${operation.operationId}"
|
class="pt-btn ${operation.operationCss}">
|
<i class="${operation.operationIcon}"></i>
|
${operation.displayName}
|
</button>
|
</c:if>
|
</c:if>
|
</c:if>
|
<c:if test="${operation.enableSystemOperation==false}">
|
<button id="btn${operation.operationId}"
|
class='pt-btn ${operation.operationCss==""?"pt-btn-primary":operation.operationCss}'
|
onclick="btnClickEvent${operation.operationId}()">
|
<i class="${operation.operationIcon}"></i>
|
${operation.displayName}
|
</button>
|
</c:if>
|
</c:forEach>
|
<c:if test="${view.enableTooltip!=null&&view.enableTooltip&&view.tooltipType==1}">
|
<button class="el-tooltipbutton">功能说明<i id="i_tooltip"
|
class="fa fa-question-circle-o"
|
title="${view.tooltipContent}"></i></button>
|
<script type="text/javascript">
|
$(function () {
|
$('#i_tooltip').tooltip({
|
position: 'bottom',
|
onShow: function () {
|
$(this).tooltip('tip').css({
|
background: '#fff',
|
borderRadius: '4px',
|
border: '1px solid #ebeef5',
|
padding: '12px',
|
color: '#606266',
|
lineHeight: '1.4',
|
textAlign: 'justify',
|
fontSize: '14px',
|
boxShadow: '0 2px 12px 0 rgba(0,0,0,.1)',
|
wordBreak: 'break-all'
|
}).unbind().bind('mouseenter', function () {
|
$('#i_tooltip').tooltip('show');
|
}).bind('mouseleave', function () {
|
$('#i_tooltip').tooltip('hide');
|
});
|
}
|
})
|
});
|
</script>
|
|
</c:if>
|
</div>
|
</div>
|
<c:if test="${fromPageType!=null}">
|
<div class="pt-form-inline" style="clear:both;" id="div_search">${viewConditionColumnHtml}</div>
|
</div>
|
</div>
|
</c:if>
|
<c:if test="${fromPageType==null}">
|
</div>
|
<div class="pt-form-inline" style="clear:both;" id="div_search">${viewConditionColumnHtml}</div>
|
</c:if>
|
<c:if test="${view.enableTooltip!=null&&view.enableTooltip&&view.tooltipType==0}">
|
<div id="div_tooltip" class="pt-note1 pt-note-${view.tooltipClass}1">
|
${view.tooltipContent}
|
</div>
|
</c:if>
|
<div>
|
<c:if test="${view.enableNavClassify}">
|
<div id="layout_navigation" class="easyui-layout" style="width:100%;">
|
<div data-options="region:'west',split:true" style="width:220px;" class="pt-tree">
|
<h3 class="pt-tree-title">
|
分类导航
|
<i id="btnRefreshClassification" class="pull-right fa fa-refresh"></i>
|
</h3>
|
<ul id="ul_classification"></ul>
|
</div>
|
<div data-options="region:'center',border:false" style="overflow:hidden;">
|
</c:if>
|
<div id="right" class="easyui-layout" style="width:100%;">
|
<c:choose>
|
<c:when test="${view.listStyleType==3&&subtabs.size()>0}">
|
<div data-options="region:'center',border:false" style="height:50%; ">
|
<table id="dg_viewData" style="width:100%;height:100%">
|
</c:when>
|
<c:otherwise>
|
<div style="height:100%">
|
<table id="dg_viewData" style="width:100%;">
|
</c:otherwise>
|
</c:choose>
|
</table>
|
</div>
|
<c:if test="${view.listStyleType==3&&subtabs.size()>0}">
|
<div data-options="region:'south',split:true,border:false,onResize:function(width,height){subtabResize(width,height);}"
|
style="height:50%">
|
<div id="div_subtabs" class="easyui-tabs" data-options="border:false"
|
style="width:100%;height:100%;">
|
<c:forEach items="${subtabs}" var="subtab">
|
<div id="subtab_${subtab.subtabId}" title="${subtab.subtabName}"
|
class="pt-nav-list"
|
style="overflow: auto;-webkit-overflow-scrolling:touch; -webkit-overflow:auto;padding-top:2px;">
|
<iframe id='iframe_${subtab.subtabId}' width='100%' height='100%'
|
frameborder='no' scrolling="no" border='0' marginwidth='0'
|
marginheight='0' src=''></iframe>
|
</div>
|
</c:forEach>
|
</div>
|
</div>
|
</c:if>
|
<c:if test="${view.enableNavClassify}">
|
</div>
|
</div>
|
</div>
|
</c:if>
|
</div>
|
</div>
|
</body>
|
<script type="text/javascript" src="static/scripts/ResizeScroll.js"></script>
|
<script>
|
//定义页面全局变量
|
var t_viewData = null;
|
var columns = [];
|
var frozenColumns = [{field: 'ck', checkbox: true}];//固定列
|
var formParams = "${formParams}"; //表单参数
|
var customFormParams = "";
|
var pageSize = parseInt('${view.pageSize}');
|
var relationModuleId = '${relationModuleId}';
|
var relationTableId = '${relationTableId}';
|
var relationKeyId = '${relationKeyId}';
|
var viewId = '${view.viewId}';
|
var moduleId = '${view.moduleId}';
|
var tableId = '${view.mainTableId}';
|
var sessionId = '${sessionId}';
|
var relationTableId = '${relationTableId}';
|
var subtabId = '${subtabId}';
|
var formId = '${view.openFormId}';
|
var openUrlType = '${view.openUrlType}';
|
var basePath = "<%=basePath%>";
|
//窗口参数,用于弹窗传递
|
var params = {
|
callBack: null
|
};
|
|
//当前导航分类ID
|
var classificationTreeIds = "${classificationTreeIds}";
|
var classificationTreeTexts = "${classificationTreeTexts}";
|
|
//组合查询条件
|
var combinationQueryConditions = null;
|
|
//高级查询条件
|
var advancedQueryConditions = null;
|
|
//自定义查询条件
|
var customSql = "${customSql}";
|
|
//用于datagrid多选的参数
|
var KEY = {SHIFT: 16, CTRL: 17, ALT: 18, DOWN: 40, RIGHT: 39, UP: 38, LEFT: 37};
|
var selectIndexs = {firstSelectRowIndex: 0, lastSelectRowIndex: 0};
|
var inputFlags = {isShiftDown: false, isCtrlDown: false, isAltDown: false};
|
|
<c:forEach items="${viewColumns}" var="viewColumn">
|
<c:if test="${viewColumn.enableFrozen}">
|
frozenColumns.push({
|
<c:if test="${isNeedToUpper==true}">
|
field: '${viewColumn.fieldName.toUpperCase()}',
|
</c:if>
|
<c:if test="${isNeedToUpper==false}">
|
field: '${viewColumn.fieldName}',
|
</c:if>
|
title: '${viewColumn.columnTitle}',
|
width:${viewColumn.displayWidth},
|
halign: '${viewColumn.titlePosition}',
|
align: '${viewColumn.columnPosition}',
|
sortable:${viewColumn.enableOrder}
|
<c:if test="${viewColumn.enableCustomStyle}">
|
,${viewColumn.customStyleJs}
|
</c:if>
|
<c:if test="${viewColumn.enableCustomFormatter}">
|
,
|
${viewColumn.customFormatterJs}
|
</c:if>
|
})
|
;
|
</c:if>
|
<c:if test="${viewColumn.enableFrozen==false}">
|
columns.push({
|
<c:if test="${isNeedToUpper==true}">
|
field: '${viewColumn.fieldName.toUpperCase()}',
|
</c:if>
|
<c:if test="${isNeedToUpper==false}">
|
field: '${viewColumn.fieldName}',
|
</c:if>
|
title: '${viewColumn.columnTitle}',
|
width:${viewColumn.displayWidth},
|
halign: '${viewColumn.titlePosition}',
|
align: '${viewColumn.columnPosition}',
|
sortable:${viewColumn.enableOrder}
|
<c:if test="${viewColumn.enableCustomStyle}">
|
,${viewColumn.customStyleJs}
|
</c:if>
|
<c:if test="${viewColumn.enableCustomFormatter}">
|
,
|
${viewColumn.customFormatterJs}
|
</c:if>
|
})
|
;
|
</c:if>
|
</c:forEach>
|
|
$(function () {
|
$("body")[0].onkeydown = keyPress;
|
$("body")[0].onkeyup = keyRelease;
|
$("body")[0].onselectstart = selectStart;
|
|
//初始化表格
|
var isFirstRow = false;
|
t_viewData = $('#dg_viewData').${datagridType}({
|
url: 'general/getBusinessDatas?viewId=${view.viewId}&subtabId=${subtabId}&relationTableId=${relationTableId}&relationKeyId=${relationKeyId}',
|
fitColumns: true,
|
striped: true,
|
<c:if test="${view.idField!=''}">
|
<c:if test="${isNeedToUpper==true}">
|
idField: "${view.idField.toUpperCase()}",
|
</c:if>
|
<c:if test="${isNeedToUpper==false}">
|
idField: "${view.idField}",
|
</c:if>
|
</c:if>
|
<c:if test="${view.listStyleType==4 && view.treeNodeColumnName!=null && view.treeNodeColumnName!=''}">
|
treeField: '${view.treeNodeColumnName}',
|
</c:if>
|
rownumbers: true,
|
pagination: ${view.enablePagination},
|
pageSize: pageSize,
|
pagePosition: '${view.paginationType}',
|
checkOnSelect: false,
|
selectOnCheck: false,
|
singleSelect: true,
|
emptyMsg: '无数据',
|
frozenColumns: [frozenColumns],
|
<c:if test="${fromPageType!=null}">
|
toolbar: '#div_toolbar',
|
</c:if>
|
columns: [columns],
|
queryParams: {
|
classificationTreeIds: classificationTreeIds,
|
classificationTreeTexts: classificationTreeTexts,
|
customSql: customSql
|
}
|
<c:if test="${view.enableCustomStyle}">
|
,${view.customStyleJs}
|
</c:if>
|
|
, onClickRow
|
:
|
<c:if test="${view.listStyleType!=4}">
|
|
function (rowIndex, rowData) {
|
//批量选择方法
|
batchSelectRows(rowIndex, rowData);
|
|
<c:if test="${view.listStyleType==3}">
|
viewSubtabChange(rowData);
|
</c:if>
|
<c:if test="${view.rowClickEventType==1}">
|
rowClickEvent(rowIndex, rowData);
|
</c:if>
|
}
|
|
</c:if>
|
<c:if test="${view.listStyleType==4}">
|
|
function (rowData) {
|
<c:if test="${view.rowClickEventType==1}">
|
rowClickEvent(null, rowData);
|
</c:if>
|
}
|
|
</c:if>
|
|
<c:if test="${view.rowClickEventType==2}">
|
,
|
<c:if test="${view.listStyleType!=4}">
|
onDblClickRow: function (rowIndex, rowData) {
|
rowClickEvent(rowIndex, rowData);
|
}
|
</c:if>
|
<c:if test="${view.listStyleType==4}">
|
onDblClickRow: function (rowData) {
|
rowClickEvent(null, rowData);
|
}
|
</c:if>
|
</c:if>
|
<c:if test="${view.enableCustomProperty}">
|
,${view.customPropertyJs}
|
</c:if>
|
,
|
onLoadSuccess: function (data) {
|
var row = $('#dg_viewData').${datagridType}('getRows');//grid加载完成后自动选中第一行
|
isFirstRow = true;
|
|
<c:if test="${fromPageType!=null || view.listStyleType!=3}">
|
//判断当前datagrid高度是否超过
|
resizeDataGrid();
|
</c:if>
|
|
<c:if test="${view.listStyleType==3}">
|
viewSubtabChange(row[0]);
|
</c:if>
|
}
|
,
|
onLoadError: function () {
|
wcp.message.error("提示", "加载数据出错!");
|
}
|
})
|
;
|
|
//分页
|
var p = $('#dg_viewData').${datagridType}('getPager');
|
$(p).pagination({
|
pageSize: pageSize, //每页显示的记录条数,默认为10
|
pageList: [${view.pageList}], //可以设置每页记录条数的列表
|
beforePageText: '第', //页数文本框前显示的汉字
|
afterPageText: '页 共 {pages} 页',
|
displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录'
|
});
|
|
$(window).resize(function () {
|
computeHeight();
|
|
resizeDataGrid();
|
|
if ($("#div_subtabs").length > 0) {
|
$("#div_subtabs").tabs("resize");
|
}
|
})
|
//删除按钮事件
|
$("#SysDelete").click(function () {
|
//获取dg选中的数据行
|
var checkRows = $("#dg_viewData").${datagridType}("getChecked");
|
if (checkRows.length == 0) {
|
wcp.message.error("请选择需要删除的数据!");
|
} else {
|
var ids = new Array();
|
<c:if test="${view.idField!=null&&view.idField!=''}">
|
$.each(checkRows, function (index, value) {
|
//ids.push(value.id);
|
<c:if test="${isNeedToUpper==true}">
|
ids.push(value.${view.idField.toUpperCase()});
|
</c:if>
|
<c:if test="${isNeedToUpper==false}">
|
ids.push(value.${view.idField});
|
</c:if>
|
});
|
</c:if>
|
if (ids.length > 0) {
|
deleteBusinessDatas(ids);
|
} else {
|
wcp.message.error("获取数据异常,请检查主键字段!");
|
}
|
}
|
});
|
|
//初始化菜单树
|
<c:if test="${view.enableNavClassify}">
|
bindClassficationTree();
|
$("#btnRefreshClassification").click(function () {
|
bindClassficationTree();
|
});
|
</c:if>
|
|
//绑定关键字检索输入框回车事件
|
$("#btnKeySearch").click(function () {
|
keywordSearch();
|
});
|
|
$("#SysUpdate").click(function () {
|
update();
|
});
|
|
$("#SysReportPrinting").click(function () {
|
reportPrinting();
|
});
|
|
//关键字检索按钮事件
|
$('#txtKeySearch').bind('keypress', function (event) {
|
if (event.keyCode == "13") {
|
keywordSearch();
|
}
|
});
|
//自定义查询增加回车检索事件
|
// <c:forEach items="${viewConditionColumns}" var="viewConditionColumn">
|
// $('#${viewConditionColumn.columnId}').textbox('textbox').keydown(function (e) {
|
// if (e.keyCode == 13) {
|
// doSearchByConditionColumn();
|
// }
|
// });
|
// </c:forEach>
|
|
//导出
|
$("#SysExport").click(function () {
|
excelExport();
|
});
|
|
//导入
|
$("#SysImport").click(function () {
|
excelImport();
|
});
|
|
//条件查询
|
$("#SysCombinationQuery").click(function () {
|
showCombinationQuery();
|
});
|
//高级查询
|
$("#SysAdvancedQuery").click(function () {
|
showAdvancedQuery();
|
});
|
//批量下载附件
|
$("#SysBatchDownloadAttach").click(function () {
|
var opid = $("#SysBatchDownloadAttach").attr("opid");
|
batchDownload(opid, false, false);
|
});
|
//批量下载附件(主件)
|
$("#SysBatchDownloadMainAttach").click(function () {
|
var opid = $("#SysBatchDownloadMainAttach").attr("opid");
|
batchDownload(opid, true, false);
|
});
|
//批量下载附件(带水印)
|
$("#SysBatchDownloadAttachWithMark").click(function () {
|
var opid = $("#SysBatchDownloadAttachWithMark").attr("opid");
|
batchDownload(opid, false, true);
|
});
|
//批量下载附件(主件且带水印)
|
$("#SysBatchDownloadMainAttach").click(function () {
|
var opid = $("#SysBatchDownloadMainAttach").attr("opid");
|
batchDownload(opid, true, true);
|
});
|
|
<c:forEach items="${viewConditionColumnsDept}" var="viewConditionColumnDept">
|
loadDeptTreeForConditionSearch('${viewConditionColumnDept.columnId}');
|
</c:forEach>
|
|
<c:forEach items="${viewConditionColumnsDate}" var="viewConditionColumnDate">
|
loadDateControl('${viewConditionColumnDate.columnId}');
|
</c:forEach>
|
|
<c:if test="${view.listStyleType==3&&subtabs.size()>0}">
|
$('#div_subtabs').tabs({
|
onSelect: function (title, index) {
|
var tab = $('#div_subtabs').tabs('getTab', index);
|
var id = $(tab).panel("options").id;
|
if (id != null) {
|
//判断是否为系统list页面,如果是则调用 一下list的刷新方法
|
var iframeId = id.replace("subtab_", "iframe_");
|
|
setTimeout(function () {
|
if (document.getElementById(iframeId).contentWindow.resizeDataGrid) {
|
document.getElementById(iframeId).contentWindow.resizeDataGrid();
|
document.getElementById(iframeId).contentWindow.computeBtns();
|
}
|
}, 100);
|
}
|
|
}
|
});
|
</c:if>
|
});
|
|
//生成操作触发事件,方法名由btnClickEvent+operationId组成
|
<c:forEach items="${operations}" var="operation">
|
<c:if test="${operation.enableSystemOperation==false}">
|
|
function btnClickEvent${operation.operationId}() {
|
//若需要选择数据
|
var ids = getIds(${operation.needSelectData}, ${operation.allowSelectMultipleData});
|
|
<c:if test="${operation.needSelectData == 1}">
|
if (ids.length == 0) {
|
return;
|
}
|
</c:if>
|
|
var exec = function (param) {
|
<c:if test="${operation.operationType==0}">
|
var pageUrl = '${operation.pageUrl}';
|
if (pageUrl.indexOf('?') > 0) {
|
pageUrl += '&';
|
} else {
|
pageUrl += '?';
|
}
|
pageUrl += 'operationId=${operation.operationId}&moduleId=${view.moduleId}&viewId=${view.viewId}&relationTableId=${relationTableId}&relationKeyId=${relationKeyId}';
|
var title = "${operation.displayName}";
|
<c:if test="${operation.pageOpenMode==0}">
|
openUrlByTab(pageUrl, title, ids);
|
</c:if>
|
<c:if test="${operation.pageOpenMode==1}">
|
var pageWidth = 900;
|
var pageHeight = 500;
|
try {
|
pageWidth = parseInt('${operation.pageWidth}');
|
pageHeight = parseInt('${operation.pageHeight}');
|
} catch (e) {
|
}
|
|
openUrlByLayer(pageWidth, pageHeight, pageUrl, title, ids);
|
</c:if>
|
<c:if test="${operation.pageOpenMode==2}">
|
var pageWidth = 0;
|
var pageHeight = 0;
|
try {
|
pageWidth = parseInt('${operation.pageWidth}');
|
pageHeight = parseInt('${operation.pageHeight}');
|
} catch (e) {
|
}
|
openUrlByWindow(pageUrl, ids, title, pageWidth, pageHeight);
|
</c:if>
|
</c:if>
|
<c:if test="${operation.operationType==1}">
|
execFunction("${view.viewId}", "${operation.operationId}", ids, param);
|
</c:if>
|
}
|
|
//执行操作JS表达式
|
${operation.jsExpression}
|
|
exec();
|
}
|
|
</c:if>
|
</c:forEach>
|
|
function batchSelectRows(index, row) {
|
if (index != selectIndexs.firstSelectRowIndex && !inputFlags.isShiftDown) {
|
selectIndexs.firstSelectRowIndex = index; //alert('firstSelectRowIndex, sfhit = ' + index);
|
}
|
|
if (inputFlags.isShiftDown) {
|
$('#dg_viewData').${datagridType}('clearChecked');
|
selectIndexs.lastSelectRowIndex = index;
|
var tempIndex = 0;
|
if (selectIndexs.firstSelectRowIndex > selectIndexs.lastSelectRowIndex) {
|
tempIndex = selectIndexs.firstSelectRowIndex;
|
selectIndexs.firstSelectRowIndex = selectIndexs.lastSelectRowIndex;
|
selectIndexs.lastSelectRowIndex = tempIndex;
|
}
|
for (var i = selectIndexs.firstSelectRowIndex; i <= selectIndexs.lastSelectRowIndex; i++) {
|
$('#dg_viewData').${datagridType}('checkRow', i);
|
}
|
}
|
|
if (inputFlags.isCtrlDown) {
|
$('#dg_viewData').${datagridType}('checkRow', index);
|
}
|
}
|
|
function selectStart() {
|
if (inputFlags.isShiftDown) {
|
return false;
|
}
|
}
|
|
function keyPress(event) {//响应键盘按下事件
|
var e = event || window.event;
|
var code = e.keyCode | e.which | e.charCode;
|
switch (code) {
|
case KEY.SHIFT:
|
inputFlags.isShiftDown = true;
|
$('#dg_viewData').${datagridType}('options').singleSelect = false;
|
break;
|
case KEY.CTRL:
|
inputFlags.isCtrlDown = true;
|
$('#dg_viewData').${datagridType}('options').singleSelect = false;
|
break;
|
default:
|
}
|
}
|
|
function keyRelease(event) { //响应键盘按键放开的事件
|
var e = event || window.event;
|
var code = e.keyCode | e.which | e.charCode;
|
switch (code) {
|
case KEY.SHIFT:
|
inputFlags.isShiftDown = false;
|
selectIndexs.firstSelectRowIndex = 0;
|
$('#dg_viewData').${datagridType}('options').singleSelect = true;
|
break;
|
case KEY.CTRL:
|
inputFlags.isCtrlDown = false;
|
selectIndexs.firstSelectRowIndex = 0;
|
$('#dg_viewData').${datagridType}('options').singleSelect = true;
|
break;
|
default:
|
}
|
}
|
|
//获取选中行主键数组
|
function getIds(needSelectData, allowSelectMultipleData) {
|
var ids = new Array();
|
var checkRows = $("#dg_viewData").${datagridType}("getChecked");
|
if (needSelectData && checkRows.length == 0) {
|
wcp.message.warn("请选择需要操作的数据!");
|
} else {
|
$.each(checkRows, function (index, value) {
|
<c:if test="${isNeedToUpper==true}">
|
ids.push(value.${view.idField.toUpperCase()});
|
</c:if>
|
<c:if test="${isNeedToUpper==false}">
|
ids.push(value.${view.idField});
|
</c:if>
|
});
|
|
if (needSelectData && allowSelectMultipleData == 0)//不允许多选
|
{
|
if (ids.length > 1) {
|
ids.length = 0;
|
wcp.message.warn("该操作只允许选择一条数据!");
|
}
|
}
|
}
|
return ids;
|
}
|
|
//通过Tab页签打开窗口//scrolling 扩展,是否显示滚动条 ,yes no
|
function openUrlByTab(pageUrl, title, ids, scrolling) {
|
if (top.addPanel) {
|
top.addPanel(pageUrl, title, scrolling);
|
var curTabWin = null;
|
var curTab = top.$('#tt').tabs('getSelected');
|
if (curTab && curTab.find('iframe').length > 0) {
|
curTabWin = curTab.find('iframe')[0].contentWindow;
|
//将回调函数传给子页面
|
$(curTabWin).load(function () {
|
if (curTabWin.params) {
|
//将回调函数传给子页面
|
if (ids) {
|
curTabWin.params.ids = ids;
|
}
|
|
curTabWin.params.parent = window;
|
curTabWin.params.callBack = refreshData;
|
}
|
});
|
}
|
} else {
|
openUrlByWindow(pageUrl);
|
}
|
}
|
|
//通过Layer打开窗口
|
function openUrlByLayer(pageWidth, pageHeight, pageUrl, title, ids, defaultFull) {
|
top.layer.open({
|
title: title,
|
type: 2,
|
area: [pageWidth + "px", pageHeight + "px"],
|
fixed: false,
|
maxmin: true,
|
content: pageUrl,
|
success: function (layero, index) {
|
var body = window.top.layer.getChildFrame('body', index);
|
var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
|
|
//将回调函数传给子页面
|
if (iframeWin.params) {
|
if (ids) {
|
iframeWin.params.ids = ids;
|
}
|
|
iframeWin.params.parent = window;
|
iframeWin.params.callBack = refreshData;
|
}
|
|
if (defaultFull) {
|
top.layer.full(index);
|
}
|
}
|
});
|
}
|
|
function openUrlByWin(pageUrl, ids) {
|
var myWindow = window.open(pageUrl);
|
//将回调函数传给子页面
|
$(myWindow).load(function () {
|
if (myWindow.params) {
|
if (ids) {
|
myWindow.params.ids = ids;
|
}
|
myWindow.params.parent = window;
|
myWindow.params.callBack = refreshData;
|
}
|
});
|
}
|
|
//居中显示打开窗口
|
function openUrlByWindow(pageUrl, ids, name, iWidth, iHeight) {
|
iWidth = iWidth ? iWidth : 0;
|
iHeight = iHeight ? iHeight : 0;
|
var iTop = (window.screen.height - 30 - iHeight) / 2; //获得窗口的垂直位置;
|
var iLeft = (window.screen.width - 10 - iWidth) / 2; //获得窗口的水平位置;
|
var myWindow;
|
if (iWidth == 0) {
|
myWindow = window.open('<%=basePath%>' + pageUrl);
|
} else {
|
myWindow = window.open('<%=basePath%>' + pageUrl, name ? name.replace(":", "") : "", 'height=' + iHeight + ',innerHeight=' + iHeight + ',width=' + iWidth + ',innerWidth=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
|
}
|
//将回调函数传给子页面
|
$(myWindow).load(function () {
|
if (myWindow.params) {
|
if (ids) {
|
myWindow.params.ids = ids;
|
}
|
myWindow.params.parent = window;
|
myWindow.params.callBack = refreshData;
|
}
|
});
|
}
|
|
//执行程序集
|
function execFunction(viewId, operationId, ids, param) {
|
wcp.ui.setBusy("body", wcp.ajax({
|
url: "general/doViewFunction?viewId=" + viewId + "&operationId=" + operationId + "&relationTableId=${relationTableId}&relationKeyId=${relationKeyId}¶m=" + ((undefined === param) ? '' : param),
|
data: JSON.stringify(ids),
|
}).done(function (result) {
|
if (result && result.jsExpression) {
|
eval(result.jsExpression);
|
} else {
|
wcp.notify.success('执行成功!');
|
}
|
|
//刷新数据
|
refreshData();
|
}));
|
}
|
|
//行数据切换,页签跟着切换
|
function viewSubtabChange(row) {
|
<c:if test="${isNeedToUpper==true}">
|
var relationKeyId = row == null ? 0 : row.${view.idField.toUpperCase()};
|
</c:if>
|
<c:if test="${isNeedToUpper==false}">
|
var relationKeyId = row == null ? 0 : row.${view.idField};
|
</c:if>
|
var url = "";
|
var oldUrl = "";
|
<c:forEach items="${subtabs}" var="subtab">
|
<c:choose>
|
<c:when test="${subtab.subtabType==0}">
|
<c:if test="${subtab.viewId>0}">
|
url = 'general/list?viewId=${subtab.viewId}&subtabId=${subtab.subtabId}&relationTableId=${view.mainTableId}&relationKeyId=' + relationKeyId + '&fromPageType=iframe_view';
|
</c:if>
|
<c:if test="${subtab.viewId==-1}">
|
url = 'general/list?moduleId=${subtab.targetModuleId}&viewIdentify=${view.viewIdentify}&subtabId=${subtab.subtabId}&relationTableId=${view.mainTableId}&relationKeyId=' + relationKeyId + '&fromPageType=iframe_view';
|
</c:if>
|
</c:when>
|
<c:when test="${subtab.subtabType==1}">
|
url = 'general/editFormData?viewId=${view.viewId}&formId=${subtab.formId}&relationTableId=${relationTableId}&relationKeyId=${relationKeyId}&formParams=${formParams}&fromPageType=iframe_view&openUrlType=1';
|
</c:when>
|
<c:when test="${subtab.subtabType==2}">
|
</c:when>
|
<c:when test="${subtab.subtabType==3}">
|
url = '${subtab.url}';
|
if (url.endsWith('#')) {
|
url = url.substr(0, url.length - 1);
|
} else {
|
if (url.indexOf("?") < 0) {
|
url += "?";
|
} else {
|
url += "&";
|
}
|
url += 'moduleId=${subtab.targetModuleId}&viewIdentify=${view.viewIdentify}&subtabId=${subtab.subtabId}&relationModuleId=${form.moduleId}&relationTableId=${view.mainTableId}&relationKeyId=' + relationKeyId + '&fromPageType=iframe_view&formParams=' + encodeURI(formParams);
|
}
|
</c:when>
|
</c:choose>
|
oldUrl = $(document).find('#iframe_${subtab.subtabId}').attr('src');
|
if (url != oldUrl) {
|
$(document).find('#iframe_${subtab.subtabId}').attr('src', url);
|
}
|
</c:forEach>
|
}
|
|
//行点击 事件
|
function rowClickEvent(index, row, keyValue, flowDefinitionId, copyKeyId, showAttachPreview) {
|
var keyId = keyValue;
|
if (keyId == null) {
|
<c:if test="${isNeedToUpper==true}">
|
keyId = row == null ? 0 : row.${view.idField.toUpperCase()};
|
</c:if>
|
<c:if test="${isNeedToUpper==false}">
|
keyId = row == null ? 0 : row.${view.idField};
|
</c:if>
|
}
|
var openMode = '${view.openMode}';
|
if (openMode == '0') {
|
var openUrlType = '${view.openUrlType}';
|
<c:if test="${view.enableCustomType==null || view.enableCustomType==false}">
|
var openCustomUrl = 'general/editFormData';
|
</c:if>
|
<c:if test="${view.enableCustomType!=null && view.enableCustomType}">
|
var openCustomUrl = '${view.openCustomUrl}';
|
|
if (copyKeyId != null) {
|
openCustomUrl = 'general/editFormData';
|
}
|
</c:if>
|
var openUrlWidth = 900;
|
var openUrlHeight = 500;
|
|
if (openCustomUrl.indexOf('?') > 0) {
|
openCustomUrl += '&';
|
} else {
|
openCustomUrl += '?';
|
}
|
openCustomUrl += 'viewId=${view.viewId}&formId=${view.openFormId}&keyId=' + keyId + '&relationTableId=${relationTableId}&relationKeyId=${relationKeyId}&openUrlType=' + openUrlType;
|
if (flowDefinitionId != null) {
|
openCustomUrl += "&flowDefinitionId=" + flowDefinitionId;
|
}
|
if (copyKeyId != null) {
|
openCustomUrl += "©KeyId=" + copyKeyId;
|
}
|
if (showAttachPreview != null) {
|
openCustomUrl += "&showAttachPreview=" + showAttachPreview;
|
}
|
var title = "";
|
if (keyId == 0) {
|
<c:if test="${view.openFormName!=null}">
|
title = "新增${view.openFormName}";
|
</c:if>
|
<c:if test="${view.openFormName==null}">
|
title = "新增${module.moduleName}";
|
</c:if>
|
var params = "";
|
if (formParams != "") {
|
params = formParams;
|
}
|
if (customFormParams != "") {
|
if (params != "") {
|
params += ",";
|
}
|
params += customFormParams;
|
}
|
if (params != "") {
|
openCustomUrl += "&formParams=" + encodeURI(encodeURI(params));
|
}
|
} else {
|
<c:if test="${view.openWindowTitle==null || empty view.openWindowTitle}">
|
title = "编辑${module.moduleName}[" + keyId + "]";
|
</c:if>
|
<c:if test="${view.openWindowTitle!=null && not empty view.openWindowTitle}">
|
title = "${view.openWindowTitle}";
|
var reg = /\{\S+?\}/g;
|
var matchs = title.match(reg);
|
if (matchs != null && matchs.length > 0) {
|
if (row == null) {
|
row = $('#dg_viewData').${datagridType}('getRows')[index];
|
}
|
|
for (var i = 0; i < matchs.length; i++) {
|
var field = matchs[i].substring(1, matchs[i].length - 1);
|
<c:if test="${isNeedToUpper==true}">
|
field = field.toUpperCase();
|
</c:if>
|
|
if (row[field] != null) {
|
title = title.replace(new RegExp(matchs[i], "g"), row[field]);
|
}
|
}
|
}
|
</c:if>
|
}
|
;
|
|
switch (openUrlType) {
|
case '0': //tab选项卡
|
openUrlByTab(openCustomUrl, title);
|
break;
|
case '1'://弹出层
|
try {
|
openUrlWidth = parseInt('${view.openUrlWidth}');
|
openUrlHeight = parseInt('${view.openUrlHeight}');
|
} catch (e) {
|
}
|
|
openUrlByLayer(openUrlWidth, openUrlHeight, openCustomUrl, title, null, showAttachPreview);
|
break;
|
case '2'://新窗口
|
//openUrlByWindow(openCustomUrl);
|
var pageWidth = 0;
|
var pageHeight = 0;
|
try {
|
pageWidth = parseInt('${view.openUrlWidth}');
|
pageHeight = parseInt('${view.openUrlHeight}');
|
} catch (e) {
|
}
|
openUrlByWindow(openCustomUrl, null, title, pageWidth, pageHeight);
|
break;
|
}
|
} else {
|
${view.customRunJs}
|
}
|
}
|
|
//关键字搜索方法
|
function keywordSearch() {
|
var keyValue = $("#txtKeySearch").val();
|
$('#dg_viewData').${datagridType}('load', {
|
viewId: ${view.viewId},
|
searchText: keyValue,
|
classificationTreeIds: classificationTreeIds,
|
classificationTreeTexts: classificationTreeTexts,
|
customSql: customSql
|
});
|
}
|
|
//刷新表格数据
|
function refreshData() {
|
$('#dg_viewData').${datagridType}('reload');
|
var checkRows = $('#dg_viewData').${datagridType}('getChecked');
|
if (checkRows.length > 0) {
|
$('#dg_viewData').${datagridType}('clearSelections');
|
$('#dg_viewData').${datagridType}('clearChecked');
|
}
|
}
|
|
//重新设置表格大小
|
function resizeDataGrid() {
|
var dgHeight = $("#right .easyui-fluid").height();
|
var divHeight = $("#right .easyui-fluid").parent().height();
|
if (dgHeight > divHeight) {
|
$("#dg_viewData").${datagridType}("resize", {
|
width: "100%",
|
height: "100%"
|
});
|
} else {
|
$("#dg_viewData").${datagridType}("resize");
|
}
|
}
|
|
//删除多条业务数据
|
function deleteBusinessDatas(ids) {
|
var opid = $("#SysDelete").attr("opid");
|
|
layer.confirm("确定要删除选择的数据吗?", {
|
icon: 3,
|
title: '提示'
|
}, function (index) {
|
wcp.ui.setBusy("body", wcp.ajax({
|
url: "general/deleteBusinessDatas?operationId=" + opid + "&viewId=${view.viewId}",
|
data: JSON.stringify(ids),
|
}).done(function (result) {
|
wcp.notify.success('删除成功!');
|
//刷新数据
|
refreshData();
|
}));
|
|
layer.close(index);
|
});
|
}
|
|
//条件查询控件加载部门树
|
function loadDeptTreeForConditionSearch(columnId) {
|
$("#" + columnId + "Dept").combotree({
|
url: 'management/dept/listDeptByComboTree?showRoot=false',
|
method: 'get',
|
panelHeight: 'auto',
|
onSelect: function (node) {
|
$("#" + columnId).textbox("setValue", node.text);
|
},
|
onLoadSuccess: function (node, data) {
|
//加载成功后,初始化赋值
|
var t = $('#' + columnId).combotree('tree');
|
var n = t.tree('getSelected');
|
if (n != null) {
|
$("#" + columnId).textbox("setValue", n.text);
|
}
|
}
|
});
|
}
|
|
//通过条件列查询
|
function doSearchByConditionColumn() {
|
//验证表单信息
|
var isValid = $('#formConditionColumn').form('validate');
|
if (!isValid) {
|
wcp.notify.warn('条件字段有误,请检查条件列输入项!');
|
return false;
|
}
|
var obj = $("#formConditionColumn").serializeObject();
|
$('#dg_viewData').datagrid('load', {
|
inputObj: JSON.stringify(obj),
|
customSql: customSql,
|
classificationTreeIds: classificationTreeIds,
|
classificationTreeTexts: classificationTreeTexts
|
});
|
}
|
|
//自定义JS事件
|
${view.customEventJs}
|
|
//导出Excel事件
|
function excelExport() {
|
var opid = $("#SysExport").attr("opid");
|
|
var rows = $("#dg_viewData").${datagridType}("getRows");
|
if (rows.length > 0) {
|
var viewId = "${view.viewId}";
|
var ids = new Array();
|
var checkRows = $("#dg_viewData").${datagridType}("getChecked");
|
var options = $("#dg_viewData").${datagridType}('getPager').data('pagination').options;
|
var pageSize = options.pageSize;
|
var pageNum = options.pageNumber;
|
|
var queryParams = $('#dg_viewData').datagrid('options').queryParams;
|
|
if (checkRows.length != 0) {
|
<c:if test="${view.idField!=null&&view.idField!=''}">
|
$.each(checkRows, function (index, value) {
|
<c:if test="${isNeedToUpper==true}">
|
ids.push(value.${view.idField.toUpperCase()});
|
</c:if>
|
<c:if test="${isNeedToUpper==false}">
|
ids.push(value.${view.idField});
|
</c:if>
|
});
|
</c:if>
|
}
|
|
top.layer.open({
|
title: "数据导出",
|
type: 2,
|
area: ["600px", "400px"],
|
fixed: false,
|
content: "general/exportIndex?operationId=" + opid + "&viewId=" + viewId + "&pageSize=" + pageSize + "&pageNum=" + pageNum + "&subtabId=${subtabId}&relationTableId=${relationTableId}&relationKeyId=${relationKeyId}",
|
success: function (layero, index) {
|
var body = window.top.layer.getChildFrame('body', index);
|
var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
|
iframeWin.params.ids = ids;
|
iframeWin.params.queryParams = queryParams;
|
}
|
});
|
} else {
|
layer.alert("没有数据!");
|
}
|
}
|
|
//Excel导入事件
|
function excelImport() {
|
var opid = $("#SysImport").attr("opid");
|
var viewId = "${view.viewId}";
|
top.layer.open({
|
title: "数据导入",
|
type: 2,
|
area: ["620px", "500px"],
|
fixed: false,
|
content: "general/importIndex?operationId=" + opid + "&moduleId=${view.moduleId}&viewId=" + viewId + '&relationKeyId=' + relationKeyId,
|
success: function (layero, index) {
|
var body = window.top.layer.getChildFrame('body', index);
|
var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
|
if (iframeWin.params != undefined) {
|
iframeWin.params.callBack = refreshData;
|
}
|
}
|
});
|
}
|
|
//批量修改
|
function update() {
|
var opid = $("#SysUpdate").attr("opid");
|
var checkRows = $("#dg_viewData").${datagridType}("getChecked");
|
if (checkRows.length > 0) {
|
var ids = new Array();
|
var viewId = "${view.viewId}";
|
<c:if test="${view.idField!=null&&view.idField!=''}">
|
$.each(checkRows, function (index, value) {
|
<c:if test="${isNeedToUpper==true}">
|
ids.push(value.${view.idField.toUpperCase()});
|
</c:if>
|
<c:if test="${isNeedToUpper==false}">
|
ids.push(value.${view.idField});
|
</c:if>
|
});
|
</c:if>
|
top.layer.open({
|
title: "批量修改",
|
type: 2,
|
area: ["600px", "500px"],
|
fixed: false,
|
content: "general/updateIndex?operationId=" + opid + "&viewId=" + viewId,
|
success: function (layero, index) {
|
var body = window.top.layer.getChildFrame('body', index);
|
var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
|
iframeWin.params.ids = ids;
|
//将回调函数传给子页面
|
iframeWin.params.callBack = refreshData;
|
}
|
});
|
} else {
|
layer.alert("请选择要修改的数据!");
|
}
|
}
|
|
//报表打印
|
function reportPrinting() {
|
var opid = $("#SysReportPrinting").attr("opid");
|
var checkRows = $("#dg_viewData").${datagridType}("getChecked");
|
if (checkRows.length > 0) {
|
var ids = new Array();
|
var viewId = "${view.viewId}";
|
<c:if test="${view.idField!=null&&view.idField!=''}">
|
$.each(checkRows, function (index, value) {
|
<c:if test="${isNeedToUpper==true}">
|
ids.push(value.${view.idField.toUpperCase()});
|
</c:if>
|
<c:if test="${isNeedToUpper==false}">
|
ids.push(value.${view.idField});
|
</c:if>
|
});
|
</c:if>
|
top.layer.open({
|
title: "报表打印",
|
type: 2,
|
area: ["600px", "450px"],
|
fixed: false,
|
content: "config/report/showReportIndex?operationId=" + opid + "&moduleId=" + "${view.moduleId}",
|
success: function (layero, index) {
|
var body = window.top.layer.getChildFrame('body', index);
|
var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
|
iframeWin.params.ids = ids;
|
}
|
});
|
} else {
|
wcp.message.warn("请选择要打印的数据!");
|
}
|
|
}
|
|
//分类查询
|
function classificationSelect(ids, texts) {
|
classificationTreeIds = JSON.stringify(ids);
|
classificationTreeTexts = JSON.stringify(texts);
|
$('#dg_viewData').datagrid('load', {
|
viewId: ${view.viewId},
|
classificationTreeIds: classificationTreeIds,
|
classificationTreeTexts: classificationTreeTexts,
|
customSql: customSql
|
});
|
}
|
|
//显示组合查询界面
|
function showCombinationQuery() {
|
var opid = $("#SysCombinationQuery").attr("opid");
|
var url = "general/combinationQuery?viewId=${view.viewId}&operationId=" + opid;
|
top.layer.open({
|
title: "组合查询",
|
type: 2,
|
area: ["650px", "550px"],
|
fixed: false,
|
content: url,
|
success: function (layero, index) {
|
var body = window.top.layer.getChildFrame('body', index);
|
var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
|
|
//将回调函数传给子页面
|
iframeWin.params.callBack = combinationSearch;
|
iframeWin.loadCondition(combinationQueryConditions);
|
}
|
});
|
}
|
|
//组合查询
|
function combinationSearch(combinationConditions) {
|
combinationQueryConditions = combinationConditions;
|
$('#dg_viewData').datagrid('load', {
|
viewId: ${view.viewId},
|
combinationConditions: JSON.stringify(combinationConditions),
|
classificationTreeIds: classificationTreeIds,
|
classificationTreeTexts: classificationTreeTexts,
|
customSql: customSql
|
});
|
}
|
|
//显示高级查询界面
|
function showAdvancedQuery() {
|
var opid = $("#SysAdvancedQuery").attr("opid");
|
var url = "general/advancedQuery?viewId=${view.viewId}&operationId=" + opid;
|
top.layer.open({
|
title: "高级查询",
|
type: 2,
|
area: ["650px", "550px"],
|
fixed: false,
|
content: url,
|
success: function (layero, index) {
|
var body = window.top.layer.getChildFrame('body', index);
|
var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
|
|
//将回调函数传给子页面
|
iframeWin.params.callBack = advancedSearch;
|
iframeWin.loadCondition(advancedQueryConditions);
|
}
|
});
|
}
|
|
//高级查询
|
function advancedSearch(advancedConditions) {
|
advancedQueryConditions = advancedConditions;
|
|
$('#dg_viewData').datagrid('load', {
|
viewId: ${view.viewId},
|
advancedConditions: JSON.stringify(advancedConditions),
|
classificationTreeIds: classificationTreeIds,
|
classificationTreeTexts: classificationTreeTexts,
|
customSql: customSql
|
});
|
}
|
|
//选中某条数据
|
function posSelectRow(type, win) {
|
var rows = $('#dg_viewData').datagrid('getRows');
|
var selRow = $('#dg_viewData').datagrid('getSelected');
|
var rowIndex = $('#dg_viewData').datagrid('getRowIndex', selRow);
|
var opt = $('#dg_viewData').datagrid('options');
|
var data = $('#dg_viewData').datagrid('getData');
|
|
$('#dg_viewData').datagrid('unselectRow', rowIndex);
|
if (type == 0) {
|
if (rowIndex == 0) {
|
if (opt.pageNumber == 1) {
|
$('#dg_viewData').datagrid('selectRow', 0);
|
win.wcp.notify.warn("已经是第一条数据!");
|
} else {
|
$('#dg_viewData').datagrid('gotoPage', {
|
page: opt.pageNumber - 1,
|
callback: function (page) {
|
$('#dg_viewData').datagrid('unselectAll');
|
$('#dg_viewData').datagrid('selectRow', opt.pageSize - 1);
|
var row = $('#dg_viewData').datagrid('getSelected');
|
|
redirectToData(win, row[opt.idField]);
|
}
|
});
|
}
|
} else {
|
$('#dg_viewData').datagrid('selectRow', rowIndex - 1);
|
var row = $('#dg_viewData').datagrid('getSelected');
|
|
redirectToData(win, row[opt.idField]);
|
}
|
} else {
|
if (rowIndex == (rows.length - 1)) {
|
if (data.total == opt.pageSize * (opt.pageNumber - 1) + rows.length) {
|
$('#dg_viewData').datagrid('selectRow', rowIndex);
|
win.wcp.notify.warn("已经是最后一条数据!");
|
} else {
|
$('#dg_viewData').datagrid('gotoPage', {
|
page: opt.pageNumber + 1,
|
callback: function (page) {
|
$('#dg_viewData').datagrid('unselectAll');
|
$('#dg_viewData').datagrid('selectRow', 0);
|
var row = $('#dg_viewData').datagrid('getSelected');
|
|
redirectToData(win, row[opt.idField]);
|
}
|
});
|
}
|
} else {
|
$('#dg_viewData').datagrid('selectRow', rowIndex + 1);
|
var row = $('#dg_viewData').datagrid('getSelected');
|
|
redirectToData(win, row[opt.idField]);
|
}
|
}
|
}
|
|
|
//绑定分类树
|
function bindClassficationTree() {
|
var defaultSelectItem = "${view.defSelectNavClassifyItem}";
|
$("#ul_classification").tree({
|
method: "get",
|
url: "config/navigationClassification/listClassificationByTreeForTop?moduleId=${view.moduleId}&viewId=${view.viewId}&subtabId=${subtabId}&relationKeyId=" + relationKeyId + "&customSql=" + customSql,
|
animate: true,
|
formatter: function (node) {
|
return "<span class='easyui-tooltip' title='" + node.text + "'>" + node.text + "</span>";
|
},
|
onBeforeLoad: function (node, param) {
|
wcp.ui.setBusy("#ul_classification");
|
},
|
onLoadSuccess: function (node, data) {
|
wcp.ui.clearBusy("#ul_classification");
|
|
//如果加载根结点,选中默认项
|
if (node == null && defaultSelectItem != "") {
|
var node = $('#ul_classification').tree('find', {text: defaultSelectItem});
|
$('#ul_classification').tree('select', node.target);
|
}
|
|
new ResizeScroll({
|
"id": "#ul_classification",
|
fun: function () {
|
var wh = $("#layout_navigation").height();
|
//$("#ul_dept").height(wh-79-39);
|
return (wh - 40);
|
}
|
});
|
|
$(".easyui-tooltip").tooltip({
|
onShow: function () {
|
$(this).tooltip('tip').css({
|
borderColor: '#222d32'
|
});
|
}
|
});
|
},
|
onLoadError: function (args) {
|
wcp.ui.clearBusy("#ul_classification");
|
},
|
onSelect: function (node) {
|
var ids = new Array();
|
var texts = new Array();
|
ids.push(node.id);
|
texts.push(node.text);
|
var parent = $("#ul_classification").tree('getParent', node.target);
|
while (1) {
|
if (parent) {
|
ids.push(parent.id);
|
texts.push(parent.text);
|
parent = $("#ul_classification").tree('getParent', parent.target);
|
} else break;
|
}
|
|
classificationTreeIds = JSON.stringify(ids);
|
classificationTreeTexts = JSON.stringify(texts);
|
|
var params = "";
|
if (node.attributes != null) {
|
if (node.attributes.paramTextField != null && node.attributes.paramTextField != "") {
|
params += node.attributes.paramTextField + "|" + node.text;
|
}
|
if (node.attributes.paramValueField != null && node.attributes.paramValueField != "") {
|
if (params != "") {
|
params += ",";
|
}
|
if (node.attributes.value) {
|
params += node.attributes.paramValueField + "|" + node.attributes.value;
|
} else {
|
params += node.attributes.paramValueField + "|" + node.id;
|
}
|
}
|
}
|
|
customFormParams = params;
|
|
$('#dg_viewData').${datagridType}('load', {
|
viewId: ${view.viewId},
|
classificationTreeIds: classificationTreeIds,
|
classificationTreeTexts: classificationTreeTexts,
|
customSql: customSql
|
});
|
},
|
onBeforeExpand: function (node, param) {
|
$('#ul_classification').tree('options').url = "config/navigationClassification/listClassificationByTreeForSingle?moduleId=${view.moduleId}&viewId=${view.viewId}&subtabId=${subtabId}&relationKeyId=" + relationKeyId + "&customSql=" + customSql + "&classificationId=" + node.id;
|
}
|
})
|
}
|
|
|
//跳转到某条数据
|
function redirectToData(win, keyId) {
|
var url = 'general/editFormData?viewId=${view.viewId}&formId=${view.openFormId}&relationTableId=${relationTableId}&relationKeyId=${relationKeyId}&openUrlType=${view.openUrlType}&keyId=';
|
win.wcp.ui.setBusy("body");
|
win.location.href = url + keyId;
|
|
setTimeout(function () {
|
if (win.params) {
|
win.params.parent = window;
|
win.params.callBack = refreshData;
|
}
|
}, 500);
|
}
|
|
//控制按钮显示
|
function computeBtns() {
|
var totalWidth = $(".pt-search").parent().width();
|
var navWidth = $(".pt-nav").outerWidth(true);
|
var retrievalWidth = $(".pt-retrieval").outerWidth(true) + 12;
|
var tooltipWidth = 0;
|
if ($(".el-tooltipbutton").length > 0) {
|
tooltipWidth = 85;
|
}
|
var space = totalWidth - navWidth - retrievalWidth - tooltipWidth - 30;
|
//console.log("space",space);
|
|
var btnsLength = 0;
|
var hideIndex = -1;
|
var arr = [];
|
$(".pt-btnList button,a").each(function (index, elem) {
|
arr.push($(elem).outerWidth(true));
|
btnsLength += arr[index];
|
if (btnsLength < space) {
|
return true;
|
} else {
|
hideIndex = getHideIndex(btnsLength, space, arr, index);
|
return false;
|
}
|
})
|
|
if (hideIndex != -1) {
|
if ($("#aMore").length > 0) {
|
$("#aMore").menubutton("destroy");
|
}
|
|
//创建a元素和div元素
|
var aElem = $("<a href=\"javascript:void(0)\" id=\"aMore\" class=\"pt-btn-primary\">更多操作</a>");
|
var mm2Elem = $("<div id=\"mm2\" style=\"width:100px;\"></div>");
|
|
$(".pt-btnList button,a").show();
|
|
if (hideIndex != 0) {
|
var btns = $(".pt-btnList button:gt(" + (hideIndex - 1) + ")");
|
} else {
|
btns = $(".pt-btnList button,a");
|
}
|
|
btns.each(function (index, elem) {
|
if (!$(elem).hasClass('el-tooltipbutton')) {
|
$(elem).hide();
|
var iconClass = $(elem).find("i").attr("class");
|
var divElem = $("<div data-options='iconCls:\"" + iconClass + "\"'>" + $(elem).text() + "</div>");
|
var _elem = elem;
|
divElem.click(function () {
|
$(elem).click();
|
})
|
mm2Elem.append(divElem);
|
}
|
})
|
|
if (mm2Elem.children().length > 0) {
|
if ($(".el-tooltipbutton").length > 0) {
|
$(".el-tooltipbutton").before(aElem);
|
$(".el-tooltipbutton").before(mm2Elem);
|
} else {
|
$(".pt-btnList").append(aElem);
|
$(".pt-btnList").append(mm2Elem);
|
}
|
|
aElem.menubutton({
|
iconCls: 'fa fa-plus',
|
menu: mm2Elem
|
});
|
|
}
|
} else {
|
if ($("#aMore").is(":visible")) {
|
$("#aMore").menubutton("destroy");
|
}
|
|
$(".pt-btnList button").show();
|
}
|
|
function getHideIndex(currentLength, total, arr, index) { //当前长度,总预留位置长度,btn数组,当前的索引index
|
currentLength = currentLength - arr[index];
|
//console.log(currentLength);
|
if (currentLength + 106 > total) {
|
if (index > 0) {
|
index--;
|
return getHideIndex(currentLength, total, arr, index);
|
} else {
|
return 0;
|
}
|
} else {
|
if (index >= 1)
|
return --index;
|
else {
|
return index;
|
}
|
}
|
}
|
}
|
|
//批量下载,写入压缩队列
|
function batchDownload(opid, onlyMain, addMark) {
|
//获取dg选中的数据行
|
var checkRows = $("#dg_viewData").${datagridType}("getChecked");
|
if (checkRows.length == 0) {
|
wcp.message.error("请选择需要下载的条目!");
|
} else {
|
var batchDownloadMaxCount = '${module.batchDownloadMaxCount}';
|
if (batchDownloadMaxCount != "" && batchDownloadMaxCount != "0" && checkRows.length > parseInt(batchDownloadMaxCount)) {
|
wcp.message.error("选择条目数量必须小于等于" + batchDownloadMaxCount + "条!");
|
return;
|
}
|
var ids = new Array();
|
<c:if test="${view.idField!=null&&view.idField!=''}">
|
$.each(checkRows, function (index, value) {
|
//ids.push(value.id);
|
<c:if test="${isNeedToUpper==true}">
|
ids.push(value.${view.idField.toUpperCase()});
|
</c:if>
|
<c:if test="${isNeedToUpper==false}">
|
ids.push(value.${view.idField});
|
</c:if>
|
});
|
</c:if>
|
if (ids.length > 0) {
|
layer.confirm('请选择批量下载类型!',
|
{
|
btn: ['只下主件', '全部下载', '取消']
|
}, function (index) {
|
saveBatchDownloadTask(true, addMark, opid, ids);
|
layer.close(index);
|
}, function (index) {
|
saveBatchDownloadTask(false, addMark, opid, ids);
|
layer.close(index);
|
});
|
} else {
|
wcp.message.error("获取数据异常,请检查主键字段!");
|
}
|
}
|
}
|
|
//创建批量下载任务
|
function saveBatchDownloadTask(onlyMain, addMark, opid, ids) {
|
wcp.ui.setBusy("body", wcp.ajax({
|
url: "management/batchDownload/batchDownload?operationId=" + opid + "&viewId=${view.viewId}&onlyMain=" + onlyMain + "&addMark= " + addMark,
|
data: JSON.stringify(ids),
|
}).done(function (result) {
|
if (result && result.jsExpression) {
|
eval(result.jsExpression);
|
} else {
|
wcp.notify.success('发起打包任务成功,请到"我的批量下载包"菜单下载压缩包!');
|
}
|
//刷新数据
|
refreshData();
|
}));
|
}
|
|
//选择多级关键字
|
function selectMultiKeyWords(controlId, keywordId, joinParentText) {
|
wcp.picker.selectParam({
|
title: "选择关键字",
|
keywordId: keywordId,
|
multiSelect: false,//暂时不支持多选
|
joinParentText: joinParentText,
|
separator: ";",
|
nameElement: controlId,
|
layerOpener: window
|
});
|
}
|
</script>
|
</html>
|