You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

357 lines
13 KiB
Plaintext

11 months ago
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello MUI</title>
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!--标准mui.css-->
<link href="../js/mui/css/mui.min.css" rel="stylesheet" type="text/css" />
<link href="../js/mui/css/mui.indexedlist.css" rel="stylesheet" type="text/css" />
<script src="../js/mui/js/mui.min.js" type="text/javascript"></script>
<script src="../js/mui/js/mui.view.js" type="text/javascript"></script>
<link href="../js/mui/css/mui.picker.min.css" rel="stylesheet" type="text/css" />
<link href="../js/mui/css/mui.dtpicker.css" rel="stylesheet" />
<script src="../js/mui/js/mui.picker.min.js" type="text/javascript"></script>
<script src="../js/mui/js/mui.dtpicker.js"></script>
<script src="../js/jquery.js" type="text/javascript"></script>
<!-- 引入通用基础JS -->
<script src="../Scripts/QueryString.js" type="text/javascript"></script>
<script src="../Scripts/config.js" type="text/javascript"></script>
<script src="../Comm/Gener.js" type="text/javascript"></script>
<script src="../Comm/JScript.js" type="text/javascript"></script>
<script src="Search.js" type="text/javascript"></script>
<script src="../../DataUser/JSLibData/SearchAndEn.js"></script>
<style type="text/css">
.congDao {
width: 30% !important;
float: left !important;
display: inline !important;
border: 1px solid rgba(0,0,0,.2) !important;
height: 90% !important;
margin-top: 2px !important;
}
#toToolBarPover {
width: 0px;
height: 0px;
position: fixed;
top: 50px !important;
left: 15px !important;
width: calc(100% - 35px) !important;
}
/*移除底部或顶部三角,需要在删除此代码*/
.mui-popover .mui-popover-arrow:after {
width: 0px;
}
.mui-col-xs-12, .mui-col-sm-12 {
font-size: 14px !important;
color: #333333eb !important;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
li .mui-table-view-cell {
padding-right: 20px !important
}
</style>
<script type="text/javascript">
var ensName = GetQueryString("EnsName");
//定义公共个变量.
var webUser = new WebUser();
var fields = [];
//页面设置信息
var cfg = new Entity("BP.Sys.EnCfg");
cfg.No = ensName;
cfg.RetrieveFromDBSources();
var drillFields = cfg.Drill || "";
drillFields += ",";
var mobileShowModel = cfg.MobileFieldShowModel || 0;
var mobileShowContent = cfg.MobileShowContent || "";
//当前用户查询信息.
var ur = new Entity("BP.Sys.UserRegedit");
ur.MyPK = webUser.No + "_" + ensName + "_SearchAttrs";
ur.RetrieveFromDBSources();
//获取Url传的查询Key值
var key = GetQueryString("Key");
if (key != null && key != undefined) {
ur.SearchKey = key;
ur.Update();
}
var mapBase;
var pageIdx = 1;//当前页
var pageSize = 10;
var pages = 1;//总页数
//列表显示的字段
var showField = [];
var pkFiled = "";
var mapAttrs = [];
//初始化数据
$(function () {
InitToolBar();
pageIdx = GetQueryString("PageIdx");//当前页
if (pageIdx == null || pageIdx == undefined || pageIdx == 0)
pageIdx = 1;
pageSize = cfg.GetPara("PageSize");
//pageSize = 3;
if (pageSize == null || pageSize == undefined || pageSize == 0)
pageSize = 10;//一页显示的行数
ShowPageInfo("batch");
BatchMethod();
})
function BatchMethod() {
//创建处理器.
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Comm");
handler.AddPara("EnsName", GetQueryString("EnsName"));
//查询集合
var data = handler.DoMethodReturnString("Refmethod_BatchInt");
if (data.indexOf('err@') == 0) {
alert(data);
return;
}
var refMethods = JSON.parse(data);
if (refMethods.length == 0) {
$("#batchBar").hide();
return;
}
$.each(refMethods, function (idx, method) {
var btn = $("<a class='mui-tab-item' style='font-size:14px' id='method_" + idx + "' name='method_" + idx + "' href='javascript:void(0)' >" + method.Title + "</ a>");
btn.data(method);
$("#batchBar").append(btn);
btn.on('tap', function () {
var method = $(this).data();
operateBatch(idx, method);
})
})
}
function Search() {
SearchCondition();
$(".mui-table-view").html("");
mui('#toToolBarPover').popover('hide');
Reload();
}
//点击事件
function operateBatch(idx, method) {
//获取前台页面的复选框的值
var pkValue = GetChecked();
if (pkValue == null || pkValue == "") {
return;
}
var url = method.Url || "";
url = url.replace(/PKVal=/g, "PKVal=" + pkValue);
if (parseInt(method.RefMethodType) == 0) {
var warning = method.Warning;
if (warning == "null" || warning == "")
warning = "您确定要执行吗?";
else {
warning = warning.replace(/,\s+/g, ",");
warning = warning.replace(/\s+/g, "\r\n");
}
var btnArray = ["确定", "取消"];
mui.confirm(warning, "", btnArray, function (e) {
if (e.index == 1)
return;
if (method.IsHaveFuncPara == "1") {
window.location.href = filterXSS(url);
return;
}
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Comm");
handler.AddPara("Index", method.No);
handler.AddPara("PKVal", pkValue);
handler.AddPara("PK", pkValue);
handler.AddPara("EnsName", GetQueryString("EnsName"));
var data = handler.DoMethodReturnString("Refmethod_Init");
if (data.indexOf("err@") != -1) {
mui.alert(data);
return;
}
data = replaceAll(data, "close@", "");
mui.alert(replaceAll(data, "info@@", ""));
mui.alert(data, function () {
Search("batch");
});
});
} else {
window.location.href=url;
}
}
//获取选中的行内容
function GetChecked() {
var checkedItems = $("input[type=checkbox]:checked");
if (checkedItems.length == 0) {
mui.alert("请选择要处理的行");
return "";
}
var names = "";
$.each(checkedItems, function (index, item) {
var id = item.id.replace("CB_", "");
names = names + id + ",";
});
return names.substring(0, names.length - 1);
}
</script>
</head>
<body>
<header class="mui-bar mui-bar-nav">
<a id="back" class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<a id="search" class="mui-action-menu mui-icon mui-icon-search mui-pull-right" href="#toToolBarPover"></a>
<h1 id="title" class="mui-title">查询</h1>
</header>
<!--查询结果显示-->
<content>
<div class="mui-content">
<!--下拉刷新容器-->
<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
<div class="mui-scroll">
<!--数据列表-->
<ul class="mui-table-view mui-table-view-chevron" style="margin-top:50px">
</ul>
</div>
</div>
</div>
</content>
<nav id="batchBar" class="mui-bar mui-bar-tab"></nav>
<!--查询条件-->
<div id="toToolBarPover" class="mui-popover">
<div class="mui-scroll-wrapper" style="height:300px;background-color:#fff">
<div class="mui-scroll">
<form class="mui-input-group" id="toolBar" style="padding-top:10px;">
</form>
</div>
</div>
</div>
<script>
mui('.mui-scroll-wrapper').scroll();
mui.init({
pullRefresh: {
container: '#pullrefresh',
down: {
callback: pulldownRefresh
},
up: {
contentrefresh: '正在加载...',
callback: pullupRefresh
}
}
});
/**
* 下拉刷新具体业务实现
*/
function pulldownRefresh() {
setTimeout(function () {
var table = document.body.querySelector('.mui-table-view');
var cells = document.body.querySelectorAll('.mui-table-view-cell');
//获取data数据
pageIdx = pageIdx - 1;
if (pageIdx == 0)
pageIdx = 1;
else {
table.innerHTML = "";
var pageData = InitData();
for (var i = 0; i < pageSize && i < pageData.length; i++) {
var item = pageData[i];
var li = document.createElement('li');
li.className = 'mui-table-view-cell';
li.style.paddingRight = "0px";
li.id = item[pkFiled];
_html = "";
_html += '<div class="mui-row mui-checkbox mui-left " >';
_html += '<label>';
_html += GetRowInfo(item);
_html += '</label>';
_html += '<input name="checkbox" id="CB_' + item[pkFiled] +'" type="checkbox">';
_html += '</div > ';
_html += '<div class="mui-row mui-left" >';
_html += "<button type='button' class='mui-btn' style='float:right;margin-right:20px;padding:7px 15px;margin-top:5px;line-height: 0.9' onclick='OpenEn(\"" + item[pkFiled] + "\")'>查看</button>";
_html += '</div>';
li.innerHTML = _html;
//下拉刷新,新纪录插到最前面;
table.appendChild(li, table.firstChild);
}
}
mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
}, 1500);
}
var refcount = 0;
/**
* 上拉加载具体业务实现
*/
function pullupRefresh() {
setTimeout(function () {
mui('#pullrefresh').pullRefresh().endPullupToRefresh((++refcount > 2)); //参数为true代表没有更多数据了。
var table = document.body.querySelector('.mui-table-view');
var cells = document.body.querySelectorAll('.mui-table-view-cell');
//获取data数据
pageIdx = pageIdx + 1;
if (pageIdx > pages)
pageIdx = pages;
else {
var pageData = InitData();
for (var i = 0; i < pageSize && i < pageData.length; i++) {
var item = pageData[i];
var li = document.createElement('li');
li.className = 'mui-table-view-cell';
li.style.paddingRight = "0px";
li.id = item[pkFiled];
_html = "";
_html += '<div class="mui-row mui-checkbox mui-left " >';
_html += '<label>';
_html += GetRowInfo(item);
_html += '</label>';
_html += '<input name="checkbox" id="CB_' + item[pkFiled] +'" type="checkbox">';
_html += '</div > ';
_html += '<div class="mui-row mui-left" >';
_html += "<button type='button' class='mui-btn' style='float:right;margin-right:20px;padding:7px 15px;margin-top:5px;line-height: 0.9' onclick='OpenEn(\"" + item[pkFiled] + "\")'>查看</button>";
_html += '</div>';
li.innerHTML = _html;
table.appendChild(li);
}
}
}, 1500);
}
$(window).keydown(function (e) {
var key = window.event ? e.keyCode : e.which;
if (key.toString() == "13") {
Search();
return false;
}
});
</script>
</body>
</html>