patient.vue 4.5 KB

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