Browse Source

fix:输入限制空格 数值范围

temp
zhaohy 3 months ago
parent
commit
129ef8845a
  1. 11
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editConfigureEnergyAlarm.vue
  2. 20
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editeEnergyAlarm.vue
  3. 12
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue
  4. 21
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue
  5. 10
      hx-ai-intelligent/src/view/alarmManagement/energyAlarm/status.vue
  6. 8
      hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/status.vue

11
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editConfigureEnergyAlarm.vue

@ -76,6 +76,7 @@
style="height: 32px" style="height: 32px"
placeholder="请输入异常描述" placeholder="请输入异常描述"
:autoSize="{ minRows: 1, maxRows: 1 }" :autoSize="{ minRows: 1, maxRows: 1 }"
@keydown="handleKeyDown"
show-count show-count
:maxlength="30" /> :maxlength="30" />
</a-form-item> </a-form-item>
@ -107,8 +108,8 @@
<a-input-number <a-input-number
style="width: 110px; margin-left: 6px" style="width: 110px; margin-left: 6px"
placeholder="请输入数值" placeholder="请输入数值"
:min="-99999999.99" :min="-9999999999.99"
:max="99999999.99" :max="9999999999.99"
:precision="2" :precision="2"
v-model:value="infoObject.alarmList[index - 1].num" /> v-model:value="infoObject.alarmList[index - 1].num" />
<div <div
@ -294,6 +295,12 @@
infoObject.value.enableRules = 1; infoObject.value.enableRules = 1;
} }
}; };
const handleKeyDown = (event: KeyboardEvent) => {
// Check if the pressed key is a space
if (event.code === 'Space') {
event.preventDefault();
}
};
// //
const toggle = async (value: any, info: any) => { const toggle = async (value: any, info: any) => {
let enumData = await getEnum({ params: { enumType: 'LogicEnum' } }); let enumData = await getEnum({ params: { enumType: 'LogicEnum' } });

20
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editeEnergyAlarm.vue

@ -13,7 +13,12 @@
</div> </div>
<a-form ref="formRef" :model="infoObject" :rules="rules"> <a-form ref="formRef" :model="infoObject" :rules="rules">
<a-form-item name="alarmTitle" label="告警标题"> <a-form-item name="alarmTitle" label="告警标题">
<ns-input allowClear v-model:value="infoObject.alarmTitle" placeholder="请输入告警标题" /> <ns-input
allowClear
:maxlength="20"
v-model:value="infoObject.alarmTitle"
@keydown="handleKeyDown"
placeholder="请输入告警标题" />
</a-form-item> </a-form-item>
<a-form-item label="告警频率" name="alarmFrequency"> <a-form-item label="告警频率" name="alarmFrequency">
<a-select <a-select
@ -25,7 +30,11 @@
@change="handleChangeAlarmFrequency" /> @change="handleChangeAlarmFrequency" />
</a-form-item> </a-form-item>
<a-form-item v-if="infoObject.alarmFrequency === 2" name="repetitions" label="重复次数"> <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>
<a-form-item label="优先级" name="priority"> <a-form-item label="优先级" name="priority">
<a-select <a-select
@ -153,6 +162,13 @@
AlarmFrequencyEnum.value = enumData.data.AlarmFrequencyEnum; AlarmFrequencyEnum.value = enumData.data.AlarmFrequencyEnum;
intervalDurationUnitData.value = enumData.data.IntervalDurationUnitEnum; intervalDurationUnitData.value = enumData.data.IntervalDurationUnitEnum;
}; };
//
const handleKeyDown = (event: KeyboardEvent) => {
// Check if the pressed key is a space
if (event.code === 'Space') {
event.preventDefault();
}
};
const toggle = (value: any) => { const toggle = (value: any) => {
// //
getMenu(); getMenu();

12
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue

@ -95,6 +95,7 @@
placeholder="请输入异常描述" placeholder="请输入异常描述"
:autoSize="{ minRows: 1, maxRows: 1 }" :autoSize="{ minRows: 1, maxRows: 1 }"
show-count show-count
@keydown="handleKeyDown"
:maxlength="30" /> :maxlength="30" />
</a-form-item> </a-form-item>
<a-form-item label="规则类型" name="ruleType"> <a-form-item label="规则类型" name="ruleType">
@ -118,8 +119,8 @@
<a-input-number <a-input-number
style="width: 110px; margin-left: 6px" style="width: 110px; margin-left: 6px"
placeholder="请输入数值" placeholder="请输入数值"
:min="-99999999.99" :min="-9999999999.99"
:max="99999999.99" :max="9999999999.99"
:precision="2" :precision="2"
v-model:value="infoObject.alarmList[index - 1].num" /> v-model:value="infoObject.alarmList[index - 1].num" />
<div <div
@ -276,6 +277,13 @@
infoObject.value.enableRules = 1; infoObject.value.enableRules = 1;
} }
}; };
//
const handleKeyDown = (event: KeyboardEvent) => {
// Check if the pressed key is a space
if (event.code === 'Space') {
event.preventDefault();
}
};
const emit = defineEmits(['editObject']); const emit = defineEmits(['editObject']);
// id // id

21
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue

@ -13,7 +13,12 @@
</div> </div>
<a-form ref="formRef" :model="infoObject" :rules="rules"> <a-form ref="formRef" :model="infoObject" :rules="rules">
<a-form-item name="alarmTitle" label="告警标题"> <a-form-item name="alarmTitle" label="告警标题">
<ns-input allowClear v-model:value="infoObject.alarmTitle" placeholder="请输入告警标题" /> <ns-input
:maxlength="20"
allowClear
v-model:value="infoObject.alarmTitle"
@keydown="handleKeyDown"
placeholder="请输入告警标题" />
</a-form-item> </a-form-item>
<a-form-item label="告警频率" name="alarmFrequency"> <a-form-item label="告警频率" name="alarmFrequency">
<a-select <a-select
@ -27,7 +32,7 @@
<a-form-item v-if="infoObject.alarmFrequency === 2" name="repetitions" label="重复次数"> <a-form-item v-if="infoObject.alarmFrequency === 2" name="repetitions" label="重复次数">
<ns-input-number <ns-input-number
v-model:value="infoObject.repetitions" v-model:value="infoObject.repetitions"
:min="0" :min="1"
:max="99" :max="99"
placeholder="请输入重复次数" /> placeholder="请输入重复次数" />
</a-form-item> </a-form-item>
@ -38,8 +43,9 @@
<ns-input-number <ns-input-number
style="width: 100%" style="width: 100%"
v-model:value="infoObject.intervalDuration" v-model:value="infoObject.intervalDuration"
:min="0" :min="1"
:max="99" :max="99"
@keydown="handleKeyDown"
placeholder="请输入间隔时长"> placeholder="请输入间隔时长">
<template #addonAfter> <template #addonAfter>
<a-select <a-select
@ -55,7 +61,7 @@
<ns-input-number <ns-input-number
allowClear allowClear
style="width: 100%" style="width: 100%"
:min="0" :min="1"
:max="999" :max="999"
v-model:value="infoObject.monitorTime" v-model:value="infoObject.monitorTime"
placeholder="请输入监测时长"> placeholder="请输入监测时长">
@ -258,6 +264,13 @@
priority: [{ required: true, message: '请选择优先级', trigger: 'change' }], priority: [{ required: true, message: '请选择优先级', trigger: 'change' }],
// monitorTimeUnit: [{ required: true, message: '', trigger: 'change' }], // monitorTimeUnit: [{ required: true, message: '', trigger: 'change' }],
}; };
//
const handleKeyDown = (event: KeyboardEvent) => {
// Check if the pressed key is a space
if (event.code === 'Space') {
event.preventDefault();
}
};
// //
const changeSwitch = () => { const changeSwitch = () => {
switch (infoObject.value.enableRules) { switch (infoObject.value.enableRules) {

10
hx-ai-intelligent/src/view/alarmManagement/energyAlarm/status.vue

@ -29,9 +29,10 @@
<a-form-item label="备注" name="remarks"> <a-form-item label="备注" name="remarks">
<a-textarea <a-textarea
v-model:value="infoObject.remarks" v-model:value="infoObject.remarks"
placeholder="请输入异常描述" placeholder="请输入备注"
:disabled="showEdit" :disabled="showEdit"
style="width: 85%" style="width: 85%"
@keydown="handleKeyDown"
:autoSize="{ minRows: 9, maxRows: 9 }" /> :autoSize="{ minRows: 9, maxRows: 9 }" />
</a-form-item> </a-form-item>
</a-form> </a-form>
@ -166,6 +167,12 @@
} }
}); });
}; };
const handleKeyDown = (event) => {
// Check if the pressed key is a space
if (event.code === 'Space') {
event.preventDefault();
}
};
return { return {
infoObject, infoObject,
changeShowEdit, changeShowEdit,
@ -178,6 +185,7 @@
visible, visible,
logList, logList,
config, config,
handleKeyDown,
handleClose, handleClose,
toggle, toggle,
}; };

8
hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/status.vue

@ -32,6 +32,7 @@
placeholder="请输入备注" placeholder="请输入备注"
:disabled="showEdit" :disabled="showEdit"
style="width: 85%" style="width: 85%"
@keydown="handleKeyDown"
:autoSize="{ minRows: 4, maxRows: 4 }" /> :autoSize="{ minRows: 4, maxRows: 4 }" />
</a-form-item> </a-form-item>
</a-form> </a-form>
@ -125,6 +126,12 @@
showEdit.value = !showEdit.value; showEdit.value = !showEdit.value;
} }
}; };
const handleKeyDown = (event) => {
// Check if the pressed key is a space
if (event.code === 'Space') {
event.preventDefault();
}
};
const toggle = async (data) => { const toggle = async (data) => {
equipmentAlarm.value = { ...data }; equipmentAlarm.value = { ...data };
visible.value = true; visible.value = true;
@ -173,6 +180,7 @@
changeShowEdit, changeShowEdit,
showEdit, showEdit,
equipmentAlarm, equipmentAlarm,
handleKeyDown,
stateOptions, stateOptions,
btnClick, btnClick,
visible, visible,

Loading…
Cancel
Save