1
0
Fork 0

category permission

master
panliang 2023-10-09 15:34:40 +08:00
parent 4dfe604309
commit 35244d6921
6 changed files with 151 additions and 63 deletions

View File

@ -1,11 +1,13 @@
<template>
<view class="page">
<view class="info">
<u-cell :title="info.name">
<view slot="icon">
<u-avatar :src="info.avatar" />
</view>
</u-cell>
<u-cell-group>
<u-cell :title="info.name">
<view slot="icon">
<u-avatar :src="info.avatar" />
</view>
</u-cell>
</u-cell-group>
</view>
<view class="btns">
<u-empty v-if="list.length == 0" mode="list" text="请先在后台添加分类" />
@ -37,10 +39,7 @@
},
methods: {
init() {
this.$ajax.get('/admin-api/category', {
params: {_action: 'getData'},
custom: { loading: true }
}).then(res => {
this.$ajax.get('/admin-api/api/category/permission-list', {custom: { loading: true }}).then(res => {
if (res.status == 0) {
this.list = res.data.items
}

View File

@ -7,6 +7,10 @@
isLink
rightIcon="edit-pen"
@click="openModal('姓名', 'name')"
/>
<u-cell
title="类别"
:value="info.type ? info.type.name : ''"
/>
<u-cell
title="性别"

View File

@ -100,6 +100,7 @@ export default {
return {
id: '',
form: {
type_id: '',
name: '',
sex: gender.none.value,
phone: '',
@ -146,6 +147,7 @@ export default {
}
},
onLoad(e) {
this.form.type_id = uni.getStorageSync('medical_record_treat_type_id')
if (!e.id) {
uni.setNavigationBarTitle({
title: '添加病人'

View File

@ -14,17 +14,17 @@
</view>
<u-list class="list" @scrolltolower="reachBottom">
<u-swipe-action>
<u-list-item v-for="(item, index) in list" :key="item.id">
<u-swipe-action-item :options="swipeOption" :name="index" @click="swipeClick">
<u-cell
:title="item.name + (item.age != '' ? `(${item.age})` : '')"
:label="item.phone ? item.phone : '暂无联系方式'"
:clickable="true"
:isLink="false"
:url=" `/pages/patient/detail?id=${item.id}`"
/>
</u-swipe-action-item>
</u-list-item>
<u-list-item v-for="(item, index) in list" :key="item.id">
<u-swipe-action-item :options="swipeOption" :name="index" @click="swipeClick">
<u-cell
:title="item.name + (item.age != '' ? `(${item.age})` : '')"
:label="item.phone ? item.phone : '暂无联系方式'"
:clickable="true"
:isLink="false"
:url=" `/pages/patient/detail?id=${item.id}`"
/>
</u-swipe-action-item>
</u-list-item>
</u-swipe-action>
</u-list>
<u-action-sheet
@ -42,6 +42,7 @@
export default {
data() {
return {
typeId: '',
list: [],
page: 1,
perPage: 20,
@ -65,6 +66,9 @@ export default {
}
},
onLoad() {
this.typeId = uni.getStorageSync('medical_record_treat_type_id')
},
onShow() {
this.loadData(true)
},
@ -79,9 +83,13 @@ export default {
}
uni.showLoading()
const params = {
_action: 'getData', page: this.page, perPage: this.perPage, keyword: this.search
_action: 'getData',
page: this.page,
perPage: this.perPage,
keyword: this.search,
type_id: this.typeId,
}
this.$ajax.get('/admin-api/patient?', { params }).then(res => {
this.$ajax.get('/admin-api/patient', { params }).then(res => {
uni.stopPullDownRefresh()
if (res.status == 0) {
this.list = this.list.concat(res.data.items)

View File

@ -8,12 +8,16 @@
<u-cell
title="类别"
:value="type.text"
isLink
rightIcon="edit-pen"
@click="toggleType"
/>
<u-cell
title="诊疗时间"
title="病种"
:value="illnessType.label"
isLink
rightIcon="edit-pen"
@click="openIllnessType"
/>
<u-cell
:title="`${type.text}时间`"
:value="info.treat_at | date"
isLink
rightIcon="edit-pen"
@ -41,7 +45,7 @@
@click="toggleOrderStatus"
/>
<u-cell
title="就诊医生"
:title="`${type.text}医师`"
:value="adminUser.doctor_name"
:label="`提成金额: ${info.doctor_money}`"
isLink
@ -59,7 +63,7 @@
:label="`提成金额: ${info.saler_money}`"
/>
<u-cell
title="诊疗情况"
:title="`${type.text}情况`"
isLink
rightIcon="edit-pen"
@click="openEditor"
@ -160,6 +164,15 @@
@select="selectOrderStatus"
/>
<cu-editor ref="editor" @confirm="confirmEditor" />
<u-picker
:show="illnessType.show"
:columns="illnessType.list"
keyName="label"
closeOnClickOverlay
@close="closeIllnessType"
@cancel="closeIllnessType"
@confirm="confirmIllnessType"
/>
</view>
</template>
@ -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
}
})
}
}
}
</script>

View File

@ -6,22 +6,29 @@
<text>{{ patient.name }}</text>
</view>
</u-form-item>
<u-form-item prop="type_id" label="类别" :required="true" :borderBottom="true" @click="toggleType">
<!-- <u-form-item prop="type_id" label="类别" :required="true" :borderBottom="true" @click="toggleType">
<u-radio-group v-model="form.type_id" @change="typeChange">
<u-radio v-for="item in typeList" :key="item.id" :label="item.name" :name="item.id" />
</u-radio-group>
</u-form-item>
<u-form-item prop="form.treat_at" label="诊疗时间" :required="true" :borderBottom="true" @click="toggleDatePicker('treat_at', 'datetime')">
</u-form-item> -->
<u-form-item prop="form.illness_type_id" label="病种" :required="true" :borderBottom="true" @click="openIllnessType">
<view class="input-text">
<text v-if="form.treat_at">{{ form.treat_at | date }}</text>
<text v-else class="input-placeholder">请选择诊疗时间</text>
<text v-if="form.illness_type_id">{{ illnessType.label }}</text>
<text v-else class="input-placeholder">请选择病种</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item prop="form.doctor_id" label="诊疗医生" :required="true" :borderBottom="true" @click="opendAdminUser('doctor')">
<u-form-item prop="form.treat_at" :label="`${typeName}时间`" :required="true" :borderBottom="true" @click="toggleDatePicker('treat_at', 'datetime')">
<view class="input-text">
<text v-if="form.treat_at">{{ form.treat_at | date }}</text>
<text v-else class="input-placeholder">请选择{{ typeName }}时间</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item prop="form.doctor_id" :label="`${typeName}医师`" :required="true" :borderBottom="true" @click="opendAdminUser('doctor')">
<view class="input-text">
<text v-if="form.doctor_id">{{ adminUser.doctor_name }}</text>
<text v-else class="input-placeholder">请选择诊疗医生</text>
<text v-else class="input-placeholder">请选择{{ typeName }}医生</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
@ -36,7 +43,7 @@
<u-radio v-for="item in orderStatus.options" :key="item.value" :label="item.name" :name="item.value" />
</u-radio-group>
</u-form-item>
<u-form-item label="诊疗情况" prop="content" :borderBottom="true" @click="openEditor">
<u-form-item :label="`${typeName}情况`" prop="content" :borderBottom="true" @click="openEditor">
<view class="input-text">
<!-- <rich-text v-if="form.illness" :nodes="form.illness" /> -->
<text v-if="form.content">{{ form.content }}</text>
@ -93,6 +100,15 @@
/>
<select-admin-user ref="select-admin-user" @select="selectAdminUser" />
<cu-editor ref="editor" @confirm="confirmEditor" />
<u-picker
:show="illnessType.show"
:columns="illnessType.list"
keyName="label"
closeOnClickOverlay
@close="closeIllnessType"
@cancel="closeIllnessType"
@confirm="confirmIllnessType"
/>
</view>
</template>
@ -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()
}
}
}