1
0
Fork 0
master
panliang 2023-09-02 09:20:19 +08:00
parent 000ebef2f0
commit 201fc5d15d
12 changed files with 944 additions and 38 deletions

View File

@ -1,16 +1,28 @@
<template>
<u-popup :show="show" mode="right" :safeAreaInsetTop="true" @close="close" @open="open">
<u-cell-group>
<u-cell
v-for="(item, index) in list"
:key="item.id"
:title="item.name"
:icon="item.avatar"
:name="index"
clickable
@click="click"
/>
</u-cell-group>
<u-search
v-model="search"
placeholder="输入姓名搜索"
:clearabled="true"
:showAction="false"
margin="10px 0"
@search="load(true)"
@change="changeSearch"
/>
<u-list :width="300" @scrolltolower="reachBottom">
<u-list-item v-for="(item, index) in list" :key="item.id">
<u-cell
:title="item.name"
:icon="item.avatar"
:name="index"
clickable
@click="click"
/>
</u-list-item>
</u-list>
<view v-if="loading" class="loading">
<u-loadmore :status="status" />
</view>
</u-popup>
</template>
@ -19,12 +31,18 @@ export default {
name: "SelectAdminUser",
data () {
return {
search: '',
show: false,
list: []
list: [],
page: 1,
perPage: 20,
loading: true,
// 'loading', 'nomore', 'loadmore'
status: 'loading',
}
},
created() {
this.load()
this.load(true)
},
methods: {
open() {
@ -36,19 +54,47 @@ export default {
click(e) {
this.$emit('select', this.list[e.name])
},
load() {
this.$ajax.get('/admin-api/system/admin_users', {_action: 'getData'}).then(res => {
load(refresh) {
if (refresh) {
this.page = 1
this.list = []
}
if (this.status == 'nomore') {
return ;
}
this.loading = true
this.status = 'loading'
// uni.showLoading()
this.$ajax.get('/admin-api/system/admin_users', {_action: 'getData', page: this.page, perPage: this.perPage, keyword: this.search}).then(res => {
this.loading = false
if (res.status == 0) {
this.list = res.data.items
this.list = this.list.concat(res.data.items)
if (this.list.length >= res.data.total) {
this.status = 'nomore'
}
}
}).catch(error => {
this.loading = false
this.status = 'nomore'
})
}
},
reachBottom() {
this.page++
this.load()
},
changeSearch(value) {
if (!value) {
this.load(true)
}
},
}
}
</script>
<style scoped>
.u-cell-group {
margin-top: 40px;
.loading {
position: fixed;
bottom: 0;
background-color: white;
width: 300px;
}
</style>

View File

@ -9,7 +9,7 @@ gender.map = {}
Object.keys(gender).forEach(key => {
if (gender[key] !== undefined && gender[key].value !== undefined) {
gender.options.push({ name: gender[key].text, value: gender[key].value })
gender.map[key] = gender[key].value
gender.map[gender[key].value] = gender[key].text
}
})

View File

@ -0,0 +1,15 @@
const orderStatus = {
none: { value: 0, text: '未收' },
success: { value: 1, text: '已收' },
}
orderStatus.options = []
orderStatus.map = {}
Object.keys(orderStatus).forEach(key => {
if (orderStatus[key] !== undefined && orderStatus[key].value !== undefined) {
orderStatus.options.push({ name: orderStatus[key].text, value: orderStatus[key].value })
orderStatus.map[orderStatus[key].value] = orderStatus[key].text
}
})
export default orderStatus

View File

@ -22,7 +22,8 @@
{
"path": "pages/patient/detail",
"style": {
"navigationBarTitleText": "病人详细"
"navigationBarTitleText": "病人详细",
"enablePullDownRefresh": true
}
},
{
@ -30,6 +31,26 @@
"style": {
"navigationBarTitleText": "病人表单"
}
},
{
"path": "pages/record/form",
"style": {
"navigationBarTitleText": "病历表单"
}
},
{
"path": "pages/record/index",
"style": {
"navigationBarTitleText": "病历记录",
"enablePullDownRefresh": true
}
},
{
"path": "pages/record/detail",
"style": {
"navigationBarTitleText": "病历详细",
"enablePullDownRefresh": true
}
}
],
"globalStyle": {

View File

@ -24,8 +24,8 @@
})
},
methods: {
itemClick(key) {
uni.setStorageSync('medical_record_treat_type', key)
itemClick(e) {
uni.setStorageSync('medical_record_treat_type_id', e)
uni.navigateTo({
url: '/pages/patient/index'
})

View File

@ -58,6 +58,10 @@
rightIcon="edit-pen"
@click="openModal('病情描述', 'illness', 'textarea')"
/>
<u-cell
title="录入时间"
:value="info.created_at"
/>
</u-cell-group>
<div class="btn">
<u-button text="病历记录" type="success" />
@ -130,6 +134,9 @@ export default {
this.id = e.id
this.loadData()
},
onPullDownRefresh() {
this.loadData()
},
methods: {
loadData() {
if (!this.id) {

View File

@ -32,10 +32,10 @@
</u-form-item>
<u-form-item prop="doctor_id" label="坐诊医生" @click="opendDoctor">
<view class="input-text">
<text v-if="form.doctor_id">{{ doctor.text }}</text>
<text v-else class="input-placeholder">请选择坐诊医生</text>
<u-icon name="arrow-right" />
</view>
<text v-if="form.doctor_id">{{ doctor.text }}</text>
<text v-else class="input-placeholder">请选择坐诊医生</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item prop="illness">
<u--textarea v-model="form.illness" :showConfirmBar="false" placeholder="请输入病情描述" />

View File

@ -7,13 +7,12 @@
margin="10px 0"
placeholder="姓名/联系方式"
@search="loadData(true)"
@clear="loadData(true)"
@change="changeSearch"
/>
<view class="add-button">
<u-button type="primary" icon="plus" shape="circle" size="large" @click="add" />
</view>
<u-list class="list">
<u-list class="list" @scrolltolower="reachBottom">
<u-list-item v-for="(item, index) in list" :key="item.id">
<u-cell
:title="item.name + (item.age != '' ? `(${item.age})` : '')"
@ -64,12 +63,6 @@ export default {
onPullDownRefresh() {
this.loadData(true)
},
onReachBottom() {
if (this.list.length < this.total) {
this.page++
this.loadData()
}
},
methods: {
loadData(refresh) {
if (refresh) {
@ -87,6 +80,12 @@ export default {
uni.stopPullDownRefresh()
})
},
reachBottom() {
if (this.list.length < this.total) {
this.page++
this.loadData()
}
},
changeSearch(value) {
if (!value) {
this.loadData(true)
@ -115,7 +114,7 @@ export default {
return uni.navigateTo({ url: `/pages/patient/form?id=${id}` })
}
if (e.action == 'delete') {
uni.showModal({
return uni.showModal({
title: '删除 ' + this.option.title,
content: '是否确定?',
success: (result) => {
@ -124,7 +123,12 @@ export default {
}
}
})
}
if (e.action == 'record-add') {
return uni.navigateTo({ url: `/pages/record/form?patient=${id}` })
}
if (e.action == 'record') {
return uni.navigateTo({ url: `/pages/record/index?patient=${id}` })
}
},
delete(id) {

View File

@ -0,0 +1,307 @@
<template>
<view class="page">
<u-cell-group :border="false">
<u-cell
title="姓名"
:value="this.info.patient ? this.info.patient.name : ''"
/>
<u-cell
title="类别"
:value="type.text"
isLink
rightIcon="edit-pen"
@click="toggleType"
/>
<u-cell
title="诊疗时间"
:value="info.treat_at | date"
isLink
rightIcon="edit-pen"
@click="toggleDatePicker('treat_at')"
/>
<u-cell
title="就诊医生"
:value="adminUser.doctor_name"
isLink
rightIcon="edit-pen"
@click="opendAdminUser('doctor')"
/>
<u-cell
title="划线价"
:value="info.origin_price"
isLink
rightIcon="edit-pen"
@click="openModal('划线价', 'origin_price', 'number')"
/>
<u-cell
title="实收价"
:value="info.sell_price"
isLink
rightIcon="edit-pen"
@click="openModal('实收价', 'sell_price', 'number')"
/>
<u-cell
title="收费情况"
:value="orderStatus.text"
isLink
rightIcon="edit-pen"
@click="toggleOrderStatus"
/>
<u-cell
title="诊疗情况"
:label="info.content"
isLink
rightIcon="edit-pen"
@click="openModal('诊疗情况', 'content', 'textarea')"
/>
<u-cell
title="下次就诊时间"
:value="info.next_treat_at | date"
isLink
rightIcon="edit-pen"
@click="toggleDatePicker('next_treat_at')"
/>
<u-cell
title="通知人"
:value="adminUser.notify_user_name"
isLink
rightIcon="edit-pen"
@click="opendAdminUser('notify_user')"
/>
<u-cell
title="通知时间"
:value="info.notify_at | date"
isLink
rightIcon="edit-pen"
@click="toggleDatePicker('notify_at')"
/>
<u-cell
title="通知备注"
:value="info.notify_remarks"
isLink
rightIcon="edit-pen"
@click="openModal('通知备注', 'notify_remarks', 'text')"
/>
<u-cell
title="录入时间"
:value="info.created_at"
/>
</u-cell-group>
<select-admin-user ref="select-admin-user" @select="selectAdminUser" />
<u-action-sheet
:title="type.title"
:show="type.show"
:actions="type.options"
:closeOnClickOverlay="true"
@close="toggleType"
@select="selectType"
/>
<u-datetime-picker
v-model="datePicker.value"
mode="datetime"
:show="datePicker.show"
:closeOnClickOverlay="true"
:minDate="datePicker.minDate"
@close="toggleDatePicker"
@cancel="toggleDatePicker"
@confirm="selectDatePicker"
/>
<u-modal
:show="modal.show"
:title="modal.title"
:showCancelButton="true"
:closeOnClickOverlay="true"
:asyncClose="false"
@confirm="confirmModal"
@cancel="closeModal"
@close="closeModal"
>
<u--input v-if="modal.type == 'text'" v-model="modal.value" border="surround" />
<u--input v-if="modal.type == 'number'" v-model="modal.value" type="number" border="surround" />
<u--textarea v-if="modal.type == 'textarea'" v-model="modal.value" :showConfirmBar="false" />
</u-modal>
<u-action-sheet
:title="orderStatus.title"
:show="orderStatus.show"
:actions="orderStatus.options"
:closeOnClickOverlay="true"
@close="toggleOrderStatus"
@select="selectOrderStatus"
/>
</view>
</template>
<script>
import SelectAdminUser from '../../components/select-admin-user'
import orderStatus from '../../enums/order_status'
export default {
components: {SelectAdminUser},
data() {
return {
id: '',
info: {
patient_id: '',
type_id: '',
origin_price: '',
sell_price: '',
notify_remarks: ''
},
adminUser: {
key: '',
doctor_name: '',
notify_user_name: ''
},
type: {
text: '',
title: '类别',
show: false,
options: []
},
datePicker: {
show: false,
name: '',
value: (new Date).getTime(),
minDate: (new Date('1900-1-1')).getTime()
},
modal: {
type: 'text',
show: false,
title: '',
key: '',
value: ''
},
orderStatus: {
title: '收费情况',
show: false,
text: '',
options: orderStatus.options,
}
}
},
onLoad(e) {
this.id = e.id
this.loadData()
this.$ajax.get('/admin-api/category', {_action: 'getData'}).then(res => {
if (res.status == 0) {
this.type.options = res.data.items
}
})
},
onPullDownRefresh() {
this.loadData()
},
methods: {
loadData() {
if (!this.id) {
return
}
uni.showLoading()
this.$ajax.get(`/admin-api/record/${this.id}`, {_action: 'getData'}).then(res => {
uni.stopPullDownRefresh()
if (res.status == 0) {
this.info = res.data
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 : ''
}
}).catch(error => {
uni.stopPullDownRefresh()
})
},
update(key, value) {
const params = {
id: this.id,
}
params[key] = value
return this.$ajax.put(`/admin-api/record/${this.id}`, params)
},
opendAdminUser(name) {
this.adminUser.key = name
this.$refs['select-admin-user'].open()
},
closeAdminUser() {
this.adminUser.key = ''
this.$refs['select-admin-user'].close()
},
selectAdminUser(e) {
const key = this.adminUser.key
const value = e.id
this.update(`${key}_id`, value).then(res => {
this.closeAdminUser()
if (res.status == 0) {
this.info[`${key}_id`] = value
this.adminUser[`${key}_name`] = e.name
}
})
},
toggleType() {
this.type.show = !this.type.show
},
selectType(e) {
this.update('type_id', e.id).then(res => {
if (res.status == 0) {
this.type.text = e.name
this.info.type_id = e.id
}
})
},
toggleDatePicker(name) {
if (name) {
this.datePicker.name = name
this.datePicker.value = this.info[name] ? Math.floor(this.info[name] * 1000) : (new Date).getTime()
}
this.datePicker.show = !this.datePicker.show
},
selectDatePicker(e) {
const value = Math.floor(e.value / 1000)
const key = this.datePicker.name
this.update(key, value).then(res => {
if (res.status == 0) {
this.info[key] = value
this.toggleDatePicker()
}
})
},
openModal(title, name, type) {
this.modal.type = type ? type : 'text'
this.modal.title = title
this.modal.key = name
this.modal.show = true
this.modal.value = this.info[name]
},
confirmModal() {
const key = this.modal.key
const value = this.modal.value
this.update(key, value).then(res => {
this.closeModal()
if (res.status == 0) {
this.info[key] = value
}
})
},
closeModal() {
this.modal.show = false
},
toggleOrderStatus() {
this.orderStatus.show = !this.orderStatus.show
},
selectOrderStatus(e) {
const key = 'order_status'
const value = e.value
const text = e.name
this.update(key, value).then(res => {
if (res.status == 0) {
this.orderStatus.text = text
this.info[key] = value
}
})
},
}
}
</script>
<style>
</style>

View File

@ -0,0 +1,338 @@
<template>
<view class="page">
<u--form :model="form" ref="form" labelWidth="70" :borderBottom="false">
<u-form-item prop="patient_id" label="姓名" :borderBottom="true">
<view class="input-text">
<text>{{ patient.name }}</text>
</view>
</u-form-item>
<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')">
<view class="input-text">
<text v-if="form.treat_at">{{ form.treat_at | date }}</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')">
<view class="input-text">
<text v-if="form.doctor_id">{{ adminUser.doctor_name }}</text>
<text v-else class="input-placeholder">请选择诊疗医生</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item prop="form.origin_price" label="划线价" :required="true" :borderBottom="true">
<u-number-box
v-model="form.origin_price"
:showMinus="false"
:showPlus="false"
:min="0"
decimalLength="2"
:asyncChange="true"
inputWidth="100%"
/>
</u-form-item>
<u-form-item prop="form.sell_price" label="实收价" :required="true" :borderBottom="true">
<u-number-box
v-model="form.sell_price"
:showMinus="false"
:showPlus="false"
:min="0"
decimalLength="2"
:asyncChange="true"
inputWidth="100%"
/>
</u-form-item>
<u-form-item prop="order_status" label="收费情况" :required="true" :borderBottom="true">
<u-radio-group v-model="form.order_status">
<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 prop="content" :borderBottom="true">
<u--textarea v-model="form.content" :showConfirmBar="false" :autoHeight="true" placeholder="请输入诊疗情况" />
</u-form-item>
<u-form-item prop="next_treat_at" label="下次就诊" :borderBottom="true" @click="toggleDatePicker('next_treat_at')">
<view class="input-text">
<text v-if="form.next_treat_at">{{ form.next_treat_at | date }}</text>
<text v-else class="input-placeholder">请选择下次就诊时间</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item prop="notify_user_id" label="通知人" :borderBottom="true" @click="opendAdminUser('notify_user')">
<view class="input-text">
<text v-if="form.notify_user_id">{{ adminUser.notify_user_name }}</text>
<text v-else class="input-placeholder">请选择通知人</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item prop="notify_at" label="通知时间" :borderBottom="true" @click="toggleDatePicker('notify_at')">
<view class="input-text">
<text v-if="form.notify_at">{{ form.notify_at | date }}</text>
<text v-else class="input-placeholder">请选择通知时间</text>
<u-icon name="arrow-right" />
</view>
</u-form-item>
<u-form-item prop="notify_remarks" label="通知备注" :borderBottom="true">
<u--input v-model="form.notify_remarks" placeholder="请输入通知备注" border="none" />
</u-form-item>
<u-form-item label="操作人" :borderBottom="true">
<view class="input-text">{{ currentUser.name }}</view>
</u-form-item>
<view class="button">
<u-button text="提交" type="primary" @click="submit"></u-button>
</view>
</u--form>
<u-datetime-picker
v-model="datePicker.value"
mode="datetime"
:show="datePicker.show"
:closeOnClickOverlay="true"
:minDate="datePicker.minDate"
@close="toggleDatePicker"
@cancel="toggleDatePicker"
@confirm="selectDatePicker"
/>
<select-admin-user ref="select-admin-user" @select="selectAdminUser" />
</view>
</template>
<script>
import SelectAdminUser from '../../components/select-admin-user'
import orderStatus from '../../enums/order_status'
export default {
components: {SelectAdminUser},
data() {
return {
id: '',
info: {},
form: {
patient_id: '',
type_id: '',
doctor_id: '',
treat_at: Math.floor((new Date).getTime() / 1000),
origin_price: 0,
sell_price: 0,
order_status: orderStatus.success.value,
content: '',
next_treat_at: '',
notify_user_id: '',
notify_at: '',
notify_remarks: ''
},
rules: {
'treat_at': {
required: true,
message: '必填',
trigger: ['blur', 'change']
},
'doctor_id': {
required: true,
message: '必填',
trigger: ['blur', 'change']
},
'origin_price': {
required: true,
message: '必填',
trigger: ['blur', 'change']
},
'sell_price': {
required: true,
message: '必填',
trigger: ['blur', 'change']
},
},
typeList: [],
patient: {},
datePicker: {
show: false,
name: '',
value: (new Date).getTime(),
minDate: (new Date('1900-1-1')).getTime()
},
adminUser: {
key: ''
},
orderStatus: orderStatus,
currentUser: {},
}
},
onLoad(e) {
this.id = e.id
if (!e.id) {
uni.setNavigationBarTitle({
title: '添加病历'
})
if (!e.patient) {
return uni.showModal({
title: '请选择病人',
showCancel: false,
success: () => {
uni.navigateBack()
}
})
}
this.$ajax.get(`/admin-api/patient/${e.patient}`, {_action: 'getData'}).then(res => {
if (res.status == 0) {
this.patient = res.data
this.form.patient_id = this.patient.id
}
})
} else {
uni.setNavigationBarTitle({
title: '修改病历'
})
this.$ajax.get(`/admin-api/record/${e.id}`, {_action: 'getData'}).then(res => {
if (res.status == 0) {
this.info = res.data
this.patient = res.data.patient
this.form = {
patient_id: this.info.patient_id,
type_id: this.info.type_id,
doctor_id: this.info.doctor_id,
treat_at: this.info.treat_at,
origin_price: this.info.origin_price,
sell_price: this.info.sell_price,
order_status: this.info.order_status,
content: this.info.content,
next_treat_at: this.info.next_treat_at,
notify_user_id: this.info.notify_user_id,
notify_at: this.info.notify_at,
notify_remarks: this.info.notify_remarks
}
}
})
}
this.$ajax.get('/admin-api/category', {_action: 'getData'}).then(res => {
if (res.status == 0) {
this.typeList = res.data.items
const type_id = uni.getStorageSync('medical_record_treat_type_id');
if (type_id) {
this.form.type_id = type_id
this.typeChange(type_id)
}
}
})
this.$ajax.get('/admin-api/current-user').then(res => {
if (res.status == 0) {
this.currentUser = res.data
this.form.doctor_id = this.currentUser.id
this.adminUser.doctor_name = this.currentUser.name
this.form.notify_user_id = this.currentUser.id
this.adminUser.notify_user_name = this.currentUser.name
}
})
},
onReady() {
this.$refs['form'].setRules(this.rules)
},
methods: {
submit() {
this.$refs['form'].validate().then(res => {
console.log(res)
uni.showLoading()
if (this.id) {
this.update()
} else {
this.create()
}
}).catch(error => {})
},
update() {
this.form.id = this.id
this.$ajax.put(`/admin-api/record/${this.id}`, this.form).then(res => {
if (res.status == 0) {
uni.showToast({
title: '保存成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 1500);
}
})
},
create() {
this.$ajax.post('/admin-api/record', this.form).then(res => {
if (res.status == 0) {
uni.showToast({
title: '提交成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 1500);
}
})
},
toggleDatePicker(name) {
if (name) {
this.datePicker.name = name
this.datePicker.value = this.form[name] ? Math.floor(this.form[name] * 1000) : (new Date).getTime()
}
this.datePicker.show = !this.datePicker.show
},
selectDatePicker(e) {
this.form[this.datePicker.name] = Math.floor(e.value / 1000)
this.toggleDatePicker()
},
opendAdminUser(name) {
this.adminUser.key = name
this.$refs['select-admin-user'].open()
},
closeAdminUser() {
this.adminUser.key = ''
this.$refs['select-admin-user'].close()
},
selectAdminUser(e) {
const key = this.adminUser.key
this.form[`${key}_id`] = e.id
this.adminUser[`${key}_name`] = e.name
this.closeAdminUser()
},
typeChange(e) {
this.typeList.forEach(item => {
if (item.id == e) {
this.form.content = item.content
}
})
}
}
}
</script>
<style scoped>
.page {
padding: 0 20px;
background: white;
position: absolute;
height: 100%;
width: 100%;
box-sizing: border-box;
}
.input-text {
color: #303133;
font-size: 15px;
padding: 6px 9px;
width: 100%;
display: flex;
justify-content: space-between;
}
.input-placeholder {
color: #c0c0c0;
}
.button {
width: 100%;
margin-top: 20px;
}
.u-number-box {
width: 100%;
}
.u-radio {
margin-left: 10px;
}
</style>

View File

@ -0,0 +1,168 @@
<template>
<view class="page">
<u-subsection :list="typeList" :current="typeIndex" fontSize="16" @change="changeType" />
<u-list class="list" @scrolltolower="reachBottom">
<u-swipe-action>
<u-list-item v-for="item in list" :key="item.id">
<u-swipe-action-item :options="swipeOption" :name="item.id" @click="swipeClick">
<u-cell
:title="item.treat_at"
:clickable="true"
:isLink="false"
size="large"
:center="true"
:url="`/pages/record/detail?id=${item.id}`"
>
<view slot="label">
<view class="u-cell__label">
<text>{{ item.content }}</text>
</view>
</view>
<view slot="value">
<view class="list-item-price">
<text style="color: #dd524d;font-size: 19px">
<u-icon name="rmb" color="#dd524d" size="19px" />
{{ item.sell_price }}
</text>
<text style="color: #c0c0c0;text-decoration: line-through;">{{ item.origin_price }}</text>
</view>
<view v-if="item.doctor" class="list-item-doctor">
<text>{{ item.doctor.name }}</text>
</view>
</view>
</u-cell>
</u-swipe-action-item>
</u-list-item>
</u-swipe-action>
</u-list>
<u-action-sheet
:actions="option.list"
:title="option.title"
:show="option.show"
:closeOnClickOverlay="true"
@close="closeOption"
@select="chooseOption"
/>
</view>
</template>
<script>
export default {
data() {
return {
patient_id: '',
typeIndex: 0,
perPage: 20,
typeList: [],
list: [],
option: {
id: '',
show: false,
list: [
{ name: "详细", color: '#4cd964', action: 'detail' },
{ name: "修改", color: "#007aff", action: 'edit' },
{ name: "删除", color: "#dd524d", action: 'delete' },
],
title: '',
},
swipeOption: [
{ text: '删除', style: {backgroundColor: '#dd524d'} }
]
}
},
onLoad(e) {
this.patient_id = e.patient
},
onShow() {
this.loadData(true)
},
onPullDownRefresh() {
this.loadData(true)
},
onReady() {
this.$ajax.get('/admin-api/category', {_action: 'getData'}).then(res => {
if (res.status == 0) {
this.typeList = res.data.items
}
})
},
methods: {
changeType(e) {
this.typeIndex = e
this.loadData(true)
},
loadData(refresh) {
if (refresh) {
this.list = []
this.page = 1
}
uni.showLoading()
if (this.typeList.length == 0) {
return setTimeout(() => {
this.loadData(refresh)
}, 800);
}
const type = this.typeList[this.typeIndex]
this.$ajax.get('/admin-api/record?', {_action: 'getData', page: this.page, perPage: this.perPage, type_id: type.id, patient_id: this.patient_id}).then(res => {
uni.stopPullDownRefresh()
if (res.status == 0) {
this.list = this.list.concat(res.data.items)
this.total = res.data.total
}
}).catch(error => {
uni.stopPullDownRefresh()
})
},
reachBottom() {
if (this.list.length < this.total) {
this.page++
this.loadData()
}
},
openOption(index) {
const item = this.list[index]
this.option.title = item.name
this.option.id = item.id
this.option.show = true
},
closeOption() {
this.option.show = false
},
chooseOption(e) {
const id = this.option.id
if (e.action == 'detail') {
return uni.navigateTo({ url: `/pages/record/detail?id=${id}` })
}
if (e.action == 'edit') {
return uni.navigateTo({ url: `/pages/record/form?id=${id}&patient=${this.patient_id}` })
}
},
swipeClick(e) {
console.log(e)
},
handleDelete() {
},
}
}
</script>
<style scoped>
.u-list {
background: white;
}
.u-cell__label {
margin-top: 5px;
font-size: 12px;
color: #909193;
line-height: 18px;
}
.list-item-doctor {
text-align: right;
color: #007aff;
margin-top: 10px;
}
.u-icon {
display: inline-block;
}
</style>

View File

@ -42,7 +42,7 @@ $uni-border-color: #c8c7cc;
/* 文字尺寸 */
$uni-font-size-sm: 12px;
$uni-font-size-base: 14px;
$uni-font-size-lg: 16;
$uni-font-size-lg: 16px;
/* 图片尺寸 */
$uni-img-size-sm: 20px;