Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
template_pda_Web
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
胡宝山
template_pda_Web
Commits
41c2a102
Commit
41c2a102
authored
Apr 03, 2024
by
高宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.修改高亮行
parent
db9093f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
124 additions
and
27 deletions
+124
-27
dispose.vue
src/views/setup/dispose.vue
+124
-27
No files found.
src/views/setup/dispose.vue
View file @
41c2a102
...
...
@@ -58,6 +58,11 @@ export default {
name
:
'Dispose'
,
data
()
{
return
{
// 本地储存
/**
* 元素是一个对象 对象中有三个值 location list frequency
* **/
storeList
:
[],
// 总计
total
:
0
,
rowIndexList
:
[],
...
...
@@ -100,40 +105,132 @@ export default {
}
})
},
// 查询回
// handleSearch() {
// this.tableList.forEach((item, index) => {
// if (item.location === this.searchForm.search) {
// this.rowIndexList.push(index)
// this.total = this.total + item.needNumber
// }
// })
// },
/**
* 获取本次要高亮的行的下坐标和要加的数量
* **/
getIndexAndNeedNumber
(
search
)
{
var
last
=
{
index
:
null
,
needNumber
:
null
}
/**
* 1.判断储存的list是不是为空
* **/
if
(
this
.
storeList
.
length
>
0
)
{
var
list
=
[]
// 判断tableList中location和search相同的元素个数
this
.
tableList
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
location
===
search
)
{
list
.
push
(
index
)
}
})
if
(
list
.
length
>
0
)
{
if
(
list
.
length
===
1
)
{
last
.
index
=
list
[
0
]
last
.
needNumber
=
this
.
tableList
[
list
[
0
]].
needNumber
return
last
}
if
(
list
.
length
>
1
)
{
// 是否能从储存中找到location
if
(
this
.
storeList
.
find
(
Litem
=>
Litem
.
location
===
search
))
{
var
index
=
this
.
storeList
.
findIndex
(
Litem
=>
Litem
.
location
===
search
)
this
.
storeList
[
index
].
frequency
=
this
.
storeList
[
index
].
frequency
+
1
last
.
index
=
this
.
storeList
[
index
].
list
[
this
.
storeList
[
index
].
frequency
]
last
.
needNumber
=
this
.
tableList
[
this
.
storeList
[
index
].
list
[
this
.
storeList
[
index
].
frequency
]].
needNumber
return
last
}
else
{
var
objT
=
{
location
:
search
,
list
:
list
,
frequency
:
0
}
this
.
storeList
.
push
(
objT
)
last
.
index
=
list
[
0
]
last
.
needNumber
=
this
.
tableList
[
list
[
0
]].
needNumber
return
last
}
}
}
else
{
this
.
$message
.
error
(
"请输入正确的地址"
)
return
null
;
}
handleSearch
()
{
const
keyword
=
this
.
searchForm
.
search
// 如果搜索关键字与上一次相同,则从当前索引的下一个位置开始搜索
if
(
keyword
===
this
.
SearchKeyword
)
{
this
.
currentIndex
++
}
else
{
// 如果搜索关键字发生变化,则重置索引为-1,并更新上一次搜索的关键字
this
.
currentIndex
=
-
1
this
.
SearchKeyword
=
keyword
// 向储存列表加数据
var
obj
=
{
location
:
search
,
list
:
[],
frequency
:
0
}
// 判断tableList中location和search相同的元素个数
this
.
tableList
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
location
===
search
)
{
obj
.
list
.
push
(
index
)
}
})
if
(
obj
.
list
.
length
>
0
)
{
if
(
obj
.
list
.
length
===
1
)
{
last
.
index
=
obj
.
list
[
0
]
last
.
needNumber
=
this
.
tableList
[
obj
.
list
[
0
]].
needNumber
return
last
}
if
(
obj
.
list
.
length
>
1
)
{
// 向本地本地储存存入obj
this
.
storeList
.
push
(
obj
)
last
.
index
=
obj
.
list
[
0
]
last
.
needNumber
=
this
.
tableList
[
obj
.
list
[
0
]].
needNumber
return
last
}
}
else
{
this
.
$message
.
error
(
"请输入正确的地址"
)
return
null
;
}
console
.
log
(
'判断tableList中location和search相同的元素个数'
,
obj
.
list
.
length
)
}
// 清空之前的高亮记录
this
.
rowIndexList
=
[]
// 查找匹配项,并将其索引添加到rowIndexList中
for
(
let
i
=
this
.
currentIndex
+
1
;
i
<
this
.
tableList
.
length
;
i
++
)
{
const
item
=
this
.
tableList
[
i
]
if
(
item
.
location
===
keyword
)
{
this
.
rowIndexList
.
push
(
i
)
this
.
total
=
this
.
total
+
item
.
needNumber
// 找到匹配项后,跳出循环
break
},
// 查询回
handleSearch
()
{
const
obj
=
this
.
getIndexAndNeedNumber
(
this
.
searchForm
.
search
)
console
.
log
(
'obj'
,
obj
)
if
(
obj
)
{
const
{
index
,
needNumber
}
=
obj
if
(
!
this
.
rowIndexList
.
includes
(
index
))
{
this
.
rowIndexList
.
push
(
index
)
}
this
.
total
=
this
.
total
+
needNumber
}
// this.tableList.forEach((item, index) => {
// if (item.location === this.searchForm.search) {
// this.rowIndexList.push(index)
// this.total = this.total + item.needNumber
// }
// })
},
// handleSearch() {
// const keyword = this.searchForm.search
// // 如果搜索关键字与上一次相同,则从当前索引的下一个位置开始搜索
// if (keyword === this.SearchKeyword) {
// this.currentIndex++
// } else {
// // 如果搜索关键字发生变化,则重置索引为-1,并更新上一次搜索的关键字
// this.currentIndex = -1
// this.SearchKeyword = keyword
// }
// // 清空之前的高亮记录
// this.rowIndexList = []
// // 查找匹配项,并将其索引添加到rowIndexList中
// for (let i = this.currentIndex + 1; i
<
this
.
tableList
.
length
;
i
++
)
{
// const item = this.tableList[i]
// if (item.location === keyword) {
// this.rowIndexList.push(i)
// this.total = this.total + item.needNumber
// // 找到匹配项后,跳出循环
// break
// }
// }
// },
// 出库
handleSave
()
{
if
(
this
.
total
===
this
.
form
.
qty
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment