zkTaskListView.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view class="view_container leaderIndex">
  3. <!-- 列表 -->
  4. <view class="leaderIndex_list">
  5. <uni-card v-for="(item,index) in pageData.taskList" padding="10rpx 0">
  6. <view class="list_title">
  7. <image :src="item.taskStatusIcon" class="statusIcon"></image>
  8. <view>{{item.name}}</view>
  9. <image :src="showIcon.nowIcon" class="showIcon" @click="changeState('list')"></image>
  10. </view>
  11. <view class="list_content">
  12. <text class="list_item">任务编号<text class="list_item_text">{{item.id}}</text></text>
  13. <text class="list_item">组长<text class="list_item_text">{{item.zzName}}</text></text>
  14. <text class="list_item">待质控代煎企业<text class="list_item_text">{{item.bzkOrgName}}</text></text>
  15. <text class="list_item">地址<text class="list_item_text">{{item.address}}</text></text>
  16. <text class="list_item">完成日期<text class="list_item_text">{{item.finishTime}}</text></text>
  17. </view>
  18. <view class="list_button">
  19. <view class="button_group">
  20. <view class="button_item" @click="signTask">签收</view>
  21. <view class="button_item" @click="starTask">开始质控</view>
  22. </view>
  23. </view>
  24. </uni-card>
  25. </view>
  26. <view>
  27. <uni-load-more :status="loadingData.status" :contentText="loadingData.contentText"></uni-load-more>
  28. </view>
  29. </view>
  30. </template>
  31. <script setup>
  32. import http from '@/utils/request';
  33. import {
  34. onMounted,
  35. reactive
  36. } from "vue";
  37. import {
  38. onLoad,
  39. onShow,
  40. onUnload,
  41. onPageScroll,
  42. onReachBottom,
  43. onPullDownRefresh
  44. } from "@dcloudio/uni-app";
  45. const props = defineProps({
  46. //接受父组件参数,当前要接质控任务状态
  47. state: {
  48. type: Object,
  49. default: ''
  50. }
  51. });
  52. const loadingData = reactive({
  53. // 加载true,到底false
  54. reload: false,
  55. status: 'more',
  56. contentText: {
  57. contentdown: '上拉加载更多',
  58. contentrefresh: '加载中',
  59. contentnomore: '已经全部加载完毕'
  60. }
  61. })
  62. const formData = reactive({
  63. pageSize: 10,
  64. pageIndex: 1,
  65. status:''
  66. })
  67. const pageInfo = reactive({
  68. // 判断列表是否为空
  69. isEmpty: true,
  70. total: 0,
  71. value: 0,
  72. orderList: [],
  73. activeIndex: 0,
  74. orderId: '',
  75. detailStatus: ''
  76. });
  77. const pageData = reactive({
  78. headImg: '/static/logo.png',
  79. userName: '王军',
  80. taskNum: 2,
  81. taskList: [],
  82. })
  83. const eyeIcon = reactive({
  84. nowIcon: '',
  85. showIcon: '/static/whiteDisplay.png',
  86. hideIcon: '/static/whiteHide.png'
  87. })
  88. const showIcon = reactive({
  89. nowIcon: '',
  90. showIcon: '/static/blackDisplay.png',
  91. hideIcon: '/static/blackHide.png'
  92. })
  93. const statusIcon = reactive({
  94. daiIcon: '/static/dai_icon.png',
  95. wanIcon: '/static/wan_icon.png',
  96. zhiIcon: '/static/zhi_icon.png'
  97. })
  98. // 切换显示与隐藏
  99. const changeState = (type) => {
  100. if (type == 'header') {
  101. console.log("头部切换")
  102. if (eyeIcon.nowIcon == eyeIcon.hideIcon) {
  103. eyeIcon.nowIcon = eyeIcon.showIcon
  104. } else {
  105. eyeIcon.nowIcon = eyeIcon.hideIcon
  106. }
  107. } else if (type == 'list') {
  108. console.log("列表切换")
  109. if (showIcon.nowIcon == showIcon.hideIcon) {
  110. showIcon.nowIcon = showIcon.showIcon
  111. } else {
  112. showIcon.nowIcon = showIcon.hideIcon
  113. }
  114. }
  115. }
  116. const getTaskData = () => {
  117. if(props.state=='wait'){
  118. formData.status="7003"
  119. }else if(props.state=='intask'){
  120. formData.status="7007"
  121. }else if(props.state=='complete'){
  122. formData.status="7004"
  123. }
  124. http.get("app-api/zkzy/findZkzyList?pageNum=" + formData.pageIndex + "&pageSize=" + formData.pageSize+ "&status=" + formData.status).then(
  125. res => {
  126. console.log(res)
  127. // pageData.taskList = res.data
  128. for (let i = 0; i < res.data.length; i++) {
  129. pageData.taskList.push(res.data[i])
  130. }
  131. pageData.taskList.forEach(item => {
  132. if (item.wcrq1 != null && item.wcrq2 != null) {
  133. item.finishTime = item.wcrq1 + ' ~ ' + item.wcrq2
  134. }
  135. if (item.status == '7003') {
  136. item.taskStatusIcon = statusIcon.daiIcon
  137. } else if (item.status == '7004') {
  138. item.taskStatusIcon = statusIcon.wanIcon
  139. } else {
  140. item.taskStatusIcon = statusIcon.zhiIcon
  141. }
  142. })
  143. if (formData.pageSize > res.data.length) {
  144. loadingData.reload = false
  145. loadingData.status = 'noMore'
  146. uni.stopPullDownRefresh();
  147. } else {
  148. loadingData.status = 'more'
  149. loadingData.reload = true
  150. }
  151. setTimeout(function() {
  152. uni.stopPullDownRefresh();
  153. }, 1000);
  154. })
  155. }
  156. onShow(() => {
  157. eyeIcon.nowIcon = eyeIcon.hideIcon
  158. showIcon.nowIcon = showIcon.hideIcon
  159. formData.pageIndex = 1;
  160. loadingData.reload = true
  161. getTaskData();
  162. pageData.taskList = []
  163. })
  164. // 上拉加载
  165. onReachBottom(() => {
  166. if (loadingData.reload) {
  167. formData.pageIndex++;
  168. loadingData.status = 'loading'
  169. getTaskData();
  170. }
  171. })
  172. //下拉刷新
  173. onPullDownRefresh(() => {
  174. formData.pageIndex = 1;
  175. loadingData.reload = true
  176. getTaskData();
  177. pageData.taskList = []
  178. })
  179. // 页面滚动触发事件
  180. onPageScroll((detail) => {
  181. //页面滚动事件
  182. uni.pageScrollTo({
  183. scrollTop: detail.scrollTop,
  184. duration: 0
  185. })
  186. })
  187. </script>
  188. <style lang="scss" scoped>
  189. @import 'indexList.scss';
  190. .yui-tabs {
  191. position: relative;
  192. }
  193. ::v-deep.uni-view.yui-tabs__wrap {
  194. margin-top: 25px !important;
  195. }
  196. .yui-tabs__wrap {
  197. top: 50px !important;
  198. }
  199. </style>