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
>
<
template
>
<GLDialog
<GLDialog
title=
"选择车系"
mode=
"mid"
:visible
.
sync=
"dialogVisible"
:before-close=
"handleClose"
title=
"选择车系"
:close-on-click-modal=
"false"
@
onOk=
"handleConfirm"
@
onCancel=
"handleClose"
>
mode=
"mid"
:visible
.
sync=
"dialogVisible"
:before-close=
"handleClose"
:close-on-click-modal=
"false"
@
onOk=
"handleConfirm"
@
onCancel=
"handleClose"
>
<div
class=
"search-wrap"
>
<div
class=
"search-wrap"
>
<!--
<el-select
clearable
v-model=
"curbrandName"
@
change=
"changeFilterItem"
filterable
placeholder=
"请选择"
>
<!--
<el-select
clearable
v-model=
"curbrandName"
@
change=
"changeFilterItem"
filterable
placeholder=
"请选择"
>
<el-option
<el-option
...
@@ -16,72 +10,43 @@
...
@@ -16,72 +10,43 @@
:value=
"item.id"
>
:value=
"item.id"
>
</el-option>
</el-option>
</el-select>
-->
</el-select>
-->
<el-autocomplete
<el-autocomplete
clearable
:debounce=
"1000"
v-model=
"curbrandName"
:fetch-suggestions=
"querySearchAsync"
clearable
placeholder=
"请输入内容"
@
select=
"changeFilterItem"
>
:debounce=
"1000"
</el-autocomplete>
v-model=
"curbrandName"
:fetch-suggestions=
"querySearchAsync"
placeholder=
"请输入内容"
@
select=
"changeFilterItem"
>
</el-autocomplete>
</div>
</div>
<div
v-if=
"loading"
class=
"loading-wrap"
>
<div
v-if=
"loading"
class=
"loading-wrap"
>
<img
class=
"loading-img"
:src=
"url"
alt=
""
/>
<img
class=
"loading-img"
:src=
"url"
alt=
""
/>
</div>
</div>
<div
class=
"car-container"
v-else
>
<div
class=
"car-container"
v-else
>
<div
class=
"wrap"
>
<div
class=
"wrap"
>
<div
<div
class=
"item son-brand-wrap"
v-for=
"(item, index) in filterBrandList"
:key=
"item.id"
>
class=
"item son-brand-wrap"
<el-checkbox
v-if=
"!singleChoice"
:disabled=
"!(item.childs && item.childs.length)"
v-for=
"(item, index) in filterBrandList"
:indeterminate=
"isIndeterminate(item, 1)"
:value=
"isChecked(item, 1)"
: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>
@
change=
"changeBrandStatus($event, item, index)"
></el-checkbox>
<span
<span
:class=
"[
:class=
"[
'son-brand-label',
'son-brand-label',
{ curItem: curBrandInfo.id == item.id }
{ curItem: curBrandInfo.id == item.id }
]" @click="showSonBrandList(item)">
]"
@click="showSonBrandList(item)">
{{
item
.
name
}}
{{
item
.
name
}}
<i
<i
v-if=
"item.childs && item.childs.length"
class=
"el-icon-arrow-right"
></i>
v-if=
"item.childs && item.childs.length"
class=
"el-icon-arrow-right"
></i>
</span>
</span>
</div>
</div>
</div>
</div>
<div
class=
"wrap"
>
<div
class=
"wrap"
>
<div
<div
class=
"item son-brand-wrap"
v-for=
"(item, index) in sonBrandList"
:key=
"item.id"
>
class=
"item son-brand-wrap"
<el-checkbox
:disabled=
"!(item.childs && item.childs.length)"
:indeterminate=
"isIndeterminate(item, 2)"
v-for=
"(item, index) in sonBrandList"
:value=
"isChecked(item, 2)"
@
change=
"changeSonBrandStatus($event, item, index)"
></el-checkbox>
:key=
"item.id"
>
<span
:class=
"[
<el-checkbox
'son-brand-label',
:disabled=
"!(item.childs && item.childs.length)"
{ curItem: curSonBrandInfo.id == item.id }
:indeterminate=
"isIndeterminate(item, 2)"
]" @click="showCarSeriesList(item)">
: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
}}
{{
item
.
name
}}
<i
<i
v-if=
"item.childs && item.childs.length"
class=
"el-icon-arrow-right"
></i>
v-if=
"item.childs && item.childs.length"
class=
"el-icon-arrow-right"
></i>
</span>
</span>
</div>
</div>
</div>
</div>
<div
class=
"wrap"
>
<div
class=
"wrap"
>
<el-checkbox
<el-checkbox
class=
"item"
v-for=
"item in carSeriesList"
:key=
"item.id"
:value=
"isChecked(item, '3')"
class=
"item"
v-for=
"item in carSeriesList"
:key=
"item.id"
:value=
"isChecked(item, '3')"
@
change=
"changeCarSeriesStatus($event, item, index)"
>
{{
item
.
name
}}
</el-checkbox>
@
change=
"changeCarSeriesStatus($event, item, index)"
>
{{
item
.
name
}}
</el-checkbox>
</div>
</div>
</div>
</div>
...
@@ -93,7 +58,7 @@ import url from "@/assets/loading.png"
...
@@ -93,7 +58,7 @@ import url from "@/assets/loading.png"
// import { mapState, mapActions } from 'vuex'
// import { mapState, mapActions } from 'vuex'
import
{
getCarBrandList
}
from
"@api/commodity.js"
import
{
getCarBrandList
}
from
"@api/commodity.js"
export
default
{
export
default
{
name
:
"Select
Store
"
,
name
:
"Select
CarDialog
"
,
data
()
{
data
()
{
return
{
return
{
url
,
url
,
...
@@ -106,7 +71,7 @@ export default {
...
@@ -106,7 +71,7 @@ export default {
}
}
],
],
curbrandName
:
""
,
curbrandName
:
""
,
// searchList: [], //
搜索列表
searchList
:
[],
//
搜索列表
filterBrandList
:
[],
// 品牌数据
filterBrandList
:
[],
// 品牌数据
sonBrandList
:
[],
// 子品牌数据
sonBrandList
:
[],
// 子品牌数据
carSeriesList
:
[],
// 车系数据
carSeriesList
:
[],
// 车系数据
...
@@ -157,6 +122,19 @@ export default {
...
@@ -157,6 +122,19 @@ export default {
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
console
.
log
(
res
)
console
.
log
(
res
)
this
.
filterBrandList
=
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
()
this
.
echoDataFn
()
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
...
@@ -165,14 +143,23 @@ export default {
...
@@ -165,14 +143,23 @@ export default {
},
},
querySearchAsync
(
queryString
,
cb
)
{
querySearchAsync
(
queryString
,
cb
)
{
var
restaurants
=
this
.
searchList
var
restaurants
=
this
.
searchList
// this.createStateFilter(queryString)
console
.
log
(
queryString
,
restaurants
,
'queryString'
)
var
results
=
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
(
!
queryString
)
this
.
filterBrandList
=
this
.
carSeriesData
if
(
results
?.
length
>
0
)
cb
(
results
)
if
(
results
?.
length
>
0
)
cb
(
results
)
},
},
createStateFilter
(
queryString
)
{
createStateFilter
(
queryString
)
{
// console.log(queryString, 'queryString')
// debugger
return
(
state
)
=>
{
return
(
state
)
=>
{
console
.
log
(
state
,
'state'
)
return
state
.
value
.
toLowerCase
().
indexOf
(
queryString
.
toLowerCase
())
>
-
1
return
state
.
value
.
toLowerCase
().
indexOf
(
queryString
.
toLowerCase
())
>
-
1
}
}
},
},
...
@@ -462,7 +449,7 @@ export default {
...
@@ -462,7 +449,7 @@ export default {
)
{
)
{
return
(
return
(
Object
.
keys
(
this
.
selectdData
[
this
.
curBrandInfo
.
id
][
id
])?.
length
!=
Object
.
keys
(
this
.
selectdData
[
this
.
curBrandInfo
.
id
][
id
])?.
length
!=
len
&&
len
&&
Object
.
keys
(
this
.
selectdData
[
this
.
curBrandInfo
.
id
][
id
])?.
length
!=
0
Object
.
keys
(
this
.
selectdData
[
this
.
curBrandInfo
.
id
][
id
])?.
length
!=
0
)
)
}
else
{
}
else
{
...
@@ -504,6 +491,7 @@ export default {
...
@@ -504,6 +491,7 @@ export default {
margin-bottom
:
12px
;
margin-bottom
:
12px
;
.el-input
{
.el-input
{
&,
&,
.el-input__inner
{
.el-input__inner
{
height
:
36px
;
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