From 3ad5511aa89a2916bed4fa5cf7679a464da44d0b Mon Sep 17 00:00:00 2001 From: xingyu Date: Wed, 23 Aug 2023 14:14:39 +0800 Subject: [PATCH] feat: bpm views --- src/api/bpm/activity/index.ts | 5 ++ src/api/bpm/model/index.ts | 22 ++--- src/api/bpm/task/index.ts | 5 ++ src/api/bpm/task/types.ts | 39 --------- src/components/Upload/src/data.tsx | 4 +- src/views/base/profile/data.ts | 2 +- src/views/bpm/form/form.data.ts | 11 +-- src/views/bpm/form/index.vue | 2 +- src/views/bpm/group/group.data.ts | 2 +- src/views/bpm/group/index.vue | 2 +- src/views/bpm/model/ModelImportModal.vue | 78 ++++++++++++++++++ src/views/bpm/model/ModelModal.vue | 2 +- src/views/bpm/model/index.vue | 27 ++++--- src/views/bpm/oa/leave/create.vue | 41 +++++++++- src/views/bpm/oa/leave/detail.vue | 39 ++++++++- src/views/bpm/oa/leave/index.vue | 81 ++++++++++++++++++- src/views/bpm/oa/leave/leave.data.ts | 75 ++++++++++++++++- .../bpm/processInstance/create/index.vue | 2 +- .../bpm/processInstance/detail/index.vue | 2 +- src/views/bpm/processInstance/index.vue | 2 +- 20 files changed, 349 insertions(+), 94 deletions(-) create mode 100644 src/api/bpm/activity/index.ts delete mode 100644 src/api/bpm/task/types.ts create mode 100644 src/views/bpm/model/ModelImportModal.vue diff --git a/src/api/bpm/activity/index.ts b/src/api/bpm/activity/index.ts new file mode 100644 index 00000000..7af0c2e1 --- /dev/null +++ b/src/api/bpm/activity/index.ts @@ -0,0 +1,5 @@ +import { defHttp } from '@/utils/http/axios' + +export function getActivityList(params) { + return defHttp.get({ url: '/bpm/activity/list', params }) +} diff --git a/src/api/bpm/model/index.ts b/src/api/bpm/model/index.ts index cc86f023..483e9d86 100644 --- a/src/api/bpm/model/index.ts +++ b/src/api/bpm/model/index.ts @@ -1,11 +1,5 @@ -import type { AxiosProgressEvent } from 'axios' -import type { UploadApiResult } from '@/api/base/model/uploadModel' -import { useGlobSetting } from '@/hooks/setting' -import type { UploadFileParams } from '@/types/axios' import { defHttp } from '@/utils/http/axios' -const { apiUrl = '' } = useGlobSetting() - export interface ProcessDefinitionVO { id: string version: number @@ -43,7 +37,11 @@ export function updateModel(data: ModelVO) { } // 任务状态修改 -export function updateModelState(data) { +export function updateModelState(id: number, state: number) { + const data = { + id, + state, + } return defHttp.put({ url: '/bpm/model/update-state', data }) } @@ -59,12 +57,6 @@ export function deployModel(id: number) { return defHttp.post({ url: `/bpm/model/deploy?id=${id}` }) } -export function importModel(params: UploadFileParams, onUploadProgress: (progressEvent: AxiosProgressEvent) => void) { - return defHttp.uploadFile( - { - url: `${apiUrl}/bpm/model/import`, - onUploadProgress, - }, - params, - ) +export function importModel(data) { + return defHttp.post({ url: '/bpm/model/import', data }) } diff --git a/src/api/bpm/task/index.ts b/src/api/bpm/task/index.ts index 1b980b21..f3721b85 100644 --- a/src/api/bpm/task/index.ts +++ b/src/api/bpm/task/index.ts @@ -32,3 +32,8 @@ export function getTaskListByProcessInstanceId(processInstanceId) { url: `/bpm/task/list-by-process-instance-id?processInstanceId=${processInstanceId}`, }) } + +// 导出任务 +export async function exportTask(params) { + return await defHttp.download({ url: '/bpm/task/export', params }) +} diff --git a/src/api/bpm/task/types.ts b/src/api/bpm/task/types.ts deleted file mode 100644 index 29c2e173..00000000 --- a/src/api/bpm/task/types.ts +++ /dev/null @@ -1,39 +0,0 @@ -export interface FormVO { - id: number - name: string - conf: string - fields: string[] - status: number - remark: string - createTime: string -} - -export interface TaskProcessVO { - id: string - name: string - startUserId: number - startUserNickname: string - processDefinitionId: string -} - -export interface TaskTodoVO { - id: string - name: string - claimTime: string - createTime: string - suspensionState: number - processInstance: TaskProcessVO -} - -export interface TaskDoneVO { - id: string - name: string - claimTime: string - createTime: string - endTime: string - durationInMillis: number - suspensionState: number - result: number - reason: string - processInstance: TaskProcessVO -} diff --git a/src/components/Upload/src/data.tsx b/src/components/Upload/src/data.tsx index 1bdaded5..08a4cfe1 100644 --- a/src/components/Upload/src/data.tsx +++ b/src/components/Upload/src/data.tsx @@ -88,7 +88,7 @@ export function createActionColumn(handleRemove: Function): BasicColumn { const actions: ActionItem[] = [ { label: t('component.upload.del'), - color: 'error', + danger: true, onClick: handleRemove.bind(null, record), }, ] @@ -132,7 +132,7 @@ export function createPreviewActionColumn({ handleRemove, handleDownload }: { ha const actions: ActionItem[] = [ { label: t('component.upload.del'), - color: 'error', + danger: true, onClick: handleRemove.bind(null, record), }, { diff --git a/src/views/base/profile/data.ts b/src/views/base/profile/data.ts index 57e34e2e..61f74668 100644 --- a/src/views/base/profile/data.ts +++ b/src/views/base/profile/data.ts @@ -1,4 +1,4 @@ -import type { FormSchema } from '@/components/Form/index' +import type { FormSchema } from '@/components/Form' import { useI18n } from '@/hooks/web/useI18n' const { t } = useI18n() diff --git a/src/views/bpm/form/form.data.ts b/src/views/bpm/form/form.data.ts index 93a921c8..f2bac499 100644 --- a/src/views/bpm/form/form.data.ts +++ b/src/views/bpm/form/form.data.ts @@ -1,6 +1,6 @@ import type { BasicColumn, FormSchema } from '@/components/Table' import { useRender } from '@/components/Table' -import { DICT_TYPE, getDictOptions } from '@/utils/dict' +import { DICT_TYPE } from '@/utils/dict' export const columns: BasicColumn[] = [ { @@ -43,13 +43,4 @@ export const searchFormSchema: FormSchema[] = [ component: 'Input', colProps: { span: 8 }, }, - { - label: '状态', - field: 'status', - component: 'Select', - componentProps: { - options: getDictOptions(DICT_TYPE.COMMON_STATUS), - }, - colProps: { span: 8 }, - }, ] diff --git a/src/views/bpm/form/index.vue b/src/views/bpm/form/index.vue index f5b1004c..d65d0db7 100644 --- a/src/views/bpm/form/index.vue +++ b/src/views/bpm/form/index.vue @@ -67,7 +67,7 @@ async function handleDelete(record: Recordable) { { icon: IconEnum.VIEW, label: t('action.detail'), auth: 'bpm:form:query', onClick: openDetail.bind(null, record) }, { icon: IconEnum.DELETE, - color: 'error', + danger: true, label: t('action.delete'), auth: 'bpm:form:delete', popConfirm: { diff --git a/src/views/bpm/group/group.data.ts b/src/views/bpm/group/group.data.ts index 932a8100..fff6dd42 100644 --- a/src/views/bpm/group/group.data.ts +++ b/src/views/bpm/group/group.data.ts @@ -126,7 +126,7 @@ export const formSchema: FormSchema[] = [ { label: '状态', field: 'status', - component: 'Select', + component: 'RadioGroup', componentProps: { options: getDictOptions(DICT_TYPE.COMMON_STATUS), }, diff --git a/src/views/bpm/group/index.vue b/src/views/bpm/group/index.vue index d549fe86..0848c84b 100644 --- a/src/views/bpm/group/index.vue +++ b/src/views/bpm/group/index.vue @@ -59,7 +59,7 @@ async function handleDelete(record: Recordable) { { icon: IconEnum.EDIT, label: t('action.edit'), auth: 'bpm:user-group:update', onClick: handleEdit.bind(null, record) }, { icon: IconEnum.DELETE, - color: 'error', + danger: true, label: t('action.delete'), auth: 'bpm:user-group:delete', popConfirm: { diff --git a/src/views/bpm/model/ModelImportModal.vue b/src/views/bpm/model/ModelImportModal.vue new file mode 100644 index 00000000..e30aefa8 --- /dev/null +++ b/src/views/bpm/model/ModelImportModal.vue @@ -0,0 +1,78 @@ + + + diff --git a/src/views/bpm/model/ModelModal.vue b/src/views/bpm/model/ModelModal.vue index f015a443..6517ec0f 100644 --- a/src/views/bpm/model/ModelModal.vue +++ b/src/views/bpm/model/ModelModal.vue @@ -7,7 +7,7 @@ import { BasicForm, useForm } from '@/components/Form' import { BasicModal, useModalInner } from '@/components/Modal' import { createModel, getModel, updateModel } from '@/api/bpm/model' -defineOptions({ name: 'BpmModelModal' }) +defineOptions({ name: 'ModelForm' }) const emit = defineEmits(['success', 'register']) const { t } = useI18n() diff --git a/src/views/bpm/model/index.vue b/src/views/bpm/model/index.vue index 0e830979..48a40825 100644 --- a/src/views/bpm/model/index.vue +++ b/src/views/bpm/model/index.vue @@ -1,16 +1,16 @@ + diff --git a/src/views/bpm/oa/leave/detail.vue b/src/views/bpm/oa/leave/detail.vue index 36487dd5..bc35a3fc 100644 --- a/src/views/bpm/oa/leave/detail.vue +++ b/src/views/bpm/oa/leave/detail.vue @@ -1,3 +1,40 @@ + + diff --git a/src/views/bpm/oa/leave/index.vue b/src/views/bpm/oa/leave/index.vue index caa07726..ddcd441b 100644 --- a/src/views/bpm/oa/leave/index.vue +++ b/src/views/bpm/oa/leave/index.vue @@ -1,14 +1,20 @@ diff --git a/src/views/bpm/oa/leave/leave.data.ts b/src/views/bpm/oa/leave/leave.data.ts index 1590326c..0f71890c 100644 --- a/src/views/bpm/oa/leave/leave.data.ts +++ b/src/views/bpm/oa/leave/leave.data.ts @@ -1,3 +1,4 @@ +import type { DescItem } from '@/components/Description' import type { BasicColumn, FormSchema } from '@/components/Table' import { useRender } from '@/components/Table' import { DICT_TYPE, getDictOptions } from '@/utils/dict' @@ -47,7 +48,7 @@ export const columns: BasicColumn[] = [ }, { title: '申请时间', - dataIndex: 'applyTime', + dataIndex: 'createTime', width: 180, customRender: ({ text }) => { return useRender.renderDate(text) @@ -58,7 +59,7 @@ export const columns: BasicColumn[] = [ export const searchFormSchema: FormSchema[] = [ { label: '请假类型', - field: 'status', + field: 'type', component: 'Select', componentProps: { options: getDictOptions(DICT_TYPE.BPM_OA_LEAVE_TYPE), @@ -73,7 +74,7 @@ export const searchFormSchema: FormSchema[] = [ }, { label: '结果', - field: 'status', + field: 'result', component: 'Select', componentProps: { options: getDictOptions(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT), @@ -87,3 +88,71 @@ export const searchFormSchema: FormSchema[] = [ colProps: { span: 8 }, }, ] + +export const formSchema: FormSchema[] = [ + { + label: '请假类型', + field: 'type', + required: true, + component: 'Select', + componentProps: { + options: getDictOptions(DICT_TYPE.BPM_OA_LEAVE_TYPE), + }, + }, + { + label: '开始时间', + field: 'startTime', + required: true, + component: 'DatePicker', + componentProps: { + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + }, + }, + { + label: '结束时间', + field: 'endTime', + required: true, + component: 'DatePicker', + componentProps: { + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + }, + }, + { + label: '原因', + field: 'reason', + required: true, + component: 'Input', + }, +] + +export const descSchema: DescItem[] = [ + { + label: '请假类型', + field: 'merchantOrderId', + render: (curVal) => { + return useRender.renderTag(curVal) + }, + }, + { + label: '开始时间', + field: 'startTime', + render: (curVal) => { + return useRender.renderDate(curVal, 'YYYY-MM-DD') + }, + }, + { + label: '结束时间', + field: 'endTime', + render: (curVal) => { + return useRender.renderDate(curVal, 'YYYY-MM-DD') + }, + }, + { + label: '原因', + field: 'reason', + }, +] diff --git a/src/views/bpm/processInstance/create/index.vue b/src/views/bpm/processInstance/create/index.vue index 36487dd5..6256e616 100644 --- a/src/views/bpm/processInstance/create/index.vue +++ b/src/views/bpm/processInstance/create/index.vue @@ -1,3 +1,3 @@ diff --git a/src/views/bpm/processInstance/detail/index.vue b/src/views/bpm/processInstance/detail/index.vue index 36487dd5..6256e616 100644 --- a/src/views/bpm/processInstance/detail/index.vue +++ b/src/views/bpm/processInstance/detail/index.vue @@ -1,3 +1,3 @@ diff --git a/src/views/bpm/processInstance/index.vue b/src/views/bpm/processInstance/index.vue index 668489ac..2cb93d3d 100644 --- a/src/views/bpm/processInstance/index.vue +++ b/src/views/bpm/processInstance/index.vue @@ -65,7 +65,7 @@ async function handleCancel(record: Recordable) { }, { icon: IconEnum.DELETE, - color: 'error', + danger: true, label: t('action.cancel'), ifShow: record.result === 1, auth: 'bpm:process-instance:cancel',