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

+ 16 - 103
src/views/modules/knowledge/aMixin/initMixin.js

@@ -1,108 +1,21 @@
-import statistics from '@/api/knowledge/statistics'
-export default (deleteTitle) => {
-  return {
-    data() {
-      return {
-        showAuditFlag: false,
-        barXUserData: [],
-        barUserDataNew: [],
-        barXOrgData: [],
-        barOrgDataNew: []
-      }
+import classApi from '@/api/knowledge/classify'
+export default {
+  methods: {
+    async init() {
+      let res = await classApi.getAllByCategoryId()
+      this.classifyList = this.formatData(res.data.children)
     },
-    mounted() {
-      this.getUserStatistics()
-    },
-    methods: {
-      handleAuditShow(arg) {
-        this.isOrgOrUser = arg
-        this.showAuditFlag = true
-      },
-          // 员工创建量统计
-    getUserStatistics(info = '',num = '') {
-      if(!info) {
-        if(!num) {
-          this.barXUserData = []
-          this.barXUserDataNew = []
-          this.barXOrgData = []
-          this.barOrgDataNew = []
-        } else if(num == 1) {
-          this.barXUserData = []
-          this.barXUserDataNew = []
-        } else {
-          this.barXOrgData = []
-          this.barOrgDataNew = []
-        }
-      } else {
-        statistics.personMap(info).then(res => {
-          let data = res.data.filter(item => item.organization != null)
-          console.log(data)
-          if(num == 1) {
-            if(!data.length) {
-              this.barXUserData = []
-              this.barXUserDataNew = []
-            } else {
-              this.barXUserData = data.map(item => item.organization)
-              this.barXUserDataNew = data.map(item => item.map)
-            }
-          } else {
-            if(!data.length) {
-              this.barXOrgData = []
-              this.barOrgDataNew = []
-            } else {
-              this.barXOrgData = data.map(item => item.organization)
-              this.barOrgDataNew = data.map(item => item.map)
-            }
-          }
-        })
-      }
-    },
-      handleSaveOk() {
-        if(this.isOrgOrUser == 1) {
-          let info = this.$refs.orgModalRef.personId
-          this.staffName = info.map(item => item.split('/')[0]).join('/')
-          this.staffForm.personId = info.map(item => item.split('/')[1])
-        } else {
-          let info = this.$refs.orgModalRef.$refs.orgTable.getSelectedRows()
-          this.orgName = info.map(item => item.name).join('/')
-          this.orgForm.organizationId = info.map(item => item.key).join(',')
-        }
-        this.showAuditFlag = false
-      },
-      handleSearchClick(arg) {
-        let info
-        if(arg == 1) {
-          this.staffForm.createTime = this.staffTime[0]
-          this.staffForm.endTime = this.staffTime[1]
-          info = {
-            type: this.type,
-            ...this.staffForm,
-            personId: this.staffForm.personId ? this.staffForm.personId : []
-          }
-          this.getUserStatistics(info,1)
-        } else {
-          this.orgForm.createTime = this.orgTime[0]
-          this.orgForm.endTime = this.orgTime[1]
-          info = {
-            type: this.type,
-            ...this.orgForm,
-          }
-           this.getUserStatistics(info,2)
-        }
-      },
-      handleResetClick(arg) {
-        if(arg == 1) {
-          this.staffName = undefined
-          this.staffTime = []
-          this.staffForm = Object.assign({},this.$options.data().staffForm)
-          this.getUserStatistics('',1)
+    //格式化数据,递归将空的children置为undefined
+    formatData(data) {
+      const that = this
+      data.forEach((element) => {
+        if (element.children && element.children.length > 0) {
+          that.formatData(element.children)
         } else {
-          this.orgName = undefined
-          this.orgTime = []
-          this.orgForm = Object.assign({},this.$options.data().orgForm)
-          this.getUserStatistics('',2)
+          delete element.children
         }
-      }
+      })
+      return data
     }
   }
-} 
+}

+ 1 - 1
src/views/modules/knowledge/warehouse/auditProcessMaintain.vue

@@ -96,7 +96,7 @@
             centered
             okText="保存"
             @ok="handleOk">
-        <org-people ref="orgPeopleRef" :key="new Date().getTime()" style="width:1100px;height:540px;" @transCheckedTarget="transCheckedTarget"></org-people>
+        <org-people ref="orgPeopleRef" isUseUserNo :key="new Date().getTime()" style="width:1100px;height:540px;" @transCheckedTarget="transCheckedTarget"></org-people>
       </a-modal>      
     </div> 
   </rx-layout>

+ 7 - 3
src/views/modules/knowledge/warehouse/components/orgPeople.vue

@@ -107,6 +107,10 @@
         isKnowledgeManage: {
             type: Boolean,
             default: false
+        },
+        isUseUserNo: {
+            type: Boolean,
+            default: false
         }
     },
     data() {
@@ -355,10 +359,10 @@
             this.$emit('transCheckedTargets',this.checkedTargets)
         },
         onSelectChange(keys,rows) {
-            if(this.isKnowledgeManage) {
-                this.checkedTarget['approverId'] = rows[0].userId
-            } else {    
+            if(this.isUseUserNo) {
                 this.checkedTarget['approverId'] = rows[0].userNo
+            } else {    
+                this.checkedTarget['approverId'] = rows[0].userId
             }
             this.checkedTarget['approverName'] = rows[0].fullName
             this.$emit('transCheckedTarget',this.checkedTarget)

+ 1 - 1
src/views/modules/knowledge/warehouse/knowledgeManageList.vue

@@ -240,7 +240,7 @@
         @ok="handleSaveOk"
       >
         <org-people
-          isKnowledgeManage
+          :isKnowledgeManage="reauthorFlag == 1 ? true : false"
           :key="new Date().getTime()" 
           style="width: 1100px; height: 540px"
           @transCheckedTarget="transCheckedTarget"