修复不同角色进入菜单没更正问题
This commit is contained in:
parent
72b800a4c9
commit
f7574bb496
42
src/api/doctor/list.js
Normal file
42
src/api/doctor/list.js
Normal file
@ -0,0 +1,42 @@
|
||||
import request from '../../utils/request'
|
||||
|
||||
const url = '/admin/doctor';
|
||||
|
||||
|
||||
export function getDoctorList(params){
|
||||
return request({
|
||||
url:'/admin/doctor',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function addDoctor(data) {
|
||||
return request({
|
||||
url,
|
||||
method: 'Doctor',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function removeDoctor(data) {
|
||||
return request({
|
||||
url,
|
||||
method: 'delete',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateDoctor(data, id) {
|
||||
return request({
|
||||
url: `${url}/${id}`,
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function getDoctorDetail(id){
|
||||
return request({
|
||||
url:'/admin/doctor/'+id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@ -10,15 +10,16 @@
|
||||
:default-selected-keys="defaultSelectKeys"
|
||||
:auto-open-selected="true"
|
||||
>
|
||||
<sub-menu :menu-list="permissionStore.menuList" />
|
||||
<sub-menu :menuList="menuList" />
|
||||
</a-menu>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onBeforeMount } from 'vue';
|
||||
import { ref, onBeforeMount,watch} from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useUserStore } from '@/store/userInfo';
|
||||
import { usePermissionStore } from '@/store/permission';
|
||||
import { storeToRefs } from 'pinia';
|
||||
|
||||
import SubMenu from './SubMenu.vue';
|
||||
|
||||
@ -31,7 +32,7 @@ const props = defineProps({
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const {menuList} = storeToRefs(permissionStore);
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
@ -43,10 +44,7 @@ const keepDefaultSelect = () => {
|
||||
defaultSelectKeys.value = [];
|
||||
defaultSelectKeys.value.push(route.fullPath);
|
||||
};
|
||||
|
||||
const handleMenuClick = (key) => {
|
||||
console.log(key)
|
||||
console.log(router.getRoutes())
|
||||
router.push(key);
|
||||
};
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { getUserMenuRole,getUserButtonRole } from '@/api/admin/login';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
// import { getCurrentInstance} from 'vue';
|
||||
// const { proxy } = getCurrentInstance();
|
||||
const modules = import.meta.glob('../views/**/*.vue');
|
||||
@ -18,6 +19,8 @@ export const usePermissionStore = defineStore('permisson', {
|
||||
actions: {
|
||||
setMenuList(menus) {
|
||||
this.menuList = menus;
|
||||
console.log('-------');
|
||||
console.log(menus)
|
||||
},
|
||||
GenerateRoutes(routeList) {
|
||||
const routes = [];
|
||||
@ -57,9 +60,12 @@ export const usePermissionStore = defineStore('permisson', {
|
||||
if(code==200){
|
||||
this.buttonPermissions=data;
|
||||
}else{
|
||||
//proxy.$notification.error(message);
|
||||
Message.error(message);
|
||||
}
|
||||
},
|
||||
clearRouters(){
|
||||
this.addRouters = [];
|
||||
},
|
||||
ClearMenuList() {
|
||||
this.menuList = [];
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { setLocalStorage, getLocalStorage } from '@/utils/storage';
|
||||
import {logout} from '@/api/admin/login'
|
||||
import { usePermissionStore } from '@/store/permission';
|
||||
import { getInfo } from '@/api/admin/sys-user';
|
||||
import { getAppConfig } from '@/api/admin/login';
|
||||
|
||||
@ -51,10 +52,12 @@ export const useUserStore = defineStore('user', {
|
||||
},
|
||||
async userLogut() {
|
||||
const {code} = await logout();
|
||||
const permissionStore=usePermissionStore();
|
||||
if(code==200){
|
||||
this.token = null;
|
||||
this.userInfo = null;
|
||||
|
||||
permissionStore.ClearMenuList();
|
||||
permissionStore.clearRouters();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -269,7 +269,7 @@ const filterTreeNode = (searchVal, nodeData) => {
|
||||
const handleUpdate = async (record) => {
|
||||
const res = await getMenuDetails(record.menu_id);
|
||||
Object.assign(modalForm, res.data);
|
||||
|
||||
|
||||
modalTitle.value = '修改菜单';
|
||||
modalVisible.value = true;
|
||||
};
|
||||
@ -290,6 +290,7 @@ const handleSubmit = (done) => {
|
||||
proxy.$message.error(message);
|
||||
}
|
||||
} else {
|
||||
modalForm.api_ids= modalForm.apis;
|
||||
const { code,message } = await updateMenu(modalForm, modalForm.menu_id);
|
||||
if (code==200) {
|
||||
proxy.$message.success('修改成功');
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<div class="app-container">
|
||||
<a-form :model="queryForm" ref="queryFormRef" layout="inline">
|
||||
|
||||
<a-form-item field="postName" label="岗位名称">
|
||||
<a-form-item field="post_name" label="岗位名称">
|
||||
<a-input v-model="queryForm.post_name" placeholder="请输入岗位名称" @press-enter="handleQuery" />
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
|
||||
340
src/views/doctor/doctor-list/index.vue
Normal file
340
src/views/doctor/doctor-list/index.vue
Normal file
@ -0,0 +1,340 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<a-form :model="queryForm" ref="queryFormRef" layout="inline">
|
||||
|
||||
<a-form-item field="doctorName" label="医生名字">
|
||||
<a-input v-model="queryForm.user_name" placeholder="请输入医生名字" @press-enter="handleQuery" />
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-space>
|
||||
<a-button type="primary" @click="handleQuery"><icon-search /> 搜索</a-button>
|
||||
<a-button @click="handleResetQuery"><icon-loop /> 重置</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
<a-divider />
|
||||
|
||||
<!-- action -->
|
||||
<div class="action">
|
||||
<a-space>
|
||||
<a-button v-has="'admin:sysDoctor:add'" type="primary" @click="handleAdd"><icon-plus /> 新增 </a-button>
|
||||
<a-button v-has="'admin:sysDoctor:remove'" type="primary" status="danger" @click="() => { deleteVisible = true; }"><icon-delete /> 批量删除 </a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
|
||||
<!-- table -->
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:scroll="{ x: 2000 }"
|
||||
:data="tableData"
|
||||
:pagination="{ 'show-total': true, 'show-jumper': true, 'show-page-size': true, total: pager.total, current: currentPage }"
|
||||
:row-selection="{ type: 'checkbox', showCheckedAll: true }"
|
||||
row-key="doctor_id"
|
||||
@selection-change="(selection) => {deleteData = selection;}"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlepage_sizeChange"
|
||||
>
|
||||
<template #doctor_id="{record,rowIndex}">
|
||||
<div>{{(rowIndex+1)+(pager.page-1)*10}}</div>
|
||||
</template>
|
||||
<template #doctor_title="{ record }">
|
||||
<!-- 医生职称(1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师) -->
|
||||
<div v-if="record.doctor_title==1">主任医师</div>
|
||||
<div v-else-if="record.doctor_title==2">主任中医师</div>
|
||||
<div v-else-if="record.doctor_title==3">副主任医师</div>
|
||||
<div v-else-if="record.doctor_title==4">副主任中医师</div>
|
||||
<div v-else-if="record.doctor_title==5">主治医师</div>
|
||||
<div v-else-if="record.doctor_title==6">住院医师</div>
|
||||
</template>
|
||||
<template #hospital_name="{record}">
|
||||
<div class="hospital_name" :title="record.hospital_name">{{record.hospital_name}}</div>
|
||||
</template>
|
||||
|
||||
<template #inquiry_service="{ record }">
|
||||
<span>{{filterService(record)}}</span>
|
||||
</template>
|
||||
<template #iden_auth_status="{ record }">
|
||||
<!-- 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败) -->
|
||||
|
||||
<a-tag v-if="record.iden_auth_status == 0" color="gray">未认证</a-tag>
|
||||
<a-tag v-else-if="record.iden_auth_status == 1" color="green">正常</a-tag>
|
||||
<a-tag v-else-if="record.iden_auth_status == 2" color="yellow">审核中</a-tag>
|
||||
<a-tag v-else color="red">认证失败)</a-tag>
|
||||
</template>
|
||||
<template #is_recommend="{ record }">
|
||||
<!-- 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败) -->
|
||||
|
||||
<a-tag v-if="record.is_recommend == 0" color="gray">否</a-tag>
|
||||
<a-tag v-else color="green">是</a-tag>
|
||||
</template>
|
||||
|
||||
<template #action="{ record }">
|
||||
<a-space>
|
||||
<a-button v-has="'admin:sysDoctor:detail'" type="text" @click="handleDetail(record)"><icon-edit />详情</a-button>
|
||||
<a-button v-has="'admin:sysDoctor:edit'" type="text" @click="handleUpdate(record)"><icon-edit /> 修改</a-button>
|
||||
<a-button v-has="'admin:sysDoctor:remove'" type="text" @click="() => { deleteVisible = true; deleteData = [record.doctor_id]; }"><icon-delete /> 删除</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<!-- Modal -->
|
||||
<a-modal
|
||||
v-model:visible="modalVisible"
|
||||
:title="modalTitle"
|
||||
title-align="start"
|
||||
@before-ok="handleSubmit"
|
||||
@close="() => {$refs.modalFormRef.resetFields(); modalForm.doctor_id = null;}"
|
||||
>
|
||||
<a-form :model="modalForm" :rules="rules" ref="modalFormRef">
|
||||
<a-form-item field="user_name" label="医生名字">
|
||||
<a-input v-model="modalForm.user_name" placeholder="请输入医生名字" />
|
||||
</a-form-item>
|
||||
|
||||
<!-- <a-form-item field="status" label="医生状态">
|
||||
<a-radio-group v-model="modalForm.status">
|
||||
<a-radio :value="2"> 正常 </a-radio>
|
||||
<a-radio :value="1"> 停用 </a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item field="remark" label="备注">
|
||||
<a-textarea v-model="modalForm.remark" placeholder="请输入备注内容" />
|
||||
</a-form-item> -->
|
||||
</a-form>
|
||||
</a-modal>
|
||||
|
||||
<!-- Akiraka 20230223 删除与批量删除 开始 -->
|
||||
<DeleteModal
|
||||
:data="deleteData"
|
||||
:visible="deleteVisible"
|
||||
:apiDelete="removeDoctor"
|
||||
@deleteVisibleChange="() => deleteVisible = false"
|
||||
/>
|
||||
<!-- Akiraka 20230223 删除与批量删除 结束 -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, getCurrentInstance, onMounted, nextTick, watch } from 'vue';
|
||||
import { getDoctorList, addDoctor, removeDoctor, updateDoctor } from '@/api/doctor/list';
|
||||
import { parseTime } from '@/utils/parseTime';
|
||||
|
||||
// Akiraka 20230210 删除数据
|
||||
const deleteData = ref([])
|
||||
// Akiraka 20230210 删除对话框
|
||||
const deleteVisible = ref(false)
|
||||
// Akiraka 20230210 监听删除事件
|
||||
watch(() => deleteVisible.value ,(value) => {
|
||||
if ( value == false ) {
|
||||
getDoctorInfo(pager);
|
||||
}
|
||||
})
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const currentPage = ref(1);
|
||||
// Pager
|
||||
const pager = {
|
||||
total: 0,
|
||||
page: 1,
|
||||
page_size: 10,
|
||||
};
|
||||
// form
|
||||
const queryForm = reactive({});
|
||||
const modalForm = reactive({
|
||||
sort: 0,
|
||||
status: 1,
|
||||
});
|
||||
|
||||
// Rules
|
||||
const rules = {
|
||||
user_name: [{ required: true, message: '请输入医生名字' }]
|
||||
};
|
||||
|
||||
// Modal
|
||||
const modalVisible = ref(false);
|
||||
const modalTitle = ref('默认标题');
|
||||
|
||||
// Batch Del List
|
||||
let batchList = [];
|
||||
|
||||
// Table Columns
|
||||
const columns = [
|
||||
{ title: '医生编号', dataIndex: 'doctor_id',slotName: 'doctor_id'},
|
||||
{ title: '医生名字', dataIndex: 'user_name' },
|
||||
{ title: '手机号码', dataIndex: 'mobile' },
|
||||
{ title: '医院', dataIndex: 'hospital_name',width:'180', slotName:'hospital_name'},
|
||||
{ title: '职称', dataIndex: 'doctor_title',slotName:'doctor_title' },
|
||||
{ title: '开启服务', dataIndex: 'inquiry_service',slotName:'inquiry_service' },
|
||||
{ title: '审核状态', dataIndex: 'iden_auth_status',slotName: 'iden_auth_status' },
|
||||
{ title: '是否推荐', dataIndex: 'is_recommend',slotName:'is_recommend' },
|
||||
{ title: '申请人', dataIndex: 'user_name' },
|
||||
{ title: '启用状态', dataIndex: 'user_status' },
|
||||
// { title: '创建时间', dataIndex: 'created_at', slotName: 'created_at' },
|
||||
{ title: '操作', slotName: 'action',fixed: 'right',width:'300'},
|
||||
];
|
||||
|
||||
// Table Data
|
||||
const tableData = ref([]);
|
||||
|
||||
// 新增
|
||||
const handleAdd = () => {
|
||||
modalVisible.value = true;
|
||||
modalTitle.value = '新增医生';
|
||||
};
|
||||
//详情
|
||||
const handleDetail = () => {
|
||||
modalVisible.value = true;
|
||||
modalTitle.value = '详情';
|
||||
};
|
||||
// 修改
|
||||
const handleUpdate = async (record) => {
|
||||
modalVisible.value = true;
|
||||
modalTitle.value = '修改医生';
|
||||
|
||||
await nextTick();
|
||||
Object.assign(modalForm, record);
|
||||
};
|
||||
//开启服务处理
|
||||
const filterService=(record)=>{
|
||||
console.log(record)
|
||||
if(record.multi_point_status==1){
|
||||
let arr=[];
|
||||
let str='';
|
||||
if(record.is_img_expert_reception==1){
|
||||
arr.push("专家问诊");
|
||||
}else if(record.is_img_welfare_reception==1){
|
||||
arr.push("公益问诊")
|
||||
}else if(record.is_img_quick_reception==1){
|
||||
arr.push("快速问诊")
|
||||
};
|
||||
arr.forEach((item)=>{
|
||||
if(!str){
|
||||
str+=item
|
||||
}else{
|
||||
str+=','+item
|
||||
}
|
||||
})
|
||||
return str
|
||||
}else{
|
||||
return "暂无"
|
||||
}
|
||||
|
||||
}
|
||||
// Modal ok
|
||||
// 异步关闭Modal需要调用 done()
|
||||
const handleSubmit = (done) => {
|
||||
proxy.$refs.modalFormRef.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
let res;
|
||||
if (!modalForm.doctor_id) {
|
||||
const { code, message } = await addDoctor(modalForm);
|
||||
if (code == 200 ) {
|
||||
proxy.$notification.success('新增成功');
|
||||
} else {
|
||||
proxy.$notification.error(message);
|
||||
}
|
||||
} else {
|
||||
console.log("doctor_id:"+modalForm.doctor_id)
|
||||
|
||||
const { code, message } = await updateDoctor(modalForm, modalForm.doctor_id);
|
||||
if (code == 200 ) {
|
||||
proxy.$notification.success('更新成功');
|
||||
} else {
|
||||
proxy.$notification.error(message);
|
||||
}
|
||||
}
|
||||
done();
|
||||
getDoctorInfo(pager);
|
||||
} else {
|
||||
proxy.$message.error('表单校验失败');
|
||||
done(false);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 批量删除
|
||||
const handleBatchDelete = () => {
|
||||
if (batchList.length !== 0) {
|
||||
proxy.$modal.warning({
|
||||
title: '提示',
|
||||
content: '是否批量删除以下选中的数据?',
|
||||
hideCancel: false,
|
||||
onOk: async () => {
|
||||
const res = await removeDoctor({ ids: batchList });
|
||||
proxy.$message.success(res.message);
|
||||
getDoctorInfo(pager);
|
||||
},
|
||||
onCancel: () => {
|
||||
proxy.$message.info('已取消批量删除数据');
|
||||
},
|
||||
});
|
||||
} else {
|
||||
proxy.$message.error('请勾选需要删除的数据!');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 分页改变
|
||||
* @param {Number} [page]
|
||||
*/
|
||||
const handlePageChange = (page) => {
|
||||
pager.page = page;
|
||||
|
||||
// 修改当前页码
|
||||
currentPage.value = page;
|
||||
getDoctorInfo({ ...pager, ...queryForm });
|
||||
};
|
||||
|
||||
// 每页数据量
|
||||
const handlepage_sizeChange = (page_size) => {
|
||||
pager.page_size = page_size;
|
||||
getDoctorInfo({ ...pager, ...queryForm });
|
||||
};
|
||||
|
||||
// 获取医生信息
|
||||
const getDoctorInfo = async (params = {}) => {
|
||||
const { data, code, message } = await getDoctorList(params);
|
||||
if ( code == 200 ) {
|
||||
tableData.value = data.data;
|
||||
Object.assign(pager, { total: data.total, page: data.page, page_size: data.page_size });
|
||||
} else {
|
||||
proxy.$notification.error(message);
|
||||
}
|
||||
};
|
||||
|
||||
// 查询医生信息
|
||||
const handleQuery = async () => {
|
||||
const params = {
|
||||
page: pager.page,
|
||||
page_size: pager.page_size,
|
||||
...queryForm,
|
||||
};
|
||||
|
||||
getDoctorInfo(params);
|
||||
};
|
||||
|
||||
// 重置搜索
|
||||
const handleResetQuery = () => {
|
||||
proxy.$refs.queryFormRef.resetFields();
|
||||
|
||||
getDoctorInfo(queryForm);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getDoctorInfo(pager);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.action {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.hospital_name{
|
||||
width:100%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -144,7 +144,7 @@ const handleLogin = () => {
|
||||
const res=await getUserMenuRole();
|
||||
let path='';
|
||||
if(code==200){
|
||||
path=res.data[1].children[0].path;
|
||||
path=res.data[0].children[0].path;
|
||||
}
|
||||
proxy.$router.push(path);
|
||||
loading.value = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user