| 
					
				 | 
			
			
				@@ -4,11 +4,11 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <el-form class="p20" label-width="100px"  label-position="left" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       ref="elForm" :model="info" :rules="rules" > 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <el-row> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          <el-col :span="8"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <el-form-item label="所属部门" class="mt20" prop="department"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <el-col :span="8" > 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <el-form-item label="所属部门" class="mt20" prop="department" > 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              <el-select v-model="info.department" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               @change="selectDepartment($event)" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              collapse-tags placeholder="请选择"  clearable> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              collapse-tags placeholder="请选择"   :disabled="info.articalId?true:false" clearable> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                <el-option 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                v-for="item in showDepartments" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                :value="item" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -50,16 +50,19 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              <!-- <el-input class="ipt-select" type="textarea" v-model="info.brief"></el-input> --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         <el-form-item label="上传附件"  prop="filename"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         <el-form-item label="上传附件"  prop="filename" v-if="info.articalId==0"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <upload-file  placeholder="上传文档"  @rmImage="info.filename=''"  @onFinish="onUpload"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <el-form-item label=""> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               <el-button type="primary" @click="onSubmit" class="btn-md"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 提交文件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               </el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              <el-button type="primary" @click="preview(info.filename )" v-if="info.articalId>0" class="btn-md"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                预览附件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              </el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </el-form> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -73,7 +76,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   import Tinymce from "@/components/Tinymce/index.vue"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   import data  from '../data/data.js' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   import {mapGetters } from 'vuex' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  import {addArtical} from '@/api/article.js' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  import {addArtical,getArticalInfo, editArtical} from '@/api/article.js' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     name: 'application', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     components:{ UploadFile,Tinymce }, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -81,9 +85,11 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         loading:false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         isLike: 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        articalId:0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         dropDownValue:'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         showDepartments:[], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         categorys:data.categorys, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        isLeader:0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         info: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           filename:'', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           departmentId:0, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -121,7 +127,28 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.info.department = department.department; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    created(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.articalId = +this.$route.query.articalId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if( this.articalId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.loadArtical(  this.articalId ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     methods:{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      loadArtical( articalId ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         getArticalInfo({articalId}).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+           if (res.code == 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              this.info = res.data.info; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              for (let i in this.userDepartments) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+               if (this.userDepartments[i].departmentId == this.info.departmentId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                 this.isLeader = this.userDepartments[i].isLeader; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+               } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              if( this.isLeader < 2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.$message.errorMsg("暂无权限", 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       onUpload(filename){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.info.filename = filename; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -129,7 +156,6 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.info.departmentId = +item.departmentId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.info.department = item.department 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       showFinish(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let that = this 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.$msgbox({ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -150,14 +176,27 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           console.log(res) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      preview(filename){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        window.open( "http://smoa.ndjsxh.cn:8888/preview/"+filename) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       onSubmit(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.$refs["elForm"].validate((valid) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           if (!valid) return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          addArtical( this.info ).then(res=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if( res.code == 200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              this.showFinish() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          let {articalId, category,brief, title, isOpen } = this.info; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if( !articalId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            addArtical( this.info ).then(res=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              if( res.code == 200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.showFinish() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            editArtical( {articalId, category, brief, title, isOpen }).then( res=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              if( res.code == 200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.$router.go(-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 |