提交 f5286477 编写于 作者: tao.wu's avatar tao.wu

no message

上级 2607d960
......@@ -192,9 +192,6 @@
</style>
<style lang="scss">
.form-box{
.margin-left-20{
margin-left: 20px;
}
.el-form-item.is-required:not(.is-no-asterisk)>.el-form-item__label:before {
content: '*';
color: #F56C6C;
......@@ -252,6 +249,20 @@
color: #449284 !important;
}
.margin-left-20{
margin-left: 20px;
}
.margin-left-40{
margin-left: 40px;
}
.margin-left-60{
margin-left: 60px;
}
.margin-left-80{
margin-left: 80px;
}
}
.checkBody{
.el-col{
......
// 检查号码是否符合规范,包括长度,类型
function isCardNo(card){
//身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
var reg = /(^\d{15}$)|(^\d{17}(\d|X|x)$)/;
if(reg.test(card) === false){
return false;
}
return true;
}
// 取身份证前两位,校验省份
function checkProvince(card,vcity){
var province = card.substr(0,2);
if(vcity[province] == undefined){
return false;
}
return true;
}
// 检查生日是否正确
function checkBirthday(card){
var len = card.length;
//身份证15位时,次序为省(3位)市(3位)年(2位)月(2位)日(2位)校验位(3位),皆为数字
if(len == '15'){
var re_fifteen = /^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/;
var arr_data = card.match(re_fifteen);
var year = arr_data[2];
var month = arr_data[3];
var day = arr_data[4];
var birthday = new Date('19'+year+'/'+month+'/'+day);
return verifyBirthday('19'+year,month,day,birthday);
}
//身份证18位时,次序为省(3位)市(3位)年(4位)月(2位)日(2位)校验位(4位),校验位末尾可能为X
if(len == '18'){
var re_eighteen = /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X|x)$/;
var arr_data = card.match(re_eighteen);
var year = arr_data[2];
var month = arr_data[3];
var day = arr_data[4];
var birthday = new Date(year+'/'+month+'/'+day);
return verifyBirthday(year,month,day,birthday);
}
return false;
}
// 校验日期
function verifyBirthday(year,month,day,birthday) {
var now = new Date();
var now_year = now.getFullYear();
//年月日是否合理
if(birthday.getFullYear() == year && (birthday.getMonth() + 1) == month && birthday.getDate() == day)
{
//判断年份的范围(0岁到100岁之间)
var time = now_year - year;
if(time >= 0 && time <= 100)
{
return true;
}
return false;
}
return false;
}
// 校验位的检测
function checkParity(card){
//15位转18位
card = changeFivteenToEighteen(card);
var len = card.length;
if(len == '18'){
var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
var cardTemp = 0, i, valnum;
for(i = 0; i < 17; i ++) {
cardTemp += card.substr(i, 1) * arrInt[i];
}
valnum = arrCh[cardTemp % 11];
if (valnum == card.substr(17, 1).toLocaleUpperCase())
{
return true;
}
return false;
}
return false;
}
// 15位转18位身份证号
function changeFivteenToEighteen(card){
if(card.length == '15')
{
var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
var cardTemp = 0, i;
card = card.substr(0, 6) + '19' + card.substr(6, card.length - 6);
for(i = 0; i < 17; i ++)
{
cardTemp += card.substr(i, 1) * arrInt[i];
}
card += arrCh[cardTemp % 11];
return card;
}
return card;
}
export const checkCardNum = (rule, value, callback) => {
var vcity={ 11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",
21:"辽宁",22:"吉林",23:"黑龙江",31:"上海",32:"江苏",
33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",
42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",
51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",
63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"
};
//是否为空
if(value === ''){
callback(new Error('请输入正确的身份证'))
}
//校验长度,类型
if(isCardNo(value) === false){
callback(new Error('请输入正确的身份证'))
}
//检查省份
if(checkProvince(value,vcity) === false){
callback(new Error('请输入正确的身份证'))
}
//校验生日
if(checkBirthday(value) === false){
callback(new Error('请输入正确的身份证'))
}
//检验位的检测
if(checkParity(value) === false){
callback(new Error('请输入正确的身份证'))
}
callback()
}
import rangeJson from '@/utils/followup/followupUtils/range';
// 校验范围通用方法
export const checkRange = (rule, value, callback) => {
let min,max;
rangeJson.forEach((item,index)=>{
if(item.field==rule.field){
min = item.min;
max = item.max;
}
if((value >= min) && (value <= max)){
callback()
}else{
callback(new Error(`输入范围${min}~${max}`))
}
})
}
// 各个字段校验的配置文件
export default [
{
field: 'fastingBloodGlucose',
name: '空腹血糖',
min: 1,
max: 33.3
},
{
field: 'triglyceride',
name: '甘油三酯',
min: 0,
max: 5
},
{
field: 'cholesterol',
name: '胆固醇',
min: 1,
max: 10
},
{
field: 'cLdl',
name: '低密度脂蛋白胆固醇',
min: 0,
max: 5
},
{
field: 'cHdl',
name: '高密度脂蛋白胆固醇',
min: 0,
max: 5
},
{
field: 'stature',
name: '身高',
min: 100,
max: 200
},
{
field: 'weight',
name: '体重',
min: 35,
max: 200
},
{
field: 'waistline',
name: '腰围',
min: 50,
max: 150
},
{
field: 'firstSystolicPressure',
name: '收缩压SBP',
min: 70,
max: 240
},
{
field: 'firstDiastolicPressure',
name: '舒张压DBP',
min: 50,
max: 130
},
{
field: 'firstPulse',
name: '脉搏',
min: 30,
max: 200
},
{
field: 'secondSystolicPressure',
name: '收缩压SBP',
min: 70,
max: 240
},
{
field: 'secondDiastolicPressure',
name: '舒张压DBP',
min: 50,
max: 130
},
{
field: 'secondPulse',
name: '脉搏',
min: 30,
max: 200
},
]
import { checkCardNum } from '@/utils/followup/followupUtils/checkCardNum';
export default ($this) => {
return [
{
formType: 'div',
......@@ -29,7 +32,7 @@ export default ($this) => {
spanNum: 12,
type: 'text',
labmsg: '次',
rules: [{required: true, message: '请输入身份证', trigger: 'submit'}],
rules: [{required: true, message: '请输入身份证', trigger: 'submit'},{ validator: checkCardNum , trigger: 'submit' }],
},
{
formType: 'radio',
......@@ -37,7 +40,7 @@ export default ($this) => {
prop: 'inTurn',
model: 'inTurn',
spanNum: 24,
label: '随访轮次 (距离建档时间):',
label: '随访轮次(距离建档时间):',
options: [
{ label: '6个月', value: '6个月' },
{ label: '12个月', value: '12个月' },
......@@ -45,7 +48,7 @@ export default ($this) => {
rules: [{ required: true, message: '请选择随访轮次', trigger: 'submit' }],
changeFun: (e)=>{
console.log(e)
if(e==2){
if(e == '12个月'){
$this.isRule = true;
// console.log($this.isRule)
}
......
......@@ -7,7 +7,7 @@ export default ($this) => {
},
{
formType: 'radio',
className: 'obj-form-title',
className: 'obj-form-title margin-left-20',
prop: 'investigationState',
model: 'investigationState',
spanNum: 24,
......@@ -25,7 +25,7 @@ export default ($this) => {
{
formType: 'radio',
className: 'obj-form-title2',
className: 'obj-form-title2 margin-left-40',
prop: 'investigationWay',
model: 'investigationWay',
label: '调查方式:',
......@@ -41,7 +41,7 @@ export default ($this) => {
},
{
formType: 'radio',
className: 'obj-form-title2',
className: 'obj-form-title2 margin-left-40',
prop: 'oneself',
model: 'oneself',
label: '本次调查是否为被调查者本人:',
......@@ -57,7 +57,7 @@ export default ($this) => {
},
{
formType: 'radio',
className: 'obj-form-title3',
className: 'obj-form-title3 margin-left-60',
prop: 'relationship',
model: 'relationship',
label: '提供信息者与被调查者之间关系:',
......@@ -76,7 +76,7 @@ export default ($this) => {
},
{
formType: 'input',
className: 'obj-form-title4',
className: 'obj-form-title4 margin-left-80',
linkageRule: [{name: 'relationshipRemark',value: ['其他']}],
prop: 'relationshipRemark',
model: 'relationshipRemark',
......@@ -90,7 +90,7 @@ export default ($this) => {
{
formType: 'radio',
className: 'obj-form-title2',
className: 'obj-form-title3 margin-left-60',
prop: 'lossReason',
model: 'lossReason',
spanNum: 24,
......@@ -105,7 +105,7 @@ export default ($this) => {
},
{
formType: 'input',
className: 'obj-form-title3',
className: 'obj-form-title3 margin-left-60',
linkageRule: [{name: 'lossReason',value: ['其他']}],
prop: 'lossRemark',
model: 'lossRemark',
......@@ -120,7 +120,7 @@ export default ($this) => {
{
formType: 'date-picker',
className: 'obj-form-title2',
className: 'obj-form-title2 margin-left-40',
prop: 'deadTime',
model: 'deadTime',
placeholder: '选择死亡时间',
......@@ -135,7 +135,7 @@ export default ($this) => {
},
{
formType: 'radio',
className: 'obj-form-title2',
className: 'obj-form-title2 margin-left-40',
prop: 'causeOfDeath',
model: 'causeOfDeath',
label: '死亡原因:',
......@@ -156,7 +156,7 @@ export default ($this) => {
},
{
formType: 'radio',
className: 'obj-form-title3',
className: 'obj-form-title3 margin-left-60',
prop: 'deadStrokeRemark',
model: 'deadStrokeRemark',
label: '脑卒中类型:',
......@@ -173,7 +173,7 @@ export default ($this) => {
},
{
formType: 'input',
className: 'obj-form-title3',
className: 'obj-form-title3 margin-left-60',
linkageRule: [{name: 'causeOfDeath',value: ['其他']}],
prop: 'deadRemark',
model: 'deadRemark',
......
import { checkRange } from '@/utils/followup/followupUtils/checkField';
export default ($this) => {
return [
{
......@@ -31,7 +33,7 @@ export default ($this) => {
type: 'number',
labmsg: '次',
slots: [{name: 'mmol/L', type: 'append'}],
rules: [{required: true, message: '请输入空腹血糖', trigger: 'submit'}],
rules: [{required: true, message: '请输入空腹血糖', trigger: 'submit'},{ validator: checkRange , trigger: 'submit' }],
},
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册