FlowCopyList.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view>
  3. <u-search :show-action="false" v-model="searchForm.procInsName" @change="inputWord" margin="20rpx 50rpx"></u-search>
  4. <view>
  5. <u-swipe-action>
  6. <u-swipe-action-item v-for="(row) in dataList" @click="({index}) => commit(index, row)" :key="row.id" :threshold="60" duration="500"
  7. :options="options">
  8. <u-cell-group>
  9. <u-cell @click="toDetail(row)">
  10. <view slot="title" class="content">
  11. <view class="text-bold text-grey">
  12. <view class="ellipsis-description">
  13. 流程标题: {{row.procInsName}}
  14. </view>
  15. </view>
  16. <view class="text-grey text-sm">
  17. 抄送时间:{{row.createTime | formatDate}}
  18. </view>
  19. </view>
  20. </u-cell>
  21. </u-cell-group>
  22. </u-swipe-action-item>
  23. </u-swipe-action>
  24. </view>
  25. <u-loadmore :status="status" @loadmore="loadmore" :line="true" />
  26. <u-gap height="20" bgColor="#fff"></u-gap>
  27. </view>
  28. </template>
  29. <script>
  30. import flowCopyService from "@/api/flowable/flowCopyService"
  31. import taskService from "@/api/flowable/taskService"
  32. import pick from 'lodash.pick'
  33. export default {
  34. data() {
  35. return {
  36. status: 'loadmore',
  37. searchForm: {
  38. procInsName: ''
  39. },
  40. dataList: [],
  41. tablePage: {
  42. pages: 0,
  43. currentPage: 0,
  44. pageSize: 10,
  45. orders: [{ column: "a.create_time", asc: false }],
  46. },
  47. loading: false,
  48. options: [{
  49. text: '删除',
  50. style: {
  51. backgroundColor: '#f56c6c'
  52. }
  53. },{
  54. text: '查阅',
  55. style: {
  56. backgroundColor: '#3c9cff'
  57. }
  58. }]
  59. }
  60. },
  61. onLoad() {
  62. this.loadmore()
  63. },
  64. methods: {
  65. // 输入监听
  66. inputWord(e){
  67. this.searchTimer && clearTimeout(this.searchTimer)
  68. this.searchTimer = setTimeout(()=>{
  69. this.doSearch()
  70. },300)
  71. },
  72. // 搜索
  73. doSearch(){
  74. this.dataList = [];
  75. this.tablePage.currentPage = 0;
  76. this.tablePage.pageSize = 10;
  77. this.tablePage.pages = 0;
  78. this.loadmore()
  79. },
  80. onReachBottom() {
  81. this.loadmore()
  82. },
  83. loadmore() {
  84. if(this.tablePage.currentPage!==0 && this.tablePage.pages <= this.tablePage.currentPage ) {
  85. this.status = 'nomore';
  86. return;
  87. }
  88. this.tablePage.currentPage = ++ this.tablePage.currentPage;
  89. //联网加载数据
  90. this.status = 'loading';
  91. flowCopyService.list({
  92. current: this.tablePage.currentPage,
  93. size: this.tablePage.pageSize,
  94. orders: this.tablePage.orders,
  95. ...this.searchForm
  96. }).then((data)=>{
  97. //追加新数据
  98. this.dataList=this.dataList.concat(data.records);
  99. this.tablePage.pages = data.pages;
  100. if(this.tablePage.pages <= this.tablePage.currentPage){
  101. this.status = 'nomore'
  102. } else {
  103. this.status = 'loadmore'
  104. }
  105. })
  106. },
  107. commit(index, row){
  108. if(index === 0){
  109. this.del(row)
  110. }else if(index === 1){
  111. this.toDetail(row)
  112. }
  113. },
  114. // 撤销申请
  115. del (row) {
  116. uni.showModal({
  117. title: '提示',
  118. content: '确定要删除该抄送吗?',
  119. success: (res)=>{
  120. if (res.confirm) {
  121. flowCopyService.delete(row.id).then((data) => {
  122. uni.showToast({
  123. title:data
  124. })
  125. this.doSearch(this.curWord)
  126. })
  127. } else if (res.cancel) {
  128. uni.hideLoading()
  129. }
  130. },
  131. fail() {
  132. }
  133. });
  134. },
  135. toDetail (row) {
  136. taskService.getTaskDef({
  137. procInsId: row.procInsId,
  138. procDefId: row.procDefId
  139. }).then((data) => {
  140. let query = {readOnly: true, title: row.procInsName, formTitle: row.procInsName, ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')}
  141. uni.navigateTo({
  142. url: '/pages/workbench/task/TaskFormDetail?flow='+JSON.stringify(query)
  143. })
  144. })
  145. },
  146. }
  147. }
  148. </script>