From f87963e8a6fa725ad7c1ca9b8bc2d9670a98525a Mon Sep 17 00:00:00 2001 From: pengjun <158915633@qq.com> Date: Fri, 27 Oct 2023 17:25:46 +0800 Subject: [PATCH] register --- src/assets/css/global_input.css | 9 +++ .../customerOrg/customerOrgGroupAsbitem.vue | 10 ++- .../patientRegister/PatientRegisterEdit.vue | 64 +++++++++++++------ .../patientRegister/PatientRegisterList.vue | 44 ++++++++++--- src/utlis/proFunc.js | 41 +++++++++--- 5 files changed, 131 insertions(+), 37 deletions(-) diff --git a/src/assets/css/global_input.css b/src/assets/css/global_input.css index fb01251..4ec9c9d 100644 --- a/src/assets/css/global_input.css +++ b/src/assets/css/global_input.css @@ -48,3 +48,12 @@ input[type="number"]::-webkit-outer-spin-button { .el-select-dropdown__item.hover, .el-select-dropdown__item:hover { background-color: #CCF9CB; /* 原始 默认 #F5F7FA */ } + +/* cascader 节点样式 */ +.el-cascader-node { + padding: 0 20px 0 10px; /* 原始 默认 0 30px 0 20px; */ + height: 28px; /* 原始 默认 34px */ + line-height: 28px; /* 原始 默认 34px */ +} + + diff --git a/src/components/customerOrg/customerOrgGroupAsbitem.vue b/src/components/customerOrg/customerOrgGroupAsbitem.vue index 3e38dec..e1a189f 100644 --- a/src/components/customerOrg/customerOrgGroupAsbitem.vue +++ b/src/components/customerOrg/customerOrgGroupAsbitem.vue @@ -53,7 +53,7 @@ @@ -350,6 +350,7 @@ export default { }) this.dict.asbItem = deepCopy(this.dict.asbItemAll); this.dict.asbItemQuick = deepCopy(res.data.items); + this.quickAsb = deepCopy(res.data.items); } }); @@ -530,6 +531,13 @@ export default { } } + this.$nextTick(() => { + this.$refs['quickAsbOCX'].blur(); //total asbItemId + this.asbItemId = '' + this.quickAsb = deepCopy(this.dict.asbItemQuick) + this.$refs['quickAsbOCX'].focus(); //total asbItemId + }); + }, //选择 未选的组合项目 diff --git a/src/components/patientRegister/PatientRegisterEdit.vue b/src/components/patientRegister/PatientRegisterEdit.vue index 200499e..1c7f071 100644 --- a/src/components/patientRegister/PatientRegisterEdit.vue +++ b/src/components/patientRegister/PatientRegisterEdit.vue @@ -44,12 +44,12 @@ - + - + @@ -61,7 +61,7 @@ - + @@ -397,7 +397,7 @@ - @@ -451,7 +451,7 @@ - @@ -623,7 +623,7 @@ import { mapState, mapActions } from "vuex"; import { getapi, postapi, putapi, deletapi } from "@/api/api"; import mm from "../../utlis/mm"; -import { objCopy, setNull, dddw, parseID, birthdayToAge, deepCopy, arrayFilter, parsIcCardtoLocal, photoParse, savePeoplePhoto, arrayExistObj } from "../../utlis/proFunc"; +import { objCopy, setNull, dddw,checkIDCode, parseID, birthdayToAge,ageToBirthday, deepCopy, arrayFilter, parsIcCardtoLocal, photoParse, savePeoplePhoto, arrayExistObj } from "../../utlis/proFunc"; import Camera from "./Camera.vue"; import PatientRegisterItem from "./PatientRegisterItem.vue"; import LisRequest from "./LisRequest.vue"; @@ -704,6 +704,7 @@ export default { "customerOrgId", "customerOrgGroupId", "medicalPackageId", + "birthDate", "age", "medicalTypeId", "personnelTypeId", @@ -913,8 +914,14 @@ export default { this.form.age = birthdayToAge(this.form.birthDate) }, + //修改出生日期 + changeAge() { + this.form.birthDate = ageToBirthday(this.form.age) + }, + //修改身份证,生成年龄、出生、性别 changeIdNo() { + this.Query(this.form.idNo) let ret = parseID(this.form.idNo) if (ret.age != -1) { this.form.birthDate = new Date(ret.birthday) @@ -940,9 +947,14 @@ export default { //编辑的时候不查重 if (this.form.id || !param) return; - //console.log(param) - getapi(`/api/app/patient/in-filter?Filter=${param}`).then((res) => { - if (res.code == 1) { + //console.log(`/api/app/patient/in-filter?Filter=${param}`) + let body = { + filter:param, + maxResultCount:500 + } + + postapi('/api/app/patient/getlistinfilter',body).then((res) => { + if (res.code != -1) { console.log("查重 ", res); //有数据才显示 if (res.data.items && res.data.items.length > 0) { this.patientList = res.data.items; @@ -950,6 +962,7 @@ export default { } } }); + }, //列表选中 @@ -1066,18 +1079,26 @@ export default { this.$message.warning(fields[Object.keys(fields)[0]][0].message); return false } + if(this.form.customerOrgId != this.dict.personOrgId){ if(!this.form.customerOrgRegisterId){ this.$message.warning("请填写单位体检次数!"); return false } } + + if(this.form.idNo && checkIDCode(this.form.idNo) == false){ + this.$message.warning("身份证号填写不合法!"); + return false + } //赋值 let body = deepCopy(this.form); - if (this.form.birthDate) { + if (this.form.birthDate && this.form.birthDate != "Invalid date") { body.birthDate = moment(this.form.birthDate).format("yyyy-MM-DD") + }else{ + body.birthDate = null } @@ -1096,9 +1117,9 @@ export default { delete body.isPhoneFollowBox; delete body.isLockBox; delete body.photo; - + setNull(body, this.defaultNull); - + //日期转换 日期控件增加格式 // console.log("body.birthDate", body.birthDate); // if (body.birthDate) { @@ -1119,12 +1140,15 @@ export default { if (this.patientRegister.photo.indexOf("data:image") > -1) savePeoplePhoto(res.data.id, this.patientRegister.photo); objCopy(res.data, this.form); + // this.patientRegister.prList.push(res.data); //列表添加记录 - this.patientRegister.patientRegisterId = res.data.id; - this.patientRegister.patientRegisterRd = res.data; + this.patientRegister.patientRegisterId = res.data.id; + objCopy(this.form, this.patientRegister.patientRegisterRd); - //this.patientRegister.query.times++; 不在触发列表查询(换成局部刷新) - this.patientRegister.prList.push(res.data) + //this.patientRegister.query.times++; 不在触发列表查询(换成局部刷新)放在窗口关闭事件中去 + let curRow = deepCopy(this.patientRegister.patientRegisterRd) + curRow.index = this.patientRegister.prList.length + this.patientRegister.prList.push(curRow) //触发已选组合项目保存 this.patientRegister.patientRegisterAbs.forEach(e => { @@ -1143,10 +1167,10 @@ export default { if (msgTip) this.$message.success("更新 操作成功"); //一般读身份证照片时,会出现这种情况 if (this.patientRegister.photo.indexOf("data:image") > -1) savePeoplePhoto(this.form.id, this.patientRegister.photo); - //this.patientRegister.query.times++; 不在触发列表查询(换成局部刷新) - let lfind = arrayExistObj(this.patientRegister.prList, 'id', this.form.id) - if(lfind > - 1) objCopy(this.form,this.patientRegister.prList[lfind]) - + objCopy(this.form, this.patientRegister.patientRegisterRd); + // this.patientRegister.query.times++; 不在触发列表查询(换成局部刷新) 放在窗口关闭事件中去 + // let lfind = arrayExistObj(this.patientRegister.prList, 'id', this.form.id) + // if(lfind > - 1) objCopy(this.form,this.patientRegister.prList[lfind]) //this.patientRegister.saveTimes++; //更新保存时,无需触发组合项目保存 } diff --git a/src/components/patientRegister/PatientRegisterList.vue b/src/components/patientRegister/PatientRegisterList.vue index 4f36254..f1a8957 100644 --- a/src/components/patientRegister/PatientRegisterList.vue +++ b/src/components/patientRegister/PatientRegisterList.vue @@ -186,12 +186,10 @@ { + this.patientRegister.prList.forEach((e,index) => { e.choosed = false; - return e; + e.index = index; }); if (this.startPoint == -1) { @@ -756,10 +754,13 @@ export default { // 未按住了ctrl 、shift 键 //清除所有选择 console.log("清除所有选择"); - this.patientRegister.prList.forEach((e) => { + this.patientRegister.prList.forEach((e,index) => { e.choosed = false; - return e; + e.index = index; }); + console.log(this.patientRegister.prList,row.index); + console.log(this.patientRegister.prList[row.index].choosed); + this.patientRegister.prList[row.index].choosed = true; this.startPoint = row.index; } @@ -811,10 +812,37 @@ export default { this.$message.warning("请选择要操作的记录"); return; } + //console.log(this.patientRegister.patientRegisterRd,this.patientRegister.prList) this.dialogVisible = true; this.editTimes++; //触发表单窗口,数据更新 }, + //新增或编辑后选中记录 + closeDialogPR(){ + this.patientRegister.prList.forEach(e =>{ + e.choosed = false + }) + let currentRow = {} + let lfind = arrayExistObj(this.patientRegister.prList,'id',this.patientRegister.patientRegisterRd.id) + if(lfind > -1){ + this.patientRegister.prList[lfind].choosed = true + currentRow = this.patientRegister.prList[lfind] + }else if(this.patientRegister.patientRegisterRd.id){ + currentRow = deepCopy(this.patientRegister.patientRegisterRd) + lfind = this.patientRegister.prList.length + currentRow.choosed = true + currentRow.index = lfind + this.patientRegister.prList.push(currentRow) + } + + if(lfind > -1){ + setTimeout(() => { + this.$refs['info'].setCurrentRow(currentRow) + }, 100) + } + + }, + //拍照 openCamera() { if (!this.patientRegister.patientRegisterId) { diff --git a/src/utlis/proFunc.js b/src/utlis/proFunc.js index 4291130..45f10e4 100644 --- a/src/utlis/proFunc.js +++ b/src/utlis/proFunc.js @@ -156,18 +156,36 @@ function arrayExistObj(arr, key, value) { }; exports.arrayExistObj = arrayExistObj; +//判断身份证是否合法 +function checkIDCode(IDCode) { + // 身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X + let ret = false; + let reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; + if(reg.test(IDCode)) { + ret = true; + } + if(!ret) return ret + if(IDCode.length == 15){ + if (IDCode.substring(8, 10).parseInt > 12 || IDCode.substring(8, 10).parseInt == 0) return false + if (IDCode.substring(10, 12).parseInt > 31 || IDCode.substring(10, 12).parseInt == 0) return false + }else{ + if (IDCode.substring(10, 12).parseInt > 12 || IDCode.substring(10, 12).parseInt == 0) return false + if (IDCode.substring(12, 14).parseInt > 31 || IDCode.substring(12, 14).parseInt == 0) return false + } + return ret +}; +exports.checkIDCode = checkIDCode; + //根据身份证号判断出生日期(yyyy-MM-DD),当前年龄与性别 粗犷式,不精确判断闰年平年 -function parseID(id) { - let yearInMs = 1000 * 60 * 60 * 24 * 365.2425; +function parseID(id) { let ret = { - birthday: '', - age: -1, + birthday: null, + age: null, sex: 'U', } - if (!id || id.length != 18) return ret - if (id.substring(10, 12).parseInt > 12 || id.substring(10, 12).parseInt == 0) return ret - if (id.substring(12, 14).parseInt > 31 || id.substring(12, 14).parseInt == 0) return ret - + if(!checkIDCode(id)) return ret + + let yearInMs = 1000 * 60 * 60 * 24 * 365.2425; //出生日期 ret.birthday = id.substring(6, 10) + '-' + id.substring(10, 12) + '-' + id.substring(12, 14) @@ -193,6 +211,13 @@ function birthdayToAge(birthday) { }; exports.birthdayToAge = birthdayToAge; +function ageToBirthday(age) { + let yearInMs = 1000 * 60 * 60 * 24 * 365.2425 * Number(age); + //年龄 + return new Date(new Date().getTime() - yearInMs) +}; +exports.ageToBirthday = ageToBirthday; + //分析身份证数据 function parsIcCardtoLocal(idNos, dictSex, dictNation) { let local = deepCopy(idNos);