From 9adc3c142e94bca536b481c8f0a568a047555de3 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期三, 07 一月 2026 15:46:10 +0800
Subject: [PATCH] #
---
pages/listing/matnrPalletising.vue | 17
.idea/pda-master.iml | 9
locale/zh-Hans.json | 2
.idea/.gitignore | 10
pages/rece/other.vue | 16
.idea/misc.xml | 7
.idea/vcs.xml | 6
.idea/modules.xml | 8
pages/emptyTray/outBound.vue | 411 ++++++++++++-----------
pages/home/index.vue | 451 ++++++++++++++------------
pages/AGV/StartInTask.vue | 14
pages/listing/labour.vue | 15
pages/listing/unPakin.vue | 15
13 files changed, 553 insertions(+), 428 deletions(-)
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..ab1f416
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,10 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Ignored default folder with query files
+/queries/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..1655cc7
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="KubernetesApiProvider">{}</component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
+ <output url="file://$PROJECT_DIR$/out" />
+ </component>
+</project>
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..55c7ee0
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/.idea/pda-master.iml" filepath="$PROJECT_DIR$/.idea/pda-master.iml" />
+ </modules>
+ </component>
+</project>
\ No newline at end of file
diff --git a/.idea/pda-master.iml b/.idea/pda-master.iml
new file mode 100644
index 0000000..d6ebd48
--- /dev/null
+++ b/.idea/pda-master.iml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$" />
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="Git" />
+ </component>
+</project>
\ No newline at end of file
diff --git a/locale/zh-Hans.json b/locale/zh-Hans.json
index fd0a7e1..014c6a6 100644
--- a/locale/zh-Hans.json
+++ b/locale/zh-Hans.json
@@ -19,6 +19,8 @@
"remPwd":"璁颁綇瀵嗙爜"
},
"index":{
+ "in": "鍏ュ簱",
+ "out": "鍑哄簱",
"GR": "鍗曟嵁鏀惰揣",
"palletizing": "鍗曟嵁缁勬墭",
"palletBuilding":"缁勬墭瑙g粦",
diff --git a/pages/AGV/StartInTask.vue b/pages/AGV/StartInTask.vue
index f59316a..ebef7c2 100644
--- a/pages/AGV/StartInTask.vue
+++ b/pages/AGV/StartInTask.vue
@@ -72,8 +72,8 @@
<view class="cu-bar btn-group foot">
- <button class="cu-btn text-blue line-blue shadow" @click="clear">娓呯┖</button>
- <button class="cu-btn bg-blue shadow-blur" :disabled="repeatClick" @click="confirm">鍏ュ簱</button>
+ <button v-if="hasButtonPermission('reset')" class="cu-btn text-blue line-blue shadow" @click="clear">娓呯┖</button>
+ <button v-if="hasButtonPermission('submit')" class="cu-btn bg-blue shadow-blur" :disabled="repeatClick" @click="confirm">鍏ュ簱</button>
</view>
@@ -103,6 +103,7 @@
curCode: '',
whAreaId:'',
repeatClick: false,
+ buttonPermissions: [] // 鎸夐挳鏉冮檺鍒楄〃
}
},
@@ -112,8 +113,15 @@
mounted() {
this.getRece()
this.whAreaId = uni.getStorageSync('whAreaId')
+
+ // 鑾峰彇鎸夐挳鏉冮檺
+ this.buttonPermissions = uni.getStorageSync('buttonPermissions') || [];
+ console.log('褰撳墠椤甸潰鎸夐挳鏉冮檺:', this.buttonPermissions);
},
- methods: {
+ methods: {
+ hasButtonPermission(route) {
+ return this.buttonPermissions.includes(route);
+ },
selChange(val) {
uni.setStorageSync('whAreaId', val)
},
diff --git a/pages/emptyTray/outBound.vue b/pages/emptyTray/outBound.vue
index a0ef4e2..e76d533 100644
--- a/pages/emptyTray/outBound.vue
+++ b/pages/emptyTray/outBound.vue
@@ -3,233 +3,240 @@
<form>
<view class="cu-form-group margin-top">
<view class="title">鎺ラ┏绔欑偣</view>
- <input placeholder=" 璇锋壂鎻忔帴椹崇珯鐐规潯鐮�" v-model="barcode" ></input>
- </view>
-
+ <input
+ placeholder=" 璇锋壂鎻忔帴椹崇珯鐐规潯鐮�"
+ v-model="barcode"
+ />
+ </view>
+
<view class="cu-form-group margin-bottom">
<view class="title">瀹瑰櫒绫诲瀷</view>
- <view style="width: 78%;">
- <uni-data-select style="min-width: 80%; max-width: 80%;" v-model="palletTypeId" :localdata="range"
- placement="bottom" @change="selChange"></uni-data-select>
+ <view style="width: 78%">
+ <uni-data-select
+ style="min-width: 80%; max-width: 80%"
+ v-model="palletTypeId"
+ :localdata="range"
+ placement="bottom"
+ @change="selChange"
+ ></uni-data-select>
</view>
</view>
</form>
-
<view class="cu-bar btn-group foot">
- <button class="cu-btn text-blue line-blue shadow" @click="clear">娓呯┖</button>
- <button class="cu-btn bg-blue shadow-blur" @click="confirm">鍛煎彨</button>
- </view>
-
+ <button
+ class="cu-btn text-blue line-blue shadow"
+ @click="clear"
+ >
+ 娓呯┖
+ </button>
+ <button
+ class="cu-btn bg-blue shadow-blur"
+ @click="confirm"
+ >
+ 鍛煎彨
+ </button>
+ </view>
</view>
</template>
<script>
- import {
- request
- } from '../../common/request.js'
- import {
- mapState,
- mapMutations,
- mapActions,
- mapGetters
- } from 'vuex';
- export default {
- data() {
- return {
- barcode: '',
- areaName: '',
- locCode: '',
- container: '',
- list: [],
- range: [],
- curCode: ''
+import { request } from '../../common/request.js'
+import { mapState, mapMutations, mapActions, mapGetters } from 'vuex'
+export default {
+ data() {
+ return {
+ barcode: '',
+ areaName: '',
+ locCode: '',
+ container: '',
+ list: [],
+ range: [],
+ curCode: '',
+ palletTypeId: ''
+ }
+ },
+ computed: {
+ ...mapState('user', ['dynamicFields'])
+ },
+ mounted() {
+ this.getPalletType(),
+ (this.palletTypeId = uni.getStorageSync('palletTypeId'))
+ },
+ methods: {
+ selChange(val) {
+ uni.setStorageSync('palletTypeId', val.value)
+ },
+ // async search() {
+ // const {
+ // code,
+ // data,
+ // msg
+ // } = await request('/stock/operate/list', {
+ // barcode: this.container,
+ // sta: this.barcode
+ // })
+ // if (code === 200) {
+ // // const find = this.list.find(el => el.id === data.id);
+ // // !find &&
+ // this.list = data
+ // } else {
+ // uni.showToast({
+ // title: msg,
+ // icon: "none",
+ // })
+ // }
+ // },
+
+ remove(index) {
+ this.list.splice(index, 1)
+ },
+ clear() {
+ this.list = []
+ this.palletTypeId = ''
+ this.container = ''
+ this.barcode = ''
+ },
+
+ open() {
+ this.$refs.popup.open()
+ },
+
+ close() {
+ this.$refs.popup.close()
+ },
+
+ popupSubmit() {
+ this.$refs.popup.close()
+ },
+ itemChange(el) {
+ this.curCode = el
+ },
+
+ async getPalletType() {
+ const { code, data, msg } = await request(
+ '/info/palletType/list',
+ {},
+ 'get'
+ )
+ if (code === 200) {
+ this.range = data.map((item) => ({
+ value: item.id,
+ text:
+ item.group === null
+ ? item.label
+ : item.group + '-- ' + item.label
+ }))
}
},
- computed: {
- ...mapState('user', ['dynamicFields']),
- },
- mounted() {
- this.getPalletType(),
- this.palletTypeId = uni.getStorageSync('palletTypeId')
- },
- methods: {
- selChange(val) {
- uni.setStorageSync('palletTypeId', val.value)
- },
- // async search() {
- // const {
- // code,
- // data,
- // msg
- // } = await request('/stock/operate/list', {
+
+ async confirm() {
+ if (this.barcode === '' || this.barcode === null) {
+ uni.showToast({
+ title: '鎺ラ┏绔欑偣涓嶈兘涓虹┖',
+ icon: 'none'
+ })
+ return
+ }
+ if (this.palletTypeId === '' || this.palletTypeId === null) {
+ uni.showToast({
+ title: '璇烽�夋嫨鎵樼洏绫诲瀷',
+ icon: 'none'
+ })
+ return
+ } else {
+ const { code, data, msg } = await request('/orders/confirm', {
+ receipts: newArr,
+ palletTypeId: this.palletTypeId
+ })
+ if (code === 200) {
+ uni.showToast({
+ title: '鍛煎彨绌烘墭鐩樹腑锛岃绋嶄綔绛夊緟'
+ })
+ this.list = []
+ this.barcode = ''
+ this.isconfirm = false
+ } else {
+ uni.showToast({
+ title: msg,
+ icon: 'none',
+ position: 'top'
+ })
+ }
+ }
+
+ // const {
+ // code,
+ // data,
+ // msg
+ // } = await request('/AGV/staBind',{
// barcode: this.container,
// sta: this.barcode
- // })
- // if (code === 200) {
- // // const find = this.list.find(el => el.id === data.id);
- // // !find &&
- // this.list = data
- // } else {
- // uni.showToast({
- // title: msg,
- // icon: "none",
- // })
// }
- // },
-
- remove(index) {
- this.list.splice(index, 1);
- },
- clear() {
- this.list = []
- this.palletTypeId = ''
- this.container = ''
- this.barcode = ''
- },
-
- open() {
- this.$refs.popup.open()
- },
-
- close() {
- this.$refs.popup.close()
- },
-
- popupSubmit() {
- this.$refs.popup.close()
- },
- itemChange(el) {
- this.curCode = el
- },
-
- async getPalletType() {
- const {
- code,
- data,
- msg
- } = await request('/info/palletType/list', {}, 'get')
- if (code === 200) {
- this.range = data.map(item => ({
- value: item.id,
- text: item.group === null ? item.label : item.group + "-- " + item.label
- }));
- }
- },
-
- async confirm() {
- if(this.barcode === '' || this.barcode === null){
- uni.showToast({
- title: "鎺ラ┏绔欑偣涓嶈兘涓虹┖",
- icon: "none",
- })
- return ;
- }
- if(this.palletTypeId === '' || this.palletTypeId === null){
- uni.showToast({
- title: "璇烽�夋嫨鎵樼洏绫诲瀷",
- icon: "none",
- })
- return ;
- } else {
- const {
- code,
- data,
- msg
- } = await request('/orders/confirm', {
- receipts: newArr,
- palletTypeId: this.palletTypeId
- })
- if (code === 200) {
- uni.showToast({
- title: '鍛煎彨绌烘墭鐩樹腑锛岃绋嶄綔绛夊緟'
- })
- this.list = []
- this.barcode = ''
- this.isconfirm = false
- } else {
- uni.showToast({
- title: msg,
- icon: "none",
- position: 'top'
- })
- }
- }
-
- // const {
- // code,
- // data,
- // msg
- // } = await request('/AGV/staBind',{
- // barcode: this.container,
- // sta: this.barcode
- // }
- // )
- // if (code === 200) {
- // uni.showToast({
- // title: '缁戝畾鎴愬姛'
- // })
- // this.clear()
- // } else {
- // uni.showToast({
- // title: msg,
- // icon: "none",
- // })
- // }
- },
-
+ // )
+ // if (code === 200) {
+ // uni.showToast({
+ // title: '缁戝畾鎴愬姛'
+ // })
+ // this.clear()
+ // } else {
+ // uni.showToast({
+ // title: msg,
+ // icon: "none",
+ // })
+ // }
}
}
+}
</script>
<style>
- .index {
- border: 1px solid #e54d42;
- color: #e54d42;
- border-radius: 50%;
- display: block;
- width: 50rpx;
- height: 50rpx;
- line-height: 48rpx;
- text-align: center;
- margin-right: 20rpx;
- font-size: 30rpx;
- }
+.index {
+ border: 1px solid #e54d42;
+ color: #e54d42;
+ border-radius: 50%;
+ display: block;
+ width: 50rpx;
+ height: 50rpx;
+ line-height: 48rpx;
+ text-align: center;
+ margin-right: 20rpx;
+ font-size: 30rpx;
+}
- .text-blue {
- color: #0081ff !important;
+.text-blue {
+ color: #0081ff !important;
+}
- }
+.item {
+ position: relative;
+ display: flex;
+ min-height: 80upx;
+ align-items: center;
+}
- .item {
- position: relative;
- display: flex;
- min-height: 80upx;
- align-items: center;
- }
+.uni-file-picker {
+ width: 100%;
+ margin-bottom: 10px;
+}
- .uni-file-picker {
- width: 100%;
- margin-bottom: 10px;
- }
+.uni-select__selector {
+ z-index: 999;
+}
- .uni-select__selector {
- z-index: 999;
- }
+.tj {
+ height: auto;
+ padding: 6px 8px;
+ display: inline-block;
+ border-radius: 6px;
+}
- .tj {
- height: auto;
- padding: 6px 8px;
- display: inline-block;
- border-radius: 6px;
- }
+.item {
+ display: flex;
+ justify-content: center;
+}
- .item {
- display: flex;
- justify-content: center;
- }
-
- .item .cu-btn {
- font-size: 26upx;
- }
-</style>
\ No newline at end of file
+.item .cu-btn {
+ font-size: 26upx;
+}
+</style>
diff --git a/pages/home/index.vue b/pages/home/index.vue
index ce43617..8102513 100644
--- a/pages/home/index.vue
+++ b/pages/home/index.vue
@@ -1,253 +1,286 @@
<template>
<view class="container">
<view class="user-bg">
- <image src="../../static/img/toux.png" class="tx" mode="widthFix"></image>
+ <image
+ src="../../static/img/toux.png"
+ class="tx"
+ mode="widthFix"
+ ></image>
<view class="text-xl margin-top-sm margin-left-lg">
<view class="text-blue text-bold text-xl">
- {{user.username}}
+ {{ user.username }}
</view>
- <view class="text-gray text-l">{{user.code}}</view>
+ <view class="text-gray text-l">{{ user.code }}</view>
</view>
- <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
+ 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 v-if="loading" class="loading-container">
+ <view
+ v-if="loading"
+ class="loading-container"
+ >
<text>鍔犺浇涓�...</text>
</view>
-
+
<!-- 鍔ㄦ�佽彍鍗曞尯鍩� -->
- <block v-for="category in filteredMenus" :key="category.id">
+ <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}}
+ <text class="cuIcon-title text-orange"></text>
+ {{ $t(category.component) }}
</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="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>
+ <text>{{ $t(menu.component) }}</text>
</view>
</view>
</block>
-
+
<!-- 鏃犺彍鍗曟潈闄愭椂鏄剧ず鎻愮ず -->
- <view v-if="!loading && filteredMenus.length === 0" class="no-permission">
+ <view
+ v-if="!loading && filteredMenus.length === 0"
+ class="no-permission"
+ >
<text>鏆傛棤鍙敤鑿滃崟</text>
</view>
</view>
</template>
<script>
- import {
- request
- } from '../../common/request2.js'
-
- export default {
- data() {
- return {
- user: {},
- menuTree: [], // 瀹屾暣鑿滃崟鏍�
- permissionIds: new Set(), // 鐢ㄦ埛鏉冮檺ID闆嗗悎
- filteredMenus: [], // 鎸夊垎绫荤粍缁囩殑杩囨护鍚庤彍鍗�
- loading: true // 鍔犺浇鐘舵��
+import { request } from '../../common/request2.js'
+
+export default {
+ data() {
+ return {
+ user: {},
+ menuTree: [], // 瀹屾暣鑿滃崟鏍�
+ permissionIds: new Set(), // 鐢ㄦ埛鏉冮檺ID闆嗗悎
+ filteredMenus: [], // 鎸夊垎绫荤粍缁囩殑杩囨护鍚庤彍鍗�
+ loading: true // 鍔犺浇鐘舵��
+ }
+ },
+ onShow() {
+ 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
}
},
- onShow() {
- this.user = uni.getStorageSync('userData');
- this.loadMenusAndPermissions();
+
+ // 鑾峰彇鑿滃崟鏍�
+ 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 || '鑾峰彇鑿滃崟澶辫触')
+ }
},
- 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', {});
+
+ // 鑾峰彇鏉冮檺锛堟敮鎸佸瑙掕壊锛�
+ async fetchPermissions() {
+ console.log('this.user:', this.user)
+ const roleIds = this.user.userRoleIds || []
+ console.log('roleIds:', roleIds)
+ if (roleIds.length === 0) {
+ console.warn('鐢ㄦ埛娌℃湁瑙掕壊ID')
+ return []
+ }
+ const allIds = []
+ for (const roleId of roleIds) {
+ const ids = await this.fetchRolePermission(roleId)
+ 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 || [];
- } 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 || '鑾峰彇鑿滃崟澶辫触');
+ return data || []
}
- },
-
- // 鑾峰彇鏉冮檺锛堟敮鎸佸瑙掕壊锛�
- async fetchPermissions() {
- const roleIds = this.user.userRoleIds || [];
- console.log('roleIds:', roleIds);
- if (roleIds.length === 0) {
- console.warn('鐢ㄦ埛娌℃湁瑙掕壊ID');
- return [];
+ 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,
+ component: category.component, // 鍥介檯鍖杒ey
+ menus: menus
+ })
}
- 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 => ({
+ }
+ },
+
+ // 杩囨护瀛愯彍鍗�
+ 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', // 榛樿鍥炬爣
+ icon: item.icon || 'apps', // 榛樿鍥炬爣
+ component: item.component, // 鍥介檯鍖杒ey
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: '娉ㄩ攢鎴愬姛',
- duration: 1000
+ }))
+ },
+
+ // 鑾峰彇鎸夐挳鏉冮檺
+ 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: '娉ㄩ攢鎴愬姛',
+ duration: 1000
+ })
+ setTimeout(() => {
+ uni.removeStorageSync('token')
+ uni.reLaunch({
+ url: '/pages/login/index'
})
- setTimeout(() => {
- uni.removeStorageSync('token');
- uni.reLaunch({
- url: "/pages/login/index"
- });
- }, 1000);
- }
+ }, 1000)
}
}
+}
</script>
<style>
- .user-bg {
- display: flex;
- flex-direction: row;
- background-size: cover;
- height: 150rpx;
- position: relative;
- color: #000;
- align-items: center;
- justify-content: start;
- padding: 0 40rpx;
- background-color: #fff;
- }
- .tx {
- width: 100rpx;
- border-radius: 50%;
- border: 1px solid #e9e9e9;
- }
- .left {
- display: flex;
- flex-direction: column;
- }
- .avatar {
- width: 160rpx;
- 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>
\ No newline at end of file
+.user-bg {
+ display: flex;
+ flex-direction: row;
+ background-size: cover;
+ height: 150rpx;
+ position: relative;
+ color: #000;
+ align-items: center;
+ justify-content: start;
+ padding: 0 40rpx;
+ background-color: #fff;
+}
+.tx {
+ width: 100rpx;
+ border-radius: 50%;
+ border: 1px solid #e9e9e9;
+}
+.left {
+ display: flex;
+ flex-direction: column;
+}
+.avatar {
+ width: 160rpx;
+ 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>
diff --git a/pages/listing/labour.vue b/pages/listing/labour.vue
index b9a05a4..5cf8a03 100644
--- a/pages/listing/labour.vue
+++ b/pages/listing/labour.vue
@@ -62,8 +62,8 @@
<view class="cu-bar btn-group foot">
- <button class="cu-btn text-blue line-blue shadow" @click="clear">娓呯┖</button>
- <button class="cu-btn bg-blue shadow-blur" @click="confirm">涓婃灦</button>
+ <button v-if="hasButtonPermission('reset')" class="cu-btn text-blue line-blue shadow" @click="clear">娓呯┖</button>
+ <button v-if="hasButtonPermission('submit')" class="cu-btn bg-blue shadow-blur" @click="confirm">涓婃灦</button>
</view>
</view>
</template>
@@ -86,13 +86,22 @@
locCode: '',
container: '',
list: [],
+ buttonPermissions: [] // 鎸夐挳鏉冮檺鍒楄〃
}
},
computed: {
...mapState('user', ['dynamicFields']),
},
- mounted() {},
+ mounted() {
+ // 鑾峰彇鎸夐挳鏉冮檺
+ this.buttonPermissions = uni.getStorageSync('buttonPermissions') || [];
+ console.log('褰撳墠椤甸潰鎸夐挳鏉冮檺:', this.buttonPermissions);
+ },
methods: {
+ // 妫�鏌ユ寜閽潈闄�
+ hasButtonPermission(route) {
+ return this.buttonPermissions.includes(route);
+ },
async search() {
const {
code,
diff --git a/pages/listing/matnrPalletising.vue b/pages/listing/matnrPalletising.vue
index e4d4f34..90d8f1e 100644
--- a/pages/listing/matnrPalletising.vue
+++ b/pages/listing/matnrPalletising.vue
@@ -115,8 +115,8 @@
</block>
</view>
<view class="cu-bar btn-group foot">
- <button class="cu-btn text-blue line-blue shadow" @click="clear">娓呯┖</button>
- <button class="cu-btn bg-blue shadow-blur" :disabled="repeatClick" @click="confirm">缁勬墭</button>
+ <button v-if="hasButtonPermission('reset')" class="cu-btn text-blue line-blue shadow" @click="clear">娓呯┖</button>
+ <button v-if="hasButtonPermission('submit')" class="cu-btn bg-blue shadow-blur" :disabled="repeatClick" @click="confirm">缁勬墭</button>
</view>
</view>
</template>
@@ -144,6 +144,7 @@
isconfirm: false,
matnrCode:'',
max: 99999999,
+ buttonPermissions: [] // 鎸夐挳鏉冮檺鍒楄〃
}
},
computed: {
@@ -152,8 +153,16 @@
return this.list.reduce((acc, row) => +row.anfme + acc, 0) || 0
}
},
- mounted() {},
- methods: {
+ mounted() {
+ // 鑾峰彇鎸夐挳鏉冮檺
+ this.buttonPermissions = uni.getStorageSync('buttonPermissions') || [];
+ console.log('褰撳墠椤甸潰鎸夐挳鏉冮檺:', this.buttonPermissions);
+ },
+ methods: {
+ // 妫�鏌ユ寜閽潈闄�
+ hasButtonPermission(route) {
+ return this.buttonPermissions.includes(route);
+ },
async search() {
const find = this.list.find(el => el.trackCode === this.barcode);
find ? this.scrollTo() : this.getDet();
diff --git a/pages/listing/unPakin.vue b/pages/listing/unPakin.vue
index 77cf212..7c7655f 100644
--- a/pages/listing/unPakin.vue
+++ b/pages/listing/unPakin.vue
@@ -99,8 +99,8 @@
</block>
</view>
<view class="cu-bar btn-group foot">
- <button class="cu-btn text-blue line-blue shadow" @click="clear">娓呯┖</button>
- <button class="cu-btn bg-blue shadow-blur" :disabled="repeatClick" @click="confirm">瑙g粦</button>
+ <button v-if="hasButtonPermission('reset')" class="cu-btn text-blue line-blue shadow" @click="clear">娓呯┖</button>
+ <button v-if="hasButtonPermission('submit')" class="cu-btn bg-blue shadow-blur" :disabled="repeatClick" @click="confirm">瑙g粦</button>
</view>
</view>
</template>
@@ -129,6 +129,7 @@
matnrCode: '',
max: 99999999,
pkCode: '',
+ buttonPermissions: [] // 鎸夐挳鏉冮檺鍒楄〃
}
},
computed: {
@@ -137,8 +138,16 @@
return this.list.reduce((acc, row) => +row.anfme + acc, 0) || 0
}
},
- mounted() {},
+ mounted() {
+ // 鑾峰彇鎸夐挳鏉冮檺
+ this.buttonPermissions = uni.getStorageSync('buttonPermissions') || [];
+ console.log('褰撳墠椤甸潰鎸夐挳鏉冮檺:', this.buttonPermissions);
+ },
methods: {
+ // 妫�鏌ユ寜閽潈闄�
+ hasButtonPermission(route) {
+ return this.buttonPermissions.includes(route);
+ },
async search() {
const find = this.list.find(el => el.trackCode === this.barcode);
find ? this.scrollTo() : this.getDet();
diff --git a/pages/rece/other.vue b/pages/rece/other.vue
index 0d7bdd3..a8234ca 100644
--- a/pages/rece/other.vue
+++ b/pages/rece/other.vue
@@ -161,13 +161,13 @@
</view>
<view class="cu-bar btn-group foot" v-show="!isconfirm">
- <button class="cu-btn text-blue line-blue shadow" @click="clear">娓呯┖</button>
- <button class="cu-btn bg-blue shadow-blur" @click="next">涓嬩竴姝�</button>
+ <button v-if="hasButtonPermission('reset')" class="cu-btn text-blue line-blue shadow" @click="clear">娓呯┖</button>
+ <button v-if="hasButtonPermission('submit')" class="cu-btn bg-blue shadow-blur" @click="next">涓嬩竴姝�</button>
</view>
<view class="cu-bar btn-group foot" v-show="isconfirm">
- <button class="cu-btn text-blue line-blue shadow" @click="prev">涓婁竴姝�</button>
- <button class="cu-btn bg-blue shadow-blur" :disabled="repeatClick" @click="confirm(false)">鏀惰揣</button>
+ <button v-if="hasButtonPermission('reset')" class="cu-btn text-blue line-blue shadow" @click="prev">涓婁竴姝�</button>
+ <button v-if="hasButtonPermission('submit')" class="cu-btn bg-blue shadow-blur" :disabled="repeatClick" @click="confirm(false)">鏀惰揣</button>
</view>
</view>
@@ -194,6 +194,7 @@
repeatClick: false,
isconfirm: false,
max: 99999999,
+ buttonPermissions: [] // 鎸夐挳鏉冮檺鍒楄〃
}
},
computed: {
@@ -209,8 +210,15 @@
mounted() {
this.getRece()
this.whAreaId = uni.getStorageSync('whAreaId')
+ // 鑾峰彇鎸夐挳鏉冮檺
+ this.buttonPermissions = uni.getStorageSync('buttonPermissions') || [];
+ console.log('褰撳墠椤甸潰鎸夐挳鏉冮檺:', this.buttonPermissions);
},
methods: {
+ // 妫�鏌ユ寜閽潈闄�
+ hasButtonPermission(route) {
+ return this.buttonPermissions.includes(route);
+ },
async search() {
const {
code,
--
Gitblit v1.9.1