diff --git a/src/api/workflow/definitionConfig/index.ts b/src/api/workflow/definitionConfig/index.ts index 44c3e85..99e95d0 100644 --- a/src/api/workflow/definitionConfig/index.ts +++ b/src/api/workflow/definitionConfig/index.ts @@ -36,3 +36,15 @@ export const deldefinitionConfig = (id: string | number | Array method: 'delete' }); }; + +/** + * 查询流程定义配置排除当前查询的流程定义 + * @param tableName + * @param tableName + */ +export const getByTableNameNotDefId = (tableName: string,definitionId: string ) => { + return request({ + url: `/workflow/definitionConfig/getByTableNameNotDefId/${tableName}/${definitionId}`, + method: 'get' + }); +}; diff --git a/src/api/workflow/definitionConfig/types.ts b/src/api/workflow/definitionConfig/types.ts index 836e7f4..e3c93d3 100644 --- a/src/api/workflow/definitionConfig/types.ts +++ b/src/api/workflow/definitionConfig/types.ts @@ -7,9 +7,9 @@ export interface DefinitionConfigVO { id: string | number; /** - * 表单ID + * 表名 */ - formId?: string | number; + tableName?: string; /** * 流程定义ID @@ -21,6 +21,11 @@ export interface DefinitionConfigVO { */ processKey: string; + /** + * 流程版本 + */ + version?: string | number; + /** * 备注 */ @@ -40,9 +45,9 @@ export interface DefinitionConfigForm extends BaseEntity { id?: string | number; /** - * 表单ID + * 表名 */ - formId?: string | number; + tableName?: string; /** * 流程定义ID @@ -54,6 +59,11 @@ export interface DefinitionConfigForm extends BaseEntity { */ processKey?: string; + /** + * 流程版本 + */ + version?: string | number; + /** * 备注 */ @@ -70,9 +80,9 @@ export interface DefinitionConfigForm extends BaseEntity { export interface DefinitionConfigQuery extends PageQuery { /** - * 表单ID + * 表名 */ - formId?: string | number; + tableName?: string; /** * 流程定义ID @@ -84,6 +94,11 @@ export interface DefinitionConfigQuery extends PageQuery { */ processKey?: string; + /** + * 流程版本 + */ + version?: string | number; + /** * 表单管理 */ diff --git a/src/api/workflow/processDefinition/types.ts b/src/api/workflow/processDefinition/types.ts index 3775ba2..979ec25 100644 --- a/src/api/workflow/processDefinition/types.ts +++ b/src/api/workflow/processDefinition/types.ts @@ -1,3 +1,4 @@ +import { DefinitionConfigVO } from '@/api/workflow/definitionConfig/types'; export interface ProcessDefinitionQuery extends PageQuery { key?: string; name?: string; @@ -14,6 +15,7 @@ export interface ProcessDefinitionVO extends BaseEntity { diagramResourceName: string; deploymentId: string; deploymentTime: string; + wfDefinitionConfigVo: DefinitionConfigVO; } export interface definitionXmlVO { diff --git a/src/api/workflow/workflowCommon/types.ts b/src/api/workflow/workflowCommon/types.ts index 9bd2454..be7325f 100644 --- a/src/api/workflow/workflowCommon/types.ts +++ b/src/api/workflow/workflowCommon/types.ts @@ -5,4 +5,10 @@ export interface RouterJumpVo { businessKey: string; taskId: string; type: string; +} + +export interface StartProcessBo { + businessKey: string | number; + tableName: string; + variables: any; } \ No newline at end of file diff --git a/src/components/Process/submitVerify.vue b/src/components/Process/submitVerify.vue index ca8ac9e..d71b855 100644 --- a/src/components/Process/submitVerify.vue +++ b/src/components/Process/submitVerify.vue @@ -142,8 +142,7 @@ const task = ref({ participantVo: undefined, multiInstance: undefined, businessKey: undefined, - wfNodeConfigVo: undefined, - wfDefinitionConfigVo: undefined + wfNodeConfigVo: undefined }); //加签 减签标题 const title = ref(''); @@ -214,7 +213,7 @@ const handleCompleteTask = async () => { dialog.visible = false; emits('submitCallback'); proxy?.$modal.msgSuccess('操作成功'); - }finally { + } finally { loading.value = false buttonLoading.value = false } diff --git a/src/views/workflow/leave/leaveEdit.vue b/src/views/workflow/leave/leaveEdit.vue index 83d5cd6..a57614a 100644 --- a/src/views/workflow/leave/leaveEdit.vue +++ b/src/views/workflow/leave/leaveEdit.vue @@ -85,7 +85,7 @@ import { startWorkFlow } from '@/api/workflow/task'; import SubmitVerify from '@/components/Process/submitVerify.vue'; import ApprovalRecord from '@/components/Process/approvalRecord.vue'; import { AxiosResponse } from 'axios'; - +import { StartProcessBo } from '@/api/workflow/workflowCommon/types'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; const buttonLoading = ref(false); @@ -120,9 +120,9 @@ const approvalRecordRef = ref>(); const leaveFormRef = ref(); -const submitFormData = ref>({ +const submitFormData = ref({ businessKey: '', - processKey: '', + tableName: '', variables: {} }); const taskVariables = ref>({}); @@ -191,46 +191,54 @@ const submitForm = (status: string) => { proxy?.$modal.msgError('请假时间不能为空'); return; } - leaveFormRef.value?.validate(async (valid: boolean) => { - form.value.startDate = leaveTime.value[0]; - form.value.endDate = leaveTime.value[1]; - if (valid) { - buttonLoading.value = true; - let res: AxiosResponse; - if (form.value.id) { - res = await updateLeave(form.value); - } else { - res = await addLeave(form.value); + try { + leaveFormRef.value?.validate(async (valid: boolean) => { + form.value.startDate = leaveTime.value[0]; + form.value.endDate = leaveTime.value[1]; + if (valid) { + buttonLoading.value = true; + let res: AxiosResponse; + if (form.value.id) { + res = await updateLeave(form.value); + } else { + res = await addLeave(form.value); + } + form.value = res.data; + if (status === 'draft') { + buttonLoading.value = false; + proxy?.$modal.msgSuccess('暂存成功'); + proxy.$tab.closePage(proxy.$route); + proxy.$router.go(-1); + } else { + await handleStartWorkFlow(res.data); + } } - form.value = res.data; - if (status === 'draft') { - buttonLoading.value = false; - proxy?.$modal.msgSuccess('暂存成功'); - proxy.$tab.closePage(proxy.$route); - proxy.$router.go(-1); - } else { - await handleStartWorkFlow(res.data); - } - } - }); + }); + } finally { + buttonLoading.value = false; + } }; //提交申请 const handleStartWorkFlow = async (data: LeaveVO) => { - submitFormData.value.processKey = 'leave1'; - submitFormData.value.businessKey = data.id; - //流程变量 - taskVariables.value = { - entity: data, - leaveDays: data.leaveDays, - userList: [1, 2], - userList2: [1, 2] - }; - submitFormData.value.variables = taskVariables.value; - const resp = await startWorkFlow(submitFormData.value); - if (submitVerifyRef.value) { + try { + submitFormData.value.tableName = 'test_leave'; + submitFormData.value.businessKey = data.id; + //流程变量 + taskVariables.value = { + entity: data, + leaveDays: data.leaveDays, + userList: [1, 2], + userList2: [1, 2] + }; + submitFormData.value.variables = taskVariables.value; + const resp = await startWorkFlow(submitFormData.value); + if (submitVerifyRef.value) { + buttonLoading.value = false; + submitVerifyRef.value.openDialog(resp.data.taskId); + } + } finally { buttonLoading.value = false; - submitVerifyRef.value.openDialog(resp.data.taskId); } }; //审批记录 diff --git a/src/views/workflow/processDefinition/index.vue b/src/views/workflow/processDefinition/index.vue index a3c26df..376182b 100644 --- a/src/views/workflow/processDefinition/index.vue +++ b/src/views/workflow/processDefinition/index.vue @@ -61,24 +61,31 @@ - + - + - + - - + + + + + @@ -203,18 +204,43 @@ - 删除 + 绑定业务 转换模型 + + 删除 + + + + + + + + + + + + + + + + + + @@ -229,17 +255,20 @@ import { deployProcessFile, getListByKey } from '@/api/workflow/processDefinition'; +import { getByTableNameNotDefId,getByDefId,saveOrUpdate } from '@/api/workflow/definitionConfig'; import ProcessPreview from './components/processPreview.vue'; import { listCategory } from '@/api/workflow/category'; import { CategoryVO } from '@/api/workflow/category/types'; import { ProcessDefinitionQuery, ProcessDefinitionVO } from '@/api/workflow/processDefinition/types'; -import { UploadRequestOptions } from 'element-plus'; +import { definitionConfigForm } from '@/api/workflow/definitionConfig/types'; +import { UploadRequestOptions, ElMessage, ElMessageBox } from 'element-plus'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; const previewRef = ref>(); const queryFormRef = ref(); const categoryTreeRef = ref(); +const definitionConfigForm = ref({}); type CategoryOption = { categoryCode: string; @@ -272,6 +301,11 @@ const processDefinitionDialog = reactive({ title: '历史版本' }); +const definitionConfigDialog = reactive({ + visible: false, + title: '流程定义配置' +}); + // 查询参数 const queryParams = ref({ pageNum: 1, @@ -436,4 +470,48 @@ const handerDeployProcessFile = (data: UploadRequestOptions): XMLHttpRequest => }); return; }; +//打开流程定义配置 +const handleDefinitionConfigOpen = async (row: ProcessDefinitionVO) => { + definitionConfigDialog.visible = true + definitionConfigForm.value.processKey = row.key + definitionConfigForm.value.definitionId = row.id + definitionConfigForm.value.version = row.version + const resp = await getByDefId(row.id) + if(resp.data){ + definitionConfigForm.value = resp.data + }else{ + definitionConfigForm.value.tableName = undefined + definitionConfigForm.value.remark = undefined + } +} +//保存表单 +const handlerSaveForm = async () => { + getByTableNameNotDefId(definitionConfigForm.value.tableName,definitionConfigForm.value.definitionId).then(res => { + if(res.data && res.data.length > 0){ + ElMessageBox.confirm('表名已被【'+res.data[0].processKey+'】版本v'+res.data[0].version+'.0绑定确认后将会删除绑定的流程KEY!','提示',{ + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + } + ).then(() => { + saveOrUpdate(definitionConfigForm.value).then(resp=>{ + if(resp.code === 200){ + proxy?.$modal.msgSuccess('操作成功'); + definitionConfigDialog.visible = false + getList(); + } + }) + }) + }else{ + saveOrUpdate(definitionConfigForm.value).then(resp=>{ + if(resp.code === 200){ + proxy?.$modal.msgSuccess('操作成功'); + definitionConfigDialog.visible = false + getList(); + } + }) + } + }) + +}