2025年05月12日18:30:46

This commit is contained in:
luojiayi 2025-05-12 18:30:50 +08:00
parent 6d5621fa91
commit c6c2e541f8
2 changed files with 13 additions and 0 deletions

View File

@ -22,6 +22,7 @@
</el-col>
<el-col :span="6">
<div class="item"><span>固件版本</span>{{ query.deviceVersion }}</div>
<div class="item"><span>紧急联系人</span>{{ query.deviceVersion }}</div>
</el-col>
</el-row>
</el-card>

View File

@ -136,6 +136,9 @@ const getDeviceConfig = () => {
phone: item.phone,
};
});
for (let i = 0; i <= 3 - arr.length; i++) {
arr.push({ name: "", phone: "" });
}
ruleForm.value = {
...res,
contacts: arr.length
@ -152,6 +155,15 @@ const submitForm = async (formEl: FormInstance | undefined) => {
if (!formEl) return;
await formEl.validate((valid) => {
if (valid) {
for (let i = 1; i < ruleForm.value.contacts.length; i++) {
let item = ruleForm.value.contacts[i];
if (!item.name && item.phone) {
return ElMessage.error(`请输入姓名${i + 1}`);
}
if (item.name && !item.phone) {
return ElMessage.error(`请输入紧急电话${i + 1}`);
}
}
deviceConfigModify({
...ruleForm.value,
contacts: ruleForm.value.contacts,