|
|
@@ -1,31 +1,39 @@
|
|
|
<template>
|
|
|
- <div class="algoCardWrapper">
|
|
|
+ <div id="algoCardWrapper" class="algoCardWrapper">
|
|
|
<div class="algoCardTitle">
|
|
|
<div>{{ selectedAlgoDetail?.algoInfo?.name }}</div>
|
|
|
- <ElSwitch
|
|
|
- v-model="selectedAlgoDetail.enableCardBool"
|
|
|
- size="small"
|
|
|
- @change="handleAlgoEnable"
|
|
|
- />
|
|
|
+ <div style="display: flex; align-items: center">
|
|
|
+ <ElSwitch
|
|
|
+ v-model="selectedAlgoDetail.enableCardBool"
|
|
|
+ size="small"
|
|
|
+ @change="handleAlgoEnable"
|
|
|
+ />
|
|
|
+ <el-tooltip class="box-item" effect="dark" placement="top">
|
|
|
+ <template #content> 关闭后该算法对<br />此台相机不生效</template>
|
|
|
+ <el-icon color="#d4d5d8" :size="16" class="tipIcon"><InfoCircleOutlined /></el-icon>
|
|
|
+ </el-tooltip>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="algoCardMain">
|
|
|
- <div class="algoRow">
|
|
|
+ <div class="algoRow" style="display: flex; align-items: center">
|
|
|
<div class="algoLabel">绘制电子围栏:</div>
|
|
|
<div>
|
|
|
<div style="display: flex; align-items: center">
|
|
|
<ElSwitch v-model="selectedAlgoDetail.electronicFenceBool" size="small" />
|
|
|
- <el-tooltip
|
|
|
- class="box-item"
|
|
|
- effect="dark"
|
|
|
- content="打开开关,绘制电子围栏。"
|
|
|
- placement="top"
|
|
|
- >
|
|
|
- <el-icon color="#e2e2e2" class="tipIcon"><InfoCircleOutlined /></el-icon>
|
|
|
+ <el-tooltip class="box-item" effect="dark" placement="top">
|
|
|
+ <template #content>
|
|
|
+ 默认检测全部范围,如需<br />指定范围,可打开开关,<br />在相机界面完成绘制
|
|
|
+ </template>
|
|
|
+ <el-icon color="#e2e2e2" :size="16" class="tipIcon"><InfoCircleOutlined /></el-icon>
|
|
|
</el-tooltip>
|
|
|
<!-- <span style="font-size: 10px; margin-left: 20px; color: #262626"
|
|
|
>备注:请绘制电子围栏</span
|
|
|
> -->
|
|
|
- <el-radio-group v-model="selectedAlgoDetail.regionJudge" class="ml-4">
|
|
|
+ <el-radio-group
|
|
|
+ v-model="selectedAlgoDetail.regionJudge"
|
|
|
+ :disabled="!selectedAlgoDetail.electronicFenceBool"
|
|
|
+ class="ml-3"
|
|
|
+ >
|
|
|
<el-radio :label="0">内</el-radio>
|
|
|
<el-radio :label="1">外</el-radio>
|
|
|
</el-radio-group>
|
|
|
@@ -52,7 +60,11 @@
|
|
|
<div class="algoRow">
|
|
|
<div class="algoLabel">检测元数据:</div>
|
|
|
<div class="algoTimeContent">
|
|
|
- <div class="timeAdd" @click="handleAddMetaObj">
|
|
|
+ <div
|
|
|
+ class="timeAdd"
|
|
|
+ :class="{ addDisable: unEmptyLabels.length >= selectedAlgoDetail.metaValues.length }"
|
|
|
+ @click="handleAddMetaObj"
|
|
|
+ >
|
|
|
<el-icon color="#d0d0d0"><Plus /></el-icon>
|
|
|
</div>
|
|
|
<div class="timeList">
|
|
|
@@ -98,11 +110,13 @@
|
|
|
:min="1"
|
|
|
size="small"
|
|
|
style="width: 186px"
|
|
|
+ placeholder="请输入允许的最长时间"
|
|
|
+ @blur="checkTimeWindowValid"
|
|
|
/>
|
|
|
<span style="font-size: 12px; margin-left: 5px">S</span>
|
|
|
</div>
|
|
|
<div style="display: flex; justify-content: flex-end">
|
|
|
- <ElButton size="small" @click="handleRemoveAlgo" :disabled="!selectedAlgoId">删除</ElButton>
|
|
|
+ <ElButton size="small" :disabled="!selectedAlgoId" @click="handleRemoveAlgo">取消</ElButton>
|
|
|
<ElButton size="small" type="primary" @click="handleSave" :disabled="!selectedAlgoId"
|
|
|
>保存</ElButton
|
|
|
>
|
|
|
@@ -118,6 +132,7 @@
|
|
|
ElInputNumber,
|
|
|
ElTimePicker,
|
|
|
ElMessage,
|
|
|
+ ElMessageBox,
|
|
|
} from 'element-plus';
|
|
|
import { CircleCloseFilled, Plus } from '@element-plus/icons-vue';
|
|
|
import { storeToRefs } from 'pinia';
|
|
|
@@ -130,7 +145,7 @@
|
|
|
import PeriodCard from './AlgoPeriodCard.vue';
|
|
|
import ParamCard from './AlgoParamsCard.vue';
|
|
|
import { uid } from 'uid';
|
|
|
- import { ref } from 'vue';
|
|
|
+ import { computed, ref } from 'vue';
|
|
|
|
|
|
// const { data: algoList, loading } = useAllAlgos();
|
|
|
const cameraAlgoStore = useCameraAlgoStore();
|
|
|
@@ -157,7 +172,7 @@
|
|
|
|
|
|
const emits = defineEmits<{
|
|
|
(e: 'onSubmit', param: Param): Promise<unknown>;
|
|
|
- (e: 'onRemove', algoId: number): Promise<unknown>;
|
|
|
+ (e: 'onCancel', algoId: number): Promise<unknown>;
|
|
|
}>();
|
|
|
|
|
|
const periodCardRefs = ref<any>([]);
|
|
|
@@ -175,19 +190,22 @@
|
|
|
selectedAlgoDetail.value.timeRangeArr.push(createDefaultTime());
|
|
|
};
|
|
|
|
|
|
+ const unEmptyLabels = computed(() => {
|
|
|
+ return selectedAlgoDetail.value.metaValues.filter((item) => item.label);
|
|
|
+ });
|
|
|
+
|
|
|
const handleAddMetaObj = () => {
|
|
|
- const unemptyList = selectedAlgoDetail.value.metaValues.filter((item) => item.label);
|
|
|
- if (unemptyList.length < selectedAlgoDetail.value.metaValues.length) {
|
|
|
+ if (unEmptyLabels.value.length < selectedAlgoDetail.value.metaValues.length) {
|
|
|
selectedAlgoDetail.value.metaValues
|
|
|
.filter((item) => !item.label)
|
|
|
.forEach((val) => markedParamCardIds.value.push(val.id));
|
|
|
ElMessage.error('存在未完善的检测元数据');
|
|
|
return;
|
|
|
}
|
|
|
- if (unemptyList.length == metaObjList.value.length) {
|
|
|
- ElMessage.warning('暂无更多检测对象');
|
|
|
- return;
|
|
|
- }
|
|
|
+ // if (unemptyList.length == metaObjList.value.length) {
|
|
|
+ // ElMessage.warning('暂无更多检测对象');
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
selectedAlgoDetail.value.metaValues.push({ id: uid() } as AlgoParamMetaItem);
|
|
|
};
|
|
|
|
|
|
@@ -213,6 +231,10 @@
|
|
|
);
|
|
|
};
|
|
|
|
|
|
+ const checkTimeWindowValid = () => {
|
|
|
+ selectedAlgoDetail.value.timeWindow = Math.ceil(selectedAlgoDetail.value.timeWindow || 1);
|
|
|
+ };
|
|
|
+
|
|
|
const handleSave = async () => {
|
|
|
//判断时间段是否合格
|
|
|
if (markedTimeRangeIds.value.length > 0) {
|
|
|
@@ -249,23 +271,22 @@
|
|
|
//判断元数据是否合格
|
|
|
for (let i = 0; i < paramCardRefs.value.length; i++) {
|
|
|
const item = paramCardRefs.value[i];
|
|
|
- await item.checkValid().then((res) => {
|
|
|
- if (res) {
|
|
|
- } else {
|
|
|
- ElMessage.error('请正确填写检测元数据');
|
|
|
- return;
|
|
|
- }
|
|
|
- });
|
|
|
+ const res = await item.checkValid();
|
|
|
+ if (res) {
|
|
|
+ } else {
|
|
|
+ ElMessage.error('请正确填写检测元数据');
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//判断时间段和元数据都有值
|
|
|
const detail = selectedAlgoDetail.value;
|
|
|
if (!detail) return;
|
|
|
const timeRanges = detail.timeRangeArr;
|
|
|
- if (timeRanges.length == 0) {
|
|
|
- ElMessage.error('至少添加一个检测时间段');
|
|
|
- return;
|
|
|
- }
|
|
|
+ // if (timeRanges.length == 0) {
|
|
|
+ // ElMessage.error('至少添加一个检测时间段');
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
const metaValues = detail.metaValues;
|
|
|
if (metaValues.length == 0) {
|
|
|
ElMessage.error('至少添加一个检测元数据');
|
|
|
@@ -320,7 +341,22 @@
|
|
|
|
|
|
const handleRemoveAlgo = () => {
|
|
|
if (!selectedAlgoId.value) return;
|
|
|
- emits('onRemove', selectedAlgoId.value);
|
|
|
+ const el = document.getElementById('algoCardWrapper') as HTMLElement;
|
|
|
+ ElMessageBox.confirm(
|
|
|
+ '<strong>确认取消算法配置吗?</strong><br />取消后配置的参数将不会被保存。',
|
|
|
+ '',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
|
+ appendTo: el,
|
|
|
+ },
|
|
|
+ )
|
|
|
+ .then(() => {
|
|
|
+ emits('onCancel', selectedAlgoId.value!);
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
};
|
|
|
</script>
|
|
|
<style scoped>
|
|
|
@@ -328,7 +364,7 @@
|
|
|
border: 1px solid #ccc;
|
|
|
border-radius: 4px;
|
|
|
/* padding: 10px; */
|
|
|
- width: 770px;
|
|
|
+ width: 780px;
|
|
|
}
|
|
|
|
|
|
.algoRow {
|
|
|
@@ -338,6 +374,8 @@
|
|
|
|
|
|
.algoLabel {
|
|
|
margin-right: 10px;
|
|
|
+ width: 90px;
|
|
|
+ text-align: right;
|
|
|
}
|
|
|
.algoTimeContent {
|
|
|
display: flex;
|
|
|
@@ -365,7 +403,7 @@
|
|
|
}
|
|
|
|
|
|
.algoCardMain {
|
|
|
- padding: 10px 20px;
|
|
|
+ padding: 10px 15px;
|
|
|
}
|
|
|
|
|
|
.timeAdd {
|
|
|
@@ -378,9 +416,15 @@
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
margin-right: 5px;
|
|
|
+ cursor: pointer;
|
|
|
}
|
|
|
+ .addDisable {
|
|
|
+ opacity: 0.5;
|
|
|
+ cursor: not-allowed;
|
|
|
+ }
|
|
|
+
|
|
|
.timeList {
|
|
|
- width: 608px;
|
|
|
+ width: 610px;
|
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|
|
|
align-items: flex-start;
|
|
|
@@ -388,4 +432,12 @@
|
|
|
.tipIcon {
|
|
|
margin-left: 10px;
|
|
|
}
|
|
|
+
|
|
|
+ :deep(.ml-4) {
|
|
|
+ margin-left: 0 !important;
|
|
|
+ }
|
|
|
+ :deep(.el-message-box__status.el-icon) {
|
|
|
+ top: 0 !important;
|
|
|
+ transform: none !important;
|
|
|
+ }
|
|
|
</style>
|