Commit 21d83817 authored by miaojiale's avatar miaojiale

入选标准增加校验

parent 730d022e
......@@ -69,6 +69,10 @@ let checkAge = (rule, value, callback) => {
if (!value) {
return callback(new Error("请选择出生日期"))
}
let sex = sessionStorage.getItem("addSex")
if (!sex) {
return
}
let birthday = new Date(value.replace(/-/g, "/"))
let d = new Date()
let age =
......@@ -78,11 +82,19 @@ let checkAge = (rule, value, callback) => {
(d.getMonth() == birthday.getMonth() && d.getDate() < birthday.getDate())
? 1
: 0)
console.log(age)
if (age < 40 || age > 80) {
callback(new Error("年龄不符合筛查条件"))
console.log(sex)
if (sex == 1) {
if (age < 40 || age > 79) {
callback(new Error("年龄不符合筛查条件"))
} else {
callback()
}
} else {
callback()
if (age < 50 || age > 79) {
callback(new Error("年龄不符合筛查条件"))
} else {
callback()
}
}
}
export default {
......
......@@ -119,6 +119,7 @@
:columns="columns.column || columns.children.column"
:group="options.group"
@formChange="formChange"
@validateForm="validateForm"
></form-item-self>
</el-col>
</template>
......@@ -186,6 +187,9 @@ export default {
this.$refs.formSelf[i].age = ""
}
},
validateForm() {
this.$emit("validateForm")
},
handleChange(key, val) {
if (this.form.hasOwnProperty(key)) this.form[key] = val
},
......
......@@ -955,6 +955,10 @@ export default {
if (this.item.prop == "birthday") {
this.getAge()
}
if (this.item.prop == "sex") {
sessionStorage.setItem("addSex", this.form.sex)
this.$emit("validateForm")
}
// 该操作判断是否符合筛查条件
this.$emit("formChange")
// ['is_one_year','is_subtotal_history','is_ppi','is_symptom','is_subtotal_history','is_disease','is_tumour']
......
......@@ -18,6 +18,7 @@
:columns="{ column: options.column }"
:options="options"
:is-show-important="isShowImportant"
@validateForm="validateForm"
></form-content>
</template>
<template v-if="options.group && options.group.length > 0">
......@@ -34,6 +35,7 @@
:columns="g"
:options="options"
:is-show-important="isShowImportant"
@validateForm="validateForm"
></form-content>
</el-tab-pane>
</el-tabs>
......@@ -61,6 +63,7 @@
:options="options"
:is-show-important="isShowImportant"
@showError="showError"
@validateForm="validateForm"
></form-content>
</el-collapse-item>
</template>
......@@ -203,6 +206,14 @@ export default {
}
},
methods: {
validateForm() {
// console.log(88845)
if (this.form.birthday) {
this.$refs.form.validateField("birthday", (valid) => {
console.log(valid)
})
}
},
clearAge() {
// 去除年龄文本
for (let i = 0; i < this.$refs.formContent.length; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment