Index: ssts-web/src/main/webapp/js/common.js =================================================================== diff -u -r34261 -r34298 --- ssts-web/src/main/webapp/js/common.js (.../common.js) (revision 34261) +++ ssts-web/src/main/webapp/js/common.js (.../common.js) (revision 34298) @@ -4799,7 +4799,7 @@ //显示富文本编辑器 function showWangEditor(title, id) { if (isIE()) { - showNoteText(title, false); + showNoteText(title, id); return; } var url = WWWROOT + '/common/wangEditor.jsp?id=' + id; @@ -4820,10 +4820,8 @@ text: '预览', handler: function (that) { that.disable(true); - top.document.getElementById('wangEditorIframe').contentWindow.document.getElementById('btn').click(); + top.document.getElementById('wangEditorIframe').contentWindow.document.getElementById('btn2').click(); setTimeout(function () { - var html = top.document.getElementById('wangEditorIframe').contentWindow.document.getElementById('getHtml').value; - top.Ext.getCmp('previewNote').setValue(html); previewWangEditor(title); that.enable(); }, 1000); @@ -4835,8 +4833,6 @@ that.disable(true); top.document.getElementById('wangEditorIframe').contentWindow.document.getElementById('btn').click(); setTimeout(function () { - var html = top.document.getElementById('wangEditorIframe').contentWindow.document.getElementById('getHtml').value; - top.Ext.getCmp('note').setValue(html); that.enable(); }, 1000); } @@ -4847,8 +4843,6 @@ top.document.getElementById('wangEditorIframe').contentWindow.document.getElementById('btn').click(); top.Ext.MessageBox.wait('保存中,请稍候……', '请等待'); setTimeout(function () { - var html = top.document.getElementById('wangEditorIframe').contentWindow.document.getElementById('getHtml').value; - top.Ext.getCmp('note').setValue(html); hideMessageBox(true); that.enable(); win.close(); @@ -4865,74 +4859,111 @@ } //预览富文本内容 -function previewWangEditor(title) { - var url = WWWROOT + '/common/previewWangEditor.jsp'; +function previewWangEditor(title,id) { + var url = WWWROOT + '/common/previewWangEditor.jsp?id=' + id; openModalWindowForExt(url, {}, title + '配包注意事项', 1000, 550); } //IE配包注意事项不显示编辑器 -function showNoteText(title, isPreview) { - var content = ''; - var note = top.Ext.getCmp('note').getValue(); - if (note.split('

').length <= 1) { - content = note; - } +function showNoteText(title, id) { var win = new top.Ext.Window({ title: title + '配包注意事项编辑器', width: 1000, height: 600, - autoScroll: isPreview, + autoScroll: false, isTopContainer: true, modal: true, resizable: false, buttonAlign: 'center', items: [{ - xtype: "panel", - hidden: !isPreview, - html: note - }, { xtype: 'textarea', name: 'hiddenNote', id: 'hiddenNote', emptyText: '请输入内容', height: 506, width: 990, - hidden: isPreview, - value: content + hidden: false, + value: '' }], tbar: [{ text: 'IE浏览器不能使用富文本编辑器' }], buttons: [{ text: '预览', - hidden: isPreview, + hidden: false, handler: function () { var hiddenNote = top.Ext.getCmp('hiddenNote').getValue(); - top.Ext.getCmp('previewNote').setValue(hiddenNote); + sessionStorage.setItem('hiddenNote',hiddenNote) previewWangEditor(title); } }, { text: '保存', - hidden: isPreview, + hidden: false, handler: function () { var hiddenNote = top.Ext.getCmp('hiddenNote').getValue(); - top.Ext.getCmp('note').setValue(hiddenNote); + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!saveTousseDefinitionNote.do', + params: { + id: id, + note: hiddenNote + }, + success: function (response, options) { + var result = Ext.decode(response.responseText); + if (result.success) { + showResult(result.message); + } else { + showResult(result.message); + } + } + }); } }, { text: '保存并关闭', - hidden: isPreview, + hidden: false, handler: function () { var hiddenNote = top.Ext.getCmp('hiddenNote').getValue(); - top.Ext.getCmp('note').setValue(hiddenNote); - win.close(); + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!saveTousseDefinitionNote.do', + params: { + id: id, + note: hiddenNote + }, + success: function (response, options) { + var result = Ext.decode(response.responseText); + if (result.success) { + showResult(result.message); + win.close(); + } else { + showResult(result.message); + } + } + }); } }, { text: '取消', - hidden: isPreview, + hidden: false, handler: function () { win.close(); } }] }) win.show(); + if(id){ + Ext.Ajax.request({ + url : WWWROOT+'/disinfectSystem/baseData/tousseDefinitionAction!loadTousseDefinitionNote.do', + params: { + id:id + }, + success: function (response, options) { + var result = Ext.decode(response.responseText); + if (result.success) { + var text; + if(result.data && result.data.note){ + text = result.data.note; + } + top.Ext.getCmp('hiddenNote').setValue(text); + } + } + }); + } } \ No newline at end of file