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