Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_admin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_admin
Commits
14fb5045
Commit
14fb5045
authored
Mar 28, 2023
by
ddl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分类修改:树结构改为层级进入
parent
caca6923
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
147 additions
and
47 deletions
+147
-47
.gitignore
.gitignore
+7
-0
src/api/business/category.js
src/api/business/category.js
+8
-0
src/styles/index.scss
src/styles/index.scss
+35
-0
src/views/mall/category.vue
src/views/mall/category.vue
+97
-47
No files found.
.gitignore
0 → 100644
View file @
14fb5045
node_modules
dist
package-lock.json
*/node_modules
*/dist
\ No newline at end of file
src/api/business/category.js
View file @
14fb5045
...
@@ -53,3 +53,11 @@ export function deleteCategory(data) {
...
@@ -53,3 +53,11 @@ export function deleteCategory(data) {
data
data
})
})
}
}
export
function
getCategory
(
query
)
{
return
request
({
url
:
'
/category/getSubCategory
'
,
method
:
'
get
'
,
params
:
query
})
}
src/styles/index.scss
View file @
14fb5045
...
@@ -189,3 +189,38 @@ aside {
...
@@ -189,3 +189,38 @@ aside {
.multiselect--active
{
.multiselect--active
{
z-index
:
1000
!
important
;
z-index
:
1000
!
important
;
}
}
.flex
{
display
:
flex
;
align-items
:
center
;
}
.f-ai-c
{
align-items
:
center
;
}
.f-ai-fs
{
align-items
:flex-start
}
.f-jc-sb
{
justify-content
:
space-between
;
}
.f-jc-c
{
justify-content
:
center
;
}
.f-jc-e
{
justify-content
:
end
;
}
.f-jc-s
{
justify-content
:
start
;
}
.ml10
{
margin-left
:
10px
;
}
.ml20
{
margin-left
:
20px
;
}
.mr10
{
margin-right
:
10px
;
}
.mr20
{
margin-right
:
20px
;
}
src/views/mall/category.vue
View file @
14fb5045
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<tree-table
<div
v-if=
"activeLevel>0"
class=
"page__header flex f-ai-c"
>
<el-button
type=
"primary"
size=
"mini"
class=
"mr10"
@
click=
"onBack"
>
返回
</el-button>
<div
v-if=
"categoryList[activeLevel]&&categoryList[activeLevel].path"
class=
"flex"
>
<div
v-for=
"(item,index) in categoryList[activeLevel].path"
:key=
"index"
class=
"page__header--text flex f-ai-c"
>
{{
item
}}
<span
v-if=
"index !==categoryList[activeLevel].path.length-1"
>
>
</span>
</div>
</div>
</div>
<el-table
v-loading=
"listLoading"
:data=
"categoryList[activeLevel] && categoryList[activeLevel].list"
size=
"small"
element-loading-text=
"正在查询中。。。"
border
fit
highlight-current-row
>
<el-table-column
align=
"center"
label=
"ID"
prop=
"id"
/>
<el-table-column
align=
"center"
label=
"名称"
prop=
"name"
/>
<el-table-column
align=
"center"
label=
"图片"
width=
"120px"
>
<template
slot-scope=
"scope"
>
<img
v-if=
"scope.row.icon"
:src=
"scope.row.icon"
class=
"row-img"
>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"层级"
prop=
"level"
/>
<el-table-column
align=
"left"
label=
"操作"
width=
"450"
class-name=
"small-padding fixed-width"
>
<
template
slot-scope=
"scope"
>
<el-button
v-permission=
"['POST /admin/category/update']"
type=
"warning"
size=
"medium"
@
click=
"handleUpdate(scope.row)"
>
编辑
</el-button>
<el-button
v-permission=
"['POST /admin/category/delete']"
type=
"danger"
size=
"medium"
@
click=
"handleDelete(scope.row)"
>
删除
</el-button>
<el-button
v-permission=
"['POST /admin/category/add']"
type=
"primary"
size=
"medium"
@
click=
"handleCreate(scope.row)"
>
+子类目
</el-button>
<i
v-permission=
"['POST /admin/category/getSubCategory']"
>
<el-button
v-if=
"!scope.row.leaf"
type=
"primary"
size=
"medium"
@
click=
"handleChild(scope.row)"
>
查看子类目
</el-button>
</i>
</
template
>
</el-table-column>
</el-table>
<!-- <tree-table
ref="table"
ref="table"
:data="categories"
:data="categories"
:columns="columns"
:columns="columns"
...
@@ -26,7 +54,7 @@
...
@@ -26,7 +54,7 @@
<template slot="c_img" slot-scope="scope">
<template slot="c_img" slot-scope="scope">
<img :src="scope.row.icon" class="row-img">
<img :src="scope.row.icon" class="row-img">
</template>
</template>
</tree-table>
</tree-table>
-->
<!-- 添加或修改对话框 -->
<!-- 添加或修改对话框 -->
<el-dialog
:title=
"textMap[dialogStatus]"
:visible.sync=
"dialogFormVisible"
>
<el-dialog
:title=
"textMap[dialogStatus]"
:visible.sync=
"dialogFormVisible"
>
<el-form
ref=
"dataForm"
:rules=
"rules"
:model=
"dataForm"
status-icon
label-position=
"left"
label-width=
"100px"
style=
"width: 400px; margin-left:50px;"
>
<el-form
ref=
"dataForm"
:rules=
"rules"
:model=
"dataForm"
status-icon
label-position=
"left"
label-width=
"100px"
style=
"width: 400px; margin-left:50px;"
>
...
@@ -77,40 +105,8 @@
...
@@ -77,40 +105,8 @@
</div>
</div>
</template>
</template>
<
style
>
.avatar-uploader
.el-upload
{
border
:
1px
dashed
#d9d9d9
;
border-radius
:
6px
;
cursor
:
pointer
;
position
:
relative
;
overflow
:
hidden
;
}
.avatar-uploader
.el-upload
:hover
{
border-color
:
#20a0ff
;
}
.avatar-uploader-icon
{
font-size
:
28px
;
color
:
#8c939d
;
width
:
120px
;
height
:
120px
;
line-height
:
120px
;
text-align
:
center
;
}
.avatar
{
width
:
145px
;
height
:
145px
;
display
:
block
;
}
.row-img
{
width
:
100px
;
height
:
100px
;
display
:
block
;
}
</
style
>
<
script
>
<
script
>
import
{
getCategoryTree
,
listCatL1
,
createCategory
,
updateCategory
,
deleteCategory
}
from
'
@/api/business/category
'
import
{
getCategoryTree
,
listCatL1
,
createCategory
,
updateCategory
,
deleteCategory
,
getCategory
}
from
'
@/api/business/category
'
import
{
getToken
}
from
'
@/utils/auth
'
import
{
getToken
}
from
'
@/utils/auth
'
import
{
uploadPath
}
from
'
@/api/business/storage
'
import
{
uploadPath
}
from
'
@/api/business/storage
'
import
TreeTable
from
'
tree-table-vue
'
import
TreeTable
from
'
tree-table-vue
'
...
@@ -184,7 +180,9 @@ export default {
...
@@ -184,7 +180,9 @@ export default {
type
:
'
template
'
,
type
:
'
template
'
,
template
:
'
c_category
'
template
:
'
c_category
'
}
}
]
],
categoryList
:
[],
activeLevel
:
0
}
}
},
},
computed
:
{
computed
:
{
...
@@ -195,23 +193,37 @@ export default {
...
@@ -195,23 +193,37 @@ export default {
}
}
},
},
created
()
{
created
()
{
this
.
getAllCategories
()
this
.
getAllCategories
(
0
)
},
},
methods
:
{
methods
:
{
onBack
()
{
this
.
activeLevel
--
this
.
categoryList
.
length
=
this
.
categoryList
.
length
-
1
},
handleRadioClick
(
option
)
{
handleRadioClick
(
option
)
{
// console.log(option); // eslint-disable-line
// console.log(option); // eslint-disable-line
},
},
getAllCategories
()
{
handleChild
(
val
)
{
this
.
activeLevel
=
val
.
level
this
.
getAllCategories
(
val
.
id
)
},
getAllCategories
(
id
=
0
)
{
this
.
listLoading
=
true
this
.
listLoading
=
true
getCategoryTree
()
const
data
=
{
.
then
(
response
=>
{
id
:
id
||
0
this
.
categories
=
response
.
data
.
data
.
categories
}
this
.
listLoading
=
false
getCategory
(
data
).
then
(
res
=>
{
})
if
(
res
&&
res
.
data
&&
res
.
data
.
data
&&
res
.
data
.
data
.
categoryList
)
{
.
catch
(()
=>
{
this
.
categoryList
.
push
({
this
.
categories
=
[]
list
:
res
.
data
.
data
.
categoryList
,
this
.
listLoading
=
false
path
:
res
.
data
.
data
.
categoryPath
})
})
}
this
.
listLoading
=
false
}).
catch
(()
=>
{
this
.
categories
=
[]
this
.
listLoading
=
false
})
},
},
resetForm
()
{
resetForm
()
{
this
.
dataForm
=
{
this
.
dataForm
=
{
...
@@ -310,3 +322,41 @@ export default {
...
@@ -310,3 +322,41 @@ export default {
}
}
}
}
</
script
>
</
script
>
<
style
scoped
>
.avatar-uploader
.el-upload
{
border
:
1px
dashed
#d9d9d9
;
border-radius
:
6px
;
cursor
:
pointer
;
position
:
relative
;
overflow
:
hidden
;
}
.avatar-uploader
.el-upload
:hover
{
border-color
:
#20a0ff
;
}
.avatar-uploader-icon
{
font-size
:
28px
;
color
:
#8c939d
;
width
:
120px
;
height
:
120px
;
line-height
:
120px
;
text-align
:
center
;
}
.avatar
{
width
:
145px
;
height
:
145px
;
display
:
block
;
}
.row-img
{
width
:
100px
;
height
:
100px
;
display
:
block
;
}
.page__header
{
padding
:
0
0
10px
;
}
.page__header--text
{
font-weight
:
500
;
font-size
:
16px
;
}
</
style
>
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