Browse Source

权限控制

jiangcheng/feature-20260402142510-现金四期
ZhangYong 5 days ago
parent
commit
9639662f8e
  1. 3
      src/utils/menuTreePermission.js
  2. 16
      src/views/moneyManage/financialAccount/cashFlow.vue
  3. 19
      src/views/moneyManage/financialAccount/performanceAttribution.vue

3
src/utils/menuTreePermission.js

@ -175,6 +175,9 @@ export const permissionMapping = {
financial_accounting: 147, // 财务核算 financial_accounting: 147, // 财务核算
cash_flow_ledger: 148, // 资金流水账 cash_flow_ledger: 148, // 资金流水账
performance_attribution_accounting: 149, // 业绩归属台账 performance_attribution_accounting: 149, // 业绩归属台账
new_transaction_flow: 162, // 新增流水
performance_adjustment: 163, // 业绩调整
} }
// 递归查找菜单中是否存在目标id // 递归查找菜单中是否存在目标id

16
src/views/moneyManage/financialAccount/cashFlow.vue

@ -13,9 +13,10 @@ import { normalizePayType,MarketNameForId, CurrencyForId, } from '@/views/moneyM
import { isTemplate } from 'element-plus/es/utils/index.mjs' import { isTemplate } from 'element-plus/es/utils/index.mjs'
import { Row } from 'vxe-pc-ui' import { Row } from 'vxe-pc-ui'
import CashManagement from '@/components/workspace/CashManagement.vue' import CashManagement from '@/components/workspace/CashManagement.vue'
import { permissionMapping, hasMenuPermission } from "@/utils/menuTreePermission.js"
const adminStore = useAdminStore() const adminStore = useAdminStore()
const { adminData } = storeToRefs(adminStore)
const { adminData, menuTree,flag } = storeToRefs(adminStore)
const { t } = useI18n() const { t } = useI18n()
const route = useRoute() const route = useRoute()
@ -38,6 +39,16 @@ const paytypeList = [
t('cash.payMethods.check'), // t('cash.payMethods.check'), //
] ]
//
const hasNewTransactionFlow = ref(false)
//
const initPermissions = async () => {
if (!menuTree.value || !menuTree.value.length) return;
//
hasNewTransactionFlow.value = hasMenuPermission(menuTree.value, permissionMapping.new_transaction_flow);
};
const payPlatformOptions = ref([...paytypeList]) const payPlatformOptions = ref([...paytypeList])
const marketFilter = (value) => { const marketFilter = (value) => {
@ -675,6 +686,7 @@ const handlePreviewClick=()=>{
} }
} }
onMounted(async () => { onMounted(async () => {
await initPermissions()
await getMarket() await getMarket()
await getPayPlatformOptions() await getPayPlatformOptions()
// //
@ -746,7 +758,7 @@ onMounted(async () => {
<el-button type="success" @click="handleReset">{{ t('common.reset') }}</el-button> <el-button type="success" @click="handleReset">{{ t('common.reset') }}</el-button>
</div> </div>
<div class="newAdd"> <div class="newAdd">
<el-button class="newAdd_btn" @click="addCashFlow('other')">{{ t('common.addCashFlow') }}</el-button>
<el-button v-if="hasNewTransactionFlow" class="newAdd_btn" @click="addCashFlow('other')">{{ t('common.addCashFlow') }}</el-button>
</div> </div>
</div> </div>
</div> </div>

19
src/views/moneyManage/financialAccount/performanceAttribution.vue

@ -6,8 +6,12 @@ import dayjs from 'dayjs'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { refundOnline,performanceSelect,exportPerformance,adjustment } from '@/api/cash/financialAccount.js' import { refundOnline,performanceSelect,exportPerformance,adjustment } from '@/api/cash/financialAccount.js'
import { getUserInfo } from '@/api/common/common.js' import { getUserInfo } from '@/api/common/common.js'
import { useAdminStore } from '@/store/index.js'
import { permissionMapping, hasMenuPermission } from "@/utils/menuTreePermission.js"
import { storeToRefs } from 'pinia'
const adminStore = useAdminStore()
const { menuTree,flag } = storeToRefs(adminStore)
const adminData = ref({}) const adminData = ref({})
@ -29,6 +33,16 @@ const paytypeList = [
t('cash.payMethods.paypal'), t('cash.payMethods.paypal'),
] ]
const hasperformanceAdjustment = ref(false)
//
const initPermissions = async () => {
if (!menuTree.value || !menuTree.value.length) return;
//
hasperformanceAdjustment.value = hasMenuPermission(menuTree.value, permissionMapping.performance_adjustment);
console.log('业绩调整权限',hasperformanceAdjustment.value);
};
const payPlatformOptions = ref([...paytypeList]) const payPlatformOptions = ref([...paytypeList])
const statusOptions = [ const statusOptions = [
@ -370,6 +384,7 @@ const submitAdjustment = async () => {
} }
onMounted( async() => { onMounted( async() => {
await initPermissions()
await handleAdminInfo() await handleAdminInfo()
getMarket() getMarket()
await fetchData() await fetchData()
@ -421,7 +436,7 @@ onMounted( async() => {
<el-button type="primary" @click="handleExport">{{ t('common.exportExcel') }}</el-button> <el-button type="primary" @click="handleExport">{{ t('common.exportExcel') }}</el-button>
<el-button type="primary" @click="openExportList">{{ t('common.viewExportList') }}</el-button> <el-button type="primary" @click="openExportList">{{ t('common.viewExportList') }}</el-button>
<el-button type="success" @click="handleReset">{{ t('common.reset') }}</el-button> <el-button type="success" @click="handleReset">{{ t('common.reset') }}</el-button>
<button class="adjust-btn" @click="handleAdjustment">业绩调整</button>
<button v-if="hasperformanceAdjustment" class="adjust-btn" @click="handleAdjustment">业绩调整</button>
</div> </div>
</div> </div>
</el-card> </el-card>

Loading…
Cancel
Save