Browse Source

新增下载用户信息

ymz 3 days ago
parent
commit
e338f0e10e

+ 2 - 2
.env.development

@@ -2,8 +2,8 @@ NODE_ENV = 'development'
 VUE_APP_TYPE= 'dev'
 # VUE_APP_URL = 'http://10.144.62.235:9999'
 # VUE_APP_URL = 'https://mic.freerr.cn'
-VUE_APP_URL = 'https://mic.cnbg.com.cn'
+# VUE_APP_URL = 'https://mic.cnbg.com.cn'
 # VUE_APP_URL = 'https://cnbg.yaoyi.net'
 # VUE_APP_URL = 'http://192.168.110.25:9999'
-# VUE_APP_URL = 'https://mic-t.cnbg.com.cn'
+VUE_APP_URL = 'https://mic-t.cnbg.com.cn'
 # VUE_APP_URL = 'http://nk5xzj.natappfree.cc'

BIN
dist.zip


+ 15 - 0
src/api/admin/user.js

@@ -216,3 +216,18 @@ export function getBindProdApi(userId) {
     }
   });
 }
+
+export function exportUserInfo(data) {
+  return request({
+    url: `/admin/user/export/export-user`,
+    method: 'post',
+    data
+  });
+}
+
+export function getExportUserResult(data) {
+  return request({
+    url: `/admin/user/export/export-user-result`,
+    method: 'get'
+  });
+}

+ 2 - 2
src/const/crud/riskEventAudit.js

@@ -33,8 +33,8 @@ export const tableOption = {
       searchSpan: 6
     },
     {
-      label: '服务周期',
-      prop: 'period',
+      label: '提交时间',
+      prop: 'taskPeriod',
       searchLabelWidth: 100,
       search: true,
       searchslot: true,

+ 16 - 26
src/views/admin/user/components/fullTimeStaffRecordDialog.vue

@@ -1,18 +1,8 @@
 <template>
-  <el-dialog
-    title="提示"
-    :visible.sync="dialogVisible"
-    width="60%"
-    @close="close"
-  >
+  <el-dialog title="提示" :visible.sync="dialogVisible" width="60%" @close="close">
     <el-form :model="form" :rules="rules" ref="formRef">
       <el-form-item label="备案上传" prop="fileIds">
-        <uploadCom
-          @updateInfo="list => updateInfo(list, 'fileIds')"
-          :info="form.fileIds"
-          :show="true"
-          key="fileIds"
-        />
+        <uploadCom @updateInfo="(list) => updateInfo(list, 'fileIds')" :info="form.fileIds" :show="true" key="fileIds" />
       </el-form-item>
     </el-form>
     <span slot="footer" class="dialog-footer">
@@ -23,20 +13,20 @@
 </template>
 
 <script>
-import uploadCom from "@/components/uploadCom/uploadCom";
-import { userCertCreateApi, certDetailsApi } from "@/api/admin/role";
+import uploadCom from '@/components/uploadCom/uploadCom';
+import { userCertCreateApi, certDetailsApi } from '@/api/admin/role';
 export default {
   components: { uploadCom },
   data() {
     return {
       dialogVisible: false,
       form: {
-        userId: "",
-        type: "REG",
+        userId: '',
+        type: 'REG',
         fileIds: []
       },
       rules: {
-        fileIds: [{ required: true, message: "请上传备案信息" }]
+        fileIds: [{ required: true, message: '请上传备案信息' }]
       }
     };
   },
@@ -54,7 +44,7 @@ export default {
     async getDetail() {
       const res = await certDetailsApi(this.form.userId);
       if (res.data.code === 0 && res.data.data.length) {
-        let arr = res.data.data.map(item => {
+        let arr = res.data.data.map((item) => {
           if (item.file) {
             const obj = {
               fileId: item.file.id,
@@ -64,15 +54,15 @@ export default {
             return obj;
           }
         });
-        console.log("arr", arr);
+        console.log('arr', arr);
         this.form.fileIds = arr;
       }
-      console.log("ress", res);
+      console.log('ress', res);
     },
     submitInfo() {
-      this.$refs.formRef.validate(async valid => {
+      this.$refs.formRef.validate(async (valid) => {
         if (valid) {
-          const fileIds = this.form.fileIds.map(item => item.fileId);
+          const fileIds = this.form.fileIds.map((item) => item.fileId);
           let obj = {
             userId: this.form.userId,
             type: this.form.type,
@@ -80,8 +70,8 @@ export default {
           };
           const res = await userCertCreateApi(obj);
           if (res.data.data) {
-            this.$message.success("备案成功");
-            this.$emit("success");
+            this.$message.success('备案成功');
+            this.$emit('success');
             this.close();
           }
         }
@@ -89,8 +79,8 @@ export default {
     },
     close() {
       this.form = {
-        userId: "",
-        type: "REG",
+        userId: '',
+        type: 'REG',
         fileIds: []
       };
       this.dialogVisible = false;

+ 75 - 33
src/views/admin/user/index.vue

@@ -29,15 +29,14 @@
           <!-- 批量导入 -->
           <el-button class="filter-item" type="primary" size="small" icon="el-icon-upload" @click="importUserOpen">导入用户 </el-button>
         </template>
+
         <!-- 右侧菜单 -->
         <template slot="menuRight">
           <!-- 角色说明隐藏 -->
-          <!-- <el-button
-            class="role-btn"
-            type="text"
-            @click="roleDialogVisible = true"
-            >角色说明</el-button
-          > -->
+          <el-button v-if="userInfo?.roles?.includes(50) && downShow" size="small" :disabled="exportUserInfoDisabled" type="primary" @click="downInfo">{{
+            exportUserInfoText
+          }}</el-button>
+          <el-button v-if="userInfo?.roles?.includes(50)" size="small" type="primary" @click="exportUserInfo">导出人员数据</el-button>
         </template>
         <!-- 操作栏 -->
         <template slot="menu" slot-scope="scope">
@@ -109,7 +108,7 @@
 
         <!-- 表单-角色 -->
         <template slot="roleForm">
-          <el-select v-model="form.role" :rules="[{required: true, message: '请选择角色', trigger: 'blur'}]" multiple clearable>
+          <el-select v-model="form.role" :rules="[{ required: true, message: '请选择角色', trigger: 'blur' }]" multiple clearable>
             <el-option v-for="item in rolesList" :key="item.roleId" :label="item.roleName" :value="item.roleId" :disabled="item.disabled"> </el-option>
           </el-select>
         </template>
@@ -180,22 +179,22 @@
 </template>
 
 <script>
-import {mapGetters} from 'vuex';
-import {tableOption, importErrorTableOption} from '@/const/crud/admin/user';
-import {listDept} from '@/api/wmdaagent';
-import {getAreaTreeApi} from '@/api/areaTree';
-import {roleExcludeList, getListByDeptApi} from '@/api/admin/role';
-import {templateDownload} from '@/api/assignPoints/currency/manList';
+import { mapGetters } from 'vuex';
+import { tableOption, importErrorTableOption } from '@/const/crud/admin/user';
+import { listDept } from '@/api/wmdaagent';
+import { getAreaTreeApi } from '@/api/areaTree';
+import { roleExcludeList, getListByDeptApi } from '@/api/admin/role';
+import { templateDownload } from '@/api/assignPoints/currency/manList';
 import RoleDescriptionDialog from './components/roleDescriptionDialog.vue';
 import QuizDialog from '@/views/admin/wmscorepackagestatus/components/quizDialog';
 import fullTimeStaffRecordDialog from './components/fullTimeStaffRecordDialog.vue';
 import communicationOfficerDialog from './components/communicationOfficerDialog.vue';
 import boundMedicinesDialog from './components/boundMedicinesDialog.vue';
 import UserCard from './components/UserCard.vue';
-import {addObj, delObj, fetchList, putObj, getUserDetails, batchChannelCert, getAuthInfo, getUserInfoApi} from '@/api/admin/user';
+import { addObj, delObj, fetchList, putObj, getUserDetails, batchChannelCert, getAuthInfo, getUserInfoApi, exportUserInfo, getExportUserResult } from '@/api/admin/user';
 import store from '@/store';
-import {getDictType} from '@/api/common';
-import {filterCodes, extractPaths} from '@/util/treeUtils.js';
+import { getDictType } from '@/api/common';
+import { filterCodes, extractPaths } from '@/util/treeUtils.js';
 
 export default {
   components: {
@@ -208,6 +207,10 @@ export default {
   },
   data() {
     return {
+      exportUserInfoText: '',
+      exportUrl: '',
+      downShow: false,
+      exportUserInfoDisabled: false,
       hideCommunicationOfficer: true,
       dialogType: '',
       option: tableOption,
@@ -279,10 +282,10 @@ export default {
       const parentIdList = this.findObject(this.option.column, 'parentIdList');
       // 选择区域
       const areaCodesData = this.findObject(this.option.column, 'areaCodesData');
-      const isDeptRole = !newVal || newVal.length === 0 || [5, 6, 31].some(role => newVal.includes(role));
+      const isDeptRole = !newVal || newVal.length === 0 || [5, 6, 31].some((role) => newVal.includes(role));
       this.$set(deptId, 'editDisplay', !isDeptRole);
       this.$set(deptId, 'addDisplay', !isDeptRole);
-      if ([5, 6, 37].some(role => newVal.includes(role))) {
+      if ([5, 6, 37].some((role) => newVal.includes(role))) {
         this.form.areaCodesData = [];
         this.noArea = true;
         this.$set(areaCodesData, 'editDisplay', false);
@@ -305,7 +308,7 @@ export default {
         this.areaCodesDisabled = true;
       }
       if (newval) {
-        const curr = this.deptLists.find(item => item.deptId === newval);
+        const curr = this.deptLists.find((item) => item.deptId === newval);
         if (this.noArea) {
           this.isLevel2csoDept = curr;
         }
@@ -340,9 +343,48 @@ export default {
     const roles = this.userInfo.roles;
   },
   methods: {
+    async exportUserInfo() {
+      const res = await exportUserInfo({});
+      console.log(res);
+      if (res.data.code === 0 && res.data.data) {
+        this.getExportInfoStatus();
+        this.downShow = true;
+        this.exportUserInfoText = '数据生成中';
+        this.exportUserInfoDisabled = true;
+      }
+    },
+    // 获取导出状态
+    async getExportInfoStatus() {
+      const res = await getExportUserResult();
+
+      if (res.data.code === 0) {
+        const timer = setInterval(() => {
+          if (res.data.data.status == 'GENERATED') {
+            this.exportUrl = res.data.data.latestUrl;
+            this.exportUserInfoText = '下载数据';
+            this.exportUserInfoDisabled = false;
+            clearInterval(timer);
+          } else if (res.data.data.status == 'GENERATING') {
+            this.exportUserInfoText = '数据生成中';
+            this.exportUserInfoDisabled = true;
+
+            this.getExportInfoStatus();
+          }
+        }, 5000);
+      }
+    },
+    downInfo() {
+      let link = document.createElement('a');
+      link.style.display = 'none';
+      link.href = process.env.VUE_APP_URL + this.exportUrl;
+      link.setAttribute('download', '用户信息.xlsx');
+      document.body.appendChild(link);
+      link.click();
+      document.body.removeChild(link);
+    },
     // 判断可以绑定药品的角色id
     showBoundMedicines(role) {
-      const flag = role.some(item => item >= 49 || item == 39 || item == 41);
+      const flag = role.some((item) => item >= 49 || item == 39 || item == 41);
       return flag;
     },
     // 生产企业监督员绑定药品
@@ -394,8 +436,8 @@ export default {
       }
       const res = await fetchList(obj);
 
-      res.data.data.records.forEach(item => {
-        item.role = item.roleList.map(iten => iten.roleId);
+      res.data.data.records.forEach((item) => {
+        item.role = item.roleList.map((iten) => iten.roleId);
       });
       const records = res.data.data.records;
       this.list = records;
@@ -417,10 +459,10 @@ export default {
     },
     // 获取字典
     getDict() {
-      getDictType({type: 'gender'}).then(res => {
+      getDictType({ type: 'gender' }).then((res) => {
         this.genderList = res.data.data;
       });
-      getDictType({type: 'user_degree'}).then(res => {
+      getDictType({ type: 'user_degree' }).then((res) => {
         this.userDegreeList = res.data.data;
       });
     },
@@ -432,11 +474,11 @@ export default {
       const res = await roleExcludeList();
       // 当前角色:BC总负责人,筛选出角色19: csm
       if (this.userInfo.roles.includes(35)) {
-        res.data.data = response.data.data.filter(item => item.roleId === 19);
+        res.data.data = response.data.data.filter((item) => item.roleId === 19);
       }
       let data = res.data.data;
       const roleList = [5, 6, 37];
-      data = data.filter(item => !roleList.includes(item.roleId));
+      data = data.filter((item) => !roleList.includes(item.roleId));
       this.rolesList = data;
       this.rolesList.forEach((ele, idx) => {
         this.$set(this.rolesList[idx], 'disabled', false);
@@ -470,7 +512,7 @@ export default {
         return this.$refs.communicationOfficerRef.editFn(row);
       }
 
-      const role = row.roleList.map(item => item.roleId);
+      const role = row.roleList.map((item) => item.roleId);
       row.role = role;
       const areaCodes = row.areaCodes;
 
@@ -507,17 +549,17 @@ export default {
       const res = await getUserInfoApi(row.userId);
       this.userCardInfo = res.data.data;
       // 性别回显
-      const curr = this.genderList.find(item => item.value === this.userCardInfo.gender);
+      const curr = this.genderList.find((item) => item.value === this.userCardInfo.gender);
       if (curr) {
         this.userCardInfo.genderLabel = curr.label;
       }
       // 学历回显
-      const curr2 = this.userDegreeList.find(item => item.value === this.userCardInfo.degree);
+      const curr2 = this.userDegreeList.find((item) => item.value === this.userCardInfo.degree);
       if (curr2) {
         this.userCardInfo.degreeLabel = curr2.label;
       }
       if (this.userCardInfo.qualificationsUrl && this.userCardInfo.qualificationsUrl.length) {
-        const arr = this.userCardInfo.qualificationsUrl.map(item => process.env.VUE_APP_URL + item);
+        const arr = this.userCardInfo.qualificationsUrl.map((item) => process.env.VUE_APP_URL + item);
         this.userCardInfo.qualificationsUrl = arr;
         this.srcList = arr;
       }
@@ -559,7 +601,7 @@ export default {
       if (res.data && res.data.code === 'FAILURE') {
         // 上传有错误
         const errorData = res.data.data;
-        this.importErrorTableData = Object.keys(errorData).map(key => ({
+        this.importErrorTableData = Object.keys(errorData).map((key) => ({
           reason: key,
           index: errorData[key]
         }));
@@ -580,7 +622,7 @@ export default {
       templateDownload({
         fileName: 'batch_create_user_template.xlsx'
       })
-        .then(response => {
+        .then((response) => {
           this.importLoading = false;
           let url = window.URL.createObjectURL(new Blob([response.data]));
           let link = document.createElement('a');
@@ -598,7 +640,7 @@ export default {
     updateDepartmentInfo() {
       if (!this.form.deptId) {
         this.form.deptId = this.userInfo.deptId;
-        const curr = this.deptLists.find(item => item.deptId === this.form.deptId);
+        const curr = this.deptLists.find((item) => item.deptId === this.form.deptId);
         this.isLevel2csoDept = curr;
       }
       this.form.areaCodes = this.isLevel2csoDept.areaCodes;

+ 22 - 9
src/views/servicePackageMonitoring/riskEventAudit/index.vue

@@ -32,8 +32,8 @@
       @size-change="sizeChange"
       @current-change="currentChange"
     >
-      <template slot="periodSearch">
-        <ElQuarterPicker placeholder="请选择" v-model="monthrange" @change="monthrangeChange" class="w100" />
+      <template slot="taskPeriodSearch">
+        <ElQuarterPicker placeholder="请选择" :value="monthrange" v-model="monthrange" @change="monthrangeChange" class="w100" />
       </template>
 
       <template slot="menuRight">
@@ -99,6 +99,7 @@ import { tableOption } from '@/const/crud/riskEventAudit.js';
 import { getAreaTreeApi } from '@/api/areaTree';
 import monitorDialog from './components/monitorDialog.vue';
 import { mapGetters } from 'vuex';
+import dayjs from 'dayjs';
 
 export default {
   components: { monitorDialog, ElQuarterPicker },
@@ -114,7 +115,7 @@ export default {
       tableData: [],
       treeList: [],
       searchForm: {
-        period: []
+        taskPeriod: []
       },
       supervision: false,
       searchFormAreaCodes: [],
@@ -125,6 +126,7 @@ export default {
       },
       supervisionInfo: {},
       IS_JDY: false,
+
       monthrange: '',
       exportDialog: false,
       exportMonthrange: '',
@@ -136,6 +138,9 @@ export default {
     ...mapGetters(['userInfo'])
   },
   created() {
+    const curr = this.getCurrentQuarterNumber();
+    this.monthrange = curr;
+    this.monthrangeChange(this.monthrange);
     this.getAreaTree();
     // 获取监督统计
     this.getSupervisionPkgStat();
@@ -143,12 +148,21 @@ export default {
     const roles = this.userInfo.roles;
     const rolesArr = [49, 52, 53, 56];
     this.IS_JDY = roles.some((item) => rolesArr.includes(item));
+
+    //
   },
 
   activated() {
     this.getList(this.page);
   },
   methods: {
+    getCurrentQuarterNumber() {
+      const now = dayjs();
+      const year = now.year();
+      const month = now.month(); // 0-11
+      const quarter = Math.floor(month / 3) + 1; // 1 到 4
+      return `${year}-0${quarter}`;
+    },
     exportDialogHandleClose() {
       this.exportMonthrange = '';
       this.exportPeriod = [];
@@ -157,10 +171,10 @@ export default {
     monthrangeChange(e) {
       if (e) {
         let arr = this.getQuarterRange(e);
-        this.searchForm.period = arr;
+        this.searchForm.taskPeriod = arr;
       } else {
         this.monthrange = '';
-        this.searchForm.period = [];
+        this.searchForm.taskPeriod = [];
       }
     },
     exportFn(row) {
@@ -179,7 +193,7 @@ export default {
     async exportBtn() {
       const obj = {
         entId: this.currRow.deptId,
-        period: this.exportPeriod
+        taskPeriod: this.exportPeriod
       };
       const res = await reportExportApi(obj);
 
@@ -320,10 +334,9 @@ export default {
       this.$refs.monitorRef.showInfo(row);
     },
     taskMonitorFn(row, type) {
-      console.log(row);
-
+      console.log('this.monthrange', this.monthrange)
       this.$router.push({
-        path: '/servicePackageMonitoring/riskEventAudit/taskMonitor?deptId=' + row.deptId + `&type=${type}`,
+        path: '/servicePackageMonitoring/riskEventAudit/taskMonitor?deptId=' + row.deptId + `&type=${type}&time=${this.monthrange}`,
         query: {
           name: '任务监督-' + row.deptName
         }

+ 40 - 5
src/views/servicePackageMonitoring/riskEventAudit/taskMonitor.vue

@@ -28,8 +28,9 @@
               </el-form-item>
             </el-col>
             <el-col :span="6">
-              <el-form-item label="起止时间">
-                <ElQuarterPicker placeholder="请选择" v-model="monthrange" @change="monthrangeChange" class="w100" />
+              <el-form-item label="起止时间:">
+                <!-- <ElQuarterPicker placeholder="请选择" v-model="monthrange" @change="monthrangeChange" class="w100" /> -->
+                <p>{{ currText }}</p>
               </el-form-item>
             </el-col>
           </el-row>
@@ -230,6 +231,7 @@ export default {
   data() {
     return {
       typeArr: ['area', 'text', 'inputautoselect', 'map', 'mapwithimg', 'datetime', 'datatimerange', 'money', 'number', ''],
+      currText: '',
       type: 0,
       hasMap: false,
       mapShow: true,
@@ -258,7 +260,9 @@ export default {
         pkgName: '',
         pkgPeriod: [],
         mahName: '',
-        memberName: ''
+        memberName: '',
+        taskPeriod: [],
+
       },
       monthrange: '',
       allCheck: false,
@@ -284,6 +288,37 @@ export default {
   async created() {
     this.type = this.$route.query.type == 0;
 
+    const time = this.$route.query.time;
+    if (time) {
+      const [year, quarterCode] = time.split('-').map(Number);
+      let text = '';
+      switch (quarterCode) {
+        case 1: // Q1
+          text = '第一季度';
+          break;
+        case 2: // Q2
+          text = '第二季度';
+          break;
+        case 3: // Q3
+          text = '第三季度';
+          break;
+        case 4: // Q4
+          text = '第四季度';
+          break;
+        default:
+          throw new Error('Invalid quarter code');
+      }
+
+      let str = `${year}年${text}`;
+
+      this.currText = str;
+
+      this.monthrangeChange(time)
+
+    }
+
+
+
     await this.getTaskList();
     this.getList();
   },
@@ -392,10 +427,10 @@ export default {
     monthrangeChange(e) {
       if (e) {
         let arr = this.getQuarterRange(e);
-        this.form.pkgPeriod = arr;
+        this.form.taskPeriod = arr;
       } else {
         this.monthrange = '';
-        this.form.pkgPeriod = [];
+        this.form.taskPeriod = [];
       }
     },
     getQuarterRange(dateString) {