todo.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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. //'pages/home' + this.listData.miniHandleRouter
  75. ///wt/components/feeApplication/taskSubmit
  76. if (type == 'handle') {
  77. let queryParams = `id=${item.processInstance.id}&businessId=${item.businessId}&taskId=${item.id}&taskDefinitionKey=${item.taskDefinitionKey}&miniHandleRouter=${item.miniHandleRouter}&miniViewRouter=${item.miniViewRouter}`
  78. let url = '/pages/home' + item.miniHandleRouter.replace('taskForm','processTask')
  79. console.log(url)
  80. uni.navigateTo({
  81. url: `${url}?${queryParams}`
  82. })
  83. //
  84. } else {
  85. uni.navigateTo({
  86. url: `/pages/home/wt/components/detail?processInstanceId=${item.processInstance.id}`
  87. })
  88. }
  89. },
  90. async getList() {
  91. let paging = {
  92. pageNo: page,
  93. pageSize: size
  94. }
  95. let par = Object.assign(paging, this.params)
  96. isEnd = false
  97. const data = await getTodoTaskPage(par)
  98. this.list.push(...data.list)
  99. this.list.forEach(item => {
  100. item.startUserNickname = item.processInstance.startUserNickname
  101. })
  102. isEnd = this.list.length >= data.count
  103. }
  104. }
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. .blacklog-container {
  109. height: 100vh;
  110. display: flex;
  111. flex-direction: column;
  112. }
  113. .list-container {
  114. flex: 1;
  115. padding: 24rpx;
  116. background: $page-bg;
  117. flex: 1;
  118. overflow: hidden;
  119. // position: absolute;
  120. // top: 88rpx;
  121. // bottom: 0;
  122. // left: 0;
  123. // right: 0;
  124. /deep/ .u-list {
  125. height: 100% !important;
  126. }
  127. }
  128. .no_data {
  129. position: fixed;
  130. top: 50%;
  131. left: 50%;
  132. transform: translate(-50%, -50%);
  133. color: #999;
  134. font-size: 50rpx;
  135. }
  136. .kd-card {
  137. font-size: 34rpx;
  138. color: #333;
  139. background-color: #fff;
  140. border-radius: 25rpx;
  141. word-break: break-all;
  142. margin-bottom: 30rpx;
  143. .status {
  144. font-weight: normal;
  145. }
  146. .card-title {
  147. font-size: 1rem;
  148. font-weight: bold;
  149. .card-time {
  150. font-weight: normal;
  151. color: #bfbfbf;
  152. font-size: 0.9rem;
  153. align-self: center;
  154. }
  155. }
  156. .card-footer,
  157. .card-title {
  158. display: flex;
  159. justify-content: space-between;
  160. padding: 30rpx 30rpx;
  161. }
  162. .card-footer {
  163. padding: 10rpx 30rpx 18rpx 30rpx;
  164. font-size: 0.8rem;
  165. /deep/ .u-button {
  166. width: 48%;
  167. }
  168. }
  169. .card-body {
  170. padding: 0 28rpx;
  171. position: relative;
  172. min-height: 150rpx;
  173. }
  174. .card-body:after {
  175. content: '';
  176. position: absolute;
  177. left: auto;
  178. top: auto;
  179. bottom: 10rpx;
  180. right: auto;
  181. height: 1rpx;
  182. width: 91%;
  183. background-color: #f1f1f1;
  184. }
  185. .card-col {
  186. padding: 8rpx 0;
  187. display: flex;
  188. // line-height: ;
  189. .content {
  190. flex: 1;
  191. overflow: hidden;
  192. font-size: 0.9rem;
  193. }
  194. .label {
  195. font-size: 0.9rem;
  196. color: #999;
  197. width: 25%;
  198. }
  199. }
  200. }
  201. </style>