虚拟M的改进

之前为了保留老习俗,虚拟M采用了和M调用一样的约定,这样的好处是习惯上保持一致,小伙伴提出现在是java了,还这样约定方法太啰嗦,确实是有点啰嗦,进行了改进。
在这里插入图片描述

改进为三个参数的,方法可以写在任何继承BaseHttpHandler和BaseHttpHandlerNoSession的ashx实现类里面,这样的好处是:1、方法什么补啰嗦了 2.在页面的ashx就可以实现了,避免专门为虚拟M再创建一个类,比如查询和导出一般要同时给页面使用和导出查询使用。
在这里插入图片描述

同页面ashx就可以直接调用,效率更高
在这里插入图片描述
导出指定的时候指定页面后台类即可,虚拟M可以防止任意的后台业务脚本里
在这里插入图片描述

示例页面

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>JRTPrintTemplateEle供拷贝代码使用</title><link rel="shortcut icon" href="../../resource/common/images/favicon.ico" /><script src="../../resource/common/js/JRTBSBase.js" type="text/javascript"></script><script src="../../jrtprint/js/JRTPrint.js" type="text/javascript"></script><script language="javascript" type="text/javascript">SYSPageCommonInfo.Init();var BasePath = '';var ResourcePath = '';var WebServicAddress = SYSPageCommonInfo.Data.WebServicAddress;var UserDR = SYSPageCommonInfo.Data.Sesssion.UserDR;var GroupID = SYSPageCommonInfo.Data.Sesssion.GroupID;var SessionStr = SYSPageCommonInfo.Data.SessionStr;</script><script type="text/javascript">//全局变量var me = {actionUrl: '../ashx/ashJRTPrintTemplateEle.ashx'};//jquery入口$(function () {//导出Excel$("#btnExport").click(function () {var para = {};var tempPath = DealExportExcelTMPName("打印元素.xls");JRTBasePrint('Export@' + WebServicAddress + '@jrtdemo.ashx.ashJRTPrintTemplateEle@QryPrintEle@' + JSON.stringify(para) + '@' + SessionStr + '@' + tempPath + '@0');});//导出Excel多模板$("#btnExport1").click(function () {var para = {};var tempPath = DealExportExcelTMPName("打印元素多模板");JRTBasePrint('Export@' + WebServicAddress + '@jrtdemo.ashx.ashJRTPrintTemplateEle@QryPrintEle@' + JSON.stringify(para) + '@' + SessionStr + '@' + tempPath + '@0');});//导出Excel无模板$("#btnExport0").click(function () {var para = {};var tempPath = "";JRTBasePrint('Export@' + WebServicAddress + '@jrtdemo.ashx.ashJRTPrintTemplateEle@QryPrintEle@' + JSON.stringify(para) + '@' + SessionStr + '@' + tempPath + '@0');});//打印预览$("#btnPrintPreview").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PrintPreview";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintBarCodeTest@GetData";JRTBasePrint(Param);});//打印表格$("#btnPrintPreviewGrid").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PrintOut";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.DrawGrid@GetData";JRTBasePrint(Param);});//打印报告$("#btnPrintReport").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PrintOut";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintTemplateTest@GetData";JRTBasePrint(Param);});//集中打印$("#btnCenterPrint").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PrintOut";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.CenterPrintTest@GetData";JRTBasePrint(Param);});//在线预览$("#btnPrintPreviewInline").click(function () {showwin("#winPrintPreview", "在线打印预览", '../../facade/form/frmJRTPrintDrawView.aspx?PrintDR=' + 1 + '&PrintClassName=vm.test.PrintBarCodeTest', 950, $(window).height() - 20, true, "10px");});//打印$("#btnPrint").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PrintOut";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintBarCodeTest@GetData";JRTBasePrint(Param);});//PDF$("#btnPDF").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PDF#-1";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintBarCodeTest@GetData";JRTBasePrint(Param);});//PDF弹窗$("#btnPDFSave").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PDF#0";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintBarCodeTest@GetData";JRTBasePrint(Param);});//上传文件到文件服务$("#btnUpfile").click(function () {$("#file_upload").click();});//改名文件$("#btnRenamefile").click(function () {//往后台提交数据$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=ReNameImageFile',success: function (data, status) {$.messager.progress('close');if (!FilterBackData(data)) {return;}alert("成功");}});});//删除文件$("#btnDeletefile").click(function () {//往后台提交数据$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=DeleteImageFile',success: function (data, status) {$.messager.progress('close');if (!FilterBackData(data)) {return;}alert("成功");}});});//Excel得到JSON$("#btnExcelGetJson").click(function () {JRTGetExcelFileJson(function (retJson) {alert(JSON.stringify(retJson));});});//新增数据点击$("#btnAddJRTPrintTemplateEle").click(function () {$("#txtJRTPrintTemplateEleRowID").val(""); $('#winEditJRTPrintTemplateEle').window({title: TranslateDataMTHD('Add Data', '新增数据', ''),modal: true});});//修改数据点击$("#btnUpdateJRTPrintTemplateEle").click(function () {UpdateJRTPrintTemplateEle();});//修改数据function UpdateJRTPrintTemplateEle(row){var selectRow = $('#dgJRTPrintTemplateEle').datagrid("getSelected");if(row!=null){selectRow=row;}if (selectRow == null) {$.messager.alert(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Please select the data to modify', '请选择要修改的数据!', ''), 'info');return;}$("#formJRTPrintTemplateEle").form('load', selectRow);$('#winEditJRTPrintTemplateEle').window({title: TranslateDataMTHD('Update Data', '修改数据', ''),modal: true});}//删除数据点击$("#btnDeleteJRTPrintTemplateEle").click(function () {var checkRow = $('#dgJRTPrintTemplateEle').datagrid("getChecked");var selectRow = $('#dgJRTPrintTemplateEle').datagrid("getSelected");if ((checkRow == null || checkRow.length == 0)&&selectRow==null) {$.messager.alert(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Please select the data to delete', '请勾选要删除的数据!', ''), 'info');return;}if ((checkRow == null || checkRow.length == 0)) {checkRow=[selectRow];}var RowIDS = "";for (var i = 0; i < checkRow.length; i++) {if (i == 0) {RowIDS = checkRow[i].RowID;}else {RowIDS += "^" + checkRow[i].RowID;}}$.messager.confirm(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Do you want to delete the selected data', '是否要删除选择的数据?', '') , function (r) {if (r) {//开启等待$.messager.progress({ text: TranslateDataMTHD("Deleting data","正在删除数据", ""), interval: 500 });setTimeout(function () {$.messager.progress('close');}, 8000);//往后台提交数据$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=DeleteJRTPrintTemplateEle',data: { RowIDS: RowIDS },success: function (data, status) {$.messager.progress('close');if (!FilterBackData(data)) {return;}if (!data.IsOk) {$.messager.alert(TranslateDataMTHD("Error message", "错误提示", ""), TranslateDataMTHD("failed to dalete data, error message:", "删除失败,错误信息:", "") + data.Message);}else {QryJRTPrintTemplateEle();$.messager.show({title: TranslateDataMTHD("Info", "提示", ""),msg: TranslateDataMTHD("Successfully deleted!", "删除成功!", ""),timeout: 500,showType: 'slide'});}}});}});});//保存数据$("#btnSaveJRTPrintTemplateEle").click(function () {var saveData = jQuery.parseJSON($("#formJRTPrintTemplateEle").serializeObject());//开启等待$.messager.progress({ text: TranslateDataMTHD("Saving data","正在保存数据", ""), interval: 500 });setTimeout(function () {$.messager.progress('close');}, 8000);//往后台提交数据$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=SaveJRTPrintTemplateEle',data: saveData,success: function (data, status) {$.messager.progress('close');if (!FilterBackData(data)) {return;}if (!data.IsOk) {$.messager.alert(TranslateDataMTHD("Error message", "错误提示", ""), TranslateDataMTHD("failed to dalete data, error message:", "删除失败,错误信息:", "") + data.Message);}else {QryJRTPrintTemplateEle();$.messager.show({title: TranslateDataMTHD("Info", "提示", ""),msg: TranslateDataMTHD("Successfully saveed!", "保存成功!", ""),timeout: 500,showType: 'slide'});$('#winEditJRTPrintTemplateEle').window("close");}}});});//关闭窗口$("#btnCloseJRTPrintTemplateEle").click(function () {$('#winEditJRTPrintTemplateEle').window("close");});//构造查询事件$("#txtFilterJRTPrintTemplateEle").searchbox({searcher: function (value, name) {QryJRTPrintTemplateEle();},prompt: TranslateDataMTHD('Enter query', '回车查询', '')});//模板下拉表格渲染$('#txtJRTPrintTemplateElePrintTemplateDR').combogrid({panelWidth: 350,idField: 'RowID',width: 205,textField: 'CName',url: me.actionUrl + '?Method=CommonQueryView&data='+JSON.stringify({ ModelName: "JRTPrintTemplate", Pram: [], IsDisplayCount: false, Joiner: [], Operators: [] }),columns: [[{ field: 'RowID', title: '主键', width: 60 },{ field: 'CName', title: '名称', width: 260 }]]});$('#txtJRTPrintTemplateElePrintTemplateDR').combogrid("showSelectWin");//JRTPrintTemplateEle表格$('#dgJRTPrintTemplateEle').datagrid({remoteSort:false,singleSelect: true,toolbar: "#dgJRTPrintTemplateEleToolBar",fit: true,onSelect: function (index, row) {//方便拷贝到子表查询用var selectJRTPrintTemplateEle=$('#dgJRTPrintTemplateEle').datagrid("getSelected");},onDblClickRow: function (index, row) {UpdateJRTPrintTemplateEle(row);},columns: [[{ field: 'ChkFlag', title: TranslateDataMTHD('Check', '选择', ''), width: 20, sortable: true, align: 'center', checkbox: true },{ field: 'RowID', title: TranslateDataMTHD('RowID', '主键', '') , width: 150, sortable: true },{ field: 'PrintTemplateDRName', title: TranslateDataMTHD('PrintTemplateDRName', '模板', '') , width: 150, sortable: true },{ field: 'PrintType', title: TranslateDataMTHD('PrintType', '元素类型', '') , width: 150, sortable: true },{ field: 'PrintX', title: TranslateDataMTHD('PrintX', 'X坐标', '') , width: 150, sortable: true },{ field: 'PrintY', title: TranslateDataMTHD('PrintY', 'Y坐标', '') , width: 150, sortable: true },{ field: 'PrintFont', title: TranslateDataMTHD('PrintFont', '打印字体', '') , width: 150, sortable: true },{ field: 'PrintFontSize', title: TranslateDataMTHD('PrintFontSize', '打印字体大小', '') , width: 150, sortable: true },{ field: 'PrintFontStyle', title: TranslateDataMTHD('PrintFontStyle', '打印字体样式', '') , width: 150, sortable: true },{ field: 'PrintLength', title: TranslateDataMTHD('PrintLength', '打印长度', '') , width: 150, sortable: true },{ field: 'PrintWidth', title: TranslateDataMTHD('PrintWidth', '元素宽度', '') , width: 150, sortable: true },{ field: 'PrintHeight', title: TranslateDataMTHD('PrintHeight', '元素高度', '') , width: 150, sortable: true },{ field: 'PrintText', title: TranslateDataMTHD('PrintText', '元素文本', '') , width: 150, sortable: true },{ field: 'DataField', title: TranslateDataMTHD('DataField', '绑定属性', '') , width: 150, sortable: true },{ field: 'PrintFlag', title: TranslateDataMTHD('PrintFlag', '特殊标志', '') , width: 150, sortable: true },{ field: 'PrintAlignment', title: TranslateDataMTHD('PrintAlignment', '停靠方向', '') , width: 150, sortable: true },{ field: 'LayOut', title: TranslateDataMTHD('LayOut', '布局方式', '') , width: 150, sortable: true },{ field: 'Angle', title: TranslateDataMTHD('Angle', '旋转角度', '') , width: 150, sortable: true },{ field: 'IsVShow', title: TranslateDataMTHD('IsVShow', '是否垂直显示', '') , width: 150, sortable: true },{ field: 'Color', title: TranslateDataMTHD('Color', '颜色', '') , width: 150, sortable: true },{ field: 'FixedReport', title: TranslateDataMTHD('FixedReport', '固定元素', '') , width: 150, sortable: true }]]});//查询JRTPrintTemplateElefunction QryJRTPrintTemplateEle() {var Filter = $("#txtFilterJRTPrintTemplateEle").searchbox("getValue");//开启等待,默认注释,在单击事件调用的逻辑启用等待会冲掉双击事件,按需要开启//$.messager.progress({ text: TranslateDataMTHD("Querying data","正在查询数据", ""), interval: 500 });//setTimeout(function () {//$.messager.progress('close');//}, 8000);$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=QryJRTPrintTemplateEle',data: { Filter: Filter },success: function (data, status) {//结束等待//$.messager.progress('close');if (!FilterBackData(data)) {return;}$('#dgJRTPrintTemplateEle').datagrid("loadData", data);}});};//执行查询数据QryJRTPrintTemplateEle();});//上传文件function UpFile(a) {var selectFiles = document.getElementById('file_upload').files;if (selectFiles != null && selectFiles.length > 0) {for (var i = 0; i < selectFiles.length; i++) {var data = new FormData();var file = selectFiles[i];data.append("file", file);ajaxLoading();setTimeout(function () {ajaxLoadEnd();}, 4000);var url = me.actionUrl + "?Method=UpImageFile";var callback = function (retData) {retData = JSON.parse(retData);if (retData.IsOk) {showInfo("上传成功!");}else {showError(retData["Message"]);}ajaxLoadEnd();};JRTHttpSys(data, url, callback);}$("#file_upload").val("");}}</script>
</head>
<body><div class="easyui-layout" fit="true" style="border: none;"><div data-options="region:'center',title:''" style="border: none;"><div id="dgJRTPrintTemplateEleToolBar" style="padding: 3px 0px 3px 10px;"><a id="btnAddJRTPrintTemplateEle" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" plain="true" listranslate="html~Add">新增</a><a id="btnUpdateJRTPrintTemplateEle" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-write-order'" plain="true" listranslate="html~Mod">修改</a><a id="btnDeleteJRTPrintTemplateEle" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" plain="true" listranslate="html~Del">删除</a><input id="txtFilterJRTPrintTemplateEle" style="margin-left: 14px; width: 240px;"></input><a id="btnExport" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" plain="true" listranslate="html~Export">导出</a><a id="btnExport1" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" plain="true" listranslate="html~Export">多模板</a><a id="btnExport0" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" plain="true" listranslate="html~Export">无模板</a><a id="btnPrintPreview" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PrintPreview">打印预览</a><a id="btnPrintPreviewInline" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PrintPreview">在线预览</a><a id="btnPrint" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~Print">打印</a><a id="btnPDF" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PDF">PDF</a><a id="btnPDFSave" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PDF">PDF弹</a><a id="btnPrintPreviewGrid" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PrintGrid">打表格</a><a id="btnPrintReport" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PrintReport">打报告</a><a id="btnCenterPrint" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~CenterPrint">集中打印</a><a id="btnUpfile" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-file'" plain="true" listranslate="html~File">上传文件</a><input type="file" id="file_upload" name="f" onchange="UpFile(this);" accept="image/png,image/gif,image/jp2,image/jpeg,image/bmp" style="display: none" multiple="multiple" /><a id="btnExcelGetJson" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" plain="true" listranslate="html~ExcelJson">ExcelJson</a><a id="btnRenamefile" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-file'" plain="true" listranslate="html~File">改名</a><a id="btnDeletefile" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-file'" plain="true" listranslate="html~File">删除</a></div><table id="dgJRTPrintTemplateEle" title="" iconcls="icon-paper" listranslate="title~JRTPrintTemplateEle"></table></div><div id="winEditJRTPrintTemplateEle" style="padding: 10px 0px 0px 10px;width:1140px;height:366.6666666666666667px;display: none;"><form id="formJRTPrintTemplateEle" name="edit_form" method="post"><input type="hidden" id="txtJRTPrintTemplateEleRowID" name="RowID" value="0" /><table><tr><td class="lisar" jrttranslate="html~PrintTemplateDR">模板</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintTemplateDR" type="text" name="PrintTemplateDR" style="width:200px;"/></td><td class="lisar" jrttranslate="html~PrintType">元素类型</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintType" type="text" name="PrintType" style="width:200px;" class="easyui-validatebox"  maxlength="20"/></td><td class="lisar" jrttranslate="html~PrintX">X坐标</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintX" type="text" name="PrintX" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td></tr><tr><td class="lisar" jrttranslate="html~PrintY">Y坐标</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintY" type="text" name="PrintY" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~PrintFont">打印字体</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintFont" type="text" name="PrintFont" style="width:200px;" class="easyui-validatebox"  maxlength="20"/></td><td class="lisar" jrttranslate="html~PrintFontSize">打印字体大小</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintFontSize" type="text" name="PrintFontSize" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td></tr><tr><td class="lisar" jrttranslate="html~PrintFontStyle">打印字体样式</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintFontStyle" type="text" name="PrintFontStyle" style="width:200px;" class="easyui-validatebox"  maxlength="20"/></td><td class="lisar" jrttranslate="html~PrintLength">打印长度</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintLength" type="text" name="PrintLength" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~PrintWidth">元素宽度</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintWidth" type="text" name="PrintWidth" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td></tr><tr><td class="lisar" jrttranslate="html~PrintHeight">元素高度</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintHeight" type="text" name="PrintHeight" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~PrintText">元素文本</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintText" type="text" name="PrintText" style="width:200px;" class="easyui-validatebox"  maxlength="2000"/></td><td class="lisar" jrttranslate="html~DataField">绑定属性</td><td class="lisal"><input id="txtJRTPrintTemplateEleDataField" type="text" name="DataField" style="width:200px;" class="easyui-validatebox"  maxlength="500"/></td></tr><tr><td class="lisar" jrttranslate="html~PrintFlag">特殊标志</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintFlag" type="text" name="PrintFlag" style="width:200px;" class="easyui-validatebox"  maxlength="50"/></td><td class="lisar" jrttranslate="html~PrintAlignment">停靠方向</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintAlignment" type="text" name="PrintAlignment" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~LayOut">布局方式</td><td class="lisal"><input id="txtJRTPrintTemplateEleLayOut" type="text" name="LayOut" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td></tr><tr><td class="lisar" jrttranslate="html~Angle">旋转角度</td><td class="lisal"><input id="txtJRTPrintTemplateEleAngle" type="text" name="Angle" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~IsVShow">是否垂直显示</td><td class="lisal"><input id="txtJRTPrintTemplateEleIsVShow" type="text" name="IsVShow" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~Color">颜色</td><td class="lisal"><input id="txtJRTPrintTemplateEleColor" type="text" name="Color" style="width:200px;" class="easyui-validatebox"  maxlength="30"/></td></tr><tr><td class="lisar" jrttranslate="html~FixedReport">固定元素</td><td class="lisal"><input id="txtJRTPrintTemplateEleFixedReport" type="text" name="FixedReport" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td></table><div region="south" border="fale" style="text-align: center; padding: 5px 0 0;"><a id="btnSaveJRTPrintTemplateEle" href="#" class="easyui-linkbutton" plain="false" listranslate="html~Save">保存</a><span class="sp6"></span><a id="btnCloseJRTPrintTemplateEle" href="#" class="easyui-linkbutton" plain="false" listranslate="html~Cancel">取消</a></div></form></div><div id="winPrintPreview" style="padding: 10px 0px 0px 10px; width: 1140px; height: 786px; display: none;"></div></div>
</body>
</html>

示例后台

import JRT.Core.Dto.OutValue;
import JRT.Core.MultiPlatform.FileCollection;
import JRT.Model.Bussiness.Parameters;
import JRTBLLBase.BaseHttpHandler;
import JRTBLLBase.Helper;
import JRT.Core.Dto.HashParam;
import JRT.Core.Dto.ParamDto;
import JRT.Core.Dto.OutParam;
import JRT.Model.Entity.*;
import JRT.Core.Util.Convert;
import JRT.Core.MultiPlatform.JRTContext;import java.util.ArrayList;
import java.util.List;/**
*由代码生成器生成的后台代码
*/
public class ashJRTPrintTemplateEle extends BaseHttpHandler {/*** 保存数据,前台按表的属性名提交* @return 字符串*/public String SaveJRTPrintTemplateEle() throws Exception{JRTPrintTemplateEle dto=new JRTPrintTemplateEle();//主键dto.RowID=Helper.ValidParam(JRTContext.GetRequest(Request, "RowID"), dto.RowID);//模板dto.PrintTemplateDR=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintTemplateDR"), dto.PrintTemplateDR);//元素类型dto.PrintType=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintType"), dto.PrintType);//X坐标dto.PrintX=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintX"), dto.PrintX);//Y坐标dto.PrintY=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintY"), dto.PrintY);//打印字体dto.PrintFont=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintFont"), dto.PrintFont);//打印字体大小dto.PrintFontSize=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintFontSize"), dto.PrintFontSize);//打印字体样式dto.PrintFontStyle=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintFontStyle"), dto.PrintFontStyle);//打印长度dto.PrintLength=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintLength"), dto.PrintLength);//元素宽度dto.PrintWidth=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintWidth"), dto.PrintWidth);//元素高度dto.PrintHeight=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintHeight"), dto.PrintHeight);//元素文本dto.PrintText=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintText"), dto.PrintText);//绑定属性dto.DataField=Helper.ValidParam(JRTContext.GetRequest(Request, "DataField"), dto.DataField);//特殊标志dto.PrintFlag=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintFlag"), dto.PrintFlag);//停靠方向dto.PrintAlignment=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintAlignment"), dto.PrintAlignment);//布局方式dto.LayOut=Helper.ValidParam(JRTContext.GetRequest(Request, "LayOut"), dto.LayOut);//旋转角度dto.Angle=Helper.ValidParam(JRTContext.GetRequest(Request, "Angle"), dto.Angle);//是否垂直显示dto.IsVShow=Helper.ValidParam(JRTContext.GetRequest(Request, "IsVShow"), dto.IsVShow);//颜色dto.Color=Helper.ValidParam(JRTContext.GetRequest(Request, "Color"), dto.Color);//固定元素dto.FixedReport=Helper.ValidParam(JRTContext.GetRequest(Request, "FixedReport"), dto.FixedReport);OutParam out=new OutParam();int ret=0;//更新if(dto.RowID>0){ret=EntityManager().Update(dto,null, out, null, null, null);}//插入数据else{ret=EntityManager().Save(dto,out);}if(ret==1){return Helper.Success();}else{return Helper.Error(out);}}/*** 删除数据,多个RowID以上尖号分割* @return 字符串*/public String DeleteJRTPrintTemplateEle() throws Exception{String RowIDS=Helper.ValidParam(JRTContext.GetRequest(Request, "RowIDS"), "");if(RowIDS.isEmpty()){return Helper.Error("请传入要删除数据的RowID,多个以^分割!");}//分割主键String [] arr=RowIDS.split("^");//out参数OutParam out=new OutParam();//循环删除数据for(int i=0;i<arr.length;i++){int ret=EntityManager().RemoveById(JRTPrintTemplateEle.class,Convert.ToInt32(arr[i]),out);if(ret!=1){return Helper.Error(out);}}return Helper.Success();}/*** 查询数据,前台按表的属性名提交* @return 字符串*/public String QryJRTPrintTemplateEle() throws Exception{//模糊查询String Filter=Helper.ValidParam(JRTContext.GetRequest(Request, "Filter"), "");Parameters para=new Parameters();para.P0=Filter;para.P1="1";//调虚拟M查询数据,和导出共用逻辑return QryPrintEle(para,null,null);}/*** 上传文件到文件服务* @return*/public String UpImageFile() throws Exception{//得到文件List<FileCollection> fileList=JRT.Core.MultiPlatform.JRTWebFile.GetFiles(Request);if(fileList!=null&&fileList.size()>0){JRT.Core.MultiPlatform.FileService fileService=new JRT.Core.MultiPlatform.FileService();fileService.Upload("http://localhost:8080/JRTWeb/FileService/",fileList.get(0).GetInputStream(),fileList.get(0).GetFileName(),"/zlz");}return Helper.Success();}/*** 改名文件* @return*/public String ReNameImageFile() throws Exception{JRT.Core.MultiPlatform.FileService fileService=new JRT.Core.MultiPlatform.FileService();fileService.ReName("http://localhost:8080/JRTWeb/FileService/","logo.png","logo1.png","zlz/");return Helper.Success();}/*** 删除文件* @return*/public String DeleteImageFile() throws Exception{JRT.Core.MultiPlatform.FileService fileService=new JRT.Core.MultiPlatform.FileService();fileService.Delete("http://localhost:8080/JRTWeb/FileService/zlz/logo.png");fileService.Delete("http://localhost:8080/JRTWeb/FileService/zlz/logo1.png");return Helper.Success();}/*** 测试日期时间转JSON* @return* @throws Exception*/public String JsonTest() throws Exception{List<JRTPrintTemplate> list=EntityManager().FindAllSimple(JRTPrintTemplate.class,null);return Helper.Object2Json(list);}/*** 查询所有打印元素数据导出到Excel** @param Param       参数* @param Session* @param Output* @return*/public String QryPrintEle(Parameters Param, OutValue Session, OutValue Output) throws Exception {if (Session != null) {//返回的参数,供Excel模板使用Session.Value = "元素数据导出^" + JRT.Core.Util.TimeParser.GetNowDate() + "^张联珠";}String Filter=Param.P0;String DisplayCount=Param.P1;//参数List<ParamDto> para = new ArrayList<>();//sql连接符号List<String> joiner = new ArrayList<>();//sql比较符号List<String> operators = new ArrayList<>();boolean displayCount = false;if (DisplayCount.equals("1")) {displayCount = true;}//模糊查询if (!Filter.isEmpty()) {ParamDto p = null;//元素类型p = new ParamDto();p.Key = "PrintType";p.Value = "%" + Filter + "%";para.add(p);joiner.add("or");operators.add("like");//打印字体p = new ParamDto();p.Key = "PrintFont";p.Value = "%" + Filter + "%";para.add(p);joiner.add("or");operators.add("like");//打印字体大小p = new ParamDto();p.Key = "PrintFontSize";p.Value = "%" + Filter + "%";para.add(p);joiner.add("or");operators.add("like");//打印字体样式p = new ParamDto();p.Key = "PrintFontStyle";p.Value = "%" + Filter + "%";para.add(p);joiner.add("or");operators.add("like");//元素文本p = new ParamDto();p.Key = "PrintText";p.Value = "%" + Filter + "%";para.add(p);joiner.add("or");operators.add("like");//绑定属性p = new ParamDto();p.Key = "DataField";p.Value = "%" + Filter + "%";para.add(p);joiner.add("or");operators.add("like");//特殊标志p = new ParamDto();p.Key = "PrintFlag";p.Value = "%" + Filter + "%";para.add(p);joiner.add("or");operators.add("like");//停靠方向p = new ParamDto();p.Key = "PrintAlignment";p.Value = "%" + Filter + "%";para.add(p);joiner.add("or");operators.add("like");//布局方式p = new ParamDto();p.Key = "LayOut";p.Value = "%" + Filter + "%";para.add(p);joiner.add("or");operators.add("like");//旋转角度p = new ParamDto();p.Key = "Angle";p.Value = "%" + Filter + "%";para.add(p);joiner.add("or");operators.add("like");//是否垂直显示p = new ParamDto();p.Key = "IsVShow";p.Value = "%" + Filter + "%";para.add(p);joiner.add("or");operators.add("like");//颜色p = new ParamDto();p.Key = "Color";p.Value = "%" + Filter + "%";para.add(p);joiner.add("or");operators.add("like");//固定元素p = new ParamDto();p.Key = "FixedReport";p.Value = "%" + Filter + "%";para.add(p);joiner.add("or");operators.add("like");}//调用查询String json = EntityManager().QueryAllWithFK(JRTPrintTemplateEle.class, para, "", displayCount, -1, -1, "", joiner, operators);return json;}}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/599565.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Transformer 模型及其典型应用研究

摘要&#xff1a; Transformer 模型是一种基于自注意力机制的深度学习架构&#xff0c;在自然语言处理等领域取得了巨大成功。本文介绍了 Transformer 模型的原理和结构&#xff0c;并探讨了其在语言翻译、文本生成、对话系统、语言模型、图像处理和推荐系统等典型应用领域的研…

一起学习python——基础篇(7)

今天讲一下python的函数。 函数是什么&#xff1f;函数是一段独立的代码块&#xff0c;这块代码是为了实现一些功能&#xff0c;而这个代码块只有在被调用时才能运行。 在 Python 中&#xff0c;使用 def 关键字定义函数&#xff1a; 函数的固定结构就是 def(关键字)函数名字…

vue33

创建 挂载 更新 销毁 动态控制类名 sum累加器 等于上一次返回的结果 item当前正在处理的元素 和data中的数据双向绑定 重新渲染 封装 、 局部注册和全局注册 全局注册&#xff08;适用于通用的&#xff09; 组件通信 保证每个组件实例 都能维护自己的数据 组件通信 父子通信…

公钥私钥详细讲解(小白都能看懂),SSH密钥远程连接服务器,代码,命令详解

公钥及私钥 公钥和私钥是非对称加密技术中的两个关键组成部分&#xff0c;它们是一对配对的密钥&#xff0c;用于加密和解密信息&#xff0c;确保信息传输的安全性。下面我将详细解释公钥和私钥的概念、用法和使用流程&#xff0c;并用现实生活中的例子来帮助理解。 公钥和私…

Linux设备全览:从字符到块,揭秘每种设备的秘密

在Linux的世界里&#xff0c;设备是构成系统的基础&#xff0c;它们使得计算机能够与外界互动。Linux设备可以大致分为几种类型&#xff0c;每种类型都有其独特的特性和用途。&#x1f30c;让我们一起探索这些设备类型及其特性。 1. 字符设备&#xff08;Character Devices&am…

JavaWeb后端——Mybatis

概述 Mybatis&#xff1a;Java程序来对数据库进行操作&#xff0c;一款优秀的持久层框架&#xff0c;用于简化JDBC的开发 SSM&#xff1a;SpringMVC、Spring、Mybatis 快速入门 步骤2&#xff1a;注意数据库连接的四要素 application.properties&#xff1a;springboot 的默…

NzN的数据结构--二叉树part1

你叉叉&#xff0c;让你学数据结构你不学&#xff1b;你叉叉&#xff0c;让你看二叉树你不看。 今天我们来一起学习二叉树部分&#xff0c;先赞后看是好习惯。 一、树的概念及结构 1. 树的概念 树是一种非线性的数据结构&#xff0c;它是由n&#xff08;n>0&#xff09;个有…

第十二届蓝桥杯大赛软件赛省赛C/C++大学B组

第十二届蓝桥杯大赛软件赛省赛C/C 大学 B 组 文章目录 第十二届蓝桥杯大赛软件赛省赛C/C 大学 B 组1、空间2、卡片3、直线4、货物摆放5、路径6、时间显示7、砝码称重8、杨辉三角形9、双向排序10、括号序列 1、空间 1MB 1024KB 1KB 1024byte 1byte8bit // cout<<"2…

在python爬虫中如何处理cookie和session

使用python开发爬虫的过程中&#xff0c;遇到需要登录鉴权的一些页面&#xff0c;必不可少的会接触到cookie和session的使用。本文结合自己最近一次爬虫爬坑的经历&#xff0c;介绍在python爬虫中如何使用Cookie和Session Cookie和Session的介绍 Cookie Cookie 是一种用于跟…

腾讯云流量怎么计算的?轻量服务器流量价格表

腾讯云轻量应用服务器套餐带流量包&#xff0c;就是有月流量限制的意思&#xff0c;超出轻量套餐的流量需要另外支付流量费&#xff0c;轻量服务器地域不同超额流量费用也不同&#xff0c;北京上海广州等中国内地地域流量价格是0.8元每GB&#xff0c;中国香港地域流量价格是1元…

【功能更新】强化知识库管理与AI问答机器人性能

三月HelpLook带来了3大类功能焕新&#xff0c;主要聚焦于&#xff1a;知识库的管理功能升级和AI问答机器人的优化&#xff0c;让我们看看更新了哪些新功能&#xff01; 那么&#xff0c;接下来就让我们来详细了解一下本次升级都带来了哪些新功能吧&#xff01; 知识库使用与管理…

Stm32 HAL库 访问内部flash空间

Stm32 HAL库 访问内部flash空间 代码的部分串口配置申明文件main函数 在一些时候&#xff0c;需要存储一些数据&#xff0c;但是又不想接外部的flash&#xff0c;那我们可以知道&#xff0c;其实还有内部的flash可以使用&#xff0c; 需要注意的是内部flash&#xff0c;读写次数…