diff --git a/src/main.js b/src/main.js index 13bec0d..5afc8d9 100644 --- a/src/main.js +++ b/src/main.js @@ -21,6 +21,7 @@ import { getConfigKey } from '@/api/system/config' import { parseTime, resetForm, + clearFormValidate, addDateRange, selectDictLabel, selectDictLabels, @@ -50,6 +51,7 @@ Vue.prototype.getDicts = getDicts Vue.prototype.getConfigKey = getConfigKey Vue.prototype.parseTime = parseTime Vue.prototype.resetForm = resetForm +Vue.prototype.clearFormValidate = clearFormValidate Vue.prototype.addDateRange = addDateRange Vue.prototype.selectDictLabel = selectDictLabel Vue.prototype.selectDictLabels = selectDictLabels diff --git a/src/utils/ruoyi.js b/src/utils/ruoyi.js index 76132fc..23f4b6a 100644 --- a/src/utils/ruoyi.js +++ b/src/utils/ruoyi.js @@ -56,13 +56,21 @@ export function resetForm(refName) { } } -// 表单重置- 延时 -export function resetFormTime(refName) { +// 表单清除验证 +export function clearFormValidate(refName) { setTimeout(() => { if (this.$refs[refName]) { - this.$refs[refName].resetFields() + this.$refs[refName].clearValidate() } - }, 1000) + }, 100) + // if (this.$refs[refName]) { + // this.$refs[refName].clearValidate() + // } + // else { + // setTimeout(() => { + // this.clearFormValidate(refName) + // }, 100) + // } } // 添加日期范围 diff --git a/src/views/business/comps/common/sign.vue b/src/views/business/comps/common/sign.vue index c1ef81b..6e3a035 100644 --- a/src/views/business/comps/common/sign.vue +++ b/src/views/business/comps/common/sign.vue @@ -106,7 +106,7 @@ export default { jyksrq: selectedDate && selectedDate.length > 0 ? selectedDate[0] : '', jyjsrq: selectedDate && selectedDate.length > 0 ? selectedDate[1] : '' } - this.resetForm("signForm") + this.open = true this.isReson = isReson || false @@ -142,6 +142,7 @@ export default { }] } } + this.clearFormValidate("signForm") }, cancel() { this.open = false diff --git a/src/views/business/comps/template/dialog/EditSign.vue b/src/views/business/comps/template/dialog/EditSign.vue index a84e291..0d5b4a7 100644 --- a/src/views/business/comps/template/dialog/EditSign.vue +++ b/src/views/business/comps/template/dialog/EditSign.vue @@ -98,8 +98,8 @@ export default { qmrmm:'', } this.isChecked = false - this.resetForm("formEditSignForm") this.open = true + this.clearFormValidate("formEditSignForm") }, cancel() { this.open = false diff --git a/src/views/business/form/drug/comp/sign.vue b/src/views/business/form/drug/comp/sign.vue index e3d67c7..885ef1e 100644 --- a/src/views/business/form/drug/comp/sign.vue +++ b/src/views/business/form/drug/comp/sign.vue @@ -114,7 +114,7 @@ export default { startDate:selectedDate&&selectedDate.length>0?selectedDate[0]:'', endDate:selectedDate&&selectedDate.length>1?selectedDate[1]:'' } - this.resetForm("signForm") + this.open = true this.isReson = isReson || false @@ -150,6 +150,7 @@ export default { }] } } + this.clearFormValidate("signForm") }, cancel() { this.open = false diff --git a/src/views/business/form/nonTrial/comp/sign.vue b/src/views/business/form/nonTrial/comp/sign.vue index e3d67c7..885ef1e 100644 --- a/src/views/business/form/nonTrial/comp/sign.vue +++ b/src/views/business/form/nonTrial/comp/sign.vue @@ -114,7 +114,7 @@ export default { startDate:selectedDate&&selectedDate.length>0?selectedDate[0]:'', endDate:selectedDate&&selectedDate.length>1?selectedDate[1]:'' } - this.resetForm("signForm") + this.open = true this.isReson = isReson || false @@ -150,6 +150,7 @@ export default { }] } } + this.clearFormValidate("signForm") }, cancel() { this.open = false diff --git a/src/views/business/study/comp/sign.vue b/src/views/business/study/comp/sign.vue index 7e28456..5613c69 100644 --- a/src/views/business/study/comp/sign.vue +++ b/src/views/business/study/comp/sign.vue @@ -114,7 +114,7 @@ export default { startDate:selectedDate&&selectedDate.length>0?selectedDate[0]:'', endDate:selectedDate&&selectedDate.length>1?selectedDate[1]:'' } - this.resetForm("signForm") + this.open = true this.isReson = isReson || false @@ -150,6 +150,8 @@ export default { }] } } + + this.clearFormValidate("signForm") }, cancel() { this.open = false