diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 704b26a..bff78e3 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -397,7 +397,7 @@ export default { addHospital(item) { this.$router.push({ name: '医院信息', - query: { doctor_id: item.doctor_id } + query: { doctor_id: item.id } }) }, editDoctor(item) { diff --git a/src/views/HosInformation.vue b/src/views/HosInformation.vue index 45d0e18..f29b72c 100644 --- a/src/views/HosInformation.vue +++ b/src/views/HosInformation.vue @@ -21,23 +21,20 @@ - - + -
+
@@ -48,7 +45,7 @@ + prop="depart_name" :placeholder="(depart_id && doctor_id)?'无':'请输入'" :disabled="(depart_id && doctor_id)?true:false"/>
@@ -56,7 +53,7 @@
医保定点
- +
@@ -103,11 +100,11 @@
+
- - +
+
@@ -359,46 +356,13 @@ export default { isIndeterminate1: false, projectSearchId: 'all', projectSearchName: '', - hospitalRestaurants: [], hospitalSearchState: '', hospitalSearchFlag: false, hospitalSearchTimeout: false, departIsFixed:-1, - - projectList: [ - { - name: '针灸', - price: '88', - group: '针灸1', - time: '2077 - 12 - 20', - status: true, - id: '1' - }, - { - name: '拔罐', - price: '188', - group: '针灸2', - time: '2077 - 12 - 20', - status: true, - id: '2' - }, - { - name: '火刺', - price: '55', - group: '针灸1', - time: '2077 - 12 - 20', - status: true, - id: '3' - }, - ], - projectTagData: [ - { - name: '全部分类', - id: '0' - }, - - ], + projectList: [], + projectTagData: [], courseList: [], selectAll: false, selectAll1: false, @@ -491,7 +455,9 @@ export default { time_unit:"0", time_unit_num:"0", treat_expire:"0", - visit_day:"0" + visit_day:"0", + search_province:"", + search_city:"", }, siteFormrules: { }, @@ -503,15 +469,12 @@ export default { isApprove: '', phone: '' }, - siteFormrules1: { domain_source: [ { required: true, message: '请输入站点简称', trigger: 'blur' } ] }, - // hosipitalList:[] - hosipitalList: [ { label: '选项1', value: '1' }, { label: '选项2', value: '2' }, @@ -526,15 +489,34 @@ export default { }, async mounted() { const { depart_id, doctor_id } = this.$route.query; // 获取 doctorId 参数 + if(doctor_id) this.doctor_id = doctor_id; if (doctor_id && depart_id) { // 请求医生信息 this.depart_id = depart_id; this.doctor_id = doctor_id; + await this.fetchDoctorData() + console.log(this.doctor_id) await this.getAreaData() - this.fetchDoctorData() this.fetchPackData() this.fetchProjectData() this.geHosAdress() + }else{ + await this.getAreaData() + } + }, + watch: { + '$route.query': { + immediate: true, + deep: true, + handler(newVal) { + this.doctor_id = newVal.doctor_id; + this.depart_id = newVal.depart_id; + this.getAreaData(); + this.fetchDoctorData(); + this.fetchPackData(); + this.fetchProjectData(); + this.geHosAdress(); + } } }, computed: { @@ -547,21 +529,22 @@ export default { 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) - }) + if(!this.hospitalSearchState.trim()) { + this.$message.error('医院名称或地址不能为空'); + this.hospitalSearchFlag = false + return + } + this.getInternetHospital(this.hospitalSearchState) }, hospitalHandleSelect(item) { - console.log(item); + this.form.h_realname = item.value + this.form.search_province = item.province + this.form.search_city = item.city + this.form.address = item.address + this.form.h_pos = item.location.lat + ',' + item.location.lng + console.log(item) }, - queryHospital(queryString, cb) { + getInternetHospital(queryString) { if(!this.hospitalSearchFlag) return; this.hospitalSearchTimeout = setTimeout(function(){ this.hospitalSearchFlag = false @@ -575,22 +558,28 @@ export default { this.hospitalSearchFlag = false clearTimeout(this.hospitalSearchTimeout) if(response.code !== 0) { - cb([]); + this.hospitalRestaurants = [] + this.$refs.hospitalAutocomplete.getData(this.hospitalSearchState) this.$message.error(response.msg); return } this.hospitalRestaurants = Object.values(response.data) - var restaurants = this.hospitalRestaurants; - var results = queryString ? restaurants : []; - cb(results); + this.$refs.hospitalAutocomplete.activated = true + this.$refs.hospitalAutocomplete.getData(this.hospitalSearchState) + + if(this.hospitalRestaurants.length <= 0) this.$message.error('未查询相关信息'); }).catch(error => { this.hospitalSearchFlag = false clearTimeout(this.hospitalSearchTimeout) - cb([]); + this.hospitalRestaurants = [] console.error(error, 'error') }) }, + queryHospital(queryString, cb) { + console.log(queryString) + cb(this.hospitalRestaurants); + }, random() { var randomNumber = Math.random(); return randomNumber @@ -614,14 +603,14 @@ export default { console.error(error, 'error') }) }, - fetchDoctorData() { + async fetchDoctorData() { this.$http('POST', '/api/admin/get_depart_info', { depart_id: this.depart_id, doctor_id: this.doctor_id }).then(response => { this.form = { ...this.form, ...response.data, - 'morning_worktime':response.data.morning_worktime.split('-'), - 'afternoon_worktime':response.data.afternoon_worktime.split('-') + 'morning_worktime':response.data.morning_worktime ? response.data.morning_worktime.split('-'):'', + 'afternoon_worktime':response.data.afternoon_worktime ? response.data.afternoon_worktime.split('-'):'' } this.departType = (response.data.type || response.data.type === 0 || response.data.type === "0") ? [Number(response.data.type)] : [] this.departIsFixed = response.data.is_fixed == "1" ? true : false @@ -661,13 +650,15 @@ export default { if(response.code == 0){ this.loading = false this.$nextTick(()=>{ - this.projectTagData = response.data.classify;//项目分类 - if(response.data.list) { - this.projectList = Object.values(response.data.list);//项目列表 - }else{ - this.projectList = [] + if(response.data.classify) { + this.projectTagData = response.data.classify;//项目分类 + if(response.data.list && response.data.list.length > 0) { + this.projectList = Object.values(response.data.list);//项目列表 + }else{ + this.projectList = [] + } + this.tableKey = Date.now(); // 强制重新渲染表格 } - this.tableKey = Date.now(); // 强制重新渲染表格 // this.$set('projectList',Object.values(response.data.list)) // this.$set('projectTagData',response.data.classify) }) @@ -773,26 +764,31 @@ export default { } else if (this.dialogVisible) {//新增项目 let data = JSON.parse(JSON.stringify(this.$refs.channelProject.form)); let str = data.project_contents; - data.project_contents = str.replace(/\n/g, ' ').trim(); - if(!data.project_contents || (data.groupType == '1' && !data.classify_id) || (data.groupType == '2' && !data.classify_name)){ - this.$Message.info('请填写完整信息!') + data.project_contents = str.trim(); + if((data.groupType == '1' && !data.classify_id) || (data.groupType == '2' && !data.classify_name)){ + this.$Message.info('分组不能为空') + return; } - else{ - this.$http('POST', '/api/admin/mitil_add_project', { - depart_id: this.depart_id, - doctor_id: this.doctor_id, - ...data - }).then(response => { - if (response.code == 0) { - this.$Message.success('新增项目成功') - this.$refs.channelProject.formReset() - this.dialogVisible = false; - this.fetchProjectData(); - } - }).catch(error => { - this.$Message.error(error || '错误!') - }) + + if(!data.project_contents) { + this.$Message.info('录入项目内容不能为空!') + return; } + + this.$http('POST', '/api/admin/mitil_add_project', { + depart_id: this.depart_id, + doctor_id: this.doctor_id, + ...data + }).then(response => { + if (response.code == 0) { + this.$Message.success('新增项目成功') + this.$refs.channelProject.formReset() + this.dialogVisible = false; + this.fetchProjectData(); + } + }).catch(error => { + this.$Message.error(error || '错误!') + }) } }, // 取消按钮事件 @@ -998,6 +994,8 @@ export default { console.log(data, '---'); }, updateHosInfo(props, url){ + if(this.doctor_id) props.doctor_id = this.doctor_id; + if(this.doctor_id && this.depart_id) { props.doctor_id = this.doctor_id; props.depart_id = this.depart_id; @@ -1009,6 +1007,15 @@ export default { }).then(response => { if(response.code == 0){ this.$Message.success('更新成功') + if(this.doctor_id && !this.depart_id) { + var that = this + setTimeout(()=>{ + that.$router.push({ + name: '医院信息', + query: { doctor_id: this.doctor_id, depart_id: response.data.depart_id } + }) + },1000) + } return; } this.$Message.error(response.msg) @@ -1038,8 +1045,15 @@ export default { rqurl = "/api/admin/set_depart_worktime"; break; case 'siteForm': + if(this.doctor_id && !this.depart_id) { + if(!this.form.search_province.trim() || !this.form.search_city.trim() || !this.form.address.trim() || !this.form.h_pos.trim()) { + this.$Message.info('请选择搜索结果下拉中的出诊医院') + return; + } + } + if(this.departType.length <= 0) { - this.$Message.info('请选择站点类型') + this.$Message.info('请选择使用功能') return; } @@ -1047,9 +1061,18 @@ export default { is_fixed:this.form.is_fixed, type:this.departType[0], notice:this.form.notice, - h_shortname:this.form.h_shortname, + h_shortname:this.form.h_shortname } + if(this.doctor_id && !this.depart_id) { + if(this.departType.length <= 0) { + this.$Message.info('请选择使用功能') + return; + } + + props = this.form + props.type = this.departType[0] + } rqurl = "/api/admin/set_hospital_depart"; break; case 'numSettingForm': @@ -1060,7 +1083,6 @@ export default { treat_expire:this.form.treat_expire, } rqurl = "/api/admin/set_visit_num"; - break; } this.updateHosInfo(props, rqurl) @@ -1080,11 +1102,14 @@ export default { }