控制资源权限

role1.0
fanluyan 1 year ago
parent 5d37873db3
commit b105c7b200

@ -115,14 +115,14 @@ export default {
index: "/userManagement",
title: "用户管理",
},
// {
// index: "/roleManagement",
// title: "",
// },
// {
// index: "/menuManagement",
// title: "",
// },
{
index: "/roleManagement",
title: "角色管理",
},
{
index: "/menuManagement",
title: "菜单功能管理",
},
{
index: "/deviceUpgrade",
title: "升级管理",
@ -139,153 +139,6 @@ export default {
],
},
],
items1: [
{
icon: "el-icon-s-home",
index: "stritl",
title: "首页",
},
{
icon: "el-icon-camera",
index: "/realTimeMonitor",
title: "实时监控",
},
{
icon: "el-icon-film",
index: "/pictureRotation",
title: "图片轮巡",
},
{
icon: "el-icon-bell",
index: "/photoAlarm",
title: "告警处理",
},
{
icon: "el-icon-search",
index: "/realTimeSearch",
title: "历史图片",
},
{
icon: "el-icon-files",
index: "/property",
title: "资产管理",
subs: [
{
index: "/lineInformation",
title: "线路信息管理",
},
{
index: "/towerInformation",
title: "杆塔信息管理",
},
{
index: "/cameraChannel",
title: "通道管理",
},
{
index: "/photographicDevice",
title: "拍照装置管理",
},
{
index: "/devicePhotoSchedule",
title: "拍照时间表设置",
},
],
},
{
icon: "el-icon-monitor",
index: "/system",
title: "系统管理",
subs: [
{
index: "/userManagement",
title: "用户管理",
},
],
},
],
items2: [
{
icon: "el-icon-s-home",
index: "stritl",
title: "首页",
},
{
icon: "el-icon-camera",
index: "/realTimeMonitor",
title: "实时监控",
},
{
icon: "el-icon-film",
index: "/pictureRotation",
title: "图片轮巡",
},
{
icon: "el-icon-bell",
index: "photoAlarm",
title: "告警处理",
},
{
icon: "el-icon-search",
index: "/realTimeSearch",
title: "历史图片",
},
{
icon: "el-icon-files",
index: "/property",
title: "资产管理",
subs: [
{
index: "/lineInformation",
title: "线路信息管理",
},
{
index: "/towerInformation",
title: "杆塔信息管理",
},
{
index: "/photographicDevice",
title: "拍照装置管理",
},
{
index: "/devicePhotoSchedule",
title: "拍照时间表设置",
},
],
},
],
hnjcitems: [
{
icon: "el-icon-s-home",
index: "stritl",
title: "首页",
},
{
icon: "el-icon-camera",
index: "/realTimeMonitor",
title: "实时监控",
},
{
icon: "el-icon-film",
index: "/pictureRotation",
title: "图片轮巡",
},
{
icon: "el-icon-bell",
index: "photoAlarm",
title: "告警处理",
},
{
icon: "el-icon-search",
index: "/realTimeSearch",
title: "历史图片",
},
],
role: "",
menuList: [],
};
@ -322,8 +175,11 @@ export default {
//
originalArray.forEach((item) => {
const { id, key, desc } = item;
console.log(key);
console.log(key, desc);
const index = key.startsWith("/") ? key.substring(1) : key; //
// desc"-"
const processedDesc = desc.split("-")[0].trim();
console.log(index, processedDesc);
const icon = icons[index] || icons["default"]; // 使
if (
@ -336,7 +192,10 @@ export default {
].includes(index)
) {
// 线
assetManagementSubs.push({ index: "/" + index, title: desc });
assetManagementSubs.push({
index: "/" + index,
title: processedDesc,
});
} else if (
[
"userManagement",
@ -348,10 +207,13 @@ export default {
].includes(index)
) {
//
systemManagementSubs.push({ index: "/" + index, title: desc });
systemManagementSubs.push({
index: "/" + index,
title: processedDesc,
});
} else {
//
newArray.push({ icon, index: "/" + index, title: desc });
newArray.push({ icon, index: "/" + index, title: processedDesc });
}
});
@ -387,22 +249,19 @@ export default {
console.log("用户管理");
console.log(this.role);
// this.menuList = JSON.parse(localStorage.getItem("menuPermission"));
// console.log(this.menuList);
// this.getMenuArr(this.menuList);
this.menuList = JSON.parse(localStorage.getItem("menuPermission"));
console.log(this.menuList);
this.getMenuArr(this.menuList);
if (this.role == 0) {
this.items = this.items;
} else if (this.role == 1) {
this.items = this.items1;
} else if (this.role == 2) {
this.items = this.items2;
} else if (this.role == 4) {
this.items = this.hnjcitems;
}
// //this.activeIndex = this.items[0].index;
// console.log(this.items);
console.log(this.activeIndex);
// if (this.role == 0) {
// this.items = this.items;
// } else if (this.role == 1) {
// this.items = this.items1;
// } else if (this.role == 2) {
// this.items = this.items2;
// } else if (this.role == 4) {
// this.items = this.hnjcitems;
// }
},
};
</script>

@ -68,10 +68,17 @@ export default new Vuex.Store({
state.uid = val.uid;
state.role = val.role;
state.resources = val.resources;
const menuArr = val.resources
.filter((item) => item.key.includes("/"))
.sort((a, b) => a.id - b.id);
const btnArr = val.resources
.filter((item) => item.key.includes("Btn"))
.sort((a, b) => a.id - b.id);
localStorage.setItem("userName", state.userName);
localStorage.setItem("uid", state.uid);
localStorage.setItem("role", state.role);
localStorage.setItem("menuPermission", JSON.stringify(state.resources));
localStorage.setItem("menuPermission", JSON.stringify(menuArr));
localStorage.setItem("btnPermission", JSON.stringify(btnArr));
},
//退出清除locastorge
REMOVE_INFO(state) {

@ -1,22 +1,14 @@
<template>
<div class="gpsbuttonBox">
<el-button type="primary" @click="handleShowGPS">GPS </el-button>
<el-dropdown class="dropgps" trigger="click" @command="handleCommandGps">
<el-button type="primary">
GPS开关<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown" class="gpsdropStyle">
<el-dropdown-item command="open">开启GPS</el-dropdown-item>
<el-dropdown-item command="close">关闭GPS</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<gps-position ref="gpsdialog_ref"></gps-position>
</div>
</template>
<script>
// import infoDialog from "./infoDialog.vue";
import gpsPosition from "./gpsPosition.vue";
import { getTermStatus, setTermGPSJoggle } from "@/utils/api/index";
import {} from "@/utils/api/index";
export default {
components: {
gpsPosition,
@ -45,54 +37,6 @@ export default {
},
},
methods: {
//gps
handleCommandGps(command) {
switch (command) {
case "open": //
this.changeGPS(1, this.cmdId);
break;
case "close": //
this.changeGPS(0, this.cmdId);
break;
}
},
changeGPS(val, cmdid) {
console.log(val, cmdid);
getTermStatus({ termId: this.termId }).then((res) => {
console.log(res);
if (res.data.isonline) {
setTermGPSJoggle({ gpsstatus: val, cmdId: cmdid })
.then((res) => {
console.log(res);
if (val == 0) {
this.$message({
duration: 1500,
message: "GPS已关闭",
type: "warning",
showClose: true,
});
} else {
this.$message({
duration: 1500,
message: "成功开启GPS",
type: "success",
showClose: true,
});
}
})
.catch((err) => {
console.log(err); //
});
} else {
this.$message({
duration: 1500,
showClose: true,
message: "装置下线,发送指令失败",
type: "error",
});
}
});
},
//GPS
handleShowGPS() {
this.$refs.gpsdialog_ref.display(this.cmdId, this.termId);
@ -103,8 +47,8 @@ export default {
</script>
<style lang="less">
.gpsbuttonBox {
width: 100%;
display: flex;
justify-content: space-between;
// width: 100%;
// display: flex;
// justify-content: space-between;
}
</style>

@ -68,32 +68,48 @@
<div class="paramsDate setTimebtn">
<h3>操作项</h3>
<div class="buttonGroup">
<takePicButton></takePicButton>
<takeVideoButton></takeVideoButton>
<takePicButton v-if="showButton('pzShowBtn')"></takePicButton>
<takeVideoButton v-if="showButton('spShowBtn')"></takeVideoButton>
<deviceInfoButton></deviceInfoButton>
<scheduleButton></scheduleButton>
<alarmButton></alarmButton>
<scheduleButton v-if="showButton('pztimeShowBtn')"></scheduleButton>
<alarmButton v-if="showButton('sgbjShowBtn')"></alarmButton>
<cableButton></cableButton>
<gpsButton></gpsButton>
<el-dropdown
class="dropgps"
trigger="click"
@command="handleCommandGps"
>
<el-button type="primary">
GPS开关<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown" class="gpsdropStyle">
<el-dropdown-item command="open">开启GPS</el-dropdown-item>
<el-dropdown-item command="close">关闭GPS</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="primary" @click="handlehistoryPic">
历史图片</el-button
>
<el-button
type="primary"
@click="handlehistoryPic"
v-if="roleUser != 4"
@click="handleParams"
v-if="showButton('cspzShowBtn')"
>
历史图片</el-button
参数配置</el-button
>
<el-button
type="primary"
@click="handleuploadPic"
v-if="showButton('sctpShowBtn')"
>
<el-button type="primary" @click="handleParams"> </el-button>
<el-button type="primary" @click="handleuploadPic" v-if="roleUser == 0">
上传图片</el-button
>
<takeTimePicButton v-if="roleUser == 0"></takeTimePicButton>
<setChannelButton v-if="roleUser == 0"></setChannelButton>
<setAppButton v-if="roleUser == 0"></setAppButton>
<takeTimePicButton
v-if="showButton('zdTimepzShowBtn')"
></takeTimePicButton>
<setChannelButton v-if="showButton('tdszShowBtn')"></setChannelButton>
<setAppButton v-if="showButton('appShowBtn')"></setAppButton>
<el-dropdown
class="dropgps"
trigger="click"
@ -114,57 +130,46 @@
<el-dropdown-item command="faultInfo">故障信息报</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<!-- <el-button type="primary" @click="handleTakePic" :loading="picLoading"
>主动拍照
</el-button> -->
<!-- <el-button type="primary">主动拍照 </el-button>
<el-button type="primary">主动拍照 </el-button>
<el-button type="primary">主动拍照 </el-button>
<el-button type="primary">主动拍照 </el-button>
<el-button type="primary">主动拍照 </el-button>
<el-button type="primary">主动拍照 </el-button>
<el-button type="primary">主动拍照 </el-button> -->
</div>
</div>
<div class="setfocalLength" v-if="areaData.protocol == '65286'">
<h3>焦距调节</h3>
<div class="selectChannel">
<span class="labelname">选择通道</span>
<el-select
v-model="channelarrValue"
placeholder="请选择通道"
ref="multiSelect"
>
<el-option
v-for="item in channelfocalOpyion"
:key="item.channelid"
:label="
item.alias !== null && item.alias !== ''
? item.alias
: item.channelname
"
:value="item.channelid"
<div class="setfocalLength" v-if="areaData.protocol == '65286'">
<h3>焦距调节</h3>
<div class="selectChannel">
<span class="labelname">选择通道</span>
<el-select
v-model="channelarrValue"
placeholder="请选择通道"
ref="multiSelect"
>
{{
item.alias !== null && item.alias !== ""
? item.alias
: item.channelname
}}
</el-option>
</el-select>
</div>
<div class="buttonGroup">
<el-button type="primary" icon="el-icon-zoom-in" @click="amplify()"
>放大</el-button
>
<el-button type="primary" icon="el-icon-zoom-out" @click="reduce()"
>缩小</el-button
>
<el-option
v-for="item in channelfocalOpyion"
:key="item.channelid"
:label="
item.alias !== null && item.alias !== ''
? item.alias
: item.channelname
"
:value="item.channelid"
>
{{
item.alias !== null && item.alias !== ""
? item.alias
: item.channelname
}}
</el-option>
</el-select>
</div>
<div class="buttonGroup">
<el-button type="primary" icon="el-icon-zoom-in" @click="amplify()"
>放大</el-button
>
<el-button type="primary" icon="el-icon-zoom-out" @click="reduce()"
>缩小</el-button
>
</div>
</div>
</div>
<parameterSetDialog ref="parameterSetref"></parameterSetDialog>
<uploadpic ref="uploadpicref"></uploadpic>
<baseInfor ref="baseInfor_ref"></baseInfor>
<workStatus ref="workStatus_ref"></workStatus>
<runStatus ref="runStatus_ref"></runStatus>
@ -197,6 +202,7 @@ import {
updateTermCamera,
getTermStatus,
addFavorList,
setTermGPSJoggle,
} from "@/utils/api/index";
export default {
components: {
@ -236,6 +242,7 @@ export default {
selectLineId: "",
selectTowerId: "",
collectFlag: false, //
btnShowList: [],
};
},
@ -250,15 +257,27 @@ export default {
areaData() {
return this.$store.state.currentData;
},
showButtonMap() {
return this.btnShowList.reduce((map, button) => {
map[button.key] = true; // key
return map;
}, {});
},
},
created() {
this.roleUser = localStorage.getItem("role");
console.log("asdsaddddddddddddddddddddddddd", this.roleUser);
this.btnShowList = JSON.parse(localStorage.getItem("btnPermission"));
console.log(this.btnShowList);
},
mounted() {
this.getDateTime();
},
methods: {
//
showButton(key) {
return this.showButtonMap[key] || false;
},
//
handleDblClick(val) {
// alert(val);
@ -377,6 +396,54 @@ export default {
this.$store.commit("channelId", val); //currentDatavuex
this.$parent.getPhotoList(val, this.dateValue, this.areaData.id);
},
//gps
handleCommandGps(command) {
switch (command) {
case "open": //
this.changeGPS(1, this.areaData.id);
break;
case "close": //
this.changeGPS(0, this.areaData.id);
break;
}
},
changeGPS(val, cmdid) {
console.log(val, cmdid);
getTermStatus({ termId: cmdid }).then((res) => {
console.log(res);
if (res.data.isonline) {
setTermGPSJoggle({ gpsstatus: val, cmdId: cmdid })
.then((res) => {
console.log(res);
if (val == 0) {
this.$message({
duration: 1500,
message: "GPS已关闭",
type: "warning",
showClose: true,
});
} else {
this.$message({
duration: 1500,
message: "成功开启GPS",
type: "success",
showClose: true,
});
}
})
.catch((err) => {
console.log(err); //
});
} else {
this.$message({
duration: 1500,
showClose: true,
message: "装置下线,发送指令失败",
type: "error",
});
}
});
},
//
handlehistoryPic() {
console.log(this.areaData);

@ -183,6 +183,7 @@ export default {
this.onlineNum = res.data.onlineNum;
this.totalNum = res.data.totalNum;
this.currentData = JSON.parse(localStorage.getItem("currentData"));
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.currentData.id); //
});

@ -106,22 +106,15 @@ export default {
this.formdata = JSON.parse(JSON.stringify(val));
},
//
// getRoleListAll() {
// getRoleList()
// .then((res) => {
// console.log("", res.data);
// this.roleoptions = res.data.filter((role) => role.id !== 0);
// })
// .catch((err) => {});
// },
// getRoleListAll() {
// getRoleList()
// .then((res) => {
// //
// this.roleoptions = res.data.filter((role) => role.id !== 0);
// })
// .catch((err) => {});
// },
getRoleListAll() {
getRoleList()
.then((res) => {
console.log("获取角色列表", res.data);
this.roleoptions = res.data.filter((role) => role.id !== 0);
})
.catch((err) => {});
},
//
submitForm() {
this.$refs.formInfo.validate((valid) => {
@ -163,7 +156,7 @@ export default {
display() {
this.isShow = true;
this.roleUser = localStorage.getItem("role");
//this.getRoleListAll();
this.getRoleListAll();
},
hide() {
this.isShow = false;

@ -28,17 +28,17 @@
show-overflow-tooltip
prop="userName"
></el-table-column>
<!-- <el-table-column label="角色" show-overflow-tooltip prop="roleName">
<template slot-scope="scope">{{ scope.row.roleName }}</template>
</el-table-column> -->
<el-table-column label="角色" show-overflow-tooltip prop="roleName">
<template slot-scope="scope">{{ scope.row.roleName }}</template>
</el-table-column>
<!-- <el-table-column label="角色" show-overflow-tooltip prop="roleName">
<template slot-scope="scope">
<span v-if="scope.row.role == 0"></span>
<span v-else-if="scope.row.role == 1">管理员</span>
<span v-else-if="scope.row.role == 2">用户</span>
<span v-else>{{ scope.row.role }}</span>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column
label="备注"
show-overflow-tooltip

Loading…
Cancel
Save