Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
back-own
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
office
back-own
Commits
297603bc
Commit
297603bc
authored
Sep 28, 2021
by
chenyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: addDownload
parent
38d2a6bb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
10 deletions
+50
-10
api.js
src/api/api.js
+23
-0
home.vue
src/views/index/home.vue
+27
-10
No files found.
src/api/api.js
View file @
297603bc
...
@@ -205,3 +205,26 @@ export const postExcel = (url, params) => {
...
@@ -205,3 +205,26 @@ export const postExcel = (url, params) => {
}) */
}) */
});
});
};
};
/**
* get excel
*/
export
const
getExcel
=
(
url
,
params
)
=>
{
params
.
requestProject
=
'haoban-manage-web'
;
return
Vue
.
axios
({
method
:
'get'
,
url
:
`
${
local
}${
url
}
`
,
data
:
{},
params
:
params
,
responseType
:
'blob'
,
headers
:
{
'content-type'
:
'application/x-www-form-urlencoded'
}
//multipart/form-data{"token": token}
/* httpAgent: new http.Agent({
keepAlive: true
}),
httpsAgent: new https.Agent({
keepAlive: true
}) */
});
};
src/views/index/home.vue
View file @
297603bc
...
@@ -34,14 +34,18 @@
...
@@ -34,14 +34,18 @@
<p
class=
"search-items-label"
>
表名:
</p>
<p
class=
"search-items-label"
>
表名:
</p>
<el-input
style=
"width:140px;"
placeholder=
"请输入表名"
v-model=
"searchParams.tableName"
clearable
>
</el-input>
<el-input
style=
"width:140px;"
placeholder=
"请输入表名"
v-model=
"searchParams.tableName"
clearable
>
</el-input>
</div>
</div>
<el-button
type=
"primary"
@
click=
"getTableList"
>
筛选
</el-button>
<el-button
type=
"primary"
@
click=
"getTableList"
:disabled=
"loading"
>
筛选
</el-button>
</div>
</div>
<el-button
type=
"primary"
@
click=
"download"
>
下载
</el-button>
<el-button
type=
"primary"
@
click=
"download"
:disabled=
"loading"
>
下载
</el-button>
</div>
</div>
<div
class=
"reviewed-body-content"
>
<div
class=
"reviewed-body-content"
>
<el-table
ref=
"multipleTable"
v-loading=
"loading"
:data=
"tableData"
tooltip-effect=
"dark"
style=
"width: 100%"
@
selection-change=
"handleSelectionChange"
>
<el-table
ref=
"multipleTable"
v-loading=
"loading"
:data=
"tableData"
tooltip-effect=
"dark"
style=
"width: 100%"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
label=
"uuid"
prop=
"uuid"
show-overflow-tooltip
></el-table-column>
<el-table-column
label=
"uuid"
prop=
"uuid"
show-overflow-tooltip
></el-table-column>
<el-table-column
label=
"时间"
prop=
"updateTime"
show-overflow-tooltip
></el-table-column>
<el-table-column
label=
"时间"
prop=
"updateTime"
show-overflow-tooltip
>
<template
slot-scope=
"scope"
>
{{
scope
.
row
.
updateTime
|
formatTimeStamp
}}
</
template
>
</el-table-column>
<el-table-column
label=
"sql内容"
prop=
"sqlContent"
min-width=
"200"
>
<el-table-column
label=
"sql内容"
prop=
"sqlContent"
min-width=
"200"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<el-tooltip
class=
"item"
effect=
"dark"
:content=
"scope.row.sqlContent"
placement=
"top"
<el-tooltip
class=
"item"
effect=
"dark"
:content=
"scope.row.sqlContent"
placement=
"top"
...
@@ -86,7 +90,7 @@
...
@@ -86,7 +90,7 @@
<
script
>
<
script
>
import
errMsg
from
'@/common/js/error'
;
import
errMsg
from
'@/common/js/error'
;
// import { _debounce } from '@/common/js/public';
// import { _debounce } from '@/common/js/public';
import
{
getRequest
}
from
'@/api/api'
;
import
{
getRequest
,
getExcel
}
from
'@/api/api'
;
export
default
{
export
default
{
name
:
'unreview'
,
name
:
'unreview'
,
data
()
{
data
()
{
...
@@ -131,16 +135,29 @@ export default {
...
@@ -131,16 +135,29 @@ export default {
},
},
download
()
{
download
()
{
const
that
=
this
;
const
that
=
this
;
that
.
loading
=
true
;
const
{
tableName
,
dataSourceId
,
scame
}
=
this
.
searchParams
;
if
(
!
tableName
||
!
dataSourceId
||
!
scame
)
{
that
.
$message
.
error
({
duration
:
3000
,
message
:
'库地址、库名、表名为必填筛选项'
});
return
;
}
let
para
=
{
...
this
.
searchParams
};
let
para
=
{
...
this
.
searchParams
};
getRequest
(
'/redis-limiter-web/sql/sql-download'
,
para
)
that
.
loading
=
true
;
getExcel
(
'/redis-limiter-web/sql/sql-download'
,
para
)
.
then
(
res
=>
{
.
then
(
res
=>
{
let
resData
=
res
.
data
;
that
.
loading
=
false
;
that
.
loading
=
false
;
if
(
resData
.
errorCode
==
1
)
{
if
(
res
.
data
)
{
return
;
let
downloadA
=
document
.
createElement
(
'a'
);
const
blob
=
new
Blob
([
res
.
data
],
{
type
:
'application/vnd.ms-excel'
});
// const href = URL.createObjectURL(blob);
// window.open(href);
downloadA
.
href
=
window
.
URL
.
createObjectURL
(
blob
);
downloadA
.
download
=
`
${
dataSourceId
}
@
${
scame
}
@
${
tableName
}
`
;
downloadA
.
click
();
window
.
URL
.
revokeObjectURL
(
downloadA
.
href
);
}
}
errMsg
.
errorMsg
(
resData
);
})
})
.
catch
(
function
(
error
)
{
.
catch
(
function
(
error
)
{
that
.
$message
.
error
({
that
.
$message
.
error
({
...
...
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