Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
traceSourceMb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yanyanhong
traceSourceMb
Commits
a13b46f7
Commit
a13b46f7
authored
Oct 10, 2020
by
JYbmarawcp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增文件夹删除功能
parent
4de3d954
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
109 additions
and
6 deletions
+109
-6
template.ts
src/api/modules/template.ts
+8
-0
TemplateItem.vue
src/components/TemplateItem.vue
+10
-2
Index.ts
src/mixins/Index.ts
+43
-0
Index-sy.vue
src/views/index/Index-sy.vue
+42
-3
List.vue
src/views/template/List.vue
+6
-1
No files found.
src/api/modules/template.ts
View file @
a13b46f7
...
@@ -27,6 +27,14 @@ const template = {
...
@@ -27,6 +27,14 @@ const template = {
...
params
,
...
params
,
});
});
},
},
delete
(
id
:
number
,
params
:
any
=
{})
{
return
axios
.
delete
(
`
${
base
}
/deleteFolder`
,
{
data
:
{
id
,
},
...
params
,
});
},
addFolder
(
name
:
string
,
params
:
any
)
{
addFolder
(
name
:
string
,
params
:
any
)
{
return
axios
.
post
(
`
${
base
}
/addFolder`
,
{
return
axios
.
post
(
`
${
base
}
/addFolder`
,
{
name
,
name
,
...
...
src/components/TemplateItem.vue
View file @
a13b46f7
...
@@ -15,12 +15,12 @@
...
@@ -15,12 +15,12 @@
class=
"desc van-multi-ellipsis--l2"
>
class=
"desc van-multi-ellipsis--l2"
>
{{
desc
}}
{{
desc
}}
</div>
</div>
<common-svg
name=
"tianjiabeifen"
width=
"28px"
height=
"28px"
class=
"add"
></common-svg>
<common-svg
@
click
.
stop
.
native=
"showMoreAction"
class=
"more"
name=
"cunzhengliebiao-gengduo"
></common-svg>
</div>
</div>
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
Component
,
Prop
,
Vue
}
from
'vue-property-decorator'
;
import
{
Component
,
Prop
,
Vue
,
Emit
}
from
'vue-property-decorator'
;
@
Component
({
@
Component
({
name
:
'TemplateItem'
,
name
:
'TemplateItem'
,
})
})
...
@@ -28,6 +28,10 @@ export default class TemplateItem extends Vue {
...
@@ -28,6 +28,10 @@ export default class TemplateItem extends Vue {
@
Prop
()
private
thumb
!
:
string
;
@
Prop
()
private
thumb
!
:
string
;
@
Prop
()
private
title
!
:
string
;
@
Prop
()
private
title
!
:
string
;
@
Prop
()
private
desc
!
:
string
;
@
Prop
()
private
desc
!
:
string
;
@
Emit
(
'show-more-action'
)
private
async
showMoreAction
()
{
return
true
;
}
}
}
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
...
@@ -65,5 +69,9 @@ export default class TemplateItem extends Vue {
...
@@ -65,5 +69,9 @@ export default class TemplateItem extends Vue {
grid-row-start
:
span
2
;
grid-row-start
:
span
2
;
width
:
27px
;
width
:
27px
;
}
}
.more
{
place-self
:
center
;
grid-row
:
1
/
span
2
;
}
}
}
</
style
>
</
style
>
src/mixins/Index.ts
View file @
a13b46f7
...
@@ -3,7 +3,50 @@ import { State, Action } from 'vuex-class';
...
@@ -3,7 +3,50 @@ import { State, Action } from 'vuex-class';
@
Component
@
Component
export
default
class
Index
extends
Vue
{
export
default
class
Index
extends
Vue
{
@
Action
(
'getSysTemplateList'
)
private
getSysTemplateList
!
:
()
=>
void
;
@
Action
(
'getSysTemplateList'
)
private
getSysTemplateList
!
:
()
=>
void
;
protected
ActionList
:
any
=
{
rename
:
{
key
:
'rename'
,
icon
:
'shanchu3'
,
text
:
'重命名'
,
callback
:
this
.
renameFolder
,
},
del
:
{
key
:
'del'
,
icon
:
'shanchu3'
,
text
:
'删除'
,
callback
:
this
.
delFolder
,
},
};
protected
mounted
()
{
protected
mounted
()
{
this
.
getSysTemplateList
();
this
.
getSysTemplateList
();
}
}
private
renameFolder
(
folder
:
any
)
{
const
{
folder_name
}
=
folder
;
return
true
}
private
delFolder
(
folder
:
any
)
{
const
{
folder_id
}
=
folder
;
return
new
Promise
(
resolve
=>
{
this
.
$dialog
.
confirm
({
message
:
'您确定要删除该文件夹吗?'
,
beforeClose
:
(
action
,
done
)
=>
{
if
(
action
===
'confirm'
)
{
this
.
$api
.
template
.
delete
(
folder_id
).
then
((
res
:
any
)
=>
{
resolve
()
this
.
$toast
.
success
(
'删除成功'
);
this
.
resetList
();
done
();
}).
catch
((
err
:
any
)
=>
{
done
();
});
}
else
{
done
();
}
},
});
})
}
protected
resetList
()
{
throw
Error
(
'resetList 在列表实现'
);
}
}
}
src/views/index/Index-sy.vue
View file @
a13b46f7
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
</div>
</div>
<empty
v-if=
"!list.length && !loading"
name=
"moban"
tip=
"您还未添加模板"
></empty>
<empty
v-if=
"!list.length && !loading"
name=
"moban"
tip=
"您还未添加模板"
></empty>
<div>
<div>
<div
class=
"folder-item"
v-for=
"
{
id, folder_simg_url, folder_name, detail} of list" :key="
id" @click="goTemplList(detail, folder_name)">
<div
class=
"folder-item"
v-for=
"
{
folder_id, folder_simg_url, folder_name, detail} of list" :key="folder_
id" @click="goTemplList(detail, folder_name)">
<van-image
<van-image
class=
"thumb"
class=
"thumb"
:src=
"folder_simg_url"
:src=
"folder_simg_url"
...
@@ -42,11 +42,25 @@
...
@@ -42,11 +42,25 @@
></van-image>
></van-image>
<div
class=
"title"
style=
"#353535;font-size:18px;font-weight:500;"
>
{{
folder_name
}}
</div>
<div
class=
"title"
style=
"#353535;font-size:18px;font-weight:500;"
>
{{
folder_name
}}
</div>
<div
class=
"desc"
style=
"color: #AAAAAA;"
>
{{
(
detail
||
[]).
length
}}
条模版
</div>
<div
class=
"desc"
style=
"color: #AAAAAA;"
>
{{
(
detail
||
[]).
length
}}
条模版
</div>
<common-svg
name=
"jinru"
class=
"right-icon
"
></common-svg>
<common-svg
@
click
.
stop
.
native=
"showMoreAction(folder_name, folder_id)"
class=
"more"
name=
"cunzhengliebiao-gengduo
"
></common-svg>
</div>
</div>
</div>
</div>
<more-action
:show
.
sync=
"show"
:menuList=
"actionList"
@
cb=
"callbackAction"
></more-action>
</div>
</div>
<van-dialog
use-slot
title=
"重命名"
v-model=
"isShowRename"
show-cancel-button
confirm-button-open-type=
"getUserInfo"
bind:close=
"onClose"
bind:getuserinfo=
"getUserInfo"
>
<van-field
:value=
"currentFolder.folder_name"
auto-focus
/>
</van-dialog>
<transition
name=
"van-slide-up"
>
<transition
name=
"van-slide-up"
>
<add-folder
v-if=
"showAddFolder"
@
cancel=
"showAddFolder = false"
@
next=
"addFolder"
></add-folder>
<add-folder
v-if=
"showAddFolder"
@
cancel=
"showAddFolder = false"
@
next=
"addFolder"
></add-folder>
</transition>
</transition>
...
@@ -71,6 +85,9 @@ export default class IndexSy extends Mixins(IndexMixin) {
...
@@ -71,6 +85,9 @@ export default class IndexSy extends Mixins(IndexMixin) {
@
State
(
'sysTemplateList'
)
private
systemList
!
:
[];
@
State
(
'sysTemplateList'
)
private
systemList
!
:
[];
@
Action
(
'getProofCount'
)
private
getProofCount
!
:
any
;
@
Action
(
'getProofCount'
)
private
getProofCount
!
:
any
;
private
list
:
any
[]
=
[];
private
list
:
any
[]
=
[];
private
currentFolder
:
object
=
{};
private
show
:
boolean
=
false
;
private
isShowRename
:
boolean
=
false
;
private
loading
:
boolean
=
true
;
private
loading
:
boolean
=
true
;
private
showAddFolder
:
boolean
=
false
;
private
showAddFolder
:
boolean
=
false
;
@
Watch
(
'isLogin'
,
{
immediate
:
true
})
@
Watch
(
'isLogin'
,
{
immediate
:
true
})
...
@@ -83,6 +100,13 @@ export default class IndexSy extends Mixins(IndexMixin) {
...
@@ -83,6 +100,13 @@ export default class IndexSy extends Mixins(IndexMixin) {
this
.
loading
=
false
;
this
.
loading
=
false
;
}
}
}
}
private
async
showMoreAction
(
folder_name
:
any
,
folder_id
:
number
)
{
this
.
currentFolder
=
{
folder_name
,
folder_id
};
this
.
show
=
true
;
}
private
async
getUserFolders
()
{
private
async
getUserFolders
()
{
const
{
results
=
[]}
=
await
this
.
$api
.
template
.
folderList
({
template_type
:
1
});
const
{
results
=
[]}
=
await
this
.
$api
.
template
.
folderList
({
template_type
:
1
});
const
ids
=
results
.
map
((
folder
:
any
)
=>
folder
.
id
);
const
ids
=
results
.
map
((
folder
:
any
)
=>
folder
.
id
);
...
@@ -100,6 +124,17 @@ export default class IndexSy extends Mixins(IndexMixin) {
...
@@ -100,6 +124,17 @@ export default class IndexSy extends Mixins(IndexMixin) {
private
goTemplList
(
templList
:
[]
=
[],
folderName
=
''
)
{
private
goTemplList
(
templList
:
[]
=
[],
folderName
=
''
)
{
this
.
$router
.
push
({
name
:
'TemplList'
,
query
:
{
templList
:
JSON
.
stringify
(
templList
)
,
folderName
}
});
this
.
$router
.
push
({
name
:
'TemplList'
,
query
:
{
templList
:
JSON
.
stringify
(
templList
)
,
folderName
}
});
}
}
get
actionList
()
{
const
{
rename
,
del
}
=
this
.
ActionList
;
return
[
rename
,
del
];
}
private
async
callbackAction
(
cb
:
any
)
{
this
.
isShowRename
=
await
cb
.
call
(
this
,
this
.
currentFolder
);
this
.
getUserFolders
();
}
private
onClose
():
void
{
}
}
}
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
...
@@ -170,6 +205,10 @@ export default class IndexSy extends Mixins(IndexMixin) {
...
@@ -170,6 +205,10 @@ export default class IndexSy extends Mixins(IndexMixin) {
place-self
:
center
;
place-self
:
center
;
grid-row
:
span
2
;
grid-row
:
span
2
;
}
}
.more
{
place-self
:
center
;
grid-row
:
1
/
span
2
;
}
}
}
}
}
}
}
...
...
src/views/template/List.vue
View file @
a13b46f7
...
@@ -6,10 +6,12 @@
...
@@ -6,10 +6,12 @@
v-for=
"
{id, s_image_url, name, info} of list"
v-for=
"
{id, s_image_url, name, info} of list"
:key="id"
:key="id"
@click.native="goProofDetail(id)"
@click.native="goProofDetail(id)"
@show-more-action="showMoreAction"
:thumb="s_image_url"
:thumb="s_image_url"
:title="name"
:title="name"
:desc="info"
:desc="info"
>
</template-item>
>
</template-item>
<more-action
:show
.
sync=
"show"
:menuList=
"actionList"
@
cb=
"callbackAction"
></more-action>
</div>
</div>
</
template
>
</
template
>
...
@@ -26,7 +28,7 @@ import { TEMPLATETYPE } from '@/const/enum';
...
@@ -26,7 +28,7 @@ import { TEMPLATETYPE } from '@/const/enum';
})
})
export
default
class
Index
extends
Vue
{
export
default
class
Index
extends
Vue
{
private
list
:
any
[]
=
[];
private
list
:
any
[]
=
[];
private
show
:
boolean
=
false
;
@
Prop
({
@
Prop
({
})
})
private
templList
!
:
string
;
private
templList
!
:
string
;
...
@@ -39,6 +41,9 @@ export default class Index extends Vue {
...
@@ -39,6 +41,9 @@ export default class Index extends Vue {
private
goProofDetail
(
templateId
:
string
)
{
private
goProofDetail
(
templateId
:
string
)
{
this
.
$router
.
push
({
name
:
'ProofDetail'
,
query
:
{
templateId
}
});
this
.
$router
.
push
({
name
:
'ProofDetail'
,
query
:
{
templateId
}
});
}
}
private
showMoreAction
(
data
:
any
)
{
this
.
show
=
true
;
}
}
}
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
...
...
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