Commit 42a05070 authored by 何鹏程's avatar 何鹏程

修改bug

parent bd8c8f4a
......@@ -20,11 +20,31 @@
label="单位全称:"
prop="hospitalName"
>
<el-input
<!-- <el-input
placeholder="请输入单位全称"
v-model="dataForm.hospitalName"
@blur="blurHandle"
/>
/> -->
<el-select
v-model="dataForm.hospitalName"
placeholder="请选择单位全称"
style="width: 100%"
filterable
allow-create
default-first-option
remote
:loading="selectLoading"
:remote-method="remoteMethod"
@change="changeHandle"
:clearable="true"
>
<el-option
v-for="item in hospitalList"
:label="item.hospitalName"
:key="item.id"
:value="item.hospitalName"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
......@@ -170,7 +190,10 @@ export default {
return {
dialogVisible: true,
loading: false,
hospitalList: [],
selectLoading: false,
areaList: [],
hospitalList: [],
dataForm: {
hospitalStep: '',
area: '',
......@@ -232,18 +255,23 @@ export default {
}
})
},
blurHandle() {
if (!this.dataForm.hospitalName) {
remoteMethod(query) {
if (!query) {
this.hospitalList = []
return
}
queryHospitalByName(this.dataForm.hospitalName).then(res => {
if (res.respData) {
this.dataForm.hospitalStep = res.respData.hospitalStep
this.dataForm.area = res.respData.area
// this.dataForm.unitType = res.respData.unitType
}
this.selectLoading = true;
queryHospitalByName(query).then(res => {
this.hospitalList = res.respData
this.selectLoading = false;
})
},
changeHandle(val) {
const item = this.hospitalList.find(i => i.hospitalName == val)
console.log(item)
this.dataForm.hospitalStep = item ? item.hospitalStep : ''
this.dataForm.area = item ? item.area : ''
this.dataForm.unitType = item ? item.unitType : ''
}
}
}
......
......@@ -51,7 +51,7 @@ router.beforeEach((to, from, next) => {
staticRouteLength += item.children.length
}
})
if (routers.length === staticRouteLength) {
if (routers.length === staticRouteLength && menu) {
router.addRoutes(routeHandle(menu))
next({
...to,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment