Index: ssts-web/src/main/webapp/disinfectsystem/labelTemplateDesign/labelTemplateForm.js =================================================================== diff -u -r30113 -r30158 --- ssts-web/src/main/webapp/disinfectsystem/labelTemplateDesign/labelTemplateForm.js (.../labelTemplateForm.js) (revision 30113) +++ ssts-web/src/main/webapp/disinfectsystem/labelTemplateDesign/labelTemplateForm.js (.../labelTemplateForm.js) (revision 30158) @@ -6,23 +6,23 @@ configWin.close(); } -function editConfig(id){ +function editConfig(id) { checkLabelTemplateIsUsed(id); showWindow(id); - if(!Ext4.isEmpty(id)){ + if (!Ext4.isEmpty(id)) { var mask = new Ext4.LoadMask({ - msg : '正在加载,请稍候...', - target : formPanel + msg: '正在加载,请稍候...', + target: formPanel }); mask.show(); - + Ext4.Ajax.request({ - url : WWWROOT + '/disinfectSystem/labelTemplateAction!loadData.do', - params : {id : id}, - success : function(response,options){ + url: WWWROOT + '/disinfectSystem/labelTemplateAction!loadData.do', + params: { id: id }, + success: function (response, options) { mask.hide(); var result = Ext4.JSON.decode(response.responseText); - if(result.success && result.data){ + 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); top.Ext4.ComponentQuery.query("#configForm #styleName")[0].setValue(result.data.styleName); @@ -31,295 +31,280 @@ top.Ext4.ComponentQuery.query("#configForm #dataSourceName")[0].setValue(result.data.dataSourceName); top.Ext4.ComponentQuery.query("#configForm #description")[0].setValue(result.data.description); top.Ext4.ComponentQuery.query("#configForm #programCodes")[0].setValue(result.data.programCodes); - - }else{ + + } else { showResult('系统加载出错,请稍候再试'); } }, - failure : function(response, options) { + failure: function (response, options) { mask.hide(); showResult('系统加载出错,请稍候再试'); } }); } } -function deleteConfig(grid){ +function deleteConfig(grid) { var selectedRecords = grid.getSelectionModel().getSelections(); var selectedCount = grid.getSelectionModel().getCount(); var ids = ""; - if(selectedCount < 1){ + if (selectedCount < 1) { showResult("请选择要删除的行"); - }else{ - for ( var i = 0, len = selectedRecords.length; i < len; i++) { + } else { + for (var i = 0, len = selectedRecords.length; i < len; i++) { if (ids == "") { ids = selectedRecords[i].data['id']; } else { ids = ids + ';' + selectedRecords[i].data['id']; } } - Ext4.MessageBox.confirm("请确认","确定要删除选中的信息吗?", - function(button, text) { - if ("yes" == button){ - Ext4.Ajax.request({ - url : WWWROOT + '/disinfectSystem/labelTemplateAction!delete.do', - params : {ids : ids}, - success : function(response, options) { - var result = Ext4.JSON.decode(response.responseText); - var success = result.success; - if (true != success) { - showResult(result.message); - return; - } else { - showResult('删除成功!'); - grid.dwrReload(); - } - }, - failure : function(response, options) { - showResult("删除失败"); - } - }); + Ext4.MessageBox.confirm("请确认", "确定要删除选中的信息吗?", function (button, text) { + if ("yes" == button) { + Ext4.Ajax.request({ + url: WWWROOT + '/disinfectSystem/labelTemplateAction!delete.do', + params: { ids: ids }, + success: function (response, options) { + var result = Ext4.JSON.decode(response.responseText); + var success = result.success; + if (true != success) { + showResult(result.message); + return; + } else { + showResult('删除成功!'); + grid.dwrReload(); + } + }, + failure: function (response, options) { + var result = Ext4.JSON.decode(response.responseText); + showResult(result.message); } }); + } + }); } } -function saveConfig(){ +function saveConfig() { formPanel.form.submit({ - url : WWWROOT + '/disinfectSystem/labelTemplateAction!save.do', - method : 'POST', - waitMsg : '正在保存数据,请稍候', - timeout : 600000, - waitTitle : '提交表单', - success : function(form, action) { + url: WWWROOT + '/disinfectSystem/labelTemplateAction!save.do', + method: 'POST', + waitMsg: '正在保存数据,请稍候', + timeout: 600000, + waitTitle: '提交表单', + success: function (form, action) { configWin.close(); showResult('保存成功'); grid.dwrReload(); }, - failure : function(form, action) { - showResult('failure = ' + action.failureType); + failure: function (form, action) { + showResult(action.result.message); } }); } -function showWindow(id){ - formPanel = new top.Ext4.form.Panel({ - id : 'configForm', - frame : true, - labelSeparator : ':', - bodyStyle : 'padding:5px 5px 0px 5px;', - width : 800, +function showWindow(id) { + formPanel = new top.Ext4.form.Panel({ + id: 'configForm', + frame: true, + labelSeparator: ':', + bodyStyle: 'padding:5px 5px 0px 5px;', + width: 800, fieldDefaults: { - labelAlign: 'left', - labelWidth: 200 - }, - items : [{ - xtype : 'hidden', - id:'id', - name:'id' - },{ - xtype:"fieldset", - title :'模板定义', - height:500, - items:[{ - layout : 'column', - xtype : 'container', - labelWidth : 170, - items : [{ - columnWidth : .8, - layout : 'form', - items : [{ - xtype : 'textfield', - fieldLabel : '名称', - id : 'name', - name : 'name', - allowBlank : false, - anchor : '98%' - },{ - xtype : 'textfield', - fieldLabel : '样式', - id : 'styleName', - name : 'styleName', - allowBlank : false, - anchor : '98%' - },{ - xtype : 'textfield', - fieldLabel : '宽度(毫米)', - id : 'width', - name : 'width', - allowBlank : false, - anchor : '98%' - },{ - xtype : 'textfield', - fieldLabel : '高度(毫米)', - id : 'height', - name : 'height', - allowBlank : false, - anchor : '98%' - },{ - xtype : 'combo', - fieldLabel : '数据源', - id : 'dataSourceName', - name : 'dataSourceName', - valueField : 'value', - displayField : 'value', - value: '普通器械包', - store : new Ext4.data.SimpleStore( { - fields : [ 'value'], - data : objectDataSourceManager.getDataSourceNamesForCombo() - }), - editable : false, - forceSelection : true, - mode : 'local', - allowBlank : false, - triggerAction : 'all', - width : 200 - - },{ - xtype : 'textfield', - fieldLabel : '描述', - id : 'description', - name : 'description', - anchor : '98%' - },{ - xtype : 'textarea', - fieldLabel : '程序代码', - id : 'programCodes', - name : 'programCodes', - height : 100, + labelAlign: 'left', + labelWidth: 200 + }, + items: [{ + xtype: 'hidden', + id: 'id', + name: 'id' + }, { + xtype: "fieldset", + title: '模板定义', + height: 500, + items: [{ + layout: 'column', + xtype: 'container', + labelWidth: 170, + items: [{ + columnWidth: .8, + layout: 'form', + items: [{ + xtype: 'textfield', + fieldLabel: '名称', + id: 'name', + name: 'name', + allowBlank: false, + anchor: '98%' + }, { + xtype: 'textfield', + fieldLabel: '样式', + id: 'styleName', + name: 'styleName', + allowBlank: false, + anchor: '98%' + }, { + xtype: 'textfield', + fieldLabel: '宽度(毫米)', + id: 'width', + name: 'width', + allowBlank: false, + anchor: '98%' + }, { + xtype: 'textfield', + fieldLabel: '高度(毫米)', + id: 'height', + name: 'height', + allowBlank: false, + anchor: '98%' + }, { + xtype: 'combo', + fieldLabel: '数据源', + id: 'dataSourceName', + name: 'dataSourceName', + valueField: 'value', + displayField: 'value', + value: '普通器械包', + store: new Ext4.data.SimpleStore({ + fields: ['value'], + data: objectDataSourceManager.getDataSourceNamesForCombo() + }), + editable: false, + forceSelection: true, + mode: 'local', + allowBlank: false, + triggerAction: 'all', + width: 200 + + }, { + xtype: 'textfield', + fieldLabel: '描述', + id: 'description', + name: 'description', + anchor: '98%' + }, { + xtype: 'textarea', + fieldLabel: '程序代码', + id: 'programCodes', + name: 'programCodes', + height: 100, readOnly: true, - allowBlank : true, - anchor : '98%' - } -// , -// { -// xtype : 'panel', -// fieldLabel : '设计器', -// id : 'departNames', -// name : 'departNames', -// html : '', -// height : 100, -// allowBlank : false, -// anchor : '98%' -// } - ] + allowBlank: true, + anchor: '98%' + }] }] }] - } - - ] - , - buttons : [{ - id : 'saveBtn', - text : '保存', - hidden:false, - handler : function(){ - if(formPanel.getForm().isValid()){ + }], + buttons: [{ + id: 'saveBtn', + text: '保存', + hidden: false, + handler: function () { + if (formPanel.getForm().isValid()) { var name = top.Ext4.getCmp('name').getValue(); var regex = /[\+\-\*\/]+/; - if(regex.test(name)){ + if (regex.test(name)) { showResult('名称不能包含+-*/'); - return false; + return false; } - if(!id) { + if (!id) { saveConfig(); } else { showconfirmWindow(); } - }else{ + } else { showResult('请填写表单!'); return false; } } }, { - text : '取消', - id : 'saveAndNewBtn', - handler : cancel + text: '取消', + id: 'saveAndNewBtn', + handler: cancel }] }); - configWin = new top.Ext4.window.Window({ - id : 'labelTemplateWin', - layout : 'border', - title : '标签模板设置', - width : 800, - height : 500, - border : false, - plain : true, - modal :true, - items : [{ - region:'center', - width : 400, - layout :'fit', - items:[formPanel] - }] + configWin = new top.Ext4.window.Window({ + id: 'labelTemplateWin', + layout: 'border', + title: '标签模板设置', + width: 800, + height: 500, + border: false, + plain: true, + modal: true, + items: [{ + region: 'center', + width: 400, + layout: 'fit', + items: [formPanel] + }] }); configWin.show(); } -function showconfirmWindow(){ - var formPanel1 = new top.Ext4.form.Panel({ - id : 'configForm1', - frame : true, - labelSeparator : ':', - bodyStyle : 'padding:5px 5px 0px 5px;', - width : 800, +function showconfirmWindow() { + var formPanel1 = new top.Ext4.form.Panel({ + id: 'configForm1', + frame: true, + labelSeparator: ':', + bodyStyle: 'padding:5px 5px 0px 5px;', + width: 800, fieldDefaults: { - labelAlign: 'left', - labelWidth: 200 - }, - items : [{ - xtype : 'label', - text : message + '确定要修改标签模板吗?', - anchor : '98%' + labelAlign: 'left', + labelWidth: 200 + }, + items: [{ + xtype: 'label', + text: message + '确定要修改标签模板吗?', + anchor: '98%' }], - buttons : [{ - id : 'saveBtn1', - text : '确认', - hidden:false, - handler : function(){ + buttons: [{ + id: 'saveBtn1', + text: '确认', + hidden: false, + handler: function () { saveConfig(); confirmWin.close(); } }, { - text : '取消', - id : 'saveAndNewBtn1', - handler : function () { + text: '取消', + id: 'saveAndNewBtn1', + handler: function () { confirmWin.close(); } }] }); var confirmWin = new top.Ext4.window.Window({ - id : 'labelTemplateWin1', - layout : 'border', - title : '请确认', - width : 300, - height : 105, - border : false, - plain : true, - modal :true, - items : [{ - region:'center', - width : 400, - layout :'fit', - items:[formPanel1] - }] + id: 'labelTemplateWin1', + layout: 'border', + title: '请确认', + width: 300, + height: 105, + border: false, + plain: true, + modal: true, + items: [{ + region: 'center', + width: 400, + layout: 'fit', + items: [formPanel1] + }] }); confirmWin.show(); } function checkLabelTemplateIsUsed(id) { Ext4.Ajax.request({ - url : WWWROOT + '/disinfectSystem/labelTemplateAction!checkLabelTemplateIsUsed.do', - params : {id : id}, - success : function(response, options) { + url: WWWROOT + '/disinfectSystem/labelTemplateAction!checkLabelTemplateIsUsed.do', + params: { id: id }, + success: function (response, options) { var result = Ext4.JSON.decode(response.responseText); var success = result.success; if (true != success) { - message = result.message; + message = result.message; } else { message = ''; } }, - failure : function(response, options) { + failure: function (response, options) { message = ''; } });