diff --git a/src/pages/record/detail.vue b/src/pages/record/detail.vue index 9edec1c..eaadeb2 100644 --- a/src/pages/record/detail.vue +++ b/src/pages/record/detail.vue @@ -248,45 +248,43 @@ export default { // if (res.status == 0) { // this.type.options = res.data.items // } - res = await this.$ajax.get('/admin-api/api/keywords/list', { params: { type_key: 'illness_type' } }) + await this.loadData() + res = await this.$ajax.get('/admin-api/api/keywords/list', { params: { type_key: 'illness_type', value: this.info?.type?.key } }) if (res.status == 0) { this.illnessType.list = [res.data] } - this.loadData() }, - loadData() { + async loadData() { if (!this.id) { return } uni.showLoading() const params = { _action: 'getData' } - this.$ajax.get(`/admin-api/record/${this.id}`, { params }).then(res => { - uni.stopPullDownRefresh() - if (res.status == 0) { - this.info = { - ...res.data, - treat_at: res.data.treat_at ? res.data.treat_at.replaceAll('-', '/') : '', - next_treat_at: res.data.next_treat_at ? res.data.next_treat_at.replaceAll('-', '/') : '', - notify_at: res.data.notify_at ? res.data.notify_at.replaceAll('-', '/') : '', - } - if (res.data.images) { - this.$refs['images'].setList(res.data.images.map(value => { - return { url: value } - })) - } - this.type.text = this.info.type ? this.info.type.name : '' - this.adminUser.doctor_name = this.info.doctor ? this.info.doctor.name : '' - this.orderStatus.text = orderStatus.map[this.info.order_status] - this.adminUser.notify_user_name = this.info.notify_user ? this.info.notify_user.name : '' - if (res.data.illness_type) { - const illness = res.data.illness_type - this.illnessType.label = illness.name - this.illnessType.value = illness.id - } + let res = await this.$ajax.get(`/admin-api/record/${this.id}`, { params }) + uni.stopPullDownRefresh() + if (res.status == 0) { + this.info = { + ...res.data, + treat_at: res.data.treat_at ? res.data.treat_at.replaceAll('-', '/') : '', + next_treat_at: res.data.next_treat_at ? res.data.next_treat_at.replaceAll('-', '/') : '', + notify_at: res.data.notify_at ? res.data.notify_at.replaceAll('-', '/') : '', } - }).catch(error => { - uni.stopPullDownRefresh() - }) + if (res.data.images) { + this.$refs['images'].setList(res.data.images.map(value => { + return { url: value } + })) + } + this.type.text = this.info.type ? this.info.type.name : '' + this.adminUser.doctor_name = this.info.doctor ? this.info.doctor.name : '' + this.orderStatus.text = orderStatus.map[this.info.order_status] + this.adminUser.notify_user_name = this.info.notify_user ? this.info.notify_user.name : '' + if (res.data.illness_type) { + const illness = res.data.illness_type + this.illnessType.label = illness.name + this.illnessType.value = illness.id + } + } + }, update(key, value) { const params = { diff --git a/src/pages/record/form.vue b/src/pages/record/form.vue index 0932974..5ee3c24 100644 --- a/src/pages/record/form.vue +++ b/src/pages/record/form.vue @@ -170,10 +170,7 @@ export default { methods: { async init() { let res - res = await this.$ajax.get('/admin-api/api/keywords/list', { params: { type_key: 'illness_type' } }) - if (res.status == 0) { - this.illnessType.list = [res.data] - } + res = await this.$ajax.get('/admin-api/current-user') if (res.status == 0) { this.currentUser = res.data @@ -227,6 +224,10 @@ export default { this.typeName = this.patient.type.name } } + res = await this.$ajax.get('/admin-api/api/keywords/list', { params: { type_key: 'illness_type', value: this.patient?.type?.key} }) + if (res.status == 0) { + this.illnessType.list = [res.data] + } }, submit() { this.form.images = this.$refs['images'].getList().map(item => item.url)