ApplyList.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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. <u-swipe-action-item v-for="(row) in dataList" @click="({index}) => commit(index, row)" :key="row.id" :threshold="60" duration="500"
  7. :options="row.code === 1?[ {
  8. text: '催办',
  9. style: {
  10. backgroundColor: '#3c9cff'
  11. }
  12. }, {
  13. text: '撤销',
  14. style: {
  15. backgroundColor: '#f56c6c'
  16. }
  17. }, {
  18. text: '历史',
  19. style: {
  20. backgroundColor: '#5ac725'
  21. }
  22. }]:row.code === 3 || row.code === 4 ?[{
  23. text: '历史',
  24. style: {
  25. backgroundColor: '#5ac725'
  26. }
  27. },{
  28. text: '编辑',
  29. style: {
  30. backgroundColor: '#3c9cff'
  31. }
  32. }]:[{
  33. text: '历史',
  34. style: {
  35. backgroundColor: '#5ac725'
  36. }
  37. }]">
  38. <u-cell-group>
  39. <u-cell @click="toDetail(row)">
  40. <view slot="title" class="content">
  41. <view class="text-bold text-grey">
  42. <view class="ellipsis-description">
  43. 标题:{{row.vars.title}}
  44. </view>
  45. </view>
  46. <view class="text-grey text-sm">
  47. <view class="ellipsis-description">
  48. 当前环节:{{row.taskName}}
  49. </view>
  50. </view>
  51. <view class="text-grey text-sm">
  52. 执行时间:{{row.startTime | formatDate}}
  53. </view>
  54. </view>
  55. <view slot="right-icon">
  56. <u-tag :text="row.status" plain shape="circle" :type="row.level === 'danger'? 'error':row.level"></u-tag>
  57. </view>
  58. </u-cell>
  59. </u-cell-group>
  60. </u-swipe-action-item>
  61. </u-swipe-action>
  62. </view>
  63. <u-loadmore :status="status" @loadmore="loadmore" :line="true" />
  64. <u-gap height="20" bgColor="#fff"></u-gap>
  65. <u-back-top :scrollTop="0" mode="square"></u-back-top>
  66. </view>
  67. </template>
  68. <script>
  69. import taskService from "@/api/flowable/taskService"
  70. import processService from "@/api/flowable/processService"
  71. import userSelect from '@/components/user-select/user-select.vue'
  72. import pick from 'lodash.pick'
  73. export default {
  74. components:{
  75. userSelect
  76. },
  77. data() {
  78. return {
  79. status: 'loadmore',
  80. searchForm: {
  81. titile: ''
  82. },
  83. dataList: [],
  84. tablePage: {
  85. pages: 0,
  86. currentPage: 0,
  87. pageSize: 10,
  88. orders: [{ column: "a.create_time", asc: false }],
  89. },
  90. loading: false,
  91. }
  92. },
  93. onLoad() {
  94. this.loadmore()
  95. },
  96. methods: {
  97. // 输入监听
  98. inputWord(e){
  99. this.searchTimer && clearTimeout(this.searchTimer)
  100. this.searchTimer = setTimeout(()=>{
  101. this.doSearch()
  102. },300)
  103. },
  104. // 搜索
  105. doSearch(){
  106. this.dataList = [];
  107. this.tablePage.currentPage = 0;
  108. this.tablePage.pageSize = 10;
  109. this.tablePage.pages = 0;
  110. this.loadmore()
  111. },
  112. onReachBottom() {
  113. this.loadmore()
  114. },
  115. loadmore() {
  116. if(this.tablePage.currentPage!==0 && this.tablePage.pages <= this.tablePage.currentPage ) {
  117. this.status = 'nomore';
  118. return;
  119. }
  120. this.tablePage.currentPage = ++ this.tablePage.currentPage;
  121. //联网加载数据
  122. this.status = 'loading';
  123. taskService.myApplyedList({
  124. current: this.tablePage.currentPage,
  125. size: this.tablePage.pageSize,
  126. orders: this.tablePage.orders,
  127. ...this.searchForm
  128. }).then((data)=>{
  129. //追加新数据
  130. this.dataList=this.dataList.concat(data.records);
  131. this.tablePage.pages = data.pages;
  132. if(this.tablePage.pages <= this.tablePage.currentPage){
  133. this.status = 'nomore'
  134. } else {
  135. this.status = 'loadmore'
  136. }
  137. })
  138. },
  139. commit(index, row){
  140. if(row.code === 1) {
  141. if(index === 0){
  142. this.urge(row)
  143. }else if(index === 1){
  144. this.callback(row)
  145. }else if(index === 2){
  146. this.toDetail(row)
  147. }
  148. } else if(row.code === 3 || row.code === 4) {
  149. if(index === 0){
  150. this.urge(row)
  151. }else if(index === 1){
  152. this.restart(row)
  153. }
  154. } else {
  155. if(index === 0){
  156. this.toDetail(row)
  157. }
  158. }
  159. },
  160. // 撤销申请
  161. callback (row) {
  162. uni.showModal({
  163. title: '提示',
  164. content: '确定要撤销该流程吗?',
  165. success: (res)=>{
  166. if (res.confirm) {
  167. processService.revokeProcIns(row.processInstanceId, '用户撤销').then((data) => {
  168. uni.showToast({
  169. title:data
  170. })
  171. this.doSearch(this.curWord)
  172. })
  173. } else if (res.cancel) {
  174. uni.hideLoading()
  175. }
  176. },
  177. fail() {
  178. }
  179. });
  180. },
  181. urge (row) {
  182. uni.showToast({
  183. title: '催办成功!'
  184. })
  185. },
  186. // 重新填写
  187. restart(row) {
  188. // 读取流程表单
  189. taskService
  190. .getTaskDef({
  191. procInsId: row.processInstanceId,
  192. procDefId: row.processDefinitionId,
  193. })
  194. .then((data) => {
  195. let query = {
  196. status: "start",
  197. title: row.vars.title,
  198. formTitle: row.vars.title,
  199. ...pick(
  200. data,
  201. "formType",
  202. "formUrl",
  203. "procDefKey",
  204. "taskDefKey",
  205. "procInsId",
  206. "procDefId",
  207. "taskId",
  208. "status",
  209. "title",
  210. "businessId"
  211. )
  212. }
  213. uni.navigateTo({
  214. url: '/pages/workbench/task/TaskFormEdit?flow='+JSON.stringify(query)
  215. })
  216. });
  217. },
  218. toDetail (row) {
  219. taskService.getTaskDef({
  220. procInsId: row.processInstanceId,
  221. procDefId: row.processDefinitionId
  222. }).then((data) => {
  223. let query = {readOnly: true, title: row.vars.title, formTitle: row.vars.title, ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')}
  224. uni.navigateTo({
  225. url: '/pages/workbench/task/TaskFormDetail?flow='+JSON.stringify(query)
  226. })
  227. })
  228. },
  229. }
  230. }
  231. </script>