You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
156 lines
5.4 KiB
156 lines
5.4 KiB
// import qs from 'qs'
|
|
// import { exportFile } from '@/utils/index'
|
|
import { FetchInitCategoryViewTable, FetchInitCategoryView } from '@/api/collect/collect'
|
|
import { crud } from '@crud/crud'
|
|
export const collectionLibraryCrud = {
|
|
mixins: [crud()],
|
|
// 组件共用属性
|
|
data() {
|
|
return {
|
|
getTableDisplayFieldsLoading: false,
|
|
tableDisplayFields: [],
|
|
projectData: [],
|
|
anjuanData: [],
|
|
junneiData: [],
|
|
fileData: [],
|
|
arrySort: [],
|
|
page: {
|
|
page: 1,
|
|
size: 10,
|
|
total: 0
|
|
},
|
|
timer: null,
|
|
query: {
|
|
search: null
|
|
},
|
|
classifyTree: [],
|
|
classifyLoading: false,
|
|
parentsId: null
|
|
}
|
|
},
|
|
// 组件挂载时的共用方法
|
|
mounted() {
|
|
},
|
|
// 组件共用方法
|
|
methods: {
|
|
handleSearch(categoryLevel) {
|
|
let parentsId = null
|
|
// 2 项目 3 案卷 /文件 4 卷内 6 文件
|
|
if (this.isTitleType === 2) {
|
|
parentsId = null
|
|
} else if (this.isTitleType === 3) {
|
|
console.log('this.isTitleType', this.isTitleType)
|
|
if (this.selectedCategory.arrangeType === 1) {
|
|
parentsId = null
|
|
} else {
|
|
parentsId = this.parentsData.parentsProjectId
|
|
this.$parent.getTableDisplayFieldsLoading = true
|
|
}
|
|
} else if (this.isTitleType === 4) {
|
|
// 卷内
|
|
this.$parent.$parent.getTableDisplayFieldsLoading = true
|
|
parentsId = this.parentsData.parentsAnjuanId
|
|
} else if (this.isTitleType === 6) {
|
|
// 原文
|
|
this.$parent.$parent.getTableDisplayFieldsLoading = true
|
|
parentsId = this.parentsData.parentsJuanneiId
|
|
}
|
|
setTimeout(() => {
|
|
this.getViewTableList(categoryLevel, 'search', parentsId)
|
|
}, 200)
|
|
},
|
|
getViewTable(categoryLevel, parentsId) {
|
|
this.getTableDisplayFieldsLoading = true
|
|
this.tableDisplayFields = []
|
|
FetchInitCategoryViewTable({ categoryId: this.selectedCategory.id, categoryLevel: categoryLevel }).then((res) => {
|
|
if (res) {
|
|
this.arrySort = []
|
|
this.tableDisplayFields = res
|
|
const orderSortArry = this.tableDisplayFields.filter(item => item.displayOrder).sort((a, b) => a.displayOrder - b.displayOrder)
|
|
orderSortArry.forEach(item => {
|
|
if (item.displayOrderBy) {
|
|
this.arrySort.push(item.fieldName + ',' + item.displayOrderBy)
|
|
}
|
|
})
|
|
this.$nextTick(() => {
|
|
this.getViewTableList(categoryLevel, null, parentsId)
|
|
})
|
|
}
|
|
})
|
|
},
|
|
getViewTableList(categoryLevel, type, parentsId) {
|
|
console.log('list', parentsId)
|
|
const params = {
|
|
'parentId': parentsId,
|
|
'categoryId': this.selectedCategory.id,
|
|
'categoryLevel': categoryLevel,
|
|
'search': this.query.search,
|
|
'page': this.page.page - 1,
|
|
'size': this.page.size
|
|
}
|
|
FetchInitCategoryView(params).then((res) => {
|
|
if (res.code !== 500) {
|
|
if (categoryLevel === 1) {
|
|
this.projectData = res.list.content
|
|
this.yearData = res.yearGroup
|
|
if (this.yearData) {
|
|
this.$emit('myYearEvent', this.yearData)
|
|
}
|
|
if (type === 'search') {
|
|
this.$parent.projectData = res.list.content
|
|
this.$parent.getTableDisplayFieldsLoading = false
|
|
}
|
|
} else if (categoryLevel === 2) {
|
|
this.anjuanData = res.list.content
|
|
this.yearData = res.yearGroup
|
|
if (this.yearData) {
|
|
this.$parent.$parent.$emit('myYearEvent', this.yearData)
|
|
}
|
|
if (type === 'search') {
|
|
this.$parent.anjuanData = res.list.content
|
|
this.$parent.getTableDisplayFieldsLoading = false
|
|
}
|
|
} else if (categoryLevel === 3) {
|
|
if (this.isTitleType === 6) {
|
|
this.fileData = res.list.content
|
|
} else if (this.isTitleType === 3) {
|
|
this.anjuanData = res.list.content
|
|
this.yearData = res.yearGroup
|
|
if (this.yearData) {
|
|
this.$parent.$parent.$emit('myYearEvent', this.yearData)
|
|
}
|
|
} else {
|
|
if (this.selectedCategory.arrangeType === 1) {
|
|
this.anjuanData = res.list.content
|
|
this.yearData = res.yearGroup
|
|
if (this.yearData) {
|
|
this.$parent.$parent.$emit('myYearEvent', this.yearData)
|
|
}
|
|
if (type === 'search') {
|
|
this.$parent.anjuanData = res.list.content
|
|
this.$parent.getTableDisplayFieldsLoading = false
|
|
}
|
|
} else {
|
|
this.junneiData = res.list.content
|
|
if (type === 'search') {
|
|
this.$parent.$parent.junneiData = res.list.content
|
|
this.$parent.$parent.getTableDisplayFieldsLoading = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.page.total = res.list.totalElements
|
|
}
|
|
this.getTableDisplayFieldsLoading = false
|
|
this.$parent.$parent.$refs.table.clearSelection()
|
|
})
|
|
},
|
|
|
|
/* 重新渲染table组件 防止table-fixed 错位 配合watch-table数据 */
|
|
doLayout() {
|
|
this.$nextTick(() => {
|
|
this.$refs.table.doLayout()
|
|
})
|
|
}
|
|
}
|
|
}
|