mirror of
https://gitee.com/krxd/shuyuan.git
synced 2026-04-08 21:35:53 +08:00
refactor权限控制逻辑
- 移除全局方法getUserBtnRole - 使用hasPermission函数替代checkBtnPermission - 优化权限判断逻辑,减少冗余代码 - 统一权限控制的实现方式
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
</u-form-item>
|
||||
</view>
|
||||
</u-form>
|
||||
<view class="w-full footer">
|
||||
<view v-if="hasPermission('erp_product_unit_add')" class="w-full footer">
|
||||
<view class="py-[var(--top-m)] px-[var(--sidebar-m)] footer w-full fixed bottom-0 left-0 right-0 box-border">
|
||||
<button hover-class="none" class="!bg-[var(--primary-color)] text-[#fff] h-[80rpx] leading-[80rpx] rounded-[100rpx] text-[26rpx] font-500"
|
||||
@click="handSave" :disabled="loading" :class="{'opacity-50': loading}">{{t('save')}}</button>
|
||||
@@ -28,9 +28,9 @@
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { getProductUnitInfo, addProductUnit, editProductUnit } from '@/addon/erp/api/product';
|
||||
import { redirect } from '@/utils/common';
|
||||
import { checkBtnPermission } from '@/utils/auth';
|
||||
import useMemberStore from '@/stores/member'
|
||||
|
||||
import usePermission from '@/utils/usePermission'
|
||||
const { hasPermission } = usePermission()
|
||||
const memberStore = useMemberStore()
|
||||
|
||||
const formRef: any = ref(null)
|
||||
@@ -71,8 +71,6 @@
|
||||
|
||||
// 保存
|
||||
const handSave = async() => {
|
||||
const hasPermission = await checkBtnPermission(memberStore.btnPermission, 'erp_product_unit_add')
|
||||
if (!hasPermission) return
|
||||
formRef.value.validate().then(() => {
|
||||
if (loading.value) return
|
||||
loading.value = true
|
||||
|
||||
Reference in New Issue
Block a user