Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/materialDefinition/materialDefinitionForm.js =================================================================== diff -u -r35744 -r36655 --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/materialDefinition/materialDefinitionForm.js (.../materialDefinitionForm.js) (revision 35744) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/materialDefinition/materialDefinitionForm.js (.../materialDefinitionForm.js) (revision 36655) @@ -418,6 +418,7 @@ store : goodsTypeStore, allowBlank: false, editable:false, + value:'普通物品', mode : 'local', forceSelection : true, triggerAction : 'all', @@ -440,6 +441,7 @@ }), allowBlank: false, editable:false, + value:'否', mode : 'local', forceSelection : true, triggerAction : 'all', @@ -462,6 +464,7 @@ }), allowBlank: true, editable:false, + value:'否', mode : 'local', forceSelection : true, triggerAction : 'all', @@ -485,6 +488,7 @@ editable:false, forceSelection : true, allowBlank: false, + value:'否', mode : 'local', triggerAction : 'all', anchor : '100%' @@ -750,8 +754,30 @@ buttons : [{ id : 'saveBtn', text : '保存', - handler : validateAndSubmit + handler : function(){ + top.Ext.MessageBox.confirm("请确认","是否确定要保存材料定义?",function(button, text) { + if ("yes" == button){ + validateAndSubmit(false); + } + }); + } }, { + id : 'saveBtnAndClose', + text : '保存并关闭', + handler : function(){ + top.Ext.MessageBox.confirm("请确认","是否确定要保存材料定义?",function(button, text) { + if ("yes" == button){ + validateAndSubmit(true); + } + }); + } + }, { + id : 'saveBtnAndNew', + text : '另存为', + handler : function(){ + newSave(); + } + }, { text : '取消', id : 'saveAndNewBtn', handler : cancel @@ -782,6 +808,7 @@ imageIds = null; top.Ext.getCmp('imageIds').setValue(""); }); + top.Ext.getCmp('name').focus('', 10); //load的代码位置已调整至所在父容器materialDefinitionWin之后,因为如果写在父容器show()之前的话,会导致formObj面板在没有渲染至dom节点前就load, //mask加载信息遮罩层默认仅覆盖显示在列表组件上,而后又被弹出的materialDefinitionWin这个window覆盖,同时如果在load方法结束前就关闭此window时会引发js错误 @@ -982,26 +1009,42 @@ var re = /^[0-9]*[1-9][0-9]*$/ ; return re.test(s) } -function validateAndSubmit(){ - this.disable(); +function validateAndSubmit(isClose,saveAs){ + if(!saveAs){ + this.disable(); + } if (!formObj.form.isValid()) { showResult('请正确填写表单各值'); - this.enable(); + if(!saveAs){ + this.enable(); + } return false; } var materialName = top.Ext.getCmp("name").getValue(); var specification = top.Ext.getCmp("specification").getValue(); if(includeSpecialCharacter(materialName) || includeSpecialCharacter(specification)){ showResult("物品名称和规格都不能包含特殊字符!"); - this.enable(); + if(!saveAs){ + this.enable(); + } return false; } + if(saveAs){ + var newName = top.Ext.getCmp('newName').getValue(); + top.Ext.getCmp("name").setValue(newName); + top.Ext.getCmp("id").setValue(''); + top.Ext.getCmp("wbCode").setValue(''); + top.Ext.getCmp("spelling").setValue(''); + newSaveMsgWin.close(); + } var intoBasketMaxAmount = top.Ext.getCmp('intoBasketMaxAmount').getValue(); if(intoBasketMaxAmount != ""){ if(!isPositiveNum(intoBasketMaxAmount)){ showResult("清洗筐装载数量上限必须是正整数!"); - this.enable(); + if(!saveAs){ + this.enable(); + } return; } } @@ -1014,8 +1057,28 @@ success : function(form, action) { showResult(action.result.msg); if(action.result.success){ - materialDefinitionWin.close(); grid.dwrReload(); + if(isClose){ + materialDefinitionWin.close(); + } + if(saveAs && action.result.id){ + formObj.form.load( { + url : WWWROOT + '/disinfectSystem/baseData/materialDefinitionAction!loadMaterialDefinition.do', + method : 'GET', + waitMsg : '正在加载数据,请稍候!', + params : { + id : action.result.id + }, + success : function(form, action) { + top.Ext.getCmp('storage').setValue(action.result.storage); + //加载时根据是否可拆显示:可拆图片管理 + if(top.Ext.getCmp('detachable').getValue() == '是'){ + top.Ext.getCmp('detachableImagPanel').show(); + top.Ext.getCmp('splitAmountPanel').show(); + } + } + }); + } } }, failure : function(form, action) { @@ -1028,7 +1091,68 @@ } }); } +var newSaveMsgWin; +function newSave() { + newSaveMsgWin = new top.Ext.Window({ + id: 'newSaveMsgWin', + layout: 'fit', + title: '请确认另存为信息', + width: 400, + border: false, + modal: true, + height: 130, + plain: true, + items: [ + new top.Ext.FormPanel({ + id: 'newSaveMsgForm', + frame: true, + labelSeparator: ':', + labelAlign: 'right', + fileUpload: true, + bodyStyle: 'padding:5px 5px 0px 5px;', + width: 400, + columnWidth: 1, + labelWidth: 130, + autoScroll: true, + height: 130, + items: [{ + columnWidth: 1, + layout: 'form', + labelAlign: "right", + items: [{ + xtype: 'textfield', + fieldLabel: "请输入新的材料名称", + allowBlank: false, + blankText: '请输入新的材料名称!', + name: "newName", + id: "newName", + anchor: '100%' + }] + }], + buttons: [{ + id: 'newSaveBtn', + text: '保存', + handler: function () { + newSaveBtn(); + } + }, { + id: 'newCancelBtn', + text: '取消', + handler: function () { + newSaveMsgWin.close(); + } + }] + }) + ] + }); + newSaveMsgWin.show(); + top.Ext.getCmp('newName').focus(false, 100); +} +function newSaveBtn(){ + validateAndSubmit(false,true); +} + /** * 判断s是否包含特殊字符(这里说的特殊字符只针对[和'两种) * @param s