master
BINGWU 7 months ago
parent f7b3203b60
commit 531cb14eb2

@ -49,6 +49,7 @@ declare module 'vue' {
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTag: typeof import('element-plus/es')['ElTag']
ElTimePicker: typeof import('element-plus/es')['ElTimePicker']
ElTree: typeof import('element-plus/es')['ElTree']
ElUpload: typeof import('element-plus/es')['ElUpload']
ExportExcelCom: typeof import('./src/components/excel/ExportExcelCom.vue')['default']
ImportExcelCom: typeof import('./src/components/excel/ImportExcelCom.vue')['default']

@ -0,0 +1,106 @@
export const asideData = [
{
id: 1,
index: '/home',
icon: 'icon iconfont icon-shujutongji',
name: '数据统计',
pid: 0
},
{
id: 2,
index: '/user-manage',
icon: 'icon iconfont icon-yonghuguanli',
name: '用户管理',
pid: 0
},
{
id: 3,
index: '/employee-manage',
icon: 'icon iconfont icon-shenfenzhongxin-xinxiguanlizhigongxinxiguanli',
name: '职工管理',
pid: 0
},
{
id: 4,
index: '/reward-manage',
icon: 'icon iconfont icon-gerenjixiao',
name: '绩效管理',
pid: 0
},
{
id: 5,
index: '/feedback',
icon: 'icon iconfont icon-fankui',
name: '员工反馈与投诉管理',
pid: 0,
children: [
{
id: 6,
index: '/feedback/manage',
name: '投诉管理',
pid: 5
},
{
id: 7,
index: '/feedback/view',
name: '员工反馈',
pid: 5
}
]
},
{
id: 8,
index: '/request',
icon: 'icon iconfont icon-qingjiashenqing',
name: '请假管理',
pid: 0,
children: [
{
id: 9,
index: '/request/manage',
name: '请假信息管理',
pid: 8
},
{
id: 10,
index: '/request/view',
name: '个人请假信息',
pid: 8
}
]
},
{
id: 11,
index: '/person',
icon: 'icon iconfont icon-gerenxinxiguanli',
name: '个人信息管理',
pid: 0,
children: [
{
id: 12,
index: '/person/password',
name: '修改密码',
pid: 11
},
{
id: 13,
index: '/person/avatar',
name: '修改个人信息',
pid: 11
}
]
}
]
export function generateNested(nodes, parentId = 0) {
const result = []
for (const node of nodes) {
if (node.pid === parentId) {
const children = generateNested(nodes, node.id)
if (children.length) {
node.children = children
}
result.push(node)
}
}
return result
}

@ -2,7 +2,7 @@
* @Author: BINGWU
* @Date: 2024-02-15 14:18:43
* @LastEditors: BINGWU HuJiaCheng2003@163.com
* @LastEditTime: 2024-05-14 00:23:33
* @LastEditTime: 2024-05-14 23:55:39
* @FilePath: \employee-information-management-system\app\src\stores\modules\user.js
* @Describe:
* @Mark: (˶ ˶)
@ -287,219 +287,7 @@ const useUserStore = defineStore(
const hasPermission = (auth) => {
return authArr.value.indexOf(auth) !== -1
}
// 切换用户
const switchUser = (username) => {
if (username === 'cxk') {
asideData.value = [
{
index: '/home',
icon: 'icon iconfont icon-home',
name: '首页'
},
{
index: '/rich-text',
icon: 'icon iconfont icon-fuwenben2',
name: '富文本编辑器'
},
{
index: '/excel',
icon: 'icon iconfont icon-excel',
name: 'excel(导出/导入)'
},
{
index: '/file',
icon: 'icon iconfont icon-wenjian',
name: '文件上传'
},
{
index: '/permission',
icon: 'icon iconfont icon-quanxian',
name: '按钮权限管理'
},
{
index: '/international',
icon: 'icon iconfont icon-yuyan1',
name: '国际化'
}
]
routerData.value = [
{
path: 'home',
name: 'home',
meta: {
// 路由组件的路径
url: '../views/HomeView.vue'
}
},
{
path: 'international',
name: 'international',
meta: {
name: '国际化',
url: '../views/InternationalView.vue'
}
},
{
path: 'excel',
name: 'excel',
meta: {
name: 'excel',
url: '../views/ExcelView.vue'
}
},
{
path: 'file',
name: 'file',
meta: {
name: 'file',
url: '../views/FileView.vue'
}
},
{
path: 'rich-text',
name: 'rich-text',
meta: {
name: 'rich-text',
url: '../views/RichTextView.vue'
}
},
{
path: 'permission',
name: 'permission',
meta: {
name: 'permission',
url: '../views/PermissionView.vue'
}
},
{
path: 'home',
name: 'home',
meta: {
// 路由组件的路径
url: '../views/HomeView.vue'
}
}
]
authArr.value = ['a', 'b']
} else {
asideData.value = [
{
index: '/permission',
icon: 'icon iconfont icon-quanxian',
name: '按钮权限管理'
},
// 二级
{
index: '/table',
icon: 'icon iconfont icon-biaoge',
name: '表格',
children: [
{
index: '/table/main-table1',
name: '表格1'
},
{
index: '/table/main-table2',
name: '表格2'
}
]
},
// 二级
{
index: '/error',
icon: 'icon iconfont icon-cuowu',
name: '错误页面',
children: [
{
index: '/error/not-find1',
name: '错误页面1'
},
{
index: '/error/not-find2',
name: '错误页面2'
},
{
index: '/error/not-find3',
name: '错误页面3'
}
]
},
// 三级
{
index: '/menu',
icon: 'icon iconfont icon-caidan',
name: '多级菜单',
children: [
{
index: '/menu/menu-1-1',
name: '菜单1-1'
},
{
index: '/menu/menu-1-2',
name: '菜单1-2'
},
{
index: '/menu/menu-1-3',
name: '菜单1-3',
sons: [
{
index: '/menu/menu-1-1/menu-1-3-1',
name: '菜单1-3-1'
},
{
index: '/menu/menu-1-1/menu-1-3-2',
name: '菜单1-3-2'
}
]
}
]
}
]
routerData.value = [
{
path: 'permission',
name: 'permission',
meta: {
name: 'permission',
url: '../views/PermissionView.vue'
}
},
{
path: 'table/main-table1',
name: 'main-table',
meta: {
name: '表格1',
url: '../views/table/MainTableView.vue'
}
},
// 三级路由
{
path: 'menu/menu-1-1',
name: 'child-menu',
meta: {
name: '菜单1-1',
url: '../views/FatherMenu/FatherMenuView.vue'
}
},
{
path: '/menu/menu-1-1/menu-1-3-1',
name: 'father-menu',
meta: {
name: '菜单1-3-1',
url: '../views/FatherMenu/ChildMenu/ChildMenuView.vue'
}
}
]
authArr.value = ['c', 'd']
}
}
return {
authArr,
hasPermission,
@ -507,8 +295,7 @@ const useUserStore = defineStore(
routerData,
setToken,
token,
asideData,
switchUser
asideData
}
},
{

@ -1,29 +0,0 @@
<!--
* @Author: BINGWU
* @Date: 2024-01-24 17:35:53
* @LastEditors: BINGWU HuJiaCheng2003@163.com
* @LastEditTime: 2024-02-10 23:50:21
* @FilePath: \bingwu-admin\src\views\InternationalView.vue
* @Describe:
* @Mark: (˶ ˶)
-->
<template>
<div class="international">
<h1>国际化展示(局部国际化)</h1>
<h4>自定义内容国际化</h4>
<div>
<span>{{ $t('headMenus.name') }}:</span>
<span>{{ $t('headMenus.userName') }}</span>
</div>
<h4>element-plus组件的国际化</h4>
<div style="width: 30%">
<el-table mb-1 :data="[]" />
<el-pagination :total="100" />
</div>
<i class="icon iconfont icon-yuyan"></i>
</div>
</template>
<script setup></script>
<style lang="scss" scoped></style>

@ -13,11 +13,13 @@
<div clase="table">
<BaseTableCom></BaseTableCom>
</div>
<UserFormCom></UserFormCom>
</div>
</template>
<script setup>
import { ref } from 'vue'
import UserFormCom from './components/form/UserFormCom.vue'
import BaseTableCom from '@/components/table/BaseTableCom.vue'
</script>

@ -0,0 +1,70 @@
<template>
<div class="UserFormCom">
<el-dialog
v-model="dialogVisible"
title="Tips"
width="500"
:before-close="handleClose"
>
<el-form :model="form" label-width="auto" style="max-width: 600px">
<el-form-item label="用户名">
<el-input type="text" v-model="formData.username" />
</el-form-item>
<el-form-item label="密码">
<el-input type="password" v-model="formData.password" />
</el-form-item>
<el-form-item label="角色类型">
<el-input type="text" v-model="formData.userType" />
</el-form-item>
<el-form-item label="菜单权限">
<el-tree
style="max-width: 600px"
:data="asideData"
show-checkbox
node-key="id"
default-expand-all
:props="defaultProps"
ref="elTreeRef"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleConfirm"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { asideData, generateNested } from '@/db/asideData'
const formData = ref({ name: '', password: '', userType: '' })
const dialogVisible = ref(true)
const elTreeRef = ref(null)
const defaultProps = {
children: 'children',
label: 'name'
}
const handleConfirm = () => {
const checkedNodes = elTreeRef.value.getCheckedNodes()
const tree = generateNested(checkedNodes)
const newTree = tree.map((item) => {
const { index, icon, name, children } = item
const newItem = { index, icon, name }
if (children) {
newItem.children = children.map((child) => {
const { index, name } = child
return { index, name }
})
}
return newItem
})
console.log('data1', newTree)
}
</script>
<style lang="scss" scoped></style>
Loading…
Cancel
Save