@@ -5,8 +5,8 @@ | |||
<link rel="icon" type="image/svg+xml" href="/logo_1.jpg" /> | |||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |||
<title>后台管理系统</title> | |||
<script type="module" crossorigin src="/assets/index-w08MfQVW.js"></script> | |||
<link rel="stylesheet" crossorigin href="/assets/index-ioYE9aJh.css"> | |||
<script type="module" crossorigin src="/assets/index-eXGpzddQ.js"></script> | |||
<link rel="stylesheet" crossorigin href="/assets/index-rOTXzbDU.css"> | |||
</head> | |||
<body> | |||
<div id="app"></div> |
@@ -14,6 +14,7 @@ export const getRoleGetpermissions = getModel(url.RoleGetpermissions); | |||
export const PostRoleDelpermission = postModel(url.RoleDelpermission); | |||
// 权限 | |||
export const PostRoleSavepermissions = postModel(url.RoleSavepermissions); | |||
export const addPermission = postModel(url.permissionAdd); | |||
export const getPermission = getModel(url.permissionList); | |||
export const updatePermission = postModel(url.permissionUpdate); | |||
@@ -194,10 +195,10 @@ export const GetJobapplicantListintroduction = getModel(url.JobapplicantListintr | |||
export const GetJobapplicantIntroductiondetail = getModel(url.JobapplicantIntroductiondetail); // 个人详情 | |||
// 统计 | |||
export const GetStatsMajor= getModel(url.StatsMajor); | |||
export const GetStatsCertificate= getModel(url.StatsCertificate); | |||
export const GetStatsWorkExperience= getModel(url.StatsWorkExperience); | |||
export const GetStatsHa= getModel(url.StatsHa); | |||
export const GetStatsAgeandgender= getModel(url.StatsAgeandgender); | |||
export const GetStatsEducation= getModel(url.StatsEducation); | |||
export const GetStatsPosition= getModel(url.StatsPosition); | |||
export const GetStatsMajor = getModel(url.StatsMajor); | |||
export const GetStatsCertificate = getModel(url.StatsCertificate); | |||
export const GetStatsWorkExperience = getModel(url.StatsWorkExperience); | |||
export const GetStatsHa = getModel(url.StatsHa); | |||
export const GetStatsAgeandgender = getModel(url.StatsAgeandgender); | |||
export const GetStatsEducation = getModel(url.StatsEducation); | |||
export const GetStatsPosition = getModel(url.StatsPosition); |
@@ -9,6 +9,7 @@ declare namespace urlType { | |||
RoleAddpermission : String, | |||
RoleGetpermissions : String, | |||
RoleDelpermission : String, | |||
RoleSavepermissions : String, | |||
permissionAdd : String, | |||
permissionList : String, | |||
permissionUpdate : String, |
@@ -12,6 +12,7 @@ export const url : urlType.url = { | |||
RoleAddpermission: admin + '/role/addpermission', | |||
RoleGetpermissions: admin + '/role/getpermissions', | |||
RoleDelpermission: admin + '/role/delpermission', | |||
RoleSavepermissions: admin + '/role/savepermissions', | |||
permissionAdd: admin + '/permission/add', | |||
permissionList: admin + '/permission/list', | |||
permissionUpdate: admin + '/permission/update', |
@@ -2,30 +2,30 @@ | |||
<a-menu mode="inline" v-model:openKeys="openSubMenu" @openChange="onOpenChange" inlineCollapsed | |||
v-model:selectedKeys="selectedMenu" style="background: #19be6b; height: '90vh';color: #fff;"> | |||
<template v-for="(item,index) in menuList"> | |||
<template v-if="!item.children"> | |||
<template v-if="!item.childs"> | |||
<a-menu-item :key="item.path" @click="onMenu(item.path)"> | |||
<template #icon> | |||
<component :is="item.meta.icon"></component> | |||
<!-- <component :is="item"></component> --> | |||
</template> | |||
<span>{{item.meta.title}}</span> | |||
<span>{{item.name}}</span> | |||
</a-menu-item> | |||
</template> | |||
<template v-else> | |||
<a-sub-menu :key="item.path"> | |||
<template #icon> | |||
<component :is="item.meta.icon"></component> | |||
<!-- <component :is="item"></component> --> | |||
</template> | |||
<template #title>{{item.meta.title}}</template> | |||
<template v-for="(twoItem, twoIndex) in item.children"> | |||
<a-sub-menu v-if="twoItem.children" :key="twoItem.path"> | |||
<template #title>{{item.name}}</template> | |||
<template v-for="(twoItem, twoIndex) in item.childs"> | |||
<a-sub-menu v-if="twoItem.childs" :key="twoItem.path"> | |||
<template #title> | |||
{{twoItem.meta.title}} | |||
{{twoItem.name}} | |||
</template> | |||
<a-menu-item v-for="(threeItem, threeIndex) in twoItem.children" :key="threeItem.path" | |||
@click="onMenu(threeItem.path)">{{ threeItem.meta.title }}</a-menu-item> | |||
<a-menu-item v-for="(threeItem, threeIndex) in twoItem.childs" :key="threeItem.path" | |||
@click="onMenu(threeItem.path)">{{ threeItem.name }}</a-menu-item> | |||
</a-sub-menu> | |||
<a-menu-item v-else @click="onMenu(twoItem.path)" :key="twoItem.path"> | |||
{{ twoItem.meta.title }} | |||
{{ twoItem.name }} | |||
</a-menu-item> | |||
</template> | |||
</a-sub-menu> |
@@ -19,7 +19,7 @@ export const useAsRouter = () => { | |||
// 匹配路由页面 | |||
function routerDynamic(userRouter : string[], originRouter : Object[]) { | |||
const finalRouter = originRouter.filter(item => userRouter.includes(item.name)).map(item => ({ ...item, children: item.children ? routerDynamic(userRouter, item.children) : null })); | |||
const finalRouter = originRouter.filter(item => userRouter.includes(item.action)).map(item => ({ ...item, childs: item.childs ? routerDynamic(userRouter, item.childs) : null })); | |||
return finalRouter; | |||
} | |||
@@ -43,7 +43,7 @@ const actions = { | |||
}) | |||
let arr = state.arrresult; | |||
// let arr = ['permission', 'role', 'account', 'company', 'vip', 'member', 'homemake', 'homemakeType', 'homemakePosition', 'homemakeDemand', 'homemakeAppointment', 'job', 'department', 'jobSeeker', 'jobResume', 'jobFair', 'jobFairList', 'jobFairCompany', 'information', 'section', 'article', 'list', 'putIn', 'advertisementList', 'advertisement', 'activity', 'activityList', 'activityAddress', 'statistics', 'statisticsResume', 'statisticsResumeMajor']; | |||
let routes = routerDynamic(arr, routesModuleList); | |||
let routes = routerDynamic(arr, res.data.menulist); | |||
LayoutRoute.children.push(...routes); | |||
commit('SET_MENU', LayoutRoute.children); | |||
routerAdd(LayoutRoute); |
@@ -5,182 +5,153 @@ | |||
<a-typography> | |||
<a-typography-title :level="4">基本资料</a-typography-title> | |||
<a-typography-paragraph> | |||
<a-row :gutter="[20,10]"> | |||
<a-col> | |||
姓名:{{detail.seekername}}王二狗 | |||
</a-col> | |||
<a-col> | |||
性别:{{detail.gender}}女 | |||
</a-col> | |||
<a-col> | |||
出生日期:{{detail.dob}}2022-11-12 | |||
</a-col> | |||
<a-col> | |||
民族:{{detail.ethnicity_txt}}汉族 | |||
</a-col> | |||
<a-col> | |||
身份证号:{{detail.id_number}}46002719960410596X | |||
</a-col> | |||
<a-col> | |||
婚姻状况:{{detail.marital_status_txt}}未婚 | |||
</a-col> | |||
<a-col> | |||
身高:{{detail.marital_status_txt}}180cm | |||
</a-col> | |||
<a-col> | |||
体重:{{detail.marital_status_txt}}54kg | |||
</a-col> | |||
<a-col span="24"> | |||
现居地:{{detail.now_level1_txt ? detail.now_level1_txt : ''}}{{detail.now_level2_txt ? detail.now_level2_txt : ''}}{{detail.now_level3_txt ? detail.now_level3_txt : ''}}{{detail.now_level4_txt ? detail.now_level4_txt : ''}} | |||
</a-col> | |||
<a-row :gutter="[20,20]"> | |||
<a-col span="24"> | |||
籍贯:{{detail.native_place_txt}} | |||
</a-col> | |||
<a-col span="24"> | |||
户口所在地:{{detail.now_level1_txt ? detail.now_level1_txt : ''}}{{detail.now_level2_txt ? detail.now_level2_txt : ''}}{{detail.now_level3_txt ? detail.now_level3_txt : ''}}{{detail.now_level4_txt ? detail.now_level4_txt : ''}} | |||
</a-col> | |||
<a-col span="24"> | |||
简历是否可见:<a-radio-group v-model:value="detail.hide_resume" button-style="solid" size="small"> | |||
<a-radio-button :value="1">是</a-radio-button> | |||
<a-radio-button :value="2">否</a-radio-button> | |||
</a-radio-group> | |||
</a-col> | |||
<a-col span="24"> | |||
家政板块是否可见:<a-radio-group v-model:value="detail.house_keeping_status" button-style="solid" | |||
size="small"> | |||
<a-radio-button :value="1">是</a-radio-button> | |||
<a-radio-button :value="2">否</a-radio-button> | |||
</a-radio-group> | |||
</a-col> | |||
<a-col span="24"> | |||
审核状态:<a-radio-group v-model:value="detail.status" button-style="solid" size="small"> | |||
<a-radio-button :value="1">待审核</a-radio-button> | |||
<a-radio-button :value="2">审核通过</a-radio-button> | |||
<a-radio-button :value="2">不通过</a-radio-button> | |||
</a-radio-group> | |||
<a-row :gutter="[20,20]"> | |||
<a-col span="10"> | |||
<a-row> | |||
<a-col span="24"> | |||
姓 名:{{detail.seekername}} | |||
</a-col> | |||
<a-col span="24"> | |||
性 别:{{detail.gender}} | |||
</a-col> | |||
<a-col span="24"> | |||
身份证号:{{detail.id_number}} | |||
</a-col> | |||
<a-col span="24"> | |||
民 族:{{detail.ethnicity_txt}} | |||
</a-col> | |||
<a-col span="24"> | |||
身 高:{{detail.height}}cm | |||
</a-col> | |||
<a-col span="24"> | |||
政治面貌:{{detail.political_status_txt}} | |||
</a-col> | |||
<a-col span="24"> | |||
联系方式:{{detail.mobile}} | |||
</a-col> | |||
<a-col span="24"> | |||
邮 箱:{{detail.email}} | |||
</a-col> | |||
</a-row> | |||
</a-col> | |||
<a-col span="10"> | |||
<a-row> | |||
<a-col span="24"> | |||
出生日期:{{detail.dob}} | |||
</a-col> | |||
<a-col span="24"> | |||
婚姻状况:{{detail.marital_status_txt}} | |||
</a-col> | |||
<a-col span="24"> | |||
学 历:{{detail.education_txt}} | |||
</a-col> | |||
<a-col span="24"> | |||
体 重:{{detail.weight}}kg | |||
</a-col> | |||
<a-col span="24"> | |||
现居地址:{{detail.now_level1_txt ? detail.now_level1_txt : ''}}{{detail.now_level2_txt ? detail.now_level2_txt : ''}}{{detail.now_level3_txt ? detail.now_level3_txt : ''}}{{detail.now_level4_txt ? detail.now_level4_txt : ''}} | |||
</a-col> | |||
<a-col span="24"> | |||
籍 贯:{{detail.native_place_txt}} | |||
</a-col> | |||
<a-col span="24"> | |||
户口地址:{{detail.now_level1_txt ? detail.now_level1_txt : ''}}{{detail.now_level2_txt ? detail.now_level2_txt : ''}}{{detail.now_level3_txt ? detail.now_level3_txt : ''}}{{detail.now_level4_txt ? detail.now_level4_txt : ''}} | |||
</a-col> | |||
</a-row> | |||
</a-col> | |||
<a-col span="4"> | |||
<a-image | |||
:src="'https://rcsc-test.jcjob.cn/img'+detail.photo" /> | |||
</a-col> | |||
</a-row> | |||
</a-col> | |||
</a-row> | |||
</a-typography-paragraph> | |||
<a-typography-title :level="4">联系信息</a-typography-title> | |||
<a-typography-title :level="4">个人简介</a-typography-title> | |||
<a-typography-paragraph> | |||
<a-row :gutter="[20,10]"> | |||
<a-col> | |||
固话:{{detail.landline ? detail.landline: '未填写'}}132132123123 | |||
</a-col> | |||
<a-col> | |||
移动电话:{{detail.mobile ? detail.mobile: '未填写'}}132132123123 | |||
</a-col> | |||
<a-col> | |||
qq:{{detail.qq ? detail.qq: '未填写'}}132132123123 | |||
</a-col> | |||
<a-col> | |||
个人网站:{{detail.personal_website ? detail.personal_website: '未填写'}}132132123123 | |||
<div v-html="detail.description"></div> | |||
</a-typography-paragraph> | |||
<a-typography-title :level="4">求职期望</a-typography-title> | |||
<a-typography-paragraph> | |||
<a-row> | |||
<a-col span="24"> | |||
工作经验:{{detail.work_experience}}年 | |||
</a-col> | |||
<a-col> | |||
通信地址:{{detail.mailing_address ? detail.mailing_address: '未填写'}}132132123123 | |||
<a-col span="24"> | |||
期望薪资:{{detail.salary_range_txt}} | |||
</a-col> | |||
<a-col> | |||
邮编:{{detail.postal_code ? detail.postal_code: '未填写'}}132132123123 | |||
<a-col span="24"> | |||
<a-row> | |||
<a-col span="8" v-if="detail.desire_areas"> | |||
<a-row> | |||
<a-col span="24" v-for="(item,index) in detail.desire_areas"> | |||
期望地址{{index + 1}}:{{item.level1_txt ? item.level1_txt : ''}}{{item.level2_txt ? item.level2_txt : ''}}{{item.level3_txt ? item.level3_txt : ''}}{{item.level4_txt ? item.level4_txt : ''}} | |||
</a-col> | |||
</a-row> | |||
</a-col> | |||
<a-col span="8" v-if="detail.desire_positions"> | |||
<a-row> | |||
<a-col span="24" v-for="(item,index) in detail.desire_positions"> | |||
期望职位{{index + 1}}:{{item.level1_txt ? item.level1_txt : ''}}{{item.level2_txt ? item.level2_txt : ''}} | |||
</a-col> | |||
</a-row> | |||
</a-col> | |||
<a-col span="8" v-if="detail.desire_industrys"> | |||
<a-row> | |||
<a-col span="24" v-for="(item,index) in detail.desire_industrys"> | |||
期望行业{{index + 1}}:{{item.industry_txt}} | |||
</a-col> | |||
</a-row> | |||
</a-col> | |||
</a-row> | |||
</a-col> | |||
</a-row> | |||
</a-typography-paragraph> | |||
</a-typography> | |||
<a-collapse v-model:activeKey="activeKey"> | |||
<a-collapse-panel key="1" header="基本资料"> | |||
<a-descriptions :column="4"> | |||
<a-descriptions-item label="姓名">{{detail.seekername}}</a-descriptions-item> | |||
<a-descriptions-item label="性别">{{detail.gender}}</a-descriptions-item> | |||
<a-descriptions-item label="出生日期">{{detail.dob}}</a-descriptions-item> | |||
<a-descriptions-item label="民族">{{detail.ethnicity_txt}}</a-descriptions-item> | |||
<a-descriptions-item label="地址" :span="3"> | |||
<br /> | |||
籍贯:{{detail.native_place_txt}} | |||
<br /> | |||
户口所在地:{{detail.now_level1_txt ? detail.now_level1_txt : ''}}{{detail.now_level2_txt ? detail.now_level2_txt : ''}}{{detail.now_level3_txt ? detail.now_level3_txt : ''}}{{detail.now_level4_txt ? detail.now_level4_txt : ''}} | |||
<br /> | |||
</a-descriptions-item> | |||
<a-descriptions-item label="照片"> | |||
<a-image :width="100" | |||
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" /> | |||
</a-descriptions-item> | |||
<a-descriptions-item label="身份证号">{{detail.id_number}}</a-descriptions-item> | |||
<a-descriptions-item label="婚姻状况">{{detail.marital_status_txt}}</a-descriptions-item> | |||
<a-descriptions-item label="身高">{{detail.height}}cm</a-descriptions-item> | |||
<a-descriptions-item label="体重">{{detail.weight}}kg</a-descriptions-item> | |||
<a-descriptions-item label="简历是否可见"> | |||
</a-descriptions-item> | |||
<a-descriptions-item label="家政板块是否可见"> | |||
</a-descriptions-item> | |||
<a-descriptions-item label="审核状态"> | |||
<a-radio-group v-model:value="detail.status" button-style="solid"> | |||
<a-radio-button :value="1">待审核</a-radio-button> | |||
<a-radio-button :value="2">审核通过</a-radio-button> | |||
<a-radio-button :value="2">不通过</a-radio-button> | |||
</a-radio-group> | |||
</a-descriptions-item> | |||
</a-descriptions> | |||
</a-collapse-panel> | |||
<a-collapse-panel key="2" header="联系信息"> | |||
<a-descriptions :column="4" bordered> | |||
<a-descriptions-item | |||
label="固话">{{detail.landline ? detail.landline: '未填写'}}</a-descriptions-item> | |||
<a-descriptions-item label="移动电话">{{detail.mobile ? detail.mobile: '未填写'}}</a-descriptions-item> | |||
<a-descriptions-item label="qq">{{detail.qq ? detail.qq: '未填写'}}</a-descriptions-item> | |||
<a-descriptions-item | |||
label="个人网站">{{detail.personal_website ? detail.personal_website: '未填写'}}</a-descriptions-item> | |||
<a-descriptions-item label="通信地址"> | |||
{{detail.mailing_address ? detail.mailing_address: '未填写'}} | |||
</a-descriptions-item> | |||
<a-descriptions-item label="邮编"> | |||
{{detail.postal_code ? detail.postal_code: '未填写'}} | |||
</a-descriptions-item> | |||
</a-descriptions> | |||
</a-collapse-panel> | |||
<a-collapse-panel key="3" header="个人简介"> | |||
<div v-html="introduction.description"></div> | |||
</a-collapse-panel> | |||
<a-collapse-panel key="4" header="专业技能掌握程度"> | |||
<a-steps style="margin-top: 8px" type="inline" :items="items" :current="2" /> | |||
<a-descriptions :column="4" bordered> | |||
<a-descriptions-item | |||
label="英语">{{detail.english_txt ? detail.english_txt: '未填写'}}</a-descriptions-item> | |||
<a-descriptions-item | |||
label="国语">{{detail.mandarin_txt ? detail.mandarin_txt: '未填写'}}</a-descriptions-item> | |||
<a-descriptions-item | |||
label="粤语">{{detail.cantonese_txt ? detail.cantonese_txt: '未填写'}}</a-descriptions-item> | |||
<a-descriptions-item | |||
label="第二外语">{{detail.other_language_txt ? detail.other_language_txt: '未填写'}}</a-descriptions-item> | |||
<a-descriptions-item label="计算机能力"> | |||
{{detail.computer_skills ? detail.computer_skills: '未填写'}} | |||
</a-descriptions-item> | |||
</a-descriptions> | |||
</a-collapse-panel> | |||
<a-collapse-panel key="5" header="培训经历"> | |||
<div v-if="trainList.length > 0"></div> | |||
<div v-else> | |||
未填写培训经历 | |||
</div> | |||
</a-collapse-panel> | |||
<a-collapse-panel key="6" header="求职意向"> | |||
<resume-intention @toNext="toNext" :customer_record="customer_record"></resume-intention> | |||
</a-collapse-panel> | |||
<a-collapse-panel key="7" header="工作经历"> | |||
<div v-if="experienceList.length > 0"></div> | |||
<div v-else> | |||
未填写工作经历 | |||
</div> | |||
</a-collapse-panel> | |||
<a-collapse-panel key="8" header="证书"> | |||
<resume-credential @toNext="toNext" :customer_record="customer_record"></resume-credential> | |||
</a-collapse-panel> | |||
</a-collapse> | |||
<a-typography-title :level="4">专业技能掌握能力</a-typography-title> | |||
<a-typography-paragraph> | |||
<a-row> | |||
<a-col span="24"> | |||
英 语:{{detail.english_txt}} | |||
</a-col> | |||
<a-col span="24"> | |||
国 语:{{detail.mandarin_txt}} | |||
</a-col> | |||
<a-col span="24"> | |||
粤 语:{{detail.cantonese_txt}} | |||
</a-col> | |||
<a-col span="24"> | |||
第二外语:{{detail.salary_range_txt}} | |||
</a-col> | |||
<a-col span="24"> | |||
计算机能力:{{detail.computer_skills}} | |||
</a-col> | |||
</a-row> | |||
</a-typography-paragraph> | |||
<a-typography-title :level="4">工作经历</a-typography-title> | |||
<a-typography-paragraph> | |||
<template v-for="(item,index) in detail.experiences"> | |||
<a-card :title="item.company_name" style="margin-bottom: 10px;"> | |||
<template #extra>{{item.position}}</template> | |||
<p>工作时间:{{item.start_year}}.{{item.start_month}}至{{item.end_year}}.{{item.end_month}}</p> | |||
<p>离职原因:{{item.reason_for_leaving}}</p> | |||
</a-card> | |||
</template> | |||
</a-typography-paragraph> | |||
<a-typography-title :level="4">教育/培训经历</a-typography-title> | |||
<a-typography-paragraph> | |||
<template v-for="(item,index) in detail.trainings"> | |||
<a-card :title="item.school_or_institution" style="margin-bottom: 10px;"> | |||
<template #extra>{{item.major}}</template> | |||
<p>教育/培训时间:{{item.start_year}}.{{item.start_month}}至{{item.end_year}}.{{item.end_month}}</p> | |||
<p>曾担任的职务:{{item.positions_held}}</p> | |||
<p>获得的证书:{{item.certificate}}</p> | |||
<p>获得的奖项:{{item.awards}}</p> | |||
</a-card> | |||
</template> | |||
</a-typography-paragraph> | |||
</a-spin> | |||
</a-modal> | |||
</template> | |||
@@ -204,42 +175,30 @@ | |||
openOtherModel_1 = computed(() => { | |||
return store.state.openOtherModel_1; | |||
}) | |||
const items = [ | |||
{ | |||
title: '一般', | |||
description: 'This is a Step 1.', | |||
}, | |||
{ | |||
title: '熟练', | |||
description: 'This is a Step 2.', | |||
}, | |||
{ | |||
title: 'Step 3', | |||
description: 'This is a Step 3.', | |||
}, | |||
]; | |||
onMounted(() => { | |||
if (props.detail_record) { | |||
const items = [ | |||
{ | |||
title: '一般', | |||
description: 'This is a Step 1.', | |||
}, | |||
{ | |||
title: '熟练', | |||
description: 'This is a Step 2.', | |||
}, | |||
{ | |||
title: 'Step 3', | |||
description: 'This is a Step 3.', | |||
}, | |||
]; | |||
watch(() => [props.detail_record], (newVal) => { | |||
if (newVal[0]) { | |||
spinning.value = false | |||
GetJobseekerDetail({ customer_id: props.detail_record.customer_id }).then(res => { | |||
detail.value = res.data | |||
}) | |||
GetJobapplicantIntroductiondetail({ customer_id: props.detail_record.customer_id }).then(res => { | |||
introduction.value = res.data; | |||
}) | |||
PostJobapplicantTrainingdetail({ customer_id: props.detail_record.customer_id }).then(res => { | |||
trainList.value = res.data | |||
}) | |||
PostJobapplicantDesireindustrydetail({ customer_id: props.detail_record.customer_id }).then(res => { | |||
}) | |||
PostJobapplicantExperiencedetail({ customer_id: props.detail_record.customer_id }).then(res => { | |||
experienceList.value = res.data | |||
}) | |||
} | |||
}) | |||
const cancelModal = () => { | |||
emit('closePermission'); | |||
hideOtherModal1() |
@@ -1,5 +1,4 @@ | |||
<template> | |||
<!-- <a-c-operation @refresh="clearData"></a-c-operation> --> | |||
<a-c-table :data="commomParams.table.data" :columns="commomParams.table.columns" :pagination="commomParams.page" | |||
@page="getPage" :loading="loading"> | |||
@@ -98,7 +97,7 @@ | |||
}) | |||
} | |||
// 为角色增加权限 | |||
let detail_record = ref<Object>(null) | |||
const detail = (record) => { | |||
detail_record.value = record; |
@@ -1,50 +1,42 @@ | |||
<template> | |||
<a-modal v-model:visible="openOtherModel_1" title="分配权限,(请使用Ctrl+F查找关键字)" ok-text="提交" cancel-text="取消" | |||
@ok="sumbitForm" @cancel="cancelModal" width="90%"> | |||
@ok="sumbitForm" @cancel="cancelModal" width="100%"> | |||
<a-divider orientation="left">{{detailTitle}}</a-divider> | |||
<a-spin :spinning="spinning"> | |||
<template v-for="(item, index) in permissionList"> | |||
<div v-for="(item, index) in permissionList" style="width: 100%;"> | |||
<a-row :gutter="20" class="a-row" align="middle"> | |||
<a-col span="6" class="a-col"> | |||
<a-checkbox v-model:checked="item.checked" @change="one($event, index, item)" | |||
:label="item.name">{{item.name}}</a-checkbox> | |||
<a-checkbox @change="one($event, index, item)" | |||
:checked="item.checked" :value="item.id">{{item.name}}</a-checkbox> | |||
</a-col> | |||
<a-col span="18" class="a-col"> | |||
<template v-if="item.childs"> | |||
<a-row :gutter="20" align="middle"> | |||
<template v-for="(childItem, childIndex) in item.childs"> | |||
<a-col :span="childItem.childs.length > 0 ? 12 : 6" class="a-col"> | |||
<a-checkbox v-model:checked="childItem.checked" | |||
@change="one($event, index, childItem)" | |||
:label="childItem.name">{{childItem.name}} | |||
</a-checkbox> | |||
</a-col> | |||
<a-col :span="childItem.childs.length > 0 ? 12 : 0" class="a-col"> | |||
<template v-if="childItem.childs && childItem.childs.length > 0"> | |||
<a-row :gutter="20" align="middle"> | |||
<template v-for="(thirdItem, thirdIndex) in childItem.childs"> | |||
<a-col span="6" class="a-col"><a-checkbox | |||
v-model:checked="thirdItem.checked" | |||
@change="one($event, index, thirdItem)" | |||
:label="thirdItem.name">{{thirdItem.name}}</a-checkbox></a-col> | |||
</template> | |||
</a-row> | |||
</template> | |||
</a-col> | |||
</template> | |||
<div v-for="(childItem, childIndex) in item.childs"> | |||
<a-row align="middle"> | |||
<a-col span="6" class="a-col"> | |||
<a-checkbox @change="two($event, index, childItem)" | |||
:checked="childItem.checked" :value="childItem.id">{{childItem.name}} | |||
</a-checkbox> | |||
</a-col> | |||
<a-col span="18" class="a-col"> | |||
<a-row :gutter="20" align="middle"> | |||
<a-col span="8" class="a-col" | |||
v-for="(thirdItem, thirdIndex) in childItem.childs"><a-checkbox | |||
@change="three($event, index, childItem)" | |||
:checked="thirdItem.checked" :value="thirdItem.id">{{thirdItem.name}}</a-checkbox></a-col> | |||
</a-row> | |||
</a-col> | |||
</a-row> | |||
</template> | |||
</div> | |||
</a-col> | |||
</a-row> | |||
</template> | |||
</div> | |||
</a-spin> | |||
</a-modal> | |||
</template> | |||
<script setup lang="ts"> | |||
import { ref, onMounted, defineProps, computed, watch, defineEmits } from 'vue'; | |||
import { getPermissionListWithchilds, getRoleGetpermissions, PostRoleAddpermission, PostRoleDelpermission } from '@/apis/models'; | |||
import { getPermissionListWithchilds, getRoleGetpermissions, PostRoleSavepermissions } from '@/apis/models'; | |||
import { message } from 'ant-design-vue'; | |||
import { useCommon } from '@/hooks/useCommon'; | |||
let { store, commomParams, hideOtherModal1, openOtherModel_1 } = useCommon(); | |||
@@ -52,6 +44,8 @@ | |||
let props = defineProps(['detail_record']); | |||
let detailTitle = ref<String>('') | |||
let permissionList = ref<object[]>([]); | |||
let choose_permission = ref<Number[]>([]); | |||
let spinning = ref<Boolean>(true); // 加载中 | |||
openOtherModel_1 = computed(() => { | |||
@@ -63,28 +57,136 @@ | |||
permissionList.value = res.data.permissions; | |||
spinning.value = false; | |||
let res1 = await getRoleGetpermissions({ ids: newVal.id.toString() }); | |||
detailTitle.value = `为角色"${newVal.name}"分配权限,当前拥有${res1.data.permissions.length}个权限`; | |||
permissionList.value.forEach(itemA => { | |||
const matchingItemB = res1.data.permissions.find(itemB => itemA.id === itemB.id); | |||
if (matchingItemB) { | |||
deepCompareAndMarkChecked(itemA, matchingItemB); | |||
} | |||
}); | |||
choose_permission.value = getAllIds(res1.data.permissions); | |||
detailTitle.value = `为角色"${newVal.name}"分配权限,当前拥有${choose_permission.value.length}个权限`; | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value); | |||
}) | |||
const one = (e, index, item) => { | |||
const one = (e, idx, item) => { | |||
if (e.target.checked) { | |||
PostRoleAddpermission({ role_id: props.detail_record.id, permission_id: item.id }).then(res => { | |||
message.success('为角色新增菜单/权限成功'); | |||
getOneRole(); | |||
}) | |||
choose_permission.value.push(e.target.value); | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
if (item.childs) { | |||
item.childs.forEach(childItem => { | |||
choose_permission.value.push(childItem.id); | |||
console.log(choose_permission.value) | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
if (childItem.childs) { | |||
childItem.childs.forEach(thirdItem => { | |||
choose_permission.value.push(thirdItem.id); | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
}) | |||
} | |||
}) | |||
} | |||
} else { | |||
delValue(e.target.value); | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
if (item.childs) { | |||
item.childs.forEach(childItem => { | |||
delValue(childItem.id) | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
if (childItem.childs) { | |||
childItem.childs.forEach(thirdItem => { | |||
delValue(thirdItem.id) | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
}) | |||
} | |||
}) | |||
} | |||
} | |||
} | |||
const two = (e, idx, item) => { | |||
let isCheckBrother = false; | |||
if (e.target.checked) { | |||
choose_permission.value.push(e.target.value); | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
if (!findValue(permissionList.value[idx].id)) { | |||
choose_permission.value.push(permissionList.value[idx].id); // 添加一级 | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
isCheckBrother = true; | |||
} | |||
if (item.childs) { | |||
item.childs.forEach(childItem => { | |||
choose_permission.value.push(childItem.id); | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
}) | |||
} | |||
} else { | |||
PostRoleDelpermission({ role_id: props.detail_record.id, permission_id: item.id }).then(res => { | |||
message.success('为角色移除菜单/权限成功'); | |||
getOneRole(); | |||
delValue(e.target.value) | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
item.childs.forEach(childItem => { | |||
delValue(childItem.id) | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
}) | |||
console.log(choose_permission.value) | |||
// 判断二级是否还有兄弟选中 | |||
for (let i = 0; i < permissionList.value[idx].childs.length; i++) { | |||
if (findValue(permissionList.value[idx].childs[i].id)) { | |||
isCheckBrother = true; | |||
} | |||
} | |||
// 如没有就删除一级权限 | |||
if (!isCheckBrother) { | |||
delValue(permissionList.value[idx].id); | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
} | |||
} | |||
} | |||
const three = (e, idx, item) => { | |||
if (e.target.checked) { | |||
choose_permission.value.push(e.target.value) | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
if (!findValue(permissionList.value[idx].id)) { | |||
choose_permission.value.push(permissionList.value[idx].id); // 添加一级 | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
} | |||
if (permissionList.value[idx].childs) { | |||
if (!findValue(item.id)) { | |||
choose_permission.value.push(item.id); // 添加二级 | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
} | |||
} | |||
} else { | |||
let isCheckBrother = false; | |||
delValue(e.target.value) | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
// 判断操作是否还有兄弟选中 | |||
if (permissionList.value[idx].childs) { | |||
for (let i = 0; i < item.childs.length; i++) { | |||
if (findValue(item.childs[i].id)) { | |||
isCheckBrother = true; | |||
} | |||
} | |||
// 如没有就删除二级权限 | |||
if (!isCheckBrother) { | |||
delValue(item.id); | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
} | |||
// 判断二级是否还有兄弟选中 | |||
for (let i = 0; i < permissionList.value[idx].childs.length; i++) { | |||
if (findValue(permissionList.value[idx].childs[i].id)) { | |||
isCheckBrother = true; | |||
} | |||
} | |||
// 如没有就删除一级权限 | |||
if (!isCheckBrother) { | |||
delValue(permissionList.value[idx].id); | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
} | |||
} else { | |||
// 如没有就删除二级权限 | |||
if (!isCheckBrother) { | |||
delValue(item.id); | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value) | |||
} | |||
} | |||
} | |||
} | |||
// 获取角色的权限 | |||
@@ -93,20 +195,16 @@ | |||
permissionList.value = res.data.permissions; | |||
spinning.value = false; | |||
let res1 = await getRoleGetpermissions({ ids: props.detail_record.id.toString() }); | |||
permissionList.value.forEach(itemA => { | |||
const matchingItemB = res1.data.permissions.find(itemB => itemA.id === itemB.id); | |||
if (matchingItemB) { | |||
deepCompareAndMarkChecked(itemA, matchingItemB); | |||
} | |||
}); | |||
// getRoleGetpermissions({ ids: props.detail_record.id.toString() }).then(res => { | |||
// permissionList.value = deepCompareAndMarkChecked(permissionList.value, res.data.permissions); | |||
// }); | |||
choose_permission.value = getAllIds(res1.data.permissions); | |||
permissionList.value = setCheckedAndReturnNewArray(permissionList.value, choose_permission.value); | |||
} | |||
const sumbitForm = () => { | |||
emit('successAdd'); | |||
hideOtherModal1() | |||
PostRoleSavepermissions({ role_id: props.detail_record.id, permission_ids: choose_permission.value }).then(res => { | |||
message.success('提交菜单/权限成功'); | |||
cancelModal(); | |||
emit('successAdd'); | |||
}) | |||
} | |||
const cancelModal = () => { | |||
@@ -114,29 +212,61 @@ | |||
hideOtherModal1() | |||
} | |||
const deepCompareAndMarkChecked = (itemA, itemB) => { | |||
if (itemA.id === itemB.id) { | |||
itemA.checked = true; | |||
const getAllIds = (permissionArray) => { | |||
return permissionArray.flatMap(item => [item.id].concat(item.childs ? getAllIds(item.childs) : [])); | |||
} | |||
const setCheckedAndReturnNewArray = (nodes, checkedIds) => { | |||
return nodes.map(node => { | |||
let newNode = { ...node }; | |||
newNode.checked = checkedIds.includes(newNode.id); | |||
if (newNode.childs && Array.isArray(newNode.childs)) { | |||
newNode.childs = setCheckedAndReturnNewArray(newNode.childs, checkedIds); | |||
} | |||
return newNode; | |||
}); | |||
} | |||
// 是否存在元素 | |||
const findValue = (value) => { | |||
let isBrother = false; | |||
for (let i = 0; i < choose_permission.value.length; i++) { | |||
if (choose_permission.value[i] === value) { | |||
isBrother = true; | |||
} | |||
} | |||
if (itemA.childs && itemA.childs.length) { | |||
itemA.childs.forEach(childA => { | |||
const matchingChildB = itemB.childs.find(childB => childA.id === childB.id); | |||
if (matchingChildB) { | |||
deepCompareAndMarkChecked(childA, matchingChildB); | |||
} | |||
}); | |||
return isBrother; | |||
} | |||
// 删除选择的元素 | |||
const delValue = (value) => { | |||
for (let i = 0; i < choose_permission.value.length; i++) { | |||
if (choose_permission.value[i] == value) { | |||
choose_permission.value.splice(i, 1); | |||
break; | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
/deep/ .ant-checkbox-group { | |||
display: block; | |||
border: none !important; | |||
} | |||
.a-row:first-child { | |||
border-bottom: none; | |||
border-radius: 10px 10px 0 0; | |||
// border-radius: 10px 10px 0 0; | |||
} | |||
.a-row:last-child { | |||
border-radius: 0 0 10px 10px; | |||
// border-radius: 0 0 10px 10px; | |||
} | |||
.a-row { |