<template> <view> <u-search :show-action="false" v-model="searchForm.procInsName" @change="inputWord" margin="20rpx 50rpx"></u-search> <view> <u-swipe-action> <u-swipe-action-item v-for="(row) in dataList" @click="({index}) => commit(index, row)" :key="row.id" :threshold="60" duration="500" :options="[{ text: '删除', style: { backgroundColor: '#f56c6c' } },{ text: '查阅', style: { backgroundColor: '#3c9cff' } }]"> <u-cell-group> <u-cell @click="toDetail(row)"> <view slot="title" class="content"> <view class="text-bold text-grey"> <view class="ellipsis-description"> 流程标题: {{row.procInsName}} </view> </view> <view class="text-grey text-sm"> 抄送时间:{{row.createTime | formatDate}} </view> </view> </u-cell> </u-cell-group> </u-swipe-action-item> </u-swipe-action> </view> <u-loadmore :status="status" @loadmore="loadmore" :line="true" /> <u-gap height="20" bgColor="#fff"></u-gap> </view> </template> <script> import flowCopyService from "@/api/flowable/flowCopyService" import taskService from "@/api/flowable/taskService" import pick from 'lodash.pick' export default { data() { return { status: 'loadmore', searchForm: { procInsName: '' }, dataList: [], tablePage: { pages: 0, currentPage: 0, pageSize: 10, orders: [{ column: "a.create_time", asc: false }], }, loading: false, } }, onLoad() { this.loadmore() }, methods: { // 输入监听 inputWord(e){ this.searchTimer && clearTimeout(this.searchTimer) this.searchTimer = setTimeout(()=>{ this.doSearch() },300) }, // 搜索 doSearch(){ this.dataList = []; this.tablePage.currentPage = 0; this.tablePage.pageSize = 10; this.tablePage.pages = 0; this.loadmore() }, onReachBottom() { this.loadmore() }, loadmore() { if(this.tablePage.currentPage!==0 && this.tablePage.pages <= this.tablePage.currentPage ) { this.status = 'nomore'; return; } this.tablePage.currentPage = ++ this.tablePage.currentPage; //联网加载数据 this.status = 'loading'; flowCopyService.list({ current: this.tablePage.currentPage, size: this.tablePage.pageSize, orders: this.tablePage.orders, ...this.searchForm }).then((data)=>{ //追加新数据 this.dataList=this.dataList.concat(data.records); this.tablePage.pages = data.pages; if(this.tablePage.pages <= this.tablePage.currentPage){ this.status = 'nomore' } else { this.status = 'loadmore' } }) }, commit(index, row){ if(index === 0){ this.del(row) }else if(index === 1){ this.toDetail(row) } }, // 撤销申请 del (row) { uni.showModal({ title: '提示', content: '确定要删除该抄送吗?', success: (res)=>{ if (res.confirm) { flowCopyService.delete(row.id).then((data) => { uni.showToast({ title:data }) this.doSearch(this.curWord) }) } else if (res.cancel) { uni.hideLoading() } }, fail() { } }); }, toDetail (row) { taskService.getTaskDef({ procInsId: row.procInsId, procDefId: row.procDefId }).then((data) => { let query = {readOnly: true, title: row.procInsName, formTitle: row.procInsName, ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')} uni.navigateTo({ url: '/pages/workbench/task/TaskFormDetail?flow='+JSON.stringify(query) }) }) }, } } </script>