档案管理

This commit is contained in:
cwchen 2025-09-18 09:42:48 +08:00
parent 8a77ac592f
commit 095b9006b4
3 changed files with 78 additions and 54 deletions

View File

@ -115,3 +115,21 @@ export function getFileManageByIdApi(params) {
params
})
}
// 档案移交确认
export function updateIntegrityStatusApi(params) {
return request({
url: '/smartArchives/fileManage/updateIntegrityStatus',
method: 'get',
params
})
}
// 档案抽取
export function fileExtractApi(data) {
return request({
url: '/smartArchives/fileManage/fileExtract',
method: 'post',
data
})
}

View File

@ -47,8 +47,7 @@
:before-upload="beforeUpload"
:auto-upload="false"
:limit="1"
accept=".pdf,.jpg,.jpeg,.png"
:http-request="customUpload">
accept=".pdf,.jpg,.jpeg,.png">
<el-button size="small" type="primary" icon="el-icon-upload" :disabled="fileList.length > 0">选择文件</el-button>
<div slot="tip" class="el-upload__tip">
<span style="color: #f00;">
@ -182,7 +181,7 @@ export default {
const res2 = await getFileManageByIdApi({id:this.rowData.id});
const obj =res2.data;
console.error(obj);
//
this.form = {
id: obj.id,
@ -196,6 +195,8 @@ export default {
level: 5,
proId:this.projectId
};
const fileList = [{name:obj.fileName,businessId:obj.businessId}];
this.fileList = fileList;
} else {
const res = await getFileManageByIdApi({id:this.rowData.id});
const obj =res.data;
@ -255,6 +256,9 @@ export default {
},
//
beforeUpload(file) {
if(!(file instanceof File)){
return true;
}
const isValidType = this.checkFileType(file)
const isValidSize = this.checkFileSize(file)
@ -305,6 +309,9 @@ export default {
},
//
handleRemove(file, fileList) {
if(!(file instanceof File)){
this.form.businessId = file.businessId;
}
this.fileList = fileList
},
//
@ -316,49 +323,7 @@ export default {
}
console.log('文件列表更新:', fileList.length, '个文件')
},
//
customUpload(options) {
//
console.log('自定义上传:', options)
return Promise.resolve()
},
//
uploadFiles() {
return new Promise((resolve, reject) => {
if (this.fileList.length === 0) {
resolve();
return;
}
let uploadPromises = this.fileList.map(file => {
return new Promise((fileResolve, fileReject) => {
const formData = new FormData();
formData.append('file', file.raw);
formData.append('projectId', this.projectId);
formData.append('categoryId', this.form.parentId || 0);
formData.append('description', this.form.contentName || '');
this.$http.post(this.uploadUrl, formData, {
headers: this.uploadHeaders
}).then(response => {
if (response.data.code === 200) {
fileResolve(response.data);
} else {
fileReject(new Error(response.data.msg || '上传失败'));
}
}).catch(error => {
fileReject(error);
});
});
});
Promise.all(uploadPromises).then(() => {
resolve();
}).catch(error => {
reject(error);
});
});
},
/**验证 */
submitForm(formName) {
this.$refs[formName].validate(valid => {
@ -385,7 +350,9 @@ export default {
let params = _.cloneDeep(this.form);
if(this.fileList.length > 0){
this.fileList.map(file => {
formData.append('file', file.raw);
if(file instanceof File){
formData.append('file', file.raw);
}
})
}
if (this.isAdd === 'add') {
@ -403,6 +370,8 @@ export default {
// this.$modal.msgError('');
});
} else {
formData.append('params', JSON.stringify(params));
console.log(params);
updateFileManageRightApi(formData).then(res => {
this.loading.close();
if (res.code === 200) {

View File

@ -3,8 +3,10 @@
<el-card class="toolbar-card">
<div class="toolbar">
<div class="toolbar-left">
<el-button type="warning" plain icon="el-icon-bottom" size="mini" @click="handleClose">档案抽取</el-button>
<el-button type="success" plain icon="el-icon-finished" size="mini" @click="handleClose">移交清单确认</el-button>
<el-button type="warning" plain icon="el-icon-bottom" size="mini"
@click="handleFileExtract">档案抽取</el-button>
<el-button type="success" plain icon="el-icon-finished" size="mini"
@click="handleUpdateIntegrityStatus">移交清单确认</el-button>
<el-button type="danger" plain icon="el-icon-close" size="mini" @click="handleClose">返回</el-button>
</div>
@ -15,7 +17,7 @@
<LeftTree @handleNodeClick="handleNodeClick" :projectId="projectId" />
</el-col>
<el-col :span="16" class="pane-right">
<RightTable :selectedNode = "selectedNode" :projectId="projectId"/>
<RightTable :selectedNode="selectedNode" :projectId="projectId" />
</el-col>
</el-row>
</div>
@ -24,6 +26,7 @@
<script>
import LeftTree from './components/leftTree.vue'
import RightTable from './components/rightTable.vue'
import { fileExtractApi, updateIntegrityStatusApi } from '@/api/archivesManagement/fileManager/fileManager'
export default {
name: 'FileData',
components: {
@ -51,6 +54,39 @@ export default {
handleNodeClick(data) {
this.selectedNode = data;
},
//
handleFileExtract() {
//
const loadingInstance = this.$loading({
lock: true,
text: '档案同步中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
//
fileExtractApi({ projectId: this.projectId })
.then(res => {
//
loadingInstance.close();
if (res.code === 200) {
this.$message.success('同步档案已完成');
} else {
this.$message.error(res.msg || '档案同步失败');
}
})
.catch(error => {
//
loadingInstance.close();
this.$message.error('档案同步失败,请重试');
console.error('档案抽取失败:', error);
});
},
//
handleUpdateIntegrityStatus() {
}
}
}
</script>
@ -70,7 +106,7 @@ export default {
justify-content: space-between;
}
.toolbar-left :deep(.el-button) + :deep(.el-button) {
.toolbar-left :deep(.el-button)+ :deep(.el-button) {
margin-left: 8px;
}
@ -82,11 +118,12 @@ export default {
min-height: calc(100vh - 200px);
}
.pane-left, .pane-right {
.pane-left,
.pane-right {
background: #fff;
border-radius: 6px;
height: 100%;
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.pane-left {