From 35244d6921cb764a72f80fd7523bafc47e2f2968 Mon Sep 17 00:00:00 2001 From: panliang <1163816051@qq.com> Date: Mon, 9 Oct 2023 15:34:40 +0800 Subject: [PATCH] category permission --- src/pages/index/index.vue | 17 ++++---- src/pages/patient/detail.vue | 4 ++ src/pages/patient/form.vue | 2 + src/pages/patient/index.vue | 34 ++++++++++------ src/pages/record/detail.vue | 78 ++++++++++++++++++++++++++++------- src/pages/record/form.vue | 79 ++++++++++++++++++++++++------------ 6 files changed, 151 insertions(+), 63 deletions(-) diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index fc2214e..cb0c70f 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -1,11 +1,13 @@ @@ -212,23 +225,35 @@ export default { show: false, text: '', options: orderStatus.options, - } + }, + illnessType: { + show: false, + value: '', + label: '', + list: [] + }, } }, onLoad(e) { this.id = e.id - this.loadData() - const params = { _action: 'getData' } - this.$ajax.get('/admin-api/category', { params }).then(res => { - if (res.status == 0) { - this.type.options = res.data.items - } - }) + this.init() }, onPullDownRefresh() { this.loadData() }, methods: { + async init() { + let res + // res = await this.$ajax.get('/admin-api/category', { params: { _action: 'getData' } }) + // 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' } }) + if (res.status == 0) { + this.illnessType.list = [res.data] + } + this.loadData() + }, loadData() { if (!this.id) { return @@ -253,6 +278,11 @@ export default { 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 + } } }).catch(error => { uni.stopPullDownRefresh() @@ -407,6 +437,26 @@ export default { patientDetail() { return uni.navigateTo({ url: `/pages/patient/detail?id=${this.info.patient_id}` }) }, + openIllnessType() { + this.illnessType.show = true + }, + closeIllnessType() { + this.illnessType.show = false + }, + confirmIllnessType(e) { + const item = e.value[0] + if (!item) { + return + } + this.closeIllnessType() + this.update('illness_type_id', item.value).then(res => { + if (res.status == 0) { + this.info.illness_type_id = item.value + this.illnessType.value = item.value + this.illnessType.label = item.label + } + }) + } } } diff --git a/src/pages/record/form.vue b/src/pages/record/form.vue index b4dea51..0932974 100644 --- a/src/pages/record/form.vue +++ b/src/pages/record/form.vue @@ -6,22 +6,29 @@ {{ patient.name }} - + + - {{ form.treat_at | date }} - 请选择诊疗时间 + {{ illnessType.label }} + 请选择病种 - + + + {{ form.treat_at | date }} + 请选择{{ typeName }}时间 + + + + {{ adminUser.doctor_name }} - 请选择诊疗医生 + 请选择{{ typeName }}医生 @@ -36,7 +43,7 @@ - + {{ form.content }} @@ -93,6 +100,15 @@ /> + @@ -110,7 +126,6 @@ export default { info: {}, form: { patient_id: '', - type_id: '', doctor_id: '', treat_at: Math.floor((new Date).getTime() / 1000), origin_price: '', @@ -122,6 +137,7 @@ export default { notify_at: '', notify_remarks: '', is_notified: 1, + illness_type_id: '', }, typeList: [], patient: {}, @@ -137,28 +153,26 @@ export default { }, orderStatus: orderStatus, currentUser: {}, + illnessType: { + show: false, + value: '', + label: '', + list: [] + }, + typeName: '', } }, onLoad(e) { this.id = e.id this.form.patient_id = e.patient - this.form.type_id = e.type this.init() }, methods: { async init() { let res - res = await this.$ajax.get('/admin-api/category', { params: {_action: 'getData'}}) + res = await this.$ajax.get('/admin-api/api/keywords/list', { params: { type_key: 'illness_type' } }) if (res.status == 0) { - this.typeList = res.data.items - let type_id = this.form.type_id - if (!type_id) { - type_id = uni.getStorageSync('medical_record_treat_type_id') - } - if (type_id) { - this.form.type_id = parseInt(type_id) - this.typeChange(type_id) - } + this.illnessType.list = [res.data] } res = await this.$ajax.get('/admin-api/current-user') if (res.status == 0) { @@ -209,6 +223,8 @@ export default { res = await this.$ajax.get(`/admin-api/patient/${this.form.patient_id}`, { params }) if (res.status == 0) { this.patient = res.data + this.form.content = this.patient.type.content + this.typeName = this.patient.type.name } } }, @@ -276,13 +292,6 @@ export default { this.adminUser[`${key}_name`] = e.name this.closeAdminUser() }, - typeChange(e) { - this.typeList.forEach(item => { - if (item.id == e) { - this.form.content = item.content - } - }) - }, openEditor() { this.$refs['editor'].open(this.form.content) }, @@ -291,6 +300,22 @@ export default { }, updateSwitch(e) { this.form.is_notified = e + }, + openIllnessType() { + this.illnessType.show = true + }, + closeIllnessType() { + this.illnessType.show = false + }, + confirmIllnessType(e) { + const item = e.value[0] + if (!item) { + return + } + this.illnessType.value = item.value + this.illnessType.label = item.label + this.form.illness_type_id = item.value + this.closeIllnessType() } } }