|
|
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, project_class: null, archive_ctg_no: null }, classifyTree: [], classifyLoading: false, parentsId: null } }, // 组件挂载时的共用方法
mounted() { }, // 组件共用方法
methods: { // 缓存用户对于固定栏操作习惯
statusBarChecked(val) { this.fixedStatusBar = val localStorage.setItem('statusBarFixedType', val) }, handleSearch(categoryLevel) { this.parentsData.$refs.classifyTree.setCurrentKey(null) this.smartQuery = { 'retention': null, 'security_class': null, 'doc_type': null, 'medium_type': null, 'archive_year': null, 'fonds_no': null } // 2 项目 3 案卷 /文件 4 卷内 6 文件
if (this.isTitleType === 2) { this.parentsId = null this.$parent.getTableDisplayFieldsLoading = true } else if (this.isTitleType === 3) { if (this.selectedCategory.arrangeType === 1) { this.parentsId = null } else { if (this.activeIndex === 1) { this.parentsId = null } else { this.parentsId = this.parentsData.parentsProjectId } } this.$parent.getTableDisplayFieldsLoading = true } else if (this.isTitleType === 4) { // 卷内
this.$parent.$parent.getTableDisplayFieldsLoading = true this.parentsId = this.parentsData.parentsAnjuanId } else if (this.isTitleType === 6) { // 原文
if (this.selectedCategory.arrangeType === 1) { this.parentsId = this.parentsData.parentsAnjuanId this.$parent.getTableDisplayFieldsLoading = true } else { this.$parent.$parent.getTableDisplayFieldsLoading = true if (this.parentsData.isTabFile) { this.parentsId = this.parentsData.parentsAnjuanId } else { this.parentsId = this.parentsData.parentsJuanneiId } } }
setTimeout(() => { this.getViewTable(categoryLevel, this.parentsId, 'search') }, 200) }, getViewTable(categoryLevel, parentsId, type) { 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, parentsId, type) }) } }) }, getViewTableList(categoryLevel, parentsId, type) { const params = { 'parentId': parentsId, 'categoryId': this.selectedCategory.id, 'categoryLevel': categoryLevel, 'isdel': this.parentsData.isdel, 'search': this.query.search, 'retention': this.smartQuery.retention, 'security_class': this.smartQuery.security_class, 'medium_type': this.smartQuery.medium_type, 'doc_type': this.smartQuery.doc_type, 'archive_year': this.smartQuery.archive_year, 'fonds_no': this.smartQuery.fonds_no, 'project_class': this.query.project_class, 'archive_ctg_no': this.query.archive_ctg_no, 'page': this.page.page - 1, 'size': this.page.size, 'sort': this.arrySort } FetchInitCategoryView(params).then((res) => { if (res.code !== 500) { if (categoryLevel === 1) { // 项目
const projectObj = this.parentsData.$refs.projectEle this.projectData = res.list.content this.page.total = res.list.totalElements this.yearData = res.yearGroup if (this.yearData && type !== 'quickFilter') { this.$emit('myYearEvent', this.yearData) } if (type === 'search') { projectObj.projectData = res.list.content projectObj.page.total = res.list.totalElements projectObj.getTableDisplayFieldsLoading = false } } else if (categoryLevel === 2) { // 案卷
const anjuanObj = this.parentsData.$refs.anjuanEle.$refs.ajContent.$refs.tableList this.anjuanData = res.list.content this.page.total = res.list.totalElements this.yearData = res.yearGroup if (this.yearData && type !== 'quickFilter') { this.$parent.$parent.$emit('myYearEvent', this.yearData) } // 搜索/新增/编辑 非 案卷是主页的时候
if (type === 'search') { anjuanObj.anjuanData = res.list.content anjuanObj.page.total = res.list.totalElements anjuanObj.getTableDisplayFieldsLoading = false } } else if (categoryLevel === 3) { if (this.isTitleType === 3) { // 案卷下的未整理 / 文件为主页时
const wjObj = this.parentsData.$refs.anjuanEle.$refs.ajContent.$refs.tableList this.anjuanData = res.list.content this.page.total = res.list.totalElements this.yearData = res.yearGroup if (this.yearData && type !== 'quickFilter') { this.$parent.$parent.$emit('myYearEvent', this.yearData) } if (type === 'search') { wjObj.anjuanData = res.list.content wjObj.page.total = res.list.totalElements wjObj.getTableDisplayFieldsLoading = false } } else { // 卷内
this.junneiData = res.list.content this.page.total = res.list.totalElements if (type === 'search') { this.parentsData.$refs.juanneiEle.junneiData = res.list.content this.parentsData.$refs.juanneiEle.page.total = res.list.totalElements this.parentsData.$refs.juanneiEle.getTableDisplayFieldsLoading = false } } } else { // 原文
this.fileData = res.list.content this.page.total = res.list.totalElements if (type === 'search') { this.parentsData.$refs.fileEle.fileData = res.list.content this.parentsData.$refs.fileEle.page.total = res.list.totalElements this.parentsData.$refs.fileEle.getTableDisplayFieldsLoading = false } } } this.getTableDisplayFieldsLoading = false this.crud.selections = [] if (categoryLevel === 3) { // 按件
if (this.isTitleType === 3) { const wjObj = this.parentsData.$refs.anjuanEle.$refs.ajContent.$refs.tableList wjObj.selections = [] wjObj.$refs.table.clearSelection() // 清空选中
wjObj.$refs.table.setCurrentRow(-1) // 清除高亮
} else { const juanneiObj = this.parentsData.$refs.juanneiEle juanneiObj.selections = [] juanneiObj.$refs.table.clearSelection() juanneiObj.$refs.table.setCurrentRow(-1) } } else if (categoryLevel === 2) { // 按卷
const anjuanObj = this.parentsData.$refs.anjuanEle.$refs.ajContent.$refs.tableList anjuanObj.selections = [] anjuanObj.$refs.table.clearSelection() anjuanObj.$refs.table.setCurrentRow(-1) } else if (categoryLevel === 1) { // 项目
const projectObj = this.parentsData.$refs.projectEle projectObj.selections = [] projectObj.$refs.table.clearSelection() projectObj.$refs.table.setCurrentRow(-1) } else { const fileObj = this.parentsData.$refs.fileEle fileObj.selections = [] fileObj.$refs.table.clearSelection() fileObj.$refs.table.setCurrentRow(-1) } }) },
/* 重新渲染table组件 防止table-fixed 错位 配合watch-table数据 */ doLayout() { this.$nextTick(() => { this.$refs.table.doLayout() }) } } }
|