修复权限缓存问题

This commit is contained in:
Zy
2026-07-20 16:43:09 +08:00
parent a5a883a652
commit 3a00c3dfe0
10 changed files with 343 additions and 306 deletions

View File

@@ -100,78 +100,77 @@
<!-- 网格布局功能 -->
<view class="function-container">
<!-- 第一行功能:故障上报、一键开门、工单大厅、我的工单 -->
<view class="function-row">
<view class="function-item" @click="goToReport" v-if="hasPermi('butler:fault:report')">
<image
class="item-icon"
src="https://wuyeadmin.bugtc.com/images/imgs/fault-report.png"
mode="aspectFit"
></image>
<text class="item-text">故障上报</text>
</view>
<view
class="function-item"
@click="goToOneOpenDoor"
v-if="hasPermi('butler:door:open')"
>
<image
class="item-icon"
src="https://wuyeadmin.bugtc.com/images/imgs/open.png"
mode="aspectFit"
></image>
<text class="item-text">一键开门</text>
</view>
<view
class="function-item"
@tap="goToTicketHall"
v-if="hasPermi('butler:workOrder:hall')"
>
<image
class="item-icon"
src="https://wuyeadmin.bugtc.com/images/imgs/work-order.png"
mode="aspectFit"
></image>
<text class="item-text">工单大厅</text>
</view>
<view
class="function-item"
@tap="goToMyTicket"
v-if="hasPermi('butler:workOrder:mine')"
>
<image
class="item-icon"
src="https://wuyeadmin.bugtc.com/images/imgs/my-work.png"
mode="aspectFit"
></image>
<text class="item-text">我的工单</text>
</view>
<view
class="function-item"
@click="goToReport"
v-if="permStore.hasPermi('butler:fault:report')"
>
<image
class="item-icon"
src="https://wuyeadmin.bugtc.com/images/imgs/fault-report.png"
mode="aspectFit"
></image>
<text class="item-text">故障上报</text>
</view>
<!-- 第二行 -->
<view class="function-row" style="margin-top: 2px">
<view
class="function-item"
@tap="goToComplaint"
v-if="hasPermi('butler:complaint:handle')"
>
<image
class="item-icon"
src="https://wuyeadmin.bugtc.com/images/imgs/complaint.png"
mode="aspectFit"
></image>
<text class="item-text">投诉处理</text>
</view>
<view
class="function-item"
@tap="goToReplacement_record"
v-if="hasPermi('butler:meter:replace')"
>
<image
class="item-icon"
src="https://wuye.ckdzkj.com/images/home/updateDevice.png"
mode="aspectFit"
></image>
<text class="item-text">仪表换新</text>
</view>
<view
class="function-item"
@click="goToOneOpenDoor"
v-if="permStore.hasPermi('butler:door:open')"
>
<image
class="item-icon"
src="https://wuyeadmin.bugtc.com/images/imgs/open.png"
mode="aspectFit"
></image>
<text class="item-text">一键开门</text>
</view>
<view
class="function-item"
@tap="goToTicketHall"
v-if="permStore.hasPermi('butler:workOrder:hall')"
>
<image
class="item-icon"
src="https://wuyeadmin.bugtc.com/images/imgs/work-order.png"
mode="aspectFit"
></image>
<text class="item-text">工单大厅</text>
</view>
<view
class="function-item"
@tap="goToMyTicket"
v-if="permStore.hasPermi('butler:workOrder:mine')"
>
<image
class="item-icon"
src="https://wuyeadmin.bugtc.com/images/imgs/my-work.png"
mode="aspectFit"
></image>
<text class="item-text">我的工单</text>
</view>
<view
class="function-item"
@tap="goToComplaint"
v-if="permStore.hasPermi('butler:complaint:handle')"
>
<image
class="item-icon"
src="https://wuyeadmin.bugtc.com/images/imgs/complaint.png"
mode="aspectFit"
></image>
<text class="item-text">投诉处理</text>
</view>
<view
class="function-item"
@tap="goToReplacement_record"
v-if="permStore.hasPermi('butler:meter:replace')"
>
<image
class="item-icon"
src="https://wuye.ckdzkj.com/images/home/updateDevice.png"
mode="aspectFit"
></image>
<text class="item-text">仪表换新</text>
</view>
</view>
</view>
@@ -188,7 +187,11 @@ import {
getNewNoticeData,
getBannarList
} from '../../api/api.js'
import { hasPermi } from '../../utils/permissions.js'
import { usePermStore } from '@/stores/usePermStore'
const permStore = usePermStore()
// 列表数据状态
const currentCommunity = ref('请先绑定房屋')
const bannerList = ref([])
@@ -197,8 +200,6 @@ const allCount = ref(0) // 全部巡检
const pendingCount = ref(0) //待巡检
const InspectedCount = ref(0) //已巡检
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight || 0)
console.log(hasPermi('butler:meter:replace'))
// =======方法=======
// 跳转小区
const navigateToPage = () => {
@@ -343,10 +344,13 @@ const slelctHomeData = data => {
getNoticeData()
getInspectionData()
}
const permissionlist = ref([])
onShow(() => {
getbannarData()
getInspectionData()
currentVillageData()
permStore.initPerm()
})
onLoad(() => {
@@ -585,6 +589,9 @@ onUnload(() => {
padding: 30rpx 0;
box-sizing: border-box;
margin-top: 20rpx;
display: grid;
grid-template-columns: repeat(4, 1fr);
}
/* 功能行布局 */
@@ -603,7 +610,6 @@ onUnload(() => {
flex-direction: column;
align-items: center;
justify-content: center;
width: 25%;
padding: 10rpx 0;
}