只在添加或修改MX和SRV类型的记录时显示优先级

This commit is contained in:
jingrow 2025-08-04 23:10:53 +08:00
parent 6d05fa9fdf
commit 3cfab004f0

View File

@ -213,7 +213,7 @@
</td> </td>
<td class="px-4 py-4 whitespace-nowrap"> <td class="px-4 py-4 whitespace-nowrap">
<!-- 优先级编辑 --> <!-- 优先级编辑 -->
<div v-if="record.editing" class="flex items-center space-x-2"> <div v-if="record.editing && (record.type === 'MX' || record.type === 'SRV')" class="flex items-center space-x-2">
<input <input
v-model="record.level" v-model="record.level"
type="number" type="number"
@ -223,7 +223,7 @@
/> />
</div> </div>
<div v-else class="text-sm text-gray-500"> <div v-else class="text-sm text-gray-500">
{{ record.type === 'MX' && record.level ? record.level : '-' }} {{ (record.type === 'MX' || record.type === 'SRV') && record.level ? record.level : '-' }}
</div> </div>
</td> </td>
<td class="px-4 py-4 whitespace-nowrap text-sm"> <td class="px-4 py-4 whitespace-nowrap text-sm">
@ -470,7 +470,7 @@ export default {
line: '', line: '',
value: '', value: '',
ttl: 600, ttl: 600,
level: 10, level: null, //
editing: true, // editing: true, //
isNew: true isNew: true
}; };
@ -500,8 +500,8 @@ export default {
return; return;
} }
// // - MXSRV
if (record.level < 1 || record.level > 100) { if ((record.type === 'MX' || record.type === 'SRV') && (record.level < 1 || record.level > 100)) {
toast.error('优先级必须在1~100之间'); toast.error('优先级必须在1~100之间');
return; return;
} }
@ -518,9 +518,12 @@ export default {
host: record.item, host: record.item,
value: record.value, value: record.value,
ttl: record.ttl, ttl: record.ttl,
level: record.level,
line: record.line line: record.line
}; };
// MXSRVlevel
if (record.type === 'MX' || record.type === 'SRV') {
params.level = record.level;
}
} else { } else {
// - // -
url = 'jcloud.api.domain_west.west_domain_modify_dns_record'; url = 'jcloud.api.domain_west.west_domain_modify_dns_record';
@ -529,9 +532,12 @@ export default {
record_id: record.id, record_id: record.id,
value: record.value, value: record.value,
ttl: record.ttl, ttl: record.ttl,
level: record.level,
line: record.line line: record.line
}; };
// MXSRVlevel
if (record.type === 'MX' || record.type === 'SRV') {
params.level = record.level;
}
} }
const request = createResource({ const request = createResource({