zhuliu 7 ماه پیش
والد
کامیت
946d4e2f64
1فایلهای تغییر یافته به همراه83 افزوده شده و 1 حذف شده
  1. 83 1
      src/views/report/components/details/components/basicMessage_official.vue

+ 83 - 1
src/views/report/components/details/components/basicMessage_official.vue

@@ -135,9 +135,19 @@
                         </el-form-item>
                         <el-form-item label="附件:">
                             <div class="box1 textEmpty">
+                                <el-upload
+                                    class="upload-demo"
+                                    action="#"
+                                    :auto-upload="false"
+                                    :show-file-list="false"
+                                    :on-change="onChangeFile"
+                                    :limit="1">
+                                    <el-button size="small" type="primary">点击上传</el-button>
+                                    <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> -->
+                                </el-upload>
                                 <div v-for="item in reportMessage.systemFileList" style="display:flex;align-items:center" :key="item.guid">
                                     <div style="margin-right:20px">{{ item.originalName }}</div>
-                                    <my-menu :data="item" :deleted="false"></my-menu>
+                                    <my-menu :data="item"  @delFile="delFile"></my-menu>
                                 </div>
                             </div>
                         </el-form-item>
@@ -457,6 +467,69 @@ export default {
     this.queryInvalidStatutes()
   },
   methods: {
+    //删除文件
+    delFile(file){
+        let guids = []
+        if( this.reportMessage.systemFileList){
+            guids = this.reportMessage.systemFileList.filter(item=>{
+                return item.guid != file.guid
+            }).map(item=>{
+                return item.guid
+            })
+        }
+        this.reportMessage.fileGuids = guids
+        this.submit2('文件删除')
+    },
+    //上传文件
+    onChangeFile(file){
+        let formData = new FormData()
+        formData.append('sourceId',this.$constants.sourceId)
+        formData.append('files',file.raw)
+        this.$api.uploadFile(formData).then(response=>{
+            if(response.code == 200){
+                let guid = response.data[0]
+                let guids = []
+                if( this.reportMessage.systemFileList){
+                    guids = this.reportMessage.systemFileList.map(item=>{
+                        return item.guid
+                    })
+                }
+                guids.push(guid)
+                this.reportMessage.fileGuids = guids
+                this.submit2('文件上传')
+            }
+        })
+    },
+    submit2(message) {
+        this.reportMessage.type = 2//项目类型(1专利数据库 2报告 3专利挖掘项目)
+
+        // 事件及调查类型处理
+        if (this.reportMessage.scenarioIds && this.reportMessage.scenarioIds.length > 0) {
+            var scenarioIds = JSON.parse(JSON.stringify(this.form.scenarioIds))
+        }
+        if (this.reportMessage.eventId) {
+            this.reportMessage.events = []
+            this.reportMessage.scenarioIds = []
+            this.reportMessage.matterIds.forEach(item => {
+                this.reportMessage.events.push(
+                {
+                    matterId: item,
+                    scenarioId: scenarioIds[0],
+                    eventId: this.reportMessage.eventId
+                }
+                )
+            })
+        }
+        let formData = this.reportMessage
+        this.$api.updateReportProject(formData).then(response => {
+            if (response.code == 200) {
+                this.$message.success(message+'成功')
+                this.$emit('refreshData')
+            }
+        })
+         
+       
+    },
     //修改了案件流程
     changeFlowPath(form){
         if(!form){
@@ -678,4 +751,13 @@ export default {
     color: var(--color1);
     font-size: medium;
 }
+</style>
+<style lang="scss">
+    .upload-demo{
+        display: flex;
+        align-items: center;
+        &>*:first-child{
+            margin-right: 10px;
+        }
+    }
 </style>