page4.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <view class="page4-warp">
  3. <view class="info-dot">打卡记录({{listTotal}}次)</view>
  4. <view class="flow-list">
  5. <up-steps current="2" direction="column">
  6. <up-steps-item v-for="(flow, index) in listData" :key="index" class="position-relative"
  7. :title="flow.nodeTitle">
  8. <template #icon>
  9. <view class="flow-icon"></view>
  10. </template>
  11. <template #desc>
  12. <view class="flow-des">
  13. <view class="flow-des-top">
  14. <view> {{flow.createTime??' '}}</view>
  15. <!-- <view :class="`flow-des-top-tips`">查看</view> -->
  16. </view>
  17. <view class="flow-des-bg">
  18. <view v-if="flow.fileList.length>0">
  19. <view>打卡图片({{flow.imgNum}}张):</view>
  20. <view class="flow-des-img">
  21. <!-- <up-image v-for="(item, index1) in flow.fileList" :key="index1"
  22. :width="'161rpx'" :height="'161rpx'" :src="item" mode="aspectFill"
  23. @click="previewImg(flow.fileList,index1)">
  24. <template #error>
  25. <image src="@/pages/subpack/static/images/error-img.png"
  26. style="width: 161rpx;height: 161rpx;" mode="aspectFill" />
  27. </template>
  28. </up-image> -->
  29. <image v-for="(item, index1) in flow.fileList" :key="index1" :src="item"
  30. style="width: 161rpx;height: 161rpx;" mode="aspectFill"
  31. @click="previewImg(flow.fileList,index1)"></image>
  32. </view>
  33. </view>
  34. <view :class="`flow-des-des`" v-if="flow.remark">
  35. {{flow.remark}}
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. </up-steps-item>
  41. </up-steps>
  42. <view v-if="listData.length === 0">
  43. <up-empty text="暂无打卡记录" />
  44. </view>
  45. </view>
  46. <view v-if="computeShowBtn" class="btn-box">
  47. <view class="flex-row ">
  48. <up-button class="up-button" type="error" style="width: 250rpx;" @tap="dieHandle">死亡</up-button>
  49. <view class="btn-place"></view>
  50. <up-button class="up-button" type="success" style="width: 250rpx;" @tap="endHandle">结束</up-button>
  51. <view class="btn-place"></view>
  52. <up-button class="up-button" type="primary" @tap="clockHandle">‌打卡</up-button>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script setup>
  58. import {
  59. ref,
  60. onMounted,
  61. onUnmounted,
  62. computed,
  63. getCurrentInstance
  64. } from 'vue';
  65. import {
  66. useStore
  67. } from 'vuex';
  68. import {
  69. onLoad,
  70. } from "@dcloudio/uni-app"
  71. import {
  72. getClockList,
  73. completeTask
  74. } from '@/common/config/application-api.js'
  75. import errorImage from '@/pages/subpack/static/images/error-img.png';
  76. const listData = ref([]);
  77. const listTotal = ref(0);
  78. const {
  79. proxy
  80. } = getCurrentInstance();
  81. const props = defineProps({
  82. item: {
  83. type: Object,
  84. default () {
  85. return {}
  86. }
  87. }
  88. })
  89. onMounted(() => {
  90. console.log('onMounted Page4');
  91. uni.$on('reloadLine', () => {
  92. getList();
  93. })
  94. })
  95. onUnmounted(() => {
  96. uni.$off('reloadLine')
  97. })
  98. // 图片预览
  99. const previewImg = (imgList, index) => {
  100. // console.log(imgList);
  101. if (imgList.length > 0) {
  102. uni.previewImage({
  103. urls: imgList,
  104. current: index
  105. })
  106. }
  107. }
  108. const computeShowBtn = computed(() => {
  109. return proxy.vuex_user.roles.includes('nurse') && props.item.dealStatus !== 'complete' && props.item
  110. .dealStatus !== 'wait_complete'
  111. })
  112. function getList() {
  113. if (!props.item.applyId) return false;
  114. let params = {
  115. pageNum: 1,
  116. pageSize: 500,
  117. applyId: props.item.applyId
  118. }
  119. getClockList({
  120. params
  121. }).then(data => {
  122. //数组倒叙
  123. listData.value = data.reverse();
  124. listData.value.map(v => {
  125. const imgs = v.imgPaths.split(",").filter(item => item.trim() !== "");
  126. let fileList = []
  127. imgs.forEach(function(item) {
  128. let url = uni.$u.http.config.baseURL + '/prod-api/' + item;
  129. fileList.push(url);
  130. })
  131. //截取前三张图片
  132. v.fileList = fileList.slice(0, 3);
  133. })
  134. listTotal.value = data.length;
  135. })
  136. }
  137. // function imgErrorHandle(index, index1) {
  138. // listData.value[index].fileList[index1] = errorImage;
  139. // }
  140. // 死亡
  141. function dieHandle() {
  142. uni.$u.route('/pages/subpack/pages/nurse/clockIn', {
  143. type: 1,
  144. id: props.item.applyId
  145. })
  146. }
  147. //结束
  148. function endHandle() {
  149. uni.$u.route('/pages/subpack/pages/nurse/end-care', {
  150. id: props.item.applyId
  151. });
  152. return;
  153. console.log(props.item);
  154. uni.showModal({
  155. title: '结束护理',
  156. content: '确定此次护理吗?',
  157. showCancel: true,
  158. success: (e) => {
  159. if (e.confirm) {
  160. let params = props.item;
  161. params.dealStatus = 'wait_complete';
  162. params.payStatus = 'dis_pay';
  163. completeTask(params)
  164. .then(res => {
  165. uni.$emit('renderApplyList')
  166. uni.navigateBack();
  167. })
  168. .catch(err => {
  169. console.log(err);
  170. })
  171. }
  172. }
  173. })
  174. }
  175. //打卡
  176. function clockHandle() {
  177. uni.$u.route('/pages/subpack/pages/nurse/clockIn', {
  178. type: 0,
  179. id: props.item.applyId
  180. })
  181. }
  182. function init() {
  183. getList();
  184. }
  185. init();
  186. </script>
  187. <style lang="scss" scoped>
  188. .flow-icon {
  189. width: 18rpx;
  190. height: 18rpx;
  191. border-radius: 50%;
  192. background: #207DFF;
  193. }
  194. .info-dot {
  195. position: relative;
  196. margin: 20rpx;
  197. padding-left: 20rpx;
  198. font-size: 36rpx;
  199. color: #0B0B0B;
  200. }
  201. .info-dot::before {
  202. content: '';
  203. position: absolute;
  204. width: 12rpx;
  205. height: 12rpx;
  206. border-radius: 50%;
  207. top: calc(50% - 6rpx);
  208. left: 0;
  209. background: #4794FF;
  210. }
  211. .flow-list {
  212. margin: 24rpx !important;
  213. padding: 30rpx;
  214. border-radius: 10rpx;
  215. background-color: #fff;
  216. }
  217. .flow-time {
  218. font-size: 28rpx;
  219. color: #888888;
  220. }
  221. .flow-des {
  222. &-bg {
  223. background: rgba(115, 190, 255, 0.08);
  224. border-radius: 8rpx 8rpx 8rpx 8rpx;
  225. padding: 24rpx 40rpx 30rpx 40rpx;
  226. margin-top: 10rpx;
  227. }
  228. &-top {
  229. font-size: 32rpx;
  230. color: #222222;
  231. display: flex;
  232. align-items: center;
  233. justify-content: space-between;
  234. &-tips {
  235. font-size: 28rpx;
  236. color: #207DFF;
  237. }
  238. &-tips1 {
  239. color: #1FBC99;
  240. }
  241. &-tips0 {
  242. color: #FA7E00;
  243. }
  244. &-tips2 {
  245. color: #fa3534;
  246. }
  247. }
  248. &-des {
  249. margin-top: 25rpx;
  250. font-size: 28rpx;
  251. color: #888888;
  252. }
  253. }
  254. .flow-des-img {
  255. display: flex;
  256. // gap: 10rpx;
  257. // flex-wrap: wrap;
  258. // margin: 10rpx 0;
  259. flex-direction: row;
  260. align-items: center;
  261. justify-content: space-between;
  262. margin-top: 12px;
  263. }
  264. .btn-box {
  265. padding: 20rpx 36rpx;
  266. background-color: #fff;
  267. position: fixed;
  268. bottom: calc(50px + var(--status-bar-height));
  269. /* bottom: 50px; */
  270. width: 690rpx;
  271. .btn-place {
  272. width: 50rpx;
  273. }
  274. }
  275. </style>