zhuliu 5 tháng trước cách đây
mục cha
commit
9dc1ff4918

+ 7 - 0
src/views/report/InvalidResponse/components/Evidence/evidence.vue

@@ -87,6 +87,13 @@
                         </div>
                     </template>
                 </el-table-column> -->
+                <el-table-column prop="systemFiles" label="文件" align="center">
+                    <template slot-scope="scope">
+                        <div v-if="scope.row.systemFiles && scope.row.systemFiles.length">
+                            <myMenu :data="scope.row.systemFiles" :deleted="false" ></myMenu>
+                        </div>
+                    </template>
+                </el-table-column>
                 <el-table-column prop="description" label="备注" align="center">
                     <template slot-scope="scope">
                         <div>

+ 93 - 2
src/views/report/InvalidResponse/components/ManualImport/manualImport.vue

@@ -77,6 +77,30 @@
                         </div>
                     </template>
                 </el-table-column>
+                <el-table-column prop="systemFiles" label="文件" align="center">
+                    <template slot-scope="scope">
+                        <div>
+                            <div class="fileList" v-if="scope.row.systemFiles&&scope.row.systemFiles.length > 0">
+                                <ul>
+                                    <li v-for="item in scope.row.systemFiles" :key="item.guid">
+                                        <myTooltip :content="item.name ? item.name : item.originalName">
+                                        <div class="noWrap">
+                                            <i class="el-icon-document" style="margin-right: 10px"></i
+                                            ><span class="name">{{
+                                            item.name ? item.name : item.originalName
+                                            }}</span>
+                                        </div>
+                                        </myTooltip>
+                                        <div class="type">{{ item.guid ? "已上传" : "待上传" }}</div>
+                                        <div class="icon" @click="onRemove(item, scope.row)">
+                                        <i class="el-icon-close"></i>
+                                        </div>
+                                    </li>
+                                </ul>
+                            </div>
+                        </div>
+                    </template>
+                </el-table-column>
                 <el-table-column prop="description" label="备注" align="center">
                     <template slot-scope="scope">
                         <div>
@@ -88,7 +112,6 @@
                     <template slot-scope="scope">
                         <div class="caozuo">
                             <el-upload
-                                v-if="scope.row.type == 1"
                                 class="margin-right_10"
                                 action="#"
                                 :show-file-list="false"
@@ -173,12 +196,35 @@ export default {
         let formData = new FormData()
         formData.append('sourceId',this.$constants.sourceId)
         formData.append('files',file.raw)
+        if(!row.systemFiles){
+            row.systemFiles = []
+        }
+        row.systemFiles.push(file.raw)
+        if(!row.fileGuids){
+            row.fileGuids = []
+        }
         this.$api.uploadFile(formData).then(response=>{
             if(response.code == 200){
-                row.literatureNo = response.data[0]
+                let index = row.systemFiles.findIndex(item=>{
+                    return item.uid == file.uid
+                })
+                if(index != -1){
+                    row.systemFiles[index] = file.raw
+                }
+                row.fileGuids.push(response.data[0])
             }
         })
     },
+    //移除文件
+    onRemove(file, row){
+        // this.$set(this.form,'systemFile',null)
+        let index = row.systemFiles.findIndex(item=>{
+            return item.guid == file.guid || item.uid == file.uid
+        })
+        if(index != -1){
+            row.systemFiles.splice(index,1)
+        }
+    },
     //添加
     add(){
         var order = 1
@@ -210,6 +256,10 @@ export default {
             if(data[i].name){
                 if(data[i].type == 0){
                     data[i].literatureNo = data[i].name
+                }else{
+                    if(data[i].fileGuids.length){
+                        data[i].literatureNo = data[i].fileGuids[0]
+                    }
                 }
             }
         }
@@ -256,4 +306,45 @@ export default {
     display: flex;
     justify-content: center;
 }
+.fileList {
+    width: 100%;
+    height: 100%;
+    overflow-y: auto;
+    flex: 2;
+    ul {
+      list-style-type: none;
+      padding: 0 10px;
+      li {
+        line-height: initial;
+        padding: 5px 10px;
+        border-radius: 5px;
+        display: flex;
+        justify-content: space-between;
+
+        .type {
+          min-width:75px;
+          display: block;
+          color: #57a5f7;
+        }
+        .icon {
+          display: none;
+        }
+      }
+      li:hover {
+        background: #f4f4f4;
+        .name {
+          color: #57a5f7;
+          cursor: pointer;
+        }
+        .type {
+          min-width:75px;
+          display: none;
+        }
+        .icon {
+          display: block;
+          cursor: pointer;
+        }
+      }
+    }
+  }
 </style>

+ 29 - 24
src/views/report/InvalidResponse/components/dialog/editEvidence.vue

@@ -13,13 +13,7 @@
                     <el-form-item  label="作者" prop="authorName">
                         <el-input  v-model="form.authorName" autocomplete="off" placeholder="请输入作者名称"></el-input>
                     </el-form-item>
-                    <el-form-item  label="附件">
-                        <template>
-                            <div v-if="showDialog"> 
-                                <myUpload :file-list="form.systemFile?[form.systemFile]:[]" :limit="1" :autoUpload="true" @on-change="onChange" @on-remove="onRemove"></myUpload>
-                            </div>
-                        </template>
-                    </el-form-item>
+                    
                 </div>
             </template>
             <template v-else>
@@ -29,6 +23,13 @@
                     </el-form-item>
                 </div>
             </template>
+            <el-form-item  label="文件">
+                <template>
+                    <div v-if="showDialog"> 
+                        <myUpload :file-list="form.systemFiles" :autoUpload="true" @on-change="onChange" @on-remove="onRemove"></myUpload>
+                    </div>
+                </template>
+            </el-form-item>
             <el-form-item  label="备注" prop="description">
               <el-input type="textarea" v-model="form.description" autocomplete="off" placeholder="请输入备注"></el-input>
             </el-form-item>
@@ -75,43 +76,47 @@ export default {
     },
     //切换文件
     onChange(file, fileList){
-        if(this.form.systemFile){
-            if(file.guid){
-                if(this.form.systemFile.uid == file.uid){
-                    this.$set(this.form,'systemFile',null)
-                    this.$set(this.form,'systemFile',file.raw)
-                }
-            }else{
-                this.$set(this.form,'systemFile',null)
-                this.$set(this.form,'systemFile',file.raw)
-            }
+        if(!this.form.systemFiles){
+            this.form.systemFiles = []
+        }
+        let index = this.form.systemFiles.findIndex(item=>{
+            return item.guid == file.guid || item.uid == file.uid
+        })
+        if(index == -1){
+            this.form.systemFiles.push(file.raw)
         }else{
-            this.$set(this.form,'systemFile',null)
-            this.$set(this.form,'systemFile',file.raw)
+            this.form.systemFiles[index] = file.raw
         }
         
     },
     //移除文件
     onRemove(file, fileList){
-        this.$set(this.form,'systemFile',null)
+        // this.$set(this.form,'systemFile',null)
+        let index = this.form.systemFiles.findIndex(item=>{
+            return item.guid == file.guid || item.uid == file.uid
+        })
+        if(index != -1){
+            this.form.systemFiles.splice(index,1)
+        }
     },
     //提交
     submit(){
         this.$refs.form.validate((valid) => {
           if (valid) {
-            if(this.form.type == 1 && this.form.systemFile){
-                var guids = this.$commonJS.checkUploadFile([this.form.systemFile])
+            if(this.form.type == 1 && this.form.systemFiles){
+                var guids = this.$commonJS.checkUploadFile(this.form.systemFiles)
                 if(!guids){
                     return false
                 }
-                this.form.fileGuid = guids.length>0?guids[0]:''  
+                // this.form.fileGuid = guids.length>0?guids[0]:''  
+                this.form.fileGuids = guids 
             }
             
             this.form.projectId = this.projectId
             this.btnLoading = true
             if(this.form.id){
                 if(this.form.type == 1){
-                    this.form.literatureNo = this.form.fileGuid
+                    this.form.literatureNo = this.form.fileGuids.length?this.form.fileGuids[0]:''
                 }
                 var a = {
                     updateBatchLiteratureDTOs:[this.form],