fix:根据ui修改样式 添加逻辑判断

This commit is contained in:
zhaohy
2024-08-21 13:35:28 +08:00
parent def744926f
commit ece2712b09
14 changed files with 113 additions and 64 deletions

View File

@@ -104,10 +104,12 @@
<span class="title-name" style="line-height: 32px; margin-left: 32px">{{
`数值${index}:`
}}</span>
<a-input
<a-input-number
style="width: 110px; margin-left: 6px"
type="number"
placeholder="请输入数值"
:min="-99999999.99"
:max="99999999.99"
:precision="2"
v-model:value="infoObject.alarmList[index - 1].num" />
<div
v-if="index > 1 && index === infoObject.alarmList?.length"
@@ -410,6 +412,14 @@
return false;
}
}
const numSet = new Set();
for (const item of infoObject.value.alarmList) {
if (numSet.has(item.num)) {
NsMessage.error('请输入正确数值');
return false; // 如果 num 已经存在于 Set 中,说明有重复,返回 false
}
numSet.add(item.num); // 添加 num 到 Set 中
}
if (infoObject.value.alarmList.length < 2) {
NsMessage.error('请选择逻辑和数值');

View File

@@ -115,10 +115,12 @@
<span class="title-name" style="line-height: 32px; margin-left: 32px">{{
`数值${index}:`
}}</span>
<a-input
<a-input-number
style="width: 110px; margin-left: 6px"
type="number"
placeholder="请输入数值"
:min="-99999999.99"
:max="99999999.99"
:precision="2"
v-model:value="infoObject.alarmList[index - 1].num" />
<div
v-if="index > 1 && index === infoObject.alarmList?.length"
@@ -424,6 +426,14 @@
return false;
}
}
const numSet = new Set();
for (const item of infoObject.value.alarmList) {
if (numSet.has(item.num)) {
NsMessage.error('请输入正确数值');
return false; // 如果 num 已经存在于 Set 中,说明有重复,返回 false
}
numSet.add(item.num); // 添加 num 到 Set 中
}
if (infoObject.value.alarmList.length < 2) {
NsMessage.error('请选择逻辑和数值');

View File

@@ -25,7 +25,11 @@
@change="handleChangeAlarmFrequency" />
</a-form-item>
<a-form-item v-if="infoObject.alarmFrequency === 2" name="repetitions" label="重复次数">
<ns-input-number v-model:value="infoObject.repetitions" placeholder="请输入重复次数" />
<ns-input-number
v-model:value="infoObject.repetitions"
:min="0"
:max="99"
placeholder="请输入重复次数" />
</a-form-item>
<a-form-item
v-if="infoObject.alarmFrequency === 2 || infoObject.alarmFrequency === 3"
@@ -34,6 +38,8 @@
<ns-input-number
style="width: 100%"
v-model:value="infoObject.intervalDuration"
:min="0"
:max="99"
placeholder="请输入间隔时长">
<template #addonAfter>
<a-select
@@ -49,6 +55,8 @@
<ns-input-number
allowClear
style="width: 100%"
:min="0"
:max="999"
v-model:value="infoObject.monitorTime"
placeholder="请输入监测时长">
<template #addonAfter>
@@ -357,6 +365,7 @@
display: flex;
justify-content: space-between;
}
.title {
width: 200px;
height: 22px;
@@ -370,6 +379,7 @@
margin-bottom: 24px;
margin-left: 24px;
}
.blue-background.ant-switch-checked {
background-color: linear-gradient(
180deg,
@@ -393,24 +403,30 @@
.grey-background.ant-switch .ant-switch-handle {
background-color: alarmSettings !important;
}
.ant-switch-checked {
background-color: rgba(57, 215, 187, 1) !important;
}
:deep(.ant-form-item-label) {
z-index: 20;
text-align: right;
width: 23%;
}
// 禁选时 选择框的样式
:deep(.ant-radio-disabled .ant-radio-inner::after) {
background-color: #2778ff !important;
}
:deep(.ant-radio-checked .ant-radio-inner) {
border-color: #2778ff !important;
}
:deep(.ant-radio-inner) {
background-color: white !important;
}
:deep(.ant-radio-disabled + span) {
color: rgba(51, 51, 51, 1);
}

View File

@@ -49,7 +49,7 @@
@click="clickSwitch" />
</a-form-item>
</a-form>
<div style="width: 100%; height: 765px; overflow-y: auto">
<div style="width: 100%; height: 640px; overflow-y: auto">
<div style="margin-bottom: 8px; width: 100%; display: flex">
<div
style="

View File

@@ -142,18 +142,18 @@
infoObject.value = { ...logList.value[0] };
infoObject.value.state = infoObject.value.state.value;
let colorMap = {
1: 'rgba(191, 205, 226, 1)',
2: 'rgba(243, 97, 99, 1)',
1: 'rgba(255, 188, 70, 1)',
2: 'rgba(67, 136, 251, 1)',
3: 'rgba(41, 196, 154, 1)',
4: 'rgba(217, 0, 27,1)',
5: 'rgba(166, 166, 166,1)',
4: 'rgba(243, 97, 99, 1)',
5: 'rgba(141, 150, 163, 1)',
};
let bgColorMap = {
1: 'rgba(191, 205, 226, 0.1)',
2: 'rgba(243, 97, 99, 0.1)',
1: 'rgba(255, 188, 70, 0.1)',
2: 'rgba(67, 136, 251, 0.1)',
3: 'rgba(41, 196, 154, 0.1)',
4: 'rgba(217, 0, 27, 0.1)',
5: 'rgba(166, 166, 166,0.1)',
4: 'rgba(243, 97, 99, 0.1)',
5: 'rgba(141, 150, 163, 0.1)',
};
logList.value.forEach((item) => {
item.stateName = item.state.label;

View File

@@ -143,18 +143,18 @@
infoObject.value = { ...logList.value[0] };
infoObject.value.state = infoObject.value.state.value;
let colorMap = {
1: 'rgba(191, 205, 226, 1)',
2: 'rgba(243, 97, 99, 1)',
1: 'rgba(255, 188, 70, 1)',
2: 'rgba(67, 136, 251, 1)',
3: 'rgba(41, 196, 154, 1)',
4: 'rgba(217, 0, 27,1)',
5: 'rgba(166, 166, 166,1)',
4: 'rgba(243, 97, 99, 1)',
5: 'rgba(141, 150, 163, 1)',
};
let bgColorMap = {
1: 'rgba(191, 205, 226, 0.1)',
2: 'rgba(243, 97, 99, 0.1)',
1: 'rgba(255, 188, 70, 0.1)',
2: 'rgba(67, 136, 251, 0.1)',
3: 'rgba(41, 196, 154, 0.1)',
4: 'rgba(217, 0, 27, 0.1)',
5: 'rgba(166, 166, 166,0.1)',
4: 'rgba(243, 97, 99, 0.1)',
5: 'rgba(141, 150, 163, 0.1)',
};
logList.value.forEach((item) => {
item.stateName = item.state.label;

View File

@@ -60,18 +60,18 @@
5: '已关闭',
};
let colorMap = {
1: 'rgba(191, 205, 226, 1)',
2: 'rgba(243, 97, 99, 1)',
1: 'rgba(255, 188, 70, 1)',
2: 'rgba(67, 136, 251, 1)',
3: 'rgba(41, 196, 154, 1)',
4: 'rgba(217, 0, 27,1)',
5: 'rgba(166, 166, 166,1)',
4: 'rgba(243, 97, 99, 1)',
5: 'rgba(141, 150, 163, 1)',
};
let bgColorMap = {
1: 'rgba(191, 205, 226, 0.1)',
2: 'rgba(243, 97, 99, 0.1)',
1: 'rgba(255, 188, 70, 0.1)',
2: 'rgba(67, 136, 251, 0.1)',
3: 'rgba(41, 196, 154, 0.1)',
4: 'rgba(217, 0, 27, 0.1)',
5: 'rgba(166, 166, 166,0.1)',
4: 'rgba(243, 97, 99, 0.1)',
5: 'rgba(141, 150, 163, 0.1)',
};
logList.value.forEach((item) => {
item.stateName = stateMap[item.state];