todo.vue 5.8 KB

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