caregiverManage.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <view class="container">
  3. <view class="top-box">
  4. <view class="select-item" @click="showSelect(1)">
  5. <span class="name">{{params.hospitalId ? hospitalName : '全部医院'}}</span>
  6. <image src="/static/下箭头.png" mode="aspectFill"></image>
  7. </view>
  8. <view class="select-item" @click="showSelect(2)">
  9. <span class="name">{{params.sex ? sexName : '性别'}}</span>
  10. <image src="/static/下箭头.png" mode="aspectFill"></image>
  11. </view>
  12. <view class="select-item" @click="showSelect(3)">
  13. <span class="name">年龄</span>
  14. <image src="/static/sort2.png" mode="aspectFill"></image>
  15. </view>
  16. <view class="select-item" @click="showSelect(4)">
  17. <span class="name">服务中</span>
  18. <image src="/static/sort2.png" mode="aspectFill"></image>
  19. </view>
  20. </view>
  21. <view class="list-box">
  22. <view class="item-box" v-for="item,index in list" :key="index">
  23. <u-image :src="item.photographUrl" width="196rpx" height="256rpx" :lazy-load="true"></u-image>
  24. <view class="info-box">
  25. <view class=" item-txt">{{item.name}}</view>
  26. <view class="info-item age-box">
  27. <view class="box-l">
  28. <view class="item-txt">{{item.sex == '2' ? '女' : '男'}}</view>
  29. <view class="item-txt age">{{item.age || '0'}}岁</view>
  30. </view>
  31. <span class="btn" @click="toDetails(item.id)">去查看></span>
  32. </view>
  33. <view class="info-item item-txt">工作年限:{{item.workYears || 0}}年</view>
  34. <view class="info-item service-box">
  35. <span class="item-txt">服务中:{{item.inProgressCount || 0}}</span>
  36. <span class="item-txt total">服务总数: {{item.finishCount || 0}}</span>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <!-- 底部按钮 -->
  42. <view class="footer-box" v-if="type == 'guanli'">
  43. <view class="btn-box">
  44. <view class="submit-btn" @click="addCaregiver">新增护工</view>
  45. </view>
  46. </view>
  47. <u-action-sheet :show="showAction" :actions="hospitalList" title="请选择" @close="showAction = false"
  48. @select="actionSelect">
  49. </u-action-sheet>
  50. <u-action-sheet :show="showSex" :actions="sexList" title="请选择性别" @close="showSex = false" @select="sexSelect"
  51. safeAreaInsetBottom>
  52. </u-action-sheet>
  53. </view>
  54. </template>
  55. <script>
  56. import {
  57. dictData
  58. } from "@/api/home.js"
  59. import {
  60. getNurseList,
  61. getHospitalListByManage
  62. } from '@/api/hospital.js'
  63. export default {
  64. data() {
  65. return {
  66. showSex: false,
  67. showAction: false,
  68. list: [],
  69. params: {
  70. hospitalId: '',
  71. sex: '',
  72. sortFiled: 'age', //排序字段 年龄-age 服务中(数量)-serviceCount
  73. sortMethod: 'asc', //排序方式 正序-asc 倒序-desc
  74. },
  75. hospitalList: [],
  76. hospitalName: '',
  77. sexList: [],
  78. sexName: '',
  79. type: 'guanli',
  80. orderNo: '',
  81. }
  82. },
  83. onLoad(option) {
  84. this.getNurseList()
  85. this.getHospitalList()
  86. this.getSexList()
  87. if (option.type) {
  88. this.type = option.type
  89. }
  90. if (option.orderNo) {
  91. this.orderNo = option.orderNo
  92. this.params.hospitalId = option.hospitalId
  93. this.hospitalName = option.hospitalName
  94. }
  95. },
  96. methods: {
  97. getNurseList() {
  98. let that = this;
  99. uni.showLoading({
  100. title: '加载中',
  101. mask: true,
  102. });
  103. getNurseList(this.params).then(res => {
  104. if (res.code == 200) {
  105. let data = res.data;
  106. this.list = data;
  107. }
  108. })
  109. .catch((err) => {
  110. console.log(err);
  111. }).finally(() => {
  112. uni.hideLoading();
  113. });
  114. },
  115. //获取于老师关联的医院
  116. getHospitalList() {
  117. let that = this;
  118. getHospitalListByManage().then(res => {
  119. if (res.code == 200) {
  120. let data = res.data;
  121. data.unshift({
  122. id: '',
  123. name: '全部',
  124. })
  125. this.hospitalList = data;
  126. }
  127. })
  128. .catch((err) => {
  129. console.log(err);
  130. })
  131. },
  132. //去查看详情
  133. toDetails(id) {
  134. uni.navigateTo({
  135. url: '/pages/workbench/caregiverDetails?id=' + id + '&type=' + this.type + '&orderNo=' + this.orderNo
  136. })
  137. },
  138. //获取性别字典
  139. getSexList() {
  140. let that = this;
  141. dictData('sys_user_sex').then(res => {
  142. let data = res.data;
  143. data.forEach(item => {
  144. item.name = item.dictLabel
  145. })
  146. data.unshift({
  147. dictValue: '',
  148. name: '全部',
  149. })
  150. that.sexList = data;
  151. // if (that.InfoId) {
  152. // that.formData.genderName = that.sexList.find(item => item.dictValue == that.formData
  153. // .gender).name
  154. // }
  155. }, err => {
  156. console.log(err);
  157. }).finally(() => {
  158. });
  159. },
  160. showSelect(val) {
  161. if(this.type != 'guanli') return
  162. switch (val) {
  163. case 1:
  164. this.showAction = true;
  165. break;
  166. case 2:
  167. this.showSex = true;
  168. break;
  169. case 3:
  170. this.params.sortFiled = 'age';
  171. this.params.sortMethod = this.params.sortMethod == 'asc' ? 'desc' : 'asc';
  172. this.getNurseList();
  173. break;
  174. case 4:
  175. this.params.sortFiled = 'serviceCount';
  176. this.params.sortMethod = this.params.sortMethod == 'asc' ? 'desc' : 'asc';
  177. this.getNurseList();
  178. break;
  179. }
  180. },
  181. actionSelect(e) {
  182. console.log(e);
  183. this.showAction = false;
  184. this.params.hospitalId = e.id
  185. this.hospitalName = e.name
  186. this.getNurseList()
  187. },
  188. sexSelect(e) {
  189. console.log(e);
  190. this.showAction = false;
  191. this.params.sex = e.dictValue
  192. this.sexName = e.name
  193. this.getNurseList()
  194. },
  195. addCaregiver() {
  196. uni.navigateTo({
  197. url: '/pages/workbench/caregiverForm?type=add',
  198. })
  199. },
  200. }
  201. }
  202. </script>
  203. <style scoped lang="scss">
  204. .container {
  205. padding: 20rpx 20rpx 200rpx;
  206. .top-box {
  207. display: flex;
  208. align-items: center;
  209. justify-content: space-between;
  210. .select-item {
  211. display: flex;
  212. align-items: center;
  213. justify-content: space-between;
  214. padding: 20rpx;
  215. border-radius: 10rpx;
  216. background-color: #fff;
  217. margin-right: 10rpx;
  218. &:first-child {
  219. width: 250rpx;
  220. .name {
  221. font-size: 24rpx;
  222. margin-right: 10rpx;
  223. //一行省略
  224. overflow: hidden;
  225. text-overflow: ellipsis;
  226. white-space: nowrap;
  227. width: 200rpx;
  228. }
  229. }
  230. &:last-child {
  231. margin-right: 0;
  232. }
  233. .name {
  234. font-size: 24rpx;
  235. margin-right: 10rpx;
  236. }
  237. image {
  238. width: 30rpx;
  239. height: 30rpx;
  240. }
  241. }
  242. }
  243. .list-box {
  244. display: flex;
  245. flex-direction: column;
  246. .item-box {
  247. display: flex;
  248. align-items: center;
  249. background-color: #fff;
  250. border-radius: 10rpx;
  251. margin-top: 20rpx;
  252. padding: 20rpx;
  253. .info-box {
  254. display: flex;
  255. flex-direction: column;
  256. justify-content: space-between;
  257. margin-left: 20rpx;
  258. flex: 1;
  259. .info-item {
  260. margin-top: 30rpx;
  261. }
  262. .item-txt {
  263. font-size: 28rpx;
  264. color: #1a1a1a;
  265. }
  266. .age-box {
  267. display: flex;
  268. align-items: center;
  269. justify-content: space-between;
  270. .box-l {
  271. display: flex;
  272. align-items: center;
  273. .age {
  274. margin-left: 30rpx;
  275. }
  276. }
  277. .btn {
  278. font-size: 28rpx;
  279. color: #4B91D1;
  280. }
  281. }
  282. .service-box {
  283. display: flex;
  284. align-items: center;
  285. justify-content: space-between;
  286. .total {}
  287. }
  288. }
  289. }
  290. }
  291. .footer-box {
  292. position: fixed;
  293. bottom: 0;
  294. left: 0;
  295. display: flex;
  296. align-items: center;
  297. justify-content: space-between;
  298. width: 100%;
  299. padding: 50rpx 30rpx;
  300. box-sizing: border-box;
  301. font-size: 28rpx;
  302. background-color: #fff;
  303. box-shadow: 0 -2rpx 30rpx #c5c5c53a;
  304. .btn-box {
  305. width: 100%;
  306. .submit-btn {
  307. display: block;
  308. width: 100%;
  309. height: 80rpx;
  310. line-height: 80rpx;
  311. text-align: center;
  312. color: #fff;
  313. background-color: #026EB7;
  314. border-radius: 50rpx;
  315. }
  316. }
  317. }
  318. }
  319. </style>