|
@@ -15,6 +15,26 @@
|
|
|
<template slot="menuLeft">
|
|
|
<el-button v-if="showBtn" type="primary" size="small" @click="exportBtnFn">导 出</el-button>
|
|
|
</template>
|
|
|
+ <template slot="menuRight">
|
|
|
+ <div class="right-btns">
|
|
|
+ <div class="r-btn">
|
|
|
+ <el-button v-if="(userInfo.roles.includes(4) || userInfo.roles.includes(37)) && pkgDetailShow" :disabled="exportPkgDisabled" size="small" @click="downInfo(2)">{{
|
|
|
+ pkgBtnText
|
|
|
+ }}</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="exportPersonalPackage">个人执行包数据导出</el-button>
|
|
|
+ </div>
|
|
|
+ <div class="r-btn">
|
|
|
+ <el-button
|
|
|
+ v-if="(userInfo.roles.includes(4) || userInfo.roles.includes(37)) && taskDetailShow"
|
|
|
+ :disabled="exportTaskDetailDisabled"
|
|
|
+ size="small"
|
|
|
+ @click="downInfo(1)"
|
|
|
+ >{{ taskDetailBtnText }}</el-button
|
|
|
+ >
|
|
|
+ <el-button type="primary" size="small" @click="exportPersonalTaskDetails">个人任务明细数据导出</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
<template slot="taskTypes" slot-scope="scope">
|
|
|
<el-button type="text" size="small" icon="el-icon-view" @click="viewDetail(scope.row, scope.index)">查看 </el-button>
|
|
|
</template>
|
|
@@ -175,12 +195,25 @@
|
|
|
<el-button @click="taskTypedialog = false">取 消</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <el-dialog title="提示" :visible.sync="exportDialogVisible" width="30%">
|
|
|
+ <el-form ref="exportFormRef" :model="exportForm" label-width="80px">
|
|
|
+ <el-form-item label="选择月份">
|
|
|
+ <el-date-picker value-format="yyyy-MM-dd" v-model="exportForm.startDate" type="month" placeholder="选择月"> </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="handleExportDialogClose">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="exportDialogFn">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</basic-container>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { missionCenterData } from '@/const/crud/missionCenter';
|
|
|
import { pkgInfoExportApi } from '@/api/taskManagement/points.js';
|
|
|
+import { getExportResult } from '@/api/admin/user';
|
|
|
import {
|
|
|
getPageTasklist,
|
|
|
taskExportNbqybg,
|
|
@@ -190,7 +223,9 @@ import {
|
|
|
saveAndUpdateWmTask,
|
|
|
saveAndUpdateWmReport,
|
|
|
taskNewExportNbqybg,
|
|
|
- taskExportNewExcelNbqybg
|
|
|
+ taskExportNewExcelNbqybg,
|
|
|
+ exportTaskDetail,
|
|
|
+ exportPkgSubInfo
|
|
|
} from '@/api/taskManagement/missionCenter';
|
|
|
import { selectByScorePackageId } from '@/api/task/taskType';
|
|
|
import { plist } from '@/const/crud/taskTypeTree/index';
|
|
@@ -199,6 +234,20 @@ export default {
|
|
|
name: 'points',
|
|
|
data() {
|
|
|
return {
|
|
|
+ taskDetailShow: false,
|
|
|
+ taskDetailBtnText: '',
|
|
|
+ exportTaskDetailDisabled: false,
|
|
|
+ exportType: '',
|
|
|
+ taskDetailUrl: '',
|
|
|
+ exportDialogVisible: false,
|
|
|
+ exportPkgDisabled: false,
|
|
|
+ pkgUrl: '',
|
|
|
+
|
|
|
+ pkgDetailShow: false,
|
|
|
+ pkgBtnText: '',
|
|
|
+ exportForm: {
|
|
|
+ startDate: ''
|
|
|
+ },
|
|
|
pageLoading: false,
|
|
|
searchFormTask: {},
|
|
|
reportForm: {},
|
|
@@ -238,6 +287,9 @@ export default {
|
|
|
if (roles.includes(37)) {
|
|
|
this.showBtn = true;
|
|
|
}
|
|
|
+
|
|
|
+ this.gerTaskExprotResult();
|
|
|
+ this.gerPkgExprotResult();
|
|
|
},
|
|
|
methods: {
|
|
|
async exportBtnFn() {
|
|
@@ -495,7 +547,112 @@ export default {
|
|
|
// 导出确认按钮
|
|
|
exportSure() {},
|
|
|
// 导出取消按钮
|
|
|
- exportCancle() {}
|
|
|
+ exportCancle() {},
|
|
|
+
|
|
|
+ handleExportDialogClose() {
|
|
|
+ this.exportForm.startDate = '';
|
|
|
+ this.exportDialogVisible = false;
|
|
|
+ },
|
|
|
+ exportPersonalTaskDetails() {
|
|
|
+ this.exportType = '1';
|
|
|
+ this.exportDialogVisible = true;
|
|
|
+ },
|
|
|
+ exportPersonalPackage() {
|
|
|
+ this.exportType = '2';
|
|
|
+ this.exportDialogVisible = true;
|
|
|
+ },
|
|
|
+ async exportDialogFn() {
|
|
|
+ if (!this.exportForm.startDate) {
|
|
|
+ return this.$message.warning('请选择导出日期');
|
|
|
+ }
|
|
|
+ let res;
|
|
|
+ if (this.exportType == '1') {
|
|
|
+ res = await exportTaskDetail(this.exportForm);
|
|
|
+ } else {
|
|
|
+ res = await exportPkgSubInfo(this.exportForm);
|
|
|
+ }
|
|
|
+ if (res.data.data) {
|
|
|
+ this.exportType == '1' ? this.gerTaskExprotResult() : this.gerPkgExprotResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ this.handleExportDialogClose();
|
|
|
+ },
|
|
|
+ // 获取导出状态
|
|
|
+ async gerTaskExprotResult() {
|
|
|
+ const timer = setInterval(async () => {
|
|
|
+ const res = await getExportResult({
|
|
|
+ type: 'TASK_DETAIL'
|
|
|
+ });
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ this.taskDetailShow = true;
|
|
|
+ const status = res.data.data.status;
|
|
|
+ if (status === 'GENERATING') {
|
|
|
+ this.taskDetailBtnText = '数据生成中';
|
|
|
+ this.exportTaskDetailDisabled = true;
|
|
|
+ } else if (status === 'GENERATED') {
|
|
|
+ this.exportUrl = res.data.data.latestUrl;
|
|
|
+ this.taskDetailBtnText = '下载数据';
|
|
|
+ this.exportTaskDetailDisabled = false;
|
|
|
+ clearInterval(timer);
|
|
|
+ } else if (status === 'ERROR') {
|
|
|
+ // 可选:处理其他状态
|
|
|
+ this.taskDetailBtnText = res.data.data.errorMsg;
|
|
|
+ this.exportTaskDetailDisabled = true;
|
|
|
+ clearInterval(timer);
|
|
|
+ } else {
|
|
|
+ this.taskDetailShow = fasle;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 接口报错处理
|
|
|
+ this.taskDetailBtnText = '获取状态失败';
|
|
|
+ this.exportTaskDetailDisabled = false;
|
|
|
+ clearInterval(timer);
|
|
|
+ }
|
|
|
+ }, 60000);
|
|
|
+ },
|
|
|
+ // 获取导出状态
|
|
|
+ async gerPkgExprotResult() {
|
|
|
+ const timer = setInterval(async () => {
|
|
|
+ const res = await getExportResult({
|
|
|
+ type: 'SCORE_PACKAGE_SUB'
|
|
|
+ });
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ this.pkgDetailShow = true;
|
|
|
+ const status = res.data.data.status;
|
|
|
+ if (status === 'GENERATING') {
|
|
|
+ this.pkgBtnText = '数据生成中';
|
|
|
+ this.exportPkgDisabled = true;
|
|
|
+ } else if (status === 'GENERATED') {
|
|
|
+ this.taskDetailUrl = res.data.data.latestUrl;
|
|
|
+ this.pkgBtnText = '下载数据';
|
|
|
+ this.exportPkgDisabled = false;
|
|
|
+ clearInterval(timer);
|
|
|
+ } else if (status === 'ERROR') {
|
|
|
+ // 可选:处理其他状态
|
|
|
+ this.pkgBtnText = res.data.data.errorMsg;
|
|
|
+ this.exportPkgDisabled = true;
|
|
|
+ clearInterval(timer);
|
|
|
+ } else {
|
|
|
+ this.pkgDetailShow = fasle;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 接口报错处理
|
|
|
+ this.pkgBtnText = '获取状态失败';
|
|
|
+ this.exportTaskDetailDisabled = false;
|
|
|
+ clearInterval(timer);
|
|
|
+ }
|
|
|
+ }, 60000);
|
|
|
+ },
|
|
|
+ downInfo(type) {
|
|
|
+ let url = type == '1' ? this.taskDetailUrl : this.pkgUrl;
|
|
|
+ let link = document.createElement('a');
|
|
|
+ link.style.display = 'none';
|
|
|
+ link.href = process.env.VUE_APP_URL + url;
|
|
|
+ link.setAttribute('download', '用户信息.xlsx');
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ document.body.removeChild(link);
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
@@ -516,6 +673,14 @@ export default {
|
|
|
width: 240px;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+.right-btns {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ .r-btn {
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|
|
|
<style>
|
|
|
.tabStyle {
|