|
|
@@ -1,58 +1,84 @@
|
|
|
<template>
|
|
|
- <QueryForm :algos-info="algosInfo" @on-search="handleQueryTableData" @on-reset="handleResetTableData" />
|
|
|
- <div v-if="showActionBar" class="action-bar">
|
|
|
- <span class="num-text">已选{{ chooseNum }}项</span>
|
|
|
- <el-button :class="isAlgoAdd ? 'btn-active' : 'btn-normal'" @click="handleAlgosAdd">算法添加</el-button>
|
|
|
- <el-button :class="isParamsSet ? 'btn-active' : 'btn-normal'" @click="handleParamsSet">参数设置</el-button>
|
|
|
- <el-button :class="isAlgoOpen ? 'btn-active' : 'btn-normal'" @click="handleAlgosOpen">算法开启</el-button>
|
|
|
- <el-button :class="isAlgoClose ? 'btn-active' : 'btn-normal'" @click="handleAlgosClose">算法关闭</el-button>
|
|
|
- <el-button :class="isAlgoDelete ? 'btn-active' : 'btn-normal'" @click="handleAlgosDel">算法删除</el-button>
|
|
|
- <span class="close-btn" @click="handleSelectNone"></span>
|
|
|
- </div>
|
|
|
- <SingleCameraTable
|
|
|
- ref="singleCameraTableRef"
|
|
|
- class="table-bar"
|
|
|
- :table-data="tableData"
|
|
|
- @on-filter="handleFilterTable"
|
|
|
- @on-reset="handleResetTable"
|
|
|
- @on-refresh="getTableData"
|
|
|
- @update:selection="handlePop"
|
|
|
- />
|
|
|
- <Pagination
|
|
|
- v-model:page="tableQueryParams.pageNumber"
|
|
|
- v-model:size="tableQueryParams.pageSize"
|
|
|
- :total="total"
|
|
|
- @update:page="handlePageChange"
|
|
|
- @update:size="handleSizeChange"
|
|
|
- style="margin-bottom: 0"
|
|
|
- />
|
|
|
- <BatchOperationDialog
|
|
|
- v-if="batchOperationVisible"
|
|
|
- :type="batchOperationType"
|
|
|
- :camera-ids="chooseId"
|
|
|
- :all-algo-list="algosInfo"
|
|
|
- @on-confirm="handleConfirmBatchOperation"
|
|
|
- @on-close="handleCloseBatchOperation"
|
|
|
- />
|
|
|
- <div class="batch-param-set" v-if="isBatchParamSetVisible">
|
|
|
- <div class="batch-param-set-header">
|
|
|
- <div class="algo-title">气密人员隔离</div>
|
|
|
- <div class="set-tips">
|
|
|
- <el-icon :size="15"><InfoFilled /></el-icon>
|
|
|
- <div class="tip"
|
|
|
- >当前为默认参数值,请选择具体参数进行修改,提交后,新参数值将对所选相机全部生效,覆盖原有参数值</div
|
|
|
- >
|
|
|
- </div>
|
|
|
- <el-icon class="set-close" :size="24" @click="isBatchParamSetVisible = false"><Close /></el-icon>
|
|
|
+ <div>
|
|
|
+ <QueryForm :algos-info="algosInfo" @on-search="handleQueryTableData" @on-reset="handleResetTableData" />
|
|
|
+ <div v-if="showActionBar" class="action-bar">
|
|
|
+ <span class="num-text">已选{{ chooseNum }}项</span>
|
|
|
+ <el-button :class="isAlgoAdd ? 'btn-active' : 'btn-normal'" @click="handleAlgosAdd" v-if="hasAddPermission()"
|
|
|
+ >算法添加</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ :class="isParamsSet ? 'btn-active' : 'btn-normal'"
|
|
|
+ @click="handleParamsSet"
|
|
|
+ v-if="hasParamSetPermission()"
|
|
|
+ >参数设置</el-button
|
|
|
+ >
|
|
|
+ <el-button :class="isAlgoOpen ? 'btn-active' : 'btn-normal'" @click="handleAlgosOpen">算法开启</el-button>
|
|
|
+ <el-button :class="isAlgoClose ? 'btn-active' : 'btn-normal'" @click="handleAlgosClose">算法关闭</el-button>
|
|
|
+ <el-button
|
|
|
+ :class="isAlgoDelete ? 'btn-active' : 'btn-normal'"
|
|
|
+ @click="handleAlgosDel"
|
|
|
+ v-if="hasDeletePermission()"
|
|
|
+ >算法删除</el-button
|
|
|
+ >
|
|
|
+ <span class="close-btn" @click="handleSelectNone"></span>
|
|
|
</div>
|
|
|
- <AlgoParamsSetting :algo-detail="selectedAlgoDetail" @on-submit="handleSubmit" @on-cancel="handleCancel" />
|
|
|
+ <SingleCameraTable
|
|
|
+ ref="singleCameraTableRef"
|
|
|
+ class="table-bar"
|
|
|
+ :table-data="tableData"
|
|
|
+ @on-filter="handleFilterTable"
|
|
|
+ @on-reset="handleResetTable"
|
|
|
+ @on-refresh="getTableData"
|
|
|
+ @update:selection="handlePop"
|
|
|
+ />
|
|
|
+ <Pagination
|
|
|
+ v-model:page="tableQueryParams.pageNumber"
|
|
|
+ v-model:size="tableQueryParams.pageSize"
|
|
|
+ :total="total"
|
|
|
+ @update:page="handlePageChange"
|
|
|
+ @update:size="handleSizeChange"
|
|
|
+ style="margin-bottom: 0"
|
|
|
+ />
|
|
|
+ <BatchOperationDialog
|
|
|
+ v-if="batchOperationVisible"
|
|
|
+ :type="batchOperationType"
|
|
|
+ :camera-ids="chooseId"
|
|
|
+ :all-algo-list="algosInfo"
|
|
|
+ @on-confirm="handleConfirmBatchOperation"
|
|
|
+ @on-close="handleCloseBatchOperation"
|
|
|
+ />
|
|
|
+ <el-dialog
|
|
|
+ v-model="isBatchParamSetVisible"
|
|
|
+ width="1022"
|
|
|
+ align-center
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ @close="handleCancel"
|
|
|
+ >
|
|
|
+ <template #header>
|
|
|
+ <div class="batch-param-set-header">
|
|
|
+ <div class="algo-title">{{ selectedAlgoDetail?.name }}</div>
|
|
|
+ <div class="set-tips">
|
|
|
+ <el-icon :size="15"><InfoFilled /></el-icon>
|
|
|
+ <div class="tip"
|
|
|
+ >当前显示默认参数值,请选择具体参数进行修改,提交后新参数值将对所选全部相机生效,覆盖原有参数值</div
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <AlgoParamsSetting
|
|
|
+ v-if="selectedAlgoDetail"
|
|
|
+ :algo-detail="selectedAlgoDetail"
|
|
|
+ @on-submit="handleSubmit"
|
|
|
+ @on-cancel="handleCancel"
|
|
|
+ />
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { onMounted, ref } from 'vue';
|
|
|
- import { ElButton, ElIcon } from 'element-plus';
|
|
|
- import { InfoFilled, Close } from '@element-plus/icons-vue';
|
|
|
+ import { ElButton, ElIcon, ElMessage, ElDialog } from 'element-plus';
|
|
|
+ import { InfoFilled } from '@element-plus/icons-vue';
|
|
|
import {
|
|
|
QueryCameraPageByAlgoParams,
|
|
|
QueryCameraPageByAlgoRes,
|
|
|
@@ -62,12 +88,30 @@
|
|
|
addAlgosByBatch,
|
|
|
deleteAlgosByBatch,
|
|
|
updateAlgosStatusByBatch,
|
|
|
+ updateAlgosByBatch,
|
|
|
} from '@/api/camera/camera-config';
|
|
|
import QueryForm from './QueryForm.vue';
|
|
|
import SingleCameraTable from './SingleCameraTable.vue';
|
|
|
import Pagination from '@/components/Pagination/Pagination.vue';
|
|
|
import BatchOperationDialog from './BatchOperationDialog.vue';
|
|
|
- import AlgoParamsSetting from '@/modules/algo/algo-params-edit/index.vue'; // 多相机共同算法配置组件
|
|
|
+ import AlgoParamsSetting from '@/modules/algo/algo-params-edit/index.vue';
|
|
|
+ import { CameraAlgoItemInCard } from '@/modules/algo/algo-params-edit/types';
|
|
|
+ import { createAlgoSubmitParams, algoDetailToJSON } from '@/modules/algo/algo-params-edit/utils';
|
|
|
+ import { useUserStore } from '@/store/modules/user';
|
|
|
+ import { PERM_ALGO } from '@/types/permission/constants';
|
|
|
+
|
|
|
+ const userStore = useUserStore();
|
|
|
+
|
|
|
+ // 权限设置
|
|
|
+ const hasAddPermission = () => {
|
|
|
+ return userStore.checkPermission(PERM_ALGO.CONFIG_ADD);
|
|
|
+ };
|
|
|
+ const hasDeletePermission = () => {
|
|
|
+ return userStore.checkPermission(PERM_ALGO.CONFIG_DELETE);
|
|
|
+ };
|
|
|
+ const hasParamSetPermission = () => {
|
|
|
+ return userStore.checkPermission(PERM_ALGO.CONFIG_PARAM);
|
|
|
+ };
|
|
|
|
|
|
const tableQueryParams = ref<QueryCameraPageByAlgoParams>({
|
|
|
pageNumber: 1,
|
|
|
@@ -93,7 +137,8 @@
|
|
|
const batchOperationType = ref('');
|
|
|
const batchOperationVisible = ref(false);
|
|
|
// 批量参数设置
|
|
|
- const isBatchParamSetVisible = ref(true);
|
|
|
+ const isBatchParamSetVisible = ref(false);
|
|
|
+ const selectedAlgoDetail = ref<CameraAlgoItemInCard>(); // 批量参数设置组件的参数
|
|
|
|
|
|
// 查询
|
|
|
const handleQueryTableData = (queryParams) => {
|
|
|
@@ -209,30 +254,37 @@
|
|
|
};
|
|
|
// 批量操作弹窗
|
|
|
const handleConfirmBatchOperation = (algoIds) => {
|
|
|
- console.log('algoIds', algoIds);
|
|
|
- console.log('batchOperationType.value', batchOperationType.value);
|
|
|
- // 这里可以根据不同的操作类型,调用不同的接口
|
|
|
if (batchOperationType.value === 'add') {
|
|
|
addAlgosByBatch({ cameraIdList: chooseId.value, algoIdList: algoIds }).then(() => {
|
|
|
+ ElMessage({ type: 'success', message: '算法添加成功' });
|
|
|
handleCloseBatchOperation();
|
|
|
+ getTableData();
|
|
|
});
|
|
|
}
|
|
|
if (batchOperationType.value === 'set') {
|
|
|
isBatchParamSetVisible.value = true;
|
|
|
+ const algoDetail = algosInfo.value.find((item) => item.id === algoIds[0]);
|
|
|
+ selectedAlgoDetail.value = algoDetailToJSON(algoDetail);
|
|
|
}
|
|
|
if (batchOperationType.value === 'open') {
|
|
|
updateAlgosStatusByBatch({ cameraIdList: chooseId.value, algoIdList: algoIds, isEnabled: true }).then(() => {
|
|
|
+ ElMessage({ type: 'success', message: '算法开启成功' });
|
|
|
handleCloseBatchOperation();
|
|
|
+ getTableData();
|
|
|
});
|
|
|
}
|
|
|
if (batchOperationType.value === 'close') {
|
|
|
updateAlgosStatusByBatch({ cameraIdList: chooseId.value, algoIdList: algoIds, isEnabled: false }).then(() => {
|
|
|
+ ElMessage({ type: 'success', message: '算法关闭成功' });
|
|
|
handleCloseBatchOperation();
|
|
|
+ getTableData();
|
|
|
});
|
|
|
}
|
|
|
if (batchOperationType.value === 'delete') {
|
|
|
deleteAlgosByBatch({ cameraIdList: chooseId.value, algoIdList: algoIds }).then(() => {
|
|
|
+ ElMessage({ type: 'success', message: '算法删除成功' });
|
|
|
handleCloseBatchOperation();
|
|
|
+ getTableData();
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
@@ -240,7 +292,21 @@
|
|
|
batchOperationType.value = '';
|
|
|
batchOperationVisible.value = false;
|
|
|
handleResetBtnStatus();
|
|
|
- getTableData();
|
|
|
+ };
|
|
|
+
|
|
|
+ // 批量参数设置提交
|
|
|
+ const handleSubmit = (param) => {
|
|
|
+ const newParam = createAlgoSubmitParams(param, selectedAlgoDetail.value);
|
|
|
+ updateAlgosByBatch({
|
|
|
+ cameraIdList: chooseId.value,
|
|
|
+ ...newParam,
|
|
|
+ }).then(() => {
|
|
|
+ ElMessage({ type: 'success', message: '参数设置成功' });
|
|
|
+ isBatchParamSetVisible.value = false;
|
|
|
+ });
|
|
|
+ };
|
|
|
+ const handleCancel = () => {
|
|
|
+ isBatchParamSetVisible.value = false;
|
|
|
};
|
|
|
|
|
|
// 换页,重新获取表格
|
|
|
@@ -264,7 +330,6 @@
|
|
|
getTableData();
|
|
|
getAlgosInfo().then((res) => {
|
|
|
algosInfo.value = res;
|
|
|
- console.log('algosInfo', algosInfo.value);
|
|
|
});
|
|
|
});
|
|
|
</script>
|
|
|
@@ -315,49 +380,31 @@
|
|
|
position: relative;
|
|
|
}
|
|
|
|
|
|
- .batch-param-set {
|
|
|
- width: 1030px;
|
|
|
- height: 550px;
|
|
|
- padding: 20px;
|
|
|
- border-radius: 4px;
|
|
|
- box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.1);
|
|
|
- background-color: #ffffff;
|
|
|
- z-index: 20;
|
|
|
- position: absolute;
|
|
|
- top: 50%;
|
|
|
- left: 50%;
|
|
|
- transform: translate(-50%, -50%);
|
|
|
-
|
|
|
- .batch-param-set-header {
|
|
|
- width: 100%;
|
|
|
- height: 80px;
|
|
|
- border-bottom: 1px solid #e4e7ec;
|
|
|
- margin-bottom: 20px;
|
|
|
- position: relative;
|
|
|
-
|
|
|
- .algo-title {
|
|
|
- font-size: 20px;
|
|
|
- font-weight: 600;
|
|
|
- color: #000000;
|
|
|
- }
|
|
|
+ .batch-param-set-header {
|
|
|
+ width: 100%;
|
|
|
+ height: 80px;
|
|
|
+ border-bottom: 1px solid #e4e7ec;
|
|
|
+ position: relative;
|
|
|
|
|
|
- .set-tips {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- margin-top: 10px;
|
|
|
- color: #66abeb;
|
|
|
+ .algo-title {
|
|
|
+ font-size: 20px;
|
|
|
+ font-weight: 600;
|
|
|
+ color: #000000;
|
|
|
+ }
|
|
|
|
|
|
- .tip {
|
|
|
- margin-left: 2px;
|
|
|
- }
|
|
|
- }
|
|
|
+ .set-tips {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-top: 10px;
|
|
|
+ color: #66abeb;
|
|
|
|
|
|
- .set-close {
|
|
|
- position: absolute;
|
|
|
- top: 0;
|
|
|
- right: 0;
|
|
|
- cursor: pointer;
|
|
|
+ .tip {
|
|
|
+ margin-left: 2px;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ :deep(.el-dialog__header) {
|
|
|
+ padding-right: 0px;
|
|
|
+ }
|
|
|
</style>
|