|
|
@ -27,7 +27,7 @@ |
|
|
|
<i class="iconfont icon-daochu" /> |
|
|
|
导出 |
|
|
|
</el-button> |
|
|
|
<el-button v-if="selectedDocument.isType===4" :loading="allDownloadLoading" size="mini" :disabled="crud.selections.length !== 0" @click="doExport('1')"> |
|
|
|
<el-button v-if="selectedDocument.isType===3 || selectedDocument.isType===4" :loading="allDownloadLoading" size="mini" :disabled="crud.selections.length !== 0" @click="doExport('1')"> |
|
|
|
<i class="iconfont icon-daochu" /> |
|
|
|
批量导出 |
|
|
|
</el-button> |
|
|
@ -53,6 +53,7 @@ |
|
|
|
class="archives-table" |
|
|
|
:data="crud.data" |
|
|
|
style="width: 100%;" |
|
|
|
height="calc(100vh - 374px)" |
|
|
|
@row-click="clickRowHandler" |
|
|
|
@select="crud.selectChange" |
|
|
|
@select-all="crud.selectAllChange" |
|
|
@ -108,15 +109,17 @@ |
|
|
|
:selected-document="selectedDocument" |
|
|
|
:is-has-code="isHasCode" |
|
|
|
:archives-type="archivesType" |
|
|
|
:is-miod-save-bind="isMiodSaveBind" |
|
|
|
@close-dialog="closeDialog" |
|
|
|
@formLoadingShow="formLoadingShow" |
|
|
|
@refreshTree="refreshTreeList" |
|
|
|
@resetQuery="resetQuery" |
|
|
|
@getInitDocumentBind="getInitDocumentBind" |
|
|
|
/> |
|
|
|
<div slot="footer" class="dialog-footer" style="margin-top: 20px !important;"> |
|
|
|
<el-button type="text" @click="closeDialog">取消</el-button> |
|
|
|
<el-button :loading="archivesBtnLoading" type="primary" @click="handlerArchivesSubmit">保存</el-button> |
|
|
|
<!-- <el-button :loading="bindSaveLoading" type="primary">保存并绑定标签</el-button> --> |
|
|
|
<el-button :loading="archivesBtnLoading" type="primary" @click="handlerArchivesSubmit(false)">保存</el-button> |
|
|
|
<el-button v-if="archivesType === 'edit'" :loading="bindSaveLoading" type="primary" @click="handlerArchivesSubmit(true)">保存并绑定标签</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
@ -146,7 +149,7 @@ |
|
|
|
<script> |
|
|
|
import CRUD, { presenter, header } from '@crud/crud' |
|
|
|
import { miodLibraryCrud } from './mixins/index' |
|
|
|
import crudDocumentArchives, { FetchDelArchives, FetchCompleteDelArchives, FetchRestoreArchives, FetchInitDistributorAllByDocumentId, FetchBorrowerdsByIds } from '@/api/system/documentArchives' |
|
|
|
import crudDocumentArchives, { FetchDelArchives, FetchCompleteDelArchives, FetchRestoreArchives, FetchInitDistributorAllByDocumentId, FetchBorrowerdsByIds, FetchInitDocumentDetailsList, FetchReadGW, FetchBingdingLabel } from '@/api/system/documentArchives' |
|
|
|
import crudOperation from '@crud/CRUD.operation' |
|
|
|
import pagination from '@crud/Pagination' |
|
|
|
import TreeList from './treeList' |
|
|
@ -225,7 +228,8 @@ export default { |
|
|
|
search: '', |
|
|
|
parentInfo: null, |
|
|
|
pageType: null, |
|
|
|
allDownloadLoading: false |
|
|
|
allDownloadLoading: false, |
|
|
|
isMiodSaveBind: null |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
@ -386,8 +390,10 @@ export default { |
|
|
|
// 获取借阅者 |
|
|
|
FetchInitDistributorAllByDocumentId(params).then(res => { |
|
|
|
if (res && res.length !== 0) { |
|
|
|
console.log('res', res) |
|
|
|
this.$refs.previewForm.miodDeptsTags = res |
|
|
|
const ids = res.map(item => item.id) |
|
|
|
const ids = res.map(item => item.id).join(',') |
|
|
|
console.log('ids', ids) |
|
|
|
this.$set(this.$refs.previewForm.addOrUpdateForm, 'miodDepts', ids) |
|
|
|
} else { |
|
|
|
this.$set(this.$refs.previewForm.addOrUpdateForm, 'miodDepts', null) |
|
|
@ -400,8 +406,9 @@ export default { |
|
|
|
} |
|
|
|
FetchBorrowerdsByIds(hostParams).then(res => { |
|
|
|
if (res && res.length !== 0) { |
|
|
|
console.log('res-hostDepartmentTags', res) |
|
|
|
this.$refs.previewForm.hostDepartmentTags = res |
|
|
|
const ids = res.map(item => item.id) |
|
|
|
const ids = res.map(item => item.id).join(',') |
|
|
|
this.$set(this.$refs.previewForm.addOrUpdateForm, 'host_department', ids) |
|
|
|
} else { |
|
|
|
this.$set(this.$refs.previewForm.addOrUpdateForm, 'host_department', null) |
|
|
@ -417,14 +424,148 @@ export default { |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
handlerArchivesSubmit() { |
|
|
|
handlerArchivesSubmit(type) { |
|
|
|
this.isMiodSaveBind = type |
|
|
|
this.$nextTick(() => { |
|
|
|
let documentId |
|
|
|
if (this.selectedDocument.isType === 2) { |
|
|
|
documentId = this.selectedDocument.id |
|
|
|
} else { |
|
|
|
documentId = this.selectedDocument.documentId |
|
|
|
} |
|
|
|
this.$refs.previewForm.submitForm('addOrUpdateForm', documentId) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
getInitDocumentBind() { |
|
|
|
this.bindSaveLoading = true |
|
|
|
let documentId |
|
|
|
if (this.selectedDocument.isType === 2) { |
|
|
|
documentId = this.selectedDocument.id |
|
|
|
} else { |
|
|
|
documentId = this.selectedDocument.documentId |
|
|
|
} |
|
|
|
this.$refs.previewForm.submitForm('addOrUpdateForm', documentId) |
|
|
|
|
|
|
|
const params = { |
|
|
|
documentId, |
|
|
|
archivesId: this.arcId |
|
|
|
} |
|
|
|
|
|
|
|
FetchInitDocumentDetailsList(params).then(data => { |
|
|
|
// id,parents_id,reg_no,details_type,pass_location,read_type,tid,is_destroy,create_by,create_time,update_by,update_time |
|
|
|
// id,公文id,登记号,文件类别(1.原文 2.复印件),传阅所在位置,传阅状态,tid,是否销毁,创建人,创建时间,更新人,更新时间 |
|
|
|
const jsonData = this.convertData(data) |
|
|
|
const fileOriginal = jsonData.filter(item => item.details_type === 1) |
|
|
|
console.log('jsonData', jsonData) |
|
|
|
console.log('fileOriginal', fileOriginal) |
|
|
|
this.bindingTag(fileOriginal[0]) |
|
|
|
}).catch(error => { |
|
|
|
console.error('获取文档详情列表失败:', error) |
|
|
|
}) |
|
|
|
}, |
|
|
|
convertData(data) { |
|
|
|
return data.map(item => { |
|
|
|
const fieldNames = [ |
|
|
|
'id', 'parents_id', 'reg_no', 'details_type', 'pass_location', |
|
|
|
'read_type', 'tid', 'is_destroy', 'create_by', 'create_time', |
|
|
|
'update_by', 'update_time' |
|
|
|
] |
|
|
|
const obj = {} |
|
|
|
fieldNames.forEach((field, index) => { |
|
|
|
obj[field] = item[index] |
|
|
|
}) |
|
|
|
return obj |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 绑定标签 |
|
|
|
bindingTag(row) { |
|
|
|
console.log('bindingTag', row) |
|
|
|
if (row.tid && (row.tid !== '' || row.tid !== null)) { |
|
|
|
this.$confirm('该原件已绑定' + '<span>是否重新绑定?</span>', '提示', { |
|
|
|
confirmButtonText: '重新绑定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning', |
|
|
|
dangerouslyUseHTMLString: true |
|
|
|
}).then(() => { |
|
|
|
this.handlBind(row, 'hasLabel') |
|
|
|
}).catch(() => { |
|
|
|
this.closeDialog() |
|
|
|
this.crud.refresh() |
|
|
|
this.refreshTreeList() |
|
|
|
this.bindSaveLoading = false |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.handlBind(row) |
|
|
|
} |
|
|
|
}, |
|
|
|
handlBind(row, type) { |
|
|
|
console.log('row', row) |
|
|
|
const sDevID = process.env.NODE_ENV === 'production' ? window.g.sDevID : process.env.VUE_APP_SDEVID |
|
|
|
const param = { |
|
|
|
'sDevID': sDevID |
|
|
|
} |
|
|
|
FetchReadGW(param).then((res) => { |
|
|
|
if (!res) { |
|
|
|
this.$message({ message: '绑定失败', type: 'error', offset: 8 }) |
|
|
|
this.bindSaveLoading = false |
|
|
|
} else { |
|
|
|
const result = JSON.parse(res) |
|
|
|
console.log('result', result) |
|
|
|
if (result.code === '0') { |
|
|
|
console.log('读取成功') |
|
|
|
// let coverLabel |
|
|
|
// if (type === 'hasLabel' && row.tid === result.data[0].uid) { |
|
|
|
// coverLabel = true |
|
|
|
// } else { |
|
|
|
// coverLabel = false |
|
|
|
// } |
|
|
|
const documentId = this.selectedDocument.isType === 2 |
|
|
|
? this.selectedDocument.id |
|
|
|
: this.selectedDocument.documentId |
|
|
|
const data = { |
|
|
|
coverLabel: !!type, |
|
|
|
documentId: documentId, // 公文库id |
|
|
|
parentsId: row.id, // 需要绑定的公文id |
|
|
|
detailsType: row.details_type, |
|
|
|
labelType: 1, // 目前只能绑定公文 填1就好了 |
|
|
|
tid: result.data[0].uid, // 标签读取的id |
|
|
|
eas: '1' // 这个和以前一样写吧 |
|
|
|
} |
|
|
|
console.log('data', data) |
|
|
|
FetchBingdingLabel(data).then((res) => { |
|
|
|
console.log('FetchBingdingLabel', res) |
|
|
|
if (res === '当前标签已被绑定') { |
|
|
|
this.$message({ message: '当前标签已被绑定', type: 'error', offset: 8 }) |
|
|
|
} else { |
|
|
|
this.$message({ message: '绑定成功', type: 'success', offset: 8 }) |
|
|
|
} |
|
|
|
this.closeDialog() |
|
|
|
this.bindSaveLoading = false |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
const selectedItem = this.crud.selections[0] |
|
|
|
this.tableDoubleClick(selectedItem) |
|
|
|
|
|
|
|
this.refreshTreeList() |
|
|
|
this.crud.refresh() |
|
|
|
}, 500) |
|
|
|
}).catch(error => { |
|
|
|
console.error(error) |
|
|
|
this.bindSaveLoading = false |
|
|
|
}) |
|
|
|
} else if (result.code === '-1') { |
|
|
|
this.$message({ message: result.message, type: 'error', offset: 8 }) |
|
|
|
this.bindSaveLoading = false |
|
|
|
} else if (result.code === '-1000') { |
|
|
|
// 读写器超时未响应 |
|
|
|
this.$message({ message: result.message, type: 'error', offset: 8 }) |
|
|
|
this.bindSaveLoading = false |
|
|
|
} |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
console.error(error) |
|
|
|
this.bindSaveLoading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
clickRowHandler(row) { |
|
|
|
this.$refs.table.clearSelection() |
|
|
@ -508,12 +649,15 @@ export default { |
|
|
|
} else { |
|
|
|
documentId = this.selectedDocument.documentId |
|
|
|
} |
|
|
|
console.log('this.selectedDocument', this.selectedDocument) |
|
|
|
const params = { |
|
|
|
'documentId': documentId, |
|
|
|
'ids': ids, |
|
|
|
'docDepartment': type === '1' ? this.selectedDocument.dictionaryName : null, |
|
|
|
'archivesYear': type === '1' ? this.selectedDocument.label : null |
|
|
|
'docDepartment': type === '1' ? (this.selectedDocument.isType === 4 ? this.selectedDocument.dictionaryName : this.selectedDocument.label) : null, |
|
|
|
'archivesYear': type === '1' ? (this.selectedDocument.isType === 4 ? this.selectedDocument.label : null) : null, |
|
|
|
'search': type === '1' ? this.search : null |
|
|
|
} |
|
|
|
console.log('exportFile', params) |
|
|
|
exportFile(this.baseApi + '/api/documentArchives/downloadDocumentArchives?' + qs.stringify(params, { indices: false, allowDots: true, skipNulls: false })) |
|
|
|
if (type === '0') { |
|
|
|
this.crud.downloadLoading = false |
|
|
|