|
@@ -342,6 +342,7 @@
|
|
|
<el-button :disabled="multipleSelection.length==0" @click="setPercent(true, null)">批量设置比例</el-button>
|
|
|
<el-button :disabled="projectCols.length==0 || userCostSettingList.length == 0" @click="getLastMonthSetting">使用上月比例设置</el-button>
|
|
|
<el-button @click="showSelectProjectDialog">管理待分摊项目</el-button>
|
|
|
+ <el-button @click="intoAmortizationRatio">导入分摊比例</el-button>
|
|
|
</div>
|
|
|
<el-table :data="userCostSettingList" highlight-current-row v-loading="costSettingLoading"
|
|
|
ref="settingTable" @selection-change="handleSelectionChange"
|
|
@@ -378,6 +379,17 @@
|
|
|
<el-button type="primary" @click="saveProjectSetting()" >确定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+ <el-dialog title="导入分摊比例数据" v-if="intoAmortizationDialog" :visible.sync="intoAmortizationDialog" customClass="customWidth" width="500px">
|
|
|
+ <p>1. 下载
|
|
|
+ <el-link type="primary" style="margin-left:5px;" :underline="false" href="./upload/员工项目分摊比例模板2.xlsx" download="员工项目分摊比例导入模板.xlsx">员工项目分摊比例模板.xlsx</el-link>
|
|
|
+ </p>
|
|
|
+ <p>2. 填写excel模板,请确保模板中的项目和人员已添加到系统中。</p>
|
|
|
+ <p style="display: flex;justify-content: center;">
|
|
|
+ <el-upload ref="upload" action="#" :limit="1" :http-request="batchImportData" :show-file-list="false">
|
|
|
+ <el-button type="primary" :underline="false" :loading="importingData">开始导入</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </p>
|
|
|
+ </el-dialog>
|
|
|
<el-dialog title="设置员工成本各项目占比" show-header="false" v-if="setPercentDialog" :visible.sync="setPercentDialog"
|
|
|
:close-on-click-modal="false" customClass="customWidth" width="600px" >
|
|
|
<div style="margin:0px 10px 10px 10px;">
|
|
@@ -479,7 +491,9 @@ import { error } from 'dingtalk-jsapi';
|
|
|
reviewLis: [],
|
|
|
ovReviewLis: [],
|
|
|
xzImportVisible: false,
|
|
|
- xzList: []
|
|
|
+ xzList: [],
|
|
|
+ intoAmortizationDialog : false ,
|
|
|
+ importingData: false,
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -1320,7 +1334,49 @@ import { error } from 'dingtalk-jsapi';
|
|
|
type: "error"
|
|
|
});
|
|
|
});
|
|
|
- }
|
|
|
+ },
|
|
|
+ //导入分摊比例
|
|
|
+ intoAmortizationRatio(){
|
|
|
+ this.intoAmortizationDialog = true;
|
|
|
+ },
|
|
|
+ batchImportData(item) {
|
|
|
+ //首先判断文件类型
|
|
|
+ let str = item.file.name.split(".");
|
|
|
+ let format = str[str.length - 1];
|
|
|
+ if (format != "xls" && format != "xlsx") {
|
|
|
+ this.$message({
|
|
|
+ message: "请选择.xls或.xlsx文件",
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.importingData = true;
|
|
|
+ let formData = new FormData();
|
|
|
+ formData.append("file", item.file);
|
|
|
+ formData.append("companyId", this.user.companyId);
|
|
|
+ this.http.uploadFile('/report/importData', formData,
|
|
|
+ res => {
|
|
|
+ this.$refs.upload.clearFiles();
|
|
|
+ this.importingData = false;
|
|
|
+ this.showImportResult = true;
|
|
|
+ if (res.code == "ok") {
|
|
|
+ //换成弹出框,以免有人等了半天回来啥也没看到
|
|
|
+ this.importResultMsg = "成功导入"+res.data+"条分摊比例数据。"+(res.msg?res.msg:"");;
|
|
|
+ this.getReportList();
|
|
|
+ this.importWXDialog = false;
|
|
|
+ } else {
|
|
|
+ this.importResultMsg = "导入失败:"+res.msg;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ this.$refs.upload.clearFiles();
|
|
|
+ this.importingData = false;
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
},
|
|
|
created() {
|