档案管理
This commit is contained in:
parent
8a77ac592f
commit
095b9006b4
|
|
@ -115,3 +115,21 @@ export function getFileManageByIdApi(params) {
|
||||||
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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -47,8 +47,7 @@
|
||||||
:before-upload="beforeUpload"
|
:before-upload="beforeUpload"
|
||||||
:auto-upload="false"
|
:auto-upload="false"
|
||||||
:limit="1"
|
:limit="1"
|
||||||
accept=".pdf,.jpg,.jpeg,.png"
|
accept=".pdf,.jpg,.jpeg,.png">
|
||||||
:http-request="customUpload">
|
|
||||||
<el-button size="small" type="primary" icon="el-icon-upload" :disabled="fileList.length > 0">选择文件</el-button>
|
<el-button size="small" type="primary" icon="el-icon-upload" :disabled="fileList.length > 0">选择文件</el-button>
|
||||||
<div slot="tip" class="el-upload__tip">
|
<div slot="tip" class="el-upload__tip">
|
||||||
<span style="color: #f00;">
|
<span style="color: #f00;">
|
||||||
|
|
@ -182,7 +181,7 @@ export default {
|
||||||
|
|
||||||
const res2 = await getFileManageByIdApi({id:this.rowData.id});
|
const res2 = await getFileManageByIdApi({id:this.rowData.id});
|
||||||
const obj =res2.data;
|
const obj =res2.data;
|
||||||
console.error(obj);
|
|
||||||
// 编辑模式:填充表单数据
|
// 编辑模式:填充表单数据
|
||||||
this.form = {
|
this.form = {
|
||||||
id: obj.id,
|
id: obj.id,
|
||||||
|
|
@ -196,6 +195,8 @@ export default {
|
||||||
level: 5,
|
level: 5,
|
||||||
proId:this.projectId
|
proId:this.projectId
|
||||||
};
|
};
|
||||||
|
const fileList = [{name:obj.fileName,businessId:obj.businessId}];
|
||||||
|
this.fileList = fileList;
|
||||||
} else {
|
} else {
|
||||||
const res = await getFileManageByIdApi({id:this.rowData.id});
|
const res = await getFileManageByIdApi({id:this.rowData.id});
|
||||||
const obj =res.data;
|
const obj =res.data;
|
||||||
|
|
@ -255,6 +256,9 @@ export default {
|
||||||
},
|
},
|
||||||
// 上传前对文件进行验证
|
// 上传前对文件进行验证
|
||||||
beforeUpload(file) {
|
beforeUpload(file) {
|
||||||
|
if(!(file instanceof File)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
const isValidType = this.checkFileType(file)
|
const isValidType = this.checkFileType(file)
|
||||||
const isValidSize = this.checkFileSize(file)
|
const isValidSize = this.checkFileSize(file)
|
||||||
|
|
||||||
|
|
@ -305,6 +309,9 @@ export default {
|
||||||
},
|
},
|
||||||
// 移除文件
|
// 移除文件
|
||||||
handleRemove(file, fileList) {
|
handleRemove(file, fileList) {
|
||||||
|
if(!(file instanceof File)){
|
||||||
|
this.form.businessId = file.businessId;
|
||||||
|
}
|
||||||
this.fileList = fileList
|
this.fileList = fileList
|
||||||
},
|
},
|
||||||
// 文件状态改变
|
// 文件状态改变
|
||||||
|
|
@ -316,49 +323,7 @@ export default {
|
||||||
}
|
}
|
||||||
console.log('文件列表更新:', fileList.length, '个文件')
|
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) {
|
submitForm(formName) {
|
||||||
this.$refs[formName].validate(valid => {
|
this.$refs[formName].validate(valid => {
|
||||||
|
|
@ -385,7 +350,9 @@ export default {
|
||||||
let params = _.cloneDeep(this.form);
|
let params = _.cloneDeep(this.form);
|
||||||
if(this.fileList.length > 0){
|
if(this.fileList.length > 0){
|
||||||
this.fileList.map(file => {
|
this.fileList.map(file => {
|
||||||
|
if(file instanceof File){
|
||||||
formData.append('file', file.raw);
|
formData.append('file', file.raw);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (this.isAdd === 'add') {
|
if (this.isAdd === 'add') {
|
||||||
|
|
@ -403,6 +370,8 @@ export default {
|
||||||
// this.$modal.msgError('提交失败,请重试');
|
// this.$modal.msgError('提交失败,请重试');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
formData.append('params', JSON.stringify(params));
|
||||||
|
console.log(params);
|
||||||
updateFileManageRightApi(formData).then(res => {
|
updateFileManageRightApi(formData).then(res => {
|
||||||
this.loading.close();
|
this.loading.close();
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,10 @@
|
||||||
<el-card class="toolbar-card">
|
<el-card class="toolbar-card">
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<div class="toolbar-left">
|
<div class="toolbar-left">
|
||||||
<el-button type="warning" plain icon="el-icon-bottom" size="mini" @click="handleClose">档案抽取</el-button>
|
<el-button type="warning" plain icon="el-icon-bottom" size="mini"
|
||||||
<el-button type="success" plain icon="el-icon-finished" size="mini" @click="handleClose">移交清单确认</el-button>
|
@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>
|
<el-button type="danger" plain icon="el-icon-close" size="mini" @click="handleClose">返回</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -24,6 +26,7 @@
|
||||||
<script>
|
<script>
|
||||||
import LeftTree from './components/leftTree.vue'
|
import LeftTree from './components/leftTree.vue'
|
||||||
import RightTable from './components/rightTable.vue'
|
import RightTable from './components/rightTable.vue'
|
||||||
|
import { fileExtractApi, updateIntegrityStatusApi } from '@/api/archivesManagement/fileManager/fileManager'
|
||||||
export default {
|
export default {
|
||||||
name: 'FileData',
|
name: 'FileData',
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -51,6 +54,39 @@ export default {
|
||||||
handleNodeClick(data) {
|
handleNodeClick(data) {
|
||||||
this.selectedNode = 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>
|
</script>
|
||||||
|
|
@ -82,7 +118,8 @@ export default {
|
||||||
min-height: calc(100vh - 200px);
|
min-height: calc(100vh - 200px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.pane-left, .pane-right {
|
.pane-left,
|
||||||
|
.pane-right {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue