zkTaskListView.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <view class="view_container leaderIndex">
  3. <!-- 列表 -->
  4. <view>
  5. <uni-card v-for="(item,index) in pageData.taskList" padding="0" spacing="0" class="leaderIndex_list">
  6. <view @click="showDetail(item)">
  7. <view class="list_title">
  8. <image :src="item.taskStatusIcon" class="statusIcon"></image>
  9. <view>{{item.name}}</view>
  10. <image :src="showIcon.nowIcon" class="showIcon" @click="changeState('list')"></image>
  11. </view>
  12. <view class="list_content">
  13. <view class="list_item">任务编号</view>
  14. <view class="list_item_text">{{item.id}}</view>
  15. </view>
  16. <view class="list_content">
  17. <view class="list_item">组长</view>
  18. <view class="list_item_text">{{item.zzName}}</view>
  19. </view>
  20. <view class="list_content">
  21. <view class="list_item">待质控代煎企业</view>
  22. <view class="list_item_text">{{item.bzkOrgName}}</view>
  23. </view>
  24. <view class="list_content">
  25. <view class="list_item">地址</view>
  26. <view class="list_item_text">{{item.address}}</view>
  27. </view>
  28. <view class="list_content">
  29. <view class="list_item">完成日期</view>
  30. <view class="list_item_text">{{item.finishTime}}</view>
  31. </view>
  32. </view>
  33. <view class="button_group" v-if="item.status=='7002' || item.status=='7003'">
  34. <view class="button_sign" @click="signTask(item)">签收</view>
  35. <view class="button_start" @click="startTask(item)">开始质控</view>
  36. </view>
  37. </uni-card>
  38. </view>
  39. <view>
  40. <uni-load-more :status="loadingData.status" :contentText="loadingData.contentText"></uni-load-more>
  41. </view>
  42. </view>
  43. </template>
  44. <script setup>
  45. import http from '@/utils/request';
  46. import {ref,onMounted,reactive} from "vue";
  47. import {onLoad,onShow,onUnload,onPageScroll,onReachBottom,onPullDownRefresh} from "@dcloudio/uni-app";
  48. const props = defineProps({
  49. //接受父组件参数,当前要接质控任务状态
  50. state: String,
  51. // 完成质控标志
  52. finishFlag:String
  53. });
  54. const loadingData = reactive({
  55. // 加载true,到底false
  56. reload: false,
  57. status: 'more',
  58. contentText: {
  59. contentdown: '上拉加载更多',
  60. contentrefresh: '加载中',
  61. contentnomore: '已经全部加载完毕'
  62. }
  63. })
  64. const formData = reactive({
  65. pageSize: 10,
  66. pageNum: 1,
  67. status:props.state
  68. })
  69. const pageInfo = reactive({
  70. // 判断列表是否为空
  71. isEmpty: true,
  72. total: 0,
  73. value: 0,
  74. activeIndex: 0,
  75. detailStatus: '',
  76. });
  77. const pageData = reactive({
  78. headImg: '/static/logo.png',
  79. userName: '王军',
  80. taskNum: 2,
  81. taskList: [],
  82. // 任务编号
  83. taskId:'',
  84. })
  85. // 签收接口输入参数
  86. const signFormData=reactive({
  87. // 任务id
  88. taskId:''
  89. })
  90. // 开始质控接口输入参数
  91. const startFormData=reactive({
  92. // 任务id
  93. taskId:''
  94. })
  95. const eyeIcon = reactive({
  96. nowIcon: '',
  97. showIcon: '/static/whiteDisplay.png',
  98. hideIcon: '/static/whiteHide.png'
  99. })
  100. const showIcon = reactive({
  101. nowIcon: '',
  102. showIcon: '/static/blackDisplay.png',
  103. hideIcon: '/static/blackHide.png'
  104. })
  105. const statusIcon = reactive({
  106. daiIcon: '/static/dai_icon.png',
  107. wanIcon: '/static/wan_icon.png',
  108. zhiIcon: '/static/zhi_icon.png'
  109. })
  110. // 切换显示与隐藏
  111. const changeState = (type) => {
  112. if (type == 'header') {
  113. console.log("头部切换")
  114. if (eyeIcon.nowIcon == eyeIcon.hideIcon) {
  115. eyeIcon.nowIcon = eyeIcon.showIcon
  116. } else {
  117. eyeIcon.nowIcon = eyeIcon.hideIcon
  118. }
  119. } else if (type == 'list') {
  120. console.log("列表切换")
  121. if (showIcon.nowIcon == showIcon.hideIcon) {
  122. showIcon.nowIcon = showIcon.showIcon
  123. } else {
  124. showIcon.nowIcon = showIcon.hideIcon
  125. }
  126. }
  127. }
  128. // 签收
  129. const signTask=(e)=>{
  130. console.log("签收")
  131. uni.$emit("signTask",e)
  132. }
  133. // 开始质控
  134. const startTask=(e)=>{
  135. console.log("开始质控")
  136. uni.$emit("startTask",e)
  137. }
  138. const getTaskData = () => {
  139. uni.showLoading({
  140. title: '',
  141. mask: true
  142. });
  143. http.get("app-api/zkzy/findZkzyList",formData).then(res => {
  144. uni.hideLoading()
  145. console.log(res)
  146. pageData.taskList = pageData.taskList.concat(res.data)
  147. if(props.finishFlag=='1'){
  148. pageData.taskList=pageData.taskList.filter(item=>{
  149. return item.status!='7001' && item.status!='7002' && item.status!='7003'
  150. })
  151. }
  152. pageData.taskList.forEach(item => {
  153. if (item.wcrq1 != null && item.wcrq2 != null) {
  154. item.finishTime = item.wcrq1 + ' ~ ' + item.wcrq2
  155. }
  156. if(item.status=='7002'){
  157. // 7002待质控
  158. item.taskStatusIcon=statusIcon.daiIcon
  159. }else if(item.status=='7003'){
  160. // 7003质控中
  161. item.taskStatusIcon=statusIcon.zhiIcon
  162. }else{
  163. item.taskStatusIcon=statusIcon.wanIcon
  164. }
  165. })
  166. if (formData.pageSize > res.data.length) {
  167. loadingData.reload = false
  168. loadingData.status = 'noMore'
  169. uni.stopPullDownRefresh();
  170. } else {
  171. loadingData.status = 'more'
  172. loadingData.reload = true
  173. }
  174. setTimeout(function() {
  175. uni.stopPullDownRefresh();
  176. }, 1000);
  177. })
  178. }
  179. // 存入taskData(taskId)
  180. const setTaskId=(id)=>{
  181. uni.setStorageSync("saveTaskId",{taskId:id})
  182. }
  183. const showDetail=(e)=>{
  184. setTaskId(e.id)
  185. uni.navigateTo({
  186. url: '/pages/ypczk/zkTask/zkTaskDetail/detailsList?taskInfo='+encodeURIComponent(JSON.stringify(e))
  187. });
  188. }
  189. // 上拉加载
  190. const reachBottom = ()=>{
  191. console.log("上拉加载");
  192. if (loadingData.reload) {
  193. formData.pageNum++;
  194. loadingData.status = 'loading'
  195. getTaskData();
  196. }
  197. }
  198. const propsState = ref("")
  199. onShow(() => {
  200. eyeIcon.nowIcon = eyeIcon.hideIcon
  201. showIcon.nowIcon = showIcon.hideIcon
  202. formData.pageNum = 1;
  203. loadingData.reload = true
  204. propsState.value = props.state
  205. })
  206. //下拉刷新
  207. const pullDownRefresh = () => {
  208. console.log("下拉刷新");
  209. formData.pageNum = 1;
  210. loadingData.reload = true
  211. pageData.taskList = []
  212. getTaskData();
  213. }
  214. const fetch = ()=>{
  215. console.log(pageData.taskList);
  216. if(pageData.taskList == null || pageData.taskList.length == 0){
  217. pullDownRefresh()
  218. }
  219. }
  220. // 页面滚动触发事件
  221. onPageScroll((detail) => {
  222. //页面滚动事件
  223. uni.pageScrollTo({
  224. scrollTop: detail.scrollTop,
  225. duration: 0
  226. })
  227. })
  228. defineExpose({reachBottom,pullDownRefresh,fetch,getTaskData})
  229. </script>
  230. <style lang="scss" scoped>
  231. @import 'indexList.scss';
  232. .yui-tabs {
  233. position: relative;
  234. }
  235. ::v-deep.uni-view.yui-tabs__wrap {
  236. margin-top: 25px !important;
  237. }
  238. .yui-tabs__wrap {
  239. top: 50px !important;
  240. }
  241. </style>