Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-web
/
glsx-oss-account
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 95fca181
authored
Jul 30, 2021
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of 192.168.3.233:glsx-web/glsx-oss-account
2 parents
436c4193
e86bcbbe
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
538 additions
and
101 deletions
src/api/productManage.js
src/components/glsx-combi-form/index.vue
src/views/productManage/components/OwnCusCom.vue
src/views/productManage/components/SelectTree.vue
src/views/productManage/functionList/app.js
src/views/productManage/functionList/index.vue
src/views/productManage/menuList/index.vue
src/views/productManage/productList/app.js
src/views/productManage/productList/index.vue
src/api/productManage.js
View file @
95fca18
import
request
from
'./request'
import
request
from
'./request'
const
path
=
'cn.com.glsx.merchants.'
const
path
=
'cn.com.glsx.merchants.'
export
const
baseApi
=
{
// 获取所有产品
getAllProduct
(
data
=
{})
{
data
.
method
=
`
${
path
}
product.findProduct`
return
request
(
data
)
},
// 所有字典
getAllDictApi
(
data
=
{})
{
data
.
method
=
`
${
path
}
menu.findAllDictData`
return
request
(
data
)
},
// 所有菜单树
getMenuTree
(
data
=
{})
{
data
.
method
=
`
${
path
}
menu.findMerProMenuTreeRemote`
return
request
(
data
)
}
}
// 产品
// 产品
export
const
productApi
=
{
export
const
productApi
=
{
/** 获取财务管理列表*/
/** 获取财务管理列表*/
getListApi
(
data
=
{})
{
getListApi
(
data
=
{})
{
data
.
method
=
`
${
path
}
product.findProductByPage`
data
.
method
=
`
${
path
}
product.findProductByPage`
return
request
(
data
)
return
request
(
data
)
},
/** 新增产品 */
saveProApi
(
data
=
{})
{
data
.
method
=
`
${
path
}
product.saveProduct`
return
request
(
data
)
}
}
}
}
// 菜单
// 菜单
...
...
src/components/glsx-combi-form/index.vue
View file @
95fca18
...
@@ -2,8 +2,9 @@
...
@@ -2,8 +2,9 @@
<
template
>
<
template
>
<div
class=
"glsx-combi-form"
>
<div
class=
"glsx-combi-form"
>
<el-form
<el-form
:ref=
"formRef"
:inline=
"true"
:inline=
"true"
v-
model=
"formObj"
:
model=
"formObj"
:label-width=
"labelWidth"
:label-width=
"labelWidth"
:rules=
"formRules"
:rules=
"formRules"
size=
"small"
size=
"small"
...
@@ -25,6 +26,8 @@
...
@@ -25,6 +26,8 @@
:maxlength=
"item.maxlength"
:maxlength=
"item.maxlength"
:clearable=
"item.isClear || false"
:clearable=
"item.isClear || false"
:type=
"item.inputType || 'text'"
:type=
"item.inputType || 'text'"
:style=
"
{ width: item.width || 'auto' }"
:show-word-limit="item.showLimit || false"
@keydown.native="e => handleInputDown(e, item)"
@keydown.native="e => handleInputDown(e, item)"
>
</el-input>
>
</el-input>
<!-- 选择-输入框 -->
<!-- 选择-输入框 -->
...
@@ -167,6 +170,10 @@ export default {
...
@@ -167,6 +170,10 @@ export default {
},
},
props
:
{
props
:
{
formRef
:
{
type
:
String
,
default
:
'formRef'
},
labelWidth
:
{
labelWidth
:
{
type
:
String
,
type
:
String
,
default
:
'85px'
default
:
'85px'
...
...
src/views/productManage/components/OwnCusCom.vue
0 → 100644
View file @
95fca18
<!-- 所属客户群体 - 组件 -->
<
template
>
<div
class=
"flex"
>
<el-select
v-model=
"form[targetItem.name]"
:placeholder=
"'请选择'"
@
change=
"handleTopChange"
>
<el-option
v-for=
"subItem in optionList"
:key=
"subItem[targetItem.optionId]"
:label=
"subItem[targetItem.optionLabel]"
:value=
"subItem[targetItem.optionId]"
></el-option>
</el-select>
<el-input
v-show=
"['3'].includes(form[targetItem.name])"
v-model=
"form.ownCusSub"
placeholder=
"请输入商户/门店ID"
></el-input>
<el-select
v-show=
"['1', '2', '4'].includes(form[targetItem.name])"
v-model=
"form.ownCusSub"
:multiple=
"targetItem.multiple || false"
>
<el-option
v-for=
"subItem in baseData[attrToList[form[targetItem.name]]]"
:key=
"subItem.dictValue"
:label=
"subItem.dictLabel"
:value=
"subItem.dictValue"
></el-option>
</el-select>
</div>
</
template
>
<
script
>
export
default
{
name
:
'OwnCusCom'
,
data
()
{
return
{
subVal
:
{
input
:
''
,
mutiSelect
:
[]
},
// 下拉框对应List
attrToList
:
{
'1'
:
'accounTypetList'
,
'2'
:
'accountLevelList'
,
'4'
:
'accountRoleList'
}
}
},
props
:
{
targetItem
:
{
type
:
Object
,
default
:
()
=>
{
}
},
form
:
{
type
:
Object
,
default
:
()
=>
{
}
},
optionList
:
{
type
:
Array
,
default
:
()
=>
[]
},
baseData
:
{
type
:
Object
,
default
:
()
=>
{
}
}
},
mounted
()
{
// console.log(this.targetItem)F
},
methods
:
{
handleTopChange
()
{
this
.
form
.
ownCusSub
=
[
'3'
].
includes
(
this
.
form
[
this
.
targetItem
.
name
])
?
''
:
[]
}
}
}
</
script
>
<
style
scoped
>
.flex
{
display
:
flex
;
}
</
style
>
\ No newline at end of file
\ No newline at end of file
src/views/productManage/components/SelectTree.vue
0 → 100644
View file @
95fca18
<!-- 树形搜索 -->
<
template
>
<div>
<el-popover
ref=
"popover"
placement=
"bottom-start"
trigger=
"click"
@
show=
"onShowPopover"
@
hide=
"onHidePopover"
>
<el-tree
ref=
"tree"
class=
"select-tree"
highlight-current
:style=
"`min-width: $
{treeWidth}`"
:data="treeData"
:props="defaultProps"
:filter-node-method="handleFilterNode"
@node-click="handleNodeClick"
>
</el-tree>
<el-input
slot=
"reference"
ref=
"input"
v-model=
"form[targetItem.name]"
clearable
:style=
"`width: $
{width}px`"
:class="{ 'rotate': showStatus }"
suffix-icon="el-icon-arrow-down"
:placeholder="'请选择' + targetItem.label"
>
</el-input>
</el-popover>
</div>
</
template
>
<
script
>
export
default
{
name
:
'SelectTree'
,
data
()
{
return
{
// 输入框显示值
labelModel
:
''
,
// 树状菜单显示状态
showStatus
:
false
,
treeWidth
:
'auto'
}
},
props
:
{
// 输入框宽度
width
:
String
,
form
:
{
type
:
Object
,
default
:
()
=>
{
}
},
targetItem
:
{
type
:
Object
,
default
:
()
=>
{
}
},
treeData
:
{
type
:
Array
,
default
:
()
=>
[]
},
defaultProps
:
{
type
:
Object
,
default
:
()
=>
({
parent
:
'parentId'
,
value
:
'rowGuid'
,
label
:
'areaName'
,
children
:
'children'
})
}
},
// watch: {
// labelModel(val) {
// if (!val) {
// this.valueModel = ''
// }
// this.$refs.tree.filter(val)
// },
// value(val) {
// this.labelModel = this.queryTree(this.data, val)
// }
// },
created
()
{
// 检测输入框原有值并显示对应 label
if
(
this
.
value
)
{
this
.
labelModel
=
this
.
queryTree
(
this
.
data
,
this
.
value
)
}
// 获取输入框宽度同步至树状菜单宽度
this
.
$nextTick
(()
=>
{
this
.
treeWidth
=
`
${(
this
.
width
||
this
.
$refs
.
input
.
$refs
.
input
.
clientWidth
)
-
24
}
px`
})
},
mounted
()
{
},
methods
:
{
// 显示时触发
onShowPopover
()
{
this
.
showStatus
=
true
// this.$refs.tree.filter(false)
},
// 隐藏时触发
onHidePopover
()
{
this
.
showStatus
=
false
},
// 树节点过滤方法
handleFilterNode
(
query
,
data
)
{
if
(
!
query
)
return
true
return
data
[
this
.
defaultProps
.
label
].
indexOf
(
query
)
!==
-
1
},
handleNodeClick
(
val
)
{
this
.
$emit
(
'selected'
,
{
val
:
val
,
targetItem
:
this
.
targetItem
,
formName
:
this
.
targetItem
.
formName
})
}
}
}
</
script
>
<
style
>
.el-input.el-input--suffix.rotate
.el-input__suffix
.el-icon-arrow-down
{
transform
:
rotate
(
-180deg
);
}
/* .select-tree {
max-height: 350px;
overflow-y: scroll;
} */
</
style
>
\ No newline at end of file
\ No newline at end of file
src/views/productManage/functionList/app.js
View file @
95fca18
import
App
from
'./index.vue'
import
base
from
'@/base'
import
base
from
'@/base'
import
GlsxVueCommon
from
'glsx-vue-common'
import
GlsxVueCommon
from
'glsx-vue-common'
base
.
getConfig
().
then
(
data
=>
{
const
Apps
=
require
.
context
(
'./'
,
false
,
/
\.
vue$/
)
const
{
vue
,
config
}
=
data
vue
.
use
(
GlsxVueCommon
,
config
)
Apps
.
keys
().
map
(
item
=>
{
base
.
render
(
App
)
base
.
getConfig
().
then
(
data
=>
{
const
{
vue
,
config
}
=
data
vue
.
use
(
GlsxVueCommon
,
config
)
base
.
render
(
Apps
(
item
).
default
)
})
})
})
src/views/productManage/functionList/index.vue
View file @
95fca18
...
@@ -12,6 +12,29 @@
...
@@ -12,6 +12,29 @@
:searchSelectObj=
"searchSelectObj"
:searchSelectObj=
"searchSelectObj"
:formData=
"searchFormData"
:formData=
"searchFormData"
>
>
<template
slot=
"menuTree"
slot-scope=
"scope"
>
<select-tree
:form=
"searchForm"
:targetItem=
"scope.scope"
:treeData=
"baseData.menuTreeList"
:defaultProps=
"treeDefaultProps"
@
selected=
"handleTreeSelect"
></select-tree>
</
template
>
<
template
slot=
"ownCusCom"
slot-scope=
"scope"
>
<own-cus-com
:targetItem=
"scope.scope"
:form=
"searchForm"
:optionList=
"baseData.ownCusList"
:baseData=
"baseData"
></own-cus-com>
</
template
>
<el-button
<el-button
size=
"small"
size=
"small"
type=
"primary"
type=
"primary"
...
@@ -20,10 +43,11 @@
...
@@ -20,10 +43,11 @@
</glsx-combi-form>
</glsx-combi-form>
<glsx-table
<glsx-table
ref=
"functionTable"
ref=
"functionTable"
:searchForm=
"
s
earchForm"
:searchForm=
"
tableS
earchForm"
:tableParams=
"tableParams"
:tableParams=
"tableParams"
:pageConf=
"pageConf"
:pageConf=
"pageConf"
:getListApi=
"getListApi"
:getListApi=
"getListApi"
:beforeSearchFn=
"beforeSearchFn"
>
>
<el-button
<el-button
slot=
"auth-button"
slot=
"auth-button"
...
@@ -42,10 +66,19 @@
...
@@ -42,10 +66,19 @@
:formData=
"editFormData"
:formData=
"editFormData"
:formRules=
"editRule"
:formRules=
"editRule"
>
>
<el-select
slot=
"parentid"
<
template
slot=
"menuTree"
slot-scope=
"scope"
slot-scope=
"scope"
></el-select>
>
<select-tree
:form=
"editForm"
:targetItem=
"scope.scope"
:treeData=
"baseData.menuTreeList"
:defaultProps=
"treeDefaultProps"
@
selected=
"handleTreeSelect"
></select-tree>
</
template
>
</glsx-combi-form>
</glsx-combi-form>
</glsx-dialog>
</glsx-dialog>
</div>
</div>
...
@@ -53,54 +86,74 @@
...
@@ -53,54 +86,74 @@
<
script
>
<
script
>
import
_
from
'lodash'
import
_
from
'lodash'
import
{
functionApi
}
from
'@/api/productManage'
import
OwnCusCom
from
'../components/OwnCusCom'
import
SelectTree
from
'../components/SelectTree'
import
{
functionApi
,
baseApi
}
from
'@/api/productManage'
export
default
{
export
default
{
name
:
'functionList'
,
name
:
'functionList'
,
data
()
{
data
()
{
return
{
return
{
searchForm
:
{
searchForm
:
{
functionName
:
''
,
functionName
:
''
,
merchantName
:
''
merchantName
:
''
,
ownCus
:
'1'
,
menu
:
''
,
menuId
:
''
,
ownCusSub
:
[],
productId
:
[]
},
},
tableSearchForm
:
{},
searchSelectObj
:
{
searchSelectObj
:
{
funcOrName
:
{
funcOrName
:
{
attr
:
'functionName'
,
attr
:
'functionName'
,
value
:
''
value
:
''
}
}
},
},
oldVal
:
{
productId
:
[]
},
searchFormData
:
[{
searchFormData
:
[{
label
:
'产品'
,
label
:
'产品'
,
name
:
'productId'
,
name
:
'productId'
,
type
:
'select'
,
type
:
'select'
,
multiple
:
true
,
multiple
:
true
,
optionList
:
[],
optionList
:
[],
optionId
:
'confId'
,
optionId
:
'dictValue'
,
optionLabel
:
'confLabel'
,
optionLabel
:
'dictLabel'
,
optionsName
:
'productList'
optionsName
:
'productList'
,
changeAttr
:
(
value
,
targetItem
)
=>
{
if
(
value
.
includes
(
''
))
{
this
.
searchForm
[
targetItem
.
name
]
=
!
this
.
oldVal
[
targetItem
.
name
].
includes
(
''
)
?
targetItem
.
optionList
.
map
(
item
=>
item
.
id
)
:
this
.
searchForm
[
targetItem
.
name
].
filter
(
item
=>
item
!==
''
)
}
else
{
if
(
this
.
oldVal
[
targetItem
.
name
].
includes
(
''
))
{
this
.
searchForm
[
targetItem
.
name
]
=
[]
}
else
if
(
value
.
length
===
(
targetItem
.
optionList
.
length
-
1
))
{
this
.
searchForm
[
targetItem
.
name
].
push
(
''
)
}
}
this
.
oldVal
[
targetItem
.
name
]
=
this
.
searchForm
[
targetItem
.
name
]
}
},
{
},
{
label
:
'菜单'
,
label
:
'菜单'
,
name
:
''
,
name
:
'menu'
,
type
:
'input'
,
addHtml
:
'menuTree'
,
isClear
:
true
,
formName
:
'searchForm'
keyFn
:
this
.
keyDowmGetList
},
{
label
:
'功能属性类型'
,
name
:
''
,
type
:
'input'
,
isClear
:
true
,
keyFn
:
this
.
keyDowmGetList
},
{
},
{
label
:
'商户账户类型'
,
label
:
'商户账户类型'
,
name
:
''
,
name
:
''
,
type
:
'input'
,
type
:
'select'
,
isClear
:
true
,
optionList
:
[],
keyFn
:
this
.
keyDowmGetList
optionId
:
'dictValue'
,
optionLabel
:
'dictLabel'
,
optionsName
:
'accounTypetList'
},
{
},
{
label
:
'所属客户群体'
,
label
:
'所属客户群体'
,
name
:
''
,
name
:
'ownCus'
,
type
:
'input'
,
// 下一级是否多选
isClear
:
true
,
multiple
:
true
,
keyFn
:
this
.
keyDowmGetList
addHtml
:
'ownCusCom'
,
optionId
:
'dictValue'
,
optionLabel
:
'dictLabel'
},
{
},
{
type
:
'selectInput'
,
type
:
'selectInput'
,
selectName
:
'funcOrName'
,
selectName
:
'funcOrName'
,
...
@@ -117,7 +170,7 @@ export default {
...
@@ -117,7 +170,7 @@ export default {
}
}
}],
}],
getListApi
:
functionApi
.
getListApi
,
getListApi
:
functionApi
.
getListApi
,
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNum
er
'
,
totalCount
:
'data.totalCount'
},
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNum'
,
totalCount
:
'data.totalCount'
},
// 表格参数
// 表格参数
tableParams
:
{
tableParams
:
{
btnId
:
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
()
*
1000
),
btnId
:
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
()
*
1000
),
...
@@ -161,13 +214,14 @@ export default {
...
@@ -161,13 +214,14 @@ export default {
name
:
'productId'
,
name
:
'productId'
,
type
:
'select'
,
type
:
'select'
,
optionList
:
[],
optionList
:
[],
optionId
:
'
confId
'
,
optionId
:
'
dictValue
'
,
optionLabel
:
'
conf
Label'
,
optionLabel
:
'
dict
Label'
,
optionsName
:
'productList'
optionsName
:
'productList'
},
{
},
{
label
:
'父级菜单'
,
label
:
'菜单'
,
name
:
'parentid'
,
name
:
'menu'
,
addHtml
:
'parentid'
addHtml
:
'menuTree'
,
formName
:
'editForm'
},
{
},
{
label
:
'功能名称'
,
label
:
'功能名称'
,
name
:
''
,
name
:
''
,
...
@@ -188,34 +242,70 @@ export default {
...
@@ -188,34 +242,70 @@ export default {
name
:
'sort'
,
name
:
'sort'
,
type
:
'input'
type
:
'input'
}],
}],
treeDefaultProps
:
{
children
:
'childlist'
,
label
:
'menuName'
},
// 基本数据
// 基本数据
baseData
:
{
baseData
:
{
productList
:
[{
menuTreeList
:
[],
confId
:
'1'
,
productList
:
[],
confLabel
:
'产品1'
accounTypetList
:
[],
funcAttrList
:
[],
ownCusList
:
[],
accountLevelList
:
[],
accountRoleList
:
[{
dictValue
:
'1'
,
dictLabel
:
'商户'
},
{
},
{
confId
:
'2'
,
dictValue
:
'2'
,
confLabel
:
'产品2'
dictLabel
:
'门店'
},
{
confId
:
'3'
,
confLabel
:
'产品3'
}]
}]
}
}
}
}
},
},
components
:
{
OwnCusCom
,
SelectTree
},
mounted
()
{
mounted
()
{
this
.
getOptionsList
(
'searchFormData'
)
baseApi
.
getMenuTree
().
then
(
res
=>
{
this
.
getOptionsList
(
'editFormData'
,
false
)
this
.
baseData
.
menuTreeList
=
res
.
data
console
.
log
(
this
.
baseData
.
menuTreeList
)
})
this
.
getBaseData
().
then
(
res
=>
{
this
.
getOptionsList
(
'searchFormData'
)
this
.
getOptionsList
(
'editFormData'
,
false
)
})
},
},
methods
:
{
methods
:
{
getBaseData
()
{
// 1.product(产品) 2.account_type(账户类型) 3.(functional_attributes) 功能属性 4.(owned_customer_group)所属客户群 5.channel渠道 6.account_level(商户层级)
return
new
Promise
(
resolve
=>
{
Promise
.
all
([
baseApi
.
getAllDictApi
({
dictType
:
'product'
}),
baseApi
.
getAllDictApi
({
dictType
:
'account_type'
}),
baseApi
.
getAllDictApi
({
dictType
:
'functional_attributes'
}),
baseApi
.
getAllDictApi
({
dictType
:
'owned_customer_group'
})],
baseApi
.
getAllDictApi
({
dictType
:
'account_level'
})).
then
(([
product
,
account
,
funcAttr
,
ownCus
,
accountLevel
])
=>
{
this
.
baseData
.
productList
=
product
.
data
this
.
baseData
.
accounTypetList
=
account
.
data
this
.
baseData
.
funcAttrList
=
funcAttr
.
data
this
.
baseData
.
ownCusList
=
ownCus
.
data
this
.
baseData
.
accountLevelList
=
accountLevel
.
data
resolve
()
})
})
},
keyDowmGetList
()
{
keyDowmGetList
()
{
this
.
$refs
.
productTable
.
refreshTable
()
this
.
$refs
.
productTable
.
refreshTable
()
},
},
getOptionsList
(
formName
,
hasAll
=
true
)
{
getOptionsList
(
formName
,
hasAll
=
true
)
{
this
[
formName
].
forEach
((
item
,
index
)
=>
{
this
[
formName
].
forEach
((
item
,
index
)
=>
{
if
(
item
.
type
===
'select'
)
{
if
(
item
.
type
===
'select'
&&
this
.
baseData
[
item
.
optionsName
].
length
)
{
this
.
$set
(
this
[
formName
][
index
],
'optionList'
,
_
.
cloneDeep
(
this
.
baseData
[
item
.
optionsName
]))
this
.
$set
(
this
[
formName
][
index
],
'optionList'
,
_
.
cloneDeep
(
this
.
baseData
[
item
.
optionsName
]))
if
(
hasAll
&&
this
.
baseData
[
item
.
optionsName
].
length
&&
this
.
baseData
[
item
.
optionsName
][
0
][
this
[
formName
][
index
].
optionLabel
]
!==
'全部'
)
{
if
(
hasAll
&&
this
.
baseData
[
item
.
optionsName
].
length
&&
this
.
baseData
[
item
.
optionsName
][
0
][
this
[
formName
][
index
].
optionLabel
]
!==
'全部'
)
{
const
temp
=
{}
const
temp
=
{}
...
@@ -237,6 +327,7 @@ export default {
...
@@ -237,6 +327,7 @@ export default {
},
},
getParams
()
{
getParams
()
{
var
params
=
_
.
cloneDeep
(
this
.
searchForm
)
var
params
=
_
.
cloneDeep
(
this
.
searchForm
)
params
.
productId
.
includes
(
''
)
&&
(
params
.
productId
=
[])
const
tempParams
=
this
.
getSelectInputParams
()
const
tempParams
=
this
.
getSelectInputParams
()
params
=
{
params
=
{
...
params
,
...
params
,
...
@@ -244,8 +335,18 @@ export default {
...
@@ -244,8 +335,18 @@ export default {
}
}
return
params
return
params
},
},
beforeSearchFn
()
{
return
new
Promise
(
resolve
=>
{
this
.
tableSearchForm
=
this
.
getParams
()
resolve
()
})
},
handleAdd
()
{
handleAdd
()
{
this
.
editVisible
=
!
this
.
editVisible
this
.
editVisible
=
!
this
.
editVisible
},
handleTreeSelect
(
obj
)
{
this
[
obj
.
formName
][
obj
.
targetItem
.
name
]
=
obj
.
val
.
menuName
this
[
obj
.
formName
].
menuId
=
obj
.
val
.
id
}
}
}
}
}
}
...
...
src/views/productManage/menuList/index.vue
View file @
95fca18
...
@@ -27,10 +27,11 @@
...
@@ -27,10 +27,11 @@
</el-row>
</el-row>
<glsx-table
<glsx-table
ref=
"menuTable"
ref=
"menuTable"
:searchForm=
"
s
earchForm"
:searchForm=
"
tableS
earchForm"
:pageConf=
"pageConf"
:pageConf=
"pageConf"
:tableParams=
"tableParams"
:tableParams=
"tableParams"
:getListApi=
"getListApi"
:getListApi=
"getListApi"
:beforeSearchFn=
"beforeSearchFn"
>
>
<span
slot=
"auth-button"
>
<span
slot=
"auth-button"
>
<el-button
type=
"text"
>
修改
</el-button>
<el-button
type=
"text"
>
修改
</el-button>
...
@@ -49,10 +50,22 @@
...
@@ -49,10 +50,22 @@
:formData=
"editFormData"
:formData=
"editFormData"
:formRules=
"editRule"
:formRules=
"editRule"
>
>
<
el-select
<
template
slot=
"
parentid
"
slot=
"
menuTree
"
slot-scope=
"scope"
slot-scope=
"scope"
></el-select>
>
<select-tree
:form=
"editForm"
:targetItem=
"scope.scope"
:treeData=
"baseData.menuTreeList"
:defaultProps=
"treeDefaultProps"
@
selected=
"handleTreeSelect"
></select-tree>
</
template
>
<
template
slot=
"menuIcon"
slot-scope=
"scope"
></
template
>
</glsx-combi-form>
</glsx-combi-form>
</glsx-dialog>
</glsx-dialog>
</div>
</div>
...
@@ -61,7 +74,8 @@
...
@@ -61,7 +74,8 @@
<
script
>
<
script
>
import
_
from
'lodash'
import
_
from
'lodash'
import
{
Util
}
from
'@/common/util'
import
{
Util
}
from
'@/common/util'
import
{
menuApi
}
from
'@/api/productManage'
import
SelectTree
from
'../components/SelectTree'
import
{
menuApi
,
baseApi
}
from
'@/api/productManage'
export
default
{
export
default
{
name
:
'menuList'
,
name
:
'menuList'
,
data
()
{
data
()
{
...
@@ -70,15 +84,31 @@ export default {
...
@@ -70,15 +84,31 @@ export default {
productId
:
[],
productId
:
[],
menuName
:
''
menuName
:
''
},
},
tableSearchForm
:
{},
oldVal
:
{
productId
:
[]
},
searchFormData
:
[{
searchFormData
:
[{
label
:
'产品'
,
label
:
'产品'
,
name
:
'productId'
,
name
:
'productId'
,
type
:
'select'
,
type
:
'select'
,
multiple
:
true
,
multiple
:
true
,
optionList
:
[],
optionList
:
[],
optionId
:
'confId'
,
optionId
:
'dictValue'
,
optionLabel
:
'confLabel'
,
optionLabel
:
'dictLabel'
,
optionsName
:
'productList'
optionsName
:
'productList'
,
changeAttr
:
(
value
,
targetItem
)
=>
{
if
(
value
.
includes
(
''
))
{
this
.
searchForm
[
targetItem
.
name
]
=
!
this
.
oldVal
[
targetItem
.
name
].
includes
(
''
)
?
targetItem
.
optionList
.
map
(
item
=>
item
.
id
)
:
this
.
searchForm
[
targetItem
.
name
].
filter
(
item
=>
item
!==
''
)
}
else
{
if
(
this
.
oldVal
[
targetItem
.
name
].
includes
(
''
))
{
this
.
searchForm
[
targetItem
.
name
]
=
[]
}
else
if
(
value
.
length
===
(
targetItem
.
optionList
.
length
-
1
))
{
this
.
searchForm
[
targetItem
.
name
].
push
(
''
)
}
}
this
.
oldVal
[
targetItem
.
name
]
=
this
.
searchForm
[
targetItem
.
name
]
}
},
{
},
{
label
:
'菜单名称'
,
label
:
'菜单名称'
,
name
:
'menuName'
,
name
:
'menuName'
,
...
@@ -107,7 +137,7 @@ export default {
...
@@ -107,7 +137,7 @@ export default {
prop
:
'menuUrl'
prop
:
'menuUrl'
},
{
},
{
label
:
'父级菜单名'
,
label
:
'父级菜单名'
,
prop
:
''
prop
:
'
parentid
'
},
{
},
{
label
:
'产品名称'
,
label
:
'产品名称'
,
prop
:
''
prop
:
''
...
@@ -122,62 +152,79 @@ export default {
...
@@ -122,62 +152,79 @@ export default {
// 弹窗
// 弹窗
title
:
'创建菜单'
,
title
:
'创建菜单'
,
editVisible
:
false
,
editVisible
:
false
,
editForm
:
{},
editForm
:
{
menu
:
''
,
menuId
:
''
},
editRule
:
{
editRule
:
{
productId
:
[{
required
:
true
,
message
:
'请选择产品'
,
trigger
:
'blur'
}]
productId
:
[{
required
:
true
,
message
:
'请选择产品'
,
trigger
:
'blur'
}]
},
},
treeDefaultProps
:
{
children
:
'childlist'
,
label
:
'menuName'
},
editFormData
:
[{
editFormData
:
[{
label
:
'产品'
,
label
:
'产品'
,
name
:
'productId'
,
name
:
'productId'
,
width
:
'300px'
,
type
:
'select'
,
type
:
'select'
,
optionList
:
[],
optionList
:
[],
optionId
:
'
confId
'
,
optionId
:
'
dictValue
'
,
optionLabel
:
'
conf
Label'
,
optionLabel
:
'
dict
Label'
,
optionsName
:
'productList'
optionsName
:
'productList'
},
{
},
{
label
:
'父级菜单'
,
label
:
'父级菜单'
,
name
:
'parentid'
,
name
:
'menu'
,
addHtml
:
'parentid'
addHtml
:
'menuTree'
,
formName
:
'editForm'
},
{
},
{
label
:
'菜单名称'
,
label
:
'菜单名称'
,
name
:
'menuName'
,
name
:
'menuName'
,
type
:
'input'
,
type
:
'input'
,
width
:
'300px'
,
maxlength
:
15
maxlength
:
15
},
{
},
{
label
:
'菜单地址'
,
label
:
'菜单地址'
,
name
:
'menuUrl'
,
name
:
'menuUrl'
,
width
:
'300px'
,
type
:
'input'
type
:
'input'
},
{
},
{
label
:
'菜单ICON'
label
:
'菜单ICON'
,
name
:
''
,
addHtml
:
'menuIcon'
},
{
},
{
label
:
'菜单排序值'
,
label
:
'菜单排序值'
,
name
:
'sort'
,
name
:
'sort'
,
width
:
'300px'
,
type
:
'input'
type
:
'input'
}],
}],
// 基本数据
// 基本数据
baseData
:
{
baseData
:
{
productList
:
[{
productList
:
[],
confId
:
'1'
,
menuTreeList
:
[]
confLabel
:
'产品1'
},
{
confId
:
'2'
,
confLabel
:
'产品2'
},
{
confId
:
'3'
,
confLabel
:
'产品3'
}]
}
}
}
}
},
},
components
:
{
SelectTree
},
mounted
()
{
mounted
()
{
this
.
getOptionsList
(
'searchFormData'
)
baseApi
.
getAllDictApi
({
dictType
:
'product'
}).
then
(
res
=>
{
this
.
getOptionsList
(
'editFormData'
,
false
)
// console.log(res)
this
.
baseData
.
productList
=
res
.
data
this
.
getOptionsList
(
'searchFormData'
)
this
.
getOptionsList
(
'editFormData'
,
false
)
})
baseApi
.
getMenuTree
().
then
(
res
=>
{
this
.
baseData
.
menuTreeList
=
res
.
data
})
},
},
methods
:
{
methods
:
{
keyDowmGetList
()
{
keyDowmGetList
()
{
this
.
$refs
.
product
Table
.
refreshTable
()
this
.
$refs
.
menu
Table
.
refreshTable
()
},
},
getOptionsList
(
formName
,
hasAll
=
true
)
{
getOptionsList
(
formName
,
hasAll
=
true
)
{
this
[
formName
].
forEach
((
item
,
index
)
=>
{
this
[
formName
].
forEach
((
item
,
index
)
=>
{
...
@@ -192,8 +239,19 @@ export default {
...
@@ -192,8 +239,19 @@ export default {
}
}
})
})
},
},
beforeSearchFn
()
{
return
new
Promise
(
resolve
=>
{
this
.
tableSearchForm
=
_
.
cloneDeep
(
this
.
searchForm
)
this
.
tableSearchForm
.
productId
.
includes
(
''
)
&&
(
this
.
tableSearchForm
.
productId
=
[])
resolve
()
})
},
handleAdd
()
{
handleAdd
()
{
this
.
editVisible
=
!
this
.
editVisible
this
.
editVisible
=
!
this
.
editVisible
},
handleTreeSelect
(
obj
)
{
this
[
obj
.
formName
][
obj
.
targetItem
.
name
]
=
obj
.
val
.
menuName
this
[
obj
.
formName
].
menuId
=
obj
.
val
.
id
}
}
}
}
}
}
...
...
src/views/productManage/productList/app.js
View file @
95fca18
// import App from './index.vue'
// import App from './index.vue'
import
base
from
'@/base'
import
base
from
'@/base'
import
GlsxVueCommon
from
'glsx-vue-common'
import
GlsxVueCommon
from
'glsx-vue-common'
import
notice
from
'@/common/notice'
const
Apps
=
require
.
context
(
'./'
,
false
,
/
\.
vue$/
)
const
Apps
=
require
.
context
(
'./'
,
false
,
/
\.
vue$/
)
...
@@ -11,12 +12,7 @@ Apps.keys().map(item => {
...
@@ -11,12 +12,7 @@ Apps.keys().map(item => {
config
config
}
=
data
}
=
data
vue
.
use
(
GlsxVueCommon
,
config
)
vue
.
use
(
GlsxVueCommon
,
config
)
vue
.
prototype
.
notice
=
notice
base
.
render
(
Apps
(
item
).
default
)
base
.
render
(
Apps
(
item
).
default
)
})
})
})
})
// base.getConfig().then(data => {
// const { vue, config } = data
// vue.use(GlsxVueCommon, config)
// base.render(App)
// })
src/views/productManage/productList/index.vue
View file @
95fca18
<!-- 产品列表 -->
<!-- 产品列表 -->
<
template
>
<
template
>
<div>
<div
class=
"prodect-list"
>
<el-row>
<el-row>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-button
<el-button
...
@@ -40,11 +40,13 @@
...
@@ -40,11 +40,13 @@
<glsx-dialog
<glsx-dialog
:title=
"title"
:title=
"title"
:isVisible=
"editVisible"
:isVisible=
"editVisible"
@
closeDialog=
"handle
Add
"
@
closeDialog=
"handle
EditClose
"
@
confirmDialog=
"handle
Add
"
@
confirmDialog=
"handle
EditConfirm
"
>
>
<glsx-combi-form
<glsx-combi-form
ref=
"editFormRef"
labelWidth=
"100px"
labelWidth=
"100px"
:formRef=
"editChildRef"
:formObj=
"editForm"
:formObj=
"editForm"
:formData=
"editFormData"
:formData=
"editFormData"
:formRules=
"editRule"
:formRules=
"editRule"
...
@@ -68,8 +70,8 @@ export default {
...
@@ -68,8 +70,8 @@ export default {
label
:
'产品名称'
,
label
:
'产品名称'
,
name
:
'productName'
,
name
:
'productName'
,
type
:
'input'
,
type
:
'input'
,
isClear
:
true
,
isClear
:
true
keyFn
:
this
.
keyDowmGetList
//
keyFn: this.keyDowmGetList
}],
}],
getListApi
:
productApi
.
getListApi
,
getListApi
:
productApi
.
getListApi
,
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNumer'
,
totalCount
:
'data.totalCount'
},
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNumer'
,
totalCount
:
'data.totalCount'
},
...
@@ -101,20 +103,29 @@ export default {
...
@@ -101,20 +103,29 @@ export default {
// 弹窗
// 弹窗
title
:
'创建产品'
,
title
:
'创建产品'
,
editVisible
:
false
,
editVisible
:
false
,
editForm
:
{},
editChildRef
:
'editChildRef'
,
editForm
:
{
productName
:
''
,
productType
:
''
,
productDetail
:
''
,
productAddress
:
''
},
editRule
:
{
editRule
:
{
productName
:
[{
required
:
true
,
message
:
'请输入产品名称'
,
trigger
:
'blur'
}]
productName
:
[{
required
:
true
,
message
:
'请输入产品名称'
,
trigger
:
'blur'
}],
productType
:
[{
required
:
true
,
message
:
'请选择产品类型'
,
trigger
:
'change'
}],
productAddress
:
[{
required
:
true
,
message
:
'请输入产品地址'
,
trigger
:
'blur'
}]
},
},
editFormData
:
[{
editFormData
:
[{
label
:
'产品名称'
,
label
:
'产品名称'
,
name
:
'productName'
,
name
:
'productName'
,
type
:
'input'
,
type
:
'input'
,
maxlength
:
15
,
maxlength
:
15
,
isClear
:
true
width
:
'300px'
},
{
},
{
label
:
'产品类型'
,
label
:
'产品类型'
,
name
:
'productType'
,
name
:
'productType'
,
type
:
'select'
,
type
:
'select'
,
width
:
'300px'
,
optionList
:
[],
optionList
:
[],
optionId
:
'confId'
,
optionId
:
'confId'
,
optionLabel
:
'confLabel'
,
optionLabel
:
'confLabel'
,
...
@@ -124,12 +135,14 @@ export default {
...
@@ -124,12 +135,14 @@ export default {
name
:
'productDetail'
,
name
:
'productDetail'
,
type
:
'input'
,
type
:
'input'
,
inputType
:
'textarea'
,
inputType
:
'textarea'
,
maxlength
:
50
maxlength
:
50
,
showLimit
:
true
,
width
:
'300px'
},
{
},
{
label
:
'产品地址'
,
label
:
'产品地址'
,
name
:
'productAddress'
,
name
:
'productAddress'
,
type
:
'input'
,
type
:
'input'
,
isClear
:
true
width
:
'300px'
}],
}],
// 基本数据
// 基本数据
baseData
:
{
baseData
:
{
...
@@ -142,6 +155,9 @@ export default {
...
@@ -142,6 +155,9 @@ export default {
},
{
},
{
confId
:
'3'
,
confId
:
'3'
,
confLabel
:
'企微小程序'
confLabel
:
'企微小程序'
},
{
confId
:
'4'
,
confLabel
:
'H5'
}]
}]
}
}
}
}
...
@@ -170,10 +186,35 @@ export default {
...
@@ -170,10 +186,35 @@ export default {
},
},
handleAdd
()
{
handleAdd
()
{
this
.
editVisible
=
!
this
.
editVisible
this
.
editVisible
=
!
this
.
editVisible
},
handleEditClose
()
{
this
.
editForm
=
{
productName
:
''
,
productType
:
''
,
productDetail
:
''
,
productAddress
:
''
}
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
clearValidate
()
this
.
handleAdd
()
},
handleEditConfirm
()
{
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
if
(
valid
)
{
productApi
.
saveProApi
({
productCode
:
'123'
,
...
this
.
editForm
}).
then
(
res
=>
{
console
.
log
(
res
)
this
.
notice
.
okTips
()
this
.
handleEditClose
()
this
.
keyDowmGetList
()
})
}
})
}
}
}
}
}
}
</
script
>
</
script
>
<
style
scoped
>
<
style
>
.prodect-list
.el-textarea__inner
{
height
:
80px
;
}
</
style
>
</
style
>
\ No newline at end of file
\ No newline at end of file
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