|
@@ -71,7 +71,7 @@
|
|
|
<el-input v-model="form.referencesName" placeholder="请输入文件名称"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="文件选择" class="margin-bottom_0">
|
|
|
- <myUpload :file-list="form.systemFileList" @on-change="onchangeFile" @on-remove="onRemove" :multiple="false"
|
|
|
+ <myUpload :file-list="form.systemFileList" @on-change="onchangeFile" @on-remove="onRemove" :multiple="false" :limit="1"
|
|
|
style="height: 185px;" :autoUpload="true">
|
|
|
</myUpload>
|
|
|
</el-form-item>
|
|
@@ -176,8 +176,18 @@ export default {
|
|
|
// 弹窗确定
|
|
|
submit() {
|
|
|
// 判断文件是否都上传完毕
|
|
|
- this.$commonJS.allUploadFile(this.form)
|
|
|
- this.form.fileGuid=this.form.fileGuids[0]
|
|
|
+ // this.$commonJS.allUploadFile(this.form)
|
|
|
+ // this.form.fileGuid=this.form.fileGuids[0]
|
|
|
+ var guids = this.$commonJS.checkUploadFile(this.form.systemFileList)
|
|
|
+ if(!guids){
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(guids.length>0){
|
|
|
+ this.form.fileGuid = guids[0]
|
|
|
+ }else{
|
|
|
+ this.form.fileGuid = ''
|
|
|
+ }
|
|
|
+
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
if (valid) {
|
|
|
if (!this.form.id) {
|
|
@@ -215,13 +225,14 @@ export default {
|
|
|
},
|
|
|
// 上传的文件监听
|
|
|
onchangeFile(file, fileList) {
|
|
|
- if (this.form.systemFileList && this.form.systemFileList.length > 0) {
|
|
|
- return false
|
|
|
- }
|
|
|
+
|
|
|
if (file) {
|
|
|
this.$set(this.form, 'referencesName', file.name)
|
|
|
}
|
|
|
- if (file.guid && this.form.systemFileList && this.form.systemFileList.length > 0) {
|
|
|
+ if(!this.form.systemFileList){
|
|
|
+ this.$set(this.form,'systemFileList',[])
|
|
|
+ }
|
|
|
+ if (file.guid) {
|
|
|
let index = this.form.systemFileList.findIndex(item => {
|
|
|
return item.uid == file.uid
|
|
|
})
|
|
@@ -241,6 +252,7 @@ export default {
|
|
|
})
|
|
|
if (index != -1) {
|
|
|
this.form.systemFileList.splice(index, 1)
|
|
|
+ fileList.splice(index, 1)
|
|
|
}
|
|
|
},
|
|
|
// 新增
|
|
@@ -329,10 +341,11 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 编辑
|
|
|
- handleEdit(row) {
|
|
|
+ handleEdit(data) {
|
|
|
+ var row = JSON.parse(JSON.stringify(data))
|
|
|
row.systemFileList = [{
|
|
|
name: row.referencesName,
|
|
|
- guid:row.guid,
|
|
|
+ guid:row.fileGuid,
|
|
|
}]
|
|
|
this.title='编辑报告文档'
|
|
|
this.form = row
|