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.
238 lines
7.6 KiB
238 lines
7.6 KiB
import qs from 'qs'
|
|
import { exportFile } from '@/utils/index'
|
|
import { FetchTableDisplayFields, FetchInitArchivesView, FetchFormDisplayFields } from '@/api/archivesManage/archivesList'
|
|
export const common = {
|
|
// 组件共用属性
|
|
data() {
|
|
return {
|
|
permission: {
|
|
add: ['admin', 'archivesList:add'],
|
|
edit: ['admin', 'archivesList:edit'],
|
|
del: ['admin', 'archivesList:del'],
|
|
download: ['admin', 'archivesList:download']
|
|
},
|
|
page: {
|
|
page: 0,
|
|
size: 10,
|
|
total: 0
|
|
},
|
|
query: {
|
|
'queryType': null,
|
|
'queryTitle': null,
|
|
'recordNo': null,
|
|
'archiveCtgNo': null,
|
|
'archiveNo': null,
|
|
'responsibleby': null
|
|
},
|
|
stateOptions: [ // 搜索 - 状态选择
|
|
{ key: '1', label: '全部' },
|
|
{ key: '2', label: '未装' },
|
|
{ key: '3', label: '未入' },
|
|
{ key: '4', label: '在库' },
|
|
{ key: '5', label: '待借' },
|
|
{ key: '6', label: '已借' }
|
|
],
|
|
tableDisplayFields: [], // table-list-title字段
|
|
getTableDisplayFieldsLoading: false, // table-loading
|
|
formVisible: false,
|
|
formTitle: '新建档案',
|
|
formPreviewData: [], // 预览界面data
|
|
totalSumAll: 0, // 删除时,内部文件数据求和
|
|
arrySort: [], // 多项sort-query
|
|
selections: [], // table已选择的
|
|
categoryId: null, // 上传附件使用
|
|
parentsId: null, // 父id
|
|
arcId: null, // 档案ID
|
|
yearGroup: [], // 智能分类 - 年度
|
|
uploadFileVisible: false // 上传附件
|
|
}
|
|
},
|
|
// 组件共用方法
|
|
methods: {
|
|
// 搜索-select
|
|
querySelect(name, val) {
|
|
this[name] = val
|
|
},
|
|
// 案卷 / 卷内 / 文件 导出
|
|
doExport(type) {
|
|
this.crud.downloadLoading = true
|
|
if (type === 0 && this.selectedCategory.isType === 2) {
|
|
this.parentsId = this.projectSelection.id
|
|
} else if (type === 1 && this.selectedCategory.isType === 2) {
|
|
this.parentsId = this.anjuanSelection.id
|
|
} else {
|
|
this.parentsId = null
|
|
}
|
|
const params = {
|
|
'categoryId': this.categoryId,
|
|
'parentsId': this.parentsId
|
|
}
|
|
exportFile(this.baseApi + '/api/archives/exportArchives?' + qs.stringify(params))
|
|
this.crud.downloadLoading = false
|
|
},
|
|
// table - 表头项
|
|
getTableItemCommon(type) {
|
|
if (type === 0) {
|
|
this.categoryId = this.selectedCategory.id
|
|
} else if (type === 1) {
|
|
if (this.selectedCategory.isType === 2) {
|
|
if (this.selectedCategory.children.length !== 0) {
|
|
this.categoryId = this.selectedCategory.children[0].id
|
|
}
|
|
} else {
|
|
this.categoryId = this.selectedCategory.id
|
|
}
|
|
} else if (type === 2) {
|
|
if (this.selectedCategory.isType === 2) {
|
|
if (this.selectedCategory.children.length !== 0) {
|
|
this.categoryId = this.selectedCategory.children[0].children[0].id
|
|
}
|
|
} else if (this.selectedCategory.isType === 3) {
|
|
if (this.selectedCategory.children.length !== 0) {
|
|
this.categoryId = this.selectedCategory.children[0].id
|
|
}
|
|
} else {
|
|
this.categoryId = this.selectedCategory.id
|
|
}
|
|
}
|
|
this.getTableDisplayFieldsLoading = true
|
|
this.selections = []
|
|
FetchTableDisplayFields({ categoryId: this.categoryId }).then(data => {
|
|
if (data) {
|
|
this.arrySort = []
|
|
this.tableDisplayFields = data
|
|
this.getTableDisplayFieldsLoading = false
|
|
const orderSortArry = this.tableDisplayFields.filter(item => item.queue).sort((a, b) => a.queue - b.queue)
|
|
orderSortArry.forEach(item => {
|
|
this.arrySort.push(item.fieldName + ',' + item.displayOrderBy)
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// table - list
|
|
getListCommon(name, page, type) {
|
|
if (type === 0) {
|
|
this.parentsId = null
|
|
} else if (type === 1) {
|
|
if (this.selectedCategory.isType === 3 || this.selectedCategory.isType === 5) {
|
|
this.parentsId = null
|
|
} else {
|
|
this.parentsId = this.projectSelection.id
|
|
}
|
|
} else if (type === 2) {
|
|
if (this.selectedCategory.isType !== 4) {
|
|
this.parentsId = this.anjuanSelection.id
|
|
} else {
|
|
this.parentsId = null
|
|
}
|
|
}
|
|
this.selections = []
|
|
this.page.page = isNaN(page - 1) ? 0 : page - 1
|
|
this.formVisible = false
|
|
this.getTableDisplayFieldsLoading = true
|
|
const params = {
|
|
'categoryId': this.categoryId,
|
|
'parentsId': this.parentsId,
|
|
'isdel': this.recycleMain.isdel,
|
|
'page': this.page.page,
|
|
'size': this.page.size,
|
|
'sort': this.arrySort,
|
|
'queryType': this.query.queryType,
|
|
'queryTitle': this.query.queryTitle,
|
|
'recordNo': this.query.recordNo,
|
|
'archiveCtgNo': this.query.archiveCtgNo,
|
|
'responsibleby': this.query.responsibleby,
|
|
'archiveNo': this.query.archiveNo,
|
|
'archiveYear': this.smartQuery.archiveYear,
|
|
'department': this.smartQuery.department,
|
|
'retention': this.smartQuery.retention,
|
|
'securityClass': this.smartQuery.securityClass,
|
|
'organizationMatter': this.smartQuery.organizationMatter
|
|
}
|
|
FetchInitArchivesView(params).then(data => {
|
|
this.getTableDisplayFieldsLoading = false
|
|
if (data) {
|
|
this[name] = data.list.content
|
|
this.yearGroup = data.yearGroup
|
|
this.page.total = data.list.totalElements
|
|
}
|
|
})
|
|
},
|
|
// 著录界面-form/详情-api
|
|
handleForm(type, title) {
|
|
if (type === 'add') {
|
|
this.formTitle = '新增' + title
|
|
this.arcId = null
|
|
// this.parentsId = this[name].id //案卷和卷内有 不确定
|
|
} else if (type === 'edit') {
|
|
this.arcId = this.selections[0].id
|
|
this.formTitle = '编辑' + title
|
|
}
|
|
this.formVisible = true
|
|
this.form.dictionaryConfigId = {}
|
|
this.formPreviewData = []
|
|
// 档案预编辑获取字段
|
|
const params = {
|
|
categoryId: this.categoryId,
|
|
archivesId: this.arcId
|
|
}
|
|
this.getFormInfo(params, type)
|
|
},
|
|
getFormInfo(params, type) {
|
|
FetchFormDisplayFields(params).then(data => {
|
|
this.formPreviewData = data.showFiled
|
|
this.$nextTick(() => {
|
|
if (type === 'edit') {
|
|
this.$refs.previewForm.addOrUpdateForm = data.echo
|
|
}
|
|
})
|
|
})
|
|
},
|
|
// form - submit
|
|
handlerArchivesSubmit() {
|
|
this.$refs.previewForm.submitForm('addOrUpdateForm', this.categoryId)
|
|
this.selections = []
|
|
},
|
|
// 选择删除
|
|
toDelete(data) {
|
|
this.$refs.deltArchives.deleteVisible = true
|
|
this.getTotalSumAll()
|
|
},
|
|
getTotalSumAll() {
|
|
this.totalSumAll = 0
|
|
this.selections.map((item) => { if (!isNaN(item.children_num)) this.totalSumAll += item.children_num })
|
|
if (isNaN(this.totalSumAll)) {
|
|
return 0
|
|
}
|
|
return this.totalSumAll
|
|
},
|
|
// 删除 - 关闭
|
|
handleClose(done) {
|
|
this.formVisible = false
|
|
done()
|
|
},
|
|
/* 重新渲染table组件 防止table-fixed 错位 配合watch-table数据 */
|
|
doLayout() {
|
|
this.$nextTick(() => {
|
|
this.$refs.table.doLayout()
|
|
})
|
|
},
|
|
// 上传附件
|
|
uploadFile() {
|
|
this.uploadFileVisible = true
|
|
this.arcId = this.selections[0].id
|
|
this.$nextTick(() => {
|
|
this.$refs.uploadFile.tableData = []
|
|
this.$refs.uploadFile.getFileList()
|
|
})
|
|
},
|
|
// 还原
|
|
handleRestore() {
|
|
this.$refs.restore.restoreVisible = true
|
|
}
|
|
},
|
|
// 组件挂载时的共用方法
|
|
mounted() {
|
|
|
|
}
|
|
}
|