Zhang Li, BBF-411-2(Neusoft) há 1 ano atrás
pai
commit
4b395912d9

+ 8 - 0
src/api/knowledge/auditProcess.js

@@ -20,6 +20,14 @@ returnData.findAllNodesByCategoryId=function (parameter) {
     return res
   })
 }
+
+// 查询选过的关联分类id集
+returnData.findAllCategorySelected=function (parameter) {
+  var url= returnData.baseUrl + '/knowledgeApprovalNode/findAllCategorySelected'
+  return rxAjax.get(url,parameter).then (res => {
+    return res
+  })
+}
 // returnData.findAllApprovalNodes=function (parameter) {
 //   var url= returnData.baseUrl + '/knowledgeApprovalNode/findAllApprovalNodes'
 //   return rxAjax.postJson(url,parameter).then (res => {

+ 42 - 9
src/views/modules/knowledge/warehouse/auditProcessMaintain.vue

@@ -8,7 +8,7 @@
             <div class="body">
               <div class="content">
                 <a-form ref="searchForm" layout="inline">
-                  <a-tabs v-model="tabsKeys" size="large" :animated="false">
+                  <a-tabs v-model="tabsKeys" size="large" :animated="false" @change="handleTabsChange">
                     <a-button type="primary" slot="tabBarExtraContent" @click="handleAddFlowClick">
                       添加流程
                     </a-button>
@@ -96,7 +96,7 @@
             centered
             okText="保存"
             @ok="handleOk">
-        <org-people style="width:1100px;height:540px;" @transCheckedTarget="transCheckedTarget"></org-people>
+        <org-people ref="orgPeopleRef" :key="new Date().getTime()" style="width:1100px;height:540px;" @transCheckedTarget="transCheckedTarget"></org-people>
       </a-modal>      
     </div> 
   </rx-layout>
@@ -122,6 +122,7 @@ export default {
       api,
       saveLoading: false,
       classifyList: [],
+      initClassifyList: [],
       classifyListArr: [],
       tempDataIndex: '',
       tempDataIndez: '',
@@ -145,6 +146,8 @@ export default {
         //   ]
         // }
       ],
+      // 已选过的分类
+      choosedCategory: [],
       begintabPaneLength: null,
     }
   },
@@ -156,11 +159,11 @@ export default {
       if(arg) {
         let res = await classApi.getAllByCategoryId()
         this.classifyList = this.formatData(res.data.children)
-        // this.formatDataAddPstr(this.classifyList,"","")
+        this.initClassifyList = JSON.parse(JSON.stringify(this.classifyList))
+        // this.formatDataAddPstr(this.classifyList)
       }
       let raw = await api.findAllNodes()
       this.tabPaneList = raw.data.map(item => {
-        // console.log(item.category)
         let categoryArr = []
         for(let i=0;i<item.category.length;i++) {
           categoryArr.push({
@@ -178,6 +181,20 @@ export default {
       // newData={value:element.pkId,label:element.name}
       this.saveLoading = false
     },
+    handleTabsChange() {
+      if(this.tabsKeys != 1) {
+        let pkId = this.tabPaneList[this.tabsKeys-1].pkId || ''
+        this.getAllCategorySelected(pkId)
+      }
+    },
+    getAllCategorySelected(pkId = '') {
+      api.findAllCategorySelected({pkId}).then(res => {
+        if(res.code == 200) {
+          this.choosedCategory = res.data
+          this.classifyList = this.formatDataAddPstr(JSON.parse(JSON.stringify(this.initClassifyList)))
+        }
+      })
+    },
     //格式化数据,递归将空的children置为undefined
     formatData(data) {
       const that = this
@@ -190,6 +207,25 @@ export default {
       })
       return data
     },
+    formatDataAddPstr(data) {
+      const that = this
+      // base = base+","+pkId+"&"
+      data.forEach((element) => {
+        // element.Pstr = base
+        // this.classifyListArr.push(element)
+        if(this.choosedCategory.some(item => item == element.pkId)) {
+          element.disabled = true
+        }
+        if (element.children && element.children.length > 0) {
+          // if(element)
+          that.formatDataAddPstr(element.children)
+        }
+        //  else {
+        //   delete element.children
+        // }
+      })
+      return data
+    },
     // formatDataAddPstr(data,base,pkId) {
     //   const that = this
     //   base = base+","+pkId+"&"
@@ -205,8 +241,6 @@ export default {
     //   return data
     // },
     selectTree(value, node, extra){
-      console.log(value.value)
-      console.log(this.classifyListArr)
       let that=this
       setTimeout(function(){
         let childArr=that.classifyListArr.filter(item=>{
@@ -296,6 +330,7 @@ export default {
           }
         ]
       })
+      this.getAllCategorySelected()
       this.tabsKeys = this.tabPaneList.length
     },
     handleDelFlowClick(pkId = null,indez) {
@@ -320,7 +355,6 @@ export default {
           }
         })
       }
-      
     },
     addRow(index,indez){
       let tempData= {
@@ -340,12 +374,11 @@ export default {
       this.tabPaneList[indez].knowledgeApprovalNode.splice(index, 1);
     },
     handleShowAuditClick(index,indez) {
-      this.showAuditFlag = true,
+      this.showAuditFlag = true
       this.tempDataIndex = index
       this.tempDataIndez = indez
     },
     transCheckedTarget(arg) {
-      console.log(arg)
       this.approverData.approverId = arg.approverId 
       this.approverData.approverName = arg.approverName
     },

+ 30 - 25
src/views/modules/knowledge/warehouse/components/orgPeople.vue

@@ -199,22 +199,25 @@
         }
     },
     created() {
-        this.loadAdminDeps();
-        if(!this.isOnlyOrg) {
-            commonApi.getSequences().then(res => {
-                this.sequencesList = res.data.map(item => {
-                    return {
-                        value: item.code,
-                        label: item.name
-                    }
-                })
-            })
-            commonApi.getGrades().then(res => {
-                this.gradesList = res.data
-            })
-        }
+       this.init()
     },
     methods: {
+        init() {
+            this.loadAdminDeps();
+            if(!this.isOnlyOrg) {
+                commonApi.getSequences().then(res => {
+                    this.sequencesList = res.data.map(item => {
+                        return {
+                            value: item.code,
+                            label: item.name
+                        }
+                    })
+                })
+                commonApi.getGrades().then(res => {
+                    this.gradesList = res.data
+                })
+            }
+        },
         reset() {
             this.queryParam.name = ""
             this.queryParam.userNo = ""
@@ -250,17 +253,19 @@
 
                 this.orgData = [...temp];
                 // this.getAllUserTypeList();
-                let info = this.organizationIdsInfo
-                this.checkedKeys.checked = info.organizationId || []
-                this.checkedTargets.organizationId = info.organizationId || []
-                this.checkedTargets.organizationName = info.organizationName || []
-                this.checkedTargets.organizationTree = info.organizationTree || []
-                this.gradeId = info.gradeId || []
-                this.sequencesInfo.gradeId = info.gradeId || []
-                this.sequencesInfo.gradeName = info.gradeName || []
-                this.gradeLevelId = info.gradeLevelId || []
-                this.gradesInfo.gradeLevelId = info.gradeLevelId || []
-                this.gradesInfo.gradeLevelName = info.gradeLevelName || []
+                if(!this.isOnlyOrg) {
+                    let info = this.organizationIdsInfo
+                    this.checkedKeys.checked = info.organizationId || []
+                    this.checkedTargets.organizationId = info.organizationId || []
+                    this.checkedTargets.organizationName = info.organizationName || []
+                    this.checkedTargets.organizationTree = info.organizationTree || []
+                    this.gradeId = info.gradeId || []
+                    this.sequencesInfo.gradeId = info.gradeId || []
+                    this.sequencesInfo.gradeName = info.gradeName || []
+                    this.gradeLevelId = info.gradeLevelId || []
+                    this.gradesInfo.gradeLevelId = info.gradeLevelId || []
+                    this.gradesInfo.gradeLevelName = info.gradeLevelName || []
+                }
             })
         },
         //加载左树下的子节点