feat: 检测项拖动调整

This commit is contained in:
zhanghao 2026-08-06 15:40:32 +08:00
parent 5fb3bf4e20
commit 1b8e2df145
2 changed files with 16 additions and 5 deletions

View File

@ -122,7 +122,7 @@
<div class="task-title">待选择点位</div> <div class="task-title">待选择点位</div>
<draggable :animation="340" :forceFallback="true" :list="taskLeftList" class="draggable-group" <draggable :animation="340" :forceFallback="true" :list="taskLeftList" class="draggable-group"
ghostClass="dragClass" group="people" itemKey="name"> ghostClass="dragClass" :group="{ name: 'people', pull: 'clone', put: false}" itemKey="name">
<template #item="{ element, index }"> <template #item="{ element, index }">
<div class="list-group-item"> <div class="list-group-item">
<el-icon> <el-icon>
@ -138,10 +138,11 @@
<div style="height: 55vh"> <div style="height: 55vh">
<div class="task-title">点位排序</div> <div class="task-title">点位排序</div>
<draggable :animation="340" :forceFallback="true" :list="taskRightList" class="draggable-group" <draggable :animation="340" :forceFallback="true" :list="taskRightList" class="draggable-group"
ghostClass="dragClass" group="people" itemKey="name"> ghostClass="dragClass" :group="{ name: 'people', pull: false, put: true }" itemKey="name">
<template #item="{ element, index }"> <template #item="{ element, index }">
<div class="list-group-item"> <div class="list-group-item">
{{ index + 1 }} {{ element.waypointName }} {{ index + 1 }} {{ element.waypointName }}
<el-icon color="red" @click="removeFromB(element.id)" style="margin-left: 10px;"><Delete /></el-icon>
</div> </div>
</template> </template>
</draggable> </draggable>
@ -377,6 +378,11 @@ const cancelPoint = () => {
dialogVisible.value = false; dialogVisible.value = false;
}; };
const removeFromB = (id) => {
const index = taskRightList.value.findIndex(item => item.id === id)
if (index !== -1) taskRightList.value.splice(index, 1)
}
onMounted(() => { onMounted(() => {
getList(); getList();
getMapArr(); getMapArr();

View File

@ -234,8 +234,7 @@
:list="taskLeftList" :list="taskLeftList"
class="draggable-group" class="draggable-group"
ghostClass="dragClass" ghostClass="dragClass"
:group="{ name: 'people', pull: 'clone', put: false}"
:group="{ name: 'people', pull: 'clone', put: true }"
itemKey="name" itemKey="name"
> >
<template #item="{ element, index }"> <template #item="{ element, index }">
@ -264,6 +263,7 @@
<template #item="{ element, index }"> <template #item="{ element, index }">
<div class="list-group-item"> <div class="list-group-item">
{{ index + 1 }} {{ element.name }} {{ index + 1 }} {{ element.name }}
<el-icon color="red" @click="removeFromB(element.id)" style="margin-left: 10px;"><Delete /></el-icon>
</div> </div>
</template> </template>
</draggable> </draggable>
@ -349,7 +349,7 @@ import { flowExecute } from "@/api/flow/flow";
import TableSearch from "@/components/TableSearch/index.vue"; import TableSearch from "@/components/TableSearch/index.vue";
import draggable from "vuedraggable"; import draggable from "vuedraggable";
import { listDetect } from "@/api/test/detect.js"; import { listDetect } from "@/api/test/detect.js";
import { Tools } from "@element-plus/icons-vue"; import { Tools, Delete } from "@element-plus/icons-vue";
import { listGroup } from "@/api/system/group.js"; import { listGroup } from "@/api/system/group.js";
import { listTerminal } from "@/api/device/terminal.js"; import { listTerminal } from "@/api/device/terminal.js";
import Run from "./Run.vue"; import Run from "./Run.vue";
@ -679,6 +679,11 @@ function handleGetTerminalGroup(row) {
}); });
} }
const removeFromB = (id) => {
const index = taskRightList.value.findIndex(item => item.id === id)
if (index !== -1) taskRightList.value.splice(index, 1)
}
onMounted(() => { onMounted(() => {
getList(); getList();
handleGetSystemGroup(); handleGetSystemGroup();