提交 1cdca983 编写于 作者: yi.li's avatar yi.li

地区回显问题

上级 a44787b2
...@@ -32,7 +32,9 @@ ...@@ -32,7 +32,9 @@
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24" style="text-align: center;margin-top:15px;" v-if="!patientId"> <el-button plain size="small" @click="toggleClick">{{tipsText}}</el-button></el-col>
</el-row> </el-row>
<div v-show="isShowAll || patientId">
<div class="has-header">数据记录</div> <div class="has-header">数据记录</div>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
...@@ -226,6 +228,7 @@ ...@@ -226,6 +228,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</div>
</el-form> </el-form>
</div> </div>
</template> </template>
...@@ -304,22 +307,23 @@ ...@@ -304,22 +307,23 @@
}, },
hasIdNo: false, hasIdNo: false,
validStatus: false, validStatus: false,
rules: {
nickname: [{required: true, message: '请输入居民姓名', trigger: ['change', 'blur'] }],
mobilePhone: [{required: true, message: '请输入手机号', trigger: ['change', 'blur'] },{ validator: checkMobile , trigger: ['blur','change'] }],
idNo: [{required: false,validator: checkCardNum, trigger: ['change'] }],
},
optionProps: {
value: "id",
label: "name",
children: "children"
},
provinceList: [], provinceList: [],
provinceLists: [], //省列表 provinceLists: [], //省列表
cityLists: [], //市列表 cityLists: [], //市列表
countyLists: [], //县列表 countyLists: [], //县列表
townLists: [],//乡镇列表 townLists: [],//乡镇列表
optionProps: {
value: "id",
label: "name",
children: "children"
},
tipsText: '展开录入完整信息',
isShowAll: false,
rules: {
nickname: [{required: true, message: '请输入居民姓名', trigger: ['change', 'blur'] }],
mobilePhone: [{required: true, message: '请输入手机号', trigger: ['change', 'blur'] },{ validator: checkMobile , trigger: ['blur','change'] }],
idNo: [{required: false,validator: checkCardNum, trigger: ['change'] }],
},
} }
}, },
props: { props: {
...@@ -328,7 +332,9 @@ ...@@ -328,7 +332,9 @@
patientId: String, patientId: String,
}, },
watch: { watch: {
patientInfoObj(val){ // const obj = await searchObj(id).then(res => res);
patientInfoObj: {
async handler(val) {
if(this.patientId){ if(this.patientId){
this.patientInfoForm = val; this.patientInfoForm = val;
this.baseInfoEdit = this.patientInfoForm.baseInfoEdit; this.baseInfoEdit = this.patientInfoForm.baseInfoEdit;
...@@ -355,16 +361,26 @@ ...@@ -355,16 +361,26 @@
} }
//对地区数据做处理 //对地区数据做处理
if(this.patientInfoForm.patientAddress) { if(this.patientInfoForm.patientAddress) {
this.addressList[0] = parseInt(this.patientInfoForm.provinceId); let provinceId = this.patientInfoForm.provinceId;
this.addressList[1] = parseInt(this.patientInfoForm.cityId); let cityId = this.patientInfoForm.cityId;
this.addressList[2] = parseInt(this.patientInfoForm.countyId); let countyId = this.patientInfoForm.countyId;
this.addressList[3] = parseInt(this.patientInfoForm.townId); let townId = this.patientInfoForm.townId;
// this.addressList = JSON.parse(this.addressList);
await this.getCity(provinceId);
await this.getCounty(provinceId, cityId);
await this.getTown(provinceId, cityId, countyId);
await setTimeout(() => {
this.addressList[0] = parseInt(provinceId);
this.addressList[1] = parseInt(cityId);
this.addressList[2] = parseInt(countyId);
this.addressList[3] = parseInt(townId);
},10);
this.$forceUpdate();
}else { }else {
this.addressList = []; this.addressList = [];
} }
this.$refs['patientInfoForm'].clearValidate(); // this.$refs['patientInfoForm'].clearValidate();
this.$forceUpdate();
}else { }else {
// 新增 // 新增
this.patientInfoForm = { this.patientInfoForm = {
...@@ -395,6 +411,8 @@ ...@@ -395,6 +411,8 @@
} }
} }
}, },
deep: true,
},
checkForm(val){ checkForm(val){
if(val){// 触发校验 if(val){// 触发校验
this.saveInfoData(); this.saveInfoData();
...@@ -597,8 +615,8 @@ ...@@ -597,8 +615,8 @@
} }
this.$forceUpdate(); this.$forceUpdate();
}, },
getProvinceLists() { async getProvinceLists() {
getProvinceList({}).then((data) => { await getProvinceList({}).then((data) => {
if(data.code == '000000') { if(data.code == '000000') {
this.provinceLists = data.data.provinceList; this.provinceLists = data.data.provinceList;
this.provinceLists.map(item => { this.provinceLists.map(item => {
...@@ -607,11 +625,12 @@ ...@@ -607,11 +625,12 @@
this.$set(item, "children", []); this.$set(item, "children", []);
}); });
this.provinceList = this.provinceLists; this.provinceList = this.provinceLists;
// this.$forceUpdate();
} }
}) })
}, },
getCity(provinceId) { async getCity(provinceId) {
getCityList({provinceId: provinceId}).then((data) => { await getCityList({provinceId: provinceId}).then((data) => {
if(data.code == '000000') { if(data.code == '000000') {
this.cityLists = data.data.cityList; this.cityLists = data.data.cityList;
this.cityLists.map(item => { this.cityLists.map(item => {
...@@ -624,11 +643,12 @@ ...@@ -624,11 +643,12 @@
item.children = this.cityLists; item.children = this.cityLists;
} }
}) })
// this.$forceUpdate();
} }
}) })
}, },
getCounty(provinceId, cityId) { async getCounty(provinceId, cityId) {
getCountyList({cityId: cityId}).then((data) => { await getCountyList({cityId: cityId}).then((data) => {
if(data.code == '000000') { if(data.code == '000000') {
this.countyLists = data.data.countyList; this.countyLists = data.data.countyList;
this.countyLists.map(item => { this.countyLists.map(item => {
...@@ -643,11 +663,12 @@ ...@@ -643,11 +663,12 @@
}) })
} }
}) })
// this.$forceUpdate();
} }
}) })
}, },
getTown(provinceId, cityId, countyId) { async getTown(provinceId, cityId, countyId) {
getTownList({countyId: countyId}).then((data) => { await getTownList({countyId: countyId}).then((data) => {
if(data.code == '000000') { if(data.code == '000000') {
this.townLists = data.data.townList; this.townLists = data.data.townList;
this.townLists.map(item => { this.townLists.map(item => {
...@@ -667,8 +688,18 @@ ...@@ -667,8 +688,18 @@
} }
}) })
} }
// this.$forceUpdate();
}) })
}, },
toggleClick() {
if(this.isShowAll) {
this.tipsText = '展开录入完整信息';
this.isShowAll = false;
}else {
this.tipsText = '收起录入完整信息';
this.isShowAll = true;
}
}
}, },
filters: { filters: {
emptyFilter: function(value) { emptyFilter: function(value) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册