PDA增加权限

This commit is contained in:
hehaibing-1996
2025-03-04 14:54:24 +08:00
parent 72d98fdd1b
commit a9b1512f44
9 changed files with 176 additions and 65 deletions

View File

@ -115,6 +115,9 @@
saveConfig('userName', this.userName);
saveConfig('passWord', this.passWord);
console.log(res.data.data.getRoles[0].authNames);
saveConfig('roleName', res.data.data.getRoles[0].authNames);
//重定向 直接就不能返回这个页面了
uni.redirectTo({
url: '/pages/main/main'

View File

@ -12,28 +12,28 @@
<view style="display: flex;flex-direction: row;margin-bottom: 10rpx;margin-top: 30rpx;">
<view style="flex: 1;"></view>
<view class="uni-flex uni-column" style="flex: 5;">
<navigator url="../bind/bind" hover-class="navigator-hover">
<view hover-class="navigator-hover" @click="handleNavigatorTap('物料绑定')">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/bind.png" />
</view>
<view class="function-text">物料绑定</view>
</navigator>
</view>
</view>
<view class="uni-flex uni-column" style="flex: 5;">
<navigator url="../queryBindList/queryBindList" hover-class="navigator-hover">
<view hover-class="navigator-hover" @click="handleNavigatorTap('绑定查询')">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/bindQuery.png" />
</view>
<view class="function-text">绑定查询</view>
</navigator>
</view>
</view>
<view class="uni-flex uni-column" style="flex: 5;">
<navigator url="../productionLineCallIn/productionLineCallIn" hover-class="navigator-hover">
<view hover-class="navigator-hover" @click="handleNavigatorTap('产线呼叫')">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/callIn.png" />
</view>
<view class="function-text">产线呼叫</view>
</navigator>
</view>
</view>
<view style="flex: 1;"></view>
</view>
@ -41,28 +41,28 @@
<view style="display: flex;flex-direction: row;margin-bottom: 10rpx;margin-top: 30rpx;">
<view style="flex: 1;"></view>
<view class="uni-flex uni-column" style="flex: 5;">
<navigator url="../productionLineCallOut/productionLineCallOut" hover-class="navigator-hover">
<view hover-class="navigator-hover" @click="handleNavigatorTap('货架送回')">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/callOut.png" />
</view>
<view class="function-text">货架送回</view>
</navigator>
</view>
</view>
<view class="uni-flex uni-column" style="flex: 5;">
<navigator url="../stockTaking/stockTaking" hover-class="navigator-hover">
<view hover-class="navigator-hover" @click="handleNavigatorTap('库存盘点')">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/stockTaking.png" />
</view>
<view class="function-text">库存盘点</view>
</navigator>
</view>
</view>
<view class="uni-flex uni-column" style="flex: 5;">
<navigator url="../agvTasks/agvTasks" hover-class="navigator-hover">
<view hover-class="navigator-hover" @click="handleNavigatorTap('任务管理')">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/task.png" />
</view>
<view class="function-text">任务管理</view>
</navigator>
</view>
</view>
<view style="flex: 1;"></view>
</view>
@ -70,12 +70,12 @@
<view style="display: flex;flex-direction: row;margin-bottom: 10rpx;margin-top: 30rpx;">
<view style="flex: 1;"></view>
<view class="uni-flex uni-column" style="flex: 5;">
<navigator url="../shelfLocationBindUnbind/shelfLocationBindUnbind" hover-class="navigator-hover">
<view hover-class="navigator-hover" @click="handleNavigatorTap('货架位置绑定解绑')">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/shelfLocation.png" />
</view>
<view class="function-text">货架位置绑定解绑</view>
</navigator>
</view>
</view>
<view class="uni-flex uni-column" style="flex: 5;">
@ -90,14 +90,67 @@
</template>
<script>
import {
getConfig
} from '@/config.js';
export default {
data() {
return {
hasPermission: true,
}
},
methods: {
handleNavigatorTap: function(pageName) {
var roleName = getConfig('roleName', '');
var requiredRole = 'PDA' + pageName;
console.log('roleName:', roleName);
console.log('requiredRole:', requiredRole);
// 检查用户角色是否包含所需的角色
this.hasPermission = roleName.includes(requiredRole);
let url = '';
switch (pageName) {
case '物料绑定':
url = '../bind/bind';
break;
case '绑定查询':
url = '../queryBindList/queryBindList';
break;
case '产线呼叫':
url = '../productionLineCallIn/productionLineCallIn';
break;
case '货架送回':
url = '../productionLineCallOut/productionLineCallOut';
break;
case '库存盘点':
url = '../stockTaking/stockTaking';
break;
case '任务管理':
url = '../agvTasks/agvTasks';
break;
case '货架位置绑定解绑':
url = '../shelfLocationBindUnbind/shelfLocationBindUnbind';
break;
default:
url = ''; // 默认情况,确保有一个有效的处理
}
if (this.hasPermission) {
// 用户有权限,允许跳转
wx.navigateTo({
url: url
});
} else {
// 用户没有权限,显示提示
wx.showToast({
title: '您没有权限进行此操作',
icon: 'none',
duration: 2000
});
}
},
}
}
</script>

View File

@ -207,6 +207,8 @@ if (uni.restoreGlobal) {
});
saveConfig("userName", this.userName);
saveConfig("passWord", this.passWord);
formatAppLog("log", "at pages/index/index.vue:118", res.data.data.getRoles[0].authNames);
saveConfig("roleName", res.data.data.getRoles[0].authNames);
uni.redirectTo({
url: "/pages/main/main"
});
@ -229,7 +231,7 @@ if (uni.restoreGlobal) {
});
},
complete: (event) => {
formatAppLog("log", "at pages/index/index.vue:144", "请求完成", event);
formatAppLog("log", "at pages/index/index.vue:147", "请求完成", event);
}
});
}
@ -392,9 +394,56 @@ if (uni.restoreGlobal) {
const _imports_7 = "/static/shelfLocation.png";
const _sfc_main$f = {
data() {
return {};
return {
hasPermission: true
};
},
methods: {}
methods: {
handleNavigatorTap: function(pageName) {
var roleName = getConfig("roleName", "");
var requiredRole = "PDA" + pageName;
formatAppLog("log", "at pages/main/main.vue:107", "roleName:", roleName);
formatAppLog("log", "at pages/main/main.vue:108", "requiredRole:", requiredRole);
this.hasPermission = roleName.includes(requiredRole);
let url = "";
switch (pageName) {
case "物料绑定":
url = "../bind/bind";
break;
case "绑定查询":
url = "../queryBindList/queryBindList";
break;
case "产线呼叫":
url = "../productionLineCallIn/productionLineCallIn";
break;
case "货架送回":
url = "../productionLineCallOut/productionLineCallOut";
break;
case "库存盘点":
url = "../stockTaking/stockTaking";
break;
case "任务管理":
url = "../agvTasks/agvTasks";
break;
case "货架位置绑定解绑":
url = "../shelfLocationBindUnbind/shelfLocationBindUnbind";
break;
default:
url = "";
}
if (this.hasPermission) {
wx.navigateTo({
url
});
} else {
wx.showToast({
title: "您没有权限进行此操作",
icon: "none",
duration: 2e3
});
}
}
}
};
function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", { class: "bg-image" }, [
@ -418,9 +467,9 @@ if (uni.restoreGlobal) {
class: "uni-flex uni-column",
style: { "flex": "5" }
}, [
vue.createElementVNode("navigator", {
url: "../bind/bind",
"hover-class": "navigator-hover"
vue.createElementVNode("view", {
"hover-class": "navigator-hover",
onClick: _cache[0] || (_cache[0] = ($event) => $options.handleNavigatorTap("物料绑定"))
}, [
vue.createElementVNode("view", {
class: "uni-flex uni-row",
@ -438,9 +487,9 @@ if (uni.restoreGlobal) {
class: "uni-flex uni-column",
style: { "flex": "5" }
}, [
vue.createElementVNode("navigator", {
url: "../queryBindList/queryBindList",
"hover-class": "navigator-hover"
vue.createElementVNode("view", {
"hover-class": "navigator-hover",
onClick: _cache[1] || (_cache[1] = ($event) => $options.handleNavigatorTap("绑定查询"))
}, [
vue.createElementVNode("view", {
class: "uni-flex uni-row",
@ -458,9 +507,9 @@ if (uni.restoreGlobal) {
class: "uni-flex uni-column",
style: { "flex": "5" }
}, [
vue.createElementVNode("navigator", {
url: "../productionLineCallIn/productionLineCallIn",
"hover-class": "navigator-hover"
vue.createElementVNode("view", {
"hover-class": "navigator-hover",
onClick: _cache[2] || (_cache[2] = ($event) => $options.handleNavigatorTap("产线呼叫"))
}, [
vue.createElementVNode("view", {
class: "uni-flex uni-row",
@ -482,9 +531,9 @@ if (uni.restoreGlobal) {
class: "uni-flex uni-column",
style: { "flex": "5" }
}, [
vue.createElementVNode("navigator", {
url: "../productionLineCallOut/productionLineCallOut",
"hover-class": "navigator-hover"
vue.createElementVNode("view", {
"hover-class": "navigator-hover",
onClick: _cache[3] || (_cache[3] = ($event) => $options.handleNavigatorTap("货架送回"))
}, [
vue.createElementVNode("view", {
class: "uni-flex uni-row",
@ -502,9 +551,9 @@ if (uni.restoreGlobal) {
class: "uni-flex uni-column",
style: { "flex": "5" }
}, [
vue.createElementVNode("navigator", {
url: "../stockTaking/stockTaking",
"hover-class": "navigator-hover"
vue.createElementVNode("view", {
"hover-class": "navigator-hover",
onClick: _cache[4] || (_cache[4] = ($event) => $options.handleNavigatorTap("库存盘点"))
}, [
vue.createElementVNode("view", {
class: "uni-flex uni-row",
@ -522,9 +571,9 @@ if (uni.restoreGlobal) {
class: "uni-flex uni-column",
style: { "flex": "5" }
}, [
vue.createElementVNode("navigator", {
url: "../agvTasks/agvTasks",
"hover-class": "navigator-hover"
vue.createElementVNode("view", {
"hover-class": "navigator-hover",
onClick: _cache[5] || (_cache[5] = ($event) => $options.handleNavigatorTap("任务管理"))
}, [
vue.createElementVNode("view", {
class: "uni-flex uni-row",
@ -546,9 +595,9 @@ if (uni.restoreGlobal) {
class: "uni-flex uni-column",
style: { "flex": "5" }
}, [
vue.createElementVNode("navigator", {
url: "../shelfLocationBindUnbind/shelfLocationBindUnbind",
"hover-class": "navigator-hover"
vue.createElementVNode("view", {
"hover-class": "navigator-hover",
onClick: _cache[6] || (_cache[6] = ($event) => $options.handleNavigatorTap("货架位置绑定解绑"))
}, [
vue.createElementVNode("view", {
class: "uni-flex uni-row",

View File

@ -253,6 +253,7 @@ namespace WCS.BLL.Services.Service
Role.IsAdmin = request.Role.IsAdmin;
Role.Name = request.Role.Name;
Role.Auths = request.Role.Auths;
Role.AuthNames = request.Role.AuthNames;
Role.Time = request.Role.Time;
var rowNum = await AuthDbHelp.db.Updateable(Role).ExecuteCommandAsync();
if (rowNum == 0)

View File

@ -76,8 +76,7 @@ namespace WCS.DAL.Db.AuthDb
/// <summary>
/// 认证模块名称
/// </summary>
[SugarColumn(IsIgnore = true)]
public List<string> AuthNames { get => Auths == null || !Auths.Any() ? new List<string>() : EnumHelps.GetEnumDescriptionList(typeof(AuthEnum), true).Where(o => Auths.Contains(o.Item1)).Select(o => o.Item3).ToList(); }
public string AuthNames { get; set; }
/// <summary>
/// 是否最大权限
/// </summary>

View File

@ -52,7 +52,7 @@ namespace WCS.Model.ApiModel
public List<int> Auths { get; set; } = new List<int>();
public List<string> AuthNames { get => (Auths == null || !Auths.Any()) ? new List<string>() : EnumHelps.GetEnumDescriptionList(typeof(AuthEnum), true).Where(o => Auths.Contains(o.Item1)).Select(o => o.Item3).ToList(); }
public string AuthNames { get; set; }
/// <summary>
/// 是否最大权限
/// </summary>

View File

@ -13,21 +13,24 @@ namespace 智慧物流软件系统
/// </summary>
public enum AuthEnum
{
//主页 = 1000,
= 2000,
= 3000,
= 4000,
= 5000,
= 6000,
= 7000,
= 8000,
= 9000,
= 10000,
= 11000,
= 12000,
= 13000,
= 14000,
= 15000,
= 1000,
= 2000,
= 3000,
= 4000,
= 5000,
= 6000,
= 7000,
= 8000,
= 9000,
= 10000,
= 11000,
PDA物料绑定 = 12000,
PDA绑定查询 = 13000,
PDA产线呼叫 = 14000,
PDA货架送回 = 15000,
PDA库存盘点 = 16000,
PDA任务管理 = 17000,
PDA货架位置绑定解绑 = 18000,
}
public class EnumTreeAttribute : Attribute

View File

@ -130,7 +130,7 @@
</hc:TransitioningContentControl>
</TabItem>-->
<TabItem Padding="10,10,40,10" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.库存查询},Converter={StaticResource AuthVisConverter}}">
<TabItem Padding="10,10,40,10" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.货架存量},Converter={StaticResource AuthVisConverter}}">
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe978;" FontSize="20" FontFamily="{StaticResource IconFont}"></TextBlock>
@ -144,7 +144,7 @@
</hc:TransitioningContentControl>
</TabItem>
<TabItem Padding="10,10,40,10"
Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.库存查询},Converter={StaticResource AuthVisConverter}}">
Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.位置管理},Converter={StaticResource AuthVisConverter}}">
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe621;"
@ -159,7 +159,7 @@
</hc:TransitioningContentControl>
</TabItem>
<TabItem Padding="10,10,40,10"
Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.物料维护},Converter={StaticResource AuthVisConverter}}">
Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.物料管理},Converter={StaticResource AuthVisConverter}}">
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe662;"
@ -174,7 +174,7 @@
</hc:TransitioningContentControl>
</TabItem>
<TabItem Padding="10,10,40,10"
Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.库位管理},Converter={StaticResource AuthVisConverter}}">
Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.货架管理},Converter={StaticResource AuthVisConverter}}">
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe614;"
@ -189,7 +189,7 @@
</hc:TransitioningContentControl>
</TabItem>
<TabItem Padding="10,10,40,10"
Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.出入记录},Converter={StaticResource AuthVisConverter}}">
Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.库存盘点},Converter={StaticResource AuthVisConverter}}">
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe65e;"
@ -204,7 +204,7 @@
</hc:TransitioningContentControl>
</TabItem>
<TabItem Padding="10,10,40,10"
Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.出入记录},Converter={StaticResource AuthVisConverter}}">
Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.物料绑定},Converter={StaticResource AuthVisConverter}}">
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe620;"
@ -218,7 +218,7 @@
<View:BatchBindMatDetailView />
</hc:TransitioningContentControl>
</TabItem>
<TabItem Padding="10,10,40,10" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.出入记录},Converter={StaticResource AuthVisConverter}}">
<TabItem Padding="10,10,40,10" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.数据记录},Converter={StaticResource AuthVisConverter}}">
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe60b;" FontSize="20" FontFamily="{StaticResource IconFont}"></TextBlock>
@ -230,7 +230,7 @@
</hc:TransitioningContentControl>
</TabItem>
<TabItem Padding="10,10,40,10"
Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.出入记录},Converter={StaticResource AuthVisConverter}}">
Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.任务管理},Converter={StaticResource AuthVisConverter}}">
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xec35;"

View File

@ -70,12 +70,15 @@ namespace 智慧物流软件系统
try
{
var treeNode = dataList.ToTreeNode();
var antuNames = treeNode.Where(o => o.IsSelect).Select(o => o.Name).ToList();
var antuNameStr = string.Join(",", antuNames);
RoleModel newRole = new RoleModel()
{
Id = roleBase.Id,
IsAdmin = roleBase.IsAdmin,
Name = view.textBox.Text.Trim(),
Auths = treeNode.Where(o => o.IsSelect).Select(o => (int)o.Id).ToList(),
AuthNames = antuNameStr,
Time = roleBase.Time,
};
if (crudEnum == CrudEnum.Update)