From b4b0eba2284d24a82732f01eab6bedb370cc4342 Mon Sep 17 00:00:00 2001
From: gssong <1742057357@qq.com>
Date: 星期六, 06 四月 2024 21:06:59 +0800
Subject: [PATCH] update 调整流程定义配置逻辑
---
src/components/Process/submitVerify.vue | 5
src/views/workflow/leave/leaveEdit.vue | 82 +++++++++-------
src/api/workflow/processDefinition/types.ts | 2
src/api/workflow/workflowCommon/types.ts | 6 +
src/api/workflow/definitionConfig/types.ts | 27 ++++-
src/views/workflow/processDefinition/index.vue | 112 +++++++++++++++++++---
src/api/workflow/definitionConfig/index.ts | 12 ++
7 files changed, 183 insertions(+), 63 deletions(-)
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 @@
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 @@
id: string | number;
/**
- * 琛ㄥ崟ID
+ * 琛ㄥ悕
*/
- formId?: string | number;
+ tableName?: string;
/**
* 娴佺▼瀹氫箟ID
@@ -20,6 +20,11 @@
* 娴佺▼KEY
*/
processKey: string;
+
+ /**
+ * 娴佺▼鐗堟湰
+ */
+ version?: string | number;
/**
* 澶囨敞
@@ -40,9 +45,9 @@
id?: string | number;
/**
- * 琛ㄥ崟ID
+ * 琛ㄥ悕
*/
- formId?: string | number;
+ tableName?: string;
/**
* 娴佺▼瀹氫箟ID
@@ -53,6 +58,11 @@
* 娴佺▼KEY
*/
processKey?: string;
+
+ /**
+ * 娴佺▼鐗堟湰
+ */
+ version?: string | number;
/**
* 澶囨敞
@@ -70,9 +80,9 @@
export interface DefinitionConfigQuery extends PageQuery {
/**
- * 琛ㄥ崟ID
+ * 琛ㄥ悕
*/
- formId?: string | number;
+ tableName?: string;
/**
* 娴佺▼瀹氫箟ID
@@ -85,6 +95,11 @@
processKey?: string;
/**
+ * 娴佺▼鐗堟湰
+ */
+ version?: string | number;
+
+ /**
* 琛ㄥ崟绠$悊
*/
wfFormManageVo: FormManageVO;
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 @@
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 @@
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 @@
participantVo: undefined,
multiInstance: undefined,
businessKey: undefined,
- wfNodeConfigVo: undefined,
- wfDefinitionConfigVo: undefined
+ wfNodeConfigVo: undefined
});
//鍔犵 鍑忕鏍囬
const title = ref('');
@@ -214,7 +213,7 @@
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 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 leaveFormRef = ref<ElFormInstance>();
-const submitFormData = ref<Record<string, any>>({
+const submitFormData = ref<StartProcessBo>({
businessKey: '',
- processKey: '',
+ tableName: '',
variables: {}
});
const taskVariables = ref<Record<string, any>>({});
@@ -191,46 +191,54 @@
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<LeaveVO>;
- 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<LeaveVO>;
+ 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 @@
<el-table-column align="center" prop="version" label="鐗堟湰鍙�" width="80">
<template #default="scope"> v{{ scope.row.version }}.0</template>
</el-table-column>
- <el-table-column align="center" prop="resourceName" label="娴佺▼XML" min-width="80" :show-overflow-tooltip="true">
+ <el-table-column align="center" prop="resourceName" label="娴佺▼XML" width="100" :show-overflow-tooltip="true">
<template #default="scope">
<el-link type="primary" @click="clickPreviewXML(scope.row.id)">{{ scope.row.resourceName }}</el-link>
</template>
</el-table-column>
- <el-table-column align="center" prop="diagramResourceName" label="娴佺▼鍥剧墖" min-width="80" :show-overflow-tooltip="true">
+ <el-table-column align="center" prop="diagramResourceName" label="娴佺▼鍥剧墖" width="100" :show-overflow-tooltip="true">
<template #default="scope">
<el-link type="primary" @click="clickPreviewImg(scope.row.id)">{{ scope.row.diagramResourceName }}</el-link>
</template>
</el-table-column>
- <el-table-column align="center" prop="suspensionState" label="鐘舵��" min-width="50">
+ <el-table-column align="center" prop="suspensionState" label="鐘舵��" width="80">
<template #default="scope">
<el-tag v-if="scope.row.suspensionState == 1" type="success">婵�娲�</el-tag>
<el-tag v-else type="danger">鎸傝捣</el-tag>
</template>
</el-table-column>
- <el-table-column align="center" prop="deploymentTime" label="閮ㄧ讲鏃堕棿" :show-overflow-tooltip="true"></el-table-column>
- <el-table-column fixed="right" label="鎿嶄綔" align="center" width="170" class-name="small-padding fixed-width">
+ <el-table-column align="center" prop="deploymentTime" label="閮ㄧ讲鏃堕棿" width="120" :show-overflow-tooltip="true"></el-table-column>
+ <el-table-column align="center" label="琛ㄥ悕/琛ㄥ崟KEY" width="120" :show-overflow-tooltip="true">
+ <template #default="scope">
+ <span v-if="scope.row.wfDefinitionConfigVo">
+ {{ scope.row.wfDefinitionConfigVo.tableName }}
+ </span>
+ </template>
+ </el-table-column>
+ <el-table-column fixed="right" label="鎿嶄綔" align="center" width="220" class-name="small-padding fixed-width">
<template #default="scope">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
@@ -93,6 +100,9 @@
</el-button>
</el-col>
<el-col :span="1.5">
+ <el-button type="text" size="small" icon="Document" @click="getProcessDefinitionHitoryList(scope.row.id, scope.row.key)">鍘嗗彶鐗堟湰</el-button>
+ </el-col>
+ <el-col :span="1.5">
<el-button link type="primary" size="small" icon="Delete" @click="handleDelete(scope.row)">鍒犻櫎</el-button>
</el-col>
</el-row>
@@ -101,16 +111,7 @@
<el-button link type="primary" size="small" icon="Sort" @click="handleConvertToModel(scope.row)"> 杞崲妯″瀷 </el-button>
</el-col>
<el-col :span="1.5">
- <el-dropdown>
- <el-button type="text" size="small">
- 鏇村<el-icon class="el-icon--right"><arrow-down /></el-icon>
- </el-button>
- <template #dropdown>
- <el-dropdown-menu>
- <el-dropdown-item @click="getProcessDefinitionHitoryList(scope.row.id, scope.row.key)">鍘嗗彶鐗堟湰</el-dropdown-item>
- </el-dropdown-menu>
- </template>
- </el-dropdown>
+ <el-button type="text" size="small" icon="Tickets" @click="handleDefinitionConfigOpen(scope.row)">缁戝畾涓氬姟</el-button>
</el-col>
</el-row>
</template>
@@ -203,17 +204,42 @@
</el-button>
</el-col>
<el-col :span="1.5">
- <el-button link type="primary" icon="Delete" size="small" @click="handleDelete(scope.row)">鍒犻櫎</el-button>
+ <el-button type="text" size="small" icon="Tickets" @click="handleDefinitionConfigOpen(scope.row)">缁戝畾涓氬姟</el-button>
</el-col>
</el-row>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button link type="primary" icon="Sort" size="small" @click="handleConvertToModel(scope.row)"> 杞崲妯″瀷 </el-button>
</el-col>
+ <el-col :span="1.5">
+ <el-button link type="primary" icon="Delete" size="small" @click="handleDelete(scope.row)">鍒犻櫎</el-button>
+ </el-col>
</el-row>
</template>
</el-table-column>
</el-table>
+ </el-dialog>
+
+ <!-- 琛ㄥ崟閰嶇疆 -->
+ <el-dialog v-model="definitionConfigDialog.visible" :title="definitionConfigDialog.title" width="650px" append-to-body :close-on-click-modal="false">
+ <el-form :model="definitionConfigForm" label-width="auto">
+ <el-form-item label="娴佺▼KEY">
+ <el-input v-model="definitionConfigForm.processKey" disabled/>
+ </el-form-item>
+ <el-form-item label="琛ㄥ悕" prop="formId">
+ <el-input v-model="definitionConfigForm.tableName" placeholder="绀轰緥:test_leave"/>
+ </el-form-item>
+ <el-form-item label="澶囨敞">
+ <el-input v-model="definitionConfigForm.remark" type="textarea" resize="none"/>
+ </el-form-item>
+ </el-form>
+
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button @click="definitionConfigDialog.visible = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="handlerSaveForm">淇濆瓨</el-button>
+ </div>
+ </template>
</el-dialog>
</div>
</template>
@@ -229,17 +255,20 @@
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<InstanceType<typeof ProcessPreview>>();
const queryFormRef = ref<ElFormInstance>();
const categoryTreeRef = ref<ElTreeInstance>();
+const definitionConfigForm = ref<definitionConfigForm>({});
type CategoryOption = {
categoryCode: string;
@@ -270,6 +299,11 @@
const processDefinitionDialog = reactive<DialogOption>({
visible: false,
title: '鍘嗗彶鐗堟湰'
+});
+
+const definitionConfigDialog = reactive<DialogOption>({
+ visible: false,
+ title: '娴佺▼瀹氫箟閰嶇疆'
});
// 鏌ヨ鍙傛暟
@@ -436,4 +470,48 @@
});
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+'銆戠増鏈瑅'+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();
+ }
+ })
+ }
+ })
+
+}
</script>
--
Gitblit v1.9.3