一单n制等功能,接入随手拍之前我先提交一版本

This commit is contained in:
王利强
2026-08-12 14:43:53 +08:00
parent ec76d588e2
commit 47deeedb22
664 changed files with 1429 additions and 2894 deletions

View File

@@ -45,11 +45,20 @@
</view>
</view>
<!-- 我的检查计划 -->
<view v-if="!isApprovalRole" class="bg-white margin-top radius" style="padding: 40rpx; margin-left: -30rpx; margin-right: -30rpx;">
<view class="flex margin-bottom-xl align-center justify-between">
<view v-if="showCheckPlanSection" class="bg-white margin-top radius" style="padding: 40rpx; margin-left: -30rpx; margin-right: -30rpx;">
<view class="flex margin-bottom align-center justify-between">
<view class="text-bold margin-left-xs" style="font-size: 32rpx;">我的检查计划</view>
<!-- <button class="cu-btn round sm line-blue inspect-list-btn" @click="goInspectList">检查列表</button> -->
</view>
<view class="danger-tab-list plan-tab-list">
<view
class="danger-tab-item"
:class="{ 'danger-tab-active': activePlanTab === index }"
v-for="(tab, index) in planTabs"
:key="tab.value"
@click="switchPlanTab(index)"
>{{ tab.label }}</view>
</view>
<!-- 无数据提示 -->
<view v-if="checkPlanData.length === 0" class="text-center text-gray padding">
暂无检查计划
@@ -184,7 +193,7 @@
class="round cu-btn bg-blue" @click.stop="goRectification(item)">立即整改</button>
<button v-if="item.statusName === '待验收' && item.canEdit"
class="round cu-btn light bg-blue" @click.stop="editRectification(item)">编辑整改信息</button>
<button v-if="canShowAcceptanceButton(item, currentRoleKey)"
<button v-if="canShowAcceptanceButton(item)"
class="round cu-btn bg-blue" @click.stop="goAcceptance(item)">立即验收</button>
<button v-if="item.statusName === '待交办'"
class="round cu-btn bg-blue" @click.stop="assignHazard(item)">隐患交办</button>
@@ -266,7 +275,7 @@
import { getProfileDetail } from '@/request/three_one_api/info.js';
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
import { toImageUrl } from '@/request/request.js';
import { applyProfileToUserInfo, applyStoredUserInfo, resolveIdentityName, resolveUserIdentityRoleKey } from '@/utils/userInfo.js';
import { applyProfileToUserInfo, applyStoredUserInfo, resolveIdentityName, resolveUserIdentityRoleKey, isGovernmentEntityAdmin } from '@/utils/userInfo.js';
import {
buildRectificationUrl,
buildEditRectificationUrl,
@@ -302,6 +311,7 @@
const currentRoleKey = computed(() => resolveUserIdentityRoleKey(userInfo));
const isApprovalRole = computed(() => currentRoleKey.value === 'approval');
const showCheckPlanSection = computed(() => !isApprovalRole.value && currentRoleKey.value !== 'manage');
// 展示用身份名称(兼容接口字段与本地缓存)
const displayIdentityName = computed(() => {
@@ -375,17 +385,22 @@
// common角色只能看到的菜单名称
const commonMenuNames = ['隐患排查', '隐患销号'];
// 政府类型管理员organizationEntityType=0/1 且 admin/manage隐藏的菜单
const govEntityAdminHiddenMenuNames = ['成员管理', '信息填报', '区域设置', '证件管理'];
// 根据角色动态展示菜单
// 根据角色与组织实体类型动态展示菜单
const infoList = computed(() => {
let list = allMenuList;
if (currentRoleKey.value === 'approval') {
return allMenuList.filter(item => item.name === '隐患排查');
list = list.filter(item => item.name === '隐患排查');
} else if (currentRoleKey.value === 'common') {
list = list.filter(item => commonMenuNames.includes(item.name));
}
if (currentRoleKey.value === 'common') {
return allMenuList.filter(item => commonMenuNames.includes(item.name));
if (isGovernmentEntityAdmin(userInfo)) {
list = list.filter(item => !govEntityAdminHiddenMenuNames.includes(item.name));
}
// admin、manage 及其他角色展示全部菜单
return allMenuList;
return list;
});
const goInspectList = () => {
uni.navigateTo({
@@ -456,6 +471,12 @@
//我的检查计划
const PLAN_INITIAL_SIZE = 4;
const planTabs = [
{ label: '全部', value: 0 },
{ label: '未完成', value: 4 },
{ label: '已完成', value: 3 }
];
const activePlanTab = ref(0);
const checkPlanParams = ref({
pageNum: 1,
pageSize: PLAN_INITIAL_SIZE,
@@ -466,6 +487,19 @@
const planShowAll = ref(false);
const expandedPlanMap = ref({});
const buildCheckPlanListParams = (pageSize) => ({
pageNum: 1,
pageSize,
name: checkPlanParams.value.name,
planStatus: planTabs[activePlanTab.value].value
});
const switchPlanTab = (index) => {
if (activePlanTab.value === index) return;
activePlanTab.value = index;
getCheckPlanLists();
};
const hasMoreCheckPlans = computed(() => {
return !planShowAll.value && checkPlanTotal.value > PLAN_INITIAL_SIZE;
});
@@ -494,11 +528,7 @@
const getCheckPlanLists = async () => {
planShowAll.value = false;
try {
const res = await getCheckPlanList({
pageNum: 1,
pageSize: PLAN_INITIAL_SIZE,
name: checkPlanParams.value.name
});
const res = await getCheckPlanList(buildCheckPlanListParams(PLAN_INITIAL_SIZE));
if (res.code === 0) {
const records = res.data?.records || [];
checkPlanTotal.value = Number(res.data?.total ?? records.length);
@@ -515,11 +545,7 @@
const loadMoreCheckPlans = async () => {
if (!hasMoreCheckPlans.value) return;
try {
const res = await getCheckPlanList({
pageNum: 1,
pageSize: checkPlanTotal.value,
name: checkPlanParams.value.name
});
const res = await getCheckPlanList(buildCheckPlanListParams(checkPlanTotal.value));
if (res.code === 0) {
const records = res.data?.records || [];
initPlanExpandedState(records);
@@ -552,7 +578,9 @@
if (isApprovalRole.value) {
fetchWorkbenchList();
} else {
getCheckPlanLists();
if (showCheckPlanSection.value) {
getCheckPlanLists();
}
resetHiddenDangerList();
fetchHiddenDangerList();
}
@@ -1117,7 +1145,8 @@
margin-left: 10rpx;
}
.workbench-tab-list {
.workbench-tab-list,
.plan-tab-list {
margin-bottom: 20rpx;
}