diff --git a/src/api/demo/leave/index.ts b/src/api/demo/leave/index.ts new file mode 100644 index 0000000..064b8da --- /dev/null +++ b/src/api/demo/leave/index.ts @@ -0,0 +1,63 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { LeaveVO, LeaveForm, LeaveQuery } from '@/api/demo/leave/types'; + +/** + * 查询请假列表 + * @param query + * @returns {*} + */ + +export const listLeave = (query?: LeaveQuery): AxiosPromise => { + return request({ + url: '/demo/leave/list', + method: 'get', + params: query + }); +}; + +/** + * 查询请假详细 + * @param id + */ +export const getLeave = (id: string | number): AxiosPromise => { + return request({ + url: '/demo/leave/' + id, + method: 'get' + }); +}; + +/** + * 新增请假 + * @param data + */ +export const addLeave = (data: LeaveForm) => { + return request({ + url: '/demo/leave', + method: 'post', + data: data + }); +}; + +/** + * 修改请假 + * @param data + */ +export const updateLeave = (data: LeaveForm) => { + return request({ + url: '/demo/leave', + method: 'put', + data: data + }); +}; + +/** + * 删除请假 + * @param id + */ +export const delLeave = (id: string | number | Array) => { + return request({ + url: '/demo/leave/' + id, + method: 'delete' + }); +}; diff --git a/src/api/demo/leave/types.ts b/src/api/demo/leave/types.ts new file mode 100644 index 0000000..210aa51 --- /dev/null +++ b/src/api/demo/leave/types.ts @@ -0,0 +1,58 @@ +export interface LeaveVO { + /** + * 主键 + */ + id: string | number; + + /** + * 标题 + */ + title: string; + + /** + * 请假天数 + */ + leaveDays: number; + + /** + * 备注 + */ + remark: string; + +} + +export interface LeaveForm extends BaseEntity { + /** + * 主键 + */ + id?: string | number; + + /** + * 标题 + */ + title?: string; + + /** + * 请假天数 + */ + leaveDays?: number; + + /** + * 备注 + */ + remark?: string; + +} + +export interface LeaveQuery extends PageQuery { + /** + * 标题 + */ + title?: string; + + /** + * 请假天数 + */ + leaveDays?: number; + +} diff --git a/src/api/workflow/processDefinition/index.ts b/src/api/workflow/processDefinition/index.ts index 64ad9d2..f35069a 100644 --- a/src/api/workflow/processDefinition/index.ts +++ b/src/api/workflow/processDefinition/index.ts @@ -71,4 +71,16 @@ export const convertToModel = (processDefinitionId: string) => { }); }; +/** + * 通过zip或xml部署流程定义 + * @returns + */ +export function deployProcessFile(data: any) { + return request({ + url: '/workflow/processDefinition/deployByFile', + method: 'post', + data: data + }) +} + diff --git a/src/components/Process/submitVerify.vue b/src/components/Process/submitVerify.vue index 9bf9c17..d84a427 100644 --- a/src/components/Process/submitVerify.vue +++ b/src/components/Process/submitVerify.vue @@ -1,6 +1,6 @@ @@ -125,9 +130,9 @@ import { processDefinitionXml, deleteProcessDefinition, updateProcessDefState, - convertToModel + convertToModel, + deployProcessFile } from '@/api/workflow/processDefinition'; -import { startWorkFlow, completeTask } from '@/api/workflow/task'; import { ComponentInternalInstance } from 'vue'; import ProcessPreview from './components/processPreview.vue'; import { listCategory } from '@/api/workflow/category'; @@ -163,6 +168,11 @@ const dialog = reactive({ title: '启动' }); +const uploadDialog = reactive({ + visible: false, + title: '部署流程文件' +}); + // 查询参数 const queryParams = ref>({ pageNum: 1, @@ -295,30 +305,22 @@ const handleConvertToModel = async (row: any) => { proxy?.$modal.msgSuccess('操作成功'); }; -/** 打开启动流程弹窗 */ -const openHandleStartWorkFlow = async (row: any) => { - submitFormData.value.processKey = row.key; - submitFormData.value.businessKey = Date.parse(new Date()); - submitFormData.value.variables = { - userList:[1,2] +//部署文件 +const handerDeployProcessFile = async (data: any) => { + let formData = new FormData(); + if (queryParams.value.categoryCode === 'ALL') { + proxy?.$modal.msgError('顶级节点不可作为分类!'); + return false; } - dialog.visible = true; -}; -/** 启动流程 */ -const handleStartWorkFlow = async () => { - await proxy?.$modal.confirm('是否确认启动流程?'); - startWorkFlow(submitFormData.value).then((response) => { - handleCompleteTask(response.data.taskId); - }); -}; -/** 办理流程 */ -const handleCompleteTask = async (taskId: string) => { - let param = { - taskId: taskId - }; - await completeTask(param).finally(() => (loading.value = false)); - getList(); - proxy?.$modal.msgSuccess('操作成功'); - dialog.visible = false; + if (!queryParams.value.categoryCode) { + proxy?.$modal.msgError('请选择左侧要上传的分类!'); + return false; + } + formData.append('file', data.file); + formData.append('categoryCode', queryParams.value.categoryCode); + await deployProcessFile(formData); + uploadDialog.visible = false; + proxy?.$modal.msgSuccess('部署成功'); + handleQuery(); }; diff --git a/src/views/workflow/task/index.vue b/src/views/workflow/task/index.vue index 1be9639..3e7708a 100644 --- a/src/views/workflow/task/index.vue +++ b/src/views/workflow/task/index.vue @@ -105,7 +105,7 @@ - + @@ -133,8 +133,6 @@ const showSearch = ref(true); const total = ref(0); // 模型定义表格数据 const taskList = ref([]); -// 任务id -const taskId = ref(''); // 查询参数 const queryParams = ref>({ pageNum: 1, @@ -202,8 +200,7 @@ const getFinishList = () => { //提交 const submitVerifyOpen = async (id: string) => { if (submitVerifyRef.value) { - taskId.value = id; - submitVerifyRef.value.openDialog(true); + submitVerifyRef.value.openDialog(true,id); } };