fix: merge yudao/dev 解决冲突

This commit is contained in:
jason
2025-06-09 00:04:45 +08:00
316 changed files with 19685 additions and 4419 deletions

View File

@@ -5,6 +5,7 @@ import { computed, ref, watchEffect } from 'vue';
import { useRouter } from 'vue-router';
import { confirm, useVbenModal } from '@vben/common-ui';
import { IconifyIcon } from '@vben/icons';
import { useUserStore } from '@vben/stores';
import { cloneDeep, formatDateTime, isEqual } from '@vben/utils';
@@ -38,6 +39,12 @@ const props = defineProps<{
const emit = defineEmits(['success']);
// 重命名分类对话框
const [CategoryRenameModal, categoryRenameModalApi] = useVbenModal({
connectedComponent: CategoryRenameForm,
destroyOnClose: true,
});
const router = useRouter();
// 获取当前登录用户Id
const userStore = useUserStore();
@@ -104,7 +111,7 @@ const columns = [
];
/** 处理模型的排序 */
const handleModelSort = () => {
function handleModelSort() {
// 保存初始数据
originalData.value = cloneDeep(props.categoryInfo.modelList);
// 展开数据
@@ -120,10 +127,10 @@ const handleModelSort = () => {
disabled: false, // 启用排序
});
}
};
}
/** 处理模型的排序提交 */
const handleModelSortSubmit = async () => {
async function handleModelSortSubmit() {
try {
// 保存排序
const ids = modelList.value.map((item) => item.id);
@@ -135,10 +142,10 @@ const handleModelSortSubmit = async () => {
} catch (error) {
console.error('排序保存失败', error);
}
};
}
/** 处理模型的排序取消 */
const handleModelSortCancel = () => {
function handleModelSortCancel() {
// 恢复初始数据
modelList.value = cloneDeep(originalData.value);
isModelSorting.value = false;
@@ -146,20 +153,20 @@ const handleModelSortCancel = () => {
if (sortableInstance.value) {
sortableInstance.value.option('disabled', true);
}
};
}
/** 处理下拉菜单命令 */
const handleCommand = (command: string) => {
function handleCommand(command: string) {
if (command === 'renameCategory') {
// 打开重命名分类对话框
categoryRenameModalApi.setData(props.categoryInfo).open();
} else if (command === 'deleteCategory') {
handleDeleteCategory();
}
};
}
/** 删除流程分类 */
const handleDeleteCategory = async () => {
async function handleDeleteCategory() {
if (props.categoryInfo.modelList.length > 0) {
message.warning('该分类下仍有流程定义,不允许删除');
return;
@@ -176,13 +183,13 @@ const handleDeleteCategory = async () => {
// 刷新列表
emit('success');
});
};
}
/** 处理表单详情点击 */
const handleFormDetail = (row: any) => {
function handleFormDetail(row: any) {
// TODO 待实现
console.warn('待实现', row);
};
}
/** 判断是否是流程管理员 */
function isManagerUser(row: any) {
@@ -273,17 +280,11 @@ watchEffect(() => {
});
/** 自定义表格行渲染 */
const customRow = (_record: any) => {
function customRow(_record: any) {
return {
class: isModelSorting.value ? 'cursor-move' : '',
};
};
// 重命名分类对话框
const [CategoryRenameModal, categoryRenameModalApi] = useVbenModal({
connectedComponent: CategoryRenameForm,
destroyOnClose: true,
});
}
// 处理重命名成功
const handleRenameSuccess = () => {
@@ -292,292 +293,307 @@ const handleRenameSuccess = () => {
</script>
<template>
<Card
:body-style="{ padding: 0 }"
class="category-draggable-model mb-5 rounded-lg transition-all duration-300 ease-in-out hover:shadow-xl"
>
<div class="flex h-12 items-center">
<!-- 头部分类名 -->
<div class="flex items-center">
<Tooltip v-if="isCategorySorting" title="拖动排序">
<span
class="icon-[ic--round-drag-indicator] ml-2.5 cursor-move text-2xl text-gray-500"
></span>
</Tooltip>
<div class="ml-4 mr-2 text-lg font-medium">{{ categoryInfo.name }}</div>
<div class="text-gray-500">
({{ categoryInfo.modelList?.length || 0 }})
</div>
</div>
<!-- 头部操作 -->
<div class="flex flex-1 items-center" v-show="!isCategorySorting">
<div
v-if="categoryInfo.modelList.length > 0"
class="ml-3 flex cursor-pointer items-center transition-transform duration-300"
:class="isExpand ? 'rotate-180' : 'rotate-0'"
@click="isExpand = !isExpand"
>
<span
class="icon-[ic--round-expand-more] text-3xl text-gray-400"
></span>
<div>
<Card
:body-style="{ padding: 0 }"
class="category-draggable-model mb-5 rounded-lg transition-all duration-300 ease-in-out hover:shadow-xl"
>
<div class="flex h-12 items-center">
<!-- 头部分类名 -->
<div class="flex items-center">
<Tooltip v-if="isCategorySorting" title="拖动排序">
<span
class="icon-[ic--round-drag-indicator] ml-2.5 cursor-move text-2xl text-gray-500"
></span>
</Tooltip>
<div class="ml-4 mr-2 text-lg font-medium">
{{ categoryInfo.name }}
</div>
<div class="text-gray-500">
({{ categoryInfo.modelList?.length || 0 }})
</div>
</div>
<div
class="ml-auto flex items-center"
:class="isModelSorting ? 'mr-4' : 'mr-8'"
>
<template v-if="!isModelSorting">
<Button
v-if="categoryInfo.modelList.length > 0"
type="link"
size="small"
class="flex items-center text-[14px]"
@click.stop="handleModelSort"
>
<template #icon>
<span class="icon-[fa--sort-amount-desc]"></span>
</template>
排序
</Button>
<Dropdown placement="bottom" arrow>
<!-- 头部操作 -->
<div class="flex flex-1 items-center" v-show="!isCategorySorting">
<div
v-if="categoryInfo.modelList.length > 0"
class="ml-3 flex cursor-pointer items-center transition-transform duration-300"
:class="isExpand ? 'rotate-180' : 'rotate-0'"
@click="isExpand = !isExpand"
>
<span
class="icon-[ic--round-expand-more] text-3xl text-gray-400"
></span>
</div>
<div
class="ml-auto flex items-center"
:class="isModelSorting ? 'mr-4' : 'mr-8'"
>
<template v-if="!isModelSorting">
<Button
v-if="categoryInfo.modelList.length > 0"
type="link"
size="small"
class="flex items-center text-[14px]"
@click.stop="handleModelSort"
>
<template #icon>
<span class="icon-[ant-design--setting-outlined]"></span>
<IconifyIcon icon="lucide:align-start-vertical" />
</template>
分类
排序
</Button>
<template #overlay>
<Menu @click="(e) => handleCommand(e.key as string)">
<Menu.Item key="renameCategory"> 重命名 </Menu.Item>
<Menu.Item key="deleteCategory"> 删除分类 </Menu.Item>
</Menu>
</template>
</Dropdown>
</template>
<Dropdown placement="bottom" arrow>
<Button
type="link"
size="small"
class="flex items-center text-[14px]"
>
<template #icon>
<IconifyIcon icon="lucide:settings" />
</template>
分类
</Button>
<template #overlay>
<Menu @click="(e) => handleCommand(e.key as string)">
<Menu.Item key="renameCategory"> 重命名 </Menu.Item>
<Menu.Item key="deleteCategory"> 删除分类 </Menu.Item>
</Menu>
</template>
</Dropdown>
</template>
<template v-else>
<Button @click.stop="handleModelSortCancel" class="mr-2">
</Button>
<Button type="primary" @click.stop="handleModelSortSubmit">
保存排序
</Button>
</template>
<template v-else>
<Button @click.stop="handleModelSortCancel" class="mr-2">
</Button>
<Button type="primary" @click.stop="handleModelSortSubmit">
保存排序
</Button>
</template>
</div>
</div>
</div>
</div>
<!-- 模型列表 -->
<Collapse :active-key="expandKeys" :bordered="false" class="bg-transparent">
<Collapse.Panel
key="1"
:show-arrow="false"
class="border-0 bg-transparent p-0"
v-show="isExpand"
<!-- 模型列表 -->
<Collapse
:active-key="expandKeys"
:bordered="false"
class="bg-transparent"
>
<Table
v-if="modelList && modelList.length > 0"
:class="`category-${categoryInfo.id}`"
ref="tableRef"
:data-source="modelList"
:columns="columns"
:pagination="false"
:custom-row="customRow"
:scroll="{ x: '100%' }"
row-key="id"
<Collapse.Panel
key="1"
:show-arrow="false"
class="border-0 bg-transparent p-0"
v-show="isExpand"
>
<template #bodyCell="{ column, record }">
<!-- 流程名 -->
<template v-if="column.key === 'name'">
<div class="flex items-center">
<Tooltip v-if="isModelSorting" title="拖动排序">
<span
class="icon-[ic--round-drag-indicator] mr-2.5 cursor-move text-2xl text-gray-500"
></span>
</Tooltip>
<div
v-if="!record.icon"
class="mr-2.5 flex h-9 w-9 items-center justify-center rounded bg-blue-500 text-white"
>
<span style="font-size: 12px">{{
record.name.substring(0, 2)
}}</span>
<Table
v-if="modelList && modelList.length > 0"
:class="`category-${categoryInfo.id}`"
ref="tableRef"
:data-source="modelList"
:columns="columns"
:pagination="false"
:custom-row="customRow"
:scroll="{ x: '100%' }"
row-key="id"
>
<template #bodyCell="{ column, record }">
<!-- 流程名 -->
<template v-if="column.key === 'name'">
<div class="flex items-center">
<Tooltip v-if="isModelSorting" title="拖动排序">
<span
class="icon-[ic--round-drag-indicator] mr-2.5 cursor-move text-2xl text-gray-500"
></span>
</Tooltip>
<div
v-if="!record.icon"
class="mr-2.5 flex h-9 w-9 items-center justify-center rounded bg-blue-500 text-white"
>
<span style="font-size: 12px">
{{ record.name.substring(0, 2) }}
</span>
</div>
<img
v-else
:src="record.icon"
class="mr-2.5 h-9 w-9 rounded"
alt="图标"
/>
{{ record.name }}
</div>
<img
v-else
:src="record.icon"
class="mr-2.5 h-9 w-9 rounded"
alt="图标"
/>
{{ record.name }}
</div>
</template>
</template>
<!-- 可见范围列-->
<template v-else-if="column.key === 'startUserIds'">
<span
v-if="!record.startUsers?.length && !record.startDepts?.length"
>
全部可见
</span>
<span v-else-if="record.startUsers?.length === 1">
{{ record.startUsers[0].nickname }}
</span>
<span v-else-if="record.startDepts?.length === 1">
{{ record.startDepts[0].name }}
</span>
<span v-else-if="record.startDepts?.length > 1">
<Tooltip
placement="top"
:title="
record.startDepts.map((dept: any) => dept.name).join('、')
<!-- 可见范围列-->
<template v-else-if="column.key === 'startUserIds'">
<span
v-if="
!record.startUsers?.length && !record.startDepts?.length
"
>
{{ record.startDepts[0].name }}
{{ record.startDepts.length }} 个部门可见
</Tooltip>
</span>
<span v-else-if="record.startUsers?.length > 1">
<Tooltip
placement="top"
:title="
record.startUsers
.map((user: any) => user.nickname)
.join('、')
"
>
{{ record.startUsers[0].nickname }}
{{ record.startUsers.length }} 人可见
</Tooltip>
</span>
</template>
<!-- 流程类型列 -->
<template v-else-if="column.key === 'type'">
<!-- <DictTag :value="record.type" :type="DICT_TYPE.BPM_MODEL_TYPE" /> -->
<!-- <Tag>{{ record.type }}</Tag> -->
<DictTag :type="DICT_TYPE.BPM_MODEL_TYPE" :value="record.type" />
</template>
<!-- 表单信息列 -->
<template v-else-if="column.key === 'formType'">
<!-- TODO BpmModelFormType.NORMAL -->
<Button
v-if="record.formType === 10"
type="link"
@click="handleFormDetail(record)"
>
{{ record.formName }}
</Button>
<!-- TODO BpmModelFormType.CUSTOM -->
<Button
v-else-if="record.formType === 20"
type="link"
@click="handleFormDetail(record)"
>
{{ record.formCustomCreatePath }}
</Button>
<span v-else>暂无表单</span>
</template>
<!-- 最后发布列 -->
<template v-else-if="column.key === 'deploymentTime'">
<div class="flex items-center justify-center">
<span v-if="record.processDefinition" class="w-[150px]">
{{ formatDateTime(record.processDefinition.deploymentTime) }}
全部可见
</span>
<Tag v-if="record.processDefinition">
v{{ record.processDefinition.version }}
</Tag>
<Tag v-else color="warning">未部署</Tag>
<Tag
v-if="record.processDefinition?.suspensionState === 2"
color="warning"
class="ml-[10px]"
>
已停用
</Tag>
</div>
</template>
<!-- 操作列 -->
<template v-else-if="column.key === 'operation'">
<div class="flex items-center space-x-0">
<!-- TODO 权限校验-->
<span v-else-if="record.startUsers?.length === 1">
{{ record.startUsers[0].nickname }}
</span>
<span v-else-if="record.startDepts?.length === 1">
{{ record.startDepts[0].name }}
</span>
<span v-else-if="record.startDepts?.length > 1">
<Tooltip
placement="top"
:title="
record.startDepts.map((dept: any) => dept.name).join('、')
"
>
{{ record.startDepts[0].name }}等
{{ record.startDepts.length }} 个部门可见
</Tooltip>
</span>
<span v-else-if="record.startUsers?.length > 1">
<Tooltip
placement="top"
:title="
record.startUsers
.map((user: any) => user.nickname)
.join('、')
"
>
{{ record.startUsers[0].nickname }}等
{{ record.startUsers.length }} 人可见
</Tooltip>
</span>
</template>
<!-- 流程类型列 -->
<template v-else-if="column.key === 'type'">
<!-- <DictTag :value="record.type" :type="DICT_TYPE.BPM_MODEL_TYPE" /> -->
<!-- <Tag>{{ record.type }}</Tag> -->
<DictTag
:type="DICT_TYPE.BPM_MODEL_TYPE"
:value="record.type"
/>
</template>
<!-- 表单信息列 -->
<template v-else-if="column.key === 'formType'">
<!-- TODO BpmModelFormType.NORMAL -->
<Button
v-if="record.formType === 10"
type="link"
size="small"
class="px-1"
@click="modelOperation('update', record.id)"
:disabled="!isManagerUser(record)"
@click="handleFormDetail(record)"
>
修改
{{ record.formName }}
</Button>
<!-- TODO BpmModelFormType.CUSTOM -->
<Button
v-else-if="record.formType === 20"
type="link"
size="small"
class="px-1"
@click="handleDeploy(record)"
:disabled="!isManagerUser(record)"
@click="handleFormDetail(record)"
>
发布
{{ record.formCustomCreatePath }}
</Button>
<Dropdown placement="bottomRight" arrow>
<Button type="link" size="small" class="px-1">更多</Button>
<!-- TODO 待实现 -->
<template #overlay>
<Menu
@click="
(e) => handleModelCommand(e.key as string, record)
"
>
<Menu.Item key="handleCopy"> 复制 </Menu.Item>
<Menu.Item key="handleDefinitionList"> 历史 </Menu.Item>
<Menu.Item
key="handleReport"
:disabled="!isManagerUser(record)"
<span v-else>暂无表单</span>
</template>
<!-- 最后发布列 -->
<template v-else-if="column.key === 'deploymentTime'">
<div class="flex items-center justify-center">
<span v-if="record.processDefinition" class="w-[150px]">
{{
formatDateTime(record.processDefinition.deploymentTime)
}}
</span>
<Tag v-if="record.processDefinition">
v{{ record.processDefinition.version }}
</Tag>
<Tag v-else color="warning">未部署</Tag>
<Tag
v-if="record.processDefinition?.suspensionState === 2"
color="warning"
class="ml-[10px]"
>
已停用
</Tag>
</div>
</template>
<!-- 操作列 -->
<template v-else-if="column.key === 'operation'">
<div class="flex items-center space-x-0">
<!-- TODO 权限校验-->
<Button
type="link"
size="small"
class="px-1"
@click="modelOperation('update', record.id)"
:disabled="!isManagerUser(record)"
>
修改
</Button>
<Button
type="link"
size="small"
class="px-1"
@click="handleDeploy(record)"
:disabled="!isManagerUser(record)"
>
发布
</Button>
<Dropdown placement="bottomRight" arrow>
<Button type="link" size="small" class="px-1">更多</Button>
<!-- TODO 待实现 -->
<template #overlay>
<Menu
@click="
(e) => handleModelCommand(e.key as string, record)
"
>
报表
</Menu.Item>
<Menu.Item
key="handleChangeState"
v-if="record.processDefinition"
:disabled="!isManagerUser(record)"
>
{{
record.processDefinition.suspensionState === 1
? '停用'
: '启用'
}}
</Menu.Item>
<Menu.Item
danger
key="handleClean"
:disabled="!isManagerUser(record)"
>
清理
</Menu.Item>
<Menu.Item
danger
key="handleDelete"
:disabled="!isManagerUser(record)"
>
删除
</Menu.Item>
</Menu>
</template>
</Dropdown>
</div>
<Menu.Item key="handleCopy"> 复制 </Menu.Item>
<Menu.Item key="handleDefinitionList"> 历史 </Menu.Item>
<Menu.Item
key="handleReport"
:disabled="!isManagerUser(record)"
>
报表
</Menu.Item>
<Menu.Item
key="handleChangeState"
v-if="record.processDefinition"
:disabled="!isManagerUser(record)"
>
{{
record.processDefinition.suspensionState === 1
? '停用'
: '启用'
}}
</Menu.Item>
<Menu.Item
danger
key="handleClean"
:disabled="!isManagerUser(record)"
>
清理
</Menu.Item>
<Menu.Item
danger
key="handleDelete"
:disabled="!isManagerUser(record)"
>
删除
</Menu.Item>
</Menu>
</template>
</Dropdown>
</div>
</template>
</template>
</template>
</Table>
</Collapse.Panel>
</Collapse>
</Card>
</Table>
</Collapse.Panel>
</Collapse>
</Card>
<!-- 重命名分类弹窗 -->
<CategoryRenameModal @success="handleRenameSuccess" />
<!-- 重命名分类弹窗 -->
<CategoryRenameModal @success="handleRenameSuccess" />
</div>
</template>
<style lang="scss" scoped>