TableForm.vue
2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<template>
<el-dialog title="数据选择" :close-on-click-modal="false" width="700px"
class="NCC-dialog NCC-dialog_center table-dialog" lock-scroll append-to-body v-bind="$attrs"
v-on="$listeners" @open="onOpen">
<el-row class="NCC-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="10">
<el-form-item label="关键词">
<el-input v-model="keyword" placeholder="请输入关键词查询" clearable
@keyup.enter.native="initData()" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="initData()">
{{$t('common.search')}}</el-button>
<el-button icon="el-icon-refresh-right" @click="refresh()">{{$t('common.reset')}}
</el-button>
</el-form-item>
</el-col>
</el-form>
<div class="NCC-common-search-box-right">
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh NCC-common-head-icon" :underline="false"
@click="refresh()" />
</el-tooltip>
</div>
</el-row>
<NCC-table v-loading="listLoading" :data="list" hasC @selection-change="handleSelectionChange"
:border="false">
<el-table-column prop="table" label="表名" show-overflow-tooltip />
<el-table-column prop="sum" label="总数" width="90" />
<el-table-column prop="tableName" label="说明" width="150" show-overflow-tooltip />
</NCC-table>
<span slot="footer" class="dialog-footer">
<el-button @click="closeDialog">{{$t('common.cancelButton')}}</el-button>
<el-button type="primary" @click="select()">{{$t('common.confirmButton')}}</el-button>
</span>
</el-dialog>
</template>
<script>
import { DataModelList } from '@/api/systemData/dataModel'
export default {
props: ['dbLinkId'],
data() {
return {
listLoading: true,
keyword: '',
list: [],
checked: []
}
},
methods: {
onOpen() {
this.initData()
},
closeDialog() {
this.$emit('update:visible', false)
},
refresh() {
this.keyword = ''
this.initData()
},
initData() {
this.listLoading = true
const dbLinkId = this.dbLinkId || '0'
DataModelList(dbLinkId, { keyword: this.keyword }).then(res => {
this.list = res.data.list
this.listLoading = false
})
},
select() {
this.$emit('closeForm', this.checked)
this.$emit('update:visible', false)
},
handleSelectionChange(val) {
this.checked = val
}
}
}
</script>
<style lang="scss" scoped>
.table-dialog {
>>> .el-dialog__body {
height: 70vh;
padding: 0 !important;
display: flex;
flex-direction: column;
overflow: hidden;
.NCC-common-search-box {
margin-bottom: 0;
.NCC-common-search-box-right {
padding: 10px 10px 0 0;
}
}
}
}
</style>