refactor(projects): 移动工作流组件位置

This commit is contained in:
xlsea
2025-07-18 11:55:23 +08:00
parent 0dcfc893dd
commit 7ffaac5893
20 changed files with 56 additions and 38 deletions

View File

@ -7,9 +7,9 @@ import { fetchCreateLeave, fetchGetLeaveDetail, fetchStartWorkflow, fetchUpdateL
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
import { useDict } from '@/hooks/business/dict';
import { $t } from '@/locales';
import ApprovalInfoPanel from '@/components/custom/workflow/approval-info-panel.vue';
import FlowTaskApprovalModal from '@/components/custom/workflow/flow-task-approval-modal.vue';
import FlowDrawer from '@/components/custom/workflow/flow-drawer.vue';
import ApprovalInfoPanel from '@/components/workflow/approval-info-panel.vue';
import FlowTaskApprovalModal from '@/components/workflow/flow-task-approval-modal.vue';
import FlowDrawer from '@/components/workflow/flow-drawer.vue';
defineOptions({
name: 'LeaveEdit'

View File

@ -9,8 +9,8 @@ export {}
declare module 'vue' {
export interface GlobalComponents {
AppProvider: typeof import('./../components/common/app-provider.vue')['default']
ApprovalInfoPanel: typeof import('./../components/custom/workflow/approval-info-panel.vue')['default']
BackTaskModal: typeof import('./../components/custom/workflow/back-task-modal.vue')['default']
ApprovalInfoPanel: typeof import('./../components/workflow/approval-info-panel.vue')['default']
BackTaskModal: typeof import('./../components/workflow/back-task-modal.vue')['default']
BetterScroll: typeof import('./../components/custom/better-scroll.vue')['default']
BooleanTag: typeof import('./../components/custom/boolean-tag.vue')['default']
ButtonIcon: typeof import('./../components/custom/button-icon.vue')['default']
@ -24,11 +24,11 @@ declare module 'vue' {
DictTag: typeof import('./../components/custom/dict-tag.vue')['default']
ExceptionBase: typeof import('./../components/common/exception-base.vue')['default']
FileUpload: typeof import('./../components/custom/file-upload.vue')['default']
FlowCategorySelect: typeof import('./../components/custom/workflow/flow-category-select.vue')['default']
FlowDrawer: typeof import('./../components/custom/workflow/flow-drawer.vue')['default']
FlowInterveneModal: typeof import('./../components/custom/workflow/flow-intervene-modal.vue')['default']
FlowPreview: typeof import('./../components/custom/workflow/flow-preview.vue')['default']
FlowTaskApprovalModal: typeof import('./../components/custom/workflow/flow-task-approval-modal.vue')['default']
FlowCategorySelect: typeof import('./../components/workflow/flow-category-select.vue')['default']
FlowDrawer: typeof import('./../components/workflow/flow-drawer.vue')['default']
FlowInterveneModal: typeof import('./../components/workflow/flow-intervene-modal.vue')['default']
FlowPreview: typeof import('./../components/workflow/flow-preview.vue')['default']
FlowTaskApprovalModal: typeof import('./../components/workflow/flow-task-approval-modal.vue')['default']
FormTip: typeof import('./../components/custom/form-tip.vue')['default']
FullScreen: typeof import('./../components/common/full-screen.vue')['default']
GroupTag: typeof import('./../components/custom/group-tag.vue')['default']
@ -66,7 +66,7 @@ declare module 'vue' {
IconUilSearch: typeof import('~icons/uil/search')['default']
JsonPreview: typeof import('./../components/custom/json-preview.vue')['default']
LangSwitch: typeof import('./../components/common/lang-switch.vue')['default']
LeaveEdit: typeof import('./../components/custom/workflow/leave-edit/index.vue')['default']
LeaveEdit: typeof import('./../components/workflow/form/leave-edit/index.vue')['default']
LookForward: typeof import('./../components/custom/look-forward.vue')['default']
MenuToggler: typeof import('./../components/common/menu-toggler.vue')['default']
MenuTree: typeof import('./../components/custom/menu-tree.vue')['default']
@ -145,7 +145,7 @@ declare module 'vue' {
OssUpload: typeof import('./../components/custom/oss-upload.vue')['default']
PinToggler: typeof import('./../components/common/pin-toggler.vue')['default']
PostSelect: typeof import('./../components/custom/post-select.vue')['default']
ReduceSignatureModal: typeof import('./../components/custom/workflow/reduce-signature-modal.vue')['default']
ReduceSignatureModal: typeof import('./../components/workflow/reduce-signature-modal.vue')['default']
ReloadButton: typeof import('./../components/common/reload-button.vue')['default']
RoleSelect: typeof import('./../components/custom/role-select.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']

View File

@ -85,7 +85,8 @@ export async function loadDynamicComponent(
{ delay = 2000, timeout = 3000 } = {}
) {
const suffix = `${humpToLine(formPath)}.vue`;
const matched = Object.entries(modules).find(([path]) => path.endsWith(suffix));
const componentPath = suffix.replace('/workflow', '/workflow/form');
const matched = Object.entries(modules).find(([path]) => path.endsWith(componentPath));
if (!matched) {
window.$message?.error(`组件不存在: ${suffix}`);

View File

@ -12,7 +12,7 @@ import { useDict } from '@/hooks/business/dict';
import { $t } from '@/locales';
import DictTag from '@/components/custom/dict-tag.vue';
import ButtonIcon from '@/components/custom/button-icon.vue';
import LeaveEdit from '@/components/custom/workflow/leave-edit/index.vue';
import LeaveEdit from '@/components/workflow/form/leave-edit/index.vue';
import LeaveSearch from './modules/leave-search.vue';
defineOptions({

View File

@ -1,5 +1,6 @@
<script setup lang="ts">
import { computed, reactive, watch } from 'vue';
import { computed, reactive, ref, watch } from 'vue';
import type { SelectOption } from 'naive-ui';
import { fetchCreateDefinition, fetchUpdateDefinition } from '@/service/api/workflow/definition';
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
import { $t } from '@/locales';
@ -38,6 +39,14 @@ const title = computed(() => {
return titles[props.operateType];
});
const formPaths = ref<SelectOption[]>([]);
const modules = import.meta.glob('@/components/workflow/form/**/*.vue');
Object.keys(modules).forEach(key => {
const label = key.replace('/src/components/workflow/form/', '');
const value = key.replace('/src/components/workflow/form', '/workflow');
formPaths.value.push({ label, value });
});
type Model = Api.Workflow.DefinitionOperateParams;
const model: Model = reactive(createDefaultModel());
@ -47,7 +56,7 @@ function createDefaultModel(): Model {
flowCode: '',
flowName: '',
category: '',
formPath: ''
formPath: undefined
};
}
@ -117,7 +126,13 @@ watch(visible, () => {
<NInput v-model:value="model.flowName" placeholder="请输入流程名称" />
</NFormItem>
<NFormItem label="审批表单路径" path="formPath">
<NInput v-model:value="model.formPath" placeholder="请输入审批表单路径" />
<template #label>
<div class="flex-center">
<FormTip content="需要在 /src/components/workflow/form 路径下创建组件" />
<span class="pl-3px">审批表单路径</span>
</div>
</template>
<NSelect v-model:value="model.formPath" :options="formPaths" placeholder="请选择审批表单路径" />
</NFormItem>
</NForm>
<template #footer>

View File

@ -316,7 +316,7 @@ async function handleShowVariable(id: CommonType.IdType) {
showVariableDrawer();
}
const modules = import.meta.glob('@/components/custom/workflow/**/*.vue');
const modules = import.meta.glob('@/components/workflow/form/**/*.vue');
const businessId = ref<CommonType.IdType>();
/** 流程预览,动态加载组件 */

View File

@ -208,7 +208,7 @@ function handleResetSearch() {
resetSearchParams();
selectedKeys.value = [];
}
const modules = import.meta.glob('@/components/custom/workflow/**/*.vue');
const modules = import.meta.glob('@/components/workflow/**/*.vue');
const businessId = ref<CommonType.IdType>();
async function handleView(row: Api.Workflow.TaskOrHisTask) {

View File

@ -214,7 +214,7 @@ function handleResetSearch() {
resetSearchParams();
selectedKeys.value = [];
}
const modules = import.meta.glob('@/components/custom/workflow/**/*.vue');
const modules = import.meta.glob('@/components/workflow/**/*.vue');
const businessId = ref<CommonType.IdType>();
const operateType = ref<CommonType.WorkflowTableOperateType>();

View File

@ -163,7 +163,7 @@ function handleResetSearch() {
resetSearchParams();
selectedKeys.value = [];
}
const modules = import.meta.glob('@/components/custom/workflow/**/*.vue');
const modules = import.meta.glob('@/components/workflow/**/*.vue');
const businessId = ref<CommonType.IdType>();
const taskId = ref<CommonType.IdType>();

View File

@ -176,7 +176,7 @@ function handleResetSearch() {
resetSearchParams();
selectedKeys.value = [];
}
const modules = import.meta.glob('@/components/custom/workflow/**/*.vue');
const modules = import.meta.glob('@/components/workflow/**/*.vue');
const businessId = ref<CommonType.IdType>();
const taskId = ref<CommonType.IdType>();

View File

@ -157,7 +157,7 @@ function handleResetSearch() {
resetSearchParams();
selectedKeys.value = [];
}
const modules = import.meta.glob('@/components/custom/workflow/**/*.vue');
const modules = import.meta.glob('@/components/workflow/**/*.vue');
const businessId = ref<CommonType.IdType>();
const taskId = ref<CommonType.IdType>();