diff --git a/src/api/workflow/definition/index.ts b/src/api/workflow/definition/index.ts index 9dcf8ba..03031a4 100644 --- a/src/api/workflow/definition/index.ts +++ b/src/api/workflow/definition/index.ts @@ -1,5 +1,5 @@ import request from '@/utils/request'; -import { definitionQuery, definitionVO, definitionXmlVO } from '@/api/workflow/definition/types'; +import { definitionQuery, definitionVO, definitionXmlVO, FlowDefinitionForm } from '@/api/workflow/definition/types'; import { AxiosPromise } from 'axios'; /** @@ -112,3 +112,16 @@ export const xmlString = (id: string) => { method: 'get' }); }; + +/** + * 新增 + * @param data 参数 + * @returns + */ +export const add = (data: FlowDefinitionForm) => { + return request({ + url: `/workflow/definition`, + method: 'post', + data: data + }); +}; diff --git a/src/api/workflow/definition/types.ts b/src/api/workflow/definition/types.ts index d30cb25..d04d949 100644 --- a/src/api/workflow/definition/types.ts +++ b/src/api/workflow/definition/types.ts @@ -1,5 +1,5 @@ import { DefinitionConfigVO } from '@/api/workflow/definitionConfig/types'; -export interface ProcessDefinitionQuery extends PageQuery { +export interface FlowDefinitionQuery extends PageQuery { key?: string; name?: string; categoryCode?: string; @@ -18,6 +18,12 @@ export interface FlowDefinitionVo extends BaseEntity { wfDefinitionConfigVo: DefinitionConfigVO; } +export interface FlowDefinitionForm { + flowName: string; + flowCode: string; + category: string; +} + export interface definitionXmlVO { xml: string[]; xmlStr: string; diff --git a/src/views/workflow/processDefinition/index.vue b/src/views/workflow/processDefinition/index.vue index ffb6ad5..18b92fc 100644 --- a/src/views/workflow/processDefinition/index.vue +++ b/src/views/workflow/processDefinition/index.vue @@ -41,6 +41,9 @@ - + @@ -255,6 +268,36 @@ + + + + + @@ -267,13 +310,14 @@ import { importDefinition, getHisListByKey, publish, - unPublish + unPublish, + add } from '@/api/workflow/definition'; 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, FlowDefinitionVo } from '@/api/workflow/definition/types'; +import { FlowDefinitionQuery, FlowDefinitionVo, FlowDefinitionForm } from '@/api/workflow/definition/types'; import { DefinitionConfigForm } from '@/api/workflow/definitionConfig/types'; import { UploadRequestOptions, ElMessage, ElMessageBox } from 'element-plus'; @@ -303,9 +347,9 @@ const processDefinitionList = ref([]); const processDefinitionHistoryList = ref([]); const categoryOptions = ref([]); const categoryName = ref(''); -const disabled = ref(true); /** 部署文件分类选择 */ const selectCategory = ref(); +const defFormRef = ref(); const uploadDialog = reactive({ visible: false, @@ -322,16 +366,30 @@ const definitionConfigDialog = reactive({ title: '流程定义配置' }); +const modelDialog = reactive({ + visible: false, + title: '新增流程' +}); + // 查询参数 -const queryParams = ref({ +const queryParams = ref({ pageNum: 1, pageSize: 10, name: undefined, key: undefined, - categoryCode: undefined, - isPublish: 1 + categoryCode: undefined +}); +const rules = { + category: [{ required: true, message: '分类名称不能为空', trigger: 'blur' }], + flowName: [{ required: true, message: '流程定义名称不能为空', trigger: 'blur' }], + flowCode: [{ required: true, message: '流程定义编码不能为空', trigger: 'blur' }] +}; +//新增流程定义参数 +const form = ref({ + flowName: '', + flowCode: '', + category: '' }); - onMounted(() => { getList(); getTreeselect(); @@ -449,6 +507,7 @@ const handleUnPublish = async (row?: FlowDefinitionVo) => { loading.value = true; await unPublish(row.id).finally(() => (loading.value = false)); await getList(); + processDefinitionDialog.visible = false; proxy?.$modal.msgSuccess('取消发布成功'); }; /** 挂起/激活 */ @@ -536,6 +595,10 @@ const handlerSaveForm = async () => { } }); }; +/** + * 设计流程 + * @param row + */ const design = async (row: FlowDefinitionVo) => { proxy.$router.push({ path: `/workflow/design/index`, @@ -544,4 +607,24 @@ const design = async (row: FlowDefinitionVo) => { } }); }; +/** + * 新增 + */ +const handleAdd = async () => { + modelDialog.visible = true; +}; +//保存 +const handleAddSubmit = async () => { + defFormRef.value.validate(async (valid: boolean) => { + if (valid) { + add(form.value).then((resp) => { + if (resp.code === 200) { + proxy?.$modal.msgSuccess('操作成功'); + modelDialog.visible = false; + getList(); + } + }); + } + }); +};