3 次代碼提交 89b5529d59 ... d63dc1ec4e

作者 SHA1 備註 提交日期
  ymz d63dc1ec4e 导出数据 1 月之前
  ymz 0984bee689 个人包数据导出 任务明细导出 1 月之前
  ymz ce4a03b215 新增导出功能 1 月之前

+ 16 - 0
src/api/taskManagement/missionCenter.js

@@ -104,3 +104,19 @@ export function taskExportNewExcelNbqybg(query) {
     params: query
   });
 }
+
+export function exportTaskDetail(data) {
+  return request({
+    url: '/admin/task/export/export-detail',
+    method: 'post',
+    data
+  });
+}
+
+export function exportPkgSubInfo(data) {
+  return request({
+    url: '/admin/pkg/sub-info/export',
+    method: 'post',
+    data
+  });
+}

+ 4 - 1
src/const/crud/missionCenter.js

@@ -7,7 +7,10 @@ export const missionCenterData = {
   border: true,
   addBtn: false,
   delBtn: false,
-
+  refreshBtn: false,
+  gridBtn: false,
+  columnBtn: false,
+  searchShowBtn: false,
   editBtn: false,
   searchMenuSpan: 4,
   searchLabelWidth: '90',

+ 183 - 2
src/views/admin/taskManagement/missionCenter.vue

@@ -15,6 +15,20 @@
         <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(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(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 +189,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 +217,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 +228,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 +281,9 @@ export default {
     if (roles.includes(37)) {
       this.showBtn = true;
     }
+
+    this.gerTaskExprotResult();
+    this.gerPkgExprotResult();
   },
   methods: {
     async exportBtnFn() {
@@ -495,7 +541,134 @@ 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();
+    },
+    // 获取导出状态 - 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.taskDetailUrl = 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.pkgUrl = 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);
+    }
   }
 };
 </script>
@@ -516,6 +689,14 @@ export default {
     width: 240px;
   }
 }
+
+.right-btns {
+  display: flex;
+  align-items: center;
+  .r-btn {
+    margin-right: 10px;
+  }
+}
 </style>
 <style>
 .tabStyle {

+ 26 - 15
src/views/admin/user/index.vue

@@ -339,7 +339,7 @@ export default {
     this.getDict();
 
     // 获取上次导出的数据信息
-         this.getExportInfoStatus();
+    this.getExportInfoStatus();
   },
   mounted() {
     // 50 隐藏沟通专员
@@ -354,37 +354,48 @@ export default {
       }
     },
     // 获取导出状态
+    // 获取导出状态 - 用户信息导出
     async getExportInfoStatus() {
-      const timer = setInterval(async () => {
-        const res = await getExportResult({
-          type: 'USER'
-        });
+      const checkStatus = async () => {
+        const res = await getExportResult({ type: 'USER' });
         if (res.data.code === 0) {
           this.downShow = true;
           const status = res.data.data.status;
+
           if (status === 'GENERATING') {
             this.exportUserInfoText = '数据生成中';
             this.exportUserInfoDisabled = true;
+            return false;
           } else if (status === 'GENERATED') {
             this.exportUrl = res.data.data.latestUrl;
             this.exportUserInfoText = '下载数据';
             this.exportUserInfoDisabled = false;
-            clearInterval(timer);
+            return true;
           } else if (status === 'ERROR') {
-            // 可选:处理其他状态
-            this.exportUserInfoText = res.data.data.errorMsg;
-            this.exportUserInfoDisabled = false;
-            clearInterval(timer);
-          }else {
-             this.downShow = fasle;
+            this.exportUserInfoText = res.data.data.errorMsg || '导出失败';
+            this.exportUserInfoDisabled = true;
+            return true;
+          } else {
+            this.downShow = false;
+            return true;
           }
         } else {
-          // 接口报错处理
           this.exportUserInfoText = '获取状态失败';
           this.exportUserInfoDisabled = false;
-          clearInterval(timer);
+          return true;
         }
-      }, 5000);
+      };
+
+      // 先执行一次
+      const stop = await checkStatus();
+
+      // 如果还在生成中,启动轮询
+      if (!stop) {
+        const timer = setInterval(async () => {
+          const stopLoop = await checkStatus();
+          if (stopLoop) clearInterval(timer);
+        }, 5000); // 每5秒轮询一次
+      }
     },
 
     downInfo() {

+ 184 - 0
src/views/serviceManagement/serviceReviewed/index.vue

@@ -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>