workHourManagementOne.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="workHourManagementOne">
  3. <view class="head">
  4. 请选择工时分类
  5. </view>
  6. <view class="body" v-if="dataInfo.list.length">
  7. <view class="body_item ellipsis" v-for="data in dataInfo.list" :key="data.id" @click="toWorkHourManagementTwo(data)">
  8. {{ data.workName }} - {{data.workUnit}} - {{data.wage}}元 - {{data.integral.value}}分
  9. </view>
  10. </view>
  11. <view class="zanwu" v-else>
  12. <text class="newicon newicon-zanwu"></text>
  13. </view>
  14. <view class="foot_common_btns">
  15. <button @click="goBack" type="default" class="primaryButton btn">返回</button>
  16. </view>
  17. </view>
  18. </template>
  19. <script setup>
  20. import { ref, reactive} from 'vue'
  21. import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
  22. import { api_workHourManagement,getFetchDataList } from "@/http/api.js"
  23. import { defaultColor } from '@/static/js/theme.js'
  24. import { useSetTitle } from '@/share/useSetTitle.js'
  25. import { useLoginUserStore } from '@/stores/loginUser'
  26. import { useGoBack } from '@/share/useGoBack.js'
  27. useSetTitle();
  28. const loginUserStore = useLoginUserStore();
  29. const { goBack } = useGoBack();
  30. // 主题颜色
  31. const primaryColor = ref(defaultColor)
  32. // 数据
  33. const dataInfo = reactive({
  34. list: [],//工单列表
  35. idx: 0,//页码
  36. hasMore: true,//是否有更多数据
  37. incidentId: undefined,//事件ID
  38. summaryId: undefined,//汇总单ID
  39. hosId:null //工单责任科室
  40. })
  41. // 跳转二级工时管理列表
  42. function toWorkHourManagementTwo(data){
  43. uni.navigateTo({
  44. url: `/pages/workHourManagementTwo/workHourManagementTwo?incidentId=${dataInfo.incidentId}&summaryId=${dataInfo.summaryId}&parentId=${data.id}&parentName=${data.workName}&hosId=${dataInfo.hosId}`
  45. })
  46. }
  47. // 获取列表信息
  48. function getList(idx){
  49. uni.showLoading({
  50. title: "加载中",
  51. mask: true,
  52. });
  53. dataInfo.idx = idx === undefined ? dataInfo.idx : idx;
  54. if(dataInfo.idx === 0){
  55. dataInfo.list = [];
  56. }
  57. let postData = {
  58. idx: dataInfo.idx,
  59. sum: 9999,
  60. workHourManagement: {
  61. treeLevel: 1,
  62. hosId:dataInfo.hosId,
  63. showSecond:1,
  64. disableType:1
  65. }
  66. }
  67. getFetchDataList("simple/data", "workHourManagement", postData).then(res => {
  68. uni.hideLoading();
  69. uni.stopPullDownRefresh();
  70. if(res.status == 200){
  71. let list = res.list || [];
  72. dataInfo.list = list
  73. // if(list.length){
  74. // dataInfo.hasMore = true;
  75. // dataInfo.list = dataInfo.idx === 0 ? list : dataInfo.list.concat(list);
  76. // }else{
  77. // dataInfo.hasMore = false;
  78. // }
  79. }else{
  80. uni.showToast({
  81. icon: 'none',
  82. title: res.msg || '请求数据失败!'
  83. });
  84. }
  85. })
  86. }
  87. onLoad((option) => {
  88. dataInfo.incidentId = option.incidentId;
  89. dataInfo.summaryId = option.summaryId;
  90. dataInfo.hosId = option.hosId;
  91. getList(0);
  92. })
  93. onPullDownRefresh(() => {
  94. getList(0)
  95. })
  96. onReachBottom(() => {
  97. // dataInfo.idx += 1;
  98. // if (dataInfo.hasMore) {
  99. // getList(); // 当触底时加载更多数据
  100. // }
  101. })
  102. </script>
  103. <style lang="scss" scoped>
  104. .workHourManagementOne{
  105. display: flex;
  106. flex-direction: column;
  107. justify-content: space-between;
  108. .head{
  109. height: 88rpx;
  110. display: flex;
  111. align-items: center;
  112. padding: 0 24rpx;
  113. position: fixed;
  114. z-index: 99;
  115. width: 100%;
  116. box-sizing: border-box;
  117. background: #fff;
  118. font-size: 26rpx;
  119. color: $uni-primary;
  120. }
  121. .body{
  122. border-top: 1rpx solid #DEDEDE;
  123. margin-bottom: 140rpx;
  124. margin-top: 88rpx;
  125. font-size: 26rpx;
  126. .body_item{
  127. border-bottom: 1rpx solid #DEDEDE;
  128. padding: 24rpx;
  129. }
  130. }
  131. .zanwu{
  132. margin-bottom: 140rpx;
  133. margin-top: 88rpx;
  134. display: flex;
  135. justify-content: center;
  136. .newicon-zanwu{
  137. font-size: 256rpx;
  138. color: #D6D6D6;
  139. margin-top: 140rpx;
  140. }
  141. }
  142. .foot_common_btns{
  143. position: fixed;
  144. left: 0;
  145. bottom: 0;
  146. background-color: #fff;
  147. }
  148. }
  149. </style>