|
@@ -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
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+}
|