Files
admin-govern/src/views/auth/menu/index.vue

81 lines
2.3 KiB
Vue
Raw Normal View History

2023-12-22 16:19:33 +08:00
<template>
2023-12-26 16:17:30 +08:00
<TableHeader>
<template v-slot:operation>
2023-12-27 10:39:40 +08:00
<el-button type='primary' @click='addMenu'>新增</el-button>
2023-12-26 16:17:30 +08:00
</template>
</TableHeader>
2023-12-27 10:39:40 +08:00
<Table ref='tableRef' :pagination='false' />
<popupForm ref='popupRef'></popupForm>
2023-12-22 16:19:33 +08:00
</template>
2023-12-27 10:39:40 +08:00
<script setup lang='ts'>
2023-12-22 16:19:33 +08:00
import { ref, onMounted, provide } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
2023-12-26 16:17:30 +08:00
import TableHeader from '@/components/table/header/index.vue'
2023-12-27 10:39:40 +08:00
import popupForm from './popupForm.vue'
2023-12-26 16:17:30 +08:00
2023-12-22 16:19:33 +08:00
defineOptions({
name: 'auth/menu'
})
const tableRef = ref()
2023-12-27 10:39:40 +08:00
const popupRef = ref()
2023-12-22 16:19:33 +08:00
const tableStore = new TableStore({
2023-12-26 16:17:30 +08:00
url: '/user-boot/function/functionTree',
2023-12-22 16:19:33 +08:00
column: [
{ type: 'selection', align: 'center', width: '60' },
2023-12-26 16:17:30 +08:00
{ label: '菜单名称', prop: 'title', align: 'left' },
2023-12-22 16:19:33 +08:00
{
label: '图标',
prop: 'icon',
align: 'center',
width: '60',
2023-12-26 16:17:30 +08:00
render: 'icon'
2023-12-22 16:19:33 +08:00
},
{
label: '操作',
align: 'center',
width: '130',
render: 'buttons',
buttons: [
{
name: 'edit',
title: '编辑',
type: 'primary',
icon: 'el-icon-EditPen',
2023-12-27 10:39:40 +08:00
render: 'tipButton',
click: (row) => {
popupRef.value.open('编辑菜单', row)
}
},
{
name: 'del',
title: '删除',
type: 'danger',
icon: 'el-icon-Delete',
render: 'confirmButton',
popconfirm: {
confirmButtonText:'确认',
cancelButtonText: '取消',
confirmButtonType: 'danger',
title: '确定删除该菜单吗?',
},
click: (row) => {
popupRef.value.open('编辑菜单', row)
}
2023-12-22 16:19:33 +08:00
}
]
}
]
})
provide('tableStore', tableStore)
onMounted(() => {
tableStore.table.ref = tableRef.value
tableStore.index()
})
2023-12-27 10:39:40 +08:00
const addMenu = () => {
console.log(popupRef)
popupRef.value.open('新增菜单')
}
2023-12-22 16:19:33 +08:00
</script>