This commit is contained in:
ldj_willow
2022-10-31 10:57:06 +08:00
2 changed files with 32 additions and 14 deletions

View File

@@ -268,7 +268,11 @@ function CRUD(options) {
/**
* 取消新增/编辑
*/
cancelCU() {
cancelCU(formName) {
if (formName instanceof PointerEvent) {
formName = 'form'
}
const addStatus = crud.status.add
const editStatus = crud.status.edit
const viewStatus = crud.status.view
@@ -296,18 +300,21 @@ function CRUD(options) {
callVmHook(crud, CRUD.HOOK.afterEditCancel, crud.form)
}
// 清除表单验证
if (crud.findVM('form').$refs['form']) {
crud.findVM('form').$refs['form'].clearValidate()
if (crud.findVM('form').$refs[formName]) {
crud.findVM('form').$refs[formName].clearValidate()
}
},
/**
* 提交新增/编辑
*/
submitCU(form) {
submitCU(formName) {
if (formName instanceof PointerEvent) {
formName = 'form'
}
if (!callVmHook(crud, CRUD.HOOK.beforeValidateCU)) {
return
}
crud.findVM('form').$refs['form'].validate(valid => {
crud.findVM('form').$refs[formName].validate(valid => {
if (!valid) {
return
}
@@ -493,8 +500,10 @@ function CRUD(options) {
}
}
// add by ghl 2020-10-04 页面重复添加信息时,下拉框的校验会存在,需要找工取消
if (crud.findVM('form').$refs['form']) {
crud.findVM('form').$refs['form'].clearValidate()
let form_ref = 'form'
if (crudFrom.form_ref) form_ref = crudFrom.form_ref
if (crud.findVM('form').$refs[form_ref]) {
crud.findVM('form').$refs[form_ref].clearValidate()
}
},
/**