完善删除图标功能
This commit is contained in:
parent
211c3071dc
commit
0a81db157b
@ -98,3 +98,20 @@ func (a *ItemIcon) GetListByGroupId(c *gin.Context) {
|
|||||||
|
|
||||||
apiReturn.SuccessListData(c, itemIcons, 0)
|
apiReturn.SuccessListData(c, itemIcons, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *ItemIcon) Deletes(c *gin.Context) {
|
||||||
|
req := commonApiStructs.RequestDeleteIds[uint]{}
|
||||||
|
|
||||||
|
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||||
|
apiReturn.ErrorParamFomat(c, err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
userInfo, _ := base.GetCurrentUserInfo(c)
|
||||||
|
if err := global.Db.Debug().Delete(&models.ItemIcon{}, "id in ? AND user_id=?", req.Ids, userInfo.ID).Error; err != nil {
|
||||||
|
apiReturn.ErrorDatabase(c, err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
apiReturn.Success(c)
|
||||||
|
}
|
||||||
|
@ -13,6 +13,6 @@ func InitItemIcon(router *gin.RouterGroup) {
|
|||||||
{
|
{
|
||||||
r.POST("/panel/itemIcon/edit", itemIcon.Edit)
|
r.POST("/panel/itemIcon/edit", itemIcon.Edit)
|
||||||
r.POST("/panel/itemIcon/getListByGroupId", itemIcon.GetListByGroupId)
|
r.POST("/panel/itemIcon/getListByGroupId", itemIcon.GetListByGroupId)
|
||||||
|
r.POST("/panel/itemIcon/deletes", itemIcon.Deletes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,5 @@
|
|||||||
import { post } from '@/utils/request'
|
import { post } from '@/utils/request'
|
||||||
|
|
||||||
// // 获取绘图的列表
|
|
||||||
// export function getMyDrawList<T>(req: Common.ListRequest) {
|
|
||||||
// return post<T>({
|
|
||||||
// url: '/aiDraw/getMyDrawList',
|
|
||||||
// data: req,
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
export function edit<T>(req: Panel.ItemInfo) {
|
export function edit<T>(req: Panel.ItemInfo) {
|
||||||
return post<T>({
|
return post<T>({
|
||||||
url: '/panel/itemIcon/edit',
|
url: '/panel/itemIcon/edit',
|
||||||
@ -28,9 +20,9 @@ export function getListByGroupId<T>() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSystemList<T>(data: Common.ListRequest) {
|
export function deletes<T>(ids: number[]) {
|
||||||
return post<T>({
|
return post<T>({
|
||||||
url: '/aiApplet/getSystemList',
|
url: '/panel/itemIcon/deletes',
|
||||||
data,
|
data: { ids },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,8 @@ const show = ref(false)
|
|||||||
<div class="flex-1 flex-shrink-0 overflow-hidden">
|
<div class="flex-1 flex-shrink-0 overflow-hidden">
|
||||||
<!-- <UserAvatar /> -->
|
<!-- <UserAvatar /> -->
|
||||||
</div>
|
</div>
|
||||||
|
<a href="https://gitee.com/hslr/sun-panel.git">Gitee</a>
|
||||||
|
<a href="https://github.com/hslr-s/sun-panel.git">Github</a>
|
||||||
|
|
||||||
<HoverButton @click="show = true">
|
<HoverButton @click="show = true">
|
||||||
<span class="text-xl text-[#4f555e] dark:text-white">
|
<span class="text-xl text-[#4f555e] dark:text-white">
|
||||||
|
@ -118,7 +118,7 @@ const handleUploadFinish = ({
|
|||||||
<div v-if="checkedValueRef === 3">
|
<div v-if="checkedValueRef === 3">
|
||||||
<div>
|
<div>
|
||||||
<NInput v-model:value="itemIconInfo.text" class="mb-[5px]" size="small" type="text" placeholder="请输入图标名字" @input="handleChange" />
|
<NInput v-model:value="itemIconInfo.text" class="mb-[5px]" size="small" type="text" placeholder="请输入图标名字" @input="handleChange" />
|
||||||
<a target="_blank" href="https://icon-sets.iconify.design/" class="text-[blue]">图标列表</a>
|
<a target="_blank" href="https://icon-sets.iconify.design/" class="text-[blue]">图标库</a>
|
||||||
</div>
|
</div>
|
||||||
<NColorPicker
|
<NColorPicker
|
||||||
v-model:value="itemIconInfo.bgColor"
|
v-model:value="itemIconInfo.bgColor"
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { NButton, NButtonGroup, NDropdown, NEllipsis, NGrid, NGridItem, NModal, NSkeleton, NSpin, useMessage } from 'naive-ui'
|
import { NButton, NButtonGroup, NDropdown, NEllipsis, NGrid, NGridItem, NModal, NSkeleton, NSpin, useDialog, useMessage } from 'naive-ui'
|
||||||
import { nextTick, onMounted, ref } from 'vue'
|
import { nextTick, onMounted, ref } from 'vue'
|
||||||
import { EditItem, Setting } from './components'
|
import { EditItem, Setting } from './components'
|
||||||
import { Clock } from '@/components/deskModule'
|
import { Clock } from '@/components/deskModule'
|
||||||
import { ItemIcon, SvgIcon } from '@/components/common'
|
import { ItemIcon, SvgIcon } from '@/components/common'
|
||||||
import { getListByGroupId } from '@/api/panel/itemIcon'
|
import { deletes, getListByGroupId } from '@/api/panel/itemIcon'
|
||||||
import { getInfo } from '@/api/system/user'
|
import { getInfo } from '@/api/system/user'
|
||||||
import { usePanelState, useUserStore } from '@/store'
|
import { usePanelState, useUserStore } from '@/store'
|
||||||
import { PanelStateNetworkModeEnum } from '@/enum'
|
import { PanelStateNetworkModeEnum } from '@/enum'
|
||||||
import { setTitle } from '@/utils/cmn'
|
import { setTitle } from '@/utils/cmn'
|
||||||
|
|
||||||
const ms = useMessage()
|
const ms = useMessage()
|
||||||
|
const dialog = useDialog()
|
||||||
const panelState = usePanelState()
|
const panelState = usePanelState()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
@ -39,6 +40,10 @@ const dropdownMenuOptions = [
|
|||||||
label: '编辑',
|
label: '编辑',
|
||||||
key: 'edit',
|
key: 'edit',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '删除',
|
||||||
|
key: 'delete',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
const items = ref<Panel.ItemInfo[]>()
|
const items = ref<Panel.ItemInfo[]>()
|
||||||
|
|
||||||
@ -100,7 +105,24 @@ function handleSelect(key: string | number) {
|
|||||||
editItemInfoData.value = { ...currentRightSelectItem.value } as Panel.ItemInfo
|
editItemInfoData.value = { ...currentRightSelectItem.value } as Panel.ItemInfo
|
||||||
editItemInfoShow.value = true
|
editItemInfoShow.value = true
|
||||||
break
|
break
|
||||||
case 'del':
|
case 'delete':
|
||||||
|
dialog.warning({
|
||||||
|
title: '警告',
|
||||||
|
content: `你确定要删除图标 ${currentRightSelectItem.value?.title} ?`,
|
||||||
|
positiveText: '确定',
|
||||||
|
negativeText: '取消',
|
||||||
|
onPositiveClick: () => {
|
||||||
|
deletes([currentRightSelectItem.value?.id as number]).then(({ code, msg }) => {
|
||||||
|
if (code === 0) {
|
||||||
|
ms.success('已删除')
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ms.error(`删除失败:${msg}`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user