swipe
parent
201fc5d15d
commit
4fb1011fcd
|
|
@ -64,7 +64,9 @@
|
|||
/>
|
||||
</u-cell-group>
|
||||
<div class="btn">
|
||||
<u-button text="病历记录" type="success" />
|
||||
<u-button text="添加病历" type="primary" @click="addRecord" />
|
||||
<u-button text="病历记录" type="success" @click="listRecord" />
|
||||
<u-button text="删除病人" type="error" @click="deletePatient" />
|
||||
</div>
|
||||
<u-modal
|
||||
:show="modal.show"
|
||||
|
|
@ -217,6 +219,37 @@ export default {
|
|||
})
|
||||
this.closeDoctor()
|
||||
},
|
||||
addRecord() {
|
||||
return uni.navigateTo({ url: `/pages/record/form?patient=${this.id}` })
|
||||
},
|
||||
listRecord() {
|
||||
return uni.navigateTo({ url: `/pages/record/index?patient=${this.id}` })
|
||||
},
|
||||
deletePatient() {
|
||||
uni.showModal({
|
||||
title: '删除 ' + this.info.name,
|
||||
content: '是否确定?',
|
||||
success: (result) => {
|
||||
if (result.confirm) {
|
||||
this.delete(this.info.id)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
delete(id) {
|
||||
uni.showLoading()
|
||||
this.$ajax.delete(`/admin-api/patient/${id}`).then(res => {
|
||||
if (res.status == 0) {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -227,6 +260,8 @@ export default {
|
|||
}
|
||||
.btn {
|
||||
padding: 0 10px;
|
||||
}
|
||||
.btn .u-button {
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -13,15 +13,19 @@
|
|||
<u-button type="primary" icon="plus" shape="circle" size="large" @click="add" />
|
||||
</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"
|
||||
@click="openOption(index)"
|
||||
:url=" `/pages/patient/detail?id=${item.id}`"
|
||||
/>
|
||||
</u-swipe-action-item>
|
||||
</u-list-item>
|
||||
</u-swipe-action>
|
||||
</u-list>
|
||||
<u-action-sheet
|
||||
:actions="option.list"
|
||||
|
|
@ -54,7 +58,11 @@ export default {
|
|||
{ name: "删除", color: "#dd524d", action: 'delete' },
|
||||
],
|
||||
title: '',
|
||||
}
|
||||
},
|
||||
swipeOption: [
|
||||
{ text: '删除', style: {backgroundColor: '#dd524d'} }
|
||||
]
|
||||
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
|
|
@ -131,6 +139,21 @@ export default {
|
|||
return uni.navigateTo({ url: `/pages/record/index?patient=${id}` })
|
||||
}
|
||||
},
|
||||
swipeClick(e) {
|
||||
const action = e.index
|
||||
const item = this.list[e.name]
|
||||
if (action == 0) {
|
||||
return uni.showModal({
|
||||
title: '删除 ' + item.name,
|
||||
content: '是否确定?',
|
||||
success: (result) => {
|
||||
if (result.confirm) {
|
||||
this.delete(item.id)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
delete(id) {
|
||||
uni.showLoading()
|
||||
this.$ajax.delete(`/admin-api/patient/${id}`).then(res => {
|
||||
|
|
|
|||
|
|
@ -87,6 +87,9 @@
|
|||
:value="info.created_at"
|
||||
/>
|
||||
</u-cell-group>
|
||||
<div class="btn">
|
||||
<u-button text="删除病历" type="error" @click="deleteRecord" />
|
||||
</div>
|
||||
<select-admin-user ref="select-admin-user" @select="selectAdminUser" />
|
||||
<u-action-sheet
|
||||
:title="type.title"
|
||||
|
|
@ -298,10 +301,39 @@ export default {
|
|||
}
|
||||
})
|
||||
},
|
||||
deleteRecord() {
|
||||
uni.showModal({
|
||||
title: '删除病历记录',
|
||||
content: '是否确定?',
|
||||
success: (result) => {
|
||||
if (result.confirm) {
|
||||
this.handleDelete(this.id)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDelete(id) {
|
||||
uni.showLoading()
|
||||
this.$ajax.delete(`/admin-api/record/${id}`).then(res => {
|
||||
if (res.status == 0) {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
<style scoped>
|
||||
.btn {
|
||||
padding: 0 10px;
|
||||
}
|
||||
.btn .u-button {
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -211,9 +211,12 @@ export default {
|
|||
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');
|
||||
let type_id = e.type_id
|
||||
if (!type_id) {
|
||||
type_id = uni.getStorageSync('medical_record_treat_type_id')
|
||||
}
|
||||
if (type_id) {
|
||||
this.form.type_id = type_id
|
||||
this.form.type_id = parseInt(type_id)
|
||||
this.typeChange(type_id)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
<template>
|
||||
<view class="page">
|
||||
<u-subsection :list="typeList" :current="typeIndex" fontSize="16" @change="changeType" />
|
||||
<view class="add-button">
|
||||
<u-button type="primary" icon="plus" shape="circle" size="large" @click="add" />
|
||||
</view>
|
||||
<u-list class="list" @scrolltolower="reachBottom">
|
||||
<u-swipe-action>
|
||||
<u-list-item v-for="item in list" :key="item.id">
|
||||
|
|
@ -51,6 +54,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
patient_id: '',
|
||||
patient: {},
|
||||
typeIndex: 0,
|
||||
perPage: 20,
|
||||
typeList: [],
|
||||
|
|
@ -72,6 +76,12 @@ export default {
|
|||
},
|
||||
onLoad(e) {
|
||||
this.patient_id = e.patient
|
||||
this.$ajax.get(`/admin-api/patient/${this.patient_id}`, {_action: 'getData'}).then(res => {
|
||||
if (res.status == 0) {
|
||||
this.patient = res.data
|
||||
uni.setNavigationBarTitle({ title: this.patient.name })
|
||||
}
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
this.loadData(true)
|
||||
|
|
@ -83,6 +93,7 @@ export default {
|
|||
this.$ajax.get('/admin-api/category', {_action: 'getData'}).then(res => {
|
||||
if (res.status == 0) {
|
||||
this.typeList = res.data.items
|
||||
this.loadData()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
@ -96,12 +107,11 @@ export default {
|
|||
this.list = []
|
||||
this.page = 1
|
||||
}
|
||||
uni.showLoading()
|
||||
// 要等分类接口返回了, 然后再去查询记录
|
||||
if (this.typeList.length == 0) {
|
||||
return setTimeout(() => {
|
||||
this.loadData(refresh)
|
||||
}, 800);
|
||||
return
|
||||
}
|
||||
uni.showLoading()
|
||||
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()
|
||||
|
|
@ -138,11 +148,37 @@ export default {
|
|||
}
|
||||
},
|
||||
swipeClick(e) {
|
||||
console.log(e)
|
||||
const action = e.index
|
||||
if (action == 0) {
|
||||
return uni.showModal({
|
||||
title: '删除病历记录',
|
||||
content: '是否确定?',
|
||||
success: (result) => {
|
||||
if (result.confirm) {
|
||||
this.handleDelete(e.name)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
handleDelete() {
|
||||
|
||||
handleDelete(id) {
|
||||
uni.showLoading()
|
||||
this.$ajax.delete(`/admin-api/record/${id}`).then(res => {
|
||||
if (res.status == 0) {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.loadData(true)
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
},
|
||||
add() {
|
||||
const type = this.typeList[this.typeIndex]
|
||||
return uni.navigateTo({ url: `/pages/record/form?patient=${this.patient_id}&type_id=${type.id}` })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -165,4 +201,10 @@ export default {
|
|||
.u-icon {
|
||||
display: inline-block;
|
||||
}
|
||||
.add-button {
|
||||
position: absolute;
|
||||
bottom: 100px;
|
||||
right: 50px;
|
||||
z-index: 999;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue