Browse Source

bug修复

master
xuhuajiao 1 year ago
parent
commit
7aad7ccd88
  1. 2
      package.json
  2. 2
      src/views/collectReorganizi/collectionLibrary/mixins/index.js
  3. 6
      src/views/collectReorganizi/collectionLibrary/module/blukEditing/index.vue
  4. 88
      src/views/collectReorganizi/collectionLibrary/module/uploadOriginal/bigUpload.vue
  5. 6
      src/views/components/category/PreviewForm.vue

2
package.json

@ -4,7 +4,7 @@
"description": "电子档案管理系统", "description": "电子档案管理系统",
"license": "", "license": "",
"scripts": { "scripts": {
"dev": "vue-cli-service serve",
"dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build:prod": "vue-cli-service build", "build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging", "build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview", "preview": "node build/index.js --preview",

2
src/views/collectReorganizi/collectionLibrary/mixins/index.js

@ -48,8 +48,6 @@ export const collectionLibraryCrud = {
'archive_year': null, 'archive_year': null,
'fonds_no': null 'fonds_no': null
} }
console.log('page', this.page)
console.log('page1', this.$parent)
// 2 项目 3 案卷 /文件 4 卷内 6 文件 // 2 项目 3 案卷 /文件 4 卷内 6 文件
if (this.isTitleType === 2) { if (this.isTitleType === 2) {
this.parentsId = null this.parentsId = null

6
src/views/collectReorganizi/collectionLibrary/module/blukEditing/index.vue

@ -70,11 +70,13 @@
v-model="editForm.updateContext" v-model="editForm.updateContext"
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
style="width: 360px;" style="width: 360px;"
/> />
<el-input-number <el-input-number
v-else-if="editForm.updateField.isInputClass === 'number'" v-else-if="editForm.updateField.isInputClass === 'number'"
v-model.number="editForm.initialValue"
v-model.number="editForm.updateContext"
:min="0" :min="0"
:max="999" :max="999"
controls-position="right" controls-position="right"
@ -164,7 +166,7 @@ export default {
]) ])
} else if (this.editForm.updateField.isInputClass === 'date') { } else if (this.editForm.updateField.isInputClass === 'date') {
this.$set(validateRule, 'updateContext', [ this.$set(validateRule, 'updateContext', [
{ type: 'date', required: true, message: '请选择日期', trigger: 'change' }
{ required: true, message: '请选择日期', trigger: 'change' }
]) ])
} else { } else {
this.$set(validateRule, 'updateContext', [ this.$set(validateRule, 'updateContext', [

88
src/views/collectReorganizi/collectionLibrary/module/uploadOriginal/bigUpload.vue

@ -11,6 +11,7 @@
@file-success="fileSuccess" @file-success="fileSuccess"
@files-added="filesAdded" @files-added="filesAdded"
@file-error="onFileError" @file-error="onFileError"
@file-removed="filesRemove"
> >
<uploader-unsupport /> <uploader-unsupport />
<uploader-drop> <uploader-drop>
@ -24,9 +25,8 @@
<!-- <uploader-btn :attrs="attrs">选择图片</uploader-btn> <!-- <uploader-btn :attrs="attrs">选择图片</uploader-btn>
<uploader-btn :directory="true">选择文件夹</uploader-btn> --> <uploader-btn :directory="true">选择文件夹</uploader-btn> -->
</uploader-drop> </uploader-drop>
<!-- <uploader-files /> -->
<ul class="file-list">
<uploader-files />
<!-- <ul class="file-list">
<li <li
v-for="file in fileList" v-for="file in fileList"
:key="file.id" :key="file.id"
@ -40,12 +40,12 @@
:list="true" :list="true"
/> />
</li> </li>
</ul>
</ul> -->
</uploader> </uploader>
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="text" @click="handleCloseDialog">取消</el-button> <el-button type="text" @click="handleCloseDialog">取消</el-button>
<el-button type="primary" @click="handleUploadConfirm">保存</el-button>
<el-button :loading="btnLoading" type="primary" @click="handleUploadConfirm">保存</el-button>
</div> </div>
</div> </div>
</el-dialog> </el-dialog>
@ -75,13 +75,14 @@ export default {
}, },
data() { data() {
return { return {
btnLoading: false,
uploadBigVisible: false, uploadBigVisible: false,
skip: false, skip: false,
options: { options: {
target: '/api/collect/upload', target: '/api/collect/upload',
// //
testChunks: true, // testChunks: true, //
// singleFile: true, //
singleFile: true, //
uploadMethod: 'post', // 使 HTTP , POST uploadMethod: 'post', // 使 HTTP , POST
allowDuplicateUploads: false, // allowDuplicateUploads: false, //
parseTimeRemaining: function(timeRemaining, parsedTimeRemaining) { parseTimeRemaining: function(timeRemaining, parsedTimeRemaining) {
@ -137,23 +138,31 @@ export default {
// } else { // } else {
// console.log('') // console.log('')
// } // }
if (result.code === 200) {
this.submitted = false
} else {
this.fileList.push(file)
if (result.code === 200 && this.fileList.length !== 0) {
this.submitted = true this.submitted = true
} else {
this.submitted = false
} }
if (this.skip) { if (this.skip) {
this.skip = false this.skip = false
} }
}, },
filesRemove(file, index) {
this.fileList = []
const uploaderInstance = this.$refs.uploader.uploader
const temp = uploaderInstance.fileList.findIndex(e => e.uniqueIdentifier === file.uniqueIdentifier)
if (temp > -1) {
uploaderInstance.fileList[temp].cancel() //
}
},
handleUploadConfirm() { handleUploadConfirm() {
if (this.submitted) {
return
if (this.$refs.uploader.fileList.length === 0) {
this.$message.error('请选择要上传的文件!')
return false
} }
this.submitted = true
this.nowDate = getCurrentTime() this.nowDate = getCurrentTime()
const filePromises = this.fileList.map(async(item, index) => {
console.log(item)
this.$refs.uploader.fileList.map(async(item, index) => {
const json = {} const json = {}
const jsonArray = [] const jsonArray = []
const jsonString = {} const jsonString = {}
@ -186,43 +195,38 @@ export default {
json.totalSize = item.size json.totalSize = item.size
json.fileJsonString = JSON.stringify(jsonArray) json.fileJsonString = JSON.stringify(jsonArray)
if (item.completed) {
return axios.post(this.baseApi + '/api/collect/merge', json, { headers: {
if (item.completed && this.submitted) {
this.btnLoading = true
this.submitted = false
axios.post(this.baseApi + '/api/collect/merge', json, { headers: {
'Authorization': getToken() 'Authorization': getToken()
}})
} else {
this.$message.error('请耐心等待文件上传完成后再保存!')
}
})
axios.all(filePromises)
.then(axios.spread((...responses) => {
//
for (const response of responses) {
//
if (response.data.code === 200 && response.data.data !== '') {
}}).then((res) => {
console.log(res)
if (res.data.code === 200 && res.data.data !== '') {
this.$message.success('上传成功') this.$message.success('上传成功')
this.$emit('close-dialog')
this.uploadBigVisible = false
this.fileList = []
} else { } else {
this.$message.error('上传失败') this.$message.error('上传失败')
} }
this.submitted = false
}
}))
.catch(error => {
console.error(error)
})
this.$emit('close-dialog')
this.uploadBigVisible = false
this.fileList = []
this.btnLoading = false
this.$refs.uploader.files = []
this.$refs.uploader.fileList = []
this.$refs.uploader.uploader.fileList = []
this.$refs.uploader.uploader.files = []
})
} else {
this.submitted = false
this.$message.error('请耐心等待文件上传完成后再保存!')
}
})
}, },
onFileError(rootFile, file, message, chunk) { onFileError(rootFile, file, message, chunk) {
this.$message.error('上传出错:' + message) this.$message.error('上传出错:' + message)
}, },
filesAdded(file, fileList, event) { filesAdded(file, fileList, event) {
this.$refs.uploader.files = []
this.$refs.uploader.fileList = []
file.forEach((e) => { file.forEach((e) => {
this.fileList = []
this.fileList.push(e) this.fileList.push(e)
this.computeMD5(e) this.computeMD5(e)
}) })
@ -234,7 +238,6 @@ export default {
this.$message.warning(maxMessage) this.$message.warning(maxMessage)
return false return false
} }
const fileReader = new FileReader() const fileReader = new FileReader()
const time = new Date().getTime() const time = new Date().getTime()
const blobSlice = const blobSlice =
@ -360,4 +363,7 @@ export default {
margin: 10px 0 5px 0; margin: 10px 0 5px 0;
} }
} }
.uploader-file[status="success"] .uploader-file-remove {
display:block
}
</style> </style>

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

@ -53,7 +53,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-if="isDesFormType === 'prearchiveLibrary'" class="preview-form-bottom prearch-bottom">
<el-row v-if="!isHasCode && isDesFormType === 'prearchiveLibrary'" class="preview-form-bottom prearch-bottom">
<el-col> <el-col>
<el-form-item label="电子原件" prop="fileOriginal" class="prearch-upload" :rules="[{ required: true, message: '请上传原文',trigger: 'blur' }]"> <el-form-item label="电子原件" prop="fileOriginal" class="prearch-upload" :rules="[{ required: true, message: '请上传原文',trigger: 'blur' }]">
<el-input <el-input
@ -69,7 +69,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-if="isDesFormType !== 'prearchiveLibrary' && isDesFormType !== 'mergeFile'" class="preview-form-bottom prearch-bottom">
<el-row v-if="!isHasCode && isDesFormType !== 'prearchiveLibrary' && isDesFormType !== 'mergeFile'" class="preview-form-bottom prearch-bottom">
<el-col v-for="(item,index) in formPreviewData" :key="index"> <el-col v-for="(item,index) in formPreviewData" :key="index">
<el-form-item v-if="item.fieldName === 'is_entity'" label="有无实体" :prop="item.fieldName" :rules="[{ required: true, message: '请选择',trigger: 'change' }]" class="pbysical-style"> <el-form-item v-if="item.fieldName === 'is_entity'" label="有无实体" :prop="item.fieldName" :rules="[{ required: true, message: '请选择',trigger: 'change' }]" class="pbysical-style">
<el-radio-group v-model="addOrUpdateForm[item.fieldName]"> <el-radio-group v-model="addOrUpdateForm[item.fieldName]">
@ -142,7 +142,7 @@ export default {
name: 'PreviewForm', name: 'PreviewForm',
components: { draggable, Treeselect }, components: { draggable, Treeselect },
mixins: [crud()], mixins: [crud()],
inject: ['parentsData'],
inject: ['parentsData'] | '',
props: { props: {
isDisabled: { isDisabled: {
type: Boolean, type: Boolean,

Loading…
Cancel
Save