Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9cfc06d9
authored
Feb 29, 2024
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix search bug
1 parent
7c3490c8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
61 deletions
src/views/systemConfig/inStoreGoalsConfig/components/selectCarDialog.vue
src/views/systemConfig/inStoreGoalsConfig/components/selectCarDialog.vue
View file @
9cfc06d
<
template
>
<GLDialog
title=
"选择车系"
mode=
"mid"
:visible
.
sync=
"dialogVisible"
:before-close=
"handleClose"
:close-on-click-modal=
"false"
@
onOk=
"handleConfirm"
@
onCancel=
"handleClose"
>
<GLDialog
title=
"选择车系"
mode=
"mid"
:visible
.
sync=
"dialogVisible"
:before-close=
"handleClose"
:close-on-click-modal=
"false"
@
onOk=
"handleConfirm"
@
onCancel=
"handleClose"
>
<div
class=
"search-wrap"
>
<!--
<el-select
clearable
v-model=
"curbrandName"
@
change=
"changeFilterItem"
filterable
placeholder=
"请选择"
>
<el-option
...
...
@@ -16,72 +10,43 @@
:value=
"item.id"
>
</el-option>
</el-select>
-->
<el-autocomplete
clearable
:debounce=
"1000"
v-model=
"curbrandName"
:fetch-suggestions=
"querySearchAsync"
placeholder=
"请输入内容"
@
select=
"changeFilterItem"
>
</el-autocomplete>
<el-autocomplete
clearable
:debounce=
"1000"
v-model=
"curbrandName"
:fetch-suggestions=
"querySearchAsync"
placeholder=
"请输入内容"
@
select=
"changeFilterItem"
>
</el-autocomplete>
</div>
<div
v-if=
"loading"
class=
"loading-wrap"
>
<img
class=
"loading-img"
:src=
"url"
alt=
""
/>
</div>
<div
class=
"car-container"
v-else
>
<div
class=
"wrap"
>
<div
class=
"item son-brand-wrap"
v-for=
"(item, index) in filterBrandList"
:key=
"item.id"
>
<el-checkbox
v-if=
"!singleChoice"
:disabled=
"!(item.childs && item.childs.length)"
:indeterminate=
"isIndeterminate(item, 1)"
:value=
"isChecked(item, 1)"
<div
class=
"item son-brand-wrap"
v-for=
"(item, index) in filterBrandList"
:key=
"item.id"
>
<el-checkbox
v-if=
"!singleChoice"
:disabled=
"!(item.childs && item.childs.length)"
:indeterminate=
"isIndeterminate(item, 1)"
:value=
"isChecked(item, 1)"
@
change=
"changeBrandStatus($event, item, index)"
></el-checkbox>
<span
:class=
"[
'son-brand-label',
{ curItem: curBrandInfo.id == item.id }
]"
@click="showSonBrandList(item)">
<span
:class=
"[
'son-brand-label',
{ curItem: curBrandInfo.id == item.id }
]" @click="showSonBrandList(item)">
{{
item
.
name
}}
<i
v-if=
"item.childs && item.childs.length"
class=
"el-icon-arrow-right"
></i>
<i
v-if=
"item.childs && item.childs.length"
class=
"el-icon-arrow-right"
></i>
</span>
</div>
</div>
<div
class=
"wrap"
>
<div
class=
"item son-brand-wrap"
v-for=
"(item, index) in sonBrandList"
:key=
"item.id"
>
<el-checkbox
:disabled=
"!(item.childs && item.childs.length)"
:indeterminate=
"isIndeterminate(item, 2)"
:value=
"isChecked(item, 2)"
@
change=
"changeSonBrandStatus($event, item, index)"
></el-checkbox>
<span
:class=
"[
'son-brand-label',
{ curItem: curSonBrandInfo.id == item.id }
]"
@click="showCarSeriesList(item)">
<div
class=
"item son-brand-wrap"
v-for=
"(item, index) in sonBrandList"
:key=
"item.id"
>
<el-checkbox
:disabled=
"!(item.childs && item.childs.length)"
:indeterminate=
"isIndeterminate(item, 2)"
:value=
"isChecked(item, 2)"
@
change=
"changeSonBrandStatus($event, item, index)"
></el-checkbox>
<span
:class=
"[
'son-brand-label',
{ curItem: curSonBrandInfo.id == item.id }
]" @click="showCarSeriesList(item)">
{{
item
.
name
}}
<i
v-if=
"item.childs && item.childs.length"
class=
"el-icon-arrow-right"
></i>
<i
v-if=
"item.childs && item.childs.length"
class=
"el-icon-arrow-right"
></i>
</span>
</div>
</div>
<div
class=
"wrap"
>
<el-checkbox
class=
"item"
v-for=
"item in carSeriesList"
:key=
"item.id"
:value=
"isChecked(item, '3')"
<el-checkbox
class=
"item"
v-for=
"item in carSeriesList"
:key=
"item.id"
:value=
"isChecked(item, '3')"
@
change=
"changeCarSeriesStatus($event, item, index)"
>
{{
item
.
name
}}
</el-checkbox>
</div>
</div>
...
...
@@ -93,7 +58,7 @@ import url from "@/assets/loading.png"
// import { mapState, mapActions } from 'vuex'
import
{
getCarBrandList
}
from
"@api/commodity.js"
export
default
{
name
:
"Select
Store
"
,
name
:
"Select
CarDialog
"
,
data
()
{
return
{
url
,
...
...
@@ -106,7 +71,7 @@ export default {
}
],
curbrandName
:
""
,
// searchList: [], //
搜索列表
searchList
:
[],
//
搜索列表
filterBrandList
:
[],
// 品牌数据
sonBrandList
:
[],
// 子品牌数据
carSeriesList
:
[],
// 车系数据
...
...
@@ -157,6 +122,19 @@ export default {
.
then
((
res
)
=>
{
console
.
log
(
res
)
this
.
filterBrandList
=
res
const
payload
=
res
const
list
=
[]
payload
?.
forEach
(
item
=>
{
list
.
push
({
id
:
`
${
item
.
id
}
`
,
value
:
item
.
name
})
item
.
childs
?.
forEach
(
ele
=>
{
list
.
push
({
id
:
`
${
item
.
id
}
-
${
ele
.
id
}
`
,
value
:
ele
.
name
})
ele
.
childs
?.
forEach
(
o
=>
{
list
.
push
({
id
:
`
${
item
.
id
}
-
${
ele
.
id
}
-
${
o
.
id
}
`
,
value
:
o
.
name
})
})
})
})
this
.
searchList
=
list
this
.
echoDataFn
()
})
.
catch
((
err
)
=>
{
...
...
@@ -165,14 +143,23 @@ export default {
},
querySearchAsync
(
queryString
,
cb
)
{
var
restaurants
=
this
.
searchList
// this.createStateFilter(queryString)
console
.
log
(
queryString
,
restaurants
,
'queryString'
)
var
results
=
queryString
?
restaurants
.
filter
(
this
.
createStateFilter
(
queryString
))
?
restaurants
.
filter
(
state
=>
{
console
.
log
(
state
,
'state'
)
return
state
.
value
.
toLowerCase
().
indexOf
(
queryString
.
toLowerCase
())
>
-
1
})
:
[]
console
.
log
(
results
,
'results'
)
if
(
!
queryString
)
this
.
filterBrandList
=
this
.
carSeriesData
if
(
results
?.
length
>
0
)
cb
(
results
)
},
createStateFilter
(
queryString
)
{
// console.log(queryString, 'queryString')
// debugger
return
(
state
)
=>
{
console
.
log
(
state
,
'state'
)
return
state
.
value
.
toLowerCase
().
indexOf
(
queryString
.
toLowerCase
())
>
-
1
}
},
...
...
@@ -462,7 +449,7 @@ export default {
)
{
return
(
Object
.
keys
(
this
.
selectdData
[
this
.
curBrandInfo
.
id
][
id
])?.
length
!=
len
&&
len
&&
Object
.
keys
(
this
.
selectdData
[
this
.
curBrandInfo
.
id
][
id
])?.
length
!=
0
)
}
else
{
...
...
@@ -504,6 +491,7 @@ export default {
margin-bottom
:
12px
;
.el-input
{
&,
.el-input__inner
{
height
:
36px
;
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment