添加权限控制

newCac1.0
fanluyan 7 months ago
parent ad57243c3a
commit 40483e92cb

@ -6,8 +6,8 @@
mode="horizontal" mode="horizontal"
router router
> >
<template v-for="item in routeItem"> <template v-for="item in processedRouteItems">
<template v-if="item.subs"> <template v-if="item.subs && item.show">
<el-submenu :index="item.path" :key="item.path"> <el-submenu :index="item.path" :key="item.path">
<template slot="title"> <template slot="title">
<span slot="title">{{ item.name }}</span> <span slot="title">{{ item.name }}</span>
@ -19,7 +19,7 @@
</template> </template>
</el-submenu> </el-submenu>
</template> </template>
<template v-else> <template v-else-if="item.show">
<el-menu-item :index="item.path" :key="item.path"> <el-menu-item :index="item.path" :key="item.path">
<span slot="title">{{ item.name }}</span> <span slot="title">{{ item.name }}</span>
</el-menu-item> </el-menu-item>
@ -115,8 +115,24 @@ export default {
], ],
}, },
], ],
rawMenus: "",
}; };
}, },
computed: {
processedRouteItems() {
// rawMenus
const menus = this.rawMenus.split(",").map(Number);
// routeItems show
return this.routeItem.map((item, index) => {
// item show
if (!item.hasOwnProperty("show")) {
return { ...item, show: menus[index] };
} else {
return { ...item, show: item.show && menus[index] }; //
}
});
},
},
mounted() { mounted() {
console.log(window.location.host); console.log(window.location.host);
console.log(process.env.NODE_ENV); console.log(process.env.NODE_ENV);
@ -152,6 +168,8 @@ export default {
}, },
}, },
created() { created() {
this.rawMenus = localStorage.getItem("menus") || "1,1,1,1,0,0,0"; //
console.log(this.menus);
this.setCurrentRoute(); this.setCurrentRoute();
}, },
}; };

@ -1150,6 +1150,18 @@ export function ieddlDelApi(data) {
}); });
} }
// /ieddl/listFiles 查询文件和目录
export function ieddllistFilesApi(data) {
return request({
url: "/ieddl/listFiles",
method: "get",
params: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
//下载记录 //下载记录
export function ieddlDownloadAllApi(data) { export function ieddlDownloadAllApi(data) {
return request({ return request({

@ -17,7 +17,12 @@
:model="formInfo" :model="formInfo"
> >
<el-form-item label="IED" prop="iedId"> <el-form-item label="IED" prop="iedId">
<el-select v-model="formInfo.iedId" filterable placeholder="请选择"> <el-select
v-model="formInfo.iedId"
filterable
placeholder="请选择"
@change="changeIed"
>
<el-option <el-option
v-for="item in iedOptions" v-for="item in iedOptions"
:key="item.id" :key="item.id"
@ -84,6 +89,7 @@ import {
ieddlUpdateApi, ieddlUpdateApi,
listIedConfigApi, listIedConfigApi,
monitoringListAllApi, monitoringListAllApi,
ieddllistFilesApi,
} from "@/utils/api/index"; } from "@/utils/api/index";
export default { export default {
props: ["title"], props: ["title"],
@ -108,6 +114,7 @@ export default {
], ],
iedOptions: [], iedOptions: [],
devIdOptions: [], devIdOptions: [],
iedId: "",
}; };
}, },
created() {}, created() {},
@ -213,6 +220,23 @@ export default {
}) })
.catch((err) => {}); .catch((err) => {});
}, },
//ied
changeIed(val) {
console.log(val);
this.iedId = val;
this.getiedFileList();
},
//
getiedFileList() {
ieddllistFilesApi({
iedId: this.iedId,
path: "/",
})
.then((res) => {
console.log(res);
})
.catch((err) => {});
},
// //
getmonitorList() { getmonitorList() {
monitoringListAllApi() monitoringListAllApi()

@ -99,7 +99,11 @@ export default {
if (res.success) { if (res.success) {
console.log(res.data); console.log(res.data);
//this.$router.push("/weather"); //this.$router.push("/weather");
localStorage.setItem("token", "13747c96ff9f434cb09ecf78e4b9a8bc"); localStorage.setItem(
"token",
"13747c96ff9f434cb09ecf78e4b9a8bc"
);
localStorage.setItem("menus", res.data.menus);
this.$message({ this.$message({
duration: 1500, duration: 1500,
showClose: true, showClose: true,

@ -119,87 +119,40 @@
>历史数据</el-button >历史数据</el-button
> >
</div> </div>
<el-tooltip placement="bottom-start"> <div class="textitem">
<div slot="content"> <p>
<div class="textitem"> 采集时间
<h3 class="headTitle" :title="item.name"> <span v-if="item.lastData" class="timeclass">
{{ item.jgName }}/{{ item.zsbName }}/{{ item.name }} {{ item.lastData.acquisitionTime }}
</h3> </span>
<p> <span v-else class="timeclass"> -- </span>
采集时间 </p>
<span v-if="item.lastData" class="timeclass"> <!-- 遍历 typePoints 显示数据 -->
{{ item.lastData.acquisitionTime }} <div
</span> class="dataclass"
<span v-else class="timeclass"> -- </span> v-for="fieldDesc in item.typePoints"
</p> :key="fieldDesc.field"
<!-- 遍历 typePoints 显示数据 --> >
<div <strong>{{ fieldDesc.fieldDesc || fieldDesc.field }}:</strong>
class="dataclass" <span v-if="item.lastData && fieldDesc.field in item.lastData">
v-for="fieldDesc in item.typePoints" {{ getDataByField(item, fieldDesc.field) }}
:key="fieldDesc.field" </span>
> <span v-else> -- </span>
<strong
>{{ fieldDesc.fieldDesc || fieldDesc.field }}:</strong
>
<span
v-if="item.lastData && fieldDesc.field in item.lastData"
>
{{ getDataByField(item, fieldDesc.field) }}
</span>
<span v-else> -- </span>
</div>
<!-- 显示 lastData 中有但 typePoints 中没有的字段 -->
<div
class="dataclass"
v-for="(value, key) in item.lastData"
:key="key"
v-if="
!item.typePoints.some((fd) => fd.field === key) &&
key !== 'acquisitionTime'
"
>
<strong>{{ key }}:</strong>
{{ value }}
</div>
</div>
</div> </div>
<div class="textitem"> <!-- 显示 lastData 中有但 typePoints 中没有的字段 -->
<p> <div
采集时间 class="dataclass"
<span v-if="item.lastData" class="timeclass"> v-for="(value, key) in item.lastData"
{{ item.lastData.acquisitionTime }} :key="key"
</span> v-if="
<span v-else class="timeclass"> -- </span> !item.typePoints.some((fd) => fd.field === key) &&
</p> key !== 'acquisitionTime'
<!-- 遍历 typePoints 显示数据 --> "
<div >
class="dataclass" <strong>{{ key }}:</strong>
v-for="fieldDesc in item.typePoints" {{ value }}
:key="fieldDesc.field"
>
<strong>{{ fieldDesc.fieldDesc || fieldDesc.field }}:</strong>
<span
v-if="item.lastData && fieldDesc.field in item.lastData"
>
{{ getDataByField(item, fieldDesc.field) }}
</span>
<span v-else> -- </span>
</div>
<!-- 显示 lastData 中有但 typePoints 中没有的字段 -->
<div
class="dataclass"
v-for="(value, key) in item.lastData"
:key="key"
v-if="
!item.typePoints.some((fd) => fd.field === key) &&
key !== 'acquisitionTime'
"
>
<strong>{{ key }}:</strong>
{{ value }}
</div>
</div> </div>
</el-tooltip> </div>
</el-card> </el-card>
</div> </div>
<div class="emptyBox" v-else> <div class="emptyBox" v-else>
@ -603,7 +556,7 @@ export default {
} }
.el-card__body { .el-card__body {
padding: 8px; padding: 8px;
height: 78px; height: auto;
.textitem { .textitem {
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;

Loading…
Cancel
Save