From e83d5914f03392d03e52917e01befb8aaf4a1df9 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 26 Mar 2023 00:46:32 +0800 Subject: [PATCH] =?UTF-8?q?Vue3=20=E9=87=8D=E6=9E=84=EF=BC=9A=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E6=A8=A1=E5=9E=8B=E7=9A=84=E5=90=84=E7=A7=8D=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/bpm/model/index.ts | 6 +- src/views/bpm/model/ModelForm.vue | 12 +- src/views/bpm/model/ModelImportForm.vue | 153 ++++++++++++++++++++ src/views/bpm/model/index.vue | 178 +++++++++++++++++++++--- 4 files changed, 322 insertions(+), 27 deletions(-) create mode 100644 src/views/bpm/model/ModelImportForm.vue diff --git a/src/api/bpm/model/index.ts b/src/api/bpm/model/index.ts index 68a8d0e8..2e1d4e64 100644 --- a/src/api/bpm/model/index.ts +++ b/src/api/bpm/model/index.ts @@ -38,7 +38,7 @@ export const updateModel = async (data: ModelVO) => { } // 任务状态修改 -export const updateModelStateApi = async (id: number, state: number) => { +export const updateModelState = async (id: number, state: number) => { const data = { id: id, state: state @@ -50,10 +50,10 @@ export const createModel = async (data: ModelVO) => { return await request.post({ url: '/bpm/model/create', data: data }) } -export const deleteModelApi = async (id: number) => { +export const deleteModel = async (id: number) => { return await request.delete({ url: '/bpm/model/delete?id=' + id }) } -export const deployModelApi = async (id: number) => { +export const deployModel = async (id: number) => { return await request.post({ url: '/bpm/model/deploy?id=' + id }) } diff --git a/src/views/bpm/model/ModelForm.vue b/src/views/bpm/model/ModelForm.vue index 192c5b2f..ac536958 100644 --- a/src/views/bpm/model/ModelForm.vue +++ b/src/views/bpm/model/ModelForm.vue @@ -67,7 +67,12 @@ - + { @@ -161,6 +167,8 @@ const open = async (type: string, id?: number) => { formLoading.value = false } } + // 获得流程表单的下拉框的数据 + formList.value = await FormApi.getSimpleFormList() } defineExpose({ open }) // 提供 open 方法,用于打开弹窗 diff --git a/src/views/bpm/model/ModelImportForm.vue b/src/views/bpm/model/ModelImportForm.vue new file mode 100644 index 00000000..6b53d322 --- /dev/null +++ b/src/views/bpm/model/ModelImportForm.vue @@ -0,0 +1,153 @@ + + + diff --git a/src/views/bpm/model/index.vue b/src/views/bpm/model/index.vue index 01e38a92..471a00fe 100644 --- a/src/views/bpm/model/index.vue +++ b/src/views/bpm/model/index.vue @@ -144,15 +144,43 @@ > 修改流程 - - - 详情 + + 设计流程 + + + 分配规则 + + + 发布流程 + + + 流程定义 删除 @@ -171,9 +199,20 @@ - - - + + + + + + + + @@ -181,11 +220,12 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { dateFormatter, formatDate } from '@/utils/formatTime' import * as ModelApi from '@/api/bpm/model' +import * as FormApi from '@/api/bpm/form' import ModelForm from './ModelForm.vue' -// import { setConfAndFields2 } from '@/utils/formCreate' -// const message = useMessage() // 消息弹窗 -// const { t } = useI18n() // 国际化 -// const { push } = useRouter() // 路由 +import { setConfAndFields2 } from '@/utils/formCreate' +const message = useMessage() // 消息弹窗 +const { t } = useI18n() // 国际化 +const { push } = useRouter() // 路由 const loading = ref(true) // 列表的加载中 const total = ref(0) // 列表的总页数 @@ -230,17 +270,111 @@ const openForm = (type: string, id?: number) => { } /** 删除按钮操作 */ -// const handleDelete = async (id: number) => { -// try { -// // 删除的二次确认 -// await message.delConfirm() -// // 发起删除 -// await FormApi.deleteForm(id) -// message.success(t('common.delSuccess')) -// // 刷新列表 -// await getList() -// } catch {} -// } +const handleDelete = async (id: number) => { + try { + // 删除的二次确认 + await message.delConfirm() + // 发起删除 + await ModelApi.deleteModel(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} + +/** 更新状态操作 */ +const handleChangeState = async (row) => { + const state = row.processDefinition.suspensionState + try { + // 修改状态的二次确认 + const id = row.id + const statusState = state === 1 ? '激活' : '挂起' + const content = '是否确认' + statusState + '流程名字为"' + row.name + '"的数据项?' + await message.confirm(content) + // 发起修改状态 + await ModelApi.updateModelState(id, state) + // 刷新列表 + await getList() + } catch { + // 取消后,进行恢复按钮 + row.processDefinition.suspensionState = state === 1 ? 2 : 1 + } +} + +/** 设计流程 */ +const handleDesign = (row) => { + push({ + name: 'modelEditor', + query: { + modelId: row.id + } + }) +} + +/** 发布流程 */ +const handleDeploy = async (row) => { + try { + // 删除的二次确认 + await message.confirm('是否部署该流程!!') + // 发起部署 + await ModelApi.deployModel(row.id) + message.success(t('部署成功')) + // 刷新列表 + await getList() + } catch {} +} + +/** 点击任务分配按钮 */ +const handleAssignRule = (row) => { + push({ + name: 'BpmTaskAssignRuleList', + query: { + modelId: row.id + } + }) +} + +/** 跳转到指定流程定义列表 */ +const handleDefinitionList = (row) => { + push({ + name: 'BpmProcessDefinitionList', + query: { + key: row.key + } + }) +} + +/** 流程表单的详情按钮操作 */ +const formDetailVisible = ref(false) +const formDetailPreview = ref({ + rule: [], + option: {} +}) +const handleFormDetail = async (row) => { + if (row.formType == 10) { + // 设置表单 + const data = await FormApi.getForm(row.formId) + setConfAndFields2(formDetailPreview, data.conf, data.fields) + // 弹窗打开 + formDetailVisible.value = true + } else { + await push({ + path: row.formCustomCreatePath + }) + } +} + +/** 流程图的详情按钮操作 */ +const bpmnDetailVisible = ref(false) +const bpmnXML = ref(null) +const bpmnControlForm = ref({ + prefix: 'flowable' +}) +const handleBpmnDetail = async (row) => { + const data = await ModelApi.getModel(row.id) + bpmnXML.value = data.bpmnXml || '' + bpmnDetailVisible.value = true +} /** 初始化 **/ onMounted(() => {