diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 0c1b308..704b26a 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -128,7 +128,7 @@ export default { depart_name: "中医科", doctor_id: "1", hid: "1", - hispital_name: "武丽娜中医针灸", + hispital_name: "", id: "1", is_fixed: "1", project_count: 24, @@ -144,7 +144,7 @@ export default { depart_name: "中医科", doctor_id: "1", hid: "1", - hispital_name: "武丽娜中医针灸", + hispital_name: "", id: "1", is_fixed: "1", project_count: 24, @@ -158,7 +158,7 @@ export default { depart_name: "中医科", doctor_id: "1", hid: "1", - hispital_name: "武丽娜中医针灸", + hispital_name: "", id: "1", is_fixed: "1", project_count: 24, diff --git a/src/views/HosInformation.vue b/src/views/HosInformation.vue index 8148983..0fdfae5 100644 --- a/src/views/HosInformation.vue +++ b/src/views/HosInformation.vue @@ -30,13 +30,18 @@
- - + v-model="hospitalSearchState" + :fetch-suggestions="queryHospital" + placeholder="请输入医院名称或地址" + ref="hospitalAutocomplete" + @select="hospitalHandleSelect"> + +
@@ -100,7 +105,7 @@
-
+
全选
- 共{{ projectList.length }}条,已选{{ selectedCount }}条 + 共{{ projectList.length }}条,已选8{{ selectedCount }}条 批量禁用 https://m.tb.cn/h.UJglv3C?tk=5KMnd9XFr3D", - time_unit:"15", - time_unit_num:"10", - treat_expire:"365", - visit_day:"7" + h_name:"", + h_pos:"", + hid:"0", + is_fixed:'0', + morning_worktime:"", + notice:"", + time_unit:"0", + time_unit_num:"0", + treat_expire:"0", + visit_day:"0" }, siteFormrules: { depart_name: [ @@ -545,35 +551,52 @@ export default { ...mapState(['hosMenuData']) // 从Vuex映射showSidebar状态到组件的计算属性中 }, methods: { + handleSearch() { + if(this.hospitalSearchFlag) return + this.hospitalSearchFlag = true + this.$refs.hospitalAutocomplete.$refs.suggestions.loading = true + this.queryHospital(this.hospitalSearchState, (results) => { + console.log(results) + + this.$refs.hospitalAutocomplete.$refs.suggestions.loading = false + this.$refs.hospitalAutocomplete.hideLoading = true + this.$refs.hospitalAutocomplete.$refs.suggestions.suggestions = results + console.log(this.hospitalSearchState) + this.$refs.hospitalAutocomplete.getData(this.hospitalSearchState) + }) + }, + hospitalHandleSelect(item) { + console.log(item); + }, queryHospital(queryString, cb) { + if(!this.hospitalSearchFlag) return; + this.hospitalSearchTimeout = setTimeout(function(){ + this.hospitalSearchFlag = false + }.bind(this), 5000); + this.$http('POST', '/api/admin/search_hoispital', { keyword: queryString, province: this.form.province, city: this.form.city, }).then(response => { - if(response.code == 0) { - this.hospitalRestaurants = response.data - }else{ + this.hospitalSearchFlag = false + clearTimeout(this.hospitalSearchTimeout) + if(response.code !== 0) { + cb([]); this.$message.error(response.msg); + return } + + this.hospitalRestaurants = Object.values(response.data) + var restaurants = this.hospitalRestaurants; + var results = queryString ? restaurants : []; + cb(results); }).catch(error => { + this.hospitalSearchFlag = false + clearTimeout(this.hospitalSearchTimeout) + cb([]); console.error(error, 'error') }) - - var restaurants = this.restaurants; - var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants; - - clearTimeout(this.timeout); - this.timeout = setTimeout(() => { - cb(results); - }, 3000 * Math.random()); - }, - hosipitalFilter(keyword, options) { - if (!keyword) return options - return options.filter(item => { - // 自定义筛选逻辑 - return item.label.includes(keyword) || item.value.includes(keyword) - }) }, random() { var randomNumber = Math.random(); @@ -623,7 +646,7 @@ export default { if(response.code == 0){ this.loading1 = false this.$nextTick(()=>{ - this.courseList = response.data.list; + this.courseList = response.data.list ? response.data.list : []; this.tableKey1 = Date.now(); // 强制重新渲染表格 }) } @@ -987,6 +1010,7 @@ export default { console.log(data, '---'); }, updateHosInfo(props){ + console.log(props) this.$http('POST', '/api/admin/set_hospital_depart', { ...props }).then(response => { @@ -998,9 +1022,8 @@ export default { }) }, submitForm(form) { - console.log(this.$refs[form], '-----'); this.$refs[form].validate((valid) => { - console.log(this[form], '======formxinxi'); + console.log(this[form], '======formxinxi8', '=============='+form); if (valid) { alert('提交成功!'); let props = {}