FlowCopyList.vue 3.8 KB

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