检查表手动添加检查项时根据部门类型展示不一样

This commit is contained in:
王利强
2026-08-03 11:51:07 +08:00
parent 088ff356f2
commit ec76d588e2
50 changed files with 826 additions and 428 deletions

View File

@@ -37,20 +37,22 @@
</view>
<view class="flex justify-end card-actions" style="gap: 10rpx;">
<button class="round cu-btn light bg-blue" @click="details(item)">查看详情</button>
<button v-if="item.statusName === '待整改' && item.canEdit"
class="round cu-btn light bg-blue" @click="assignHazard(item)">隐患交办</button>
<button v-if="item.statusName === '待整改' && item.canEdit"
class="round cu-btn bg-blue" @click="Rectification(item)">立即整改</button>
<button v-if="item.statusName === '待验收' && item.canEdit"
class="round cu-btn light bg-blue" @click="editRectification(item)">编辑整改信息</button>
<button v-if="canShowAcceptanceButton(item, userRole)"
class="round cu-btn bg-blue" @click="acceptance(item)">立即验收</button>
<button v-if="item.statusName === '待交办'"
class="round cu-btn bg-blue" @click="assignHazard(item)">隐患交办</button>
<button v-if="canShowWriteoffApplyButton(item)"
class="round cu-btn bg-blue" @click="goWriteoffApply(item)">销号申请</button>
<button v-if="canShowWriteoffApprovalButton(item, userRole)"
class="round cu-btn bg-blue" @click="goWriteoffApproval(item)">销号审批</button>
<template v-if="!isApprovalRole">
<button v-if="item.statusName === '待整改' && item.canEdit"
class="round cu-btn light bg-blue" @click="assignHazard(item)">隐患交办</button>
<button v-if="item.statusName === '待整改' && item.canEdit"
class="round cu-btn bg-blue" @click="Rectification(item)">立即整改</button>
<button v-if="item.statusName === '待验收' && item.canEdit"
class="round cu-btn light bg-blue" @click="editRectification(item)">编辑整改信息</button>
<button v-if="canShowAcceptanceButton(item, userRole)"
class="round cu-btn bg-blue" @click="acceptance(item)">立即验收</button>
<button v-if="item.statusName === '待交办'"
class="round cu-btn bg-blue" @click="assignHazard(item)">隐患交办</button>
<button v-if="canShowWriteoffApplyButton(item)"
class="round cu-btn bg-blue" @click="goWriteoffApply(item)">销号申请</button>
<button v-if="canShowWriteoffApprovalButton(item, userRole)"
class="round cu-btn bg-blue" @click="goWriteoffApproval(item)">销号审批</button>
</template>
</view>
</view>
@@ -60,7 +62,7 @@
style="margin-top: 20rpx; margin-bottom: 140rpx;"
/>
<view class="fixed-add-btn" @click="goToAdd">
<view v-if="!isApprovalRole" class="fixed-add-btn" @click="goToAdd">
<text class="cuIcon-add"></text>
<text>新增</text>
</view>
@@ -68,7 +70,7 @@
</template>
<script setup>
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app'
import {
enterCheckPlan,
@@ -86,19 +88,20 @@
canShowWriteoffApplyButton,
canShowWriteoffApprovalButton
} from '@/utils/hazardNav.js'
import { resolveUserRoleKey } from '@/utils/userInfo.js'
import { resolveUserIdentityRoleKey } from '@/utils/userInfo.js'
const taskId = ref('')
const checkPointId = ref('')
const oneTableId = ref('')
const userRole = ref('')
const isApprovalRole = computed(() => userRole.value === 'approval')
const getUserRole = () => {
try {
const userInfoStr = uni.getStorageSync('userInfo')
if (userInfoStr) {
userRole.value = resolveUserRoleKey(JSON.parse(userInfoStr))
userRole.value = resolveUserIdentityRoleKey(JSON.parse(userInfoStr))
}
} catch (error) {
console.error('获取用户信息失败:', error)