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

地区回显问题

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