把收支项目的重复提示改成提交的时候进行显示

This commit is contained in:
jishenghua
2025-06-11 23:35:02 +08:00
parent e26e16d85b
commit 715976be2d

View File

@@ -72,8 +72,7 @@
name:{ name:{
rules: [ rules: [
{ required: true, message: '请输入名称!' }, { required: true, message: '请输入名称!' },
{ min: 2, max: 30, message: '长度在 2 30 个字符', trigger: 'blur' }, { min: 2, max: 30, message: '长度在 2 30 个字符', trigger: 'blur' }
{ validator: this.validatePersonName}
]}, ]},
type:{ type:{
rules: [ rules: [
@@ -128,36 +127,20 @@
} }
obj.then((res)=>{ obj.then((res)=>{
if(res.code === 200){ if(res.code === 200){
that.$emit('ok'); that.$emit('ok')
that.confirmLoading = false
that.close()
} else { } else {
that.$message.warning(res.data.message); that.$message.warning(res.data.message);
that.confirmLoading = false
} }
}).finally(() => { }).finally(() => {
that.confirmLoading = false;
that.close();
}) })
} }
}) })
}, },
handleCancel () { handleCancel () {
this.close() this.close()
},
validatePersonName(rule, value, callback){
let params = {
name: value,
id: this.model.id?this.model.id:0
};
checkInOutItem(params).then((res)=>{
if(res && res.code===200) {
if(!res.data.status){
callback();
} else {
callback("名称已经存在");
}
} else {
callback(res.data);
}
});
} }
} }
} }