Index: ssts-web/src/main/webapp/disinfectsystem/labelTemplateDesign/printCustomDesign.js
===================================================================
diff -u -r15022 -r15030
--- ssts-web/src/main/webapp/disinfectsystem/labelTemplateDesign/printCustomDesign.js (.../printCustomDesign.js) (revision 15022)
+++ ssts-web/src/main/webapp/disinfectsystem/labelTemplateDesign/printCustomDesign.js (.../printCustomDesign.js) (revision 15030)
@@ -1,105 +1,189 @@
-var currentConfig = null;
-var LODOP; //声明为全局变量
- var obj = {};
- obj.name = '缝合包';
- obj.operator = '张三';
- obj.reviewer = '李四';
- obj.sterilizationDate = '2016-09-10';
- obj.validDate = '2016-09-17';
- obj.sterilizer = '1号灭菌炉';
- obj.frequency = 3;
- obj.hospitalName = '广东省人民医院';
- obj.patient = '张三';
- obj.toolAmount = 50;
- obj.implantAmount = 10;
+var currentConfig = null;
+var LODOP; // 声明为全局变量
+var templateObj = {
+ name: '包名',
+ operator: '配包人',
+ reviewer: '审核人',
+ sterilizationDate: '灭菌日期',
+ validDate: '失效日期',
+ sterilizer: '炉号',
+ frequency: '炉次',
+ hospitalName: '医院名称',
+ patient: '病人',
+ toolAmount: '工具件数',
+ implantAmount: '植入物件数'
+};
+var previewObj = {
+ name: '缝合包',
+ operator: '张三',
+ reviewer: '李四',
+ sterilizationDate: '2016-09-10',
+ validDate: '2016-09-17',
+ sterilizer: '1号灭菌炉',
+ frequency: '炉次',
+ hospitalName: '广东省人民医院',
+ patient: '张三',
+ toolAmount: '50',
+ implantAmount: '10'
+ };
+var obj = templateObj;
- function Moditify(item){
- LODOP=getLodop(document.getElementById('LODOP2'),document.getElementById('LODOP_EM2'));
- if ((!LODOP.GET_VALUE("ItemIsAdded",item.name))&&(item.checked)){
- LODOP.ADD_PRINT_TEXTA(item.name,56,32,65,30,item.value);
- LODOP.SET_PRINT_STYLEA(0,"ContentVName",item.name);//设置内容参数的变量名
- } else {
- LODOP.SET_PRINT_STYLEA(item.name,'Deleted',!item.checked);
+function getLODOP2(){
+ LODOP = getLodop(document.getElementById('LODOP2'), document
+ .getElementById('LODOP_EM2'));
+}
+function Moditify(item) {
+ getLODOP2();
+ if ((!LODOP.GET_VALUE("ItemIsAdded", item.name)) && (item.checked)) {
+ LODOP.ADD_PRINT_TEXTA(item.name, 56, 32, 65, 30, item.value);
+ LODOP.SET_PRINT_STYLEA(0, "ContentVName", item.name);// 设置内容参数的变量名
+ } else {
+ LODOP.SET_PRINT_STYLEA(item.name, 'Deleted', !item.checked);
+ }
+}
+function addOrRemove(add,vName,value) {
+ getLODOP2();
+ if(add){
+ if(LODOP.GET_VALUE("ItemIsAdded", vName)){
+ LODOP.SET_PRINT_STYLEA(vName, 'Deleted', 0);// 恢复删除的项
+ }else{
+ LODOP.ADD_PRINT_TEXTA(vName, 56, 32, 65, 30, value);
+ LODOP.SET_PRINT_STYLEA(0, "ContentVName", vName);// 设置内容参数的变量名
}
- }
- function CreatePage(){
- LODOP=getLodop(document.getElementById('LODOP2'),document.getElementById('LODOP_EM2'));
- LODOP.PRINT_INITA(0,0,currentConfig.width,currentConfig.height,"小标签");
- LODOP.SET_PRINT_MODE("PROGRAM_CONTENT_BYVAR",true);//生成程序时,内容参数有变量用变量,无变量用具体值
- LODOP.ADD_PRINT_TEXT(10,50,175,30,"先加的内容");
- };
- function DisplayDesign() {
- CreatePage();
- LODOP.SET_SHOW_MODE("DESIGN_IN_BROWSE",1);
- LODOP.SET_SHOW_MODE("SETUP_ENABLESS","11111111000000");//隐藏关闭(叉)按钮
- LODOP.SET_SHOW_MODE("HIDE_GROUND_LOCK",true);//隐藏纸钉按钮
- LODOP.PRINT_DESIGN();
- };
- function DisplaySetup() {
- CreatePage();
- LODOP.SET_SHOW_MODE("SETUP_IN_BROWSE",1);
- LODOP.SET_SHOW_MODE("MESSAGE_NOSET_PROPERTY",'不能设置属性,请用打印设计(本提示可修改)!');
- LODOP.PRINT_SETUP();
- };
- // 删除所选项
- function deleteSelectedItems(){
- LODOP.SET_PRINT_STYLEA('Selected','Deleted',true);
+ }else{
+ LODOP.SET_PRINT_STYLEA(vName, 'Deleted', 1);// 删除对应的项
}
- // 插入文本项
- function insertTextItem(){
- LODOP.ADD_PRINT_TEXTA('a',0,0,75,30,'文本');
+}
+function CreatePage() {
+ getLODOP2();
+ LODOP.PRINT_INITA(0, 0, currentConfig.width, currentConfig.height, "小标签");
+ LODOP.SET_PRINT_MODE("PROGRAM_CONTENT_BYVAR", true);// 生成程序时,内容参数有变量用变量,无变量用具体值
+};
+function DisplayDesign() {
+ obj = templateObj;
+ CreatePage();
+ if(!isUndefinedOrNullOrEmpty(currentConfig.programCodes)){
+// alert(currentConfig.programCodes)
+ eval(currentConfig.programCodes);// 执行eval方法,装载模板
}
- function Addhtm() {
- LODOP.ADD_PRINT_HTM(45,494,288,88,"
\n\n表格11 | \n表格12 | \n表格13 | \n
\n\n表格21 | \n表格22 | \n表格23 | \n
\n
");
- };
- function SetBKIMG() {
- LODOP=getLodop(document.getElementById('LODOP2'),document.getElementById('LODOP_EM2'));
- LODOP.ADD_PRINT_SETUP_BKIMG("
");
+
+ LODOP.SET_SHOW_MODE("DESIGN_IN_BROWSE", 1);
+ LODOP.SET_SHOW_MODE("SETUP_ENABLESS", "11111111000000");// 隐藏关闭(叉)按钮
+ LODOP.SET_SHOW_MODE("HIDE_GROUND_LOCK", true);// 隐藏纸钉按钮
+ LODOP.PRINT_DESIGN();
+};
+function DisplaySetup() {
+ CreatePage();
+ LODOP.SET_SHOW_MODE("SETUP_IN_BROWSE", 1);
+ LODOP.SET_SHOW_MODE("MESSAGE_NOSET_PROPERTY", '不能设置属性,请用打印设计(本提示可修改)!');
+ LODOP.PRINT_SETUP();
+};
+// 删除所选项
+function deleteSelectedItems() {
+ LODOP.SET_PRINT_STYLEA('Selected', 'Deleted', true);
+}
+// 插入文本项
+function insertTextItem() {
+ LODOP.ADD_PRINT_TEXTA('a', 0, 0, 75, 30, '文本');
+}
+function Addhtm() {
+ LODOP
+ .ADD_PRINT_HTM(
+ 45,
+ 494,
+ 288,
+ 88,
+ "\n\n表格11 | \n表格12 | \n表格13 | \n
\n\n表格21 | \n表格22 | \n表格23 | \n
\n
");
+};
+function SetBKIMG() {
+ getLODOP2();
+ LODOP
+ .ADD_PRINT_SETUP_BKIMG("
");
- };
- function getProgram() {
- LODOP=getLodop(document.getElementById('LODOP2'),document.getElementById('LODOP_EM2'));
- document.getElementById('S1').value=LODOP.GET_VALUE("ProgramCodes",0);
- document.getElementById('button01').style.display="";
- };
- function createTemplate() {
- LODOP=getLodop(document.getElementById('LODOP2'),document.getElementById('LODOP_EM2'));
- document.getElementById('S1').value=LODOP.GET_VALUE("ProgramData",0);
- };
- function loadTemplate() {
-// LODOP=getLodop(document.getElementById('LODOP2'),document.getElementById('LODOP_EM2'));
-// var code = document.getElementById('S1').value;
-// LODOP.ADD_PRINT_DATA('ProgramData', code);
-
-
- LODOP=getLodop(document.getElementById('LODOP2'),document.getElementById('LODOP_EM2'));
- eval(document.getElementById('S1').value);
- if (LODOP.CVERSION) LODOP.On_Return=function(TaskID,Value){document.getElementById('S1').value=Value;};
- document.getElementById('S1').value=LODOP.PRINT_DESIGN();
-
- };
- function restoreDesign() {
-
- LODOP=getLodop(document.getElementById('LODOP2'),document.getElementById('LODOP_EM2'));
- eval(document.getElementById('S1').value);// 执行eval方法,装载模板
- if (LODOP.CVERSION) LODOP.On_Return=function(TaskID,Value){document.getElementById('S1').value=Value;};
- LODOP.SET_SHOW_MODE("DESIGN_IN_BROWSE",1);
- LODOP.SET_SHOW_MODE("SETUP_ENABLESS","11111111000000");//隐藏关闭(叉)按钮
- LODOP.SET_SHOW_MODE("HIDE_GROUND_LOCK",true);//隐藏纸钉按钮
- document.getElementById('S1').value=LODOP.PRINT_DESIGN();
-
- };
- function prn_Preview() {
- LODOP=getLodop(document.getElementById('LODOP1'),document.getElementById('LODOP_EM1'));
- LODOP.SET_PRINT_MODE("PROGRAM_CONTENT_BYVAR",true);//生成程序时,内容参数有变量用变量,无变量用具体值
- eval(document.getElementById('S1').value);
- LODOP.PREVIEW();
- LODOP=getLodop(document.getElementById('LODOP2'),document.getElementById('LODOP_EM2'));
- };
+};
+function getProgram() {
+ getLODOP2();
+ currentConfig.programCodes = LODOP.GET_VALUE("ProgramCodes", 0);
+ document.getElementById('S1').value = LODOP.GET_VALUE("ProgramCodes", 0);
+ document.getElementById('button01').style.display = "";
+};
+function createTemplate() {
+ getLODOP2();
+ document.getElementById('S1').value = LODOP.GET_VALUE("ProgramData", 0);
+};
+function loadTemplate() {
+
+ getLODOP2();
+ eval(document.getElementById('S1').value);
+ if (LODOP.CVERSION)
+ LODOP.On_Return = function(TaskID, Value) {
+ document.getElementById('S1').value = Value;
+ };
+ document.getElementById('S1').value = LODOP.PRINT_DESIGN();
+
+};
+function restoreDesign() {
+
+ getLODOP2();
+ if(isUndefinedOrNullOrEmpty(currentConfig.programCodes)){
+ showResult('保存成功');
+ return ;
+ }
+ eval(document.getElementById('S1').value);// 执行eval方法,装载模板
+ if (LODOP.CVERSION)
+ LODOP.On_Return = function(TaskID, Value) {
+ document.getElementById('S1').value = Value;
+ };
+ LODOP.SET_SHOW_MODE("DESIGN_IN_BROWSE", 1);
+ LODOP.SET_SHOW_MODE("SETUP_ENABLESS", "11111111000000");// 隐藏关闭(叉)按钮
+ LODOP.SET_SHOW_MODE("HIDE_GROUND_LOCK", true);// 隐藏纸钉按钮
+
+};
+function prn_Preview() {
+ getLODOP2();
+ getProgram();
+ obj = previewObj;
+ if(!isUndefinedOrNullOrEmpty(currentConfig.programCodes)){
+ eval(currentConfig.programCodes);// 执行eval方法,装载模板
+ }
+ LODOP.PREVIEW();
- function cancel() {
+ DisplayDesign();
+};
+
+function cancel() {
+ var href = WWWROOT
+ + '/disinfectsystem/labelTemplateDesign/labelTemplateView.jsp?id='
+ + id;
+ location.href = href;
+}
+function saveConfig() {
+ getProgram();
+ if(isUndefinedOrNullOrEmpty(currentConfig.programCodes)){
+ showResult('保存成功');
+ return ;
}
- function showWindow(id) {
+ top.Ext.MessageBox.wait('正在保存……', '请稍候');
+
+ Ext4.Ajax.request({
+ url : WWWROOT + '/disinfectSystem/labelTemplateAction!saveOrUpdateProgramCodes.do',
+ params : {
+ id : id,
+ programCodes: currentConfig.programCodes
+ },
+ success : function(response, options) {
+ hideMessageBox(true);
+ showResult('保存成功');
+ cancel();
+ },
+ failure : function(response, options) {
+ hideMessageBox(true);
+ showResult('保存失败');
+ }
+ });
+}
+function showWindow(id) {
+
formPanel = new Ext4.form.Panel({
id : 'configForm',
frame : true,
@@ -129,18 +213,27 @@
handler : function() {
insertTextItem();
}
+ }, {
+ xtype : 'checkboxfield',
+ id: 'checkbox_operator',
+ boxLabel : '配包人',
+ handler : function(checkbox,checked) {
+ addOrRemove(checked,'obj.operator',obj.operator);
+ }
} ],
buttons : [ {
+ id : 'pre',
+ text : '预览',
+ hidden : false,
+ handler : function() {
+ prn_Preview();
+ }
+ },{
id : 'saveBtn',
text : '保存',
hidden : false,
handler : function() {
- if (formPanel.getForm().isValid()) {
-
- } else {
- showResult('请填写表单!');
- return false;
- }
+ saveConfig();
}
}, {
text : '取消',
@@ -149,40 +242,50 @@
} ]
});
}
+
+function loadConfigAndInitDesign() {
- function loadConfigAndInitDesign(){
-
- if(!Ext4.isEmpty(id)){
- top.Ext.MessageBox.wait('正在加载……', '请等待');
-
- Ext4.Ajax.request({
- url : WWWROOT + '/disinfectSystem/labelTemplateAction!loadData.do',
- params : {id : id},
- success : function(response,options){
- hideMessageBox(true);
- var result = Ext4.JSON.decode(response.responseText);
- if(result.success && result.data){
-// top.Ext4.ComponentQuery.query("#configForm #id")[0].setValue(result.data.id);
-// top.Ext4.ComponentQuery.query("#configForm #name")[0].setValue(result.data.name);
- currentConfig = result.data;
-// top.Ext4.ComponentQuery.query("#configForm #width")[0].setValue(result.data.width);
-// top.Ext4.ComponentQuery.query("#configForm #height")[0].setValue(result.data.height);
-// top.Ext4.ComponentQuery.query("#configForm #description")[0].setValue(result.data.description);
-// top.Ext4.ComponentQuery.query("#configForm #programCodes")[0].setValue(result.data.programCodes);
- DisplayDesign();
- }else{
- showResult('系统加载出错,请稍候再试');
- }
- },
- failure : function(response, options) {
- hideMessageBox(true);
+ if (!Ext4.isEmpty(id)) {
+ top.Ext.MessageBox.wait('正在加载……', '请等待');
+
+ Ext4.Ajax.request({
+ url : WWWROOT + '/disinfectSystem/labelTemplateAction!loadData.do',
+ params : {
+ id : id
+ },
+ success : function(response, options) {
+ hideMessageBox(true);
+ var result = Ext4.JSON.decode(response.responseText);
+ if (result.success && result.data) {
+ // top.Ext4.ComponentQuery.query("#configForm
+ // #id")[0].setValue(result.data.id);
+ // top.Ext4.ComponentQuery.query("#configForm
+ // #name")[0].setValue(result.data.name);
+ currentConfig = result.data;
+ // top.Ext4.ComponentQuery.query("#configForm
+ // #width")[0].setValue(result.data.width);
+ // top.Ext4.ComponentQuery.query("#configForm
+ // #height")[0].setValue(result.data.height);
+ // top.Ext4.ComponentQuery.query("#configForm
+ // #description")[0].setValue(result.data.description);
+ // top.Ext4.ComponentQuery.query("#configForm
+ // #programCodes")[0].setValue(result.data.programCodes);
+ DisplayDesign();
+// restoreDesign();
+ } else {
showResult('系统加载出错,请稍候再试');
}
- });
- }
+ },
+ failure : function(response, options) {
+ hideMessageBox(true);
+ showResult('系统加载出错,请稍候再试');
+ }
+ });
}
- Ext4.onReady(function() {
- Ext4.QuickTips.init();
- showWindow('');
- loadConfigAndInitDesign();
- });
+}
+Ext4.onReady(function() {
+ Ext4.QuickTips.init();
+
+ showWindow('');
+ loadConfigAndInitDesign();
+});