档案管理

This commit is contained in:
cwchen 2025-09-17 11:30:01 +08:00
parent a7ec726fec
commit 9876e6c542
6 changed files with 242 additions and 73 deletions

View File

@ -174,10 +174,10 @@ export default {
} else { } else {
// //
this.form = { this.form = {
parentId: this.rowData.id, parentId: this.rowData && this.rowData.id ? this.rowData.id : undefined,
contentName: null, contentName: null,
sort: 0, sort: 0,
level:this.rowData.level level:this.rowData && this.rowData.level ? this.rowData.level : undefined
}; };
value = this.rowData.id; value = this.rowData.id;
} }

View File

@ -65,6 +65,7 @@ export default {
originalTreeData: [], // , originalTreeData: [], // ,
isflag: false, isflag: false,
isAdd: '', isAdd: '',
title:'',
row: {}, row: {},
selectedNodeId: null, // ID selectedNodeId: null, // ID
delArchiveApi delArchiveApi
@ -111,8 +112,10 @@ export default {
this.title = "新增"; this.title = "新增";
this.isAdd = 'add'; this.isAdd = 'add';
this.isflag = true; this.isflag = true;
this.row = data; if(data){
this.row.level = Number(data.level) + 1 this.row = data;
this.row.level = Number(data.level) + 1
}
}, },
/* 修改树节点 */ /* 修改树节点 */
editTree(row, data) { editTree(row, data) {

View File

@ -12,16 +12,16 @@
placeholder="请输入文件题名" maxlength="64" :disabled="detailStatus"></el-input> placeholder="请输入文件题名" maxlength="64" :disabled="detailStatus"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="案卷期限" prop="term"> <el-form-item label="案卷期限" prop="term">
<el-input class="form-item" v-model="form.term" clearable show-word-limit <el-input class="form-item" v-model="form.term" clearable show-word-limit placeholder="请输入案卷期限"
placeholder="请输入案卷期限" maxlength="32" :disabled="detailStatus"></el-input> maxlength="32" :disabled="detailStatus"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="归档责任单位" prop="unitName"> <el-form-item label="归档责任单位" prop="unitName">
<el-input class="form-item" v-model="form.unitName" clearable show-word-limit <el-input class="form-item" v-model="form.unitName" clearable show-word-limit
placeholder="请输入归档责任单位" maxlength="32" :disabled="detailStatus"></el-input> placeholder="请输入归档责任单位" maxlength="32" :disabled="detailStatus"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="所属专业" prop="major"> <el-form-item label="所属专业" prop="major">
<el-input class="form-item" v-model="form.major" clearable show-word-limit <el-input class="form-item" v-model="form.major" clearable show-word-limit placeholder="请输入所属专业"
placeholder="请输入所属专业" maxlength="32" :disabled="detailStatus"></el-input> maxlength="32" :disabled="detailStatus"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="档案标识代码" prop="markCode"> <el-form-item label="档案标识代码" prop="markCode">
<el-select class="form-item" v-model="form.markCode" :disabled="detailStatus" filterable clearable <el-select class="form-item" v-model="form.markCode" :disabled="detailStatus" filterable clearable
@ -31,10 +31,32 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="文件分类标记" prop="classifyMark"> <el-form-item label="文件分类标记" prop="classifyMark">
<el-select class="form-item" v-model="form.classifyMark" :disabled="detailStatus" filterable clearable> <el-select class="form-item" v-model="form.classifyMark" :disabled="detailStatus" filterable
<el-option v-for="item in classifyMarkList" :key="item.id" :label="item.name" :value="item.id"></el-option> clearable>
<el-option v-for="item in classifyMarkList" :key="item.id" :label="item.name"
:value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="附件上传" v-if="!detailStatus">
<el-upload
ref="upload"
:action="uploadUrl"
:headers="uploadHeaders"
:data="uploadData"
:file-list="fileList"
:before-upload="beforeUpload"
:on-success="handleUploadSuccess"
:on-error="handleUploadError"
:on-remove="handleRemove"
:auto-upload="false"
:limit="1"
accept=".pdf,.jpg,.jpeg,.png,.gif,.bmp">
<el-button size="small" type="primary" icon="el-icon-upload">选择文件</el-button>
<div slot="tip" class="el-upload__tip">
只能上传PDF和图片文件且不超过10MB
</div>
</el-upload>
</el-form-item>
</el-form> </el-form>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -50,18 +72,19 @@ import {
addArchiveRightApi, addArchiveRightApi,
editArchiveRightApi, editArchiveRightApi,
} from '@/api/archivesManagement/index.js' } from '@/api/archivesManagement/index.js'
import {getClassifyMarkSelApi} from '@/api/select.js' import { getClassifyMarkSelApi } from '@/api/select.js'
import { getToken } from '@/utils/auth'
export default { export default {
name: "FileAddTableData", name: "FileAddTableData",
props: ["width", "dataForm", "title", "disabled", "isAdd", "rowData","projectId"], props: ["width", "dataForm", "title", "disabled", "isAdd", "rowData", "projectId"],
dicts: ['mark_code'], dicts: ['mark_code','file_size_limit'],
data() { data() {
return { return {
lDialog: this.width > 500 ? "w700" : "w500", lDialog: this.width > 500 ? "w700" : "w500",
dialogVisible: true, dialogVisible: true,
isDisabled: true, isDisabled: true,
getClassifyMarkSelApi, getClassifyMarkSelApi,
classifyMarkList : [], classifyMarkList: [],
form: { form: {
contentName: null, contentName: null,
term: null, term: null,
@ -70,9 +93,17 @@ export default {
markCode: null, markCode: null,
classifyMark: null, classifyMark: null,
}, },
belongName:'', belongName: '',
loading: null, loading: null,
detailStatus:false, detailStatus: false,
//
fileList: [],
uploadUrl: process.env.VUE_APP_BASE_API + '/smartArchives/file/upload',
uploadHeaders: {
'Authorization': 'Bearer ' + getToken()
},
uploadData: {},
maxFileSize: 10 * 1024 * 1024, // 10MB
rules: { rules: {
contentName: [ contentName: [
{ required: true, message: '文件题名不能为空', trigger: 'blur' } { required: true, message: '文件题名不能为空', trigger: 'blur' }
@ -98,13 +129,32 @@ export default {
created() { created() {
this.initFormData(); this.initFormData();
}, },
mounted() {
// mounted
this.$nextTick(() => {
if (this.dict && this.dict.type && this.dict.type.file_size_limit) {
const fileSizeLimit = this.dict.type.file_size_limit;
if (Array.isArray(fileSizeLimit) && fileSizeLimit.length > 0) {
const firstValue = fileSizeLimit[0].value;
//
if (firstValue && !isNaN(firstValue)) {
this.maxFileSize = parseInt(firstValue);
}
}
}
});
},
methods: { methods: {
/** 初始化表单数据 */ /** 初始化表单数据 */
async initFormData() { async initFormData() {
const res = await getClassifyMarkSelApi(); //
this.classifyMarkList = res.data; await this.$nextTick();
this.belongName = this.rowData.belongName; const fileSizeLimit = this.dict.type.file_size_limit;
this.detailStatus = this.rowData.detailStatus; const firstFileSizeLimit = fileSizeLimit && Array.isArray(fileSizeLimit) && fileSizeLimit.length > 0 ? fileSizeLimit[0].value : null;
const res = await getClassifyMarkSelApi();
this.classifyMarkList = res.data;
this.belongName = this.rowData.belongName;
this.detailStatus = this.rowData.detailStatus;
if ((this.isAdd === 'edit' || this.isAdd === 'detail') && this.rowData) { if ((this.isAdd === 'edit' || this.isAdd === 'detail') && this.rowData) {
// //
this.form = { this.form = {
@ -115,8 +165,8 @@ export default {
unitName: this.rowData.unitName || null, unitName: this.rowData.unitName || null,
markCode: this.rowData.markCode || null, markCode: this.rowData.markCode || null,
classifyMark: this.rowData.classifyMark || null, classifyMark: this.rowData.classifyMark || null,
parentId:this.rowData.parentId || null, parentId: this.rowData.parentId || null,
level:4 level: 4
}; };
} else { } else {
// //
@ -127,8 +177,8 @@ export default {
major: null, major: null,
markCode: null, markCode: null,
classifyMark: null, classifyMark: null,
parentId:this.rowData.id || null, parentId: this.rowData.id || null,
level:4 level: 4
}; };
} }
}, },
@ -157,9 +207,11 @@ export default {
major: null, major: null,
markCode: null, markCode: null,
classifyMark: null, classifyMark: null,
parentId:null, parentId: null,
level:4 level: 4
}; };
this.fileList = [];
this.$refs.upload && this.$refs.upload.clearFiles();
this.resetForm("ruleForm"); this.resetForm("ruleForm");
}, },
handleReuslt(res) { handleReuslt(res) {
@ -168,46 +220,159 @@ export default {
this.$emit('handleQuery'); this.$emit('handleQuery');
this.handleClose(); this.handleClose();
}, },
//
beforeUpload(file) {
const isValidType = this.checkFileType(file)
const isValidSize = this.checkFileSize(file)
if (!isValidType) {
this.$message.error('只能上传PDF和图片文件')
return false
}
if (!isValidSize) {
this.$message.error('文件大小不能超过10MB')
return false
}
//
if (this.fileList.length >= 1) {
this.$message.warning('只能上传一个文件,请先删除现有文件!')
return false
}
//
this.uploadData = {
projectId: this.projectId,
categoryId: this.form.parentId || 0,
description: this.form.contentName || ''
}
return true
},
//
checkFileType(file) {
const allowedTypes = [
'application/pdf',
'image/jpeg',
'image/jpg',
'image/png',
'image/gif',
'image/bmp'
]
return allowedTypes.includes(file.type)
},
//
checkFileSize(file) {
const maxSize = this.maxFileSize || (10 * 1024 * 1024) // 使10MB
return file.size <= maxSize
},
//
handleUploadSuccess(response, file, fileList) {
if (response.code === 200) {
this.$message.success('文件上传成功!')
} else {
this.$message.error(response.msg || '上传失败')
}
},
//
handleUploadError(error, file, fileList) {
this.$message.error('文件上传失败,请重试')
console.error('Upload error:', error)
},
//
handleRemove(file, fileList) {
this.fileList = fileList
},
//
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 => {
if (valid) { if (valid) {
// //
this.loading = this.$loading({ if (this.fileList.length > 0) {
lock: true, this.uploadFiles().then(() => {
text: "数据提交中,请稍候...", this.submitFormData();
background: 'rgba(0,0,0,0.5)',
target: this.$el.querySelector('.el-dialog') || document.body
})
let params = _.cloneDeep(this.form);
if (this.isAdd === 'add') {
addArchiveRightApi(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => { }).catch(error => {
this.loading.close(); this.$message.error('文件上传失败,请重试');
// this.$modal.msgError('');
}); });
} else { } else {
editArchiveRightApi(params).then(res => { this.submitFormData();
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
// this.$modal.msgError('');
});
} }
} }
}); });
},
//
submitFormData() {
//
this.loading = this.$loading({
lock: true,
text: "数据提交中,请稍候...",
background: 'rgba(0,0,0,0.5)',
target: this.$el.querySelector('.el-dialog') || document.body
})
let params = _.cloneDeep(this.form);
if (this.isAdd === 'add') {
addArchiveRightApi(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
// this.$modal.msgError('');
});
} else {
editArchiveRightApi(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
// this.$modal.msgError('');
});
}
} }
} }
}; };

View File

@ -34,19 +34,17 @@ import _ from 'lodash'
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { getFileManageTreeByAddOrUpdateApi, addFileManageLeftApi, updateFileManageLeftApi,geMaxSortApi } from '@/api/archivesManagement/fileManager/fileManager.js' import { getFileManageTreeByAddOrUpdateApi, addFileManageLeftApi, updateFileManageLeftApi,geMaxSortApi } from '@/api/archivesManagement/fileManager/fileManager.js'
import { Alert } from 'element-ui';
export default { export default {
name: "FileAddTreeData", name: "FileAddTreeData",
props: ["width", "dataForm", "title", "disabled", "isAdd", "rowData"], props: ["width", "dataForm", "title", "disabled", "isAdd", "rowData","projectId"],
components: { Treeselect }, components: { Treeselect },
props: ["projectId"],
data() { data() {
return { return {
lDialog: this.width > 500 ? "w700" : "w500", lDialog: this.width > 500 ? "w700" : "w500",
dialogVisible: true, dialogVisible: true,
isDisabled: true, isDisabled: true,
form: { form: {
parentId: '', parentId: undefined,
contentName: '', contentName: '',
sort: 1, sort: 1,
}, },
@ -168,7 +166,7 @@ export default {
// //
this.form = { this.form = {
id: this.rowData.id, id: this.rowData.id,
parentId: this.rowData.parentId || 0, parentId: this.rowData.parentId || undefined,
contentName: this.rowData.label || null, contentName: this.rowData.label || null,
sort: this.rowData.sort || 0, sort: this.rowData.sort || 0,
level:this.rowData.level, level:this.rowData.level,
@ -178,10 +176,10 @@ export default {
} else { } else {
// //
this.form = { this.form = {
parentId: this.rowData.id, parentId: this.rowData && this.rowData.id ? this.rowData.id : undefined,
contentName: null, contentName: null,
sort: 0, sort: 0,
level:this.rowData.level, level:this.rowData && this.rowData.level ? this.rowData.level : undefined,
proId:this.projectId proId:this.projectId
}; };
value = this.rowData.id; value = this.rowData.id;
@ -203,8 +201,8 @@ export default {
} }
return data.map(item => { return data.map(item => {
// 3 // 4
if (item.level === 3) { if (item.level === 4) {
return null; return null;
} }

View File

@ -47,7 +47,7 @@
</div> </div>
</el-card> </el-card>
<!-- 树的操作新增修改 --> <!-- 树的操作新增修改 -->
<AddTreeData v-if="isflag" :isAdd="isAdd" :rowData="row" :title="title" @closeDialog="closeDialog" <FileAddTreeData v-if="isflag" :isAdd="isAdd" :rowData="row" :title="title" @closeDialog="closeDialog"
@showColose="showColose" :dataForm="row" :width="600" :projectId="projectId" /> @showColose="showColose" :dataForm="row" :width="600" :projectId="projectId" />
</div> </div>
@ -55,10 +55,10 @@
<script> <script>
import { getFileManageTreeApi, delFileManageApi } from '@/api/archivesManagement/fileManager/fileManager.js' import { getFileManageTreeApi, delFileManageApi } from '@/api/archivesManagement/fileManager/fileManager.js'
import AddTreeData from './addTreeData.vue' import FileAddTreeData from './addTreeData.vue'
export default { export default {
name: 'FileLeftTree', name: 'FileLeftTree',
components: { AddTreeData }, components: { FileAddTreeData },
props: ["projectId"], props: ["projectId"],
data() { data() {
return { return {
@ -67,6 +67,7 @@ export default {
originalTreeData: [], // , originalTreeData: [], // ,
isflag: false, isflag: false,
isAdd: '', isAdd: '',
title: '',
row: {}, row: {},
selectedNodeId: null, // ID selectedNodeId: null, // ID
delFileManageApi delFileManageApi
@ -113,8 +114,10 @@ export default {
this.title = "新增"; this.title = "新增";
this.isAdd = 'add'; this.isAdd = 'add';
this.isflag = true; this.isflag = true;
this.row = data; if(data){
this.row.level = Number(data.level) + 1 this.row = data;
this.row.level = Number(data.level) + 1
}
}, },
/* 修改树节点 */ /* 修改树节点 */
editTree(row, data) { editTree(row, data) {
@ -159,7 +162,6 @@ export default {
} }
return data.map(item => { return data.map(item => {
console.log(item);
const node = { const node = {
id: item.id, id: item.id,
@ -201,7 +203,6 @@ export default {
const res = await getFileManageTreeApi({proId:this.projectId}) const res = await getFileManageTreeApi({proId:this.projectId})
const transformedData = this.convertToVueTree(res.data) const transformedData = this.convertToVueTree(res.data)
this.treeDataList = transformedData; this.treeDataList = transformedData;
console.log(this.treeDataList);
// //
this.originalTreeData = JSON.parse(JSON.stringify(this.treeDataList)) this.originalTreeData = JSON.parse(JSON.stringify(this.treeDataList))

View File

@ -91,6 +91,8 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
console.log(this.selectedNode);
this.title = "新增"; this.title = "新增";
this.isAdd = 'add'; this.isAdd = 'add';
this.isflag = true; this.isflag = true;