feat: 流程模型分类排序按钮显示逻辑完善

pull/582/head
GoldenZqqq 2024-10-15 16:29:45 +08:00
parent 57820cb3e1
commit 2db1f726c3
2 changed files with 47 additions and 5 deletions

View File

@ -36,6 +36,13 @@
</template> </template>
<template #title> <template #title>
<div class="flex items-center"> <div class="flex items-center">
<el-tooltip content="拖动排序" v-if="isCategorySorting">
<Icon
:size="22"
icon="ic:round-drag-indicator"
class="ml-10px category-drag-icon cursor-move text-#8a909c"
/>
</el-tooltip>
<h3 class="ml-20px mr-8px text-18px">{{ title }}</h3> <h3 class="ml-20px mr-8px text-18px">{{ title }}</h3>
<div class="color-gray-600 text-16px"> ({{ dataList?.length || 0 }}) </div> <div class="color-gray-600 text-16px"> ({{ dataList?.length || 0 }}) </div>
</div> </div>
@ -228,7 +235,8 @@ const renameVisible = ref(false)
const props = defineProps({ const props = defineProps({
// //
dataList: propTypes.object.def([]), dataList: propTypes.object.def([]),
title: propTypes.string.def('') title: propTypes.string.def(''),
isCategorySorting: propTypes.bool.def(false)
}) })
const emit = defineEmits(['success']) const emit = defineEmits(['success'])
const appStore = useAppStore() const appStore = useAppStore()

View File

@ -4,6 +4,7 @@
<h3 class="font-extrabold">流程模型</h3> <h3 class="font-extrabold">流程模型</h3>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form <el-form
v-if="!isCategorySorting"
class="-mb-15px flex" class="-mb-15px flex"
:model="queryParams" :model="queryParams"
ref="queryFormRef" ref="queryFormRef"
@ -30,17 +31,17 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-dropdown placement="bottom-end"> <el-dropdown @command="(command) => handleCommand(command)" placement="bottom-end">
<el-button class="w-30px" plain> <el-button class="w-30px" plain>
<Icon icon="ep:setting" /> <Icon icon="ep:setting" />
</el-button> </el-button>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item> <el-dropdown-item command="handleAddCategory">
<Icon icon="ep:circle-plus" :size="13" class="mr-5px" /> <Icon icon="ep:circle-plus" :size="13" class="mr-5px" />
新建分类 新建分类
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item> <el-dropdown-item command="handleSort">
<Icon icon="fa:sort-amount-desc" :size="13" class="mr-5px" /> <Icon icon="fa:sort-amount-desc" :size="13" class="mr-5px" />
分类排序 分类排序
</el-dropdown-item> </el-dropdown-item>
@ -49,6 +50,10 @@
</el-dropdown> </el-dropdown>
</el-form-item> </el-form-item>
</el-form> </el-form>
<template v-else>
<el-button type="primary" @click="cancelSort"> </el-button>
<el-button type="primary" @click="saveSort"> </el-button>
</template>
</div> </div>
<el-divider /> <el-divider />
@ -63,6 +68,7 @@
> >
<CategoryDraggableModel <CategoryDraggableModel
ref="draggableModelRef" ref="draggableModelRef"
:isCategorySorting="isCategorySorting"
:dataList="list" :dataList="list"
:title="title" :title="title"
@success="getList" @success="getList"
@ -91,6 +97,7 @@ defineOptions({ name: 'BpmModel' })
const draggableModelRef = ref() const draggableModelRef = ref()
const loading = ref(true) // const loading = ref(true) //
const isCategorySorting = ref(false) //
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
@ -105,7 +112,7 @@ const categoryGroup = ref<any>({}) // 按照category分组的数据
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
try { try {
// TODO // TODO categoryId/
const data = await ModelApi.getModelPage(queryParams) const data = await ModelApi.getModelPage(queryParams)
data.list = mockData data.list = mockData
categoryGroup.value = groupBy(data.list, 'categoryName') categoryGroup.value = groupBy(data.list, 'categoryName')
@ -133,6 +140,33 @@ const formDetailPreview = ref({
option: {} option: {}
}) })
/** 右上角设置按钮 */
const handleCommand = (command: string) => {
switch (command) {
case 'handleAddCategory':
handleAddCategory()
break
case 'handleSort':
handleSort()
break
default:
break
}
}
//
const handleAddCategory = () => {}
//
const handleSort = () => {
isCategorySorting.value = true
}
//
const cancelSort = () => {
isCategorySorting.value = false
}
//
const saveSort = () => {}
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
await getList() await getList()