fix: 修改部分校验规则 (#2512)

pull/2513/head
ssongliu 1 year ago committed by GitHub
parent cd376b2e97
commit 6d578e53ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -328,7 +328,7 @@ const handleClose = () => {
const rules = reactive({ const rules = reactive({
name: [Rules.requiredInput, Rules.containerName], name: [Rules.requiredInput, Rules.containerName],
image: [Rules.requiredInput], image: [Rules.imageName],
cpuShares: [Rules.integerNumberWith0, checkNumberRange(0, 262144)], cpuShares: [Rules.integerNumberWith0, checkNumberRange(0, 262144)],
nanoCPUs: [Rules.floatNumber], nanoCPUs: [Rules.floatNumber],
memory: [Rules.floatNumber], memory: [Rules.floatNumber],

@ -20,7 +20,7 @@
</el-tooltip> </el-tooltip>
<el-tag v-else>{{ form.imageName }}:{{ form.oldTag }}</el-tag> <el-tag v-else>{{ form.imageName }}:{{ form.oldTag }}</el-tag>
</el-form-item> </el-form-item>
<el-form-item prop="newTag" :rules="Rules.requiredInput"> <el-form-item prop="newTag" :rules="Rules.imageName">
<template #label> <template #label>
<el-tooltip <el-tooltip
placement="top-start" placement="top-start"

@ -139,10 +139,15 @@ const onCopy = async () => {
const loadMfaCodeBefore = async (formEl: FormInstance | undefined) => { const loadMfaCodeBefore = async (formEl: FormInstance | undefined) => {
if (!formEl) return; if (!formEl) return;
formEl.validate(async (valid) => { const result = await formEl.validateField('interval', callback);
if (!valid) return; if (!result) {
loadMfaCode(); return;
}); }
const result2 = await formEl.validateField('title', callback);
if (!result2) {
return;
}
loadMfaCode();
}; };
const loadMfaCode = async () => { const loadMfaCode = async () => {
let param = { let param = {
@ -154,6 +159,14 @@ const loadMfaCode = async () => {
qrImage.value = res.data.qrImage; qrImage.value = res.data.qrImage;
}; };
function callback(error: any) {
if (error) {
return error.message;
} else {
return;
}
}
const onBind = async (formEl: FormInstance | undefined) => { const onBind = async (formEl: FormInstance | undefined) => {
if (!formEl) return; if (!formEl) return;
formEl.validate(async (valid) => { formEl.validate(async (valid) => {

Loading…
Cancel
Save