2025-07-04 16:18:58 +08:00
|
|
|
|
<template>
|
2025-07-05 16:09:43 +08:00
|
|
|
|
<view class="workbench-container">
|
|
|
|
|
|
<custom-nav-bar>
|
|
|
|
|
|
<view class="workbench-title" slot="left">
|
|
|
|
|
|
<text>工作台</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</custom-nav-bar>
|
2025-08-20 13:44:05 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 按分类展示入口项 -->
|
|
|
|
|
|
<view class="category-container" v-for="(group, category) in groupedEntries" :key="category">
|
|
|
|
|
|
<!-- 分类标题 -->
|
|
|
|
|
|
<view class="category-title">
|
|
|
|
|
|
<text>{{ category || '其他' }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 分类下的入口列表 -->
|
|
|
|
|
|
<view class="entry-list">
|
|
|
|
|
|
<view
|
|
|
|
|
|
v-for="item in group"
|
2026-02-05 15:52:09 +08:00
|
|
|
|
:key="item.text"
|
2025-08-20 13:44:05 +08:00
|
|
|
|
class="entry-item"
|
|
|
|
|
|
@click="handleEntryClick(item)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<image class="entry-icon" :src="item.icon" mode="aspectFit" />
|
|
|
|
|
|
<text class="entry-text">{{ item.text }}</text>
|
|
|
|
|
|
</view>
|
2025-07-05 16:09:43 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2025-07-04 16:18:58 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-07-05 16:09:43 +08:00
|
|
|
|
import CustomNavBar from '@/components/CustomNavBar/index.vue';
|
2025-07-14 10:04:33 +08:00
|
|
|
|
import { getUserProfile } from '@/api/oa/user.js';
|
|
|
|
|
|
|
2025-07-04 16:18:58 +08:00
|
|
|
|
export default {
|
2025-07-05 16:09:43 +08:00
|
|
|
|
name: "WorkbenchIndex",
|
|
|
|
|
|
components: {
|
|
|
|
|
|
CustomNavBar,
|
2025-07-04 16:18:58 +08:00
|
|
|
|
},
|
2025-07-14 10:04:33 +08:00
|
|
|
|
onShow() {
|
2025-08-20 13:44:05 +08:00
|
|
|
|
console.log('页面onShow被调用');
|
2025-07-14 10:04:33 +08:00
|
|
|
|
this.fetchUserProfile();
|
|
|
|
|
|
},
|
2025-07-28 11:22:19 +08:00
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2025-08-20 13:44:05 +08:00
|
|
|
|
roleGroup: [], // 存储用户拥有的权限集合
|
|
|
|
|
|
loading: true,
|
2025-07-28 11:22:19 +08:00
|
|
|
|
entryList: [
|
|
|
|
|
|
{
|
|
|
|
|
|
text: '每日报工',
|
|
|
|
|
|
icon: '/static/images/baogong.png',
|
|
|
|
|
|
url: '/pages/workbench/reportWork/reportWork',
|
2025-08-20 13:44:05 +08:00
|
|
|
|
category: "信息中心"
|
|
|
|
|
|
// 未设置access时默认允许所有用户访问
|
2025-07-28 11:22:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
text: '任务中心',
|
|
|
|
|
|
icon: '/static/images/task.png',
|
|
|
|
|
|
url: '/pages/workbench/task/task',
|
2025-11-07 17:18:33 +08:00
|
|
|
|
category: "项目中心"
|
2025-07-28 11:22:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
text: '项目排产',
|
|
|
|
|
|
icon: '/static/images/paichan.png',
|
|
|
|
|
|
url: '/pages/workbench/reportSchedule/reportSchedule',
|
2025-08-20 13:44:05 +08:00
|
|
|
|
category: '车间管理'
|
2025-07-28 11:22:19 +08:00
|
|
|
|
},
|
2025-08-20 13:44:05 +08:00
|
|
|
|
{
|
|
|
|
|
|
text: '施工进度',
|
|
|
|
|
|
icon: '/static/images/shigong.png',
|
|
|
|
|
|
url: '/pages/workbench/construction/construction',
|
|
|
|
|
|
category: '车间管理'
|
|
|
|
|
|
},
|
2025-07-28 11:22:19 +08:00
|
|
|
|
{
|
|
|
|
|
|
text: '快递信息',
|
|
|
|
|
|
icon: '/static/images/express.svg',
|
|
|
|
|
|
url: '/pages/workbench/express/express',
|
2025-08-20 13:44:05 +08:00
|
|
|
|
category: '车间管理'
|
2025-07-28 11:22:19 +08:00
|
|
|
|
},
|
2025-08-20 16:07:18 +08:00
|
|
|
|
{
|
|
|
|
|
|
text: '人员考勤',
|
|
|
|
|
|
icon: '/static/images/kaoqin.png',
|
|
|
|
|
|
url: '/pages/workbench/attendance/attendance',
|
|
|
|
|
|
category: '车间管理'
|
|
|
|
|
|
},
|
2025-07-28 11:22:19 +08:00
|
|
|
|
{
|
2025-11-06 16:56:35 +08:00
|
|
|
|
text: '项目管理',
|
2025-07-28 11:22:19 +08:00
|
|
|
|
icon: '/static/images/project.png',
|
|
|
|
|
|
url: '/pages/workbench/project/project',
|
2025-11-06 16:56:35 +08:00
|
|
|
|
access: ['vice, admin', 'doctor', 'ceo', '13'],
|
|
|
|
|
|
category: "项目中心"
|
2025-07-28 11:22:19 +08:00
|
|
|
|
},
|
2025-11-06 16:56:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
text: '项目进度',
|
|
|
|
|
|
icon: '/static/images/progress.png',
|
|
|
|
|
|
url: '/pages/workbench/project/schedule',
|
|
|
|
|
|
category: '项目中心'
|
|
|
|
|
|
},
|
2025-08-20 13:44:05 +08:00
|
|
|
|
{
|
|
|
|
|
|
text: '问题反馈',
|
|
|
|
|
|
icon: '/static/images/wenti.png',
|
|
|
|
|
|
url: '/pages/workbench/feedback/feedback',
|
|
|
|
|
|
category: "信息中心"
|
|
|
|
|
|
},
|
2025-11-07 14:21:27 +08:00
|
|
|
|
{
|
|
|
|
|
|
text: '采购需求',
|
|
|
|
|
|
icon: '/static/images/requirement.png',
|
|
|
|
|
|
url: '/pages/workbench/requirement/requirement',
|
|
|
|
|
|
category: "信息中心"
|
|
|
|
|
|
},
|
2025-11-06 16:56:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
text: '客户管理',
|
|
|
|
|
|
icon: '/static/images/customer.png',
|
|
|
|
|
|
url: '/pages/workbench/customer/customer',
|
|
|
|
|
|
category: '信息中心'
|
|
|
|
|
|
},
|
2025-11-07 10:30:50 +08:00
|
|
|
|
{
|
|
|
|
|
|
text: '通知公告',
|
|
|
|
|
|
icon: '/static/images/notice.png',
|
|
|
|
|
|
url: '/pages/workbench/notice/notice',
|
|
|
|
|
|
category: '信息中心'
|
|
|
|
|
|
},
|
2026-02-05 10:42:50 +08:00
|
|
|
|
{
|
|
|
|
|
|
text: '我的代办',
|
|
|
|
|
|
icon: '/static/images/todo.png',
|
|
|
|
|
|
url: '/pages/workbench/hrm/approve/approve',
|
|
|
|
|
|
category: '办公管理'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
text: '抄送我的',
|
|
|
|
|
|
icon: '/static/images/cc.png',
|
|
|
|
|
|
url: '/pages/workbench/hrm/cc/cc',
|
|
|
|
|
|
category: '办公管理'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
text: '我的申请',
|
|
|
|
|
|
icon: '/static/images/hrm_apply.png',
|
|
|
|
|
|
url: '/pages/workbench/hrm/apply/apply',
|
|
|
|
|
|
category: '办公管理'
|
|
|
|
|
|
},
|
2025-07-28 11:22:19 +08:00
|
|
|
|
{
|
|
|
|
|
|
text: '库存盘点',
|
|
|
|
|
|
icon: '/static/images/stock.png',
|
|
|
|
|
|
url: '/pages/workbench/wms/wms',
|
2025-08-20 13:44:05 +08:00
|
|
|
|
category: "库房管理"
|
2025-07-28 11:22:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-08-20 13:44:05 +08:00
|
|
|
|
text: '项目盈亏',
|
|
|
|
|
|
icon: '/static/images/yingkui.png',
|
|
|
|
|
|
url: '/pages/workbench/profit/profit',
|
|
|
|
|
|
category: '财务中心',
|
2025-08-20 16:21:59 +08:00
|
|
|
|
access: ['vice', 'baomi', 'ceo'] // 需要特定权限才能访问
|
2025-07-28 11:22:19 +08:00
|
|
|
|
},
|
2025-11-06 16:56:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
text: '项目明细',
|
|
|
|
|
|
icon: '/static/images/profitpro.png',
|
|
|
|
|
|
url: '/pages/workbench/profit/project',
|
|
|
|
|
|
category: '财务中心',
|
|
|
|
|
|
// access: ['vice', 'baomi', 'ceo'] // 需要特定权限才能访问
|
|
|
|
|
|
},
|
2025-10-14 13:58:33 +08:00
|
|
|
|
{
|
|
|
|
|
|
text: '项目成本',
|
|
|
|
|
|
icon: '/static/images/cost.png',
|
|
|
|
|
|
url: '/pages/workbench/cost/cost',
|
|
|
|
|
|
category: '财务中心',
|
|
|
|
|
|
},
|
2025-08-20 16:07:18 +08:00
|
|
|
|
{
|
|
|
|
|
|
text: '智慧库房',
|
|
|
|
|
|
icon: '/static/images/smartStock.png',
|
|
|
|
|
|
url: '/pages/workbench/smartWM/smartWM',
|
|
|
|
|
|
category: '库房管理',
|
|
|
|
|
|
},
|
2025-08-21 16:56:01 +08:00
|
|
|
|
{
|
|
|
|
|
|
text: '采购进度',
|
|
|
|
|
|
icon: '/static/images/purchase.png',
|
|
|
|
|
|
url: '/pages/workbench/wms/purchase',
|
|
|
|
|
|
category: '库房管理',
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
text: '入库记录',
|
|
|
|
|
|
icon: '/static/images/ruku.png',
|
|
|
|
|
|
url: '/pages/workbench/wms/in',
|
|
|
|
|
|
category: '库房管理',
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
text: '出库记录',
|
|
|
|
|
|
icon: '/static/images/chuku.png',
|
|
|
|
|
|
url: '/pages/workbench/wms/out',
|
|
|
|
|
|
category: '库房管理',
|
|
|
|
|
|
},
|
2026-02-05 10:42:50 +08:00
|
|
|
|
|
2025-10-13 17:51:27 +08:00
|
|
|
|
// {
|
|
|
|
|
|
// text: '代办任务',
|
|
|
|
|
|
// icon: '/static/images/todo.png',
|
|
|
|
|
|
// url: '/pages/workbench/workflow/todo/todo',
|
|
|
|
|
|
// category: '办公流程'
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// text: '已办任务',
|
|
|
|
|
|
// icon: '/static/images/finished.png',
|
|
|
|
|
|
// url: '/pages/workbench/workflow/finished/finished',
|
|
|
|
|
|
// category: '办公流程'
|
|
|
|
|
|
// },
|
2025-08-20 13:44:05 +08:00
|
|
|
|
{
|
|
|
|
|
|
text: '线上营销',
|
|
|
|
|
|
icon: '/static/images/yingxiao.png',
|
|
|
|
|
|
url: '/pages/workbench/sales/sales',
|
|
|
|
|
|
},
|
2025-10-13 17:51:27 +08:00
|
|
|
|
{
|
|
|
|
|
|
text: "用户管理",
|
|
|
|
|
|
icon: '/static/images/user.png',
|
|
|
|
|
|
url: '/pages/workbench/user/user',
|
2025-10-14 13:58:33 +08:00
|
|
|
|
access: ['vice', 'ceo']
|
2025-10-13 17:51:27 +08:00
|
|
|
|
}
|
2025-07-28 11:22:19 +08:00
|
|
|
|
],
|
|
|
|
|
|
};
|
|
|
|
|
|
},
|
2025-08-20 13:44:05 +08:00
|
|
|
|
computed: {
|
|
|
|
|
|
// 按category分组并过滤权限的计算属性
|
|
|
|
|
|
groupedEntries() {
|
|
|
|
|
|
const groups = {};
|
|
|
|
|
|
this.entryList.forEach(item => {
|
|
|
|
|
|
// 权限判断逻辑:
|
|
|
|
|
|
// 1. 如果item没有access属性,默认允许访问
|
|
|
|
|
|
// 2. 如果有access属性,检查用户权限(roleGroup)是否包含其中任意一个
|
|
|
|
|
|
const hasAccess = !item.access || item.access.some(access => this.roleGroup.includes(access));
|
|
|
|
|
|
|
|
|
|
|
|
// 没有权限则跳过当前项
|
|
|
|
|
|
if (!hasAccess) return;
|
|
|
|
|
|
|
|
|
|
|
|
// 按分类分组
|
|
|
|
|
|
const category = item.category || '其他';
|
|
|
|
|
|
if (!groups[category]) {
|
|
|
|
|
|
groups[category] = [];
|
|
|
|
|
|
}
|
|
|
|
|
|
groups[category].push(item);
|
|
|
|
|
|
});
|
|
|
|
|
|
return groups;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-07-05 16:09:43 +08:00
|
|
|
|
methods: {
|
2025-07-14 10:04:33 +08:00
|
|
|
|
async fetchUserProfile() {
|
|
|
|
|
|
console.log('fetchUserProfile方法开始执行');
|
|
|
|
|
|
try {
|
2025-08-20 13:44:05 +08:00
|
|
|
|
// this.loading = true;
|
|
|
|
|
|
uni.showLoading()
|
2025-07-14 10:04:33 +08:00
|
|
|
|
console.log('开始调用getUserProfile API');
|
|
|
|
|
|
const response = await getUserProfile();
|
2026-02-05 10:42:50 +08:00
|
|
|
|
//
|
2025-07-14 10:04:33 +08:00
|
|
|
|
console.log('用户个人信息:', response);
|
2025-08-20 13:44:05 +08:00
|
|
|
|
// 从接口返回数据中提取用户权限(roleKey)
|
|
|
|
|
|
const roles = response.data.user?.roles?.map(item => item.roleKey) || [];
|
2026-02-05 10:42:50 +08:00
|
|
|
|
this.$store.commit('oa/SET_STATE', response.data.user)
|
2025-08-20 13:44:05 +08:00
|
|
|
|
console.log('用户权限字段', roles);
|
|
|
|
|
|
this.roleGroup = roles;
|
|
|
|
|
|
uni.hideLoading()
|
2025-07-14 10:04:33 +08:00
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('获取用户个人信息失败:', error);
|
2025-08-20 13:44:05 +08:00
|
|
|
|
// 错误处理:可以设置默认权限或提示用户
|
|
|
|
|
|
this.roleGroup = [];
|
2025-07-14 10:04:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-07-28 11:22:19 +08:00
|
|
|
|
handleEntryClick(item) {
|
|
|
|
|
|
if (item.url) {
|
|
|
|
|
|
uni.navigateTo({ url: item.url });
|
|
|
|
|
|
}
|
2025-07-24 15:45:18 +08:00
|
|
|
|
},
|
2025-07-14 10:04:33 +08:00
|
|
|
|
},
|
2025-07-04 16:18:58 +08:00
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
2025-07-05 16:09:43 +08:00
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.workbench-container {
|
|
|
|
|
|
min-height: 100vh;
|
2025-08-20 13:44:05 +08:00
|
|
|
|
background: #f5f5f5;
|
2025-07-05 16:09:43 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
}
|
2025-08-20 13:44:05 +08:00
|
|
|
|
|
2025-07-05 16:09:43 +08:00
|
|
|
|
.workbench-title {
|
|
|
|
|
|
padding-left: 44rpx;
|
|
|
|
|
|
font-size: 40rpx;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
color: #0c1c33;
|
|
|
|
|
|
}
|
2025-08-20 13:44:05 +08:00
|
|
|
|
|
|
|
|
|
|
// 分类容器样式
|
|
|
|
|
|
.category-container {
|
|
|
|
|
|
margin-top: 30rpx;
|
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
border-radius: 16rpx;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
margin-left: 30rpx;
|
|
|
|
|
|
margin-right: 30rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 分类标题样式
|
|
|
|
|
|
.category-title {
|
|
|
|
|
|
padding: 28rpx 44rpx;
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
background-color: #fafafa;
|
|
|
|
|
|
border-bottom: 1px solid #f0f0f0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 入口列表样式
|
2025-07-05 16:09:43 +08:00
|
|
|
|
.entry-list {
|
|
|
|
|
|
display: flex;
|
2025-08-20 13:44:05 +08:00
|
|
|
|
flex-wrap: wrap; // 允许换行
|
|
|
|
|
|
padding: 10rpx 0;
|
2025-07-05 16:09:43 +08:00
|
|
|
|
}
|
2025-08-20 13:44:05 +08:00
|
|
|
|
|
|
|
|
|
|
// 入口项样式
|
2025-07-05 16:09:43 +08:00
|
|
|
|
.entry-item {
|
|
|
|
|
|
display: flex;
|
2025-08-20 13:44:05 +08:00
|
|
|
|
flex-direction: column; // 纵向排列(图标在上,文字在下)
|
2025-07-05 16:09:43 +08:00
|
|
|
|
align-items: center;
|
2025-08-20 13:44:05 +08:00
|
|
|
|
justify-content: center;
|
|
|
|
|
|
width: 25%; // 一行显示4个
|
|
|
|
|
|
padding: 30rpx 0;
|
|
|
|
|
|
box-sizing: border-box;
|
2025-07-05 16:09:43 +08:00
|
|
|
|
}
|
2025-08-20 13:44:05 +08:00
|
|
|
|
|
2025-07-05 16:09:43 +08:00
|
|
|
|
.entry-icon {
|
2025-08-20 13:44:05 +08:00
|
|
|
|
width: 80rpx;
|
|
|
|
|
|
height: 80rpx;
|
|
|
|
|
|
margin-bottom: 16rpx; // 图标与文字间距
|
2025-07-05 16:09:43 +08:00
|
|
|
|
}
|
2025-08-20 13:44:05 +08:00
|
|
|
|
|
2025-07-05 16:09:43 +08:00
|
|
|
|
.entry-text {
|
|
|
|
|
|
color: #333;
|
2025-08-20 13:44:05 +08:00
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
|
text-align: center; // 文字居中
|
|
|
|
|
|
white-space: nowrap; // 防止文字换行
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis; // 文字过长时显示省略号
|
|
|
|
|
|
width: 100%; // 限制文字宽度
|
2025-07-05 16:09:43 +08:00
|
|
|
|
}
|
2025-08-20 13:44:05 +08:00
|
|
|
|
</style>
|