patient.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <view class="content">
  3. <view class="inner">
  4. <view v-for="(item,index) in patient" :key="index" @click.stop="selectPatient(item)" class="peop-item">
  5. <view class="info" >
  6. <view class="name">{{item.patientName}}</view>
  7. <view class="detail">
  8. <text class="text" v-if="item.sex==1">男</text>
  9. <text class="text" v-if="item.sex==2">女</text>
  10. <text class="text">{{$getAge(item.birthday)}}岁</text>
  11. <text class="text">{{$parseIdCard(item.idCard)}}</text>
  12. </view>
  13. </view>
  14. <view class="operat-box">
  15. <image src="../../static/images/del.png" mode="" @click.stop="delPatient(item)" ></image>
  16. <image src="../../static/images/edit.png" mode="" @click.stop="editPatient(item)"></image>
  17. </view>
  18. </view>
  19. <view v-if="patient.length == 0" class="no-data-box" @click="getPatientList()">
  20. <image src="https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png" mode="aspectFit"></image>
  21. <view class="empty-title">暂无数据</view>
  22. </view>
  23. </view>
  24. <view class="btn-box">
  25. <view class="sub-btn" @click="addPatient">创建就诊人</view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import {getPatientList,delPatient} from '@/api/patient'
  31. export default {
  32. data() {
  33. return {
  34. patient:[],
  35. }
  36. },
  37. onLoad() {
  38. this.getPatientList()
  39. uni.$on('refreshPatient', () => {
  40. this.getPatientList()
  41. })
  42. },
  43. onUnload() {
  44. uni.$off('refreshPatient')
  45. },
  46. methods: {
  47. selectPatient(item){
  48. uni.$emit('refreshOrderPatient',item);
  49. uni.navigateBack({
  50. delta: 1
  51. })
  52. },
  53. editPatient(item){
  54. uni.navigateTo({
  55. url: './addEditPatient?type=edit&patientId='+item.patientId
  56. })
  57. },
  58. delPatient(item){
  59. uni.showModal({
  60. title:"提示",
  61. content:"确认删除吗?",
  62. showCancel:true,
  63. cancelText:'取消',
  64. confirmText:'确定',
  65. success:res=>{
  66. if(res.confirm){
  67. // 用户点击确定
  68. var data={patientId:item.patientId}
  69. delPatient(data).then(
  70. res => {
  71. if(res.code==200){
  72. uni.showToast({
  73. icon:'success',
  74. title: "操作成功",
  75. });
  76. this.getPatientList()
  77. }else{
  78. uni.showToast({
  79. icon:'none',
  80. title: "请求失败",
  81. });
  82. }
  83. },
  84. rej => {}
  85. );
  86. }else{
  87. // 否则点击了取消
  88. }
  89. }
  90. })
  91. },
  92. getPatientList(){
  93. // uni.showLoading({
  94. // title:"正在加载中"
  95. // })
  96. getPatientList().then(
  97. res => {
  98. uni.hideLoading()
  99. if(res.code==200){
  100. this.patient=res.data;
  101. }else{
  102. uni.showToast({
  103. icon:'none',
  104. title: "请求失败",
  105. });
  106. }
  107. },
  108. rej => {}
  109. );
  110. },
  111. addPatient() {
  112. uni.navigateTo({
  113. url: './addEditPatient?type=add'
  114. })
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss">
  120. page{
  121. height: 100%;
  122. }
  123. .content{
  124. height: 100%;
  125. display: flex;
  126. flex-direction: column;
  127. justify-content: space-between;
  128. .inner{
  129. flex: 1;
  130. padding: 20upx 20upx 160upx;
  131. .peop-item{
  132. box-sizing: border-box;
  133. height: 184upx;
  134. background: #FFFFFF;
  135. border-radius: 16upx;
  136. padding: 50upx 40upx 50upx 30upx;
  137. display: flex;
  138. align-items: center;
  139. justify-content: space-between;
  140. margin-bottom: 20upx;
  141. .info{
  142. .name{
  143. font-size: 30upx;
  144. font-family: PingFang SC;
  145. font-weight: bold;
  146. color: #111111;
  147. line-height: 1;
  148. }
  149. .detail{
  150. display: flex;
  151. align-items: center;
  152. margin-top: 30upx;
  153. .text{
  154. font-size: 26upx;
  155. font-family: PingFang SC;
  156. font-weight: 500;
  157. color: #999999;
  158. line-height: 1;
  159. margin-right: 30upx;
  160. &:last-child{
  161. margin-right: 0;
  162. }
  163. }
  164. }
  165. }
  166. .operat-box{
  167. display: flex;
  168. align-items: center;
  169. image{
  170. padding: 15rpx;
  171. width: 30upx;
  172. height: 30upx;
  173. margin-left: 10upx;
  174. &:first-child{
  175. margin-left: 0;
  176. }
  177. }
  178. }
  179. }
  180. }
  181. .btn-box{
  182. z-index: 9999;
  183. width: 100%;
  184. padding: 30upx;
  185. position: fixed;
  186. bottom: 0;
  187. left: 0;
  188. box-sizing: border-box;
  189. background: #FFFFFF;
  190. .sub-btn{
  191. width: 100%;
  192. height: 88upx;
  193. line-height: 88upx;
  194. text-align: center;
  195. font-size: 30upx;
  196. font-family: PingFang SC;
  197. font-weight: bold;
  198. color: #FFFFFF;
  199. background: #C39A58;
  200. border-radius: 44upx;
  201. }
  202. }
  203. }
  204. </style>