|
@@ -8,8 +8,8 @@
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
<!-- 详情内容 -->
|
|
<!-- 详情内容 -->
|
|
|
- <view class="p-24rpx pb-200rpx">
|
|
|
|
|
- <wd-cell-group custom-class="cell-group" border>
|
|
|
|
|
|
|
+ <view>
|
|
|
|
|
+ <wd-cell-group border>
|
|
|
<wd-cell title="角色名称" :value="formData?.name || '-'" />
|
|
<wd-cell title="角色名称" :value="formData?.name || '-'" />
|
|
|
<wd-cell title="角色标识" :value="formData?.code || '-'" />
|
|
<wd-cell title="角色标识" :value="formData?.code || '-'" />
|
|
|
<wd-cell title="显示顺序" :value="String(formData?.sort ?? '-')" />
|
|
<wd-cell title="显示顺序" :value="String(formData?.sort ?? '-')" />
|
|
@@ -22,12 +22,18 @@
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 底部操作按钮 -->
|
|
<!-- 底部操作按钮 -->
|
|
|
- <view class="safe-area-inset-bottom fixed bottom-0 left-0 right-0 bg-white p-24rpx">
|
|
|
|
|
|
|
+ <view class="fixed bottom-0 left-0 right-0 bg-white p-24rpx">
|
|
|
<view class="w-full flex gap-24rpx">
|
|
<view class="w-full flex gap-24rpx">
|
|
|
- <wd-button class="flex-1" type="warning" @click="handleEdit">
|
|
|
|
|
|
|
+ <wd-button
|
|
|
|
|
+ v-if="hasAccessByCodes(['system:role:update'])"
|
|
|
|
|
+ class="flex-1" type="warning" @click="handleEdit"
|
|
|
|
|
+ >
|
|
|
编辑
|
|
编辑
|
|
|
</wd-button>
|
|
</wd-button>
|
|
|
- <wd-button class="flex-1" type="error" :loading="deleting" @click="handleDelete">
|
|
|
|
|
|
|
+ <wd-button
|
|
|
|
|
+ v-if="hasAccessByCodes(['system:role:delete'])"
|
|
|
|
|
+ class="flex-1" type="error" :loading="deleting" @click="handleDelete"
|
|
|
|
|
+ >
|
|
|
删除
|
|
删除
|
|
|
</wd-button>
|
|
</wd-button>
|
|
|
</view>
|
|
</view>
|
|
@@ -41,11 +47,13 @@ import type { Role } from '@/api/system/role'
|
|
|
import { onMounted, ref } from 'vue'
|
|
import { onMounted, ref } from 'vue'
|
|
|
import { useToast } from 'wot-design-uni'
|
|
import { useToast } from 'wot-design-uni'
|
|
|
import { deleteRole, getRole } from '@/api/system/role'
|
|
import { deleteRole, getRole } from '@/api/system/role'
|
|
|
|
|
+import { useAccess } from '@/hooks/useAccess'
|
|
|
|
|
+import { navigateBackPlus } from '@/utils'
|
|
|
import { DICT_TYPE } from '@/utils/constants'
|
|
import { DICT_TYPE } from '@/utils/constants'
|
|
|
import { formatDateTime } from '@/utils/date'
|
|
import { formatDateTime } from '@/utils/date'
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
const props = defineProps<{
|
|
|
- id: number
|
|
|
|
|
|
|
+ id?: number | any
|
|
|
}>()
|
|
}>()
|
|
|
|
|
|
|
|
definePage({
|
|
definePage({
|
|
@@ -55,13 +63,14 @@ definePage({
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+const { hasAccessByCodes } = useAccess()
|
|
|
const toast = useToast()
|
|
const toast = useToast()
|
|
|
const formData = ref<Role>() // 详情数据
|
|
const formData = ref<Role>() // 详情数据
|
|
|
const deleting = ref(false) // 删除中
|
|
const deleting = ref(false) // 删除中
|
|
|
|
|
|
|
|
/** 返回上一页 */
|
|
/** 返回上一页 */
|
|
|
function handleBack() {
|
|
function handleBack() {
|
|
|
- uni.navigateBack()
|
|
|
|
|
|
|
+ navigateBackPlus('/pages-system/role/index')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** 加载角色详情 */
|
|
/** 加载角色详情 */
|
|
@@ -69,7 +78,12 @@ async function getDetail() {
|
|
|
if (!props.id) {
|
|
if (!props.id) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- formData.value = await getRole(props.id)
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ toast.loading('加载中...')
|
|
|
|
|
+ formData.value = await getRole(props.id)
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ toast.close()
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** 编辑角色 */
|
|
/** 编辑角色 */
|
|
@@ -112,13 +126,4 @@ onMounted(() => {
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
-:deep(.cell-group) {
|
|
|
|
|
- border-radius: 12rpx;
|
|
|
|
|
- overflow: hidden;
|
|
|
|
|
- box-shadow: 0 3rpx 8rpx rgba(24, 144, 255, 0.06);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.safe-area-inset-bottom {
|
|
|
|
|
- padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
|
|
|
|
|
-}
|
|
|
|
|
</style>
|
|
</style>
|