todo.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view class="blacklog-container">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="我的待办" @clickLeft="back" background-color="#157A2C" color="#fff"></uni-nav-bar>
  4. <view class="list-container">
  5. <u-list @scrolltolower="scrolltolower">
  6. <u-list-item v-for="(item, index) in list" :key="index">
  7. <view class="kd-card">
  8. <view class="card-title">
  9. <text>{{ item.processInstance.name }}</text>
  10. <text class="card-time">{{ item.createTime }}</text>
  11. </view>
  12. <view>
  13. <view class="card-body">
  14. <view class="card-col" v-for="itm in colOptions">
  15. <text class="label">{{ itm.label }}</text>
  16. <text class="content">{{ item[itm.key] }}</text>
  17. </view>
  18. </view>
  19. <view class="card-footer">
  20. <u-button v-if="['0', '2'].includes(item.extensionProperty.taskHandlePlatform)" type="success" @click="handleDetail(item, 'handle')">处理</u-button>
  21. <u-button v-else type="error">请在PC端处理</u-button>
  22. <u-button type="info" @click="handleDetail(item, 'detail')">流程详情</u-button>
  23. </view>
  24. </view>
  25. </view>
  26. </u-list-item>
  27. </u-list>
  28. </view>
  29. <view v-show="list.length === 0" class="no_data">
  30. <u-empty mode="data" textSize="30"></u-empty>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import { getTodoTaskPage } from '@/api/wt/index.js'
  36. let [page, size, isEnd] = [1, 10, true]
  37. export default {
  38. computed: {
  39. colOptions() {
  40. return [
  41. {
  42. label: '任务名称',
  43. key: 'name'
  44. },
  45. {
  46. label: '流程发起人',
  47. key: `startUserNickname`
  48. }
  49. ]
  50. }
  51. },
  52. data() {
  53. return {
  54. list: [],
  55. params: {
  56. status: '',
  57. name: ''
  58. }
  59. }
  60. },
  61. onShow() {
  62. page = 1
  63. this.list = []
  64. this.getList()
  65. },
  66. methods: {
  67. scrolltolower() {
  68. if (isEnd) return
  69. page++
  70. this.getList()
  71. },
  72. //miniHandleRouter
  73. handleDetail(item, type) {
  74. if (type == 'handle') {
  75. let queryParams = `id=${item.processInstance.id}&businessId=${item.businessId}&taskId=${item.id}&taskDefinitionKey=${item.taskDefinitionKey}&miniHandleRouter=${item.miniHandleRouter}&miniViewRouter=${item.miniViewRouter}`
  76. uni.navigateTo({
  77. url: `/pages/home/wt/components/processTask?${queryParams}`
  78. })
  79. //
  80. } else {
  81. uni.navigateTo({
  82. url: `/pages/home/wt/components/detail?processInstanceId=${item.processInstance.id}`
  83. })
  84. }
  85. },
  86. async getList() {
  87. let paging = {
  88. pageNo: page,
  89. pageSize: size
  90. }
  91. let par = Object.assign(paging, this.params)
  92. isEnd = false
  93. const data = await getTodoTaskPage(par)
  94. this.list.push(...data.list)
  95. this.list.forEach(item => {
  96. item.startUserNickname = item.processInstance.startUserNickname
  97. })
  98. isEnd = this.list.length >= data.count
  99. }
  100. }
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. .blacklog-container {
  105. height: 100vh;
  106. display: flex;
  107. flex-direction: column;
  108. }
  109. .list-container {
  110. flex: 1;
  111. padding: 24rpx;
  112. background: $page-bg;
  113. flex: 1;
  114. overflow: hidden;
  115. // position: absolute;
  116. // top: 88rpx;
  117. // bottom: 0;
  118. // left: 0;
  119. // right: 0;
  120. /deep/ .u-list {
  121. height: 100% !important;
  122. }
  123. }
  124. .no_data {
  125. position: fixed;
  126. top: 50%;
  127. left: 50%;
  128. transform: translate(-50%, -50%);
  129. color: #999;
  130. font-size: 50rpx;
  131. }
  132. .kd-card {
  133. font-size: 34rpx;
  134. color: #333;
  135. background-color: #fff;
  136. border-radius: 25rpx;
  137. word-break: break-all;
  138. margin-bottom: 30rpx;
  139. .status {
  140. font-weight: normal;
  141. }
  142. .card-title {
  143. font-size: 1rem;
  144. font-weight: bold;
  145. .card-time {
  146. font-weight: normal;
  147. color: #bfbfbf;
  148. font-size: 0.9rem;
  149. align-self: center;
  150. }
  151. }
  152. .card-footer,
  153. .card-title {
  154. display: flex;
  155. justify-content: space-between;
  156. padding: 30rpx 30rpx;
  157. }
  158. .card-footer {
  159. padding: 10rpx 30rpx 18rpx 30rpx;
  160. font-size: 0.8rem;
  161. /deep/ .u-button {
  162. width: 48%;
  163. }
  164. }
  165. .card-body {
  166. padding: 0 28rpx;
  167. position: relative;
  168. min-height: 150rpx;
  169. }
  170. .card-body:after {
  171. content: '';
  172. position: absolute;
  173. left: auto;
  174. top: auto;
  175. bottom: 10rpx;
  176. right: auto;
  177. height: 1rpx;
  178. width: 91%;
  179. background-color: #f1f1f1;
  180. }
  181. .card-col {
  182. padding: 8rpx 0;
  183. display: flex;
  184. // line-height: ;
  185. .content {
  186. flex: 1;
  187. overflow: hidden;
  188. font-size: 0.9rem;
  189. }
  190. .label {
  191. font-size: 0.9rem;
  192. color: #999;
  193. width: 25%;
  194. }
  195. }
  196. }
  197. </style>