From f3f8d4a29353ac4a2cb216f0c9b92e63af2f574b Mon Sep 17 00:00:00 2001 From: LiuHao Date: Mon, 15 Jan 2024 12:02:21 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/workflow/category/types.ts | 2 +- src/api/workflow/processDefinition/index.ts | 11 +- src/api/workflow/processDefinition/types.ts | 22 +++ src/api/workflow/processInstance/index.ts | 14 +- src/api/workflow/processInstance/types.ts | 27 +++ src/api/workflow/task/index.ts | 4 +- src/api/workflow/task/types.ts | 6 +- .../workflow/processDefinition/index.vue | 162 ++++++++++-------- src/views/workflow/processInstance/index.vue | 133 +++++++------- src/views/workflow/task/allTaskWaiting.vue | 82 ++++----- src/views/workflow/task/index.vue | 5 +- src/views/workflow/task/myDocument.vue | 96 ++++++----- 12 files changed, 325 insertions(+), 239 deletions(-) create mode 100644 src/api/workflow/processDefinition/types.ts create mode 100644 src/api/workflow/processInstance/types.ts diff --git a/src/api/workflow/category/types.ts b/src/api/workflow/category/types.ts index 5a58982..414fa55 100644 --- a/src/api/workflow/category/types.ts +++ b/src/api/workflow/category/types.ts @@ -2,7 +2,7 @@ export interface CategoryVO { /** * 主键 */ - id: string | number; + id: string; /** * 分类名称 diff --git a/src/api/workflow/processDefinition/index.ts b/src/api/workflow/processDefinition/index.ts index b8f326a..f64b531 100644 --- a/src/api/workflow/processDefinition/index.ts +++ b/src/api/workflow/processDefinition/index.ts @@ -1,13 +1,14 @@ import request from '@/utils/request'; +import { ProcessDefinitionQuery, ProcessDefinitionVO, ProcessDefinitionXmlVO } from '@/api/workflow/processDefinition/types'; +import { AxiosPromise } from 'axios'; const baseUrl = import.meta.env.VITE_APP_BASE_API; -import { getToken } from '@/utils/auth'; /** * 获取流程定义列表 - * @param processInstanceId 流程实例id + * @param query 流程实例id * @returns */ -export const listProcessDefinition = (query: object) => { +export const listProcessDefinition = (query: ProcessDefinitionQuery): AxiosPromise => { return request({ url: `/workflow/processDefinition/list`, method: 'get', @@ -29,7 +30,7 @@ export const getProcessDefinitionListByKey = (key: string) => { /** * 通过流程定义id获取流程图 */ -export const processDefinitionImage = (processDefinitionId: string) => { +export const processDefinitionImage = (processDefinitionId: string): AxiosPromise => { return request({ url: `/workflow/processDefinition/processDefinitionImage/${processDefinitionId}` + '?t' + Math.random(), method: 'get' @@ -41,7 +42,7 @@ export const processDefinitionImage = (processDefinitionId: string) => { * @param processDefinitionId 流程定义id * @returns */ -export const processDefinitionXml = (processDefinitionId: string) => { +export const processDefinitionXml = (processDefinitionId: string): AxiosPromise => { return request({ url: `/workflow/processDefinition/processDefinitionXml/${processDefinitionId}`, method: 'get' diff --git a/src/api/workflow/processDefinition/types.ts b/src/api/workflow/processDefinition/types.ts new file mode 100644 index 0000000..8987b33 --- /dev/null +++ b/src/api/workflow/processDefinition/types.ts @@ -0,0 +1,22 @@ +export interface ProcessDefinitionQuery extends PageQuery { + key?: string; + name?: string; + categoryCode?: string; +} + +export interface ProcessDefinitionVO extends BaseEntity { + id: string; + name: string; + key: string; + version: number; + suspensionState: number; + resourceName: string; + diagramResourceName: string; + deploymentId: string; + deploymentTime: string; +} + +export interface ProcessDefinitionXmlVO { + xml: string[]; + xmlStr: string; +} diff --git a/src/api/workflow/processInstance/index.ts b/src/api/workflow/processInstance/index.ts index 63225f4..295fc0d 100644 --- a/src/api/workflow/processInstance/index.ts +++ b/src/api/workflow/processInstance/index.ts @@ -1,13 +1,15 @@ import request from '@/utils/request'; +import { ProcessInstanceQuery, ProcessInstanceVO } from '@/api/workflow/processInstance/types'; +import { AxiosPromise } from 'axios'; +import { string } from 'vue-types'; const baseUrl = import.meta.env.VITE_APP_BASE_API; -import { getToken } from '@/utils/auth'; /** * 查询运行中实例列表 * @param query * @returns {*} */ -export const getProcessInstanceRunningByPage = (query: object) => { +export const getProcessInstanceRunningByPage = (query: ProcessInstanceQuery): AxiosPromise => { return request({ url: '/workflow/processInstance/getProcessInstanceRunningByPage', method: 'get', @@ -20,7 +22,7 @@ export const getProcessInstanceRunningByPage = (query: object) => { * @param query * @returns {*} */ -export const getProcessInstanceFinishByPage = (query: object) => { +export const getProcessInstanceFinishByPage = (query: ProcessInstanceQuery): AxiosPromise => { return request({ url: '/workflow/processInstance/getProcessInstanceFinishByPage', method: 'get', @@ -68,7 +70,7 @@ export const deleteRuntimeProcessInst = (data: object) => { * @param processInstanceId 流程实例id * @returns */ -export const deleteRuntimeProcessAndHisInst = (processInstanceId: string) => { +export const deleteRuntimeProcessAndHisInst = (processInstanceId: string | string[]) => { return request({ url: `/workflow/processInstance/deleteRuntimeProcessAndHisInst/${processInstanceId}`, method: 'delete' @@ -80,7 +82,7 @@ export const deleteRuntimeProcessAndHisInst = (processInstanceId: string) => { * @param processInstanceId 流程实例id * @returns */ -export const deleteFinishProcessAndHisInst = (processInstanceId: string) => { +export const deleteFinishProcessAndHisInst = (processInstanceId: string | string[]) => { return request({ url: `/workflow/processInstance/deleteFinishProcessAndHisInst/${processInstanceId}`, method: 'delete' @@ -92,7 +94,7 @@ export const deleteFinishProcessAndHisInst = (processInstanceId: string) => { * @param query * @returns {*} */ -export const getCurrentSubmitByPage = (query: object) => { +export const getCurrentSubmitByPage = (query: ProcessInstanceQuery): AxiosPromise => { return request({ url: '/workflow/processInstance/getCurrentSubmitByPage', method: 'get', diff --git a/src/api/workflow/processInstance/types.ts b/src/api/workflow/processInstance/types.ts new file mode 100644 index 0000000..99d0511 --- /dev/null +++ b/src/api/workflow/processInstance/types.ts @@ -0,0 +1,27 @@ +import { TaskVO } from '@/api/workflow/task/types'; + +export interface ProcessInstanceQuery extends PageQuery { + categoryCode?: string; + name?: string; + key?: string; + startUserId?: string; + businessKey?: string; +} + +export interface ProcessInstanceVO extends BaseEntity { + id: string; + processDefinitionId: string; + processDefinitionName: string; + processDefinitionKey: string; + processDefinitionVersion: string; + deploymentId: string; + businessKey: string; + isSuspended?: any; + tenantId: string; + startTime: string; + endTime?: string; + startUserId: string; + businessStatus: string; + businessStatusName: string; + taskVoList: TaskVO[]; +} diff --git a/src/api/workflow/task/index.ts b/src/api/workflow/task/index.ts index 95b185a..af8ff9e 100644 --- a/src/api/workflow/task/index.ts +++ b/src/api/workflow/task/index.ts @@ -32,7 +32,7 @@ export const getTaskFinishByPage = (query: TaskQuery): AxiosPromise => * @param query * @returns {*} */ -export const getAllTaskWaitByPage = (query: object) => { +export const getAllTaskWaitByPage = (query: TaskQuery): AxiosPromise => { return request({ url: '/workflow/task/getAllTaskWaitByPage', method: 'get', @@ -45,7 +45,7 @@ export const getAllTaskWaitByPage = (query: object) => { * @param query * @returns {*} */ -export const getAllTaskFinishByPage = (query: object) => { +export const getAllTaskFinishByPage = (query: TaskQuery): AxiosPromise => { return request({ url: '/workflow/task/getAllTaskFinishByPage', method: 'get', diff --git a/src/api/workflow/task/types.ts b/src/api/workflow/task/types.ts index d2b846b..11cc48b 100644 --- a/src/api/workflow/task/types.ts +++ b/src/api/workflow/task/types.ts @@ -1,7 +1,7 @@ export interface TaskQuery extends PageQuery { - name: string; - processDefinitionKey: string; - processDefinitionName: string; + name?: string; + processDefinitionKey?: string; + processDefinitionName?: string; } export interface ParticipantVo { diff --git a/src/views/workflow/processDefinition/index.vue b/src/views/workflow/processDefinition/index.vue index 2ffd742..2fda8a1 100644 --- a/src/views/workflow/processDefinition/index.vue +++ b/src/views/workflow/processDefinition/index.vue @@ -4,10 +4,10 @@ - + -
+
- + @@ -39,7 +39,7 @@
-
+
部署流程文件 @@ -49,7 +49,7 @@ @@ -68,14 +68,13 @@ @@ -83,8 +82,14 @@ - + @@ -141,8 +154,8 @@ @@ -150,8 +163,14 @@ - + - + @@ -81,30 +77,37 @@ - + - + @@ -126,8 +135,8 @@ @@ -151,20 +160,16 @@ import { deleteFinishProcessAndHisInst, deleteRuntimeProcessInst } from '@/api/workflow/processInstance'; -import { - getProcessDefinitionListByKey, - migrationProcessDefinition -} from '@/api/workflow/processDefinition'; -import { ComponentInternalInstance } from 'vue'; +import { getProcessDefinitionListByKey, migrationProcessDefinition } from '@/api/workflow/processDefinition'; import ApprovalRecord from '@/components/Process/approvalRecord.vue'; -import { listCategory } from "@/api/workflow/category"; -import { ElTree } from 'element-plus'; +import { listCategory } from '@/api/workflow/category'; import { CategoryVO } from '@/api/workflow/category/types'; -import { string } from 'vue-types'; +import { ProcessInstanceQuery, ProcessInstanceVO } from '@/api/workflow/processInstance/types'; //审批记录组件 const approvalRecordRef = ref>(); const { proxy } = getCurrentInstance() as ComponentInternalInstance; -const queryFormRef = ref(ElForm); +const queryFormRef = ref(); +const categoryTreeRef = ref(); // 遮罩层 const loading = ref(true); @@ -181,11 +186,10 @@ const total = ref(0); // 流程定义id const processDefinitionId = ref(''); // 模型定义表格数据 -const processInstanceList = ref([]); +const processInstanceList = ref([]); const processDefinitionHistoryList = ref>([]); const categoryOptions = ref([]); const categoryName = ref(''); -const categoryTreeRef = ref(ElTree); const processDefinitionDialog = reactive({ visible: false, @@ -196,13 +200,13 @@ type CategoryOption = { categoryCode: string; categoryName: string; children?: CategoryOption[]; -} +}; const tab = ref('running'); // 作废原因 const deleteReason = ref(''); // 查询参数 -const queryParams = ref>({ +const queryParams = ref({ pageNum: 1, pageSize: 10, name: undefined, @@ -215,23 +219,24 @@ onMounted(() => { getTreeselect(); }); - /** 节点单击事件 */ const handleNodeClick = (data: CategoryVO) => { queryParams.value.categoryCode = data.categoryCode; if (data.categoryCode === 'ALL') { - queryParams.value.categoryCode = '' + queryParams.value.categoryCode = ''; } - handleQuery() -} + handleQuery(); +}; /** 通过条件过滤节点 */ const filterNode = (value: string, data: any) => { - if (!value) return true - return data.categoryName.indexOf(value) !== -1 -} + if (!value) return true; + return data.categoryName.indexOf(value) !== -1; +}; /** 根据名称筛选部门树 */ watchEffect( - () => { categoryTreeRef.value.filter(categoryName.value); }, + () => { + categoryTreeRef.value.filter(categoryName.value); + }, { flush: 'post' // watchEffect会在DOM挂载或者更新之前就会触发,此属性控制在DOM元素更新后运行 } @@ -242,9 +247,9 @@ const getTreeselect = async () => { const res = await listCategory(); categoryOptions.value = []; const data: CategoryOption = { categoryCode: 'ALL', categoryName: '顶级节点', children: [] }; - data.children = proxy?.handleTree(res.data, "id", "parentId"); + data.children = proxy?.handleTree(res.data, 'id', 'parentId'); categoryOptions.value.push(data); -} +}; //审批记录 const handleApprovalRecord = (row: any) => { @@ -262,14 +267,14 @@ const handleQuery = () => { }; /** 重置按钮操作 */ const resetQuery = () => { - queryFormRef.value.resetFields(); + queryFormRef.value?.resetFields(); queryParams.value.categoryCode = ''; queryParams.value.pageNum = 1; queryParams.value.pageSize = 10; handleQuery(); }; // 多选框选中数据 -const handleSelectionChange = (selection: any) => { +const handleSelectionChange = (selection: ProcessInstanceVO[]) => { ids.value = selection.map((item: any) => item.id); single.value = selection.length !== 1; multiple.value = !selection.length; @@ -316,7 +321,7 @@ const changeTab = async (data: string) => { } }; /** 作废按钮操作 */ -const handleInvalid = async (row: any) => { +const handleInvalid = async (row: ProcessInstanceVO) => { await proxy?.$modal.confirm('是否确认作废业务id为【' + row.businessKey + '】的数据项?'); loading.value = true; if ('running' === tab.value) { @@ -334,8 +339,8 @@ const cancelPopover = async (index: any) => { }; //获取流程定义 const getProcessDefinitionHitoryList = (id: string, key: string) => { - processDefinitionDialog.visible = true - processDefinitionId.value = id + processDefinitionDialog.visible = true; + processDefinitionId.value = id; loading.value = true; getProcessDefinitionListByKey(key).then((resp) => { if (resp.data && resp.data.length > 0) { @@ -351,7 +356,7 @@ const handleChange = async (id: string) => { migrationProcessDefinition(processDefinitionId.value, id).then((resp) => { proxy?.$modal.msgSuccess('操作成功'); getProcessInstanceRunningList(); - processDefinitionDialog.visible = false + processDefinitionDialog.visible = false; loading.value = false; }); }; diff --git a/src/views/workflow/task/allTaskWaiting.vue b/src/views/workflow/task/allTaskWaiting.vue index c3f5c3d..d5497c4 100644 --- a/src/views/workflow/task/allTaskWaiting.vue +++ b/src/views/workflow/task/allTaskWaiting.vue @@ -1,29 +1,25 @@