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/EdorSimplePrint.js

383 lines
13 KiB

/***************************************************************
* <p>ProName:EdorSimplePrint.js</p>
* <p>Title:官网团体保单信息打印</p>
* <p>Description:官网团体保单信息打印</p>
* <p>Copyright:Copyright (c) 2012</p>
* <p>Company:Sinosoft</p>
* @author : lisy
* @version : 8.0
* @date : 2024-10-29
****************************************************************/
// 该文件中包含客户端需要处理的函数和事件
var showInfo;
var mDebug="1";
var turnPage = new turnPageClass(); //使用翻页功能,必须建立为全局变量
// var turnPage1 = new turnPageClass(); //使用翻页功能,必须建立为全局变量
/**
* 提交,保存按钮对应操作
*/
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.patch);
}
/**
* 提交后操作,服务器数据返回后执行的操作
*/
function afterSubmit(FlagStr, content, patch) {
if (typeof(showInfo)=="object"&& typeof(showInfo)!="unknown") {
showInfo.close();
}
if (FlagStr == "Fail" ) {
var urlStr = "../common/jsp/MessagePage.jsp?picture=C&content=" + encodeURIComponent(content);
//showModalDialog(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();
} else {
var urlStr = "../common/jsp/MessagePage.jsp?picture=C&content=" + encodeURIComponent(content);
//showModalDialog(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();
downFile(patch);
}
}
// 前台查询时调用的查询按钮,注意要跟easyQueryClick()同步
function queryEndorse()
{
var EdorState;
if(trim(fm.ManageCom.value) == "" ||
(trim(fm.EdorAppntType.value) == "" || trim(fm.CheckNo.value) == "")
&& trim(fm.EdorNo.value) == "")
{
alert("在线打印前,请输入批单号或客户类型和网上查询号!管理机构必录!");
return;
}
// 初始化表格
initPEdorMainGrid();
// var tReturn = parseManageComLimit();
// SQL语句
tSQLInfo = new SqlClass();
tSQLInfo.setModule("grp_pa");
tSQLInfo.setResourceName("g_pos.EdorSimplePrintSql");
tSQLInfo.setSqlId("EdorSimplePrintSql1");
tSQLInfo.addSubPara(fm.EdorType.value);
tSQLInfo.addSubPara(fm.EdorAppntType.value);
tSQLInfo.addSubPara(fm.ManageCom.value);
tSQLInfo.addSubPara(fm.CheckNo.value);
tSQLInfo.addSubPara(fm.EdorNo.value);
tSQLInfo.addSubPara(fm.CheckNo.value);
tSQLInfo.addSubPara(fm.CheckNo.value);
tSQLInfo.addSubPara(fm.CheckNo.value);
turnPage.queryModal(tSQLInfo.getString(), PEdorMainGrid);
//查询SQL,返回结果字符串
// turnPage.strQueryResult = easyQueryVer3(tSQLInfo.getString(), 1, 0, 1);
// turnPage.strQueryResult = easyExecSql(tSQLInfo.getString(), 1, 0, 1);
//判断是否查询成功
if (!turnPage.strQueryResult)
{
alert("无满足查询条件的批单!");
initPEdorMainGrid();
return;
}
else
{
//查询成功则拆分字符串,返回二维数组
turnPage.arrDataCacheSet = decodeEasyQueryResult(turnPage.strQueryResult);
//设置初始化过的MULTILINE对象,VarGrid为在初始化页中定义的全局变量
turnPage.pageDisplayGrid = PEdorMainGrid;
//保存SQL语句
turnPage.strQuerySql = strSQL;
//设置查询起始位置
turnPage.pageIndex = 0;
//在查询结果数组中取出符合页面显示大小设置的数组
var arrDataSet = turnPage.getData(turnPage.arrDataCacheSet, turnPage.pageIndex, MAXSCREENLINES);
arrGrid = arrDataSet;
//调用MULTILINE对象显示查询结果
displayMultiline(arrDataSet, turnPage.pageDisplayGrid);
}
}
// 打印后返回时调用的查询按钮,注意要跟queryEndorse()同步
function easyQueryClick()
{
if(trim(fm.ManageCom.value) == "" || trim(fm.EdorType.value) == "" || trim(fm.EdorAppntType.value) == "" || (trim(fm.CheckNo.value) == "" && trim(fm.EdorNo.value) == ""))
{
alert("请输入批单类型,客户类型,网上查询号或批单号,或者到保全批量打印页面进行打印!");
return;
}
var EdorState;
// 初始化表格
initPEdorMainGrid();
// var tReturn = parseManageComLimit();
// 书写SQL语句
tSQLInfo = new SqlClass();
tSQLInfo.setModule("grp_pa");
tSQLInfo.setResourceName("g_pos.EdorSimplePrintSql");
tSQLInfo.setSqlId("EdorSimplePrintSql2");
tSQLInfo.addSubPara(fm.EdorType.value);
tSQLInfo.addSubPara(fm.EdorAppntType.value);
tSQLInfo.addSubPara(fm.ManageCom.value);
tSQLInfo.addSubPara(fm.CheckNo.value);
tSQLInfo.addSubPara(fm.EdorNo.value);
turnPage1.queryModal(tSQLInfo.getString(), PEdorMainGrid);
//判断是否查询成功
if (!turnPage.strQueryResult)
{
//打印返回调用时如果查询失败不弹出对话框
//alert("无满足查询条件的批单或该批单已打印!");
initPEdorMainGrid();
return;
}
else
{
//查询成功则拆分字符串,返回二维数组
turnPage.arrDataCacheSet = decodeEasyQueryResult(turnPage.strQueryResult);
//设置初始化过的MULTILINE对象,VarGrid为在初始化页中定义的全局变量
turnPage.pageDisplayGrid = PEdorMainGrid;
//保存SQL语句
turnPage.strQuerySql = strSQL;
//设置查询起始位置
turnPage.pageIndex = 0;
//在查询结果数组中取出符合页面显示大小设置的数组
var arrDataSet = turnPage.getData(turnPage.arrDataCacheSet, turnPage.pageIndex, MAXSCREENLINES);
arrGrid = arrDataSet;
//调用MULTILINE对象显示查询结果
displayMultiline(arrDataSet, turnPage.pageDisplayGrid);
}
}
//打印批单
function PrtEdor(type)
{
var arrReturn = new Array();
var tSel = PEdorMainGrid.getSelNo();
if( tSel == 0 || tSel == null )
alert( "请先选择一条记录,再点击查看按钮。" );
else
{
arrReturn = getQueryResult();
fm.all('EdorNo').value = arrReturn[0];
fm.all('ContNo').value=arrReturn[1];
fm.action = "../f1print/EndorsementF1PJ1.jsp?type="+type;
fm.target="f1print";
fm.submit();
fm.action = "./PEdorQueryOut.jsp";
fm.target="fraSubmit";
}
}
// 数据返回父窗口
function returnParent()
{
var arrReturn = new Array();
var tSel = PEdorMainGrid.getSelNo();
if( tSel == 0 || tSel == null )
top.close();
//alert( "请先选择一条记录,再点击返回按钮。" );
else
{
try
{
arrReturn = getQueryResult();
top.opener.afterQuery( arrReturn );
}
catch(ex)
{
//alert( "没有发现父窗口的afterQuery接口。" + ex );
}
top.close();
}
}
function getQueryResult()
{
var arrSelected = null;
tRow = PEdorMainGrid.getSelNo();
if( tRow == 0 || tRow == null || arrGrid == null )
return arrSelected;
arrSelected = new Array();
arrSelected = PEdorMainGrid.getRowData(tRow - 1);
return arrSelected;
}
function printPD(){
var selno = PEdorMainGrid.getSelNo()-1;
if (selno <0)
{
alert("请选择要处理的任务!");
return;
}
document.all("EdorNo").value = PEdorMainGrid.getRowColData(selno, 1);
document.all("GrpContNo").value = PEdorMainGrid.getRowColData(selno, 2);
document.all("Operate").value = "JYBQ";
var queryPath = wrapSql("g_pos.EdorSimplePrintSql", "queryPath", [document.all("EdorNo").value,document.all("GrpContNo").value ,document.all("Operate").value], "grp_pa");
var URLPath = easyExecSql(queryPath, 1, 0, 1);
if (URLPath != null && URLPath != "") {
var str = URLPath[0][0];
downFile(str);
return true;
} else {
fm.action = "../API/grp_print/g_print/EdorPrintSave/ADD";
submitForm();
}
//fm.all('EdorAcceptNo').value = PEdorMainGrid.getRowColData(selno, 6);
// fm.action = "../f1print/EndorsementF1PJ3.jsp?EdorNo="+EdorNo;
// fm.target="f1print";
// fm.submit();
}
function queryImage(){
var selno = PEdorMainGrid.getSelNo()-1;
if (selno <0)
{
alert("请选择要处理的任务!");
return;
}
var EdorNo = PEdorMainGrid.getRowColData(selno, 1);
window.open("../es_common/ImageQueryGrpMain.jsp?EdorAcceptNo="+EdorNo)
}
//初始化管理机构,最长截取六位
function initManageCom()
{
if(comcode.substring(0,6) !=null && comcode.substring(0,6) != "")
{
var i,j,m,n;
var returnstr;
var tTurnPage = new turnPageClass();
var strSQL = "select comcode,name from ldcom where comcode like "+comcode.substring(0,6)+"%%'";
tTurnPage.strQueryResult = easyQueryVer3(strSQL, 1, 1, 1);
if (tTurnPage.strQueryResult == "")
{
return "";
}
tTurnPage.arrDataCacheSet = decodeEasyQueryResult(tTurnPage.strQueryResult);
var returnstr = "";
var n = tTurnPage.arrDataCacheSet.length;
if (n > 0)
{
for( i = 0;i < n; i++)
{
m = tTurnPage.arrDataCacheSet[i].length;
if (m > 0)
{
for( j = 0; j< m; j++)
{
if (i == 0 && j == 0)
{
returnstr = "0|^"+tTurnPage.arrDataCacheSet[i][j];
}
if (i == 0 && j > 0)
{
returnstr = returnstr + "|" + tTurnPage.arrDataCacheSet[i][j];
}
if (i > 0 && j == 0)
{
returnstr = returnstr+"^"+tTurnPage.arrDataCacheSet[i][j];
}
if (i > 0 && j > 0)
{
returnstr = returnstr+"|"+tTurnPage.arrDataCacheSet[i][j];
}
}
}
else
{
alert("查询失败!!");
return "";
}
}
}
else
{
alert("查询失败!");
return "";
}
fm.ManageCom.CodeData = returnstr;
return returnstr;
}
}
/**
** 文件下载
**/
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("无效的文件路径,请检查输入!");
}
}