Jelajahi Sumber

代码提交:
1028知识分享

sunruiqi 2 tahun lalu
induk
melakukan
f7b0a935c7
1 mengubah file dengan 24 tambahan dan 4 penghapusan
  1. 24 4
      src/views/modules/knowledgeShare/InfoForm.vue

+ 24 - 4
src/views/modules/knowledgeShare/InfoForm.vue

@@ -13,11 +13,18 @@
         <el-row  :gutter="15">
 
           <el-col :span="21">
-            <el-form-item label="知识分享类型" prop="typeName"
+            <el-form-item label="知识分享类型" prop="typeId"
                           :rules="[
                           {required: true, message:'分享类型不能为空', trigger:'blur'}
                  ]">
-              <el-input v-model="inputForm.typeName" @focus="openProgramPageForm()" placeholder="请选择知识分享类型"></el-input>
+              <el-select v-model="inputForm.typeId" placeholder="请选择" style="width:100%;">
+                <el-option
+                  v-for="item in typeList"
+                  :value="item.id"
+                  :label="item.klgsType"
+                  :key="item.id">
+                </el-option>
+              </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="21">
@@ -127,6 +134,7 @@
 
 <script>
   import KnowledgeShareInfoService from '@/api/sys/KnowledgeShareInfoService'
+  import KnowledgeShareTypeService from '@/api/sys/KnowledgeShareTypeService'
   import UpLoadComponent from '@/views/common/UpLoadComponent'
   import UserService from '@/api/sys/UserService'
   import KnowledgeShareTypePageForm from '@/views/modules/finance/invoice/KnowledgeShareTypePageForm'
@@ -140,6 +148,7 @@
         loading: false,
         isAdmin: false,
         create: '',
+        typeList: [],
         inputForm: {
           id: '',
           typeId: '',
@@ -156,7 +165,11 @@
     userService: null,
     created () {
       this.knowledgeShareInfoService = new KnowledgeShareInfoService()
+      this.knowledgeShareTypeService = new KnowledgeShareTypeService()
       this.userService = new UserService()
+      this.knowledgeShareTypeService.list().then(({data}) => {
+        this.typeList = data.records
+      })
     },
     components: {
       UpLoadComponent,
@@ -189,6 +202,9 @@
         this.visible = true
         this.loading = false
         this.$nextTick(() => {
+          if (method === 'add') {
+            this.$refs.contentEditor.enable()
+          }
           if (method === 'edit' || method === 'view') { // 修改或者查看
             this.loading = true
             // 富文本处理
@@ -198,7 +214,11 @@
             this.$refs.inputForm.resetFields()
             this.knowledgeShareInfoService.findById(this.inputForm.id, method).then(({data}) => {
               // 富文本处理
-              this.$refs.contentEditor.disable()
+              if (method === 'view') {
+                this.$refs.contentEditor.disable()
+              } else {
+                this.$refs.contentEditor.enable()
+              }
               this.inputForm = this.recover(this.inputForm, data)
               this.$refs.uploadComponent.newUpload(method, this.inputForm.files, 'knowledgeShare')
               this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
@@ -245,7 +265,7 @@
       },
       pushComment () {
         if (this.commonJS.isEmpty(this.inputForm.content)) {
-          this.$message.error("请输入评论内容")
+          this.$message.error('请输入评论内容')
           return
         }
         this.commentForm = {