|
|
@@ -7,7 +7,10 @@
|
|
|
<el-button :class="isActiveExport ? 'btn-active' : 'btn-normal'" @click="handleBatchExport"
|
|
|
>导出</el-button
|
|
|
>
|
|
|
- <el-button :class="isActiveDelete ? 'btn-active' : 'btn-normal'" @click="handleBatchDelete"
|
|
|
+ <el-button
|
|
|
+ :class="isActiveDelete ? 'btn-active' : 'btn-normal'"
|
|
|
+ @click="handleBatchDelete"
|
|
|
+ v-if="hasCameraDeletePermission()"
|
|
|
>删除</el-button
|
|
|
>
|
|
|
<span class="close-btn" @click="handleSelectNone"></span>
|
|
|
@@ -39,12 +42,20 @@
|
|
|
@page-size-change="handlePageSizeChange"
|
|
|
>
|
|
|
<template #tableTitle>
|
|
|
- <el-button type="primary" :icon="Plus" @click="showAddPopover = true">添加</el-button>
|
|
|
<el-button
|
|
|
+ v-if="hasCameraAddPermission()"
|
|
|
+ type="primary"
|
|
|
+ :icon="Plus"
|
|
|
+ @click="showAddPopover = true"
|
|
|
+ style="margin-right: 18px"
|
|
|
+ >添加</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ v-if="hasCameraAddPermission()"
|
|
|
+ plain
|
|
|
color="#1890FF"
|
|
|
@click="showBatchImportPopover = true"
|
|
|
- style="margin-left: 18px"
|
|
|
- plain
|
|
|
+ style="margin: 0 18px 0 0"
|
|
|
>
|
|
|
<template #icon>
|
|
|
<el-icon>
|
|
|
@@ -54,10 +65,11 @@
|
|
|
批量添加
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
+ v-if="hasCameraEditPermission()"
|
|
|
+ plain
|
|
|
color="#1890FF"
|
|
|
@click="showBatchEditPopover = true"
|
|
|
- style="margin-left: 18px"
|
|
|
- plain
|
|
|
+ style="margin: 0 18px 0 0"
|
|
|
>
|
|
|
<template #icon>
|
|
|
<el-icon>
|
|
|
@@ -67,7 +79,13 @@
|
|
|
批量修改
|
|
|
</el-button>
|
|
|
<el-badge :value="totalRow" :hidden="totalRow < 1" class="item">
|
|
|
- <el-button color="#1890FF" @click="showSharedPopover = true" plain>共享相机</el-button>
|
|
|
+ <el-button
|
|
|
+ plain
|
|
|
+ color="#1890FF"
|
|
|
+ @click="showSharedPopover = true"
|
|
|
+ style="margin: 0 18px 0 0"
|
|
|
+ >共享相机</el-button
|
|
|
+ >
|
|
|
</el-badge>
|
|
|
</template>
|
|
|
<template #empty>
|
|
|
@@ -135,6 +153,19 @@
|
|
|
import { getHeaders } from '@/utils/http/axios';
|
|
|
import { useGlobSetting } from '@/hooks/setting';
|
|
|
import { useSceneTemplateList } from './stores/useSceneTemplateList';
|
|
|
+ import { useUserStore } from '@/store/modules/user';
|
|
|
+ import { PERM_DEVICE } from '@/types/permission/constants';
|
|
|
+
|
|
|
+ const userStore = useUserStore();
|
|
|
+ const hasCameraAddPermission = () => {
|
|
|
+ return userStore.checkPermission(PERM_DEVICE.CAMERA_ADD);
|
|
|
+ };
|
|
|
+ const hasCameraEditPermission = () => {
|
|
|
+ return userStore.checkPermission(PERM_DEVICE.CAMERA_EDIT);
|
|
|
+ };
|
|
|
+ const hasCameraDeletePermission = () => {
|
|
|
+ return userStore.checkPermission(PERM_DEVICE.CAMERA_DELETE);
|
|
|
+ };
|
|
|
|
|
|
const sceneTemplateListInfo = useSceneTemplateList();
|
|
|
const { getSceneTemplateList } = sceneTemplateListInfo;
|
|
|
@@ -211,13 +242,18 @@
|
|
|
label: '编辑',
|
|
|
icon: editIcon,
|
|
|
onClick: handleEdit.bind(null, record.row),
|
|
|
+ auth: hasCameraEditPermission,
|
|
|
},
|
|
|
{
|
|
|
label: '删除',
|
|
|
icon: deleteIcon,
|
|
|
onClick: handleDelete.bind(null, record.row),
|
|
|
+ auth: hasCameraDeletePermission,
|
|
|
},
|
|
|
- ],
|
|
|
+ ].filter((x) => {
|
|
|
+ if (!x.auth) return true;
|
|
|
+ return x.auth();
|
|
|
+ }),
|
|
|
});
|
|
|
},
|
|
|
});
|
|
|
@@ -326,7 +362,7 @@
|
|
|
};
|
|
|
|
|
|
const handleDelete = (row) => {
|
|
|
- ElMessageBox.confirm(`您想删除相机${row.code}`, '提示', {
|
|
|
+ ElMessageBox.confirm(`是否删除相机${row.code}`, '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning',
|
|
|
@@ -486,7 +522,7 @@
|
|
|
}
|
|
|
|
|
|
.item {
|
|
|
- margin: 0px 40px 0px 15px;
|
|
|
+ margin: 0px 40px 0px 0px;
|
|
|
}
|
|
|
</style>
|
|
|
<style lang="less">
|