| | |
| | | <view class="cu-btn bg-red margin-tb-sm lg round" style="position: absolute; right: 20px; width: 30%; height: 50%;" @click="equit">{{$t('index.outLogin')}}</view>
|
| | | </view>
|
| | |
|
| | | <view class="cu-bar bg-white solid-bottom margin-top-sm">
|
| | | <view class="action">
|
| | | <text class="cuIcon-title text-orange "></text> 入库
|
| | | </view>
|
| | | </view> |
| | | <view class="cu-list grid col-4 no-border">
|
| | | <!-- 空托入库 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/emptyTray/inBound" navigateTo>
|
| | | <view class="cuIcon-pulldown text-blue"></view>
|
| | | <text>{{$t('index.emptyInBound')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/rece/standard" navigateTo>
|
| | | <view class="cuIcon-apps text-blue">
|
| | | </view>
|
| | | <text>标准收货</text>
|
| | | </navigator>
|
| | | </view> |
| | | <!-- 单据组托 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/listing/matnrPalletising" navigateTo>
|
| | | <view class="cuIcon-cardboard text-blue"></view>
|
| | | <text>{{$t('index.palletizing')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <!-- 组托解绑 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/listing/unPakin" navigateTo>
|
| | | <view class="cuIcon-cardboardforbid text-blue"></view>
|
| | | <text>{{$t('index.palletBuilding')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <!-- 启动入库 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/AGV/StartInTask" navigateTo>
|
| | | <view class="cuIcon-pulldown text-blue"></view>
|
| | | <text>{{$t('index.inboundInitiation')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <!-- 入库订单 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/inbound/orderIn" navigateTo>
|
| | | <view class="cuIcon-addressbook text-blue"></view>
|
| | | <text>{{$t('index.orderIn')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <!-- 人工上架 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/listing/labour" navigateTo>
|
| | | <view class="cuIcon-friendadd text-blue"></view>
|
| | | <text>{{$t('index.manualPutaway')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <!-- 灌桶入库:缓存区袋装塑料粒子灌桶后入库 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/inbound/buffStore" navigateTo>
|
| | | <view class="cuIcon-all text-blue"></view>
|
| | | <text>{{$t('index.buffStore')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | |
| | | <!-- <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/rece/other" navigateTo>
|
| | | <view class="cuIcon-taoxiaopu text-blue">
|
| | | </view>
|
| | | <text>{{$t('index.GR')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/inspect/report" navigateTo>
|
| | | <view class="cuIcon-edit text-blue">
|
| | | </view>
|
| | | <text>{{$t('index.inspectionRequest')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | |
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/listing/disc" navigateTo>
|
| | | <view class="cuIcon-cardboard text-blue">
|
| | | </view>
|
| | | <text>组盘</text>
|
| | | </navigator>
|
| | | </view> -->
|
| | | <!-- 加载中提示 -->
|
| | | <view v-if="loading" class="loading-container">
|
| | | <text>加载中...</text>
|
| | | </view>
|
| | |
|
| | | <!-- 动态菜单区域 -->
|
| | | <block v-for="category in filteredMenus" :key="category.id">
|
| | | <view class="cu-bar bg-white solid-bottom margin-top-sm">
|
| | | <view class="action">
|
| | | <text class="cuIcon-title text-orange "></text> {{category.name}}
|
| | | </view>
|
| | | </view>
|
| | | <view class="cu-list grid col-4 no-border">
|
| | | <view class="cu-item" v-for="menu in category.menus" :key="menu.id" @click="goToPage(menu)">
|
| | | <view :class="'cuIcon-' + menu.icon + ' text-blue'"></view>
|
| | | <text>{{menu.name}}</text>
|
| | | </view>
|
| | | </view>
|
| | | </block>
|
| | |
|
| | | <view class="cu-bar bg-white solid-bottom margin-top-sm">
|
| | | <view class="action">
|
| | | <text class="cuIcon-title text-orange "></text> 出库
|
| | | </view>
|
| | | </view> |
| | | <view class="cu-list grid col-4 no-border">
|
| | | <!-- 空托出库 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/emptyTray/outBound" navigateTo>
|
| | | <view class="cuIcon-pullup text-blue"></view>
|
| | | <text>{{$t('index.emptyOutBound')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <!-- 订单出库 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/outbound/orderPick" navigateTo>
|
| | | <view class="cuIcon-addressbook text-blue"></view>
|
| | | <text>{{$t('index.orderPick')}}</text>
|
| | | </navigator>
|
| | | </view> |
| | | <!-- 生产直送:原材料不入库直接送产线 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/outbound/matDirectDelivery" navigateTo>
|
| | | <view class="cuIcon-deliver text-blue"></view>
|
| | | <text>{{$t('index.matDirectDelivery')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <!-- 成品直出:成品不入立库直接出库 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/outbound/productDirectDelivery" navigateTo>
|
| | | <view class="cuIcon-deliver_fill text-blue"></view>
|
| | | <text>{{$t('index.productDirectDelivery')}}</text>
|
| | | </navigator>
|
| | | </view> |
| | | <!-- 出库订单 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/outbound/orderOut" navigateTo>
|
| | | <view class="cuIcon-addressbook text-blue"></view>
|
| | | <text>{{$t('index.orderPickGroup')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <!-- 生产备料 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/outbound/matPreparation" navigateTo>
|
| | | <view class="cuIcon-present text-blue"></view>
|
| | | <text>{{$t('index.matPreparation')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | |
| | | <!-- 生产叫料 -->
|
| | | <!-- <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/outbound/productionMatCall" navigateTo>
|
| | | <view class="cuIcon-apps text-blue">
|
| | | </view>
|
| | | <text>{{$t('index.productionMatCall')}}</text>
|
| | | </navigator>
|
| | | </view> -->
|
| | | <!-- 无菜单权限时显示提示 -->
|
| | | <view v-if="!loading && filteredMenus.length === 0" class="no-permission">
|
| | | <text>暂无可用菜单</text>
|
| | | </view>
|
| | | |
| | | |
| | | <view class="cu-bar bg-white solid-bottom margin-top-sm">
|
| | | <view class="action">
|
| | | <text class="cuIcon-title text-orange "></text> 综合
|
| | | </view>
|
| | | </view> |
| | | <view class="cu-list grid col-4 no-border">
|
| | | <!-- 调拨订单 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/transfer/transferType" navigateTo>
|
| | | <view class="cuIcon-addressbook text-blue"></view>
|
| | | <text>{{$t('index.orderTransfer')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <!-- 移库 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/transfer/matTransfer" navigateTo>
|
| | | <view class="cuIcon-location text-blue"></view>
|
| | | <text>{{$t('index.matTransfer')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <!-- 盘点 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/check/checkOrder" navigateTo>
|
| | | <view class="cuIcon-roundcheck text-blue"></view>
|
| | | <text>{{$t('index.checkOrder')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <!-- 质检上锁 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/inspect/bad" navigateTo>
|
| | | <view class="cuIcon-lock text-blue"></view>
|
| | | <text>{{$t('index.defectiveMarking')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <!-- 质检解锁 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/inspect/check" navigateTo>
|
| | | <view class="cuIcon-unlock text-blue"></view>
|
| | | <text>{{$t('index.qualityInspection')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <!-- 工作任务 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/workInfo/taskInfo" navigateTo>
|
| | | <view class="cuIcon-tagfill text-blue"></view>
|
| | | <text>{{$t('index.taskInfo')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <!-- 站点维护 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/workInfo/stationInfo" navigateTo>
|
| | | <view class="cuIcon-service text-blue"></view>
|
| | | <text>{{$t('index.stationInfo')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <!-- 库位维护 -->
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/workInfo/locInfo" navigateTo>
|
| | | <view class="cuIcon-servicefill text-blue"></view>
|
| | | <text>{{$t('index.locInfo')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | |
| | | <!-- <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/outbound/fastPicking" navigateTo>
|
| | | <view class="cuIcon-apps text-blue">
|
| | | </view>
|
| | | <text>{{$t('index.quickPicking')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/outbound/wavePickItem" navigateTo>
|
| | | <view class="cuIcon-apps text-blue">
|
| | | </view>
|
| | | <text>{{$t('index.wavePick')}}</text>
|
| | | </navigator>
|
| | | </view> -->
|
| | | <!-- <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/check/firstCheck" navigateTo>
|
| | | <view class="cuIcon-apps text-blue"></view>
|
| | | <text>{{$t('index.checkOrder')}}</text>
|
| | | </navigator>
|
| | | </view> -->
|
| | | </view>
|
| | | |
| | | |
| | | <!-- <view class="cu-bar bg-white solid-bottom margin-top-sm">
|
| | | <view class="action">
|
| | | <text class="cuIcon-title text-orange "></text> AGV
|
| | | </view>
|
| | | </view>
|
| | | |
| | | <view class="cu-list grid col-4 no-border">
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/AGV/AGVStaBind" navigateTo>
|
| | | <view class="cuIcon-punch text-blue">
|
| | | </view>
|
| | | <text>{{$t('index.stationBinding')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/AGV/StartInTask" navigateTo>
|
| | | <view class="cuIcon-punch text-blue">
|
| | | </view>
|
| | | <text>{{$t('index.inboundInitiation')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/AGV/StaUnBind" navigateTo>
|
| | | <view class="cuIcon-punch text-blue">
|
| | | </view>
|
| | | <text>{{$t('index.stationUnbinding')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/AGV/BindAndInTask" navigateTo>
|
| | | <view class="cuIcon-punch text-blue">
|
| | | </view>
|
| | | <text>{{$t('index.bindAndInbound')}}</text>
|
| | | </navigator>
|
| | | </view> |
| | | </view> -->
|
| | |
|
| | |
|
| | | <!-- <view class="cu-bar bg-white solid-bottom margin-top-sm">
|
| | | <view class="action">
|
| | | <text class="cuIcon-title text-orange "></text> 开发
|
| | | </view>
|
| | | </view>
|
| | | |
| | | <view class="cu-list grid col-4 no-border">
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/phyz/stationManage/stationManage" navigateTo>
|
| | | <view class="cuIcon-punch text-blue">
|
| | | </view>
|
| | | <text>{{$t('index.stationBinding')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/home/orderManage" navigateTo>
|
| | | <view class="cuIcon-punch text-blue">
|
| | | </view>
|
| | | <text>{{$t('index.stationBinding')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/home/locMastManage" navigateTo>
|
| | | <view class="cuIcon-punch text-blue">
|
| | | </view>
|
| | | <text>{{$t('index.stationBinding')}}</text>
|
| | | </navigator>
|
| | | </view>
|
| | | <view class="cu-item">
|
| | | <navigator hover-class='none' url="/pages/home/wrkMastManage" navigateTo>
|
| | | <view class="cuIcon-punch text-blue">
|
| | | </view>
|
| | | <text>{{$t('index.stationBinding')}}</text>
|
| | | </navigator>
|
| | | </view> -->
|
| | | </view>
|
| | | |
| | |
|
| | | <!-- <view class="padding flex flex-direction">
|
| | | <view class="cu-btn bg-red margin-tb-sm lg round" @click="equit">{{$t('index.outLogin')}}</view>
|
| | | </view> -->
|
| | | </view>
|
| | | </view>
|
| | | </template>
|
| | |
|
| | | <script>
|
| | | import {
|
| | | request
|
| | | } from '../../common/request2.js'
|
| | | |
| | | export default {
|
| | | data() {
|
| | | return {
|
| | | user:{ |
| | | }
|
| | | user: {},
|
| | | menuTree: [], // 完整菜单树
|
| | | permissionIds: new Set(), // 用户权限ID集合
|
| | | filteredMenus: [], // 按分类组织的过滤后菜单
|
| | | loading: true // 加载状态
|
| | | }
|
| | | },
|
| | | onShow() {
|
| | | this.user = uni.getStorageSync('userData'); |
| | | this.user = uni.getStorageSync('userData');
|
| | | this.loadMenusAndPermissions();
|
| | | },
|
| | | methods: {
|
| | | // 并行获取菜单和权限数据
|
| | | async loadMenusAndPermissions() {
|
| | | this.loading = true;
|
| | | try {
|
| | | const [menuRes, permRes] = await Promise.all([
|
| | | this.fetchMenuTree(),
|
| | | this.fetchPermissions()
|
| | | ]);
|
| | | this.menuTree = menuRes;
|
| | | this.permissionIds = new Set(permRes);
|
| | | this.filterMenus();
|
| | | } catch (e) {
|
| | | console.error('加载菜单权限失败:', e);
|
| | | uni.showToast({
|
| | | title: '加载菜单失败',
|
| | | icon: 'none'
|
| | | });
|
| | | } finally {
|
| | | this.loading = false;
|
| | | }
|
| | | },
|
| | | |
| | | // 获取菜单树
|
| | | async fetchMenuTree() {
|
| | | const { code, data, msg } = await request('/menuPda/tree', {});
|
| | | if (code === 200) {
|
| | | return data || [];
|
| | | } else if (code === 403) {
|
| | | uni.showToast({
|
| | | title: msg,
|
| | | icon: 'none'
|
| | | });
|
| | | setTimeout(() => {
|
| | | uni.reLaunch({
|
| | | url: '/pages/login/index'
|
| | | });
|
| | | }, 1000);
|
| | | throw new Error(msg);
|
| | | } else {
|
| | | throw new Error(msg || '获取菜单失败');
|
| | | }
|
| | | },
|
| | | |
| | | // 获取权限(支持多角色)
|
| | | async fetchPermissions() { |
| | | const roleIds = this.user.userRoleIds || [];
|
| | | console.log('roleIds:', roleIds);
|
| | | if (roleIds.length === 0) {
|
| | | console.warn('用户没有角色ID');
|
| | | return [];
|
| | | }
|
| | | const allIds = [];
|
| | | for (const roleId of roleIds) {
|
| | | console.log('请求角色权限, roleId:', roleId);
|
| | | const ids = await this.fetchRolePermission(roleId);
|
| | | console.log('角色权限结果:', ids);
|
| | | allIds.push(...ids);
|
| | | }
|
| | | return [...new Set(allIds)]; // 去重合并
|
| | | },
|
| | | |
| | | // 获取单个角色的权限
|
| | | async fetchRolePermission(roleId) {
|
| | | try {
|
| | | const { code, data } = await request('/rolePda/scope/list', { roleId: roleId },'GET');
|
| | | if (code === 200) {
|
| | | return data || [];
|
| | | }
|
| | | return [];
|
| | | } catch (e) {
|
| | | return [];
|
| | | }
|
| | | },
|
| | | |
| | | // 过滤菜单并按分类组织
|
| | | filterMenus() {
|
| | | this.filteredMenus = [];
|
| | | for (const category of this.menuTree) {
|
| | | if (category.type === 1) continue; // 跳过按钮
|
| | | |
| | | const menus = this.filterChildren(category.children || []);
|
| | | // 只有当分类有可见子菜单时才显示该分类
|
| | | if (menus.length > 0) {
|
| | | this.filteredMenus.push({
|
| | | id: category.id,
|
| | | name: category.name,
|
| | | menus: menus
|
| | | });
|
| | | }
|
| | | }
|
| | | },
|
| | | |
| | | // 过滤子菜单
|
| | | filterChildren(children) {
|
| | | return children.filter(item => {
|
| | | if (item.type === 1) return false; // 过滤按钮
|
| | | return this.permissionIds.has(item.id);
|
| | | }).map(item => ({
|
| | | id: item.id,
|
| | | name: item.name,
|
| | | route: '/pages' + item.route,
|
| | | icon: item.component || 'apps', // 默认图标
|
| | | buttons: this.getButtons(item.children || [])
|
| | | }));
|
| | | },
|
| | | |
| | | // 获取按钮权限
|
| | | getButtons(children) {
|
| | | return children.filter(item => item.type === 1 && this.permissionIds.has(item.id))
|
| | | .map(btn => ({
|
| | | id: btn.id,
|
| | | name: btn.name,
|
| | | route: btn.route
|
| | | }));
|
| | | },
|
| | | |
| | | // 检查权限(供其他地方使用)
|
| | | hasPermission(id) {
|
| | | return this.permissionIds.has(id);
|
| | | },
|
| | | |
| | | // 跳转页面并传递按钮权限
|
| | | goToPage(menu) {
|
| | | // 将按钮权限存入 storage,以 route 为 key
|
| | | const buttonRoutes = (menu.buttons || []).map(btn => btn.route);
|
| | | uni.setStorageSync('buttonPermissions', buttonRoutes);
|
| | | console.log('按钮权限:', buttonRoutes);
|
| | | |
| | | // 跳转页面
|
| | | uni.navigateTo({
|
| | | url: menu.route
|
| | | });
|
| | | },
|
| | | |
| | | // 退出登录
|
| | | equit() {
|
| | | uni.showToast({
|
| | | title: '注销成功',
|
| | |
| | | </script>
|
| | |
|
| | | <style>
|
| | | /* .container {
|
| | | background-color: #fff;
|
| | | } */
|
| | |
|
| | | .user-bg {
|
| | | display: flex;
|
| | | flex-direction: row;
|
| | |
| | | height: 160rpx;
|
| | | border-radius: 50%;
|
| | | }
|
| | | .loading-container {
|
| | | display: flex;
|
| | | justify-content: center;
|
| | | align-items: center;
|
| | | padding: 40rpx;
|
| | | color: #999;
|
| | | }
|
| | | .no-permission {
|
| | | display: flex;
|
| | | justify-content: center;
|
| | | align-items: center;
|
| | | padding: 80rpx;
|
| | | color: #999;
|
| | | }
|
| | | </style> |