Commit 21d83817 authored by miaojiale's avatar miaojiale

入选标准增加校验

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