feat(workflow): add Excel export for process and task lists
Support filtered and selected rows for process defs, pending/completed tasks, and my applications. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
ee56dad875
commit
e72bcc67bc
6 files changed
+369
-4
No files matched your search
@@ -22,6 +22,14 @@ export function fetchProcessDefList(params?: {
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchExportProcessDefs(data: Record<string, any>) {
|
||||
return request.post({
|
||||
url: '/web/admin/workflow/defs/export',
|
||||
data,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchCreateProcessDef(data: {
|
||||
processCode: string
|
||||
processName: string
|
||||
@@ -144,6 +152,14 @@ export function fetchPendingTasks(params?: { page?: number; pageSize?: number; k
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchExportPendingTasks(data: Record<string, any>) {
|
||||
return request.post({
|
||||
url: '/web/admin/workflow/tasks/pending/export',
|
||||
data,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchCompletedTasks(params?: {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
@@ -161,6 +177,14 @@ export function fetchCompletedTasks(params?: {
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchExportCompletedTasks(data: Record<string, any>) {
|
||||
return request.post({
|
||||
url: '/web/admin/workflow/tasks/completed/export',
|
||||
data,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchApproveTask(taskId: string, data?: { commentText?: string }) {
|
||||
return request.post({
|
||||
url: `/web/admin/workflow/tasks/${taskId}/approve`,
|
||||
@@ -195,6 +219,14 @@ export function fetchMyInstances(params?: {
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchExportMyInstances(data: Record<string, any>) {
|
||||
return request.post({
|
||||
url: '/web/admin/workflow/instances/my/export',
|
||||
data,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchBusinessAllTasks(businessType: string, businessId: string) {
|
||||
return request.get<Api.Workflow.BusinessAllTasks>({
|
||||
url: `/web/admin/workflow/instances/by-business/${businessType}/${businessId}`
|
||||
|
||||
@@ -48,6 +48,16 @@
|
||||
@search="handleQuickSearch"
|
||||
@clear="handleQuickSearchClear"
|
||||
/>
|
||||
|
||||
<ListExportDropdown
|
||||
:export-fn="fetchExportMyInstances"
|
||||
:get-filter-params="getMyApplicationsExportFilterParams"
|
||||
:has-selection="true"
|
||||
:selected-ids="selectedRows.map((r) => r.id)"
|
||||
:visible-columns="myApplicationsExportColumns"
|
||||
filename="我的申请.xlsx"
|
||||
/>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
@@ -227,9 +237,10 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
|
||||
import ListExportDropdown from '@/components/business/list-export-dropdown/index.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { fetchMyInstances, fetchBusinessAllTasks } from '@/api/workflow'
|
||||
import { fetchMyInstances, fetchBusinessAllTasks, fetchExportMyInstances } from '@/api/workflow'
|
||||
import ProcessStatusTag from '../components/ProcessStatusTag.vue'
|
||||
import { Document, Search, RefreshLeft, Close } from '@element-plus/icons-vue'
|
||||
|
||||
@@ -252,6 +263,21 @@
|
||||
|
||||
const searchForm = reactive<{ keyword: string; status: string }>({ keyword: '', status: '' })
|
||||
const quickSearchKeyword = ref('')
|
||||
|
||||
function getMyApplicationsExportFilterParams() {
|
||||
const quickKeyword = quickSearchKeyword.value?.trim()
|
||||
return {
|
||||
keyword: quickKeyword || searchForm.keyword || undefined,
|
||||
status: searchForm.status || undefined
|
||||
}
|
||||
}
|
||||
|
||||
const myApplicationsExportColumns = computed(() => {
|
||||
const cols = [...visibleColumns.value]
|
||||
if (!cols.includes('processName')) cols.unshift('processName')
|
||||
return cols
|
||||
})
|
||||
|
||||
const tableData = ref<Api.Workflow.MyInstanceItem[]>([])
|
||||
const loading = ref(false)
|
||||
const selectedRows = ref<Api.Workflow.MyInstanceItem[]>([])
|
||||
|
||||
@@ -78,6 +78,15 @@
|
||||
批量删除
|
||||
</el-button>
|
||||
|
||||
<ListExportDropdown
|
||||
:export-fn="fetchExportProcessDefs"
|
||||
:get-filter-params="getProcessExportFilterParams"
|
||||
:has-selection="true"
|
||||
:selected-ids="selectedRows.map((r) => r.id)"
|
||||
:visible-columns="processExportColumns"
|
||||
filename="流程定义.xlsx"
|
||||
/>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
@@ -270,6 +279,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
|
||||
import ListExportDropdown from '@/components/business/list-export-dropdown/index.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import {
|
||||
@@ -294,7 +304,8 @@ import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
fetchProcessDefList,
|
||||
fetchCreateProcessDef,
|
||||
fetchUpdateProcessDef,
|
||||
fetchDeleteProcessDef
|
||||
fetchDeleteProcessDef,
|
||||
fetchExportProcessDefs
|
||||
} from '@/api/workflow'
|
||||
import FlowDesigner from '../designer/FlowDesigner.vue'
|
||||
import SystemViewDialog, {
|
||||
@@ -321,6 +332,20 @@ import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
|
||||
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
|
||||
const quickSearchKeyword = ref('')
|
||||
|
||||
function getProcessExportFilterParams() {
|
||||
const quickKeyword = quickSearchKeyword.value?.trim()
|
||||
return {
|
||||
keyword: quickKeyword || searchForm.keyword || undefined
|
||||
}
|
||||
}
|
||||
|
||||
const processExportColumns = computed(() => {
|
||||
const cols = [...visibleColumns.value]
|
||||
if (!cols.includes('processName')) cols.unshift('processName')
|
||||
return cols
|
||||
})
|
||||
|
||||
const tableData = ref<Api.Workflow.ProcessDefItem[]>([])
|
||||
const selectedRows = ref<Api.Workflow.ProcessDefItem[]>([])
|
||||
const loading = ref(false)
|
||||
|
||||
@@ -36,6 +36,16 @@
|
||||
@search="handleQuickSearch"
|
||||
@clear="handleQuickSearchClear"
|
||||
/>
|
||||
|
||||
<ListExportDropdown
|
||||
:export-fn="fetchExportCompletedTasks"
|
||||
:get-filter-params="getCompletedExportFilterParams"
|
||||
:has-selection="true"
|
||||
:selected-ids="selectedRows.map((r) => r.id)"
|
||||
:visible-columns="completedExportColumns"
|
||||
filename="已办任务.xlsx"
|
||||
/>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
@@ -232,9 +242,10 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
|
||||
import ListExportDropdown from '@/components/business/list-export-dropdown/index.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { fetchCompletedTasks, fetchInstanceDetail } from '@/api/workflow'
|
||||
import { fetchCompletedTasks, fetchInstanceDetail, fetchExportCompletedTasks } from '@/api/workflow'
|
||||
import ProcessStatusTag from '../components/ProcessStatusTag.vue'
|
||||
import { Document, Search, RefreshLeft, Close } from '@element-plus/icons-vue'
|
||||
|
||||
@@ -259,6 +270,20 @@
|
||||
|
||||
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
|
||||
const quickSearchKeyword = ref('')
|
||||
|
||||
function getCompletedExportFilterParams() {
|
||||
const quickKeyword = quickSearchKeyword.value?.trim()
|
||||
return {
|
||||
keyword: quickKeyword || searchForm.keyword || undefined
|
||||
}
|
||||
}
|
||||
|
||||
const completedExportColumns = computed(() => {
|
||||
const cols = [...visibleColumns.value]
|
||||
if (!cols.includes('processName')) cols.unshift('processName')
|
||||
return cols
|
||||
})
|
||||
|
||||
const tableData = ref<Api.Workflow.TaskItem[]>([])
|
||||
const loading = ref(false)
|
||||
const selectedRows = ref<Api.Workflow.TaskItem[]>([])
|
||||
|
||||
@@ -46,6 +46,15 @@
|
||||
审批
|
||||
</el-button>
|
||||
|
||||
<ListExportDropdown
|
||||
:export-fn="fetchExportPendingTasks"
|
||||
:get-filter-params="getPendingExportFilterParams"
|
||||
:has-selection="true"
|
||||
:selected-ids="selectedRows.map((r) => r.id)"
|
||||
:visible-columns="pendingExportColumns"
|
||||
filename="待办任务.xlsx"
|
||||
/>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
@@ -241,9 +250,10 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
|
||||
import ListExportDropdown from '@/components/business/list-export-dropdown/index.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { fetchPendingTasks, fetchInstanceDetail } from '@/api/workflow'
|
||||
import { fetchPendingTasks, fetchInstanceDetail, fetchExportPendingTasks } from '@/api/workflow'
|
||||
import ApprovalDialog from '../components/ApprovalDialog.vue'
|
||||
import ProcessStatusTag from '../components/ProcessStatusTag.vue'
|
||||
import { Document, EditPen, Search, RefreshLeft, Close } from '@element-plus/icons-vue'
|
||||
@@ -267,6 +277,20 @@ import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
|
||||
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
|
||||
const quickSearchKeyword = ref('')
|
||||
|
||||
function getPendingExportFilterParams() {
|
||||
const quickKeyword = quickSearchKeyword.value?.trim()
|
||||
return {
|
||||
keyword: quickKeyword || searchForm.keyword || undefined
|
||||
}
|
||||
}
|
||||
|
||||
const pendingExportColumns = computed(() => {
|
||||
const cols = [...visibleColumns.value]
|
||||
if (!cols.includes('processName')) cols.unshift('processName')
|
||||
return cols
|
||||
})
|
||||
|
||||
const tableData = ref<Api.Workflow.TaskItem[]>([])
|
||||
const selectedRows = ref<Api.Workflow.TaskItem[]>([])
|
||||
const loading = ref(false)
|
||||
|
||||
Reference in new issue
Block a user