|
@@ -959,14 +959,26 @@ export default {
|
|
|
// 如果点不在 positions 中,可能是从右侧或左侧列表移动回来
|
|
// 如果点不在 positions 中,可能是从右侧或左侧列表移动回来
|
|
|
const rightIndex = this.rightPoints.findIndex(item => item.pointName === labelText)
|
|
const rightIndex = this.rightPoints.findIndex(item => item.pointName === labelText)
|
|
|
const leftIndex = this.leftPoints.findIndex(item => item.pointName === labelText)
|
|
const leftIndex = this.leftPoints.findIndex(item => item.pointName === labelText)
|
|
|
-
|
|
|
|
|
- if (rightIndex !== -1) {
|
|
|
|
|
|
|
+ if (rightIndex !== -1 && isInLeftBox) {
|
|
|
|
|
+ // 从右侧拖拽到左侧
|
|
|
|
|
+ const movedPoint = this.rightPoints.splice(rightIndex, 1)[0];
|
|
|
|
|
+ if (!this.leftPoints.find(point => point.pointName === movedPoint.pointName)) {
|
|
|
|
|
+ this.leftPoints.push(movedPoint);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (leftIndex !== -1 && isInRightBox) {
|
|
|
|
|
+ // 从左侧拖拽到右侧
|
|
|
|
|
+ const movedPoint = this.leftPoints.splice(leftIndex, 1)[0];
|
|
|
|
|
+ if (!this.rightPoints.find(point => point.pointName === movedPoint.pointName)) {
|
|
|
|
|
+ this.rightPoints.push(movedPoint);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (rightIndex !== -1&&isInCabinet) {
|
|
|
// 从右侧列表移回物资柜
|
|
// 从右侧列表移回物资柜
|
|
|
const movedPoint = this.rightPoints.splice(rightIndex, 1)[0]
|
|
const movedPoint = this.rightPoints.splice(rightIndex, 1)[0]
|
|
|
positions.push(movedPoint)
|
|
positions.push(movedPoint)
|
|
|
// 更新 this.value
|
|
// 更新 this.value
|
|
|
this.value = JSON.stringify(positions, null, 4)
|
|
this.value = JSON.stringify(positions, null, 4)
|
|
|
- } else if (leftIndex !== -1) {
|
|
|
|
|
|
|
+ } else if (leftIndex !== -1&&isInCabinet) {
|
|
|
// 从左侧列表移回物资柜
|
|
// 从左侧列表移回物资柜
|
|
|
const movedPoint = this.leftPoints.splice(leftIndex, 1)[0]
|
|
const movedPoint = this.leftPoints.splice(leftIndex, 1)[0]
|
|
|
positions.push(movedPoint)
|
|
positions.push(movedPoint)
|