mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): 新增流程表达式功能
This commit is contained in:
@ -8,13 +8,15 @@ interface Props {
|
|||||||
size?: 'small' | 'medium' | 'large';
|
size?: 'small' | 'medium' | 'large';
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
closable?: boolean;
|
closable?: boolean;
|
||||||
|
threadshold?: number; // 超过该数量显示popover
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
type: 'info',
|
type: 'info',
|
||||||
size: 'small',
|
size: 'small',
|
||||||
placeholder: '无',
|
placeholder: '无',
|
||||||
closable: false
|
closable: false,
|
||||||
|
threadshold: 1 // 默认超过1个就显示popover
|
||||||
});
|
});
|
||||||
|
|
||||||
interface Emits {
|
interface Emits {
|
||||||
@ -41,9 +43,17 @@ function handleClose(index?: number) {
|
|||||||
</NTag>
|
</NTag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-else-if="tags.length === 1">
|
<template v-else-if="tags.length <= threadshold">
|
||||||
<NTag :type="type" :size="size" :closable="closable" @close="handleClose(0)">
|
<NTag
|
||||||
{{ tags[0] }}
|
v-for="(tag, index) in tags"
|
||||||
|
:key="index"
|
||||||
|
:type="type"
|
||||||
|
class="m-1"
|
||||||
|
:size="size"
|
||||||
|
:closable="closable"
|
||||||
|
@close="handleClose(index)"
|
||||||
|
>
|
||||||
|
{{ tag }}
|
||||||
</NTag>
|
</NTag>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -7,7 +7,7 @@ import { fetchGetOssListByIds } from '@/service/api/system/oss';
|
|||||||
import { useDict } from '@/hooks/business/dict';
|
import { useDict } from '@/hooks/business/dict';
|
||||||
import { useDownload } from '@/hooks/business/download';
|
import { useDownload } from '@/hooks/business/download';
|
||||||
import DictTag from '@/components/custom/dict-tag.vue';
|
import DictTag from '@/components/custom/dict-tag.vue';
|
||||||
import GroupTag from '@/components/custom/group-tag.vue';
|
import TagGroup from '@/components/custom/tag-group.vue';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'ApprovalInfoPanel'
|
name: 'ApprovalInfoPanel'
|
||||||
@ -39,7 +39,7 @@ const columns = ref<NaiveUI.TableColumn<Api.Workflow.HisTask>[]>([
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
width: 100,
|
width: 100,
|
||||||
render: row => {
|
render: row => {
|
||||||
return <GroupTag value={row.approveName} />;
|
return <TagGroup value={row.approveName} />;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -164,7 +164,7 @@ watch(visible, () => {
|
|||||||
{{ taskInfo?.instanceId }}
|
{{ taskInfo?.instanceId }}
|
||||||
</NDescriptionsItem>
|
</NDescriptionsItem>
|
||||||
<NDescriptionsItem label="办理人">
|
<NDescriptionsItem label="办理人">
|
||||||
<GroupTag :value="assigneeNames" />
|
<TagGroup :value="assigneeNames" />
|
||||||
</NDescriptionsItem>
|
</NDescriptionsItem>
|
||||||
<NDescriptionsItem label="版本号">
|
<NDescriptionsItem label="版本号">
|
||||||
<NTag type="info" size="small">v{{ taskInfo?.version }}.0</NTag>
|
<NTag type="info" size="small">v{{ taskInfo?.version }}.0</NTag>
|
||||||
|
@ -388,7 +388,7 @@ watch(visible, () => {
|
|||||||
<NFormItem v-if="buttonPerm.copy" label="抄送人员">
|
<NFormItem v-if="buttonPerm.copy" label="抄送人员">
|
||||||
<NSpace>
|
<NSpace>
|
||||||
<NButton ghost type="primary" @click="openCopyModal">选择抄送人员</NButton>
|
<NButton ghost type="primary" @click="openCopyModal">选择抄送人员</NButton>
|
||||||
<GroupTag
|
<TagGroup
|
||||||
size="large"
|
size="large"
|
||||||
:value="selectCopyUserList.map(item => item.nickName)"
|
:value="selectCopyUserList.map(item => item.nickName)"
|
||||||
:closable="true"
|
:closable="true"
|
||||||
@ -407,7 +407,7 @@ watch(visible, () => {
|
|||||||
<NSpace>
|
<NSpace>
|
||||||
<NButton ghost type="primary" @click="handleAssigneeOpen(item)">选择审批人员</NButton>
|
<NButton ghost type="primary" @click="handleAssigneeOpen(item)">选择审批人员</NButton>
|
||||||
<NInput v-if="false" v-model:value="model.assigneeMap![item.nodeCode]" />
|
<NInput v-if="false" v-model:value="model.assigneeMap![item.nodeCode]" />
|
||||||
<GroupTag
|
<TagGroup
|
||||||
size="large"
|
size="large"
|
||||||
:value="nickNameMap[item.nodeCode]"
|
:value="nickNameMap[item.nodeCode]"
|
||||||
:closable="true"
|
:closable="true"
|
||||||
|
@ -238,6 +238,7 @@ const local: App.I18n.Schema = {
|
|||||||
exception_404: '404',
|
exception_404: '404',
|
||||||
exception_500: '500',
|
exception_500: '500',
|
||||||
workflow_design: 'Process Design',
|
workflow_design: 'Process Design',
|
||||||
|
workflow_spel: 'Process Spel',
|
||||||
'workflow_process-definition': 'Process Definition',
|
'workflow_process-definition': 'Process Definition',
|
||||||
'workflow_process-instance': 'Process Instance',
|
'workflow_process-instance': 'Process Instance',
|
||||||
workflow_task: 'Task',
|
workflow_task: 'Task',
|
||||||
|
@ -238,6 +238,7 @@ const local: App.I18n.Schema = {
|
|||||||
exception_404: '404',
|
exception_404: '404',
|
||||||
exception_500: '500',
|
exception_500: '500',
|
||||||
workflow_design: '流程设计',
|
workflow_design: '流程设计',
|
||||||
|
workflow_spel: '流程表达式',
|
||||||
'workflow_process-definition': '流程定义',
|
'workflow_process-definition': '流程定义',
|
||||||
'workflow_process-instance': '流程实例',
|
'workflow_process-instance': '流程实例',
|
||||||
workflow_task: '任务',
|
workflow_task: '任务',
|
||||||
|
@ -48,6 +48,7 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
|
|||||||
workflow_leave: () => import("@/views/workflow/leave/index.vue"),
|
workflow_leave: () => import("@/views/workflow/leave/index.vue"),
|
||||||
"workflow_process-definition": () => import("@/views/workflow/process-definition/index.vue"),
|
"workflow_process-definition": () => import("@/views/workflow/process-definition/index.vue"),
|
||||||
"workflow_process-instance": () => import("@/views/workflow/process-instance/index.vue"),
|
"workflow_process-instance": () => import("@/views/workflow/process-instance/index.vue"),
|
||||||
|
workflow_spel: () => import("@/views/workflow/spel/index.vue"),
|
||||||
"workflow_task_all-task-waiting": () => import("@/views/workflow/task/all-task-waiting/index.vue"),
|
"workflow_task_all-task-waiting": () => import("@/views/workflow/task/all-task-waiting/index.vue"),
|
||||||
"workflow_task_my-document": () => import("@/views/workflow/task/my-document/index.vue"),
|
"workflow_task_my-document": () => import("@/views/workflow/task/my-document/index.vue"),
|
||||||
"workflow_task_task-copy": () => import("@/views/workflow/task/task-copy/index.vue"),
|
"workflow_task_task-copy": () => import("@/views/workflow/task/task-copy/index.vue"),
|
||||||
|
@ -386,6 +386,15 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
i18nKey: 'route.workflow_process-instance'
|
i18nKey: 'route.workflow_process-instance'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'workflow_spel',
|
||||||
|
path: '/workflow/spel',
|
||||||
|
component: 'view.workflow_spel',
|
||||||
|
meta: {
|
||||||
|
title: 'workflow_spel',
|
||||||
|
i18nKey: 'route.workflow_spel'
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'workflow_task',
|
name: 'workflow_task',
|
||||||
path: '/workflow/task',
|
path: '/workflow/task',
|
||||||
|
@ -205,6 +205,7 @@ const routeMap: RouteMap = {
|
|||||||
"workflow_leave": "/workflow/leave",
|
"workflow_leave": "/workflow/leave",
|
||||||
"workflow_process-definition": "/workflow/process-definition",
|
"workflow_process-definition": "/workflow/process-definition",
|
||||||
"workflow_process-instance": "/workflow/process-instance",
|
"workflow_process-instance": "/workflow/process-instance",
|
||||||
|
"workflow_spel": "/workflow/spel",
|
||||||
"workflow_task": "/workflow/task",
|
"workflow_task": "/workflow/task",
|
||||||
"workflow_task_all-task-waiting": "/workflow/task/all-task-waiting",
|
"workflow_task_all-task-waiting": "/workflow/task/all-task-waiting",
|
||||||
"workflow_task_my-document": "/workflow/task/my-document",
|
"workflow_task_my-document": "/workflow/task/my-document",
|
||||||
|
36
src/service/api/workflow/spel.ts
Normal file
36
src/service/api/workflow/spel.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import { request } from '@/service/request';
|
||||||
|
|
||||||
|
/** 获取流程spel达式定义列表 */
|
||||||
|
export function fetchGetSpelList(params?: Api.Workflow.SpelSearchParams) {
|
||||||
|
return request<Api.Workflow.SpelList>({
|
||||||
|
url: '/workflow/spel/list',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增流程spel达式定义 */
|
||||||
|
export function fetchCreateSpel(data: Api.Workflow.SpelOperateParams) {
|
||||||
|
return request<boolean>({
|
||||||
|
url: '/workflow/spel',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改流程spel达式定义 */
|
||||||
|
export function fetchUpdateSpel(data: Api.Workflow.SpelOperateParams) {
|
||||||
|
return request<boolean>({
|
||||||
|
url: '/workflow/spel',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 批量删除流程spel达式定义 */
|
||||||
|
export function fetchBatchDeleteSpel(ids: CommonType.IdType[]) {
|
||||||
|
return request<boolean>({
|
||||||
|
url: `/workflow/spel/${ids.join(',')}`,
|
||||||
|
method: 'delete'
|
||||||
|
});
|
||||||
|
}
|
33
src/typings/api/workflow.api.d.ts
vendored
33
src/typings/api/workflow.api.d.ts
vendored
@ -86,6 +86,39 @@ declare namespace Api {
|
|||||||
/** 工作流分类列表 */
|
/** 工作流分类列表 */
|
||||||
type WorkflowCategoryList = WorkflowCategory[];
|
type WorkflowCategoryList = WorkflowCategory[];
|
||||||
|
|
||||||
|
/** spel */
|
||||||
|
type Spel = Common.CommonRecord<{
|
||||||
|
/** 主键id */
|
||||||
|
id: CommonType.IdType;
|
||||||
|
/** 组件名称 */
|
||||||
|
componentName: string;
|
||||||
|
/** 方法名 */
|
||||||
|
methodName: string;
|
||||||
|
/** 参数 */
|
||||||
|
methodParams: string;
|
||||||
|
/** spel表达式 */
|
||||||
|
viewSpel: string;
|
||||||
|
/** 备注 */
|
||||||
|
remark: string;
|
||||||
|
/** 状态 */
|
||||||
|
status: string;
|
||||||
|
/** 删除标志 */
|
||||||
|
delFlag: string;
|
||||||
|
}>;
|
||||||
|
|
||||||
|
/** spel search params */
|
||||||
|
type SpelSearchParams = CommonType.RecordNullable<
|
||||||
|
Pick<Api.Workflow.Spel, 'componentName' | 'methodName' | 'status'> & Api.Common.CommonSearchParams
|
||||||
|
>;
|
||||||
|
|
||||||
|
/** spel operate params */
|
||||||
|
type SpelOperateParams = CommonType.RecordNullable<
|
||||||
|
Pick<Api.Workflow.Spel, 'id' | 'componentName' | 'methodName' | 'methodParams' | 'viewSpel' | 'remark' | 'status'>
|
||||||
|
>;
|
||||||
|
|
||||||
|
/** spel list */
|
||||||
|
type SpelList = Api.Common.PaginatingQueryRecord<Spel>;
|
||||||
|
|
||||||
/** 工作流发布状态 */
|
/** 工作流发布状态 */
|
||||||
type WorkflowPublishStatus = 0 | 1 | 9;
|
type WorkflowPublishStatus = 0 | 1 | 9;
|
||||||
|
|
||||||
|
3
src/typings/components.d.ts
vendored
3
src/typings/components.d.ts
vendored
@ -31,7 +31,6 @@ declare module 'vue' {
|
|||||||
FlowTaskApprovalModal: typeof import('./../components/workflow/flow-task-approval-modal.vue')['default']
|
FlowTaskApprovalModal: typeof import('./../components/workflow/flow-task-approval-modal.vue')['default']
|
||||||
FormTip: typeof import('./../components/custom/form-tip.vue')['default']
|
FormTip: typeof import('./../components/custom/form-tip.vue')['default']
|
||||||
FullScreen: typeof import('./../components/common/full-screen.vue')['default']
|
FullScreen: typeof import('./../components/common/full-screen.vue')['default']
|
||||||
GroupTag: typeof import('./../components/custom/group-tag.vue')['default']
|
|
||||||
IconAntDesignEnterOutlined: typeof import('~icons/ant-design/enter-outlined')['default']
|
IconAntDesignEnterOutlined: typeof import('~icons/ant-design/enter-outlined')['default']
|
||||||
IconAntDesignReloadOutlined: typeof import('~icons/ant-design/reload-outlined')['default']
|
IconAntDesignReloadOutlined: typeof import('~icons/ant-design/reload-outlined')['default']
|
||||||
IconAntDesignSettingOutlined: typeof import('~icons/ant-design/setting-outlined')['default']
|
IconAntDesignSettingOutlined: typeof import('~icons/ant-design/setting-outlined')['default']
|
||||||
@ -96,6 +95,7 @@ declare module 'vue' {
|
|||||||
NDrawerContent: typeof import('naive-ui')['NDrawerContent']
|
NDrawerContent: typeof import('naive-ui')['NDrawerContent']
|
||||||
NDropdown: typeof import('naive-ui')['NDropdown']
|
NDropdown: typeof import('naive-ui')['NDropdown']
|
||||||
NDynamicInput: typeof import('naive-ui')['NDynamicInput']
|
NDynamicInput: typeof import('naive-ui')['NDynamicInput']
|
||||||
|
NDynamicTags: typeof import('naive-ui')['NDynamicTags']
|
||||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||||
NEmpty: typeof import('naive-ui')['NEmpty']
|
NEmpty: typeof import('naive-ui')['NEmpty']
|
||||||
NForm: typeof import('naive-ui')['NForm']
|
NForm: typeof import('naive-ui')['NForm']
|
||||||
@ -158,6 +158,7 @@ declare module 'vue' {
|
|||||||
TableHeaderOperation: typeof import('./../components/advanced/table-header-operation.vue')['default']
|
TableHeaderOperation: typeof import('./../components/advanced/table-header-operation.vue')['default']
|
||||||
TableRowCheckAlert: typeof import('./../components/advanced/table-row-check-alert.vue')['default']
|
TableRowCheckAlert: typeof import('./../components/advanced/table-row-check-alert.vue')['default']
|
||||||
TableSiderLayout: typeof import('./../components/advanced/table-sider-layout.vue')['default']
|
TableSiderLayout: typeof import('./../components/advanced/table-sider-layout.vue')['default']
|
||||||
|
TagGroup: typeof import('./../components/custom/tag-group.vue')['default']
|
||||||
TenantSelect: typeof import('./../components/custom/tenant-select.vue')['default']
|
TenantSelect: typeof import('./../components/custom/tenant-select.vue')['default']
|
||||||
ThemeSchemaSwitch: typeof import('./../components/common/theme-schema-switch.vue')['default']
|
ThemeSchemaSwitch: typeof import('./../components/common/theme-schema-switch.vue')['default']
|
||||||
TinymceEditor: typeof import('./../components/custom/tinymce-editor.vue')['default']
|
TinymceEditor: typeof import('./../components/custom/tinymce-editor.vue')['default']
|
||||||
|
2
src/typings/elegant-router.d.ts
vendored
2
src/typings/elegant-router.d.ts
vendored
@ -59,6 +59,7 @@ declare module "@elegant-router/types" {
|
|||||||
"workflow_leave": "/workflow/leave";
|
"workflow_leave": "/workflow/leave";
|
||||||
"workflow_process-definition": "/workflow/process-definition";
|
"workflow_process-definition": "/workflow/process-definition";
|
||||||
"workflow_process-instance": "/workflow/process-instance";
|
"workflow_process-instance": "/workflow/process-instance";
|
||||||
|
"workflow_spel": "/workflow/spel";
|
||||||
"workflow_task": "/workflow/task";
|
"workflow_task": "/workflow/task";
|
||||||
"workflow_task_all-task-waiting": "/workflow/task/all-task-waiting";
|
"workflow_task_all-task-waiting": "/workflow/task/all-task-waiting";
|
||||||
"workflow_task_my-document": "/workflow/task/my-document";
|
"workflow_task_my-document": "/workflow/task/my-document";
|
||||||
@ -163,6 +164,7 @@ declare module "@elegant-router/types" {
|
|||||||
| "workflow_leave"
|
| "workflow_leave"
|
||||||
| "workflow_process-definition"
|
| "workflow_process-definition"
|
||||||
| "workflow_process-instance"
|
| "workflow_process-instance"
|
||||||
|
| "workflow_spel"
|
||||||
| "workflow_task_all-task-waiting"
|
| "workflow_task_all-task-waiting"
|
||||||
| "workflow_task_my-document"
|
| "workflow_task_my-document"
|
||||||
| "workflow_task_task-copy"
|
| "workflow_task_task-copy"
|
||||||
|
221
src/views/workflow/spel/index.vue
Normal file
221
src/views/workflow/spel/index.vue
Normal file
@ -0,0 +1,221 @@
|
|||||||
|
<script setup lang="tsx">
|
||||||
|
import { NDivider } from 'naive-ui';
|
||||||
|
import { fetchBatchDeleteSpel, fetchGetSpelList } from '@/service/api/workflow/spel';
|
||||||
|
import { useAppStore } from '@/store/modules/app';
|
||||||
|
import { useAuth } from '@/hooks/business/auth';
|
||||||
|
import { useDownload } from '@/hooks/business/download';
|
||||||
|
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||||
|
import { $t } from '@/locales';
|
||||||
|
import ButtonIcon from '@/components/custom/button-icon.vue';
|
||||||
|
import DictTag from '@/components/custom/dict-tag.vue';
|
||||||
|
import TagGroup from '@/components/custom/tag-group.vue';
|
||||||
|
import SpelOperateDrawer from './modules/spel-operate-drawer.vue';
|
||||||
|
import SpelSearch from './modules/spel-search.vue';
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'SpelList'
|
||||||
|
});
|
||||||
|
|
||||||
|
const appStore = useAppStore();
|
||||||
|
const { download } = useDownload();
|
||||||
|
const { hasAuth } = useAuth();
|
||||||
|
const {
|
||||||
|
columns,
|
||||||
|
columnChecks,
|
||||||
|
data,
|
||||||
|
getData,
|
||||||
|
getDataByPage,
|
||||||
|
loading,
|
||||||
|
mobilePagination,
|
||||||
|
searchParams,
|
||||||
|
resetSearchParams
|
||||||
|
} = useTable({
|
||||||
|
apiFn: fetchGetSpelList,
|
||||||
|
apiParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
// if you want to use the searchParams in Form, you need to define the following properties, and the value is null
|
||||||
|
// the value can not be undefined, otherwise the property in Form will not be reactive
|
||||||
|
componentName: null,
|
||||||
|
methodName: null,
|
||||||
|
status: null,
|
||||||
|
params: {}
|
||||||
|
},
|
||||||
|
columns: () => [
|
||||||
|
{
|
||||||
|
type: 'selection',
|
||||||
|
align: 'center',
|
||||||
|
width: 48
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'index',
|
||||||
|
title: $t('common.index'),
|
||||||
|
align: 'center',
|
||||||
|
width: 64
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'componentName',
|
||||||
|
title: '组件名称',
|
||||||
|
align: 'center',
|
||||||
|
minWidth: 120
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'methodName',
|
||||||
|
title: '方法名',
|
||||||
|
align: 'center',
|
||||||
|
minWidth: 120
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'methodParams',
|
||||||
|
title: '参数',
|
||||||
|
align: 'center',
|
||||||
|
minWidth: 120,
|
||||||
|
render: row => {
|
||||||
|
return <TagGroup threadshold={4} value={row.methodParams} />;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'viewSpel',
|
||||||
|
title: 'spel表达式',
|
||||||
|
align: 'center',
|
||||||
|
minWidth: 120
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'remark',
|
||||||
|
title: '备注',
|
||||||
|
align: 'center',
|
||||||
|
minWidth: 120
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'status',
|
||||||
|
title: '状态',
|
||||||
|
align: 'center',
|
||||||
|
minWidth: 120,
|
||||||
|
render: row => {
|
||||||
|
return <DictTag size="small" value={row.status} dict-code="sys_normal_disable" />;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'operate',
|
||||||
|
title: $t('common.operate'),
|
||||||
|
align: 'center',
|
||||||
|
width: 130,
|
||||||
|
render: row => {
|
||||||
|
const divider = () => {
|
||||||
|
if (!hasAuth('workflow:spel:edit') || !hasAuth('workflow:spel:remove')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return <NDivider vertical />;
|
||||||
|
};
|
||||||
|
|
||||||
|
const editBtn = () => {
|
||||||
|
if (!hasAuth('workflow:spel:edit')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<ButtonIcon
|
||||||
|
text
|
||||||
|
type="primary"
|
||||||
|
icon="material-symbols:drive-file-rename-outline-outline"
|
||||||
|
tooltipContent={$t('common.edit')}
|
||||||
|
onClick={() => edit(row.id!)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const deleteBtn = () => {
|
||||||
|
if (!hasAuth('workflow:spel:remove')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<ButtonIcon
|
||||||
|
text
|
||||||
|
type="error"
|
||||||
|
icon="material-symbols:delete-outline"
|
||||||
|
tooltipContent={$t('common.delete')}
|
||||||
|
popconfirmContent={$t('common.confirmDelete')}
|
||||||
|
onPositiveClick={() => handleDelete(row.id!)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div class="flex-center gap-8px">
|
||||||
|
{editBtn()}
|
||||||
|
{divider()}
|
||||||
|
{deleteBtn()}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const { drawerVisible, operateType, editingData, handleAdd, handleEdit, checkedRowKeys, onBatchDeleted, onDeleted } =
|
||||||
|
useTableOperate(data, getData);
|
||||||
|
|
||||||
|
async function handleBatchDelete() {
|
||||||
|
// request
|
||||||
|
const { error } = await fetchBatchDeleteSpel(checkedRowKeys.value);
|
||||||
|
if (error) return;
|
||||||
|
onBatchDeleted();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDelete(id: CommonType.IdType) {
|
||||||
|
// request
|
||||||
|
const { error } = await fetchBatchDeleteSpel([id]);
|
||||||
|
if (error) return;
|
||||||
|
onDeleted();
|
||||||
|
}
|
||||||
|
|
||||||
|
function edit(id: CommonType.IdType) {
|
||||||
|
handleEdit('id', id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleExport() {
|
||||||
|
download('/workflow/spel/export', searchParams, `流程spel达式定义_${new Date().getTime()}.xlsx`);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
|
||||||
|
<SpelSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getDataByPage" />
|
||||||
|
<NCard title="流程表达式列表" :bordered="false" size="small" class="card-wrapper sm:flex-1-hidden">
|
||||||
|
<template #header-extra>
|
||||||
|
<TableHeaderOperation
|
||||||
|
v-model:columns="columnChecks"
|
||||||
|
:disabled-delete="checkedRowKeys.length === 0"
|
||||||
|
:loading="loading"
|
||||||
|
:show-add="hasAuth('workflow:spel:add')"
|
||||||
|
:show-delete="hasAuth('workflow:spel:remove')"
|
||||||
|
:show-export="hasAuth('workflow:spel:export')"
|
||||||
|
@add="handleAdd"
|
||||||
|
@delete="handleBatchDelete"
|
||||||
|
@export="handleExport"
|
||||||
|
@refresh="getData"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<NDataTable
|
||||||
|
v-model:checked-row-keys="checkedRowKeys"
|
||||||
|
:columns="columns"
|
||||||
|
:data="data"
|
||||||
|
size="small"
|
||||||
|
:flex-height="!appStore.isMobile"
|
||||||
|
:scroll-x="962"
|
||||||
|
:loading="loading"
|
||||||
|
remote
|
||||||
|
:row-key="row => row.id"
|
||||||
|
:pagination="mobilePagination"
|
||||||
|
class="sm:h-full"
|
||||||
|
/>
|
||||||
|
<SpelOperateDrawer
|
||||||
|
v-model:visible="drawerVisible"
|
||||||
|
:operate-type="operateType"
|
||||||
|
:row-data="editingData"
|
||||||
|
@submitted="getDataByPage"
|
||||||
|
/>
|
||||||
|
</NCard>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
179
src/views/workflow/spel/modules/spel-operate-drawer.vue
Normal file
179
src/views/workflow/spel/modules/spel-operate-drawer.vue
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, reactive, ref, watch } from 'vue';
|
||||||
|
import { fetchCreateSpel, fetchUpdateSpel } from '@/service/api/workflow/spel';
|
||||||
|
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
|
||||||
|
import { useDict } from '@/hooks/business/dict';
|
||||||
|
import { $t } from '@/locales';
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'SpelOperateDrawer'
|
||||||
|
});
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
/** the type of operation */
|
||||||
|
operateType: NaiveUI.TableOperateType;
|
||||||
|
/** the edit row data */
|
||||||
|
rowData?: Api.Workflow.Spel | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps<Props>();
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: 'submitted'): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
|
||||||
|
const visible = defineModel<boolean>('visible', {
|
||||||
|
default: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const { options: sysNormalDisableOptions } = useDict('sys_normal_disable');
|
||||||
|
|
||||||
|
const { formRef, validate, restoreValidation } = useNaiveForm();
|
||||||
|
const { createRequiredRule } = useFormRules();
|
||||||
|
|
||||||
|
const title = computed(() => {
|
||||||
|
const titles: Record<NaiveUI.TableOperateType, string> = {
|
||||||
|
add: '新增流程表达式',
|
||||||
|
edit: '编辑流程表达式'
|
||||||
|
};
|
||||||
|
return titles[props.operateType];
|
||||||
|
});
|
||||||
|
|
||||||
|
// 参数标签
|
||||||
|
const methodParamTags = ref<string[]>([]);
|
||||||
|
|
||||||
|
type Model = Api.Workflow.SpelOperateParams;
|
||||||
|
|
||||||
|
const model: Model = reactive(createDefaultModel());
|
||||||
|
|
||||||
|
function createDefaultModel(): Model {
|
||||||
|
return {
|
||||||
|
componentName: '',
|
||||||
|
methodName: '',
|
||||||
|
methodParams: '',
|
||||||
|
viewSpel: '',
|
||||||
|
remark: '',
|
||||||
|
status: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
type RuleKey = Extract<keyof Model, 'id'>;
|
||||||
|
|
||||||
|
const rules: Record<RuleKey, App.Global.FormRule> = {
|
||||||
|
id: createRequiredRule('主键id不能为空')
|
||||||
|
};
|
||||||
|
|
||||||
|
function handleUpdateModelWhenEdit() {
|
||||||
|
if (props.operateType === 'add') {
|
||||||
|
Object.assign(model, createDefaultModel());
|
||||||
|
methodParamTags.value = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.operateType === 'edit' && props.rowData) {
|
||||||
|
Object.assign(model, props.rowData);
|
||||||
|
// 如果有参数,将逗号分隔的字符串转为数组
|
||||||
|
methodParamTags.value = model.methodParams ? model.methodParams.split(',') : [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 实时更新 SPEL 表达式
|
||||||
|
function updateSpelExpression() {
|
||||||
|
if (!model.componentName || !model.methodName) {
|
||||||
|
model.viewSpel = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建参数部分
|
||||||
|
const params = methodParamTags.value.map(param => `#${param}`).join(',');
|
||||||
|
|
||||||
|
// 生成 SPEL 表达式: #{@组件名.方法名(#参数1,#参数2,...)}
|
||||||
|
model.viewSpel = `#{@${model.componentName}.${model.methodName}(${params})}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听组件名、方法名和参数变化
|
||||||
|
watch(() => model.componentName, updateSpelExpression);
|
||||||
|
watch(() => model.methodName, updateSpelExpression);
|
||||||
|
watch(methodParamTags, updateSpelExpression, { deep: true });
|
||||||
|
|
||||||
|
function closeDrawer() {
|
||||||
|
visible.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleSubmit() {
|
||||||
|
await validate();
|
||||||
|
|
||||||
|
// 将参数标签数组转为逗号分隔的字符串
|
||||||
|
model.methodParams = methodParamTags.value.join(',');
|
||||||
|
|
||||||
|
const { id, componentName, methodName, methodParams, viewSpel, remark, status } = model;
|
||||||
|
|
||||||
|
// request
|
||||||
|
if (props.operateType === 'add') {
|
||||||
|
const { error } = await fetchCreateSpel({ componentName, methodName, methodParams, viewSpel, remark, status });
|
||||||
|
if (error) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.operateType === 'edit') {
|
||||||
|
const { error } = await fetchUpdateSpel({ id, componentName, methodName, methodParams, viewSpel, remark, status });
|
||||||
|
if (error) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.$message?.success($t('common.updateSuccess'));
|
||||||
|
closeDrawer();
|
||||||
|
emit('submitted');
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(visible, () => {
|
||||||
|
if (visible.value) {
|
||||||
|
handleUpdateModelWhenEdit();
|
||||||
|
restoreValidation();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<NDrawer v-model:show="visible" :title="title" display-directive="show" :width="800" class="max-w-90%">
|
||||||
|
<NDrawerContent :title="title" :native-scrollbar="false" closable>
|
||||||
|
<NForm ref="formRef" :model="model" :rules="rules">
|
||||||
|
<NFormItem label="组件名称" path="componentName">
|
||||||
|
<NInput v-model:value="model.componentName" placeholder="请输入组件名称" />
|
||||||
|
</NFormItem>
|
||||||
|
<NFormItem label="方法名" path="methodName">
|
||||||
|
<NInput v-model:value="model.methodName" placeholder="请输入方法名" />
|
||||||
|
</NFormItem>
|
||||||
|
<NFormItem label="参数" path="methodParams">
|
||||||
|
<NDynamicTags v-model:value="methodParamTags" placeholder="请输入参数后回车" />
|
||||||
|
</NFormItem>
|
||||||
|
<NFormItem label="spel表达式" path="viewSpel">
|
||||||
|
<NInput v-model:value="model.viewSpel" placeholder="自动生成的spel表达式" disabled />
|
||||||
|
</NFormItem>
|
||||||
|
<NFormItem label="备注" path="remark">
|
||||||
|
<NInput v-model:value="model.remark" placeholder="请输入备注" />
|
||||||
|
</NFormItem>
|
||||||
|
<NFormItem label="状态" path="status">
|
||||||
|
<NRadioGroup v-model:value="model.status">
|
||||||
|
<NSpace>
|
||||||
|
<NRadio
|
||||||
|
v-for="option in sysNormalDisableOptions"
|
||||||
|
:key="option.value"
|
||||||
|
:value="option.value"
|
||||||
|
:label="option.label"
|
||||||
|
/>
|
||||||
|
</NSpace>
|
||||||
|
</NRadioGroup>
|
||||||
|
</NFormItem>
|
||||||
|
</NForm>
|
||||||
|
<template #footer>
|
||||||
|
<NSpace :size="16">
|
||||||
|
<NButton @click="closeDrawer">{{ $t('common.cancel') }}</NButton>
|
||||||
|
<NButton type="primary" @click="handleSubmit">{{ $t('common.confirm') }}</NButton>
|
||||||
|
</NSpace>
|
||||||
|
</template>
|
||||||
|
</NDrawerContent>
|
||||||
|
</NDrawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
77
src/views/workflow/spel/modules/spel-search.vue
Normal file
77
src/views/workflow/spel/modules/spel-search.vue
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { useNaiveForm } from '@/hooks/common/form';
|
||||||
|
import { useDict } from '@/hooks/business/dict';
|
||||||
|
import { $t } from '@/locales';
|
||||||
|
defineOptions({
|
||||||
|
name: 'SpelSearch'
|
||||||
|
});
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: 'reset'): void;
|
||||||
|
(e: 'search'): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
|
||||||
|
const { formRef, validate, restoreValidation } = useNaiveForm();
|
||||||
|
|
||||||
|
const model = defineModel<Api.Workflow.SpelSearchParams>('model', { required: true });
|
||||||
|
|
||||||
|
const { options: sysNormalDisableOptions } = useDict('sys_normal_disable', false);
|
||||||
|
|
||||||
|
async function reset() {
|
||||||
|
Object.assign(model.value.params!, {});
|
||||||
|
await restoreValidation();
|
||||||
|
emit('reset');
|
||||||
|
}
|
||||||
|
|
||||||
|
async function search() {
|
||||||
|
await validate();
|
||||||
|
emit('search');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<NCard :bordered="false" size="small" class="card-wrapper">
|
||||||
|
<NCollapse>
|
||||||
|
<NCollapseItem :title="$t('common.search')" name="user-search">
|
||||||
|
<NForm ref="formRef" :model="model" label-placement="left" :label-width="80">
|
||||||
|
<NGrid responsive="screen" item-responsive>
|
||||||
|
<NFormItemGi span="24 s:12 m:6" label="组件名称" path="componentName" class="pr-24px">
|
||||||
|
<NInput v-model:value="model.componentName" placeholder="请输入组件名称" />
|
||||||
|
</NFormItemGi>
|
||||||
|
<NFormItemGi span="24 s:12 m:6" label="方法名" path="methodName" class="pr-24px">
|
||||||
|
<NInput v-model:value="model.methodName" placeholder="请输入方法名" />
|
||||||
|
</NFormItemGi>
|
||||||
|
<NFormItemGi span="24 s:12 m:6" label="状态" path="status" class="pr-24px">
|
||||||
|
<NSelect
|
||||||
|
v-model:value="model.status"
|
||||||
|
placeholder="请选择状态"
|
||||||
|
:options="sysNormalDisableOptions"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</NFormItemGi>
|
||||||
|
<NFormItemGi span="24 s:12 m:6" class="pr-24px">
|
||||||
|
<NSpace class="w-full" justify="end">
|
||||||
|
<NButton @click="reset">
|
||||||
|
<template #icon>
|
||||||
|
<icon-ic-round-refresh class="text-icon" />
|
||||||
|
</template>
|
||||||
|
{{ $t('common.reset') }}
|
||||||
|
</NButton>
|
||||||
|
<NButton type="primary" ghost @click="search">
|
||||||
|
<template #icon>
|
||||||
|
<icon-ic-round-search class="text-icon" />
|
||||||
|
</template>
|
||||||
|
{{ $t('common.search') }}
|
||||||
|
</NButton>
|
||||||
|
</NSpace>
|
||||||
|
</NFormItemGi>
|
||||||
|
</NGrid>
|
||||||
|
</NForm>
|
||||||
|
</NCollapseItem>
|
||||||
|
</NCollapse>
|
||||||
|
</NCard>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
@ -8,7 +8,7 @@ import { useAppStore } from '@/store/modules/app';
|
|||||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||||
import { useDict } from '@/hooks/business/dict';
|
import { useDict } from '@/hooks/business/dict';
|
||||||
import { loadDynamicComponent } from '@/utils/common';
|
import { loadDynamicComponent } from '@/utils/common';
|
||||||
import GroupTag from '@/components/custom/group-tag.vue';
|
import TagGroup from '@/components/custom/tag-group.vue';
|
||||||
import DictTag from '@/components/custom/dict-tag.vue';
|
import DictTag from '@/components/custom/dict-tag.vue';
|
||||||
import ButtonIcon from '@/components/custom/button-icon.vue';
|
import ButtonIcon from '@/components/custom/button-icon.vue';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
@ -72,7 +72,7 @@ const waitingColumns = ref<NaiveUI.TableColumn<Api.Workflow.Task>[]>([
|
|||||||
title: '办理人',
|
title: '办理人',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 120,
|
width: 120,
|
||||||
render: row => <GroupTag value={row.assigneeNames} />
|
render: row => <TagGroup value={row.assigneeNames} />
|
||||||
},
|
},
|
||||||
{ key: 'createTime', title: '创建时间', align: 'center', width: 120 }
|
{ key: 'createTime', title: '创建时间', align: 'center', width: 120 }
|
||||||
]);
|
]);
|
||||||
|
@ -8,7 +8,7 @@ import { useAppStore } from '@/store/modules/app';
|
|||||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||||
import { useDict } from '@/hooks/business/dict';
|
import { useDict } from '@/hooks/business/dict';
|
||||||
import { loadDynamicComponent } from '@/utils/common';
|
import { loadDynamicComponent } from '@/utils/common';
|
||||||
import GroupTag from '@/components/custom/group-tag.vue';
|
import TagGroup from '@/components/custom/tag-group.vue';
|
||||||
import DictTag from '@/components/custom/dict-tag.vue';
|
import DictTag from '@/components/custom/dict-tag.vue';
|
||||||
import ButtonIcon from '@/components/custom/button-icon.vue';
|
import ButtonIcon from '@/components/custom/button-icon.vue';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
@ -89,7 +89,7 @@ const {
|
|||||||
key: 'assigneeNames',
|
key: 'assigneeNames',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 100,
|
width: 100,
|
||||||
render: row => <GroupTag value={row.assigneeNames} />
|
render: row => <TagGroup value={row.assigneeNames} />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '流程状态',
|
title: '流程状态',
|
||||||
|
Reference in New Issue
Block a user