zhaozhipeng 1 ano atrás
pai
commit
d504df677c

+ 33 - 12
src/views/modules/knowledge/warehouse/auditProcessMaintain.vue

@@ -157,27 +157,48 @@ export default {
     this.init(true)
   },
   methods: {
-    async init(arg = false) {
+    init(arg = false) {
       if(arg) {
-        let res = await classApi.getAllByCategoryId()
-        this.classifyList = this.formatData(res.data.children)
-        this.initClassifyList = JSON.parse(JSON.stringify(this.classifyList))
+        // let res = await classApi.getAllByCategoryId()
+        // this.classifyList = this.formatData(res.data.children)
+        // this.initClassifyList = JSON.parse(JSON.stringify(this.classifyList))
         // this.formatDataAddPstr(this.classifyList)
+        classApi.getAllByCategoryId().then(res => {
+          this.classifyList = this.formatData(res.data.children)
+          this.initClassifyList = JSON.parse(JSON.stringify(this.classifyList))
+          this.formatDataAddPstr(this.classifyList)
+        })
       }
-      let raw = await api.findAllNodes()
-      this.tabPaneList = raw.data.map(item => {
+      // let raw = await api.findAllNodes()
+      // this.tabPaneList = raw.data.map(item => {
+      //   let categoryArr = []
+      //   for(let i=0;i<item.category.length;i++) {
+      //     categoryArr.push({
+      //       value:item.category[i],label:item.categoryName[i]
+      //     })
+      //   }
+      //   return {
+      //     pkId: item.pkId,
+      //     flowerName: item.flowerName,
+      //     categoryId: categoryArr,
+      //     knowledgeApprovalNode: item.knowledgeApprovalNode
+      //   }
+      // })
+      api.findAllNodes().then(raw => {
+        this.tabPaneList = raw.data.map(item => {
         let categoryArr = []
         for(let i=0;i<item.category.length;i++) {
           categoryArr.push({
             value:item.category[i],label:item.categoryName[i]
           })
         }
-        return {
-          pkId: item.pkId,
-          flowerName: item.flowerName,
-          categoryId: categoryArr,
-          knowledgeApprovalNode: item.knowledgeApprovalNode
-        }
+          return {
+            pkId: item.pkId,
+            flowerName: item.flowerName,
+            categoryId: categoryArr,
+            knowledgeApprovalNode: item.knowledgeApprovalNode
+          }
+        })
       })
       this.begintabPaneLength = this.tabPaneList.length
       // newData={value:element.pkId,label:element.name}

+ 13 - 2
src/views/modules/knowledge/warehouse/knowledgeAddUpdate.vue

@@ -45,7 +45,11 @@
                 </a-select>
               </a-form-model-item>
               <a-form-model-item label="*知识标题:" prop="titles">
-                <a-input v-model="knowledgeForm.titles" placeholder="请输入" :disabled="!!pkId" />
+                <a-input v-model="knowledgeForm.titles" placeholder="请输入" :disabled="!!pkId" :maxLength="40"  @change='titlesChange'>
+                  <div v-if="!pkId" slot="suffix" style="color: #C0C0C0;">
+                    {{ titlesNum }}
+                  </div>
+                </a-input>
               </a-form-model-item>
               <a-form-model-item prop="author">
                 <span slot="label">&emsp;&emsp;&ensp;作者</span>
@@ -299,7 +303,8 @@ export default {
       gradesInfo: {},
       widthVar: 800,
       organizationIdsInfo: {},
-      isAuth: false
+      isAuth: false,
+      titlesNum: 40
     }
   },
   created() {
@@ -376,6 +381,8 @@ export default {
           this.isAuth = false
         }
       })
+      this.titlesChange()
+
     } else {
       this.pkId = ''
       this.type = 'knowledgeManageList'
@@ -418,6 +425,10 @@ export default {
     this.$refs.knowledgeRef.clearValidate()
   },
   methods: {
+    //  title修改限制数量
+    titlesChange(){
+      this.titlesNum=40-this.knowledgeForm.titles.length
+    },
     handleAuthClickshow() {
       if(this.isAuth) {
         this.organizationIdsInfo = this.knowledgeForm.organizationIds