TodoList.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <view>
  3. <u-search :show-action="false" v-model="searchForm.title" @change="inputWord" margin="20rpx 50rpx"></u-search>
  4. <view>
  5. <u-swipe-action>
  6. <view
  7. v-for="(row, index) in dataList"
  8. :key="index">
  9. <u-swipe-action-item @click="todo(row)" :key="row.id" :threshold="60" duration="500"
  10. :options="[ {
  11. text: '办理',
  12. style: {
  13. backgroundColor: '#3c9cff'
  14. }
  15. }]">
  16. <u-cell-group>
  17. <u-cell @click="todo(row)">
  18. <view slot="title" class="content">
  19. <view class="text-bold text-grey">
  20. <view class="ellipsis-description">
  21. 标题:{{row.vars.title}}
  22. </view>
  23. </view>
  24. <view class="text-grey text-sm">
  25. <view class="ellipsis-description">
  26. 当前环节:{{row.task && row.task.name}}
  27. </view>
  28. </view>
  29. <view class="text-grey text-sm">
  30. 执行时间:{{row.task.createTime | formatDate}}
  31. </view>
  32. </view>
  33. <view slot="right-icon" class="action">
  34. <u-tag text="等待审核" plain shape="circle" type="error"></u-tag>
  35. </view>
  36. </u-cell>
  37. </u-cell-group>
  38. </u-swipe-action-item>
  39. </view>
  40. </u-swipe-action>
  41. </view>
  42. <u-loadmore :status="status" @loadmore="loadmore" :line="true" />
  43. <u-gap height="20" bgColor="#fff"></u-gap>
  44. <u-back-top :scrollTop="0" mode="square"></u-back-top>
  45. </view>
  46. </template>
  47. <script>
  48. import taskService from "@/api/flowable/taskService"
  49. import userSelect from '@/components/user-select/user-select.vue'
  50. import pick from 'lodash.pick'
  51. export default {
  52. components:{
  53. userSelect
  54. },
  55. data() {
  56. return {
  57. status: 'loadmore',
  58. searchForm: {
  59. title: ''
  60. },
  61. dataList: [],
  62. tablePage: {
  63. pages: 0,
  64. currentPage: 0,
  65. pageSize: 10,
  66. orders: [{ column: "a.create_time", asc: false }],
  67. },
  68. loading: false,
  69. }
  70. },
  71. onLoad() {
  72. console.log('onLoad')
  73. this.loadmore()
  74. },
  75. methods: {
  76. // 跳转到详细页面
  77. todo (row) {
  78. taskService.getTaskDef({
  79. taskId: row.task.id,
  80. taskName: row.task.name,
  81. taskDefKey: row.task.taskDefinitionKey,
  82. procInsId: row.task.processInstanceId,
  83. procDefId: row.task.processDefinitionId,
  84. procDefKey: row.task.processDefKey,
  85. status: row.status
  86. }).then((data) => {
  87. let query = {formTitle: `${row.vars.title}`, title: `审批【${row.task.name || ''}】`, ...pick(data, 'formType', 'formReadOnly', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')};
  88. uni.navigateTo({
  89. url: '/pages/workbench/task/TaskForm?flow='+JSON.stringify(query)
  90. })
  91. })
  92. },
  93. // 输入监听
  94. inputWord(e){
  95. this.searchTimer && clearTimeout(this.searchTimer)
  96. this.searchTimer = setTimeout(()=>{
  97. this.doSearch()
  98. },300)
  99. },
  100. // 搜索
  101. doSearch(){
  102. this.dataList = [];
  103. this.tablePage.currentPage = 0;
  104. this.tablePage.pageSize = 10;
  105. this.tablePage.pages = 0;
  106. this.loadmore()
  107. },
  108. onReachBottom() {
  109. this.loadmore()
  110. },
  111. loadmore() {
  112. if(this.tablePage.currentPage!==0 && this.tablePage.pages <= this.tablePage.currentPage ) {
  113. this.status = 'nomore';
  114. return;
  115. }
  116. this.tablePage.currentPage = ++ this.tablePage.currentPage;
  117. //联网加载数据
  118. this.status = 'loading';
  119. taskService.todoList({
  120. current: this.tablePage.currentPage,
  121. size: this.tablePage.pageSize,
  122. orders: this.tablePage.orders,
  123. ...this.searchForm
  124. }).then((data)=>{
  125. //追加新数据
  126. this.dataList=this.dataList.concat(data.records);
  127. this.tablePage.pages = data.pages;
  128. if(this.tablePage.pages <= this.tablePage.currentPage){
  129. this.status = 'nomore'
  130. } else {
  131. this.status = 'loadmore'
  132. }
  133. })
  134. }
  135. }
  136. }
  137. </script>