patient.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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. methods: {
  44. selectPatient(item){
  45. uni.$emit('refreshOrderPatient',item);
  46. uni.navigateBack({
  47. delta: 1
  48. })
  49. },
  50. editPatient(item){
  51. uni.navigateTo({
  52. url: './addEditPatient?type=edit&patientId='+item.patientId
  53. })
  54. },
  55. delPatient(item){
  56. uni.showModal({
  57. title:"提示",
  58. content:"确认删除吗?",
  59. showCancel:true,
  60. cancelText:'取消',
  61. confirmText:'确定',
  62. success:res=>{
  63. if(res.confirm){
  64. // 用户点击确定
  65. var data={patientId:item.patientId}
  66. delPatient(data).then(
  67. res => {
  68. if(res.code==200){
  69. uni.showToast({
  70. icon:'success',
  71. title: "操作成功",
  72. });
  73. this.getPatientList()
  74. }else{
  75. uni.showToast({
  76. icon:'none',
  77. title: "请求失败",
  78. });
  79. }
  80. },
  81. rej => {}
  82. );
  83. }else{
  84. // 否则点击了取消
  85. }
  86. }
  87. })
  88. },
  89. getPatientList(){
  90. // uni.showLoading({
  91. // title:"正在加载中"
  92. // })
  93. getPatientList().then(
  94. res => {
  95. uni.hideLoading()
  96. if(res.code==200){
  97. this.patient=res.data;
  98. }else{
  99. uni.showToast({
  100. icon:'none',
  101. title: "请求失败",
  102. });
  103. }
  104. },
  105. rej => {}
  106. );
  107. },
  108. addPatient() {
  109. uni.navigateTo({
  110. url: './addEditPatient?type=add'
  111. })
  112. }
  113. }
  114. }
  115. </script>
  116. <style lang="scss">
  117. page{
  118. height: 100%;
  119. }
  120. .content{
  121. height: 100%;
  122. display: flex;
  123. flex-direction: column;
  124. justify-content: space-between;
  125. .inner{
  126. flex: 1;
  127. padding: 20upx 20upx 160upx;
  128. .peop-item{
  129. box-sizing: border-box;
  130. height: 184upx;
  131. background: #FFFFFF;
  132. border-radius: 16upx;
  133. padding: 50upx 40upx 50upx 30upx;
  134. display: flex;
  135. align-items: center;
  136. justify-content: space-between;
  137. margin-bottom: 20upx;
  138. .info{
  139. .name{
  140. font-size: 30upx;
  141. font-family: PingFang SC;
  142. font-weight: bold;
  143. color: #111111;
  144. line-height: 1;
  145. }
  146. .detail{
  147. display: flex;
  148. align-items: center;
  149. margin-top: 30upx;
  150. .text{
  151. font-size: 26upx;
  152. font-family: PingFang SC;
  153. font-weight: 500;
  154. color: #999999;
  155. line-height: 1;
  156. margin-right: 30upx;
  157. &:last-child{
  158. margin-right: 0;
  159. }
  160. }
  161. }
  162. }
  163. .operat-box{
  164. display: flex;
  165. align-items: center;
  166. image{
  167. padding: 15rpx;
  168. width: 30upx;
  169. height: 30upx;
  170. margin-left: 10upx;
  171. &:first-child{
  172. margin-left: 0;
  173. }
  174. }
  175. }
  176. }
  177. }
  178. .btn-box{
  179. z-index: 9999;
  180. width: 100%;
  181. padding: 30upx;
  182. position: fixed;
  183. bottom: 0;
  184. left: 0;
  185. box-sizing: border-box;
  186. background: #FFFFFF;
  187. .sub-btn{
  188. width: 100%;
  189. height: 88upx;
  190. line-height: 88upx;
  191. text-align: center;
  192. font-size: 30upx;
  193. font-family: PingFang SC;
  194. font-weight: bold;
  195. color: #FFFFFF;
  196. background: #C39A58;
  197. border-radius: 44upx;
  198. }
  199. }
  200. }
  201. </style>