feat: permissions

This commit is contained in:
JaguarJack
2022-12-07 19:28:57 +08:00
parent a1d9468a91
commit 8c537e6656
45 changed files with 1030 additions and 372 deletions

View File

@@ -1,29 +1,17 @@
<template>
<div class="pt-2 pb-2 flex justify-end">
<el-pagination
background
:layout="layout"
:current-page="page"
:page-size="limit"
@current-change="changePage"
@size-change="changeLimit"
:total="total"
:page-sizes="pageSizes"
/>
</div>
<div class="flex justify-end pt-5">
<el-pagination background :layout="layout" :current-page="page" :page-size="limit" @current-change="changePage" @size-change="changeLimit" :total="total" :page-sizes="pageSizes" />
</div>
</template>
<script lang="ts" setup>
import {inject} from "vue";
import { inject } from 'vue'
const layout = 'total,sizes,prev, pager,next'
const pageSizes = [10, 20, 30, 50]
const {page, limit, total, changePage, changeLimit} = inject('paginate')
const { page, limit, total, changePage, changeLimit } = inject('paginate')
</script>
<style scoped>
</style>
<style scoped></style>

View File

@@ -5,7 +5,6 @@
<script lang="ts" setup>
import { useEnabled } from '/admin/composables/curd/useEnabled'
import { Status } from '/admin/enum/app'
import { watch } from 'vue'
const props = defineProps({
modelValue: Boolean | Number | String,
@@ -13,12 +12,15 @@ const props = defineProps({
id: Number | String,
})
const emits = defineEmits(['update:modelValue'])
const emits = defineEmits(['update:modelValue', 'refresh'])
const { enabled, success, loading } = useEnabled()
const { enabled, success, loading, afterEnabled } = useEnabled()
watch(success, function () {
success(() => {
emits('update:modelValue', props.modelValue === Status.ENABLE ? Status.DISABLE : Status.ENABLE)
success.value = false
})
afterEnabled.value = () => {
emits('refresh')
}
</script>

View File

@@ -1,21 +1,17 @@
<template>
<div class="pt-5 pl-2">
<Add @click="show(showParams)" />
<slot name="operate"/>
</div>
<div class="pt-5 pl-2">
<Add @click="show(showParams)" />
<slot name="operate" />
</div>
</template>
<script lang="ts" setup>
defineProps({
show: {
type: Function,
required: true,
},
show: {
type: Function,
required: true,
},
showParams: null
showParams: null,
})
</script>
<style scoped>
</style>