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