You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
FZ/lis-module-grp-pa-web/src/main/webapp/g_pos/GrpReportPrint.js

193 lines
8.0 KiB

// 该文件中包含客户端需要处理的函数和事件
var showInfo;
var mDebug = "1";
var turnPage = new turnPageClass(); //使用翻页功能,必须建立为全局变量
var turnPage1 = new turnPageClass(); //使用翻页功能,必须建立为全局变量
var turnPage2 = new turnPageClass(); //使用翻页功能,必须建立为全局变量
var turnPage3 = new turnPageClass(); //使用翻页功能,必须建立为全局变量
var mySql = new SqlClass();
//提交后操作,服务器数据返回后执行的操作
function afterSubmit(FlagStr, content, patch) {
//showInfo.close();
if (FlagStr == "Fail") {
var urlStr = "../common/jsp/MessagePage.jsp?picture=C&content=" + content;
// showInfo=window.showModalDialog(urlStr,window,"status:no;help:0;close:0;dialogWidth:550px;dialogHeight:250px");
var name = '提示'; //网页名称,可为空;
var iWidth = 550; //弹出窗口的宽度;
var iHeight = 350; //弹出窗口的高度;
var iTop = (window.screen.availHeight - iHeight) / 2; //获得窗口的垂直位置
var iLeft = (window.screen.availWidth - iWidth) / 2; //获得窗口的水平位置
showInfo = window.open(urlStr, name, "status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no,height=" + iHeight + ",width=" + iWidth + ",innerHeight=" + iHeight + ",innerWidth=" + iWidth + ",left=" + iLeft + ",top=" + iTop, false);
showInfo.focus();
} else {
var urlStr = "../common/jsp/MessagePage.jsp?picture=S&content=" + content;
// showInfo=window.showModalDialog(urlStr,window,"status:no;help:0;close:0;dialogWidth:550px;dialogHeight:350px");
var name = '提示'; //网页名称,可为空;
var iWidth = 550; //弹出窗口的宽度;
var iHeight = 350; //弹出窗口的高度;
var iTop = (window.screen.availHeight - iHeight) / 2; //获得窗口的垂直位置
var iLeft = (window.screen.availWidth - iWidth) / 2; //获得窗口的水平位置
showInfo = window.open(urlStr, name, "status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no,height=" + iHeight + ",width=" + iWidth + ",innerHeight=" + iHeight + ",innerWidth=" + iWidth + ",left=" + iLeft + ",top=" + iTop, false);
showInfo.focus();
downFile(patch);
}
}
function queryGrpCont() {
if (fm.ManageCom.value == "") {
alert("请录入管理机构!");
return;
}
// if (fm.all('StartDay').value == null || fm.all('StartDay').value == "" || fm.all('EndDay').value == null || fm.all('EndDay').value == "") {
// alert("请选择起止时间!");
// return;
// }
//
// if (fm.all('StartDay').value >= fm.all('EndDay').value) {
// alert("初始日期必须小于结束日期!");
// return;
// }
// 书写SQL语句
tSQLInfo = new SqlClass();
tSQLInfo.setResourceName("g_pos.GrpReportPrintSql");
tSQLInfo.setModule("grp_pa");
tSQLInfo.setSqlId("queryLCGrpPolContInfo");
tSQLInfo.addSubPara(fm.GrpContNo.value);
tSQLInfo.addSubPara(fm.PrtNo.value);
tSQLInfo.addSubPara(fm.ManageCom.value);
tSQLInfo.addSubPara(fm.StartDay.value);
tSQLInfo.addSubPara(fm.EndDay.value);
//查询SQL,返回结果字符串
turnPage.queryModal(tSQLInfo.getString(), GrpContGrid);
//判断是否查询成功
if (!turnPage.strQueryResult) {
alert("无满足查询条件的团单!");
return;
}
}
function print() {
if (fm.all('ManageCom').value == null || fm.all('ManageCom').value == "") {
alert("请选择管理机构!");
return;
}
var selno = GrpContGrid.getSelNo() - 1;
//打印条件不能为空
if (selno < 0) {
alert("请选择要打印年度报告的保单!");
return;
}
var grpContNo = GrpContGrid.getRowColData(selno, 2);
if (grpContNo == "" || grpContNo == null) {
alert("请先查询保单信息!")
return;
}
var tPolNo = GrpContGrid.getRowColData(selno, 7);
var tRiskCode = GrpContGrid.getRowColData(selno, 6);
var tGrpName = GrpContGrid.getRowColData(selno, 3);
var tCVilaDate = GrpContGrid.getRowColData(selno, 5);
fm.all('InputGrpContNo').value = grpContNo;
if (fm.all('PolType').value == null || fm.all('PolType').value == "") {
alert("请选择是否打印个人余额清单!");
return;
}
if (fm.all('StartDay').value == null || fm.all('StartDay').value == "" || fm.all('EndDay').value == null || fm.all('EndDay').value == "") {
alert("请选择起止时间!");
return;
}
if (fm.all('StartDay').value < tCVilaDate) {
fm.all('InputStartDay').value = tCVilaDate;
} else {
fm.all('InputStartDay').value = fm.all('StartDay').value;
}
if (fm.all('StartDay').value >= fm.all('EndDay').value) {
alert("初始日期必须小于结束日期!");
return;
}
if (tCVilaDate > fm.all('EndDay').value) {
alert("该保单的生效日期为:" + tCVilaDate + ",请输入合理的查询时间范围!");
return;
}
//检查险种条件
tSQLInfo = new SqlClass();
tSQLInfo.setResourceName("g_pos.GrpReportPrintSql");
tSQLInfo.setModule("grp_pa");
tSQLInfo.setSqlId("queryLMRiskAppRiskCodeByRiskCode");
tSQLInfo.addSubPara(tRiskCode);
//查询SQL,返回结果字符串
turnPage.strQueryResult = easyQueryVer3(tSQLInfo.getString(), 1, 0, 1);
//判断是否查询成功
if (!turnPage.strQueryResult) {
alert("非团体万能险种,无法打印!");
return;
} else {
fm.all('InputRiskCode').value = tRiskCode;
fm.all('InputGrpName').value = tGrpName;
fm.all('InputCVilaDate').value = tCVilaDate;
fm.all('InputPolNo').value = tPolNo;
fm.action = "../API/grp_pa/g_pos/GrpReportPrintSave/ADD";
fm.target = "f1print";
fm.fmtransact.value = "PRINT";
submitForm();
}
}
/**
* 提交,保存按钮对应操作
*/
function submitForm() {
var i = 0;
var showStr = i18nMessage("正在保存数据,请您稍候并且不要修改屏幕上的值或链接其他页面", "LIS-04525");
var urlStr = "../common/jsp/MessagePage.jsp?picture=C&content=" + encodeURIComponent(showStr);
//showInfo = window.showModelessDialog(urlStr,window,"status:no;help:0;close:0;dialogWidth:550px;dialogHeight:250px");
var name = '提示'; //网页名称,可为空;
var iWidth = 550; //弹出窗口的宽度;
var iHeight = 250; //弹出窗口的高度;
var iTop = (window.screen.availHeight - iHeight) / 2; //获得窗口的垂直位置
var iLeft = (window.screen.availWidth - iWidth) / 2; //获得窗口的水平位置
showInfo = window.open(urlStr, name, "status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no,height=" + iHeight + ",width=" + iWidth + ",innerHeight=" + iHeight + ",innerWidth=" + iWidth + ",left=" + iLeft + ",top=" + iTop, false);
showInfo.focus();
ajaxSubmit2(document.getElementById("fm"), resultAfterSubmit);
}
function resultAfterSubmit(flagStr, content, result) {
afterSubmit(flagStr, content, result.tFilePath1);
}
/**
** 文件下载
**/
function downFile(patch) {
try {
// 创建 URL 对象
var url = new URL(patch);
// 获取路径部分
var path = url.pathname; // 注意:JavaScript 中是 `pathname` 而不是 `getPath()`
// 截取文件名
var fileName = path.substring(path.lastIndexOf('/') + 1);
// 构造下载链接并跳转
// window.location = "../API/grp_common/jsp/download/DOWNLOAD?FilePath=" + path + "&FileName=" + fileName;
showInfo = window.open(patch);
showInfo.focus();
} catch (e) {
alert("无效的文件路径,请检查输入!");
}
//window.location = "../common/jsp/download.jsp?FilePath="+patch+"&FileName="+fileName1;
// window.open("../API/grp_common/jsp/download/DOWNLOAD?FilePath=" + patch + "&FileName=" + fileName1);
}