<template>
|
<div>
|
<el-form :inline="true" label-width="150px">
|
<el-form-item label="Sql" prop="sql" label-width="150px">
|
<textarea v-model="sql" style="width: 660px;height:200px"></textarea>
|
</el-form-item>
|
<el-button type="primary" @click="check()">查询</el-button>
|
<el-button type="primary" @click="logDownload()">日志下载</el-button>
|
</el-form>
|
<el-table :data="tableData" height="100px" v-adaptive="{bottomOffset:30}"
|
:header-cell-style="{'text-align':'center'}">
|
<el-table-column v-for="column in tableColumns" :key="column.prop" :prop="column.prop" :label="column.label">
|
</el-table-column>
|
</el-table>
|
</div>
|
</template>
|
|
<script>
|
|
import qs from "qs";
|
import Cookies from "js-cookie";
|
|
export default {
|
data() {
|
return {
|
sql: ''
|
}
|
},
|
props: {
|
tableData: {
|
type: Array,
|
},
|
tableColumns: {
|
type: Array,
|
}
|
},
|
methods: {
|
async check() {
|
let params = {
|
sql: this.sql
|
}
|
let res = await this.$http.get('/sys/mysql/check', {params: params})
|
if (res.success) {
|
console.log(res)
|
this.tableData = res.data.tableData
|
this.tableColumns = res.data.tableColumns
|
}
|
},
|
async logDownload() {
|
let param = qs.stringify({
|
'token': Cookies.get('token')
|
})
|
let apiURL = `/sys/mysql/logDownload`
|
window.location.href = `${window.SITE_CONFIG['apiURL']}${apiURL}?${param}`
|
}
|
}
|
}
|
</script>
|