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

View File

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

View File

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

View File

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

View File

@ -8,12 +8,16 @@
<u-cell <u-cell
title="类别" title="类别"
:value="type.text" :value="type.text"
isLink
rightIcon="edit-pen"
@click="toggleType"
/> />
<u-cell <u-cell
title="诊疗时间" title="病种"
:value="illnessType.label"
isLink
rightIcon="edit-pen"
@click="openIllnessType"
/>
<u-cell
:title="`${type.text}时间`"
:value="info.treat_at | date" :value="info.treat_at | date"
isLink isLink
rightIcon="edit-pen" rightIcon="edit-pen"
@ -41,7 +45,7 @@
@click="toggleOrderStatus" @click="toggleOrderStatus"
/> />
<u-cell <u-cell
title="就诊医生" :title="`${type.text}医师`"
:value="adminUser.doctor_name" :value="adminUser.doctor_name"
:label="`提成金额: ${info.doctor_money}`" :label="`提成金额: ${info.doctor_money}`"
isLink isLink
@ -59,7 +63,7 @@
:label="`提成金额: ${info.saler_money}`" :label="`提成金额: ${info.saler_money}`"
/> />
<u-cell <u-cell
title="诊疗情况" :title="`${type.text}情况`"
isLink isLink
rightIcon="edit-pen" rightIcon="edit-pen"
@click="openEditor" @click="openEditor"
@ -160,6 +164,15 @@
@select="selectOrderStatus" @select="selectOrderStatus"
/> />
<cu-editor ref="editor" @confirm="confirmEditor" /> <cu-editor ref="editor" @confirm="confirmEditor" />
<u-picker
:show="illnessType.show"
:columns="illnessType.list"
keyName="label"
closeOnClickOverlay
@close="closeIllnessType"
@cancel="closeIllnessType"
@confirm="confirmIllnessType"
/>
</view> </view>
</template> </template>
@ -212,23 +225,35 @@ export default {
show: false, show: false,
text: '', text: '',
options: orderStatus.options, options: orderStatus.options,
} },
illnessType: {
show: false,
value: '',
label: '',
list: []
},
} }
}, },
onLoad(e) { onLoad(e) {
this.id = e.id this.id = e.id
this.loadData() this.init()
const params = { _action: 'getData' }
this.$ajax.get('/admin-api/category', { params }).then(res => {
if (res.status == 0) {
this.type.options = res.data.items
}
})
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.loadData() this.loadData()
}, },
methods: { 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() { loadData() {
if (!this.id) { if (!this.id) {
return return
@ -253,6 +278,11 @@ export default {
this.adminUser.doctor_name = this.info.doctor ? this.info.doctor.name : '' this.adminUser.doctor_name = this.info.doctor ? this.info.doctor.name : ''
this.orderStatus.text = orderStatus.map[this.info.order_status] this.orderStatus.text = orderStatus.map[this.info.order_status]
this.adminUser.notify_user_name = this.info.notify_user ? this.info.notify_user.name : '' 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 => { }).catch(error => {
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
@ -407,6 +437,26 @@ export default {
patientDetail() { patientDetail() {
return uni.navigateTo({ url: `/pages/patient/detail?id=${this.info.patient_id}` }) 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> </script>

View File

@ -6,22 +6,29 @@
<text>{{ patient.name }}</text> <text>{{ patient.name }}</text>
</view> </view>
</u-form-item> </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-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 v-for="item in typeList" :key="item.id" :label="item.name" :name="item.id" />
</u-radio-group> </u-radio-group>
</u-form-item> </u-form-item> -->
<u-form-item prop="form.treat_at" label="诊疗时间" :required="true" :borderBottom="true" @click="toggleDatePicker('treat_at', 'datetime')"> <u-form-item prop="form.illness_type_id" label="病种" :required="true" :borderBottom="true" @click="openIllnessType">
<view class="input-text"> <view class="input-text">
<text v-if="form.treat_at">{{ form.treat_at | date }}</text> <text v-if="form.illness_type_id">{{ illnessType.label }}</text>
<text v-else class="input-placeholder">请选择诊疗时间</text> <text v-else class="input-placeholder">请选择病种</text>
<u-icon name="arrow-right" /> <u-icon name="arrow-right" />
</view> </view>
</u-form-item> </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"> <view class="input-text">
<text v-if="form.doctor_id">{{ adminUser.doctor_name }}</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" /> <u-icon name="arrow-right" />
</view> </view>
</u-form-item> </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 v-for="item in orderStatus.options" :key="item.value" :label="item.name" :name="item.value" />
</u-radio-group> </u-radio-group>
</u-form-item> </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"> <view class="input-text">
<!-- <rich-text v-if="form.illness" :nodes="form.illness" /> --> <!-- <rich-text v-if="form.illness" :nodes="form.illness" /> -->
<text v-if="form.content">{{ form.content }}</text> <text v-if="form.content">{{ form.content }}</text>
@ -93,6 +100,15 @@
/> />
<select-admin-user ref="select-admin-user" @select="selectAdminUser" /> <select-admin-user ref="select-admin-user" @select="selectAdminUser" />
<cu-editor ref="editor" @confirm="confirmEditor" /> <cu-editor ref="editor" @confirm="confirmEditor" />
<u-picker
:show="illnessType.show"
:columns="illnessType.list"
keyName="label"
closeOnClickOverlay
@close="closeIllnessType"
@cancel="closeIllnessType"
@confirm="confirmIllnessType"
/>
</view> </view>
</template> </template>
@ -110,7 +126,6 @@ export default {
info: {}, info: {},
form: { form: {
patient_id: '', patient_id: '',
type_id: '',
doctor_id: '', doctor_id: '',
treat_at: Math.floor((new Date).getTime() / 1000), treat_at: Math.floor((new Date).getTime() / 1000),
origin_price: '', origin_price: '',
@ -122,6 +137,7 @@ export default {
notify_at: '', notify_at: '',
notify_remarks: '', notify_remarks: '',
is_notified: 1, is_notified: 1,
illness_type_id: '',
}, },
typeList: [], typeList: [],
patient: {}, patient: {},
@ -137,28 +153,26 @@ export default {
}, },
orderStatus: orderStatus, orderStatus: orderStatus,
currentUser: {}, currentUser: {},
illnessType: {
show: false,
value: '',
label: '',
list: []
},
typeName: '',
} }
}, },
onLoad(e) { onLoad(e) {
this.id = e.id this.id = e.id
this.form.patient_id = e.patient this.form.patient_id = e.patient
this.form.type_id = e.type
this.init() this.init()
}, },
methods: { methods: {
async init() { async init() {
let res 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) { if (res.status == 0) {
this.typeList = res.data.items this.illnessType.list = [res.data]
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)
}
} }
res = await this.$ajax.get('/admin-api/current-user') res = await this.$ajax.get('/admin-api/current-user')
if (res.status == 0) { if (res.status == 0) {
@ -209,6 +223,8 @@ export default {
res = await this.$ajax.get(`/admin-api/patient/${this.form.patient_id}`, { params }) res = await this.$ajax.get(`/admin-api/patient/${this.form.patient_id}`, { params })
if (res.status == 0) { if (res.status == 0) {
this.patient = res.data 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.adminUser[`${key}_name`] = e.name
this.closeAdminUser() this.closeAdminUser()
}, },
typeChange(e) {
this.typeList.forEach(item => {
if (item.id == e) {
this.form.content = item.content
}
})
},
openEditor() { openEditor() {
this.$refs['editor'].open(this.form.content) this.$refs['editor'].open(this.form.content)
}, },
@ -291,6 +300,22 @@ export default {
}, },
updateSwitch(e) { updateSwitch(e) {
this.form.is_notified = 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()
} }
} }
} }