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 05ec0231
authored
Jul 31, 2021
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
产品,菜单,功能
1 parent
7391b7ed
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
409 additions
and
127 deletions
src/api/productManage.js
src/api/request.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/app.js
src/views/productManage/menuList/index.vue
src/views/productManage/productList/index.vue
src/api/productManage.js
View file @
05ec023
...
...
@@ -13,7 +13,17 @@ export const baseApi = {
},
// 所有菜单树
getMenuTree
(
data
=
{})
{
data
.
method
=
`
${
path
}
menu.findMerProMenuTreeRemote`
data
.
method
=
`
${
path
}
menu.findMerProMenuTree`
return
request
(
data
)
},
// 图片上传
upload
(
url
,
data
=
{})
{
data
.
method
=
'glsx.accounts.biz.common.pictureUpload'
return
request
(
data
,
'post'
,
[
'file'
],
url
)
},
// 获取ICON
getIcon
(
data
=
{})
{
data
.
method
=
`
${
path
}
menu.findMerchantFile`
return
request
(
data
)
}
}
...
...
@@ -27,15 +37,35 @@ export const productApi = {
/** 新增产品 */
saveProApi
(
data
=
{})
{
data
.
method
=
`
${
path
}
product.saveProduct`
return
request
(
data
)
return
request
(
data
,
'post'
)
},
/** 编辑产品 */
updateProApi
(
data
=
{})
{
data
.
method
=
`
${
path
}
product.updateProduct`
return
request
(
data
,
'post'
)
}
}
// 菜单
export
const
menuApi
=
{
/** 获取财务管理列表*/
getListApi
(
data
=
{})
{
data
.
method
=
`
${
path
}
menu.findMerProMenuByPage
Remote
`
data
.
method
=
`
${
path
}
menu.findMerProMenuByPage`
return
request
(
data
)
},
/** 新增菜单 */
saveMenuApi
(
data
=
{})
{
data
.
method
=
`
${
path
}
menu.saveMerchantProductMenu`
return
request
(
data
,
'post'
)
},
// 更新菜单
updateMenuApi
(
data
=
{})
{
data
.
method
=
`
${
path
}
menu.updateMerchantProductMenu`
return
request
(
data
,
'post'
)
},
// 删除菜单
deleteMenuApi
(
data
=
{})
{
data
.
method
=
`
${
path
}
menu.deleteMerchantProductMenu`
return
request
(
data
,
'post'
)
}
}
...
...
@@ -45,5 +75,15 @@ export const functionApi = {
getListApi
(
data
=
{})
{
data
.
method
=
`
${
path
}
menu.findMerchantFunction`
return
request
(
data
)
},
/** 新增功能 */
saveFunApi
(
data
=
{})
{
data
.
method
=
`
${
path
}
menu.saveMerchantFunction`
return
request
(
data
,
'post'
)
},
/** 编辑功能 */
updateFunApi
(
data
=
{})
{
data
.
method
=
`
${
path
}
menu.updateMerchantFunction`
return
request
(
data
,
'post'
)
}
}
src/api/request.js
View file @
05ec023
import
RequestMethods
from
'./request.methods'
import
axios
from
'axios'
import
qs
from
'qs'
// import GlsxVueCommon from 'glsx-vue-common'
import
sign
from
'./sign'
import
{
GlAxios
}
from
'glsx-vue-common'
const
request
=
(
params
=
{},
method
=
RequestMethods
.
GET
,
noSignAttr
=
[])
=>
{
const
request
=
(
params
=
{},
method
=
RequestMethods
.
GET
,
noSignAttr
=
[]
,
url
=
''
)
=>
{
params
.
source
=
'glsx-oss-merchant-data'
params
.
appKey
=
'48e5e13229b82c1b4e6e8c96151f0637'
params
.
timestamp
=
new
Date
().
getTime
()
...
...
@@ -12,6 +14,9 @@ const request = (params = {}, method = RequestMethods.GET, noSignAttr = []) => {
params
.
format
=
'json'
// params.createBy = this.$get_session_config().user.id
var
data
=
sign
(
params
,
noSignAttr
)
if
(
url
)
{
return
axios
.
post
(
`
${
url
}
/router?method=
${
method
}
`
,
qs
.
stringify
(
data
))
}
return
method
===
RequestMethods
.
GET
?
GlAxios
.
get
(
'router'
,
{
params
:
sign
(
params
,
noSignAttr
)
})
:
GlAxios
.
post
(
'router'
,
data
)
...
...
src/components/glsx-combi-form/index.vue
View file @
05ec023
...
...
@@ -18,8 +18,13 @@
:label="item.label ? (item.label + ':') : ''"
:prop="item.name"
>
<slot
v-if=
"item.addHtml"
:name=
"item.addHtml"
:scope=
"item"
></slot>
<el-input
v-if=
"item.type === 'input'"
v-
else-
if=
"item.type === 'input'"
:placeholder=
"item.placeholder || ('请输入' + item.label)"
v-model
.
trim=
"formObj[item.name]"
:disabled=
"item.isDisabled"
...
...
@@ -145,11 +150,6 @@
:picker-options=
"pickerOption[item.pickerOptions]"
>
</el-date-picker>
<slot
v-if=
"item.addHtml"
:name=
"item.addHtml"
:scope=
"item"
></slot>
</el-form-item>
</template>
<slot></slot>
...
...
src/views/productManage/components/OwnCusCom.vue
View file @
05ec023
...
...
@@ -2,9 +2,9 @@
<
template
>
<div
class=
"flex"
>
<el-select
v-model=
"form[targetItem.
name
]"
v-model=
"form[targetItem.
firstVal
]"
:placeholder=
"'请选择'"
@
change=
"handle
TopChange
"
@
change=
"handle
FirstChange('')
"
>
<el-option
v-for=
"subItem in optionList"
...
...
@@ -14,17 +14,19 @@
></el-option>
</el-select>
<el-input
v-show=
"[
'3'].includes(form[targetItem.name
])"
v-model=
"
form.ownCusSub
"
v-show=
"[
3].includes(form[targetItem.firstVal
])"
v-model=
"
subVal.input
"
placeholder=
"请输入商户/门店ID"
@
change=
"handleFirstChange"
></el-input>
<el-select
v-show=
"[
'1', '2', '4'].includes(form[targetItem.name
])"
v-model=
"
form.ownCusSub
"
v-show=
"[
1, 2, 4].includes(form[targetItem.firstVal
])"
v-model=
"
subVal.mutiSelect
"
:multiple=
"targetItem.multiple || false"
@
change=
"handleFirstChange"
>
<el-option
v-for=
"subItem in baseData[attrToList[form[targetItem.
name
]]]"
v-for=
"subItem in baseData[attrToList[form[targetItem.
firstVal
]]]"
:key=
"subItem.dictValue"
:label=
"subItem.dictLabel"
:value=
"subItem.dictValue"
...
...
@@ -71,12 +73,18 @@ export default {
},
mounted
()
{
// console.log(this.targetItem)
F
// console.log(this.targetItem)
},
methods
:
{
handleTopChange
()
{
this
.
form
.
ownCusSub
=
[
'3'
].
includes
(
this
.
form
[
this
.
targetItem
.
name
])
?
''
:
[]
handleFirstChange
(
val
)
{
if
(
!
val
)
{
this
.
subVal
=
{
input
:
''
,
mutiSelect
:
[]
}
}
this
.
$emit
(
'changeSecond'
,
{
val
:
val
,
targetItem
:
this
.
targetItem
})
}
}
}
...
...
src/views/productManage/components/SelectTree.vue
View file @
05ec023
...
...
@@ -21,12 +21,13 @@
<el-input
slot=
"reference"
ref=
"input"
v-model=
"form[targetItem.name]"
v-model=
"form[targetItem.name
Label
]"
clearable
:style=
"`width: $
{width}px`"
:class="{ 'rotate': showStatus }"
suffix-icon="el-icon-arrow-down"
:placeholder="'请选择' + targetItem.label"
@change="handleClear"
>
</el-input>
</el-popover>
...
...
@@ -65,24 +66,32 @@ export default {
type
:
Object
,
default
:
()
=>
({
parent
:
'parentId'
,
value
:
'
rowGu
id'
,
label
:
'
area
Name'
,
children
:
'child
ren
'
value
:
'id'
,
label
:
'
menu
Name'
,
children
:
'child
list
'
})
}
},
// watch: {
// labelModel(val) {
// if (!val) {
// this.valueModel = ''
// }
// this.$refs.tree.filter(val)
// },
// value(val) {
// this.labelModel = this.queryTree(this.data, val)
// }
// },
watch
:
{
labelModel
(
val
)
{
if
(
!
val
)
{
this
.
valueModel
=
''
}
this
.
$refs
.
tree
.
filter
(
val
)
},
value
(
val
)
{
this
.
labelModel
=
this
.
queryTree
(
this
.
data
,
val
)
},
form
(
val
)
{
console
.
log
(
val
)
// this.labelModel = this.form[this.targetItem.name]
if
(
this
.
form
[
this
.
targetItem
.
name
])
{
this
.
form
[
this
.
targetItem
.
nameLabel
]
=
this
.
queryTree
(
this
.
treeData
,
this
.
form
[
this
.
targetItem
.
name
])
// this.$refs.tree.filter(this.form[this.targetItem.nameLabel])
}
}
},
created
()
{
// 检测输入框原有值并显示对应 label
...
...
@@ -95,13 +104,17 @@ export default {
})
},
mounted
()
{
},
mounted
()
{
if
(
this
.
form
[
this
.
targetItem
.
name
])
{
this
.
form
[
this
.
targetItem
.
nameLabel
]
=
this
.
queryTree
(
this
.
treeData
,
this
.
form
[
this
.
targetItem
.
name
])
}
},
methods
:
{
// 显示时触发
onShowPopover
()
{
this
.
showStatus
=
true
//
this.$refs.tree.filter(false)
this
.
$refs
.
tree
.
filter
(
false
)
},
// 隐藏时触发
onHidePopover
()
{
...
...
@@ -114,6 +127,24 @@ export default {
},
handleNodeClick
(
val
)
{
this
.
$emit
(
'selected'
,
{
val
:
val
,
targetItem
:
this
.
targetItem
,
formName
:
this
.
targetItem
.
formName
})
},
handleClear
(
val
)
{
this
.
$emit
(
'selected'
,
{
val
:
val
,
targetItem
:
this
.
targetItem
,
formName
:
this
.
targetItem
.
formName
})
},
// 搜索树状数据中的 ID
queryTree
(
tree
,
id
)
{
let
stark
=
[]
stark
=
stark
.
concat
(
tree
)
while
(
stark
.
length
)
{
const
temp
=
stark
.
shift
()
if
(
temp
[
this
.
defaultProps
.
children
])
{
stark
=
stark
.
concat
(
temp
[
this
.
defaultProps
.
children
])
}
if
(
temp
[
this
.
defaultProps
.
value
]
===
id
)
{
return
temp
[
this
.
defaultProps
.
label
]
}
}
return
}
}
}
...
...
src/views/productManage/functionList/app.js
View file @
05ec023
import
App
from
'./index.vue'
import
base
from
'@/base'
import
GlsxVueCommon
from
'glsx-vue-common'
import
notice
from
'@/common/notice'
base
.
getConfig
().
then
(
data
=>
{
const
{
vue
,
config
}
=
data
vue
.
use
(
GlsxVueCommon
,
config
)
vue
.
prototype
.
notice
=
notice
base
.
render
(
App
)
})
src/views/productManage/functionList/index.vue
View file @
05ec023
...
...
@@ -31,8 +31,9 @@
<own-cus-com
:targetItem=
"scope.scope"
:form=
"searchForm"
:optionList=
"baseData.
o
wnCusList"
:optionList=
"baseData.
searchO
wnCusList"
:baseData=
"baseData"
@
changeSecond=
"changeOwnSecond"
></own-cus-com>
</
template
>
<el-button
...
...
@@ -51,23 +52,26 @@
>
<el-button
slot=
"auth-button"
slot-scope=
"scope"
type=
"text"
@
click=
"handleFunEdit(scope.scope)"
>
编辑
</el-button>
</glsx-table>
<glsx-dialog
:title=
"
title
"
:title=
"
editForm.id ? '编辑功能' : '创建功能'
"
width=
"760px"
:isVisible=
"editVisible"
@
closeDialog=
"handle
Add
"
@
confirmDialog=
"handle
Add
"
@
closeDialog=
"handle
Close
"
@
confirmDialog=
"handle
Confirm
"
>
<glsx-combi-form
ref=
"editFormRef"
labelWidth=
"130px"
:formRef=
"editChildRef"
:formObj=
"editForm"
:formData=
"editFormData"
:formRules=
"editRule"
>
<
template
slot=
"menuTree"
slot-scope=
"scope"
...
...
@@ -108,11 +112,12 @@ export default {
searchForm
:
{
functionName
:
''
,
merchantName
:
''
,
ownCus
:
'1'
,
menu
:
''
,
ownCus
:
1
,
menuId
:
''
,
ownCusSub
:
[],
productId
:
[]
menuName
:
''
,
ownedCusgroupType
:
''
,
ownedCusgroupValue
:
''
,
productIds
:
[]
},
tableSearchForm
:
{},
searchSelectObj
:
{
...
...
@@ -122,11 +127,11 @@ export default {
}
},
oldVal
:
{
productId
:
[]
productId
s
:
[]
},
searchFormData
:
[{
label
:
'产品'
,
name
:
'productId'
,
name
:
'productId
s
'
,
type
:
'select'
,
multiple
:
true
,
optionList
:
[],
...
...
@@ -135,7 +140,7 @@ export default {
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
!==
''
)
this
.
searchForm
[
targetItem
.
name
]
=
!
this
.
oldVal
[
targetItem
.
name
].
includes
(
''
)
?
targetItem
.
optionList
.
map
(
item
=>
item
[
targetItem
.
optionId
]
)
:
this
.
searchForm
[
targetItem
.
name
].
filter
(
item
=>
item
!==
''
)
}
else
{
if
(
this
.
oldVal
[
targetItem
.
name
].
includes
(
''
))
{
this
.
searchForm
[
targetItem
.
name
]
=
[]
...
...
@@ -144,28 +149,35 @@ export default {
}
}
this
.
oldVal
[
targetItem
.
name
]
=
this
.
searchForm
[
targetItem
.
name
]
this
.
tableSearchForm
[
targetItem
.
name
]
=
this
.
searchForm
[
targetItem
.
name
].
includes
(
''
)
?
[]
:
this
.
searchForm
[
targetItem
.
name
]
}
},
{
label
:
'菜单'
,
name
:
'menu'
,
name
:
'menuId'
,
nameLabel
:
'menuName'
,
addHtml
:
'menuTree'
,
formName
:
'searchForm'
},
{
label
:
'商户账户类型'
,
name
:
''
,
type
:
'select'
,
optionList
:
[],
optionId
:
'dictValue'
,
optionLabel
:
'dictLabel'
,
optionsName
:
'accounTypetList'
},
{
},
// {
// label: '商户账户类型',
// name: '',
// type: 'select',
// optionList: [],
// optionId: 'dictValue',
// optionLabel: 'dictLabel',
// optionsName: 'accounTypetList'
// },
{
label
:
'所属客户群体'
,
name
:
'ownCus'
,
firstVal
:
'ownedCusgroupType'
,
secondVal
:
'ownedCusgroupValue'
,
// 下一级是否多选
multiple
:
true
,
addHtml
:
'ownCusCom'
,
optionId
:
'dictValue'
,
optionLabel
:
'dictLabel'
optionLabel
:
'dictLabel'
,
formName
:
'searchForm'
},
{
type
:
'selectInput'
,
selectName
:
'funcOrName'
,
...
...
@@ -215,47 +227,73 @@ export default {
}]
},
// 弹窗
title
:
'创建
产品
'
,
title
:
'创建
功能
'
,
editVisible
:
false
,
editChildRef
:
'editChildRef'
,
editForm
:
{},
editRule
:
{
productName
:
[{
required
:
true
,
message
:
'请输入产品名称'
,
trigger
:
'blur'
}]
productId
:
[{
required
:
true
,
message
:
'请选择产品名称'
,
trigger
:
'change'
}],
menuId
:
[{
required
:
true
,
message
:
'请选择菜单'
,
trigger
:
'change'
}],
functionName
:
[{
required
:
true
,
message
:
'请输入功能名称'
,
trigger
:
'blur'
}],
functionAttributeName
:
[{
required
:
true
,
message
:
'请输入功能属性名'
,
trigger
:
'blur'
}],
functionType
:
[{
required
:
true
,
message
:
'请选择功能属性类型'
,
trigger
:
'change'
}],
// productId: [{ required: true, message: '请输入产品名称', trigger: 'blur' }],
functionValue
:
[{
required
:
true
,
message
:
'请输入功能值'
,
trigger
:
'blur'
}],
sort
:
[{
required
:
true
,
message
:
'请输入排序值'
,
trigger
:
'blur'
}]
},
editFormData
:
[{
label
:
'产品'
,
name
:
'productId'
,
type
:
'select'
,
width
:
'400px'
,
optionList
:
[],
optionId
:
'dictValue'
,
optionLabel
:
'dictLabel'
,
optionsName
:
'productList'
},
{
label
:
'菜单'
,
name
:
'menu'
,
name
:
'menuId'
,
nameLabel
:
'menuName'
,
addHtml
:
'menuTree'
,
formName
:
'editForm'
},
{
label
:
'功能名称'
,
name
:
''
,
name
:
'functionName'
,
width
:
'400px'
,
type
:
'input'
,
maxlength
:
15
},
{
label
:
'功能属性名'
,
name
:
''
,
name
:
'functionAttributeName '
,
width
:
'400px'
,
type
:
'input'
},
{
label
:
'功能属性类型'
,
name
:
'functionType'
,
width
:
'400px'
,
type
:
'select'
,
optionList
:
[],
optionId
:
'dictValue'
,
optionLabel
:
'dictLabel'
,
optionsName
:
'funcAttrList'
},
{
label
:
'所属客户群体'
,
name
:
'ownCus'
,
firstVal
:
'ownedCusgroupType'
,
secondVal
:
'ownedCusgroupValue'
,
addHtml
:
'ownCusCom'
,
optionId
:
'dictValue'
,
optionLabel
:
'dictLabel'
optionLabel
:
'dictLabel'
,
formName
:
'editForm'
},
{
label
:
'功能值'
,
name
:
''
,
name
:
'functionValue'
,
width
:
'400px'
,
type
:
'input'
},
{
label
:
'排序值'
,
name
:
'sort'
,
width
:
'400px'
,
type
:
'input'
}],
treeDefaultProps
:
{
...
...
@@ -268,6 +306,7 @@ export default {
productList
:
[],
accounTypetList
:
[],
funcAttrList
:
[],
searchOwnCusList
:
[],
ownCusList
:
[],
accountLevelList
:
[],
accountRoleList
:
[{
...
...
@@ -305,12 +344,17 @@ export default {
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
])
=>
{
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
.
searchOwnCusList
=
ownCus
.
data
this
.
baseData
.
searchOwnCusList
.
unshift
({
dictValue
:
''
,
dictLabel
:
'全部'
})
this
.
baseData
.
accountLevelList
=
accountLevel
.
data
resolve
()
})
...
...
@@ -343,7 +387,7 @@ export default {
},
getParams
()
{
var
params
=
_
.
cloneDeep
(
this
.
searchForm
)
params
.
productId
.
includes
(
''
)
&&
(
params
.
productId
=
[])
params
.
productId
s
.
includes
(
''
)
&&
(
params
.
productIds
=
[])
const
tempParams
=
this
.
getSelectInputParams
()
params
=
{
...
params
,
...
...
@@ -360,9 +404,35 @@ export default {
handleAdd
()
{
this
.
editVisible
=
!
this
.
editVisible
},
handleFunEdit
(
row
)
{
this
.
editForm
=
_
.
cloneDeep
(
row
)
this
.
handleAdd
()
},
handleClose
()
{
this
.
editForm
=
{}
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
clearValidate
()
this
.
handleAdd
()
},
handleConfirm
()
{
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
if
(
valid
)
{
var
apiName
=
this
.
editForm
.
id
?
'updateFunApi'
:
'saveFunApi'
functionApi
[
apiName
](
this
.
editForm
).
then
(
res
=>
{
if
(
res
.
code
===
'0'
)
{
this
.
notice
.
okTips
()
this
.
handleClose
()
this
.
keyDowmGetList
()
}
})
}
})
},
handleTreeSelect
(
obj
)
{
this
[
obj
.
formName
][
obj
.
targetItem
.
name
]
=
obj
.
val
.
menuName
this
[
obj
.
formName
].
menuId
=
obj
.
val
.
id
this
[
obj
.
formName
][
obj
.
targetItem
.
nameLabel
]
=
obj
.
val
?
obj
.
val
.
menuName
:
''
this
[
obj
.
formName
][
obj
.
targetItem
.
name
]
=
obj
.
val
?
obj
.
val
.
id
:
''
},
changeOwnSecond
(
obj
)
{
this
[
obj
.
targetItem
.
formName
][
obj
.
targetItem
.
secondVal
]
=
obj
.
val
}
}
}
...
...
src/views/productManage/menuList/app.js
View file @
05ec023
// import App from './index.vue'
import
base
from
'@/base'
import
GlsxVueCommon
from
'glsx-vue-common'
import
notice
from
'@/common/notice'
const
Apps
=
require
.
context
(
'./'
,
false
,
/
\.
vue$/
)
console
.
log
(
'00000000000000'
)
Apps
.
keys
().
map
(
item
=>
{
console
.
log
(
item
)
...
...
@@ -13,6 +13,7 @@ Apps.keys().map(item => {
config
}
=
data
vue
.
use
(
GlsxVueCommon
,
config
)
vue
.
prototype
.
notice
=
notice
base
.
render
(
Apps
(
item
).
default
)
})
})
...
...
src/views/productManage/menuList/index.vue
View file @
05ec023
...
...
@@ -2,7 +2,10 @@
<
template
>
<div>
<el-row>
<el-col
:span=
"8"
>
<el-col
:span=
"4"
style=
"padding-top: 16px;"
>
<el-button
icon=
"el-icon-plus"
@
click=
"handleAdd"
...
...
@@ -10,7 +13,7 @@
</el-col>
<el-col
style=
"text-align: right;"
:span=
"
16
"
:span=
"
20
"
>
<glsx-combi-form
ref=
"showSearch"
...
...
@@ -20,7 +23,7 @@
<el-button
size=
"small"
type=
"primary"
:id=
"tableParams.btnId
"
@
click=
"keyDowmGetList
"
>
查询
</el-button>
</glsx-combi-form>
</el-col>
...
...
@@ -33,19 +36,30 @@
:getListApi=
"getListApi"
:beforeSearchFn=
"beforeSearchFn"
>
<span
slot=
"auth-button"
>
<el-button
type=
"text"
>
修改
</el-button>
<el-button
type=
"text"
>
删除
</el-button>
<span
slot=
"auth-button"
slot-scope=
"scope"
>
<el-button
type=
"text"
@
click=
"handleEdit(scope.scope)"
>
修改
</el-button>
<el-button
type=
"text"
@
click=
"handleDelete(scope.scope)"
>
删除
</el-button>
</span>
</glsx-table>
<glsx-dialog
:title=
"
title
"
:title=
"
editForm.menuCode ? '编辑菜单' : '创建菜单'
"
:isVisible=
"editVisible"
@
closeDialog=
"handle
Add
"
@
confirmDialog=
"handle
Add
"
@
closeDialog=
"handle
Close
"
@
confirmDialog=
"handle
Confirm
"
>
<glsx-combi-form
labelWidth=
"100px"
ref=
"editFormRef"
labelWidth=
"120px"
:formRef=
"editChildRef"
:formObj=
"editForm"
:formData=
"editFormData"
:formRules=
"editRule"
...
...
@@ -56,6 +70,7 @@
>
<select-tree
:form=
"editForm"
:width=
"'300'"
:targetItem=
"scope.scope"
:treeData=
"baseData.menuTreeList"
:defaultProps=
"treeDefaultProps"
...
...
@@ -65,7 +80,27 @@
<
template
slot=
"menuIcon"
slot-scope=
"scope"
></
template
>
>
<el-select
v-model=
"editForm[scope.scope.name]"
placeholder=
"请选择icon"
style=
"width: 300px"
>
<el-option
v-for=
"item in scope.scope.optionList"
:key=
"item[scope.scope.optionId]"
:label=
"item[scope.scope.optionLabel]"
:value=
"item[scope.scope.optionId]"
style=
"height: 100px;"
>
<el-image
style=
"width: 100px; height: 100px"
:src=
"item[scope.scope.optionLabel]"
fit=
"contain"
></el-image>
</el-option>
</el-select>
</
template
>
</glsx-combi-form>
</glsx-dialog>
</div>
...
...
@@ -81,16 +116,18 @@ export default {
data
()
{
return
{
searchForm
:
{
productId
:
[],
productId
s
:
[],
menuName
:
''
},
tableSearchForm
:
{},
tableSearchForm
:
{
productIds
:
[]
},
oldVal
:
{
productId
:
[]
productId
s
:
[]
},
searchFormData
:
[{
label
:
'产品'
,
name
:
'productId'
,
name
:
'productId
s
'
,
type
:
'select'
,
multiple
:
true
,
optionList
:
[],
...
...
@@ -99,7 +136,7 @@ export default {
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
!==
''
)
this
.
searchForm
[
targetItem
.
name
]
=
!
this
.
oldVal
[
targetItem
.
name
].
includes
(
''
)
?
targetItem
.
optionList
.
map
(
item
=>
item
[
targetItem
.
optionId
]
)
:
this
.
searchForm
[
targetItem
.
name
].
filter
(
item
=>
item
!==
''
)
}
else
{
if
(
this
.
oldVal
[
targetItem
.
name
].
includes
(
''
))
{
this
.
searchForm
[
targetItem
.
name
]
=
[]
...
...
@@ -108,6 +145,7 @@ export default {
}
}
this
.
oldVal
[
targetItem
.
name
]
=
this
.
searchForm
[
targetItem
.
name
]
this
.
tableSearchForm
[
targetItem
.
name
]
=
this
.
searchForm
[
targetItem
.
name
].
includes
(
''
)
?
[]
:
this
.
searchForm
[
targetItem
.
name
]
}
},
{
label
:
'菜单名称'
,
...
...
@@ -117,7 +155,7 @@ export default {
keyFn
:
this
.
keyDowmGetList
}],
getListApi
:
menuApi
.
getListApi
,
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNum
er
'
,
totalCount
:
'data.totalCount'
},
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNum'
,
totalCount
:
'data.totalCount'
},
// 表格参数
tableParams
:
{
btnId
:
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
()
*
1000
),
...
...
@@ -137,7 +175,7 @@ export default {
prop
:
'menuUrl'
},
{
label
:
'父级菜单名'
,
prop
:
'parent
i
d'
prop
:
'parent
I
d'
},
{
label
:
'产品名称'
,
prop
:
''
...
...
@@ -152,15 +190,24 @@ export default {
// 弹窗
title
:
'创建菜单'
,
editVisible
:
false
,
editChildRef
:
'editChildRef'
,
editForm
:
{
menu
:
''
,
menu
Id
:
''
parentName
:
''
,
parent
Id
:
''
},
editRule
:
{
productId
:
[{
required
:
true
,
message
:
'请选择产品'
,
trigger
:
'blur'
}]
productId
:
[{
required
:
true
,
message
:
'请选择产品'
,
trigger
:
'change'
}],
parentId
:
[{
required
:
true
,
message
:
'请选择父级菜单'
,
trigger
:
'change'
}],
menuName
:
[{
required
:
true
,
message
:
'请输入菜单名称'
,
trigger
:
'change'
}],
menuUrl
:
[{
required
:
true
,
message
:
'请输入菜单地址'
,
trigger
:
'change'
}],
iconId
:
[{
required
:
true
,
message
:
'请上传菜单ICON'
,
trigger
:
'change'
}],
sort
:
[{
required
:
true
,
message
:
'请选择产品排序值'
,
trigger
:
'change'
}],
menuPosition
:
[{
required
:
true
,
message
:
'请输入菜单位置'
,
trigger
:
'change'
}]
},
treeDefaultProps
:
{
parent
:
'parentId'
,
children
:
'childlist'
,
value
:
'id'
,
label
:
'menuName'
},
editFormData
:
[{
...
...
@@ -174,7 +221,8 @@ export default {
optionsName
:
'productList'
},
{
label
:
'父级菜单'
,
name
:
'menu'
,
name
:
'parentId'
,
nameLabel
:
'parentName'
,
addHtml
:
'menuTree'
,
formName
:
'editForm'
},
{
...
...
@@ -190,18 +238,36 @@ export default {
type
:
'input'
},
{
label
:
'菜单ICON'
,
name
:
''
,
addHtml
:
'menuIcon'
name
:
'iconId'
,
type
:
'select'
,
addHtml
:
'menuIcon'
,
optionList
:
[],
optionId
:
'id'
,
optionLabel
:
'fileUrl'
,
optionsName
:
'iconList'
},
{
label
:
'菜单排序值'
,
name
:
'sort'
,
width
:
'300px'
,
type
:
'input'
width
:
'100px'
,
type
:
'select'
,
optionList
:
[],
optionId
:
'dictValue'
,
optionLabel
:
'dictLabel'
,
optionsName
:
'sortList'
},
{
label
:
''
,
name
:
'menuPosition'
,
width
:
'200px'
,
type
:
'input'
,
maxlength
:
3
,
placeholder
:
'请输入菜单位置'
}],
// 基本数据
baseData
:
{
productList
:
[],
menuTreeList
:
[]
menuTreeList
:
[],
sortList
:
[],
iconList
:
[]
}
}
},
...
...
@@ -211,14 +277,24 @@ export default {
},
mounted
()
{
baseApi
.
getAllDictApi
({
dictType
:
'product'
}).
then
(
res
=>
{
// console.log(res)
this
.
baseData
.
productList
=
res
.
data
Promise
.
all
([
baseApi
.
getAllDictApi
({
dictType
:
'product'
}),
baseApi
.
getAllDictApi
({
dictType
:
'sort_value'
}),
baseApi
.
getIcon
({
fileType
:
2
})]).
then
(([
product
,
sort
,
icon
])
=>
{
this
.
baseData
.
productList
=
product
.
data
this
.
baseData
.
sortList
=
sort
.
data
this
.
baseData
.
iconList
=
icon
.
data
this
.
getOptionsList
(
'searchFormData'
)
this
.
getOptionsList
(
'editFormData'
,
false
)
})
baseApi
.
getMenuTree
().
then
(
res
=>
{
// console.log(res.data)
this
.
baseData
.
menuTreeList
=
res
.
data
this
.
baseData
.
menuTreeList
.
unshift
({
id
:
' '
,
menuName
:
'无(表示顶级菜单)'
,
childlist
:
[]
})
})
},
...
...
@@ -242,16 +318,59 @@ export default {
beforeSearchFn
()
{
return
new
Promise
(
resolve
=>
{
this
.
tableSearchForm
=
_
.
cloneDeep
(
this
.
searchForm
)
this
.
tableSearchForm
.
productId
.
includes
(
''
)
&&
(
this
.
tableSearchForm
.
productId
=
[])
resolve
()
resolve
(
this
.
tableSearchForm
)
})
},
handleAdd
()
{
this
.
editVisible
=
!
this
.
editVisible
this
.
$refs
.
editFormRef
&&
(
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
clearValidate
())
},
handleConfirm
()
{
// console.log(this.editForm)
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
if
(
valid
)
{
var
apiName
=
this
.
editForm
.
menuCode
?
'updateMenuApi'
:
'saveMenuApi'
menuApi
[
apiName
](
this
.
editForm
).
then
(
res
=>
{
console
.
log
(
res
)
if
(
res
.
code
===
'0'
)
{
this
.
notice
.
okTips
()
this
.
keyDowmGetList
()
this
.
handleClose
()
}
})
}
})
},
handleClose
()
{
this
.
editForm
=
{
parentName
:
''
,
parentId
:
''
}
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
clearValidate
()
this
.
handleAdd
()
},
handleEdit
(
row
)
{
// console.log(row)
this
.
editForm
=
_
.
cloneDeep
(
row
)
this
.
handleAdd
()
},
handleDelete
(
row
)
{
this
.
$confirm
(
'是否删除菜单?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'error'
}).
then
(()
=>
{
menuApi
.
deleteMenuApi
({
id
:
row
.
id
}).
then
(
res
=>
{
if
(
res
.
code
===
'0'
)
{
this
.
notice
.
okTips
()
this
.
keyDowmGetList
()
}
})
}).
catch
(()
=>
{
})
},
handleTreeSelect
(
obj
)
{
this
[
obj
.
formName
][
obj
.
targetItem
.
name
]
=
obj
.
val
.
menuName
this
[
obj
.
formName
]
.
menuId
=
obj
.
val
.
id
this
[
obj
.
formName
][
obj
.
targetItem
.
name
Label
]
=
obj
.
val
?
obj
.
val
.
menuName
:
''
this
[
obj
.
formName
]
[
obj
.
targetItem
.
name
]
=
obj
.
val
?
obj
.
val
.
id
:
''
}
}
}
...
...
src/views/productManage/productList/index.vue
View file @
05ec023
...
...
@@ -34,11 +34,13 @@
>
<el-button
slot=
"auth-button"
slot-scope=
"scope"
type=
"text"
@
click=
"handleProEdit(scope.scope)"
>
修改
</el-button>
</glsx-table>
<glsx-dialog
:title=
"
title
"
:title=
"
editForm.productCode ? '编辑产品' : '创建产品'
"
:isVisible=
"editVisible"
@
closeDialog=
"handleEditClose"
@
confirmDialog=
"handleEditConfirm"
...
...
@@ -58,7 +60,7 @@
<
script
>
import
_
from
'lodash'
import
{
productApi
}
from
'@/api/productManage'
import
{
productApi
,
baseApi
}
from
'@/api/productManage'
export
default
{
name
:
'productList'
,
data
()
{
...
...
@@ -74,7 +76,7 @@ export default {
// keyFn: this.keyDowmGetList
}],
getListApi
:
productApi
.
getListApi
,
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNum
er
'
,
totalCount
:
'data.totalCount'
},
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNum'
,
totalCount
:
'data.totalCount'
},
// 表格参数
tableParams
:
{
btnId
:
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
()
*
1000
),
...
...
@@ -127,8 +129,8 @@ export default {
type
:
'select'
,
width
:
'300px'
,
optionList
:
[],
optionId
:
'
confId
'
,
optionLabel
:
'
conf
Label'
,
optionId
:
'
dictValue
'
,
optionLabel
:
'
dict
Label'
,
optionsName
:
'productTypeList'
},
{
label
:
'产品说明'
,
...
...
@@ -146,25 +148,13 @@ export default {
}],
// 基本数据
baseData
:
{
productTypeList
:
[{
confId
:
'1'
,
confLabel
:
'web'
},
{
confId
:
'2'
,
confLabel
:
'微信小程序'
},
{
confId
:
'3'
,
confLabel
:
'企微小程序'
},
{
confId
:
'4'
,
confLabel
:
'H5'
}]
productTypeList
:
[]
}
}
},
mounted
()
{
this
.
get
OptionsList
(
'editFormData'
,
false
)
this
.
get
ProductType
(
)
},
methods
:
{
...
...
@@ -184,9 +174,20 @@ export default {
}
})
},
getProductType
()
{
baseApi
.
getAllDictApi
({
dictType
:
'product_type'
}).
then
(
res
=>
{
this
.
baseData
.
productTypeList
=
res
.
data
this
.
getOptionsList
(
'editFormData'
,
false
)
})
},
handleAdd
()
{
this
.
editVisible
=
!
this
.
editVisible
},
handleProEdit
(
row
)
{
this
.
editForm
=
_
.
clone
(
row
)
console
.
log
(
row
)
this
.
handleAdd
()
},
handleEditClose
()
{
this
.
editForm
=
{
productName
:
''
,
...
...
@@ -200,11 +201,16 @@ export default {
handleEditConfirm
()
{
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
if
(
valid
)
{
productApi
.
saveProApi
({
productCode
:
'123'
,
...
this
.
editForm
}).
then
(
res
=>
{
// productApi.saveProApi({ productCode: '123', ...this.editForm }).then(res => {
console
.
log
(
this
.
editForm
)
var
apiName
=
this
.
editForm
.
productCode
?
'updateProApi'
:
'saveProApi'
productApi
[
apiName
](
this
.
editForm
).
then
(
res
=>
{
console
.
log
(
res
)
this
.
notice
.
okTips
()
this
.
handleEditClose
()
this
.
keyDowmGetList
()
}).
catch
(
errMsg
=>
{
this
.
notice
.
errorTips
(
errMsg
)
})
}
})
...
...
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