提交 3241777b 编写于 作者: yi.li's avatar yi.li

居民详情编辑

上级 0092d20a
......@@ -56,6 +56,7 @@
<el-select
v-model="labelIdList"
multiple
@change="changeLabels"
placeholder="请选择居民分组">
<el-option
v-for="(item, index) in labelsList"
......@@ -280,6 +281,7 @@
nickname: '',
mobilePhone: '',
diseases: [],
patientDiseases: [],
customLabels: [],
idNo: '',
birthTime: '',
......@@ -336,6 +338,27 @@
}
// this.$refs['patientInfoForm'].clearValidate();
this.$forceUpdate();
}else {
// 新增
this.patientInfoForm = {
nickname: '',
mobilePhone: '',
diseases: [],
patientDiseases: [],
customLabels: [],
idNo: '',
birthTime: '',
age: '',
sex: null,
permanentResidence: '',
nationality: '',
socialCard: '',
fileLocator: '',
isWechatBind: null,
isRemind: null,
wechatNickname: '',
remark: '',
}
}
},
checkForm(val){
......@@ -391,17 +414,27 @@
})
},
changeDiseases(val) {
// console.log('疾病选择',val)
let newDiseaseList = [];
// this.patientInfoForm.diseases
val.forEach((valItem) => {
this.diseasesList.forEach((item2) => {
if(valItem == item.diseaseId){
if(valItem == item2.diseaseId){
newDiseaseList.push({parentDiseaseId: item2.diseaseId});
}
})
// console.log('item',valItem)
})
});
// this.patientInfoForm.diseases = newDiseaseList;
this.patientInfoForm.patientDiseases = newDiseaseList;
},
changeLabels(val){
let newLabelsList = [];
val.forEach((valItem) => {
this.labelsList.forEach((item2) => {
if(valItem == item2.labelId){
newLabelsList.push(item2);
}
})
});
this.patientInfoForm.customLabels = newLabelsList;
},
//提醒绑定
remindBind() {
......@@ -415,6 +448,7 @@
}).then( data => {
if(data.code == '000000') {
this.$message.success(data.data.respMsg);
this.$router.go(-1);
}else {
this.$message.error(data.message);
}
......@@ -423,14 +457,22 @@
saveInfoData() {
this.$refs['patientInfoForm'].validate((valid) => {
if (valid) {
console.log('对象',this.patientInfoForm)
this.$emit('addListenSave',{
status: true,
patientInfoForm: this.patientInfoForm
patientInfoForm: {
...this.patientInfoForm,
birthTime: this.patientInfoForm.birthTime ? `${this.patientInfoForm.birthTime} 00:00:00` : '',
}
})
} else {
this.$emit('addListenSave',{
status: false,
patientInfoForm: this.patientInfoForm,
// patientInfoForm: this.patientInfoForm,
patientInfoForm: {
...this.patientInfoForm,
birthTime: this.patientInfoForm.birthTime ? `${this.patientInfoForm.birthTime} 00:00:00` : '',
}
})
}
});
......@@ -470,16 +512,10 @@
},
getAge(val) {
if(val) {
let birthdays = new Date(this.patientInfoForm.birthTime.replace(/-/g, "/"));
// let birthdays = new Date(this.patientInfoForm.birthTime.replace(/-/g, "/"));
let birthdays = new Date(val.replace(/-/g, "/"));
let d = new Date();
let age =
d.getFullYear() -
birthdays.getFullYear() -
(d.getMonth() < birthdays.getMonth() ||
(d.getMonth() == birthdays.getMonth() &&
d.getDate() < birthdays.getDate())
? 1
: 0);
let age = d.getFullYear() - birthdays.getFullYear() - (d.getMonth() < birthdays.getMonth() || (d.getMonth() == birthdays.getMonth() && d.getDate() < birthdays.getDate()) ? 1 : 0);
this.patientInfoForm.age = age;
}else {
this.patientInfoForm.age = null;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册