Browse Source

diy patj

master
maochaoying 2 years ago
parent
commit
40bfc450b1
  1. 15
      src/components/PathPlan.vue

15
src/components/PathPlan.vue

@ -42,8 +42,6 @@ const getLine = (index, position) => {
return '' return ''
} }
const pathArr = ref([])
const showPath = item => { const showPath = item => {
const testArr = taskStore.pathData.filter(it => it.number == item) const testArr = taskStore.pathData.filter(it => it.number == item)
if (testArr?.length > 0) { if (testArr?.length > 0) {
@ -67,10 +65,10 @@ const planPath = item => {
// order // order
const coord = transItemToCoord(item) const coord = transItemToCoord(item)
// coord order // coord order
const testArr = pathArr.value.filter(item => item.coord == coord)
const testArr = taskStore.pathData.filter(item => item.coord == coord)
if (testArr?.length > 0) { if (testArr?.length > 0) {
// //
const leftArr = pathArr.value.filter(item => item.coord != coord)
const leftArr = taskStore.pathData.filter(item => item.coord != coord)
const del = testArr[0] const del = testArr[0]
const delOrder = del.orderNumber const delOrder = del.orderNumber
leftArr.map(item => { leftArr.map(item => {
@ -79,16 +77,17 @@ const planPath = item => {
item.orderNumber = item.orderNumber - 1 item.orderNumber = item.orderNumber - 1
} }
}) })
pathArr.value = leftArr
taskStore.updatePathData(leftArr)
} else { } else {
// //
let obj = {} let obj = {}
obj.coord = coord obj.coord = coord
obj.number = item obj.number = item
obj.orderNumber = pathArr.value.length + 1
pathArr.value.push(obj)
obj.orderNumber = taskStore.pathData.length + 1
const arr = [...taskStore.pathData]
arr.push(obj)
taskStore.updatePathData(arr)
} }
taskStore.updatePathData(pathArr.value)
} }
} }

Loading…
Cancel
Save