| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <template>
- <div class="app-container">
- <el-card>
- <template #header>
- <div class="card-header">
- <span>我的已办</span>
- </div>
- </template>
- <el-form :inline="true" :model="queryParams" class="search-form">
- <el-form-item label="流程名称">
- <el-input v-model="queryParams.processName" placeholder="请输入流程名称" clearable />
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="handleQuery">查询</el-button>
- <el-button @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <el-table v-loading="loading" :data="tableData" border>
- <el-table-column type="index" label="序号" width="60" />
- <el-table-column prop="definitionName" label="流程名称" />
- <el-table-column label="处理节点" show-overflow-tooltip>
- <template #default="{ row }">
- {{ row.subNodeName ? row.nodeName + ' / ' + row.subNodeName : row.nodeName }}
- </template>
- </el-table-column>
- <el-table-column prop="action" label="操作结果" width="100">
- <template #default="{ row }">
- <el-tag :type="actionTagType(row.action)">
- {{ actionText(row.action) }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column prop="comment" label="审批意见" show-overflow-tooltip />
- <el-table-column prop="endTime" label="处理时间" />
- </el-table>
- <el-pagination
- v-model:current-page="queryParams.pageNum"
- v-model:page-size="queryParams.pageSize"
- :total="total"
- :page-sizes="[10, 20, 50]"
- layout="total, sizes, prev, pager, next, jumper"
- class="pagination"
- @current-change="loadData"
- @size-change="loadData"
- />
- </el-card>
- </div>
- </template>
- <script setup lang="ts">
- import { ref, reactive, onMounted } from 'vue'
- import { listHandled } from '@/api/flow/task'
- import type { FlowTask } from '@/types/flow'
- import { ElMessage } from 'element-plus'
- const loading = ref(false)
- const tableData = ref<FlowTask[]>([])
- const total = ref(0)
- const queryParams = reactive({
- pageNum: 1,
- pageSize: 10,
- processName: undefined as string | undefined
- })
- function actionText(action?: string) {
- const key = (action || '').toUpperCase()
- const map: Record<string, string> = {
- PASS: '通过',
- REJECT: '拒绝',
- RETURN: '回退',
- ROLLBACK: '回退',
- TRANSFER: '转办',
- ADD_SIGN: '加签'
- }
- return map[key] || action || '-'
- }
- function actionTagType(action?: string) {
- const key = (action || '').toUpperCase()
- const map: Record<string, any> = {
- PASS: 'success',
- REJECT: 'danger',
- RETURN: 'warning',
- ROLLBACK: 'warning',
- TRANSFER: 'info',
- ADD_SIGN: 'info'
- }
- return map[key] || 'info'
- }
- async function loadData() {
- loading.value = true
- try {
- const res = await listHandled(queryParams)
- tableData.value = res.list
- total.value = res.total
- } catch {
- ElMessage.error('加载已办任务失败')
- } finally {
- loading.value = false
- }
- }
- function handleQuery() {
- queryParams.pageNum = 1
- loadData()
- }
- function resetQuery() {
- queryParams.processName = undefined
- queryParams.pageNum = 1
- loadData()
- }
- onMounted(loadData)
- </script>
- <style scoped>
- .card-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .pagination {
- margin-top: 20px;
- justify-content: flex-end;
- }
- .search-form {
- margin-bottom: 20px;
- }
- </style>
|