Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-app-operator-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-app-operator-master
Commits
f0a1362c
Commit
f0a1362c
authored
Jun 28, 2022
by
ylpmty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品列表多选,商品选择组件增加数据回显
parent
3952fdcb
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
258 additions
and
228 deletions
+258
-228
index.vue
src/components/ProductsSelector/index.vue
+145
-124
index.vue
src/views/ecw/product/index.vue
+100
-80
edit.vue
src/views/ecw/productAttr/edit.vue
+13
-24
No files found.
src/components/ProductsSelector/index.vue
View file @
f0a1362c
<
template
>
<
template
>
<el-row
class=
""
:gutter=
"10"
>
<el-row
class=
""
:gutter=
"10"
>
<el-col
:span=
"10"
>
<el-col
:span=
"10"
>
<el-card>
<el-card>
<div
slot=
"header"
class=
"header"
>
<div
slot=
"header"
class=
"header"
>
<el-select
v-model=
"queryParams.typeId"
placeholder=
"选择类型"
style=
"width:120px"
clearable
>
<el-select
v-model=
"queryParams.typeId"
placeholder=
"选择类型"
style=
"width:120px"
clearable
>
<el-option
v-for=
"item in typeList"
:key=
"item.id"
:label=
"item.titleZh"
:value=
"item.id"
/>
<el-option
v-for=
"item in typeList"
:key=
"item.id"
:label=
"item.titleZh"
:value=
"item.id"
/>
</el-select>
</el-select>
<el-select
v-model=
"queryParams.attrId"
placeholder=
"选择属性"
style=
"width:120px"
clearable
>
<el-select
v-model=
"queryParams.attrId"
placeholder=
"选择属性"
style=
"width:120px"
clearable
>
<el-option
v-for=
"item in attrList"
:key=
"item.id"
:label=
"item.attrName"
:value=
"item.id"
/>
<el-option
v-for=
"item in attrList"
:key=
"item.id"
:label=
"item.attrName"
:value=
"item.id"
/>
</el-select>
</el-select>
<el-input
v-model=
"queryParams.titleZh"
placeholder=
"产品关键字"
style=
"width:120px"
clearable
/>
<el-input
v-model=
"queryParams.titleZh"
placeholder=
"产品关键字"
style=
"width:120px"
clearable
/>
<el-button
type=
"primary"
@
click=
"reLoad"
>
搜搜
</el-button>
<el-button
type=
"primary"
@
click=
"reLoad"
>
搜搜
</el-button>
</div>
</div>
<div
class=
"list"
>
<div
class=
"list"
>
<div
class=
"item"
v-for=
"item in list"
:key=
"item.id"
>
<div
class=
"item"
v-for=
"item in list"
:key=
"item.id"
>
<el-checkbox
@
change=
"toggleCheck(item, $event)"
:value=
"ids.indexOf(item.id) > -1"
/>
{{
item
.
titleZh
}}
<el-checkbox
@
change=
"toggleCheck(item, $event)"
:value=
"ids.indexOf(item.id) > -1"
/>
{{
item
.
titleZh
}}
<div>
{{
item
.
titleEn
}}
</div>
<div>
{{
item
.
titleEn
}}
</div>
</div>
</div>
</div>
</div>
</el-card>
</el-card>
</el-col>
</el-col>
<el-col
:span=
"10"
>
<el-col
:span=
"10"
>
<el-card>
<el-card>
<div
slot=
"header"
class=
"header"
>
<div
slot=
"header"
class=
"header"
>
已选产品
已选产品
</div>
</div>
<div
class=
"list"
>
<div
class=
"list"
>
<div
class=
"item"
v-for=
"(choosed) in choosedList"
:key=
"choosed.id"
:data-data=
"JSON.stringify(choosed)"
>
<div
class=
"item"
v-for=
"(choosed) in choosedList"
:key=
"choosed.id"
:data-data=
"JSON.stringify(choosed)"
>
<el-link
class=
"el-icon-delete"
@
click=
"remove(choosed)"
/>
{{
choosed
.
titleZh
}}
<el-link
class=
"el-icon-delete"
@
click=
"remove(choosed)"
/>
{{
choosed
.
titleZh
}}
<div>
{{
choosed
.
titleEn
}}
</div>
<div>
{{
choosed
.
titleEn
}}
</div>
</div>
</div>
</div>
</div>
</el-card>
</el-card>
</el-col>
</el-col>
</el-row>
</el-row>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
getProductPage
}
from
'
@/api/ecw/product
'
import
{
getProductPage
}
from
'
@/api/ecw/product
'
import
{
getProductTypeList
}
from
'
@/api/ecw/productType
'
import
{
getProductTypeList
}
from
'
@/api/ecw/productType
'
import
{
getProductAttrList
}
from
'
@/api/ecw/productAttr
'
import
{
getProductAttrList
}
from
'
@/api/ecw/productAttr
'
export
default
{
export
default
{
data
(){
props
:
{
return
{
defaultIds
:
{
list
:[],
type
:
Array
,
page
:
1
,
default
:
[]
pages
:
1
,
}
queryParams
:{
},
page
:
1
,
data
()
{
attrId
:
null
,
return
{
titleZh
:
null
,
list
:
[],
typeId
:
null
page
:
1
,
},
pages
:
1
,
choosedList
:[],
queryParams
:
{
typeList
:[],
page
:
1
,
attrList
:[]
attrId
:
null
,
}
titleZh
:
null
,
typeId
:
null
},
choosedList
:
[],
typeList
:
[],
attrList
:
[]
}
},
computed
:
{
ids
:
{
get
()
{
let
arr
=
[]
this
.
choosedList
.
forEach
(
item
=>
{
arr
.
push
(
item
.
id
)
})
return
arr
},
set
(
v
)
{
}
}
},
watch
:
{
ids
(
val
)
{
this
.
$emit
(
'
input
'
,
val
)
}
},
created
()
{
getProductTypeList
().
then
(
res
=>
this
.
typeList
=
res
.
data
)
getProductAttrList
().
then
(
res
=>
this
.
attrList
=
res
.
data
)
this
.
reLoad
()
this
.
ids
=
this
.
defaultIds
//数据回显
},
methods
:
{
reLoad
()
{
this
.
queryParams
.
page
=
1
this
.
list
=
[]
this
.
getList
()
},
},
computed
:{
loadNextPage
()
{
ids
(){
if
(
this
.
page
>=
this
.
pages
)
{
let
arr
=
[]
return
this
.
$message
.
error
(
'
已加载全部
'
)
this
.
choosedList
.
forEach
(
item
=>
{
}
arr
.
push
(
item
.
id
)
this
.
queryParams
.
page
++
this
.
getList
()
},
getList
()
{
getProductPage
(
this
.
queryParams
).
then
(
res
=>
{
this
.
list
=
res
.
data
.
list
//.concat(res.data.list || [])
this
.
page
=
res
.
data
.
page
this
.
pages
=
res
.
data
.
pages
this
.
choosedList
=
[]
//搜搜重置,数据回显
if
(
this
.
defaultIds
.
length
>
0
)
{
this
.
defaultIds
.
map
(
item
=>
{
this
.
list
.
map
(
items
=>
{
if
(
items
.
id
==
item
)
{
this
.
choosedList
.
push
(
items
)
}
})
})
return
arr
})
}
}
})
},
},
watch
:{
toggleCheck
(
item
,
checked
)
{
ids
(
val
){
if
(
checked
)
{
this
.
$emit
(
'
input
'
,
val
)
this
.
choose
(
item
)
}
}
else
{
this
.
remove
(
item
)
}
},
},
created
(){
choose
(
item
)
{
getProductTypeList
().
then
(
res
=>
this
.
typeList
=
res
.
data
)
this
.
choosedList
.
push
(
item
)
getProductAttrList
().
then
(
res
=>
this
.
attrList
=
res
.
data
)
this
.
reLoad
()
},
},
methods
:{
remove
(
item
)
{
reLoad
(){
this
.
choosedList
.
forEach
((
choosed
,
index
)
=>
{
this
.
queryParams
.
page
=
1
if
(
choosed
.
id
==
item
.
id
)
this
.
choosedList
.
splice
(
index
,
1
)
this
.
list
=
[]
})
this
.
getList
()
},
loadNextPage
(){
if
(
this
.
page
>=
this
.
pages
){
return
this
.
$message
.
error
(
'
已加载全部
'
)
}
this
.
queryParams
.
page
++
this
.
getList
()
},
getList
(){
getProductPage
(
this
.
queryParams
).
then
(
res
=>
{
this
.
list
=
res
.
data
.
list
//.concat(res.data.list || [])
this
.
page
=
res
.
data
.
page
this
.
pages
=
res
.
data
.
pages
})
},
toggleCheck
(
item
,
checked
){
if
(
checked
){
this
.
choose
(
item
)
}
else
{
this
.
remove
(
item
)
}
},
choose
(
item
){
this
.
choosedList
.
push
(
item
)
},
remove
(
item
){
this
.
choosedList
.
forEach
((
choosed
,
index
)
=>
{
if
(
choosed
.
id
==
item
.
id
)
this
.
choosedList
.
splice
(
index
,
1
)
})
}
}
}
}
}
}
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
.header
{
.header
{
>
div
{
>
div
{
margin-right
:
5px
;
margin-right
:
5px
;
}
}
}
}
.list
{
.list
{
height
:
200px
;
height
:
200px
;
border
:
1px
solid
#ccc
;
border
:
1px
solid
#ccc
;
overflow-y
:
auto
;
overflow-y
:
auto
;
overflow-x
:
hidden
;
overflow-x
:
hidden
;
padding
:
0
10px
;
padding
:
0
10px
;
display
:
flex
;
display
:
flex
;
flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
.item
{
.item
{
width
:
50%
;
width
:
50%
;
line-height
:
20px
;
line-height
:
20px
;
height
:
50px
;
height
:
50px
;
white-space
:
nowrap
;
white-space
:
nowrap
;
overflow
:
hidden
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
text-overflow
:
ellipsis
;
}
}
}
}
</
style
>
</
style
>
\ No newline at end of file
src/views/ecw/product/index.vue
View file @
f0a1362c
This diff is collapsed.
Click to expand it.
src/views/ecw/productAttr/edit.vue
View file @
f0a1362c
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"120px"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"120px"
>
<el-form-item
label=
"适用商品"
prop=
"idList"
v-if=
"form.type != 1"
>
<el-form-item
label=
"适用商品"
prop=
"idList"
>
<products-selector
v-model=
"form.idList"
/>
<products-selector
:defaultIds=
"form.idList"
v-model=
"form.idList"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"货柜位置"
prop=
"containerLocation"
>
<el-form-item
label=
"货柜位置"
prop=
"containerLocation"
>
...
@@ -36,10 +36,10 @@
...
@@ -36,10 +36,10 @@
<el-checkbox
style=
"width: 100px"
v-model=
"checked[6]"
>
需要修改
</el-checkbox>
<el-checkbox
style=
"width: 100px"
v-model=
"checked[6]"
>
需要修改
</el-checkbox>
<dict-selector
v-if=
"checked[6]"
form-type=
"checkbox"
:type=
"DICT_TYPE.ECW_ORDER_ATTR"
v-model=
"form.attrId"
multiple
/>
<dict-selector
v-if=
"checked[6]"
form-type=
"checkbox"
:type=
"DICT_TYPE.ECW_ORDER_ATTR"
v-model=
"form.attrId"
multiple
/>
</el-form-item>
</el-form-item>
<
!-- <el-form-item label="商品材质" prop="
">
<
el-form-item
label=
"商品材质"
prop=
"materialType
"
>
<el-checkbox
style=
"width: 100px"
v-model=
"checked[7]"
>
需要修改
</el-checkbox>
<el-checkbox
style=
"width: 100px"
v-model=
"checked[7]"
>
需要修改
</el-checkbox>
<dict-selector v-if="checked[7]" form-type="checkbox" :type="DICT_TYPE.ECW_PRODUCT_MATERIAL" v-model="form.
status
" multiple />
<dict-selector
v-if=
"checked[7]"
form-type=
"checkbox"
:type=
"DICT_TYPE.ECW_PRODUCT_MATERIAL"
v-model=
"form.
materialType
"
multiple
/>
</el-form-item>
-->
</el-form-item>
<el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
...
@@ -75,11 +75,12 @@ export default {
...
@@ -75,11 +75,12 @@ export default {
"
needBook
"
:
undefined
,
"
needBook
"
:
undefined
,
"
packaging
"
:
undefined
,
"
packaging
"
:
undefined
,
"
requirements
"
:
undefined
,
"
requirements
"
:
undefined
,
"
square
"
:
undefined
"
square
"
:
undefined
,
"
materialType
"
:
undefined
},
},
// 表单校验
// 表单校验
rules
:
{},
rules
:
{},
checked
:
[
false
,
false
,
false
,
false
,
false
,
false
,
false
]
checked
:
[
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
]
};
};
},
},
computed
:
{
computed
:
{
...
@@ -88,7 +89,7 @@ export default {
...
@@ -88,7 +89,7 @@ export default {
watch
:
{
watch
:
{
'
form.idList
'
(
val
)
{
'
form.idList
'
(
val
)
{
if
(
val
.
length
>
0
)
{
if
(
val
.
length
>
0
)
{
this
.
form
.
isAllProduct
=
undefined
this
.
form
.
isAllProduct
=
0
}
else
{
}
else
{
this
.
form
.
isAllProduct
=
1
this
.
form
.
isAllProduct
=
1
}
}
...
@@ -96,6 +97,7 @@ export default {
...
@@ -96,6 +97,7 @@ export default {
},
},
created
()
{
created
()
{
this
.
reset
()
this
.
reset
()
this
.
form
.
idList
=
this
.
$route
.
query
&&
this
.
$route
.
query
.
ids
?
[...
this
.
$route
.
query
.
ids
].
map
(
item
=>
{
return
Number
(
item
)
})
:
[]
},
},
methods
:
{
methods
:
{
/** 表单重置 */
/** 表单重置 */
...
@@ -109,7 +111,8 @@ export default {
...
@@ -109,7 +111,8 @@ export default {
"
needBook
"
:
undefined
,
"
needBook
"
:
undefined
,
"
packaging
"
:
undefined
,
"
packaging
"
:
undefined
,
"
requirements
"
:
undefined
,
"
requirements
"
:
undefined
,
"
square
"
:
undefined
"
square
"
:
undefined
,
"
materialType
"
:
undefined
};
};
this
.
resetForm
(
"
form
"
);
this
.
resetForm
(
"
form
"
);
},
},
...
@@ -129,18 +132,4 @@ export default {
...
@@ -129,18 +132,4 @@ export default {
},
},
},
},
};
};
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
\ No newline at end of file
.fee-item
{
padding
:
5px
0
;
>
div
{
margin-right
:
5px
;
}
}
.coupon-list
{
max-height
:
200px
;
border
:
1px
solid
#ccc
;
padding
:
10px
;
overflow-y
:
auto
;
}
</
style
>
\ No newline at end of file
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