Files
zyplayer-doc/zyplayer-doc-ui/db-ui/src/views/table/Database.vue

73 lines
2.8 KiB
Vue
Raw Normal View History

2019-07-04 21:52:39 +08:00
<template>
2019-07-05 22:40:40 +08:00
<div class="table-database-vue">
2019-07-04 21:52:39 +08:00
<el-card style="margin: 10px;" shadow="never">
<div slot="header" class="clearfix">库信息</div>
<el-form label-width="100px">
<el-form-item label="数据源:">{{vueQueryParam.host}}</el-form-item>
<el-form-item label="数据库:">{{vueQueryParam.dbName}}</el-form-item>
</el-form>
<el-form :inline="true" label-width="100px">
<el-form-item label="关键字:">
<el-input v-model="keyword" placeholder="输入字段名或注释搜索相关的表或字段信息" style="width: 500px;"></el-input>
</el-form-item>
<el-form-item>
<el-button class="search-submit" type="primary" icon="el-icon-search" @click="searchSubmit">模糊搜索</el-button>
</el-form-item>
</el-form>
</el-card>
<div style="padding: 10px;" v-loading="columnListLoading">
<el-table :data="columnList" stripe border style="width: 100%; margin-bottom: 5px;">
<el-table-column prop="tableName" label="表名" width="200"></el-table-column>
<el-table-column prop="columnName" label="字段名" width="200"></el-table-column>
<el-table-column prop="description" label="注释"></el-table-column>
</el-table>
</div>
</div>
</template>
<script>
import global from '../../common/config/global'
var app;
export default {
data() {
return {
columnListLoading: false,
vueQueryParam: {},
columnList: [],
tableInfo: [],
keyword: '',
};
},
beforeRouteUpdate(to, from, next) {
this.initQueryParam(to);
next();
},
mounted: function () {
app = this;
this.initQueryParam(this.$route);
// 延迟设置展开的目录edit比app先初始化
setTimeout(function () {
2019-08-21 20:39:43 +08:00
global.vue.$app.initLoadDataList(app.vueQueryParam.sourceId, app.vueQueryParam.host, app.vueQueryParam.dbName);
2019-07-04 21:52:39 +08:00
}, 500);
},
methods: {
initQueryParam(to) {
this.vueQueryParam = to.query;
},
searchSubmit() {
this.columnListLoading = true;
this.vueQueryParam.searchText = this.keyword;
this.common.post(this.apilist1.tableAndColumnBySearch, this.vueQueryParam, function (json) {
app.columnList = json.data || [];
app.columnListLoading = false;
});
},
}
}
</script>
<style>
2019-07-05 22:40:40 +08:00
.table-database-vue .el-table td, .table-database-vue .el-table th{padding: 5px 0;}
2019-07-04 21:52:39 +08:00
</style>