| New file |
| | |
| | | # 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/ |
| New file |
| | |
| | | <?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> |
| New file |
| | |
| | | <?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> |
| New file |
| | |
| | | <?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> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="VcsDirectoryMappings"> |
| | | <mapping directory="" vcs="Git" /> |
| | | </component> |
| | | </project> |
| | |
| | | "remPwd":"记住密码" |
| | | }, |
| | | "index":{ |
| | | "in": "入库", |
| | | "out": "出库", |
| | | "GR": "单据收货", |
| | | "palletizing": "单据组托", |
| | | "palletBuilding":"组托解绑", |
| | |
| | | |
| | | |
| | | <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> |
| | | |
| | | |
| | |
| | | curCode: '', |
| | | whAreaId:'', |
| | | repeatClick: false, |
| | | buttonPermissions: [] // 按钮权限列表 |
| | | |
| | | } |
| | | }, |
| | |
| | | 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) |
| | | }, |
| | |
| | | <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> |
| | | .item .cu-btn { |
| | | font-size: 26upx; |
| | | } |
| | | </style> |
| | |
| | | <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, // 国际化key
|
| | | 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, // 国际化key
|
| | | 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> |
| | | .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>
|
| | |
| | |
|
| | |
|
| | | <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>
|
| | |
| | | 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,
|
| | |
| | | </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> |
| | |
| | | isconfirm: false, |
| | | matnrCode:'', |
| | | max: 99999999, |
| | | buttonPermissions: [] // 按钮权限列表 |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | 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(); |
| | |
| | | </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>
|
| | |
| | | matnrCode: '',
|
| | | max: 99999999,
|
| | | pkCode: '',
|
| | | buttonPermissions: [] // 按钮权限列表
|
| | | }
|
| | | },
|
| | | computed: {
|
| | |
| | | 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();
|
| | |
| | | </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>
|
| | |
| | | repeatClick: false,
|
| | | isconfirm: false,
|
| | | max: 99999999,
|
| | | buttonPermissions: [] // 按钮权限列表
|
| | | }
|
| | | },
|
| | | computed: {
|
| | |
| | | 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,
|