Browse Source

预归档库

master
xuhuajiao 1 year ago
parent
commit
2a5134fd1f
  1. 12
      src/api/prearchiveLibrary/prearchiveLibrary.js
  2. 211
      src/views/components/category/PreviewForm.vue
  3. 89
      src/views/prearchiveLibrary/index.vue
  4. 4
      src/views/system/fileLibraryManage/fieldManage/index.vue

12
src/api/prearchiveLibrary/prearchiveLibrary.js

@ -24,7 +24,7 @@ export function add(data) {
}) })
} }
export function edit(data) {
export function prearchEdit(data) {
return request({ return request({
url: 'api/re-document/editDocument', url: 'api/re-document/editDocument',
method: 'post', method: 'post',
@ -49,4 +49,12 @@ export function FetchDoeditDocument(params) {
}) })
} }
export default { add, edit, del, FetchInitPreDocument, FetchInitDocumentsViewTable, FetchDoeditDocument }
export function FetchReDoeditIsRepeat(params) {
return request({
url: 'api/re-document/doeditIsRepeat',
method: 'get',
params
})
}
export default { add, prearchEdit, del, FetchInitPreDocument, FetchInitDocumentsViewTable, FetchDoeditDocument }

211
src/views/components/category/PreviewForm.vue

@ -53,20 +53,18 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row v-if="isDesFormType === 'prearchiveLibrary'" class="preview-form-bottom"> <el-row v-if="isDesFormType === 'prearchiveLibrary'" class="preview-form-bottom">
<el-col class="upload-wm">
<el-form-item label="电子原件" prop="fileOriginal">
<el-input v-model="fileOriginal" type="text" style="width: 420px" />
<el-upload
class="upload-btn"
:action="upload_qiniu_url"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:on-error="handleError"
:before-upload="beforeAvatarUpload"
:data="qiniuData"
>
<el-col>
<el-form-item label="电子原件" prop="fileOriginal" class="prearch-upload">
<el-input
v-model="fileOriginal"
type="text"
style="width: 446px"
readonly
/>
<div class="upload-btn">
<input id="upFile" type="file" name="upFile" @change="changeFile($event)">
<el-button size="small" type="primary"><i class="iconfont icon-shangchuan" />上传</el-button> <el-button size="small" type="primary"><i class="iconfont icon-shangchuan" />上传</el-button>
</el-upload>
</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -91,13 +89,13 @@
<script> <script>
import { crud } from '@crud/crud' import { crud } from '@crud/crud'
import { edit, FetchDoeditIsRepeat } from '@/api/archivesManage/archivesList' import { edit, FetchDoeditIsRepeat } from '@/api/archivesManage/archivesList'
import { prearchEdit } from '@/api/prearchiveLibrary/prearchiveLibrary'
import { prearchEdit, FetchReDoeditIsRepeat } from '@/api/prearchiveLibrary/prearchiveLibrary'
import { getNoFormatField } from '@/api/system/category/fileNoFormat' import { getNoFormatField } from '@/api/system/category/fileNoFormat'
import draggable from 'vuedraggable' import draggable from 'vuedraggable'
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 { FetchFindAllSubsetById } from '@/api/archivesConfig/dictDetail' import { FetchFindAllSubsetById } from '@/api/archivesConfig/dictDetail'
import { parseTime } from '@/utils/index.js'
import { parseTime, getCurrentTime } from '@/utils/index'
export default { export default {
name: 'PreviewForm', name: 'PreviewForm',
@ -165,14 +163,15 @@ export default {
children: node.childMenus children: node.childMenus
} }
}, },
qiniuData: {
key: '',
token: ''
},
//
upload_qiniu_url: 'https://upload.qiniup.com/',
//
upload_qiniu_addr: 'qiniu.aiyxlib.com'
file: null, // change
fileNames: '', // - name
formatType: '', // - type
postfix: '', // -
fileSize: '', // -
filePath: '', // - path
px: '', // -
nowDate: '', //
fileJsonString: null
} }
}, },
watch: { watch: {
@ -306,31 +305,51 @@ export default {
}, },
// api // api
handlerIsRepeat(params, item) { handlerIsRepeat(params, item) {
if (this.isDesFormType !== 'prearchiveLibrary') {
FetchDoeditIsRepeat(params).then(res => { FetchDoeditIsRepeat(params).then(res => {
if (res) { if (res) {
this.$message.error(item.fieldCnName + '不可重复') this.$message.error(item.fieldCnName + '不可重复')
} }
}) })
} else {
FetchReDoeditIsRepeat(params).then(res => {
if (res) {
this.$message.error(item.fieldCnName + '不可重复')
}
})
}
}, },
// input // input
isRepeatHandle(item) { isRepeatHandle(item) {
// - // -
if (item.isRepeat) { if (item.isRepeat) {
const params = {
let params
if (this.isDesFormType !== 'prearchiveLibrary') {
params = {
'categoryId': this.selectedCategory.id, 'categoryId': this.selectedCategory.id,
'archivesId': this.arcId, 'archivesId': this.arcId,
'fieldName': item.fieldName, 'fieldName': item.fieldName,
'value': this.addOrUpdateForm[item.fieldName] 'value': this.addOrUpdateForm[item.fieldName]
} }
} else {
params = {
'documentId': this.selectedCategory.id,
'archivesId': null,
'fieldName': item.fieldName,
'value': this.addOrUpdateForm[item.fieldName]
}
}
this.handlerIsRepeat(params, item) this.handlerIsRepeat(params, item)
} }
if (this.isDesFormType !== 'prearchiveLibrary') {
if (!item.isAutomatic) { if (!item.isAutomatic) {
const index = this.autoMatic.findIndex(i => item.fieldName === i.fieldName) const index = this.autoMatic.findIndex(i => item.fieldName === i.fieldName)
if (index !== -1) { if (index !== -1) {
this.handleAuto() this.handleAuto()
} }
} }
}
}, },
// tree - open // tree - open
openTree(item) { openTree(item) {
@ -344,12 +363,22 @@ export default {
// this.treeName = val.dicName // this.treeName = val.dicName
// - - treeSelect // - - treeSelect
if (this.treeCurrentFiled.isRepeat) { if (this.treeCurrentFiled.isRepeat) {
const params = {
let params
if (this.isDesFormType !== 'prearchiveLibrary') {
params = {
'categoryId': this.selectedCategory.id, 'categoryId': this.selectedCategory.id,
'archivesId': this.arcId, 'archivesId': this.arcId,
'fieldName': this.treeCurrentFiled.fieldName, 'fieldName': this.treeCurrentFiled.fieldName,
'value': val.dicName 'value': val.dicName
} }
} else {
params = {
'documentId': this.selectedCategory.id,
'archivesId': null,
'fieldName': this.treeCurrentFiled.fieldName,
'value': val.dicName
}
}
this.handlerIsRepeat(params, this.treeCurrentFiled) this.handlerIsRepeat(params, this.treeCurrentFiled)
} }
const index = this.autoMatic.findIndex(i => this.treeCurrentFiled.fieldName === i.fieldName) const index = this.autoMatic.findIndex(i => this.treeCurrentFiled.fieldName === i.fieldName)
@ -454,21 +483,28 @@ export default {
delete this.addOrUpdateForm.id delete this.addOrUpdateForm.id
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
//
if (this.isDesFormType === 'prearchiveLibrary') { if (this.isDesFormType === 'prearchiveLibrary') {
if (this.fileOriginal === null) {
this.$message({
message: '请上传电子文件',
type: 'error'
})
return false
}
const params = { const params = {
'id': null,
'id': this.arcId,
'ids': null,
'documentId': categoryId, 'documentId': categoryId,
'delMan': null, 'delMan': null,
'fileJsonString': JSON.stringify(this.addOrUpdateForm)
'jsonString': JSON.stringify(this.addOrUpdateForm),
'fileJsonString': this.fileJsonString
} }
console.log(this.addOrUpdateForm)
prearchEdit(params).then(res => { prearchEdit(params).then(res => {
if (res) { if (res) {
this.$message.success(res) this.$message.success(res)
this.$emit('emitTableList')
this.$emit('close-dialog')
this.crud.refresh() this.crud.refresh()
localStorage.setItem('isForm', true)
localStorage.removeItem('isDelt')
} }
}) })
} else { } else {
@ -499,31 +535,74 @@ export default {
this.popoverVisible = false this.popoverVisible = false
done() done()
}, },
handleChange(file, fileList) {
this.fileList = fileList.slice(-3)
},
//
beforeAvatarUpload(file) {
this.qiniuData.key = file.name
const isJPG = file.type === 'image/jpeg' || file.type === 'image/png'
const isLt2M = file.size / 1024 / 1024 < 2
if (!isJPG) {
this.$message.error('图片只支持bmp、jpg、png、gif格式的文件 !')
}
if (!isLt2M) {
this.$message.error('图片大小不能超过 2MB !')
//
async changeFile(e) {
this.file = e.target.files[0]
this.fileSize = this.file.size
this.formatType = this.file.type.substring(0, this.file.type.indexOf('/'))
this.fileNames = this.file.name
this.postfix = this.file.name.substring(
this.fileNames.lastIndexOf('.') + 1,
this.fileNames.length
)
if (this.formatType === 'image') {
const fileBase64 = await this.getBase64(this.file)
const res = await this.getImgPx(fileBase64)
this.px = res.width + 'px*' + res.height + 'px'
} else {
this.px = ''
}
this.uploadSave()
//
// archivesUpload(this.baseApi + '/api/archives/uploadFile', this.file, this.categoryId).then(res => {
// if (res.data.code === 200) {
// this.filePath = res.data.data
// this.uploadSave()
// }
// })
},
// -
uploadSave() {
this.nowDate = getCurrentTime()
const json = {
'file_name': this.fileNames,
'file_size': this.fileSize,
'file_type': this.postfix,
'file_path': this.filePath,
'sequence': null,
'archive_id': this.arcId,
'file_dpi': this.px,
'file_thumbnail': '',
'create_time': this.nowDate,
'id': null
}
const arrayUpload = []
arrayUpload.push(json)
console.log(arrayUpload)
this.fileOriginal = this.fileNames
this.fileJsonString = JSON.stringify(arrayUpload)
console.log(this.fileJsonString)
},
// base64
getBase64(file) {
const reader = new FileReader()
reader.readAsDataURL(file)
return new Promise((resolve) => {
reader.onload = () => {
resolve(reader.result)
} }
return isJPG && isLt2M
},
handleAvatarSuccess: function(res, file) {
this.form.imageUrl = 'http://' + this.upload_qiniu_addr + '/' + res.key
console.log(this.form.imageUrl)
})
}, },
handleError: function(res) {
this.$message({
message: '上传失败',
duration: 2000,
type: 'warning'
//
getImgPx(img) {
const image = new Image()
image.src = img
return new Promise((resolve) => {
image.onload = () => {
const width = image.width
const height = image.height
resolve({ width, height })
}
}) })
} }
} }
@ -603,17 +682,31 @@ export default {
@include preview-border-color; @include preview-border-color;
} }
.upload-wm{
display: flex;
justify-content: flex-start;
.prearch-upload{
margin-right: 0 !important;
::v-deep .el-form-item__content{ ::v-deep .el-form-item__content{
width: 510px !important;
width: 540px !important;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.upload-btn{ .upload-btn{
margin-right: 0;
position: relative;
width:96px;
margin-right: 0 !important;
margin-left: 10px; margin-left: 10px;
overflow: initial !important;
#upFile{
position: absolute;
left: 0;
top: 0;
// opacity: 0;
width: 84px;
height: 34px;
}
.el-button{
margin-top: -2px;
} }
} }
} }
}
</style> </style>

89
src/views/prearchiveLibrary/index.vue

@ -39,7 +39,7 @@
<el-table <el-table
ref="table" ref="table"
v-loading="crud.loading" v-loading="crud.loading"
:data="crud.table"
:data="crud.data"
@select="crud.selectChange" @select="crud.selectChange"
@select-all="crud.selectAllChange" @select-all="crud.selectAllChange"
@selection-change="crud.selectionChangeHandler" @selection-change="crud.selectionChangeHandler"
@ -106,6 +106,19 @@
</div> </div>
</div> </div>
</el-dialog> </el-dialog>
<!--新增 / 编辑 表单组件-->
<el-dialog class="preview-dialog" :modal-append-to-body="false" :close-on-click-modal="false" append-to-body :before-close="handleClose" :visible="formVisible" :title="formTitle">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<PreviewForm ref="previewForm" :form-preview-data.sync="formPreviewData" :selected-category="selectedCategory" :parents-id="parentsId" :arc-id="arcId" :is-des-form-type="isDesFormType" :is-disabled="isDisabled" :is-has-code="isHasCode" @close-dialog="closeDialog" />
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="formVisible = false">取消</el-button>
<el-button type="primary" @click="handlerArchivesSubmit">确定</el-button>
</div>
</div>
</el-dialog>
</div> </div>
</div> </div>
</div> </div>
@ -123,12 +136,13 @@ import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import TreeList from './treeList' import TreeList from './treeList'
import eForm from './module/form' import eForm from './module/form'
import PreviewForm from '@/views/components/category/PreviewForm'
import batchFile from './module/batchFile' import batchFile from './module/batchFile'
import moveFile from './module/moveFile' import moveFile from './module/moveFile'
export default { export default {
name: 'PrearchiveLibrary', name: 'PrearchiveLibrary',
components: { TreeList, eForm, batchFile, moveFile, Treeselect, rrOperation, crudOperation, pagination },
components: { TreeList, eForm, PreviewForm, batchFile, moveFile, Treeselect, rrOperation, crudOperation, pagination },
cruds() { cruds() {
return [ return [
CRUD({ CRUD({
@ -158,7 +172,7 @@ export default {
tableDisplayFields: [], // table-list-title tableDisplayFields: [], // table-list-title
arrySort: [], arrySort: [],
selectedDocument: {}, selectedDocument: {},
formPreviewData: [],
deleteVisible: false, deleteVisible: false,
mergeVisible: false, mergeVisible: false,
categoryTree: [], categoryTree: [],
@ -168,7 +182,16 @@ export default {
target: [ target: [
{ required: true, message: '请选择档案门类', trigger: 'input' } { required: true, message: '请选择档案门类', trigger: 'input' }
] ]
}
},
formVisible: false,
formTitle: '新增文件',
formPreviewData: [],
selectedCategory: null,
parentsId: null,
arcId: null,
isDesFormType: 'prearchiveLibrary',
isDisabled: false,
isHasCode: false
} }
}, },
computed: { computed: {
@ -184,6 +207,7 @@ export default {
this.selectedDocument = data this.selectedDocument = data
this.getInitDocumentsViewTable() this.getInitDocumentsViewTable()
}, },
//
getInitDocumentsViewTable() { getInitDocumentsViewTable() {
PrearchiveCrud.FetchInitDocumentsViewTable({ documentId: this.selectedDocument.id }).then(data => { PrearchiveCrud.FetchInitDocumentsViewTable({ documentId: this.selectedDocument.id }).then(data => {
if (data) { if (data) {
@ -206,23 +230,24 @@ export default {
// -form/-api // -form/-api
handleForm(type) { handleForm(type) {
this.mergeVisible = false this.mergeVisible = false
this.$refs.eform.selectedCategory = this.selectedDocument
this.selectedCategory = this.selectedDocument
let params let params
if (type === 'add') { if (type === 'add') {
this.$refs.eform.formTitle = '新增文件'
this.formTitle = '新增文件'
params = { params = {
documentId: this.selectedDocument.id, documentId: this.selectedDocument.id,
archivesId: null archivesId: null
} }
} else if (type === 'edit') { } else if (type === 'edit') {
this.$refs.eform.formTitle = '编辑文件'
this.formTitle = '编辑文件'
this.arcId = this.crud.selections[0].id
params = { params = {
documentId: this.selectedDocument.id, documentId: this.selectedDocument.id,
archivesId: this.crud.selections[0].id archivesId: this.crud.selections[0].id
} }
} }
this.getFormInfo(params)
this.getFormInfo(params, type)
}, },
// //
toDelete(data) { toDelete(data) {
@ -248,37 +273,29 @@ export default {
// this.crud.refresh() // this.crud.refresh()
// }) // })
}, },
getFormInfo(params) {
getFormInfo(params, type) {
PrearchiveCrud.FetchDoeditDocument(params).then(data => { PrearchiveCrud.FetchDoeditDocument(params).then(data => {
const showFiledAll = data.showFiled.filter(item => item.displayOrder).sort((a, b) => a.displayOrder - b.displayOrder) const showFiledAll = data.showFiled.filter(item => item.displayOrder).sort((a, b) => a.displayOrder - b.displayOrder)
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.eform.formPreviewData = showFiledAll
this.$refs.eform.formVisible = true
// if (type === 'edit') {
// this.$refs.previewForm.addOrUpdateForm = data.echo
// } else {
// // if (this.recycleMain.selectedDocument.isType !== 5) {
// // //
// // this.formPreviewData.forEach(item => {
// // if (isAnOrJuan === 1) {
// // if (this.recycleMain.selectedDocument.isType !== 3) {
// // if (this.recycleMain.projectSelection[item.fieldName]) {
// // this.$refs.previewForm.addOrUpdateForm = JSON.parse(JSON.stringify(this.recycleMain.projectSelection))
// // }
// // }
// // } else if (isAnOrJuan === 2) {
// // if (this.recycleMain.anjuanSelection[item.fieldName]) {
// // this.$refs.previewForm.addOrUpdateForm = JSON.parse(JSON.stringify(this.recycleMain.anjuanSelection))
// // }
// // }
// // })
// // }
// }
// this.isDesFormType = 'arcives'
// this.$refs.previewForm.FetchNoFormatField(this.categoryId)
this.formPreviewData = showFiledAll
this.formVisible = true
this.$nextTick(() => {
this.$refs.previewForm.fileOriginal = null
this.$refs.previewForm.fileJsonString = null
if (type === 'edit') {
this.$refs.previewForm.addOrUpdateForm = data.echo
const fileecho = []
fileecho.push(data.fileecho)
this.$refs.previewForm.fileOriginal = fileecho[0].file_name
this.$refs.previewForm.fileJsonString = JSON.stringify(fileecho)
}
})
}) })
}) })
}, },
handlerArchivesSubmit() {
this.$refs.previewForm.submitForm('addOrUpdateForm', this.selectedDocument.id)
},
handleBatch() { handleBatch() {
this.$refs.batchForm.batchVisible = true this.$refs.batchForm.batchVisible = true
}, },
@ -307,8 +324,12 @@ export default {
}, },
handleClose(done) { handleClose(done) {
this.mergeVisible = false this.mergeVisible = false
this.formVisible = false
done() done()
}, },
closeDialog() {
this.formVisible = false
},
handleMove() { handleMove() {
this.$refs.moveForm.moveVisible = true this.$refs.moveForm.moveVisible = true
} }

4
src/views/system/fileLibraryManage/fieldManage/index.vue

@ -48,11 +48,11 @@
<el-checkbox v-model="scope.row.isRequired" :disabled="true" /> <el-checkbox v-model="scope.row.isRequired" :disabled="true" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="自动生成" min-width="85" align="center">
<!-- <el-table-column label="自动生成" min-width="85" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-checkbox v-model="scope.row.isAuto" :disabled="true" /> <el-checkbox v-model="scope.row.isAuto" :disabled="true" />
</template> </template>
</el-table-column>
</el-table-column> -->
<el-table-column label="自动补零" min-width="85" align="center"> <el-table-column label="自动补零" min-width="85" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-checkbox v-model="scope.row.isFilling" :disabled="true" /> <el-checkbox v-model="scope.row.isFilling" :disabled="true" />

Loading…
Cancel
Save