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 #title>
<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>
<div class="color-gray-600 text-16px"> ({{ dataList?.length || 0 }}) </div>
</div>
@ -228,7 +235,8 @@ const renameVisible = ref(false)
const props = defineProps({
//
dataList: propTypes.object.def([]),
title: propTypes.string.def('')
title: propTypes.string.def(''),
isCategorySorting: propTypes.bool.def(false)
})
const emit = defineEmits(['success'])
const appStore = useAppStore()

View File

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