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

居民详情编辑

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