修复权限树父级节点问题

This commit is contained in:
zoujiandong 2023-07-07 08:40:48 +08:00
parent f7574bb496
commit 8e656552b9
4 changed files with 368 additions and 38 deletions

View File

@ -34,4 +34,21 @@ const onCollapse = () => {
padding: 16px;
background-color: #f2f3f5;
}
.titlebox{
display: flex;
align-items: center;
.bar{
width:4px;
height:24px;
background-color: rgb(var(--primary-6));
}
.name{
margin-left: 8px;
font-size: 18px;
}
}
.titletip{
margin-bottom: 15px;
}
</style>

View File

@ -65,7 +65,7 @@
<a-row :gutter="24">
<a-col :span="12">
<a-form-item field="parent_id" label="上级菜单">
<a-tree-select v-model="modalForm.parent_id" :data="tableData" :field-names="{ key: 'menu_id', icon: '_' ,title:'menu_title'}" :allow-search="true" :filter-tree-node="filterTreeNode" placeholder="请选择上级菜单"/>
<a-tree-select v-model="modalForm.parent_id" :data="tableData" :field-names="{ key: 'menu_id', icon: '_' ,title:'menu_title'}" :allow-search="true" :filter-tree-node="filterTreeNode" placeholder="请选择上级菜单"/>
</a-form-item>
</a-col>
<a-col :span="12">
@ -256,6 +256,7 @@ const modalTitle = ref('默认标题');
const handleAddMenu = (parent_id = null) => {
modalVisible.value = true;
modalTitle.value = '新增菜单';
modalForm.menu_id='';
if (parent_id) modalForm.parent_id = parent_id;
getSysMenuInfo();
};

View File

@ -107,6 +107,10 @@
:checkable="true"
:check-strictly="false"
:data="treeData"
ref="tree"
checked-strategy="child"
@check="checkTree"
:only-check-leaf="true"
:default-expand-all="true"
:field-names="{ key: 'menu_id', title: 'menu_title',icon: '_'}"
/>
@ -192,13 +196,14 @@
// Batch Delete List
const batchDeleteList = ref([]);
const allCheckKeys=ref([]);
// Form
const queryForm = reactive({});
const modalForm = reactive({
sort: 0,
role_status: '',
is_admin: ''
is_admin: '',
});
const scopeForm = reactive({});
@ -306,7 +311,19 @@
page_size
});
};
const tree=ref(null);
const checkTree=(checkedKeys,data)=>{
allCheckKeys.value=checkedKeys.concat(data.halfCheckedKeys);
console.log(checkedKeys);
console.log(data);
// if(data.checked){
// console.log(data.node.parent_id)
// tree.value.selectNode(data.node.parent_id,true);
// }
// console.log(checkedKeys);
// console.log(data);
}
//
const handleResetQuery = () => {
proxy.$refs.queryFormRef.resetFields();
@ -328,21 +345,22 @@
const { code, data, message } = await roleDetail(record.role_id);
if (code == 200) {
Object.assign(modalForm, data);
checkedKeys.value = data.menu_ids;
// console.log(data.menu_ids)
// checkedKeys id
//
const res2 = data.menu_ids.filter(item1 => !allParentId.some(item2 => item2 === item1))
checkedKeys.value = res2;
} else {
proxy.$notification.error(message);
}
//await nextTick();
//Object.assign(modalForm, record);
const menuIdsChecked = [];
data.menu_ids.forEach((item) => {
menuIdsChecked.push(item);
});
checkedKeys.value = menuIdsChecked;
// const menuIdsChecked = [];
// data.menu_ids.forEach((item) => {
// menuIdsChecked.push(item);
// });
// checkedKeys.value = menuIdsChecked;
};
//
@ -396,7 +414,7 @@
// valid
if (!valid) {
console.log(checkedKeys.value);
modalForm.menu_ids = checkedKeys.value;
modalForm.menu_ids = allCheckKeys.value;
let res;
if (modalForm.role_id) {
const {
@ -480,13 +498,23 @@
proxy.$notification.error(message);
}
};
let allParentId=[];
const getId=(arr)=>{
arr.forEach((item)=>{
if(item.children){
allParentId.push(item.menu_id);
getId(item.children);
}
});
};
//
const getRoleMenuTreeInfo = async () => {
const res = await getRoleMenuTree();
treeData.value = res.data;
console.log(res.data)
getId(res.data);
console.log(allParentId);
};

View File

@ -5,6 +5,38 @@
<a-form-item field="doctorName" label="医生名字">
<a-input v-model="queryForm.user_name" placeholder="请输入医生名字" @press-enter="handleQuery" />
</a-form-item>
<a-form-item field="mobile" label="电话号码">
<a-input v-model="queryForm.mobile" placeholder="请输入电话号码" @press-enter="handleQuery" />
</a-form-item>
<a-form-item field="hospital_name" label="所属医院">
<a-input v-model="queryForm.hospital_name" placeholder="请输入所属医院" @press-enter="handleQuery" />
</a-form-item>
<a-form-item field="inquiry_service" label="服务类型">
<a-select
v-model="queryForm.inquiry_service"
placeholder="请选择服务类型"
:style="{ width: '182px' }"
>
<!-- 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 -->
<a-option :value="1">专家问诊</a-option>
<a-option :value="2">快速问诊</a-option>
<a-option :value="3">公益问诊</a-option>
<a-option :value="4">问诊购药</a-option>
</a-select>
</a-form-item>
<a-form-item field="multi_point_status" label="认&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;证">
<a-select
v-model="queryForm.multi_point_status"
placeholder="请选择多点认证状态"
:style="{ width: '180px' }"
>
<!-- 医生多点执业认证状态0:未认证 1:认证通过 2:审核中 3:认证失败 -->
<a-option :value="0">未认证</a-option>
<a-option :value="1">认证通过</a-option>
<a-option :value="2">审核中</a-option>
<a-option :value="3">认证失败</a-option>
</a-select>
</a-form-item>
<a-form-item>
<a-space>
<a-button type="primary" @click="handleQuery"><icon-search /> 搜索</a-button>
@ -50,13 +82,11 @@
<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>
@ -64,11 +94,13 @@
</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 #status="{ record }">
<!-- 状态0:禁用 1:正常 2:删除 -->
<a-switch v-model="record.status" checked-color="#14C9C9" :checked-value="1" unchecked-value="0" />
</template>
<template #action="{ record }">
<a-space>
<a-button v-has="'admin:sysDoctor:detail'" type="text" @click="handleDetail(record)"><icon-edit />详情</a-button>
@ -81,16 +113,261 @@
<!-- Modal -->
<a-modal
v-model:visible="modalVisible"
fullscreen
:title="modalTitle"
title-align="start"
:footer="false"
@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="请输入医生名字" />
<div class="titlebox">
<div class="bar"></div>
<div class="name">医生信息</div>
</div>
<a-form :model="modalForm" :rules="rules" ref="modalFormRef" :auto-label-width="true">
<a-form-item field="user_name" label="医生头像">
<a-space size="large">
<a-avatar :size="80" :shape="circle" imageUrl="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/3ee5f13fb09879ecb5185e440cef6eb9.png~tplv-uwbnlip3yd-webp.webp">
</a-avatar>
</a-space>
<a-upload action="/" />
</a-form-item>
<a-row :gutter="24">
<a-col :span="12">
<a-form-item field="user_name" label="医生名字">
{{modalForm.user_name}}
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item field="user_name" label="身份证号">
<!-- {{modalForm.user_doctor_info.card_num_mask}} -->
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="12">
<a-form-item field="user_name" label="联系电话">
{{modalForm.user_name}}
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item field="user_name" label="多点执业">
<!-- {{modalForm.user_doctor_info.card_num_mask}} -->
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="12">
<a-form-item field="user_name" label="医院地址">
<a-input v-model="queryForm.dept_name" placeholder="请输入部门名称" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item field="user_name" label="医院名称">
<a-input v-model="queryForm.dept_name" placeholder="请输入部门名称" />
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="12">
<a-form-item field="user_name" label="所在科室">
<a-input v-model="queryForm.dept_name" placeholder="请输入部门名称" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item field="user_name" label="科室名称">
<a-input v-model="queryForm.dept_name" placeholder="请输入部门名称" />
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="12">
<a-form-item field="user_name" label="职 称">
<a-input v-model="queryForm.dept_name" placeholder="请输入部门名称" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item field="user_name" label="科室电话">
<a-input v-model="queryForm.dept_name" placeholder="请输入部门名称" />
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="24">
<a-form-item field="user_name" label="执业证编码">
<a-input v-model="queryForm.dept_name" placeholder="请输入部门名称" />
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="24">
<a-form-item field="user_name" label="资格证编码">
<a-input v-model="queryForm.dept_name" placeholder="请输入部门名称" />
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="24">
<a-form-item field="user_name" label="专长">
<a-textarea v-model="modalForm.remark" placeholder="请输入备注内容" />
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="24">
<a-form-item field="user_name" label="擅长信息">
<a-textarea v-model="modalForm.remark" placeholder="请输入备注内容" />
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="24">
<a-form-item field="user_name" label="个人简介">
<a-textarea v-model="modalForm.remark" placeholder="请输入备注内容" />
</a-form-item>
</a-col>
</a-row>
<a-divider />
<div class="titlebox">
<div class="bar"></div>
<div class="name">是否推荐</div>
</div>
<a-row :gutter="24" style="margin-top: 35px;">
<a-col :span="4">
<a-form-item field="" label="状态">
<a-switch checked-color="#14C9C9" />
</a-form-item>
</a-col>
<a-col :span="20"><div>理由平台合作</div></a-col>
</a-row>
<a-divider />
<div class="titlebox">
<div class="bar"></div>
<div class="name">医师证件</div>
</div>
<a-row :gutter="24" style="margin-top: 35px;">
<a-col :span="24">
<a-form-item field="" label="" no-style>
<div class="titletip">医师执业证<span>(点击图片查看大图)</span></div>
<a-image-preview-group infinite>
<a-space>
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/cd7a1aaea8e1c5e3d26fe2591e561798.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/6480dbc69be1b5de95010289787d64f1.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/0265a04fddbd77a19602a15d9d55d797.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/24e0dd27418d2291b65db1b21aa62254.png~tplv-uwbnlip3yd-webp.webp" width="200" />
</a-space>
</a-image-preview-group>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24" style="margin-top: 35px;">
<a-col :span="24">
<a-form-item field="" label="" no-style>
<div class="titletip">医师资格证<span>(点击图片查看大图)</span></div>
<a-image-preview-group infinite>
<a-space>
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/cd7a1aaea8e1c5e3d26fe2591e561798.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/6480dbc69be1b5de95010289787d64f1.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/0265a04fddbd77a19602a15d9d55d797.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/24e0dd27418d2291b65db1b21aa62254.png~tplv-uwbnlip3yd-webp.webp" width="200" />
</a-space>
</a-image-preview-group>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24" style="margin-top: 35px;">
<a-col :span="24">
<a-form-item field="" label="" no-style>
<div class="titletip">医师职称证<span>(点击图片查看大图)</span></div>
<a-image-preview-group infinite>
<a-space>
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/cd7a1aaea8e1c5e3d26fe2591e561798.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/6480dbc69be1b5de95010289787d64f1.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/0265a04fddbd77a19602a15d9d55d797.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/24e0dd27418d2291b65db1b21aa62254.png~tplv-uwbnlip3yd-webp.webp" width="200" />
</a-space>
</a-image-preview-group>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24" style="margin-top: 35px;">
<a-col :span="24">
<a-form-item field="" label="" no-style>
<div class="titletip">医师身份证<span>(点击图片查看大图)</span></div>
<a-image-preview-group infinite>
<a-space>
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/cd7a1aaea8e1c5e3d26fe2591e561798.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/6480dbc69be1b5de95010289787d64f1.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/0265a04fddbd77a19602a15d9d55d797.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/24e0dd27418d2291b65db1b21aa62254.png~tplv-uwbnlip3yd-webp.webp" width="200" />
</a-space>
</a-image-preview-group>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24" style="margin-top: 35px;">
<a-col :span="24">
<a-form-item field="" label="" no-style>
<div class="titletip">医师手写签名<span>(点击图片查看大图)</span></div>
<a-image-preview-group infinite>
<a-space>
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/cd7a1aaea8e1c5e3d26fe2591e561798.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/6480dbc69be1b5de95010289787d64f1.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/0265a04fddbd77a19602a15d9d55d797.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/24e0dd27418d2291b65db1b21aa62254.png~tplv-uwbnlip3yd-webp.webp" width="200" />
</a-space>
</a-image-preview-group>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24" style="margin-top: 35px;">
<a-col :span="24">
<a-form-item field="" label="" no-style>
<div class="titletip">医师云证书<span>(点击图片查看大图)</span></div>
<a-image-preview-group infinite>
<a-space>
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/cd7a1aaea8e1c5e3d26fe2591e561798.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/6480dbc69be1b5de95010289787d64f1.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/0265a04fddbd77a19602a15d9d55d797.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/24e0dd27418d2291b65db1b21aa62254.png~tplv-uwbnlip3yd-webp.webp" width="200" />
</a-space>
</a-image-preview-group>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24" style="margin-top: 35px;">
<a-col :span="24">
<a-form-item field="" label="" no-style>
<div class="titletip">医师二维码<span>(点击图片查看大图)</span></div>
<a-image-preview-group infinite>
<a-space>
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/cd7a1aaea8e1c5e3d26fe2591e561798.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/6480dbc69be1b5de95010289787d64f1.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/0265a04fddbd77a19602a15d9d55d797.png~tplv-uwbnlip3yd-webp.webp" width="200" />
<a-image show-loader src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/24e0dd27418d2291b65db1b21aa62254.png~tplv-uwbnlip3yd-webp.webp" width="200" />
</a-space>
</a-image-preview-group>
</a-form-item>
</a-col>
</a-row>
<a-divider />
<div class="titlebox">
<div class="bar"></div>
<div class="name">操作</div>
</div>
<a-row :gutter="24" style="margin-top: 35px;">
<a-col :span="24">
<a-form-item field="" label="" no-style>
<a-space>
<a-button type="primary">保存</a-button>
<a-button type="primary" status="warning">拉黑</a-button>
<a-button type="primary" status="danger">删除</a-button>
</a-space>
</a-form-item>
</a-col>
</a-row>
<!-- <a-form-item field="status" label="医生状态">
<a-radio-group v-model="modalForm.status">
<a-radio :value="2"> 正常 </a-radio>
@ -140,7 +417,9 @@
page_size: 10,
};
// form
const queryForm = reactive({});
const queryForm = reactive({
inquiry_service:''
});
const modalForm = reactive({
sort: 0,
status: 1,
@ -160,7 +439,7 @@
// Table Columns
const columns = [
{ title: '医生编号', dataIndex: 'doctor_id',slotName: 'doctor_id'},
{ title: '编号', dataIndex: 'doctor_id',slotName: 'doctor_id',width:'100'},
{ title: '医生名字', dataIndex: 'user_name' },
{ title: '手机号码', dataIndex: 'mobile' },
{ title: '医院', dataIndex: 'hospital_name',width:'180', slotName:'hospital_name'},
@ -169,7 +448,7 @@
{ 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: 'status',slotName:'status'},
// { title: '', dataIndex: 'created_at', slotName: 'created_at' },
{ title: '操作', slotName: 'action',fixed: 'right',width:'300'},
];
@ -185,7 +464,7 @@
//
const handleDetail = () => {
modalVisible.value = true;
modalTitle.value = '详情';
modalTitle.value = '医生详情';
};
//
const handleUpdate = async (record) => {
@ -197,17 +476,20 @@
};
//
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){
}
if(record.is_img_welfare_reception==1){
arr.push("公益问诊")
}else if(record.is_img_quick_reception==1){
}
if(record.is_img_quick_reception==1){
arr.push("快速问诊")
};
if(record.multi_point_status==1){
arr.push("问诊购药")
}
arr.forEach((item)=>{
if(!str){
str+=item
@ -215,12 +497,9 @@
str+=','+item
}
})
return str
}else{
return "暂无"
return str?str:"暂无"
}
}
// Modal ok
// Modal done()
const handleSubmit = (done) => {
@ -235,8 +514,6 @@
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('更新成功');
@ -326,7 +603,7 @@
});
</script>
<style lang="scss">
<style lang="scss" scoped>
.action {
margin-bottom: 12px;
}
@ -336,5 +613,12 @@
overflow: hidden;
text-overflow: ellipsis;
}
.headImg{
margin-right: 20px;
border-radius: 50%;
}
.arco-form-item-layout-horizontal:first-child{
align-items: center;
}
</style>