完成排序保存功能
This commit is contained in:
parent
3f4b3c67f2
commit
128af005eb
@ -5,7 +5,7 @@ import { NButton } from 'naive-ui'
|
|||||||
import AppIconSystemMonitor from './AppIconSystemMonitor/index.vue'
|
import AppIconSystemMonitor from './AppIconSystemMonitor/index.vue'
|
||||||
import type { CardStyle, MonitorData } from './typings'
|
import type { CardStyle, MonitorData } from './typings'
|
||||||
import Edit from './Edit/index.vue'
|
import Edit from './Edit/index.vue'
|
||||||
import { getAll } from './common'
|
import { getAll, saveAll } from './common'
|
||||||
import { useAuthStore, usePanelState } from '@/store'
|
import { useAuthStore, usePanelState } from '@/store'
|
||||||
import { PanelPanelConfigStyleEnum } from '@/enums'
|
import { PanelPanelConfigStyleEnum } from '@/enums'
|
||||||
import { VisitMode } from '@/enums/auth'
|
import { VisitMode } from '@/enums/auth'
|
||||||
@ -23,11 +23,6 @@ const monitorGroup = ref<MonitorGroup>({
|
|||||||
hoverStatus: false,
|
hoverStatus: false,
|
||||||
sortStatus: false,
|
sortStatus: false,
|
||||||
})
|
})
|
||||||
// const progressStyle = ref<ProgressStyle>({
|
|
||||||
// color: 'white',
|
|
||||||
// railColor: 'rgba(0, 0, 0, 0.2)',
|
|
||||||
// height: 5,
|
|
||||||
// })
|
|
||||||
|
|
||||||
const editShowStatus = ref<boolean>(false)
|
const editShowStatus = ref<boolean>(false)
|
||||||
const editData = ref<MonitorData | null>(null)
|
const editData = ref<MonitorData | null>(null)
|
||||||
@ -42,12 +37,9 @@ function handleAddItem() {
|
|||||||
function handleSetSortStatus(sortStatus: boolean) {
|
function handleSetSortStatus(sortStatus: boolean) {
|
||||||
monitorGroup.value.sortStatus = sortStatus
|
monitorGroup.value.sortStatus = sortStatus
|
||||||
|
|
||||||
// // 并未保存排序重新更新数据
|
// 并未保存排序重新更新数据
|
||||||
// if (!sortStatus) {
|
if (!sortStatus)
|
||||||
// // 单独更新组
|
getData()
|
||||||
// if (items.value[groupIndex] && items.value[groupIndex].id)
|
|
||||||
// updateItemIconGroupByNet(groupIndex, items.value[groupIndex].id as number)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSetHoverStatus(hoverStatus: boolean) {
|
function handleSetHoverStatus(hoverStatus: boolean) {
|
||||||
@ -62,11 +54,8 @@ const monitorDatas = ref<MonitorData[]>([])
|
|||||||
|
|
||||||
function handleClick(index: number, item: MonitorData) {
|
function handleClick(index: number, item: MonitorData) {
|
||||||
editShowStatus.value = true
|
editShowStatus.value = true
|
||||||
|
|
||||||
editData.value = item
|
editData.value = item
|
||||||
editIndex.value = index
|
editIndex.value = index
|
||||||
|
|
||||||
console.log(editData.value)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getData() {
|
async function getData() {
|
||||||
@ -81,8 +70,10 @@ function handleSaveDone() {
|
|||||||
getData()
|
getData()
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSaveSort() {
|
async function handleSaveSort() {
|
||||||
|
const { code } = await saveAll(monitorDatas.value)
|
||||||
|
if (code === 0)
|
||||||
|
monitorGroup.value.sortStatus = false
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user