parent
f7b3203b60
commit
531cb14eb2
@ -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
|
||||||
|
}
|
@ -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>
|
|
@ -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…
Reference in new issue