Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
front-backend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
framework
front-backend
Commits
2bc97e31
Commit
2bc97e31
authored
Dec 21, 2019
by
Elune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
4ccb6cb8
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
141 additions
and
220 deletions
+141
-220
src/api/tools/localStorage.js
+2
-9
src/api/tools/qiniu.js
+3
-10
src/views/tools/aliPay/config.vue
+2
-2
src/views/tools/storage/index.vue
+2
-2
src/views/tools/storage/local/index.vue
+66
-102
src/views/tools/storage/qiniu/form.vue
+1
-1
src/views/tools/storage/qiniu/index.vue
+65
-94
No files found.
src/api/tools/localStorage.js
View file @
2bc97e31
...
@@ -8,14 +8,7 @@ export function add(data) {
...
@@ -8,14 +8,7 @@ export function add(data) {
})
})
}
}
export
function
del
(
id
)
{
export
function
del
(
ids
)
{
return
request
({
url
:
'api/localStorage/'
+
id
,
method
:
'delete'
})
}
export
function
delAll
(
ids
)
{
return
request
({
return
request
({
url
:
'api/localStorage/'
,
url
:
'api/localStorage/'
,
method
:
'delete'
,
method
:
'delete'
,
...
@@ -31,4 +24,4 @@ export function edit(data) {
...
@@ -31,4 +24,4 @@ export function edit(data) {
})
})
}
}
export
default
{
add
,
edit
,
del
,
delAll
}
export
default
{
add
,
edit
,
del
}
src/api/tools/qiniu.js
View file @
2bc97e31
...
@@ -15,13 +15,6 @@ export function update(data) {
...
@@ -15,13 +15,6 @@ export function update(data) {
})
})
}
}
export
function
del
(
id
)
{
return
request
({
url
:
'api/qiNiuContent/'
+
id
,
method
:
'delete'
})
}
export
function
download
(
id
)
{
export
function
download
(
id
)
{
return
request
({
return
request
({
url
:
'api/qiNiuContent/download/'
+
id
,
url
:
'api/qiNiuContent/download/'
+
id
,
...
@@ -36,12 +29,12 @@ export function sync() {
...
@@ -36,12 +29,12 @@ export function sync() {
})
})
}
}
export
function
del
All
(
ids
)
{
export
function
del
(
ids
)
{
return
request
({
return
request
({
url
:
'api/qiNiuContent
/
'
,
url
:
'api/qiNiuContent'
,
method
:
'delete'
,
method
:
'delete'
,
data
:
ids
data
:
ids
})
})
}
}
export
default
{
del
,
download
,
sync
,
delAll
}
export
default
{
del
,
download
,
sync
}
src/views/tools/aliPay/config.vue
View file @
2bc97e31
<
template
>
<
template
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
style=
"margin-top: 6px;"
size=
"small"
label-width=
"100px"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
style=
"margin-top: 6px;"
size=
"small"
label-width=
"100px"
>
<el-form-item
label=
"appID"
prop=
"appID"
>
<el-form-item
label=
"appID"
prop=
"appID"
>
<el-input
v-model=
"form.appI
D
"
style=
"width: 40%"
/>
<el-input
v-model=
"form.appI
d
"
style=
"width: 40%"
/>
<span
style=
"color: #C0C0C0;margin-left: 10px;"
>
应用APPID,收款账号既是APPID对应支付宝账号
</span>
<span
style=
"color: #C0C0C0;margin-left: 10px;"
>
应用APPID,收款账号既是APPID对应支付宝账号
</span>
</el-form-item>
</el-form-item>
<el-form-item
label=
"商家账号"
prop=
"sysServiceProviderId"
>
<el-form-item
label=
"商家账号"
prop=
"sysServiceProviderId"
>
...
@@ -37,7 +37,7 @@ export default {
...
@@ -37,7 +37,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
loading
:
false
,
loading
:
false
,
form
:
{
appI
D
:
''
,
sysServiceProviderId
:
''
,
privateKey
:
''
,
publicKey
:
''
,
returnUrl
:
''
,
notifyUrl
:
''
},
form
:
{
appI
d
:
''
,
sysServiceProviderId
:
''
,
privateKey
:
''
,
publicKey
:
''
,
returnUrl
:
''
,
notifyUrl
:
''
},
rules
:
{
rules
:
{
appID
:
[
appID
:
[
{
required
:
true
,
message
:
'请输入appID'
,
trigger
:
'blur'
}
{
required
:
true
,
message
:
'请输入appID'
,
trigger
:
'blur'
}
...
...
src/views/tools/storage/index.vue
View file @
2bc97e31
...
@@ -23,9 +23,9 @@ export default {
...
@@ -23,9 +23,9 @@ export default {
methods
:
{
methods
:
{
tabClick
(
name
)
{
tabClick
(
name
)
{
if
(
this
.
activeName
===
'first'
)
{
if
(
this
.
activeName
===
'first'
)
{
this
.
$refs
.
local
.
init
()
this
.
$refs
.
local
.
crud
.
toQuery
()
}
else
{
}
else
{
this
.
$refs
.
qiNiu
.
init
()
this
.
$refs
.
qiNiu
.
crud
.
toQuery
()
}
}
}
}
}
}
...
...
src/views/tools/storage/local/index.vue
View file @
2bc97e31
...
@@ -2,60 +2,44 @@
...
@@ -2,60 +2,44 @@
<div
class=
"app-container"
style=
"padding: 8px;"
>
<div
class=
"app-container"
style=
"padding: 8px;"
>
<!--工具栏-->
<!--工具栏-->
<div
class=
"head-container"
>
<div
class=
"head-container"
>
<!-- 搜索 -->
<div
v-if=
"crud.props.searchToggle"
>
<el-input
v-model=
"query.blurry"
clearable
size=
"small"
placeholder=
"输入内容模糊搜索"
style=
"width: 200px;"
class=
"filter-item"
@
keyup
.
enter
.
native=
"toQuery"
/>
<!-- 搜索 -->
<el-date-picker
<el-input
v-model=
"query.blurry"
clearable
size=
"small"
placeholder=
"输入内容模糊搜索"
style=
"width: 200px;"
class=
"filter-item"
@
keyup
.
enter
.
native=
"crud.toQuery"
/>
v-model=
"query.createTime"
<el-date-picker
:default-time=
"['00:00:00','23:59:59']"
v-model=
"query.createTime"
type=
"daterange"
:default-time=
"['00:00:00','23:59:59']"
range-separator=
":"
type=
"daterange"
size=
"small"
range-separator=
":"
class=
"date-item"
size=
"small"
value-format=
"yyyy-MM-dd HH:mm:ss"
class=
"date-item"
start-placeholder=
"开始日期"
value-format=
"yyyy-MM-dd HH:mm:ss"
end-placeholder=
"结束日期"
start-placeholder=
"开始日期"
/>
end-placeholder=
"结束日期"
<el-button
class=
"filter-item"
size=
"mini"
type=
"success"
icon=
"el-icon-search"
@
click=
"toQuery"
>
搜索
</el-button>
/>
<!-- 新增 -->
<rrOperation
:crud=
"crud"
/>
<el-button
</div>
v-permission=
"['admin','storage:add']"
<crudOperation
:permission=
"permission"
>
class=
"filter-item"
<!-- 新增 -->
size=
"mini"
<el-button
type=
"primary"
slot=
"left"
icon=
"el-icon-upload"
v-permission=
"['admin','storage:add']"
@
click=
"showAddFormDialog"
class=
"filter-item"
>
文件上传
size=
"mini"
</el-button>
type=
"primary"
<!-- 多选删除 -->
icon=
"el-icon-upload"
<el-button
@
click=
"crud.toAdd"
v-permission=
"['admin','storage:del']"
>
上传
:loading=
"delAllLoading"
</el-button>
:disabled=
"data.length === 0 || $refs.table.selection.length === 0"
</crudOperation>
class=
"filter-item"
size=
"mini"
type=
"danger"
icon=
"el-icon-delete"
@
click=
"beforeDelAllMethod"
>
删除
</el-button>
<!-- 导出 -->
<el-button
:loading=
"downloadLoading"
size=
"mini"
class=
"filter-item"
type=
"warning"
icon=
"el-icon-download"
@
click=
"downloadMethod"
>
导出
</el-button>
</div>
</div>
<!--表单组件-->
<!--表单组件-->
<el-dialog
append-to-body
:close-on-click-modal=
"false"
:before-close=
"c
ancel"
:visible
.
sync=
"dialog"
:title=
"getFormTitle()
"
width=
"500px"
>
<el-dialog
append-to-body
:close-on-click-modal=
"false"
:before-close=
"c
rud.cancelCU"
:visible
.
sync=
"crud.status.cu > 0"
:title=
"crud.status.add ? '文件上传' : '编辑文件'
"
width=
"500px"
>
<el-form
ref=
"form"
:model=
"form"
size=
"small"
label-width=
"80px"
>
<el-form
ref=
"form"
:model=
"form"
size=
"small"
label-width=
"80px"
>
<el-form-item
label=
"文件名"
>
<el-form-item
label=
"文件名"
>
<el-input
v-model=
"form.name"
style=
"width: 370px;"
/>
<el-input
v-model=
"form.name"
style=
"width: 370px;"
/>
</el-form-item>
</el-form-item>
<!-- 上传文件 -->
<!-- 上传文件 -->
<el-form-item
v-if=
"
isA
dd"
label=
"上传"
>
<el-form-item
v-if=
"
crud.status.a
dd"
label=
"上传"
>
<el-upload
<el-upload
ref=
"upload"
ref=
"upload"
:limit=
"1"
:limit=
"1"
...
@@ -72,14 +56,15 @@
...
@@ -72,14 +56,15 @@
</el-form-item>
</el-form-item>
</el-form>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"text"
@
click=
"cancel"
>
取消
</el-button>
<el-button
type=
"text"
@
click=
"crud.cancelCU"
>
取消
</el-button>
<el-button
:loading=
"loading"
type=
"primary"
@
click=
"submitMethod"
>
确认
</el-button>
<el-button
v-if=
"crud.status.add"
:loading=
"loading"
type=
"primary"
@
click=
"upload"
>
确认
</el-button>
<el-button
v-else
:loading=
"crud.cu === 2"
type=
"primary"
@
click=
"crud.submitCU"
>
确认
</el-button>
</div>
</div>
</el-dialog>
</el-dialog>
<!--表格渲染-->
<!--表格渲染-->
<el-table
ref=
"table"
v-loading=
"
loading"
:data=
"data"
style=
"width: 100%;
"
>
<el-table
ref=
"table"
v-loading=
"
crud.loading"
:data=
"crud.data"
style=
"width: 100%;"
@
selection-change=
"crud.selectionChangeHandler
"
>
<el-table-column
type=
"selection"
width=
"55"
/>
<el-table-column
type=
"selection"
width=
"55"
/>
<el-table-column
prop=
"name"
width=
"150px
"
label=
"文件名"
>
<el-table-column
v-if=
"columns.visible('name')"
prop=
"name
"
label=
"文件名"
>
<template
slot-scope=
"scope"
>
<template
slot-scope=
"scope"
>
<el-popover
<el-popover
:content=
"'file/' + scope.row.type + '/' + scope.row.realName"
:content=
"'file/' + scope.row.type + '/' + scope.row.realName"
...
@@ -100,7 +85,7 @@
...
@@ -100,7 +85,7 @@
</el-popover>
</el-popover>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
prop=
"path"
label=
"预览图"
>
<el-table-column
v-if=
"columns.visible('path')"
prop=
"path"
label=
"预览图"
>
<
template
slot-scope=
"{row}"
>
<
template
slot-scope=
"{row}"
>
<el-image
<el-image
:src=
" baseApi + '/file/' + row.type + '/' + row.realName"
:src=
" baseApi + '/file/' + row.type + '/' + row.realName"
...
@@ -115,61 +100,45 @@
...
@@ -115,61 +100,45 @@
</el-image>
</el-image>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
prop=
"suffix"
label=
"文件类型"
/>
<el-table-column
v-if=
"columns.visible('suffix')"
prop=
"suffix"
label=
"文件类型"
/>
<el-table-column
prop=
"type"
label=
"类别"
/>
<el-table-column
v-if=
"columns.visible('type')"
prop=
"type"
label=
"类别"
/>
<el-table-column
prop=
"size"
label=
"大小"
/>
<el-table-column
v-if=
"columns.visible('size')"
prop=
"size"
label=
"大小"
/>
<el-table-column
prop=
"operate"
label=
"操作人"
/>
<el-table-column
v-if=
"columns.visible('operate')"
prop=
"operate"
label=
"操作人"
/>
<el-table-column
prop=
"createTime"
label=
"创建日期"
>
<el-table-column
v-if=
"columns.visible('createTime')"
prop=
"createTime"
label=
"创建日期"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<span>
{{
parseTime
(
scope
.
row
.
createTime
)
}}
</span>
<span>
{{
parseTime
(
scope
.
row
.
createTime
)
}}
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
v-if=
"checkPermission(['admin','storage:edit','storage:del'])"
label=
"操作"
width=
"150px"
align=
"center"
>
<
template
slot-scope=
"scope"
>
<el-button
v-permission=
"['admin','storage:edit']"
size=
"mini"
type=
"primary"
icon=
"el-icon-edit"
@
click=
"showEditFormDialog(scope.row)"
/>
<el-popover
:ref=
"scope.row.id"
v-permission=
"['admin','storage:del']"
placement=
"top"
width=
"180"
>
<p>
确定删除本条数据吗?
</p>
<div
style=
"text-align: right; margin: 0"
>
<el-button
size=
"mini"
type=
"text"
@
click=
"$refs[scope.row.id].doClose()"
>
取消
</el-button>
<el-button
:loading=
"delLoading"
type=
"primary"
size=
"mini"
@
click=
"delMethod(scope.row.id)"
>
确定
</el-button>
</div>
<el-button
slot=
"reference"
type=
"danger"
icon=
"el-icon-delete"
size=
"mini"
/>
</el-popover>
</
template
>
</el-table-column>
</el-table>
</el-table>
<!--分页组件-->
<!--分页组件-->
<el-pagination
<pagination
/>
:total=
"total"
:current-page=
"page + 1"
style=
"margin-top: 8px;"
layout=
"total, prev, pager, next, sizes"
@
size-change=
"sizeChange"
@
current-change=
"pageChange"
/>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
{
mapGetters
}
from
'vuex'
import
{
mapGetters
}
from
'vuex'
import
{
getToken
}
from
'@/utils/auth'
import
{
getToken
}
from
'@/utils/auth'
import
crud
from
'@/mixins/crud'
import
crudFile
from
'@/api/tools/localStorage'
import
crudFile
from
'@/api/tools/localStorage'
import
CRUD
,
{
presenter
,
header
,
form
,
crud
}
from
'@crud/crud'
import
rrOperation
from
'@crud/RR.operation'
import
crudOperation
from
'@crud/CRUD.operation'
import
pagination
from
'@crud/Pagination'
// crud交由presenter持有
const
defaultCrud
=
CRUD
({
title
:
'文件'
,
url
:
'api/localStorage'
,
crudMethod
:
{
...
crudFile
}})
const
defaultForm
=
{
id
:
null
,
name
:
''
}
export
default
{
export
default
{
mixins
:
[
crud
],
components
:
{
pagination
,
crudOperation
,
rrOperation
},
mixins
:
[
presenter
(
defaultCrud
),
header
(),
form
(
defaultForm
),
crud
()],
data
()
{
data
()
{
return
{
return
{
title
:
'文件'
,
crudMethod
:
{
...
crudFile
},
delAllLoading
:
false
,
delAllLoading
:
false
,
loading
:
false
,
headers
:
{
'Authorization'
:
getToken
()
},
headers
:
{
'Authorization'
:
getToken
()
},
form
:
{
id
:
null
,
name
:
null
}
permission
:
{
edit
:
[
'admin'
,
'storage:edit'
],
del
:
[
'admin'
,
'storage:del'
]
}
}
}
},
},
computed
:
{
computed
:
{
...
@@ -179,34 +148,29 @@ export default {
...
@@ -179,34 +148,29 @@ export default {
])
])
},
},
created
()
{
created
()
{
this
.
$nextTick
(()
=>
{
this
.
crud
.
optShow
.
add
=
false
this
.
init
()
})
},
},
methods
:
{
methods
:
{
// 获取数据前设置好接口地址
beforeInit
()
{
this
.
url
=
'api/localStorage'
return
true
},
// 上传文件
// 上传文件
addMetho
d
()
{
uploa
d
()
{
this
.
$refs
.
upload
.
submit
()
this
.
$refs
.
upload
.
submit
()
},
},
beforeUpload
(
file
)
{
beforeUpload
(
file
)
{
let
isLt2M
=
true
let
isLt2M
=
true
isLt2M
=
file
.
size
/
1024
/
1024
<
100
isLt2M
=
file
.
size
/
1024
/
1024
<
100
if
(
!
isLt2M
)
{
if
(
!
isLt2M
)
{
this
.
loading
=
false
this
.
$message
.
error
(
'上传文件大小不能超过 100MB!'
)
this
.
$message
.
error
(
'上传文件大小不能超过 100MB!'
)
}
}
this
.
loading
=
fals
e
this
.
form
.
name
=
file
.
nam
e
return
isLt2M
return
isLt2M
},
},
handleSuccess
(
response
,
file
,
fileList
)
{
handleSuccess
(
response
,
file
,
fileList
)
{
this
.
dialog
=
false
this
.
crud
.
notify
(
'上传成功'
,
CRUD
.
NOTIFICATION_TYPE
.
SUCCESS
)
this
.
cancel
()
this
.
$refs
.
upload
.
clearFiles
()
this
.
$refs
.
upload
.
clearFiles
()
this
.
init
()
this
.
crud
.
status
.
add
=
CRUD
.
STATUS
.
NORMAL
this
.
crud
.
resetForm
()
this
.
crud
.
toQuery
()
},
},
// 监听上传失败
// 监听上传失败
handleError
(
e
,
file
,
fileList
)
{
handleError
(
e
,
file
,
fileList
)
{
...
...
src/views/tools/storage/qiniu/form.vue
View file @
2bc97e31
...
@@ -77,7 +77,7 @@ export default {
...
@@ -77,7 +77,7 @@ export default {
type
:
'success'
,
type
:
'success'
,
duration
:
2500
duration
:
2500
})
})
this
.
$parent
.
init
()
this
.
$parent
.
crud
.
toQuery
()
this
.
loading
=
false
this
.
loading
=
false
this
.
dialog
=
false
this
.
dialog
=
false
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
...
...
src/views/tools/storage/qiniu/index.vue
View file @
2bc97e31
...
@@ -4,51 +4,38 @@
...
@@ -4,51 +4,38 @@
<eForm
ref=
"form"
/>
<eForm
ref=
"form"
/>
<!-- 工具栏 -->
<!-- 工具栏 -->
<div
class=
"head-container"
>
<div
class=
"head-container"
>
<!-- 搜索 -->
<div
v-if=
"crud.props.searchToggle"
>
<el-input
v-model=
"query.key"
clearable
size=
"small"
placeholder=
"输入文件名称搜索"
style=
"width: 200px;"
class=
"filter-item"
@
keyup
.
enter
.
native=
"toQuery"
/>
<!-- 搜索 -->
<el-date-picker
<el-input
v-model=
"query.key"
clearable
size=
"small"
placeholder=
"输入文件名称搜索"
style=
"width: 200px;"
class=
"filter-item"
@
keyup
.
enter
.
native=
"toQuery"
/>
v-model=
"query.c"
<el-date-picker
:default-time=
"['00:00:00','23:59:59']"
v-model=
"query.c"
type=
"daterange"
:default-time=
"['00:00:00','23:59:59']"
range-separator=
":"
type=
"daterange"
size=
"small"
range-separator=
":"
class=
"date-item"
size=
"small"
value-format=
"yyyy-MM-dd HH:mm:ss"
class=
"date-item"
start-placeholder=
"开始日期"
value-format=
"yyyy-MM-dd HH:mm:ss"
end-placeholder=
"结束日期"
start-placeholder=
"开始日期"
/>
end-placeholder=
"结束日期"
<el-button
class=
"filter-item"
size=
"mini"
type=
"success"
icon=
"el-icon-search"
@
click=
"toQuery"
>
搜索
</el-button>
/>
<!-- 上传 -->
<rrOperation
:crud=
"crud"
/>
<el-button
class=
"filter-item"
size=
"mini"
type=
"primary"
icon=
"el-icon-upload"
@
click=
"dialog = true"
>
上传文件
</el-button>
</div>
<!-- 同步 -->
<crudOperation
:permission=
"permission"
>
<el-button
:icon=
"icon"
class=
"filter-item"
size=
"mini"
type=
"warning"
@
click=
"synchronize"
>
同步数据
</el-button>
<template
slot=
"left"
>
<!-- 配置 -->
<!-- 上传 -->
<el-button
<el-button
class=
"filter-item"
size=
"mini"
type=
"primary"
icon=
"el-icon-upload"
@
click=
"dialog = true"
>
上传
</el-button>
class=
"filter-item"
<!-- 同步 -->
size=
"mini"
<el-button
:icon=
"icon"
class=
"filter-item"
size=
"mini"
type=
"warning"
@
click=
"synchronize"
>
同步
</el-button>
type=
"success"
<!-- 配置 -->
icon=
"el-icon-s-tools"
<el-button
@
click=
"doConfig"
class=
"filter-item"
>
七牛配置
</el-button>
size=
"mini"
<!-- 多选删除 -->
type=
"success"
<el-button
icon=
"el-icon-s-tools"
:loading=
"delAllLoading"
@
click=
"doConfig"
:disabled=
"data.length === 0 || $refs.table.selection.length === 0"
>
配置
</el-button>
class=
"filter-item"
</
template
>
size=
"mini"
</crudOperation>
type=
"danger"
icon=
"el-icon-delete"
@
click=
"beforeDelAllMethod"
>
删除
</el-button>
<!-- 导出 -->
<el-button
:loading=
"downloadLoading"
size=
"mini"
class=
"filter-item"
type=
"warning"
icon=
"el-icon-download"
@
click=
"downloadMethod"
>
导出
</el-button>
<!-- 文件上传 -->
<!-- 文件上传 -->
<el-dialog
:visible
.
sync=
"dialog"
:close-on-click-modal=
"false"
append-to-body
width=
"500px"
@
close=
"doSubmit"
>
<el-dialog
:visible
.
sync=
"dialog"
:close-on-click-modal=
"false"
append-to-body
width=
"500px"
@
close=
"doSubmit"
>
<el-upload
<el-upload
...
@@ -69,67 +56,52 @@
...
@@ -69,67 +56,52 @@
</div>
</div>
</el-dialog>
</el-dialog>
<!--表格渲染-->
<!--表格渲染-->
<el-table
ref=
"table"
v-loading=
"
loading"
:data=
"data"
style=
"width: 100%;
"
>
<el-table
ref=
"table"
v-loading=
"
crud.loading"
:data=
"crud.data"
style=
"width: 100%;"
@
selection-change=
"crud.selectionChangeHandler
"
>
<el-table-column
type=
"selection"
width=
"55"
/>
<el-table-column
type=
"selection"
width=
"55"
/>
<el-table-column
:show-overflow-tooltip=
"true"
label=
"文件名"
>
<el-table-column
v-if=
"columns.visible('name')"
prop=
"name"
:show-overflow-tooltip=
"true"
label=
"文件名"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<a
href=
"JavaScript:
;
"
class=
"el-link el-link--primary"
target=
"_blank"
type=
"primary"
@
click=
"download(scope.row.id)"
>
{{
scope
.
row
.
key
}}
</a>
<a
href=
"JavaScript:"
class=
"el-link el-link--primary"
target=
"_blank"
type=
"primary"
@
click=
"download(scope.row.id)"
>
{{
scope
.
row
.
key
}}
</a>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
:show-overflow-tooltip=
"true"
prop=
"suffix"
label=
"文件类型
"
/>
<el-table-column
v-if=
"columns.visible('suffix')"
:show-overflow-tooltip=
"true"
prop=
"suffix"
label=
"文件类型"
@
selection-change=
"crud.selectionChangeHandler
"
/>
<el-table-column
prop=
"bucket"
label=
"空间名称"
/>
<el-table-column
v-if=
"columns.visible('bucket')"
prop=
"bucket"
label=
"空间名称"
/>
<el-table-column
prop=
"size"
label=
"文件大小"
/>
<el-table-column
v-if=
"columns.visible('size')"
prop=
"size"
label=
"文件大小"
/>
<el-table-column
prop=
"type"
label=
"空间类型"
/>
<el-table-column
v-if=
"columns.visible('type')"
prop=
"type"
label=
"空间类型"
/>
<el-table-column
width=
"180px
"
prop=
"updateTime"
label=
"创建日期"
>
<el-table-column
v-if=
"columns.visible('updateTime')
"
prop=
"updateTime"
label=
"创建日期"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<span>
{{
parseTime
(
scope
.
row
.
updateTime
)
}}
</span>
<span>
{{
parseTime
(
scope
.
row
.
updateTime
)
}}
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"操作"
width=
"100px"
align=
"center"
fixed=
"right"
>
<
template
slot-scope=
"scope"
>
<el-popover
:ref=
"scope.row.id"
placement=
"top"
width=
"180"
>
<p>
确定删除本条数据吗?
</p>
<div
style=
"text-align: right; margin: 0"
>
<el-button
size=
"mini"
type=
"text"
@
click=
"$refs[scope.row.id].doClose()"
>
取消
</el-button>
<el-button
:loading=
"delLoading"
type=
"primary"
size=
"mini"
@
click=
"delMethod(scope.row.id)"
>
确定
</el-button>
</div>
<el-button
slot=
"reference"
type=
"danger"
icon=
"el-icon-delete"
size=
"mini"
/>
</el-popover>
</
template
>
</el-table-column>
</el-table>
</el-table>
<!--分页组件-->
<!--分页组件-->
<el-pagination
<pagination
/>
:total=
"total"
:current-page=
"page + 1"
style=
"margin-top: 8px;"
layout=
"total, prev, pager, next, sizes"
@
size-change=
"sizeChange"
@
current-change=
"pageChange"
/>
</div>
</div>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
crud
from
'@/mixins/crud'
import
crudQiNiu
from
'@/api/tools/qiniu'
import
crudQiNiu
from
'@/api/tools/qiniu'
import
{
mapGetters
}
from
'vuex'
import
{
mapGetters
}
from
'vuex'
import
{
getToken
}
from
'@/utils/auth'
import
{
getToken
}
from
'@/utils/auth'
import
eForm
from
'./form'
import
eForm
from
'./form'
import
CRUD
,
{
presenter
,
header
,
crud
}
from
'@crud/crud'
import
rrOperation
from
'@crud/RR.operation'
import
crudOperation
from
'@crud/CRUD.operation'
import
pagination
from
'@crud/Pagination'
// crud交由presenter持有
const
defaultCrud
=
CRUD
({
title
:
'七牛云文件'
,
url
:
'api/qiNiuContent'
,
crudMethod
:
{
...
crudQiNiu
}})
export
default
{
export
default
{
components
:
{
eForm
},
components
:
{
eForm
,
pagination
,
crudOperation
,
rrOperation
},
mixins
:
[
crud
],
mixins
:
[
presenter
(
defaultCrud
),
header
(),
crud
()
],
data
()
{
data
()
{
return
{
return
{
title
:
'文件'
,
permission
:
{
crudMethod
:
{
...
crudQiNiu
},
del
:
[
'admin'
,
'storage:del'
]
},
title
:
'文件'
,
dialog
:
false
,
icon
:
'el-icon-refresh'
,
icon
:
'el-icon-refresh'
,
url
:
''
,
headers
:
{
'Authorization'
:
getToken
()
},
dialog
:
false
,
url
:
''
,
headers
:
{
'Authorization'
:
getToken
()
},
dialogImageUrl
:
''
,
dialogVisible
:
false
,
fileList
:
[],
files
:
[],
newWin
:
null
dialogImageUrl
:
''
,
dialogVisible
:
false
,
fileList
:
[],
files
:
[],
newWin
:
null
}
}
},
},
...
@@ -149,12 +121,11 @@ export default {
...
@@ -149,12 +121,11 @@ export default {
}
}
}
}
},
},
created
()
{
this
.
crud
.
optShow
.
add
=
false
this
.
crud
.
optShow
.
edit
=
false
},
methods
:
{
methods
:
{
// 获取数据前设置好接口地址
beforeInit
()
{
this
.
url
=
'api/qiNiuContent'
return
true
},
// 七牛云配置
// 七牛云配置
doConfig
()
{
doConfig
()
{
const
_this
=
this
.
$refs
.
form
const
_this
=
this
.
$refs
.
form
...
@@ -169,7 +140,7 @@ export default {
...
@@ -169,7 +140,7 @@ export default {
handleBeforeRemove
(
file
,
fileList
)
{
handleBeforeRemove
(
file
,
fileList
)
{
for
(
let
i
=
0
;
i
<
this
.
files
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
files
.
length
;
i
++
)
{
if
(
this
.
files
[
i
].
uid
===
file
.
uid
)
{
if
(
this
.
files
[
i
].
uid
===
file
.
uid
)
{
this
.
crudMethod
.
del
(
this
.
files
[
i
].
id
).
then
(
res
=>
{})
crudQiNiu
.
del
([
this
.
files
[
i
].
id
]
).
then
(
res
=>
{})
return
true
return
true
}
}
}
}
...
@@ -184,19 +155,19 @@ export default {
...
@@ -184,19 +155,19 @@ export default {
this
.
dialogVisible
=
false
this
.
dialogVisible
=
false
this
.
dialogImageUrl
=
''
this
.
dialogImageUrl
=
''
this
.
dialog
=
false
this
.
dialog
=
false
this
.
init
()
this
.
crud
.
toQuery
()
},
},
// 监听上传失败
// 监听上传失败
handleError
(
e
,
file
,
fileList
)
{
handleError
(
e
,
file
,
fileList
)
{
const
msg
=
JSON
.
parse
(
e
.
message
)
const
msg
=
JSON
.
parse
(
e
.
message
)
this
.
notify
(
msg
.
message
,
'error'
)
this
.
crud
.
notify
(
msg
.
message
,
CRUD
.
NOTIFICATION_TYPE
.
ERROR
)
},
},
// 下载文件
// 下载文件
download
(
id
)
{
download
(
id
)
{
this
.
downloadLoading
=
true
this
.
downloadLoading
=
true
// 先打开一个空的新窗口,再请求
// 先打开一个空的新窗口,再请求
this
.
newWin
=
window
.
open
()
this
.
newWin
=
window
.
open
()
this
.
crudMethod
.
download
(
id
).
then
(
res
=>
{
crudQiNiu
.
download
(
id
).
then
(
res
=>
{
this
.
downloadLoading
=
false
this
.
downloadLoading
=
false
this
.
url
=
res
.
url
this
.
url
=
res
.
url
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
...
@@ -207,7 +178,7 @@ export default {
...
@@ -207,7 +178,7 @@ export default {
// 同步数据
// 同步数据
synchronize
()
{
synchronize
()
{
this
.
icon
=
'el-icon-loading'
this
.
icon
=
'el-icon-loading'
this
.
crudMethod
.
sync
().
then
(
res
=>
{
crudQiNiu
.
sync
().
then
(
res
=>
{
this
.
icon
=
'el-icon-refresh'
this
.
icon
=
'el-icon-refresh'
this
.
$message
({
this
.
$message
({
showClose
:
true
,
showClose
:
true
,
...
@@ -215,7 +186,7 @@ export default {
...
@@ -215,7 +186,7 @@ export default {
type
:
'success'
,
type
:
'success'
,
duration
:
1500
duration
:
1500
})
})
this
.
toQuery
()
this
.
crud
.
toQuery
()
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
this
.
icon
=
'el-icon-refresh'
this
.
icon
=
'el-icon-refresh'
console
.
log
(
err
.
response
.
data
.
message
)
console
.
log
(
err
.
response
.
data
.
message
)
...
...
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