提交 56c4a58f 作者: “kai”

fix(uav列表): 修复权限判断逻辑和样式问题

修复权限判断从菜单ID改为权限标识,修正视频播放按钮显示变量名
调整健康状态组件内边距,优化无人机列表国际化显示格式
上级 ec70f3f2
......@@ -398,6 +398,7 @@ export default {
已取消操作: "Операция отменена",
},
controlMenu: {
当前高度创建航点动作可能不安全: "Возможно, что действие создания точки маршрута небезопасно в текущей высоте.",
任务: "Задача",
智能识别: "ИИ распознавание",
人脸识别: "Распознавание лиц",
......
......@@ -855,7 +855,7 @@ export default {
}
.nest_info {
padding: 16px;
padding: 6px;
.btn {
width: 80px;
......
......@@ -33,12 +33,13 @@
/>
</div>
<div class="online-info">
{{$t('common.共')}} {{ data.onLineCount + data.offLineCount }} {{$t('common.架')}}
{{ $t("common.共") }} {{ data.onLineCount + data.offLineCount }}
{{ $t("common.架") }}
<span class="ml10" :class="{ online: data.onLineCount }"
>{{ data.onLineCount }} {{$t('common.在线')}}</span
>{{ data.onLineCount }} {{ $t("common.在线") }}</span
>
/
{{ data.offLineCount }} {{$t('common.离线')}}
{{ data.offLineCount }} {{ $t("common.离线") }}
</div>
</div>
<div class="uav-item-child-box" :class="{ collapse: data.collapse }">
......@@ -69,9 +70,9 @@
>{{ device.name }}</span
>
<span style="color: #31db24" class="dib" v-if="device.isOnline"
>({{$t('common.在线')}})</span
>({{ $t("common.在线") }})</span
>
<span v-else class="dib">({{$t('common.离线')}})</span>
<span v-else class="dib">({{ $t("common.离线") }})</span>
<div class="symbol-icon-box">
<!-- <template v-if="device.modelName && device.modelName.includes('入云龙1')">
<div class="uav_version status-icon cp">
......@@ -100,12 +101,12 @@
</div>
<div class="device-fns">
<div
v-if="isShowPlayerFlag"
class="iconfont icon-luxiang_xianxing"
:class="{
active:
uav && device.deviceId === uav.deviceId && uav.showPlayer,
}"
v-if="IsShowPlayer"
:title="$t('common.视频')"
@click="onShowPlayer(device)"
v-hover
......@@ -147,20 +148,26 @@
:close-on-click-modal="false"
@close="takeLoading = false"
>
<span>{{$t('common.是否请求接管')}} {{ departmentName }} {{$t('common.下的')}} {{ takeDevice.name }}</span>
<span
>{{ $t("common.是否请求接管") }} {{ departmentName }}
{{ $t("common.下的") }} {{ takeDevice.name }}</span
>
<span slot="footer" class="dialog-footer">
<el-button @click="takeOverVisible = false">{{$t('common.取消')}}</el-button>
<el-button @click="takeOverVisible = false">{{
$t("common.取消")
}}</el-button>
<el-button
@click="onForceTakeOver"
type="danger"
:loading="forceTakeLoading"
>{{$t('common.强制接管')}}</el-button
>{{ $t("common.强制接管") }}</el-button
>
<el-button
type="primary"
@click="onApplyTakeOver"
:loading="takeLoading"
>{{$t('common.确认')}}</el-button>
>{{ $t("common.确认") }}</el-button
>
>
</span>
</el-dialog>
......@@ -187,7 +194,7 @@ export default {
data() {
return {
IsShowPane: false,
IsShowPlayer: false,
isShowPlayerFlag: false,
isTakeOver: false,
takeOverVisible: false,
// 接管设备信息
......@@ -242,37 +249,24 @@ export default {
created() {
let tmjData = JSON.parse(localStorage.getItem("tmj"));
if (tmjData) {
const userList = this.handleGetMenuList(tmjData.user.menuList);
// 使用一个映射对象来存储权限ID和对应的标志
const userList = tmjData.user.permissions;
// 使用一个映射对象来存储权限和对应的标志
const permissionMap = {
3108: "IsShowPane", // 控制面板权限
3099: "isTakeOver", // 接管权限
3193: "isShowPlayer", // 视频权限
"uas:device-stream:query": "isShowPlayerFlag", // 视频权限
"uas:device-take:query": "IsShowPane", // 控制面板权限
"uas:device-take:update": "isTakeOver", // 接管权限
};
// 遍历用户菜单列表,设置对应的标志
userList.forEach((item) => {
if (permissionMap[item.id]) {
this[permissionMap[item.id]] = true;
}
});
userList.forEach((item) => {
if (permissionMap[item]) {
this.$nextTick(() => {
this[permissionMap[item]] = true;
})
}
});
}
},
methods: {
handleGetMenuList(menuList) {
const collector = [];
const flattenMenu = (items) => {
items.forEach((item) => {
if (item.children && item.children.length > 0) {
flattenMenu(item.children);
} else {
collector.push(item);
}
});
};
flattenMenu(menuList);
return collector;
},
/**
* 同意接管事件
*/
......@@ -281,7 +275,7 @@ export default {
//接管消息
if (content.isAgree) {
this.$notify.success({
title: this.$t('common.接管消息'),
title: this.$t("common.接管消息"),
message: msg,
duration: 30000,
offset: 40,
......@@ -290,12 +284,12 @@ export default {
this.takeOverVisible = false;
} else {
this.$notify.warning({
title: this.$t('common.接管消息'),
title: this.$t("common.接管消息"),
message: msg,
duration: 30000,
offset: 40,
});
this.$message.warning(this.$t('common.申请接管拒绝'));
this.$message.warning(this.$t("common.申请接管拒绝"));
}
this.takeLoading = false;
this.bus.$off("uas-device-take-agree-message", this.onTakeAgree);
......@@ -314,12 +308,12 @@ export default {
this.bus.$on("uas-device-take-agree-message", this.onTakeAgree);
this.bus.$on("uas-device-take-refuse-message", this.onTakeAgree);
} else {
this.$message.warning(this.$t('common.接管失败申请单位未同意'));
this.$message.warning(this.$t("common.接管失败申请单位未同意"));
this.takeLoading = false;
}
setTimeout(() => {
if (this.takeLoading) {
this.$message.error(this.$t('common.接管失败申请单位未同意'));
this.$message.error(this.$t("common.接管失败申请单位未同意"));
this.takeLoading = false;
}
}, 5500);
......@@ -334,7 +328,9 @@ export default {
deviceId: this.takeDevice.id,
});
if (res.code === 0) {
this.$message.success(`${this.$t('common.请开始操作')}${this.takeDevice.name}`);
this.$message.success(
`${this.$t("common.请开始操作")}${this.takeDevice.name}`
);
this.takeOverVisible = false;
this.$emit("refresh");
}
......@@ -354,7 +350,7 @@ export default {
deviceId: uav.id,
});
if (res.code === 0) {
this.$message.success(`${this.$t('common.请开始操作')}${uav.name}`);
this.$message.success(`${this.$t("common.请开始操作")}${uav.name}`);
this.$emit("refresh");
}
} else {
......@@ -367,17 +363,21 @@ export default {
uav.currentOperator === this.userInfo.id
) {
try {
await this.$confirm(`${this.$t('common.请确认是否退出接管')}${uav.name}?`, this.$t('common.安全确认'), {
cancelButtonText: this.$t('common.取消'),
confirmButtonText: this.$t('common.确认'),
customClass: "uav_controlPane",
showClose: false,
});
await this.$confirm(
`${this.$t("common.请确认是否退出接管")}${uav.name}?`,
this.$t("common.安全确认"),
{
cancelButtonText: this.$t("common.取消"),
confirmButtonText: this.$t("common.确认"),
customClass: "uav_controlPane",
showClose: false,
}
);
let res = await Control_API.setUavControlOff({
deviceId: uav.id,
});
if (res.code === 0) {
this.$message.success(`${this.$t('common.已退出接管')}${uav.name}`);
this.$message.success(`${this.$t("common.已退出接管")}${uav.name}`);
this.$emit("refresh");
}
} catch (e) {}
......@@ -401,10 +401,10 @@ export default {
password: this.mqttToken,
})
.then(() => {
console.log(this.$t('common.mqtt连接成功'));
console.log(this.$t("common.mqtt连接成功"));
});
} catch (e) {
console.log(this.$t('common.mqtt失败'), e);
console.log(this.$t("common.mqtt失败"), e);
}
// setTimeout(() => {
// this.onShowPanel(item);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论