档案管理
This commit is contained in:
parent
8a77ac592f
commit
095b9006b4
|
|
@ -114,4 +114,22 @@ export function getFileManageByIdApi(params) {
|
|||
method: 'get',
|
||||
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
|
||||
})
|
||||
}
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -3,11 +3,13 @@
|
|||
<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>
|
||||
|
||||
|
||||
</div>
|
||||
</el-card>
|
||||
<el-row :gutter="24" class="content-row">
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue