|
@@ -98,6 +98,21 @@
|
|
|
<el-tooltip class="item" effect="dark" content="导出需要大量计算,请耐心等候,不要频繁点击" placement="top">
|
|
|
<el-button type="primary" size="small" @click="exportBtnFn" :loading="exportLoading">导 出</el-button>
|
|
|
</el-tooltip>
|
|
|
+
|
|
|
+ <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>
|
|
|
</div>
|
|
|
|
|
|
<div class="table">
|
|
@@ -181,6 +196,18 @@
|
|
|
:layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
|
|
|
>
|
|
|
</vxe-pager>
|
|
|
+
|
|
|
+ <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>
|
|
|
|
|
@@ -195,6 +222,9 @@ import {
|
|
|
getTaskV2CheckHisApi,
|
|
|
pkgCheckExportApi
|
|
|
} from '@/api/serviceManagement/servicesToBeReviewed/index.js';
|
|
|
+
|
|
|
+import { exportTaskDetail, exportPkgSubInfo } from '@/api/taskManagement/missionCenter';
|
|
|
+import { getExportResult } from '@/api/admin/user';
|
|
|
import { tableOptin } from './index.js';
|
|
|
import { getDictType } from '@/api/common';
|
|
|
import abbreviationsProvinces from '@/const/abbreviationsProvinces.js';
|
|
@@ -208,6 +238,20 @@ export default {
|
|
|
components: { refuseReason, TaskDetail },
|
|
|
data() {
|
|
|
return {
|
|
|
+ taskDetailShow: false,
|
|
|
+ taskDetailBtnText: '',
|
|
|
+ exportTaskDetailDisabled: false,
|
|
|
+ exportType: '',
|
|
|
+ taskDetailUrl: '',
|
|
|
+ exportDialogVisible: false,
|
|
|
+ exportPkgDisabled: false,
|
|
|
+ pkgUrl: '',
|
|
|
+
|
|
|
+ pkgDetailShow: false,
|
|
|
+ pkgBtnText: '',
|
|
|
+ exportForm: {
|
|
|
+ startDate: ''
|
|
|
+ },
|
|
|
tableOptin,
|
|
|
tableData: [],
|
|
|
tableLoading: false,
|
|
@@ -265,6 +309,9 @@ export default {
|
|
|
const currYear = dayjs().format('YYYY');
|
|
|
this.searchFrom.year = currYear;
|
|
|
this.getList();
|
|
|
+
|
|
|
+ this.gerTaskExprotResult();
|
|
|
+ this.gerPkgExprotResult();
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
@@ -414,6 +461,133 @@ export default {
|
|
|
} catch (err) {
|
|
|
this.exportLoading = false;
|
|
|
}
|
|
|
+ },
|
|
|
+
|
|
|
+ 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();
|
|
|
+ },
|
|
|
+ // 获取导出状态 - TASK_DETAIL
|
|
|
+ async gerTaskExprotResult() {
|
|
|
+ const checkStatus = 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;
|
|
|
+ return false;
|
|
|
+ } else if (status === 'GENERATED') {
|
|
|
+ this.exportUrl = res.data.data.latestUrl;
|
|
|
+ this.taskDetailBtnText = '下载数据';
|
|
|
+ this.exportTaskDetailDisabled = false;
|
|
|
+ return true;
|
|
|
+ } else if (status === 'ERROR') {
|
|
|
+ this.taskDetailBtnText = res.data.data.errorMsg;
|
|
|
+ this.exportTaskDetailDisabled = true;
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ this.taskDetailShow = false;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.taskDetailBtnText = '获取状态失败';
|
|
|
+ this.exportTaskDetailDisabled = false;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 初次执行
|
|
|
+ const stop = await checkStatus();
|
|
|
+
|
|
|
+ // 如果状态仍是生成中,开始轮询
|
|
|
+ if (!stop) {
|
|
|
+ const timer = setInterval(async () => {
|
|
|
+ const stopLoop = await checkStatus();
|
|
|
+ if (stopLoop) {
|
|
|
+ clearInterval(timer);
|
|
|
+ }
|
|
|
+ }, 60000);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取导出状态 - SCORE_PACKAGE_SUB
|
|
|
+ async gerPkgExprotResult() {
|
|
|
+ const checkStatus = 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;
|
|
|
+ return false;
|
|
|
+ } else if (status === 'GENERATED') {
|
|
|
+ this.taskDetailUrl = res.data.data.latestUrl;
|
|
|
+ this.pkgBtnText = '下载数据';
|
|
|
+ this.exportPkgDisabled = false;
|
|
|
+ return true;
|
|
|
+ } else if (status === 'ERROR') {
|
|
|
+ this.pkgBtnText = res.data.data.errorMsg;
|
|
|
+ this.exportPkgDisabled = true;
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ this.pkgDetailShow = false;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.pkgBtnText = '获取状态失败';
|
|
|
+ this.exportPkgDisabled = false;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const stop = await checkStatus();
|
|
|
+
|
|
|
+ if (!stop) {
|
|
|
+ const timer = setInterval(async () => {
|
|
|
+ const stopLoop = await checkStatus();
|
|
|
+ if (stopLoop) {
|
|
|
+ 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);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -473,5 +647,15 @@ export default {
|
|
|
}
|
|
|
.table-btns {
|
|
|
margin: 10px 0;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+}
|
|
|
+
|
|
|
+.right-btns {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ .r-btn {
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|