From 00dfe00d4692a9406f1fea803585fa45ec1dd33b Mon Sep 17 00:00:00 2001
From: LesanOuO <1960681385@qq.com>
Date: Sun, 26 Jan 2025 11:07:16 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20BPM-=E6=95=B0=E6=8D=AE=E6=8A=A5?=
=?UTF-8?q?=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/bpm/processInstance/index.ts | 4 --
.../bpm/processInstance/report/index.vue | 61 ++++++++++++++-----
2 files changed, 47 insertions(+), 18 deletions(-)
diff --git a/src/api/bpm/processInstance/index.ts b/src/api/bpm/processInstance/index.ts
index 32cadc2c..9a99a91e 100644
--- a/src/api/bpm/processInstance/index.ts
+++ b/src/api/bpm/processInstance/index.ts
@@ -60,10 +60,6 @@ export const getProcessInstanceManagerPage = async (params: any) => {
return await request.get({ url: '/bpm/process-instance/manager-page', params })
}
-export const getProcessInstanceReportPage = async (params: any) => {
- return await request.get({ url: '/bpm/process-instance/report-page', params })
-}
-
export const createProcessInstance = async (data) => {
return await request.post({ url: '/bpm/process-instance/create', data: data })
}
diff --git a/src/views/bpm/processInstance/report/index.vue b/src/views/bpm/processInstance/report/index.vue
index 75753e51..57a5f349 100644
--- a/src/views/bpm/processInstance/report/index.vue
+++ b/src/views/bpm/processInstance/report/index.vue
@@ -66,6 +66,22 @@
class="!w-240px"
/>
+
+
+
+
搜索
重置
@@ -98,7 +114,7 @@
:formatter="dateFormatter"
/>
- {{ scope.row.variables.find((variable) => variable.key === item.field)?.value }}
+ {{ scope.row.formVariables[item.field] ?? '' }}
@@ -124,28 +140,28 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
import * as UserApi from '@/api/system/user'
+import * as DefinitionApi from '@/api/bpm/definition'
+import { parseFormFields } from '@/components/FormCreate/src/utils'
defineOptions({ name: 'BpmProcessInstanceReport' })
-const router = useRouter() // 路由
-const { query } = useRoute() // 查询参数
-const message = useMessage() // 消息弹窗
-const { t } = useI18n() // 国际化
+const { query } = useRoute()
const loading = ref(true) // 列表的加载中
const total = ref(0) // 列表的总页数
const list = ref([]) // 列表的数据
-const formFieldsList = ref([])
+const formFields = ref()
+const processDefinitionId = query.processDefinitionId as string
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
startUserId: undefined,
name: '',
- processDefinitionId: query.processDefinitionId,
processDefinitionKey: query.processDefinitionKey,
status: undefined,
createTime: [],
- endTime: []
+ endTime: [],
+ formFieldsParams: {}
})
const queryFormRef = ref() // 搜索的表单
const userList = ref([]) // 用户列表
@@ -154,16 +170,31 @@ const userList = ref([]) // 用户列表
const getList = async () => {
loading.value = true
try {
- const data = await ProcessInstanceApi.getProcessInstanceReportPage(queryParams)
- list.value = data.pageResult.list
- total.value = data.pageResult.total
- // TODO @lesan:不确定,能不能通过 processDefinitionId 获取流程定义哈,从而拿到 formFields;
- formFieldsList.value = data.formFields
+ let queryParamsClone = { ...queryParams }
+ queryParamsClone.formFieldsParams = JSON.stringify(queryParamsClone.formFieldsParams)
+ const data = await ProcessInstanceApi.getProcessInstanceManagerPage(queryParamsClone)
+ list.value = data.list
+ total.value = data.total
} finally {
loading.value = false
}
}
+const getProcessDefinition = async () => {
+ const processDefinition = await DefinitionApi.getProcessDefinition(processDefinitionId)
+ formFields.value = parseFormCreateFields(processDefinition.formFields)
+}
+
+const parseFormCreateFields = (formFields?: string[]) => {
+ const result: Array> = []
+ if (formFields) {
+ formFields.forEach((fieldStr: string) => {
+ parseFormFields(JSON.parse(fieldStr), result)
+ })
+ }
+ return result
+}
+
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
@@ -173,11 +204,13 @@ const handleQuery = () => {
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
+ queryFormRef.value.formFieldsParams = {}
handleQuery()
}
/** 初始化 **/
onMounted(async () => {
+ await getProcessDefinition()
await getList()
userList.value = await UserApi.getSimpleUserList()
})