todo.vue 5.0 KB

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