瀏覽代碼

调整财务核算成本的分摊比例导出

Lijy 2 年之前
父節點
當前提交
f972331d8d
共有 1 個文件被更改,包括 30 次插入1 次删除
  1. 30 1
      fhKeeper/formulahousekeeper/timesheet/src/views/project/finance.vue

+ 30 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/project/finance.vue

@@ -486,7 +486,8 @@
         </el-dialog>
         <el-dialog :title="$t('allocationdata')" v-if="intoAmortizationDialog" :visible.sync="intoAmortizationDialog" customClass="customWidth" width="500px">
             <p>{{'1.' + $t('other.download')}}
-            <el-link type="primary" style="margin-left:5px;" :underline="false" :href="'./upload/'+$t('allocationImporttemplates')+'.xlsx'" :download="$t('allocationImporttemplates') + '.xlsx'">{{$t('allocationImporttemplates')+'.xlsx'}}</el-link>
+            <el-link v-if="financialFlg" type="primary" style="margin-left:5px;" :underline="false" :href="'./upload/'+$t('allocationImporttemplates')+'.xlsx'" :download="$t('allocationImporttemplates') + '.xlsx'">{{$t('allocationImporttemplates')+'.xlsx'}}</el-link>
+            <el-link v-else type="primary" style="margin-left:5px;" :underline="false" @click="financialClick()">{{$t('allocationImporttemplates')+'.xlsx'}}</el-link>
             </p>
             <p>{{'2.' + $t('other.projectsAndPeopleInThetemplate') }}</p>
             <p style="display: flex;justify-content: center;padding:1em 0">
@@ -647,6 +648,8 @@ import { error } from 'dingtalk-jsapi';
                 deleteSelList: [],
                 chosenProjectsChecked: false,
                 exportDataProcessing: false,
+
+                financialFlg: true
             };
         },
         methods: {
@@ -874,6 +877,26 @@ import { error } from 'dingtalk-jsapi';
                             })
                         } });
             },
+            // 补齐注释,一月三十号
+            financialClick() {
+                this.http.post('/project-percentage/getTemplate', {ymonth: this.date},
+                    res => {
+                    if (res.code == "ok") {
+                        let fName = this.$t('allocationImporttemplates' ) + '.xlsx'
+                        var filePath = res.data;
+                        const a = document.createElement('a'); // 创建a标签
+                        a.setAttribute('download', fName);// download属性
+                        a.setAttribute('href', filePath);// href链接
+                        a.click(); //自执行点击事件
+                        a.remove();
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                });
+            },
             //获取当月的无项目工时人员的分配比例设置
             getMonthSetting() {
                 this.costSettingLoading = true;
@@ -884,6 +907,12 @@ import { error } from 'dingtalk-jsapi';
                             this.projectCols = res.data.financeProjects;
                             this.allProjectList = res.data.allProjectList;
                             this.userCostSettingList = res.data.userCostSetting;
+                            if(res.data.financeProjects.length <= 0 && res.data.userCostSetting <= 0) {
+                                this.financialFlg = false
+                            } else {
+                                this.financialFlg = true
+                            }
+                            console.log(this.financialFlg, '看看返回的数据是什么')
                             //上次如果没有配置过,需要初始化
                             for (var i=0;i<this.noReportUserList.length; i++) {
                                 var rUser = this.noReportUserList[i];