Explorar o código

1.优化模板下载功能

GouGengquan hai 3 meses
pai
achega
fdf5f6de64

+ 7 - 1
src/views/assets/template/createCalculate.vue

@@ -210,6 +210,12 @@ export default {
                     label: '机器设备-基础信息导入模板',
                 }
             ],
+            crTmplCode: [
+                {
+                    value: 'ANALYSIS_MAIN',
+                    label: '债权分析测算表模板',
+                },
+            ],
             tmplCodes: null,
             calculateType: [],
             tmplAssetCalculate: {
@@ -316,7 +322,7 @@ export default {
                 this.tmplCodes = this.equipmentTmplCode;
             }
             if (this.tmplAssetCalculate.calculateType == "债权" || this.tmplAssetCalculateSection.calculateType == "债权") {
-                this.tmplCodes = null;
+                this.tmplCodes = this.crTmplCode;
             }
         },
         // 创建测算表模板

+ 32 - 25
src/views/assets/workbench/cr/calculate/uploadCalculate.vue

@@ -22,37 +22,40 @@
         <em>或点击上传</em> 测算表
       </div>
       <template #tip>
-        <div class="el-upload__tip">文件大小限制在100MB及以下</div>
+        <div class="el-upload__tip">
+          文件大小限制在100MB及以下
+          <el-button type="primary" link @click="downloadTmpl()" style="font-size:12px;margin-bottom: 2px;float:right">下载模板</el-button>
+        </div>
       </template>
     </el-upload>
   </div>
 </template>
 
 <script>
-import { mapStores } from 'pinia'
-import { assetsProjectInfo } from '@/stores/assetsProjectStore'
-import { createAssetsCalculate, getUnFinishedCalculateProgress } from '@/api/assetsCalculate'
-import { uploadCalculate } from '@/api/assetsCalculateCRData'
+import { mapStores } from 'pinia';
+import { assetsProjectInfo } from '@/stores/assetsProjectStore';
+import { createAssetsCalculate, getUnFinishedCalculateProgress } from '@/api/assetsCalculate';
+import { uploadCalculate } from '@/api/assetsCalculateCRData';
+import fileUtil from '@/utils/file';
+
 export default {
   data() {
     return {
       fileList: [],
-    }
+    };
   },
   computed: {
     ...mapStores(assetsProjectInfo),
   },
-  created() {
-    
-  },
+  created() {},
   methods: {
     // 获取未完成测算表的进度信息并保存到缓存
     getCalculateProgress() {
       getUnFinishedCalculateProgress(this.projectStore.projectInfo.id).then((res) => {
         if (res.data) {
-          this.projectStore.setCalculateProgress(res.data)
+          this.projectStore.setCalculateProgress(res.data);
         }
-      })
+      });
     },
     // 文件上传数量限制
     handleExceed() {
@@ -60,35 +63,39 @@ export default {
         showClose: true,
         message: '最多选择一个文件!',
         type: 'error',
-      })
+      });
     },
     // 移除文件
     beforeRemove(file, fileList) {
       fileList = fileList.filter((o) => {
-        return o.name !== file.name
-      })
-      this.fileList = []
-      this.tmplAssetCalculate.fileName = null
-      this.tmplAssetCalculate.fileUrl = null
+        return o.name !== file.name;
+      });
+      this.fileList = [];
+      this.tmplAssetCalculate.fileName = null;
+      this.tmplAssetCalculate.fileUrl = null;
     },
     // 上传债权测算表
     uploadCalculate(item) {
-      let crCalculateExcel = new FormData()
-      crCalculateExcel.append('calculateId', this.projectStore.calculateProgress.id)
-      crCalculateExcel.append('multipartFile', item.file)
+      let crCalculateExcel = new FormData();
+      crCalculateExcel.append('calculateId', this.projectStore.calculateProgress.id);
+      crCalculateExcel.append('multipartFile', item.file);
       uploadCalculate(crCalculateExcel).then((res) => {
         if (res.code == 200) {
           ElMessage({
             showClose: true,
             message: res.message,
             type: 'success',
-          })
-          this.projectStore.calculateProgress.progress = 'FINISHED'
+          });
+          this.projectStore.calculateProgress.progress = 'FINISHED';
         }
-      })
-    }
+      });
+    },
+    // 下载测算表模板
+    downloadTmpl() {
+      fileUtil.download('/file/download/assets/tmpl?tmplCode=ANALYSIS_MAIN&tmplType=MAIN');
+    },
   },
-}
+};
 </script>
 
 <style scoped>

+ 1 - 1
src/views/assets/workbench/eqpt/calculate/importInfo.vue

@@ -2171,7 +2171,7 @@ export default {
     },
     // 下载申报表
     downloadDeclarationForm() {
-      fileUtil.download('/file/download/assets/declarationForm?tmplCode=DECLARATION_FORM')
+      fileUtil.download('/file/download/assets/tmpl?tmplCode=DECLARATION_FORM&tmplType=SECTION')
     },
     deleteEqptDataById(eqptId) {
       deleteEqptDataById(eqptId).then((res) => {