style: lint auto-fix formatting

This commit is contained in:
向宁 2026-05-25 20:36:16 +08:00
parent 7d941bafe6
commit bb97af32e7
15 changed files with 110 additions and 88 deletions

View File

@ -27,9 +27,9 @@ import {
Spin,
} from 'ant-design-vue';
import { createGroupApi } from '#/api';
import { uploadFileApi } from '#/api/core/file-management';
import { fileRequestClient } from '#/api/request';
import { createGroupApi } from '#/api';
import { useImStore } from '#/store';
const InputSearch = Input.Search;
@ -741,7 +741,7 @@ onUnmounted(() => {
placeholder="输入消息... (Shift+Enter 换行)"
:rows="1"
@keydown.enter="handleSend"
/>
></textarea>
<Button
type="primary"
:loading="sending || uploading"

View File

@ -1,12 +1,12 @@
<script lang="ts" setup>
import type { SchemaField } from '../composables/useFormSchema';
import { computed } from 'vue';
import { Descriptions, DescriptionsItem, Tag } from 'ant-design-vue';
import type { SchemaField } from '../composables/useFormSchema';
const props = defineProps<{
dataJson: string | null;
dataJson: null | string;
fields: SchemaField[];
}>();

View File

@ -1,10 +1,10 @@
<script lang="ts" setup>
import type { SchemaField } from '../composables/useFormSchema';
import { reactive } from 'vue';
import { DatePicker, Form, Input, InputNumber, Select } from 'ant-design-vue';
import type { SchemaField } from '../composables/useFormSchema';
const props = defineProps<{
fields: SchemaField[];
}>();

View File

@ -1,4 +1,9 @@
<script lang="ts" setup>
import type { SchemaField } from '../composables/useFormSchema';
import type { FormDefinitionDto } from '#/api/core/form-management';
import type { WorkflowDefinitionDto } from '#/api/core/workflow';
import { h, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
@ -19,7 +24,6 @@ import {
} from 'ant-design-vue';
import { getFormDefinitionsApi } from '#/api/core/form-management';
import type { FormDefinitionDto } from '#/api/core/form-management';
import {
createWorkflowDefinitionApi,
DefinitionStatus,
@ -30,11 +34,9 @@ import {
startWorkflowInstanceApi,
updateWorkflowDefinitionApi,
} from '#/api/core/workflow';
import type { WorkflowDefinitionDto } from '#/api/core/workflow';
import SchemaFormRenderer from '../components/SchemaFormRenderer.vue';
import { parseFormSchema } from '../composables/useFormSchema';
import type { SchemaField } from '../composables/useFormSchema';
const router = useRouter();
@ -460,7 +462,7 @@ onMounted(() => {
<Form.Item label="流程变量JSON">
<Input.TextArea
v-model:value="startFormState.variables"
placeholder='可选,例如:{"reason": "出差申请", "amount": 5000}'
placeholder="可选,例如:{&quot;reason&quot;: &quot;出差申请&quot;, &quot;amount&quot;: 5000}"
:rows="4"
/>
</Form.Item>

View File

@ -12,13 +12,28 @@ import {
Selection,
Snapline,
} from '@antv/x6';
import { register, getTeleport } from '@antv/x6-vue-shape';
import { getTeleport, register } from '@antv/x6-vue-shape';
import { message } from 'ant-design-vue';
import { EdgeType, NodeType, createEdgeApi, updateNodeApi } from '#/api/core';
import { createEdgeApi, EdgeType, NodeType, updateNodeApi } from '#/api/core';
import WorkflowNodeVue from './WorkflowNode.vue';
const props = defineProps<{
definitionId: string;
edges: WorkflowEdgeDto[];
nodes: WorkflowNodeDto[];
}>();
const emit = defineEmits<{
canvasClick: [];
edgeClick: [edgeId: string];
edgeConnected: [edge: WorkflowEdgeDto];
nodeClick: [nodeId: string];
nodeCreated: [];
nodeMoved: [nodeId: string, x: number, y: number];
}>();
const TeleportContainer = getTeleport();
register({
@ -56,21 +71,6 @@ register({
},
});
const props = defineProps<{
definitionId: string;
edges: WorkflowEdgeDto[];
nodes: WorkflowNodeDto[];
}>();
const emit = defineEmits<{
canvasClick: [];
edgeClick: [edgeId: string];
edgeConnected: [edge: WorkflowEdgeDto];
nodeClick: [nodeId: string];
nodeCreated: [];
nodeMoved: [nodeId: string, x: number, y: number];
}>();
const containerRef = ref<HTMLDivElement>();
const minimapRef = ref<HTMLDivElement>();
let graph: Graph | null = null;
@ -345,7 +345,7 @@ function bindEvents() {
graph.bindKey(['delete', 'backspace'], () => {
const cells = graph?.getSelectedCells();
if (cells.length) {
if (cells.length > 0) {
cells.forEach((cell) => cell.remove());
}
return false;

View File

@ -1,4 +1,6 @@
<script lang="ts" setup>
import type { UserListItem, WorkflowNodeDto } from '#/api/core';
import { computed, onMounted, ref, watch } from 'vue';
import {
@ -10,11 +12,14 @@ import {
Popconfirm,
Radio,
Select,
Tag,
} from 'ant-design-vue';
import { deleteNodeApi, getUsersApi, NodeType, updateNodeApi } from '#/api/core';
import type { UserListItem, WorkflowNodeDto } from '#/api/core';
import {
deleteNodeApi,
getUsersApi,
NodeType,
updateNodeApi,
} from '#/api/core';
const props = defineProps<{
definitionId: string;
@ -32,7 +37,7 @@ const name = ref('');
const assigneeRule = ref<'role' | 'user'>('role');
const assigneeRole = ref('');
const assigneeUserId = ref('');
const approvalType = ref<'any' | 'all'>('any');
const approvalType = ref<'all' | 'any'>('any');
const recipients = ref<string[]>([]);
const subDefinitionId = ref('');
const onEnter = ref('');
@ -65,7 +70,7 @@ const nodeTypeLabels: Record<number, string> = {
[NodeType.SubProcess]: '子流程节点',
};
function parseConfig(config: string | null) {
function parseConfig(config: null | string) {
if (!config) {
assigneeRule.value = 'role';
assigneeRole.value = '';

View File

@ -50,7 +50,7 @@ const typeLabel = computed(() => node?.getData()?.typeLabel ?? '');
</div>
<div
:style="{
color: color,
color,
fontSize: '11px',
marginTop: '2px',
}"

View File

@ -1,6 +1,7 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { FormDefinitionDetailDto } from '#/api/core';
import { onMounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { Button, message } from 'ant-design-vue';
@ -10,7 +11,6 @@ import {
getFormDefinitionByIdApi,
updateFormDefinitionApi,
} from '#/api/core';
import type { FormDefinitionDetailDto } from '#/api/core';
import ComponentPanel from './components/ComponentPanel.vue';
import PropertyPanel from './components/PropertyPanel.vue';
@ -25,8 +25,8 @@ const definition = ref<FormDefinitionDetailDto | null>(null);
const containerRef = ref<HTMLElement | null>(null);
const saving = ref(false);
const selectedNodeData = ref<Record<string, any> | null>(null);
const selectedNodeId = ref<string | null>(null);
const selectedNodeData = ref<null | Record<string, any>>(null);
const selectedNodeId = ref<null | string>(null);
const { graph, initGraph, TeleportContainer } = useGraph(containerRef);
const {
@ -151,7 +151,7 @@ onMounted(async () => {
<!-- Center: Canvas -->
<div class="relative flex-1">
<div ref="containerRef" class="h-full w-full" />
<div ref="containerRef" class="h-full w-full"></div>
<TeleportContainer />
<div
class="absolute bottom-0 left-0 right-0 flex items-center gap-4 border-t bg-white px-4 py-1 text-xs text-gray-500"

View File

@ -1,10 +1,11 @@
<script lang="ts" setup>
import type { FormDefinitionDetailDto } from '#/api/core';
import { onMounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { Page } from '@vben/common-ui';
import { useRoute, useRouter } from 'vue-router';
import {
Button,
Descriptions,
@ -15,11 +16,10 @@ import {
} from 'ant-design-vue';
import {
FormStatus,
getFormDefinitionByIdApi,
updateFormDefinitionApi,
FormStatus,
} from '#/api/core';
import type { FormDefinitionDetailDto } from '#/api/core';
const route = useRoute();
const router = useRouter();

View File

@ -1,4 +1,6 @@
<script lang="ts" setup>
import type { FormDefinitionDto } from '#/api/core';
import { h, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
@ -24,7 +26,6 @@ import {
getFormDefinitionsApi,
publishFormDefinitionApi,
} from '#/api/core';
import type { FormDefinitionDto } from '#/api/core';
const router = useRouter();

View File

@ -1,9 +1,12 @@
<script lang="ts" setup>
import type { SchemaField } from '../../composables/useFormSchema';
import type { WorkflowInstanceDetailDto } from '#/api/core/workflow';
import { computed, h, onMounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { Page } from '@vben/common-ui';
import { useUserStore } from '@vben/stores';
import {
@ -28,11 +31,9 @@ import {
TokenStatus,
withdrawWorkflowInstanceApi,
} from '#/api/core/workflow';
import type { WorkflowInstanceDetailDto } from '#/api/core/workflow';
import FormDataDisplay from '../../components/FormDataDisplay.vue';
import { parseFormSchema } from '../../composables/useFormSchema';
import type { SchemaField } from '../../composables/useFormSchema';
import { useUserNames } from '../../composables/useUserNames';
const route = useRoute();
@ -43,10 +44,10 @@ const instanceId = computed(() => route.params.id as string);
const { getUserName, resolveUserNames } = useUserNames();
const loading = ref(false);
const detail = ref<WorkflowInstanceDetailDto | null>(null);
const detail = ref<null | WorkflowInstanceDetailDto>(null);
// Form data display
const formDataJson = ref<string | null>(null);
const formDataJson = ref<null | string>(null);
const schemaFields = ref<SchemaField[]>([]);
const formLoading = ref(false);
@ -99,7 +100,7 @@ const tokenColumns = [
dataIndex: 'completedAt',
key: 'completedAt',
width: 180,
customRender: ({ text }: { text: string | null }) =>
customRender: ({ text }: { text: null | string }) =>
text ? new Date(text).toLocaleString() : '-',
},
];
@ -112,7 +113,7 @@ const taskColumns = [
key: 'assigneeId',
ellipsis: true,
width: 200,
customRender: ({ text }: { text: string | null }) =>
customRender: ({ text }: { text: null | string }) =>
text ? getUserName(text) : '-',
},
{
@ -130,7 +131,7 @@ const taskColumns = [
dataIndex: 'completedAt',
key: 'completedAt',
width: 180,
customRender: ({ text }: { text: string | null }) =>
customRender: ({ text }: { text: null | string }) =>
text ? new Date(text).toLocaleString() : '-',
},
];
@ -257,20 +258,28 @@ onMounted(() => {
{{ instanceStatusMap[detail.status]?.text ?? '未知' }}
</Tag>
</DescriptionsItem>
<DescriptionsItem label="发起人">{{
<DescriptionsItem label="发起人">
{{
getUserName(detail.initiatorId)
}}</DescriptionsItem>
<DescriptionsItem label="启动时间">{{
}}
</DescriptionsItem>
<DescriptionsItem label="启动时间">
{{
new Date(detail.startedAt).toLocaleString()
}}</DescriptionsItem>
<DescriptionsItem label="定义 ID">{{
}}
</DescriptionsItem>
<DescriptionsItem label="定义 ID">
{{
detail.definitionId
}}</DescriptionsItem>
<DescriptionsItem label="完成时间">{{
}}
</DescriptionsItem>
<DescriptionsItem label="完成时间">
{{
detail.completedAt
? new Date(detail.completedAt).toLocaleString()
: '-'
}}</DescriptionsItem>
}}
</DescriptionsItem>
</Descriptions>
<Spin v-if="formLoading" class="mb-6" />

View File

@ -1,9 +1,10 @@
<script lang="ts" setup>
import type { WorkflowInstanceDto } from '#/api/core';
import { computed, h, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import { Page } from '@vben/common-ui';
import { useUserStore } from '@vben/stores';
import {
@ -23,7 +24,6 @@ import {
suspendWorkflowInstanceApi,
withdrawWorkflowInstanceApi,
} from '#/api/core';
import type { WorkflowInstanceDto } from '#/api/core';
import { useUserNames } from '../composables/useUserNames';
@ -37,7 +37,7 @@ const data = ref<WorkflowInstanceDto[]>([]);
const total = ref(0);
const pageIndex = ref(1);
const pageSize = ref(20);
const statusFilter = ref<number | null>(null);
const statusFilter = ref<null | number>(null);
const instanceStatusMap: Record<number, { color: string; text: string }> = {
[InstanceStatus.Pending]: { color: 'blue', text: '待启动' },
@ -89,7 +89,7 @@ const columns = [
dataIndex: 'completedAt',
key: 'completedAt',
width: 180,
customRender: ({ text }: { text: string | null }) =>
customRender: ({ text }: { text: null | string }) =>
text ? new Date(text).toLocaleString() : '-',
},
{ title: '操作', key: 'actions', width: 240 },
@ -171,9 +171,9 @@ onMounted(() => loadData());
@change="onFilterChange"
/>
</Space>
<Button type="primary" @click="router.push('/workflow/start')"
>发起流程</Button
>
<Button type="primary" @click="router.push('/workflow/start')">
发起流程
</Button>
</div>
<Table
@ -196,8 +196,9 @@ onMounted(() => loadData());
<Button
size="small"
@click="router.push(`/workflow/instances/detail/${record.id}`)"
>详情</Button
>
>
详情
</Button>
<Popconfirm
v-if="record.status === InstanceStatus.Running"
title="确定挂起此流程?"

View File

@ -1,4 +1,6 @@
<script lang="ts" setup>
import type { WorkflowMonitorDto, WorkflowTaskListItemDto } from '#/api/core';
import { computed, h, onMounted, ref } from 'vue';
import { Page } from '@vben/common-ui';
@ -6,7 +8,6 @@ import { Page } from '@vben/common-ui';
import { Button, Card, message, Space, Statistic, Table } from 'ant-design-vue';
import { getOverdueTasksApi, getWorkflowMonitorApi } from '#/api/core';
import type { WorkflowMonitorDto, WorkflowTaskListItemDto } from '#/api/core';
const monitorLoading = ref(false);
const overdueLoading = ref(false);
@ -101,8 +102,9 @@ onMounted(() => {
loadMonitor();
loadOverdue();
"
>刷新</Button
>
>
刷新
</Button>
</Space>
</div>

View File

@ -1,4 +1,8 @@
<script lang="ts" setup>
import type { SchemaField } from '../composables/useFormSchema';
import type { WorkflowDefinitionDto } from '#/api/core/workflow';
import { onMounted, ref } from 'vue';
import { Page } from '@vben/common-ui';
@ -16,22 +20,20 @@ import {
import { getFormDefinitionByIdApi } from '#/api/core/form-management';
import {
DefinitionStatus,
getWorkflowDefinitionsApi,
startWorkflowInstanceApi,
DefinitionStatus,
} from '#/api/core/workflow';
import type { WorkflowDefinitionDto } from '#/api/core/workflow';
import SchemaFormRenderer from '../components/SchemaFormRenderer.vue';
import { parseFormSchema } from '../composables/useFormSchema';
import type { SchemaField } from '../composables/useFormSchema';
const loading = ref(false);
const definitions = ref<WorkflowDefinitionDto[]>([]);
const startVisible = ref(false);
const startFormState = ref({ title: '', variables: '' });
const currentDef = ref<WorkflowDefinitionDto | null>(null);
const currentDef = ref<null | WorkflowDefinitionDto>(null);
const schemaFields = ref<SchemaField[]>([]);
const schemaLoading = ref(false);
@ -141,10 +143,10 @@ onMounted(() => loadDefinitions());
</p>
<div class="mt-2 flex items-center justify-between">
<Tag v-if="def.formName" color="blue">{{ def.formName }}</Tag>
<span v-else />
<Button type="primary" size="small" @click="openStartForm(def)"
>发起</Button
>
<span v-else></span>
<Button type="primary" size="small" @click="openStartForm(def)">
发起
</Button>
</div>
</Card>
</div>
@ -178,7 +180,7 @@ onMounted(() => loadDefinitions());
<Form.Item label="流程变量JSON">
<Input.TextArea
v-model:value="startFormState.variables"
placeholder='可选,例如:{"reason": "出差申请", "amount": 5000}'
placeholder="可选,例如:{&quot;reason&quot;: &quot;出差申请&quot;, &quot;amount&quot;: 5000}"
:rows="4"
/>
</Form.Item>

View File

@ -1,8 +1,9 @@
<script lang="ts" setup>
import type { WorkflowTaskListItemDto } from '#/api/core';
import { computed, h, onMounted, ref } from 'vue';
import { Page } from '@vben/common-ui';
import { useUserStore } from '@vben/stores';
import {
@ -28,7 +29,6 @@ import {
transferTaskApi,
urgeTaskApi,
} from '#/api/core';
import type { WorkflowTaskListItemDto } from '#/api/core';
const userStore = useUserStore();
const userId = computed(() => userStore.userInfo?.userId ?? '');
@ -125,7 +125,7 @@ const historyColumns = [
dataIndex: 'completedAt',
key: 'completedAt',
width: 180,
customRender: ({ text }: { text: string | null }) =>
customRender: ({ text }: { text: null | string }) =>
text ? new Date(text).toLocaleString() : '-',
},
];
@ -175,7 +175,7 @@ const ccColumns = [
dataIndex: 'completedAt',
key: 'completedAt',
width: 180,
customRender: ({ text }: { text: string | null }) =>
customRender: ({ text }: { text: null | string }) =>
text ? new Date(text).toLocaleString() : '-',
},
];
@ -205,7 +205,7 @@ function handleCcTableChange(pagination: any) {
// Tab switch
function handleTabChange(key: string | number) {
function handleTabChange(key: number | string) {
activeTab.value = String(key);
if (key === 'pending' && pendingData.value.length === 0) loadPending();
if (key === 'history' && historyData.value.length === 0) loadHistory();
@ -320,7 +320,7 @@ onMounted(() => loadPending());
<template>
<Page auto-content-height>
<Tabs v-model:activeKey="activeTab" @change="handleTabChange">
<Tabs v-model:active-key="activeTab" @change="handleTabChange">
<Tabs.TabPane key="pending" tab="我的待办">
<Table
:columns="pendingColumns"