|  | @ -4,8 +4,9 @@ | 
		
	
		
			
				|  |  |     <div class="flex1" style="background: #FFFFFF;padding:0 10px"> |  |  |     <div class="flex1" style="background: #FFFFFF;padding:0 10px"> | 
		
	
		
			
				|  |  |       <div style="padding: 10px 0"> |  |  |       <div style="padding: 10px 0"> | 
		
	
		
			
				|  |  |         <el-button type="primary" size="mini" @click="saveForm">保存</el-button> |  |  |         <el-button type="primary" size="mini" @click="saveForm">保存</el-button> | 
		
	
		
			
				|  |  |         <el-button type="primary" size="mini" @click="setForm">设置</el-button> |  |  |  | 
		
	
		
			
				|  |  |         <el-button type="primary" size="mini" @click="setFormMode">表格模式</el-button> |  |  |  | 
		
	
		
			
				|  |  |  |  |  |         <el-button type="primary" size="mini" @click="setForm">获取html</el-button> | 
		
	
		
			
				|  |  |  |  |  |         <el-button type="primary" size="mini" @click="setFormMode('form')">表格模式</el-button> | 
		
	
		
			
				|  |  |  |  |  |         <el-button type="primary" size="mini" @click="setFormMode('design')">设计模式</el-button> | 
		
	
		
			
				|  |  |       </div> |  |  |       </div> | 
		
	
		
			
				|  |  |       <editor mode="design" @after-init.native="onAfterInit" /> |  |  |       <editor mode="design" @after-init.native="onAfterInit" /> | 
		
	
		
			
				|  |  |     </div> |  |  |     </div> | 
		
	
	
		
			
				|  | @ -28,19 +29,33 @@ export default { | 
		
	
		
			
				|  |  |     onAfterInit(e) { |  |  |     onAfterInit(e) { | 
		
	
		
			
				|  |  |       this.editor = e.editor |  |  |       this.editor = e.editor | 
		
	
		
			
				|  |  |       this.editor.execCommand('new') |  |  |       this.editor.execCommand('new') | 
		
	
		
			
				|  |  |  |  |  |       this.setForm() | 
		
	
		
			
				|  |  |  |  |  |       if (this.editor) { | 
		
	
		
			
				|  |  |  |  |  |         this.imageChange() | 
		
	
		
			
				|  |  |  |  |  |         // this.editor.$('#patientId').change(() => { | 
		
	
		
			
				|  |  |  |  |  |         //   console.log('asdfas') | 
		
	
		
			
				|  |  |  |  |  |         // }) | 
		
	
		
			
				|  |  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |  |     }, | 
		
	
		
			
				|  |  |  |  |  |     imageChange() { | 
		
	
		
			
				|  |  |  |  |  |       const data = this.editor.getBindObject().BODY | 
		
	
		
			
				|  |  |  |  |  |       const keys = Object.keys(data) | 
		
	
		
			
				|  |  |  |  |  |       this.editor.$('#img_editor').click(() => { | 
		
	
		
			
				|  |  |  |  |  |         this.editor.$('#img_editor')[0].src = require('@/assets/img/od.png') | 
		
	
		
			
				|  |  |  |  |  |       }) | 
		
	
		
			
				|  |  |  |  |  |       console.log(keys) | 
		
	
		
			
				|  |  |     }, |  |  |     }, | 
		
	
		
			
				|  |  |     saveForm() { |  |  |     saveForm() { | 
		
	
		
			
				|  |  |       const html = this.editor.getHtml() |  |  |       const html = this.editor.getHtml() | 
		
	
		
			
				|  |  |       console.log(this.editor.getBindObject()) |  |  |  | 
		
	
		
			
				|  |  |       window.sessionStorage.setItem('form', encodeURIComponent(html)) |  |  |       window.sessionStorage.setItem('form', encodeURIComponent(html)) | 
		
	
		
			
				|  |  |     }, |  |  |     }, | 
		
	
		
			
				|  |  |     setForm() { |  |  |     setForm() { | 
		
	
		
			
				|  |  |       const html = decodeURIComponent(window.sessionStorage.getItem('form')) |  |  |       const html = decodeURIComponent(window.sessionStorage.getItem('form')) | 
		
	
		
			
				|  |  |       this.editor.loadHtml(html) |  |  |       this.editor.loadHtml(html) | 
		
	
		
			
				|  |  |       this.editor.execCommand('design') |  |  |  | 
		
	
		
			
				|  |  |     }, |  |  |  | 
		
	
		
			
				|  |  |     setFormMode() { |  |  |  | 
		
	
		
			
				|  |  |       this.editor.execCommand('form') |  |  |       this.editor.execCommand('form') | 
		
	
		
			
				|  |  |  |  |  |     }, | 
		
	
		
			
				|  |  |  |  |  |     setFormMode(mode) { | 
		
	
		
			
				|  |  |  |  |  |       this.editor.execCommand(mode) | 
		
	
		
			
				|  |  |     } |  |  |     } | 
		
	
		
			
				|  |  |   } |  |  |   } | 
		
	
		
			
				|  |  | } |  |  | } | 
		
	
	
		
			
				|  | 
 |