Index: ssts-web/src/main/webapp/disinfectsystem/labelTemplateDesign/printCustomDesign.js =================================================================== diff -u -r15071 -r15083 --- ssts-web/src/main/webapp/disinfectsystem/labelTemplateDesign/printCustomDesign.js (.../printCustomDesign.js) (revision 15071) +++ ssts-web/src/main/webapp/disinfectsystem/labelTemplateDesign/printCustomDesign.js (.../printCustomDesign.js) (revision 15083) @@ -1,4 +1,5 @@ var currentConfig = null; +var currentTableConfig = null; var LODOP; // 声明为全局变量 var templateObj = { name: '包名', @@ -149,7 +150,8 @@ tableConfig.insertRowConfig(rowConfig2); tableConfigs.push(tableConfig); - testInsertTable(tableConfig); + currentTableConfig = tableConfig; +// testInsertTable(tableConfig); } function Addhtm() { @@ -387,6 +389,96 @@ } ] }); } +// 编辑表头文字 +var editTableHeadWindow = null; +function showEditTableHeadWindow(tableConfig,rowConfig){ + if(editTableHeadWindow){ + return; + } + var editTableHeadWindow = Ext4.create('widget.window', { + header: { + titlePosition: 2, + titleAlign: 'center' + }, + closable: false, + width: 400, + minWidth: 350, + height: 300, + x:800, + layout: 'fit', + items: [{ + layout: 'column', + defaultType: 'textfield', + items: [{ + id: 'table_head_text', + value: rowConfig.getAllColumnText(), + columnWidth: 1, + allowBlank: false + }] + }], + buttons : [ { + text : '确定', + handler : function() { + var text = Ext4.getCmp('table_head_text').getValue(); + rowConfig.setAllColumnText(text); + editTableHeadWindow.close(); + editTableHeadWindow = null; + } + }, { + text : '取消', + handler : function(){ + editTableHeadWindow.close(); + editTableHeadWindow = null; + } + } ] + }); + editTableHeadWindow.show(); +} +// 编辑数据项 +var editTableDataItemWindow = null; +function showEditTableDataItemWindow(tableConfig,rowConfig){ + if(editTableDataItemWindow){ + return; + } + var editTableDataItemWindow = Ext4.create('widget.window', { + header: { + titlePosition: 2, + titleAlign: 'center' + }, + closable: false, + width: 400, + minWidth: 350, + height: 300, + x:800, + layout: 'fit', + items: [{ + layout: 'column', + defaultType: 'textfield', + items: [{ + id: 'table_dataItem_text', + value: rowConfig.getAllColumnText(), + columnWidth: 1, + allowBlank: false + }] + }], + buttons : [ { + text : '确定', + handler : function() { + var text = Ext4.getCmp('table_dataItem_text').getValue(); + rowConfig.setAllColumnText(text); + editTableDataItemWindow.close(); + editTableDataItemWindow = null; + } + }, { + text : '取消', + handler : function(){ + editTableDataItemWindow.close(); + editTableDataItemWindow = null; + } + } ] + }); + editTableDataItemWindow.show(); +} function showInsertTableWindow(){ var w = Ext4.create('widget.window', { header: { @@ -437,6 +529,12 @@ // 显示表格窗口 var tableDesignWindow = null; function showTableDesignWindow(){ + if(currentTableConfig == null){ + if(currentConfig.tableConfigs.length > 0){ + currentTableConfig = currentConfig.tableConfigs[0]; + } + } + if (!tableDesignWindow) { tableDesignWindow = Ext4.create('widget.window', { title: '表格设计器', @@ -459,7 +557,7 @@ items: [{ region: 'west', title: '表格列表', - width: 200, + width: 100, split: true, collapsible: true, floatable: false @@ -468,19 +566,37 @@ xtype: 'panel', layout: 'column', items: [{ - // LTR even when example is RTL so that the code can be read xtype: 'button', text: '插入表格', handler : function() { showInsertTableWindow(); } },{ - // LTR even when example is RTL so that the code can be read xtype: 'button', text: '删除表格', handler : function() { prn_Preview(); } + },{ + xtype: 'button', + text: '编辑表头文字', + handler : function() { + if(currentTableConfig == null){ + showResult('请先新建表格!'); + return ; + } + showEditTableHeadWindow(currentTableConfig,currentTableConfig.getFirstHeadRowConfig()); + } + },{ + xtype: 'button', + text: '编辑数据项', + handler : function() { + if(currentTableConfig == null){ + showResult('请先新建表格!'); + return ; + } + showEditTableDataItemWindow(currentTableConfig,currentTableConfig.getFirstDataItemRowConfig()); + } }] }, { region: 'center', @@ -524,40 +640,67 @@ id: 'table_height', value: '400px', allowBlank: false + },{ + xtype:'fieldset', + title: '表头字体', + defaultType: 'textfield', + items: [{ + xtype : 'combo', + fieldLabel : '字体', + id : 'table_head_font_family', + name : 'table_head_font_family', + valueField : 'value', + displayField : 'value', + value: '宋体', + store : new Ext4.data.SimpleStore( { + fields : [ 'value'], + data : [['serif'],['sans-serif'],['宋体'],['微软雅黑']] + }), + editable : false, + forceSelection : true, + mode : 'local', + allowBlank : false, + triggerAction : 'all', + width : 200 + + },{ + fieldLabel: '大小', + id: 'table_head_font_size', + value: '15px', + allowBlank: false, + width : 200 + }] + },{ + xtype:'fieldset', + title: '数据项字体', + defaultType: 'textfield', + items: [{ + xtype : 'combo', + fieldLabel : '字体', + id : 'table_dataItem_font_family', + name : 'table_dataItem_font_family', + valueField : 'value', + displayField : 'value', + value: '宋体', + store : new Ext4.data.SimpleStore( { + fields : [ 'value'], + data : [['serif'],['sans-serif'],['宋体'],['微软雅黑']] + }), + editable : false, + forceSelection : true, + mode : 'local', + allowBlank : false, + triggerAction : 'all', + width : 200 + },{ + fieldLabel: '大小', + id: 'table_dataItem_font_size', + value: '15px', + allowBlank: false, + width : 200 + }] }] }] - }, { - region: 'south', - xtype: 'tabpanel', - items: [{ - // LTR even when example is RTL so that the code can be read - rtl: false, - title: 'Bogus Tab', - html: '

Window configured with:

header: {\n    titlePosition: 2,\n    titleAlign: "center"\n},\nmaximizable: true,\ntools: [{type: "pin"}],\nclosable: true
' - }, { - title: 'Another Tab', - html: 'Hello world 2' - }, { - title: 'Closable Tab', - html: 'Hello world 3', - closable: true - }] - }, { - region: 'east', - xtype: 'tabpanel', - items: [{ - // LTR even when example is RTL so that the code can be read - rtl: false, - title: 'Bogus Tab', - html: '

Window configured with:

header: {\n    titlePosition: 2,\n    titleAlign: "center"\n},\nmaximizable: true,\ntools: [{type: "pin"}],\nclosable: true
' - }, { - title: 'Another Tab', - html: 'Hello world 2' - }, { - title: 'Closable Tab', - html: 'Hello world 3', - closable: true - }] }] }); } @@ -593,6 +736,7 @@ currentConfig.tableConfigs = Ext4.JSON.decode(currentConfig.tableConfigs); } DisplayDesign(); + showTableDesignWindow(); // restoreDesign(); } else { showResult('系统加载出错,请稍候再试'); @@ -609,7 +753,7 @@ Ext4.QuickTips.init(); showWindow(''); - showTableDesignWindow(); + loadConfigAndInitDesign(); }); @@ -699,6 +843,35 @@ }, insertColumnConfig: function(columnConfig){ this.columnConfigs.push(columnConfig); + }, + getAllColumnText: function(columnConfig){ + var text = ''; + for(var i=0;i 0){ for(var r=0;r - - - - - - +
+ + + + + + + +