综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

apply.vue 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <!--
  2. * @Author: ysh
  3. * @Date: 2025-01-21 10:01:39
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2025-04-11 15:36:40
  6. -->
  7. <template>
  8. <view>
  9. <mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
  10. :up="upOption" :top="20">
  11. <view class="tag-view text-center margin-top-xs margin-bottom-xs" style="padding: 10rpx;">
  12. <uni-tag :text="'您还有' + total + '个任务待审'" />
  13. </view>
  14. <view v-if="todoList.length > 0">
  15. <view v-for="(item, index) in todoList" :key="index">
  16. <view @click="goToDetail(item)" class="box">
  17. <!-- 当前节点标签 -->
  18. <view class="node-tag">
  19. <uni-tag :text="'流程名称:' + item.procDefName" inverted="true" type="primary" size="small" />
  20. </view>
  21. <!-- 时间与标题区域 -->
  22. <view class="header-area">
  23. <text class="time-text">{{ item.createTime }}</text>
  24. <uni-title type="h4" :title="item.title || '暂无标题'" class="title-text" />
  25. </view>
  26. <!-- 流程信息 -->
  27. <view class="process-info">
  28. <view class="info-item">
  29. <text class="info-label">当前节点:</text>
  30. <text class="info-value">{{ item.taskName }}</text>
  31. </view>
  32. <view class="info-item">
  33. <text class="info-label">发起人:</text>
  34. <text class="info-value">{{ item.startUserName }}</text>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <u-empty v-else mode="list"></u-empty>
  41. </mescroll-uni>
  42. </view>
  43. </template>
  44. <script>
  45. import { todoList } from "@/api/flowable/todo";
  46. import MescrollMixin from '@/uni_modules/mescroll/components/mescroll-uni/mescroll-mixins.js'
  47. export default {
  48. mixins: [MescrollMixin],
  49. data() {
  50. return {
  51. todoList: [],
  52. total: 0,
  53. mescroll: null,
  54. downOption: {
  55. auto: false, // 手动初始化后需要关闭自动加载
  56. textOutOffset: '下拉刷新',
  57. textLoading: '加载中...'
  58. },
  59. upOption: {
  60. auto: true, // 自动加载初始页
  61. page: { num: 0, size: 10 }, // 初始页码和每页数量
  62. noMoreSize: 5, // 数据不足时显示"没有更多"
  63. empty: { tip: '暂无待审任务' },
  64. textNoMore: '~ 没有更多任务了 ~'
  65. }
  66. };
  67. },
  68. created() {
  69. this.getTodoList();
  70. },
  71. onLoad: function (options) {
  72. uni.startPullDownRefresh();
  73. },
  74. onPullDownRefresh() {
  75. this.getTodoList();
  76. },
  77. methods: {
  78. // 初始化mescroll实例
  79. mescrollInit(mescroll) {
  80. this.mescroll = mescroll;
  81. },
  82. // 下拉刷新回调
  83. downCallback() {
  84. this.mescroll.resetUpScroll(true);
  85. },
  86. async upCallback(page) {
  87. try {
  88. const res = await todoList({
  89. pageNum: page.num,
  90. pageSize: page.size,
  91. name: null
  92. });
  93. const curPageLen = res.data.records.length;
  94. this.total = res.data.total;
  95. // 处理分页数据
  96. if (page.num == 1) this.todoList = []; // 第一页清空数据
  97. this.todoList = this.todoList.concat(res.data.records);
  98. // 结束加载状态
  99. this.mescroll.endSuccess(curPageLen, res.data.total <= this.todoList.length);
  100. } catch (e) {
  101. this.mescroll.endErr();
  102. }
  103. },
  104. getTodoList() {
  105. todoList({
  106. pageNum: 1,
  107. pageSize: 999,
  108. name: null
  109. }).then(response => {
  110. this.total = response.data.total;
  111. this.todoList = response.data.records;
  112. uni.stopPullDownRefresh();
  113. });
  114. },
  115. goToDetail(item) {
  116. // 跳转到详情页,并传递项目ID
  117. const query = {
  118. procInsId: item.procInsId,
  119. executionId: item.executionId,
  120. deployId: item.deployId,
  121. taskId: item.taskId,
  122. taskName: item.taskName,
  123. startUserName: item.startUserName,
  124. procDefName: item.procDefName
  125. }
  126. const encodedParams = encodeURIComponent(JSON.stringify(query));
  127. uni.navigateTo({
  128. url: `/pages/message/apply/detail?params=${encodedParams}`
  129. })
  130. }
  131. }
  132. }
  133. </script>
  134. <style lang="scss">
  135. /* 新增mescroll布局样式 */
  136. mescroll-body {
  137. height: calc(100vh - 100rpx);
  138. box-sizing: border-box;
  139. }
  140. .box {
  141. position: relative;
  142. background: #fff;
  143. border-radius: 12rpx;
  144. padding: 32rpx;
  145. margin: 20rpx;
  146. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
  147. .node-tag {
  148. position: absolute;
  149. left: 20rpx;
  150. top: 40rpx;
  151. z-index: 2;
  152. }
  153. .header-area {
  154. margin-top: 16rpx;
  155. border-bottom: 1rpx solid #eee;
  156. .time-text {
  157. float: right;
  158. font-size: 24rpx;
  159. color: #999;
  160. }
  161. .title-text {
  162. clear: both;
  163. font-weight: 600;
  164. color: #333;
  165. margin: 16rpx 0;
  166. }
  167. }
  168. .process-info {
  169. margin-top: 24rpx;
  170. .info-item {
  171. margin-bottom: 12rpx;
  172. font-size: 28rpx;
  173. .info-label {
  174. color: #666;
  175. margin-right: 16rpx;
  176. }
  177. .info-value {
  178. color: #333;
  179. font-weight: 500;
  180. }
  181. }
  182. }
  183. }
  184. </style>