|
@ -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> |