|
|
@ -71,6 +71,7 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import crudCategory from '@/api/category/category' |
|
|
|
import crudRoles from '@/api/system/role' |
|
|
|
import { collectionLibraryCrud } from './mixins/index.js' |
|
|
|
import { FetchDictionaryTreeByCategoryId } from '@/api/system/dict' |
|
|
|
import CRUD, { presenter, header } from '@crud/crud' |
|
|
@ -78,6 +79,7 @@ import Project from './project/index' |
|
|
|
import Anjuan from './anjuan/index' |
|
|
|
import Juannei from './juannei/index' |
|
|
|
import File from './file/index' |
|
|
|
import { mapGetters } from 'vuex' |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'CollectionLibrary', |
|
|
@ -141,12 +143,18 @@ export default { |
|
|
|
'doc_type': null, // 文种 |
|
|
|
'medium_type': null, // 载体类型 |
|
|
|
'archive_year': null, // 年度 |
|
|
|
'organ_or_function': null, // 机构与类型 |
|
|
|
'fonds_no': null // 全宗 |
|
|
|
}, |
|
|
|
isTabFile: false, |
|
|
|
fixedStatusBar: false |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
...mapGetters([ |
|
|
|
'user' |
|
|
|
]) |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
isdel: function(newValue, oldValue) { |
|
|
|
}, |
|
|
@ -166,15 +174,17 @@ export default { |
|
|
|
this.classifyTree = this.classifyTree.slice(1) |
|
|
|
} |
|
|
|
if (this.yearChildData.length !== 0) { |
|
|
|
console.log('this.yearChildData', this.yearChildData) |
|
|
|
const newYearArr = this.yearChildData.map((item, index) => { |
|
|
|
const json = {} |
|
|
|
json.id = index |
|
|
|
json.id = item |
|
|
|
json.dictionaryName = item |
|
|
|
json.dictionaryParents = '-1' |
|
|
|
json.childDictionarys = [] |
|
|
|
return json |
|
|
|
}) |
|
|
|
this.classifyTree.unshift({ id: -1, dictionaryName: '年度', dictionaryCode: 'archive_year', childDictionarys: newYearArr }) |
|
|
|
console.log('this.classifyTree', this.classifyTree) |
|
|
|
} |
|
|
|
this.classifyLoading = false |
|
|
|
}, 500) |
|
|
@ -255,6 +265,7 @@ export default { |
|
|
|
'doc_type': null, // 文种 |
|
|
|
'medium_type': null, // 载体类型 |
|
|
|
'archive_year': null, // 年度 |
|
|
|
'organ_or_function': null, // 机构与类型 |
|
|
|
'fonds_no': null // 全宗 |
|
|
|
} |
|
|
|
this.parentsProjectId = null |
|
|
@ -321,6 +332,9 @@ export default { |
|
|
|
this.$refs.fileEle.fileDrawer = false |
|
|
|
} |
|
|
|
}, |
|
|
|
getRole(id) { |
|
|
|
return crudRoles.get(id) |
|
|
|
}, |
|
|
|
getDictionaryTreeByCategoryId(categoryId) { |
|
|
|
this.classifyLoading = true |
|
|
|
const params = { |
|
|
@ -334,11 +348,49 @@ export default { |
|
|
|
const parent = {} |
|
|
|
parent.id = 0 |
|
|
|
parent.fondsName = '全宗' |
|
|
|
parent.childDictionarys = res.fonds |
|
|
|
parent.childDictionarys = res.fonds.map(item => { |
|
|
|
return { |
|
|
|
...item, |
|
|
|
id: item.fondsId |
|
|
|
} |
|
|
|
}) |
|
|
|
fonds = parent |
|
|
|
} |
|
|
|
this.classifyTree = res.dictionarys.concat(fonds) |
|
|
|
this.classifyLoading = false |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
Promise.all(this.user.roles.map(item => this.getRole(item.id))) |
|
|
|
.then(roles => { |
|
|
|
// 去重取fonds合集 |
|
|
|
// const allFonds = [] |
|
|
|
// roles.forEach(role => { |
|
|
|
// role.fonds.forEach(fond => { |
|
|
|
// const existingIndex = allFonds.findIndex(item => item.id === fond.id) |
|
|
|
// if (existingIndex !== -1) { |
|
|
|
// allFonds[existingIndex] = fond |
|
|
|
// } else { |
|
|
|
// allFonds.push(fond) |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// }) |
|
|
|
const allFondsIds = [] |
|
|
|
const fondsObj = {} |
|
|
|
|
|
|
|
roles.forEach(role => { |
|
|
|
role.fonds.forEach(fond => { |
|
|
|
if (!fondsObj[fond.id]) { |
|
|
|
fondsObj[fond.id] = fond |
|
|
|
allFondsIds.push(fond.id) |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.$refs.classifyTree.setCheckedKeys(allFondsIds) |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
console.error('Error fetching roles:', error) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}).catch(err => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
@ -398,34 +450,50 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
getIdByCode(dictionaryCode) { |
|
|
|
for (const dictionary of this.classifyTree) { |
|
|
|
if (dictionary.dictionaryCode === dictionaryCode) { |
|
|
|
return dictionary.id |
|
|
|
} |
|
|
|
} |
|
|
|
return null |
|
|
|
}, |
|
|
|
handleCheckChange(data, checked, indeterminate) { |
|
|
|
// 获取所有选中的节点 |
|
|
|
const res = this.$refs.classifyTree.getCheckedNodes() |
|
|
|
|
|
|
|
if (res.some(obj => obj.fondsName === '全宗')) { |
|
|
|
this.smartQuery.fonds_no = null |
|
|
|
} else { |
|
|
|
const fondsGroup = res.filter(item => item.fondsId).map(item => item.fondsNo) |
|
|
|
this.smartQuery.fonds_no = fondsGroup.join(',') |
|
|
|
} |
|
|
|
// const isFondsTop = res.some(obj => obj.fondsName === '全宗') |
|
|
|
// if (isFondsTop) { |
|
|
|
// this.smartQuery.fonds_no = null |
|
|
|
const fondsGroup = res.filter(item => item.fondsId).map(item => item.fondsNo) |
|
|
|
this.smartQuery.fonds_no = fondsGroup.join(',') |
|
|
|
// } |
|
|
|
|
|
|
|
const groupedData = {} |
|
|
|
const securityId = this.getIdByCode('security_class') |
|
|
|
const retentionId = this.getIdByCode('retention') |
|
|
|
const docTypeId = this.getIdByCode('doc_type') |
|
|
|
const mediumTypeId = this.getIdByCode('medium_type') |
|
|
|
const organOrFunctionId = this.getIdByCode('organ_or_function') |
|
|
|
|
|
|
|
res.forEach(function(item) { |
|
|
|
if (item.dictionaryParents === '-1') { |
|
|
|
groupedData.archive_year = groupedData.archive_year || [] |
|
|
|
groupedData.archive_year.push(item.dictionaryName) |
|
|
|
} else if (item.dictionaryParents === '4028e3c389cee5920189cf0af3d30000') { |
|
|
|
} else if (item.dictionaryParents === securityId) { |
|
|
|
groupedData.security_class = groupedData.security_class || [] |
|
|
|
groupedData.security_class.push(item.dictionaryName) |
|
|
|
} else if (item.dictionaryParents === '4028e3c38a20f4d4018a213c26ff001c') { |
|
|
|
} else if (item.dictionaryParents === retentionId) { |
|
|
|
groupedData.retention = groupedData.retention || [] |
|
|
|
groupedData.retention.push(item.dictionaryName) |
|
|
|
} else if (item.dictionaryParents === '4028e3c38b4159fe018b415a7c470000') { |
|
|
|
} else if (item.dictionaryParents === docTypeId) { |
|
|
|
groupedData.doc_type = groupedData.doc_type || [] |
|
|
|
groupedData.doc_type.push(item.dictionaryName) |
|
|
|
} else if (item.dictionaryParents === '4028e3c38b415cea018b417f4a6c0011') { |
|
|
|
} else if (item.dictionaryParents === mediumTypeId) { |
|
|
|
groupedData.medium_type = groupedData.medium_type || [] |
|
|
|
groupedData.medium_type.push(item.dictionaryName) |
|
|
|
} else if (item.dictionaryParents === organOrFunctionId) { |
|
|
|
groupedData.organ_or_function = groupedData.organ_or_function || [] |
|
|
|
groupedData.organ_or_function.push(item.dictionaryName) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
@ -433,7 +501,7 @@ export default { |
|
|
|
const selectedParentVal = this.$refs.classifyTree.getNode(data.id).parent.data.dictionaryCode |
|
|
|
switch (selectedParentVal) { |
|
|
|
case 'security_class': |
|
|
|
if (res.some(obj => obj.dictionaryCode === 'security_class')) { |
|
|
|
if (res.find(obj => obj.dictionaryCode === 'security_class')) { |
|
|
|
this.smartQuery.security_class = null |
|
|
|
} else { |
|
|
|
if (groupedData.security_class) { |
|
|
@ -444,7 +512,7 @@ export default { |
|
|
|
} |
|
|
|
break |
|
|
|
case 'retention': |
|
|
|
if (res.some(obj => obj.dictionaryCode === 'retention')) { |
|
|
|
if (res.find(obj => obj.dictionaryCode === 'retention')) { |
|
|
|
this.smartQuery.retention = null |
|
|
|
} else { |
|
|
|
if (groupedData.retention) { |
|
|
@ -455,7 +523,7 @@ export default { |
|
|
|
} |
|
|
|
break |
|
|
|
case 'doc_type': |
|
|
|
if (res.some(obj => obj.dictionaryCode === 'doc_type')) { |
|
|
|
if (res.find(obj => obj.dictionaryCode === 'doc_type')) { |
|
|
|
this.smartQuery.doc_type = null |
|
|
|
} else { |
|
|
|
if (groupedData.doc_type) { |
|
|
@ -466,7 +534,7 @@ export default { |
|
|
|
} |
|
|
|
break |
|
|
|
case 'medium_type': |
|
|
|
if (res.some(obj => obj.dictionaryCode === 'medium_type')) { |
|
|
|
if (res.find(obj => obj.dictionaryCode === 'medium_type')) { |
|
|
|
this.smartQuery.medium_type = null |
|
|
|
} else { |
|
|
|
if (groupedData.medium_type) { |
|
|
@ -476,19 +544,34 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
break |
|
|
|
default: |
|
|
|
if (res.some(obj => obj.dictionaryCode === 'archive_year')) { |
|
|
|
this.smartQuery.archive_year = null |
|
|
|
case 'organ_or_function': |
|
|
|
if (res.find(obj => obj.dictionaryCode === 'organ_or_function')) { |
|
|
|
this.smartQuery.organ_or_function = null |
|
|
|
} else { |
|
|
|
if (groupedData.archive_year) { |
|
|
|
this.smartQuery.archive_year = groupedData.archive_year.join(',') |
|
|
|
if (groupedData.organ_or_function) { |
|
|
|
this.smartQuery.organ_or_function = groupedData.organ_or_function.join(',') |
|
|
|
} else { |
|
|
|
this.smartQuery.archive_year = null |
|
|
|
this.smartQuery.organ_or_function = null |
|
|
|
} |
|
|
|
} |
|
|
|
break |
|
|
|
default: |
|
|
|
if (groupedData.archive_year) { |
|
|
|
this.smartQuery.archive_year = groupedData.archive_year.join(',') |
|
|
|
} else { |
|
|
|
this.smartQuery.archive_year = null |
|
|
|
} |
|
|
|
// if (res.find(obj => obj.dictionaryCode === 'archive_year')) { |
|
|
|
// this.smartQuery.archive_year = null |
|
|
|
// } else { |
|
|
|
// if (groupedData.archive_year) { |
|
|
|
// this.smartQuery.archive_year = groupedData.archive_year.join(',') |
|
|
|
// } else { |
|
|
|
// this.smartQuery.archive_year = null |
|
|
|
// } |
|
|
|
// } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
this.handlePageList('quickFilter') |
|
|
|
}) |
|
|
|