Browse Source

增加火炬发展年报上传功能

ljb 6 months ago
parent
commit
70a786d383

+ 88 - 19
src/views/external-reports/external-manage/torch-develop-annual-report.vue

@@ -22,13 +22,31 @@
           导出
         </el-button>
         <file-download-btn type="primary" icon="el-icon-download" btnText="下载完整模板" templateKey="对外报表-火炬发展年报"></file-download-btn>
-        <!-- <el-button
+        <el-button
           type="primary"
           size="small"
           icon="el-icon-upload2"
+          @click="handleUploadClick"
         >
           上传火炬系统定稿版
-        </el-button> -->
+        </el-button>
+        <el-dialog
+        :visible.sync="drawerVisible"
+        title="上传火炬系统定稿版"
+        modal-append-to-body
+        append-to-body
+        width="500px"
+        destroy-on-close
+      >
+        <avue-form v-model="uploadForm" :option="formOptions" @submit="handleSubmit" @reset-change="handleResetForm">
+        </avue-form>
+      </el-dialog>
+      </div>
+      <div class="file-list" style="margin: 15px 0;">
+        <div v-for="(file, index) of attachmentList" :key="index" style="display: flex; align-items: center;">
+          <span v-if="index == 0">火炬系统定稿版:</span>
+          <el-link type="primary" @click="handleDownloadFile(file)" :style="`padding-left: ${index == 0 ? 0 : 112}px;`">{{ file.label }}</el-link>
+        </div>
       </div>
       <div>第1步 (封面)基本信息</div>
       <div style="margin-bottom: 8px;">第2步 (一)企业概况</div>
@@ -129,23 +147,6 @@
             </tr>
           </template>
           <tr v-else><td colspan="15" align="center">暂无数据</td></tr>
-          <!-- <tr>
-            <td align="center">1</td>
-            <td align="center">2</td>
-            <td align="center">3</td>
-            <td></td>
-            <td>1</td>
-            <td align="center">2</td>
-            <td align="center">3</td>
-            <td></td>
-            <td>1</td>
-            <td align="center">2</td>
-            <td align="center">3</td>
-            <td></td>
-            <td>1</td>
-            <td align="center">2</td>
-            <td align="center">3</td>
-          </tr> -->
         </tbody>
       </table>
 
@@ -592,10 +593,13 @@ import moment from "moment";
 import fileDownloadBtn from "@/components/file-download-btn";
 import yearMonthSelect from "@/components/year-month-select";
 import { getData } from "@/api/externalReports/torchDevelopAnnualReport";
+import { getAttenDetail as getAttachmentList, settingAttenInfo as settingAttachment } from "@/api/basicResource/compInfoSetting";
 import { exportBlob } from "@/api/common";
 import { getToken } from "@/util/auth";
 import { downloadXls } from "@/util/util";
 import { mapGetters } from "vuex";
+import { downloadFileByUrl } from "@/util/util";
+
 
 export default {
   components: {
@@ -609,11 +613,41 @@ export default {
       formData: {},
 
       loading: false,
+
+      drawerVisible: false,
+      uploadForm: {},
+      formOptions: {
+        labelWidth: 60,
+        emptyText: "取消",
+        column: [
+          {
+            label: "附件",
+            prop: "torchDevUrl",
+            type: "upload",
+            multiple: true,
+            span: 24,
+            dataType: "object",
+            propsHttp: {
+              url: "link",
+              name: "originalName",
+              res: "data",
+            },
+            action: '/api/kd-resource/oss/endpoint/put-file',
+            uploadPreview: (file, column, done) => {
+              downloadFileByUrl(file.url, file.name);
+              return;
+            },
+          },
+        ]
+      },
+      attachmentList: [],
+      
     };
   },
   watch: {
     "yearAndMonth"(newVal) {
       this.getDataFunc(newVal);
+      this.getAttachmentListFunc(newVal);
     },
   },
   computed: {
@@ -624,8 +658,16 @@ export default {
     }
   },
   methods: {
+    getAttachmentListFunc(year) {
+      getAttachmentList(year).then(({ data }) => {
+        if (data.code == 200 && data.data.torchDevUrl) {
+          this.attachmentList = JSON.parse(data.data.torchDevUrl);
+        }
+      });
+    },
     handleReady() {
       this.getDataFunc(this.yearAndMonth);
+      this.getAttachmentListFunc(this.yearAndMonth);
     },
     getDataFunc(year) {
       this.loading = true;
@@ -651,6 +693,33 @@ export default {
         );
       });
     },
+    handleUploadClick() {
+      this.drawerVisible = true;
+      this.uploadForm = { torchDevUrl: [...this.attachmentList] };
+    },
+    handleSubmit(form, done) {
+      let params = { yearAndMonth: this.yearAndMonth };
+      if (!!form.torchDevUrl) {
+        params.torchDevUrl = JSON.stringify(form.torchDevUrl);
+      }
+      settingAttachment(params).then(({ data }) => {
+        done();
+        if (data.code == 200) {
+          this.$message.success('保存成功!');
+          this.getAttachmentListFunc(this.yearAndMonth);
+          this.drawerVisible = false;
+          this.uploadForm = {};
+        }
+      }).catch(() => {
+        done();
+      })
+    },
+    handleDownloadFile(file) {
+      downloadFileByUrl(file.value, file.label);
+    },
+    handleResetForm() {
+      this.drawerVisible = false;
+    },
   },
 };
 </script>

+ 1 - 1
src/views/wel/index.vue

@@ -222,7 +222,7 @@ export default {
     },
     getProjectListByYearFunc() {
       getProjectListByYear({ year: this.currYear }).then(({ data }) => {
-        let _projectList = data.data;
+        let _projectList = data.data.filter(item => item.status != 0);
         this.projectTotal = _projectList.length;
 
         this.projectStatusOpt = this.getPieOptions("研发项目情况", [