2021-03-03 15:06:52 +08:00
|
|
|
<template>
|
2021-05-26 11:00:41 +08:00
|
|
|
<el-col ref="container" style="width: 100%;height:100%">
|
2021-03-03 17:38:41 +08:00
|
|
|
<span>{{ table.name }}</span>
|
2021-03-15 15:51:34 +08:00
|
|
|
<ux-grid
|
|
|
|
ref="plxTable"
|
2021-03-03 17:38:41 +08:00
|
|
|
size="mini"
|
2021-03-15 15:51:34 +08:00
|
|
|
style="width: 100%;"
|
|
|
|
:height="height"
|
|
|
|
:checkbox-config="{highlight: true}"
|
2021-03-16 11:55:22 +08:00
|
|
|
:width-resize="true"
|
2021-03-03 17:38:41 +08:00
|
|
|
>
|
2021-03-15 15:51:34 +08:00
|
|
|
<ux-table-column
|
2021-03-03 17:38:41 +08:00
|
|
|
v-for="field in fields"
|
2021-05-11 12:40:12 +08:00
|
|
|
:key="field.dataeaseName"
|
2021-03-03 17:38:41 +08:00
|
|
|
min-width="200px"
|
2021-05-11 12:40:12 +08:00
|
|
|
:field="field.dataeaseName"
|
2021-03-15 15:51:34 +08:00
|
|
|
:title="field.name"
|
|
|
|
:resizable="true"
|
2021-03-03 17:38:41 +08:00
|
|
|
/>
|
2021-03-15 15:51:34 +08:00
|
|
|
</ux-grid>
|
2021-05-28 16:04:59 +08:00
|
|
|
<span style="font-size: 12px;">{{ $t('chart.preview_100_data') }}</span>
|
2021-03-03 17:38:41 +08:00
|
|
|
</el-col>
|
2021-03-03 15:06:52 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-03-03 18:35:51 +08:00
|
|
|
import { post } from '@/api/dataset/dataset'
|
|
|
|
|
2021-03-03 15:06:52 +08:00
|
|
|
export default {
|
2021-03-03 17:38:41 +08:00
|
|
|
name: 'DatasetTableData',
|
2021-03-03 15:06:52 +08:00
|
|
|
props: {
|
2021-03-15 15:51:34 +08:00
|
|
|
table: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
}
|
2021-03-03 15:06:52 +08:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
fields: [],
|
2021-03-15 15:51:34 +08:00
|
|
|
data: [],
|
2021-05-26 11:00:41 +08:00
|
|
|
height: 'auto'
|
2021-03-03 15:06:52 +08:00
|
|
|
}
|
|
|
|
},
|
2021-03-03 17:38:41 +08:00
|
|
|
watch: {
|
|
|
|
table() {
|
|
|
|
this.initData()
|
|
|
|
}
|
|
|
|
},
|
2021-03-03 15:06:52 +08:00
|
|
|
mounted() {
|
2021-05-26 11:00:41 +08:00
|
|
|
// window.onresize = () => {
|
|
|
|
// return (() => {
|
|
|
|
// this.height = window.innerHeight / 3
|
|
|
|
// })()
|
|
|
|
// }
|
|
|
|
// this.height = window.innerHeight / 3
|
2021-03-15 15:51:34 +08:00
|
|
|
this.initData()
|
2021-03-03 15:06:52 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
initData() {
|
2021-03-03 17:38:41 +08:00
|
|
|
this.resetData()
|
2021-03-03 15:06:52 +08:00
|
|
|
if (this.table.id) {
|
2021-05-28 16:04:59 +08:00
|
|
|
this.table.row = 100
|
|
|
|
post('/dataset/table/getPreviewData/1/100', this.table).then(response => {
|
2021-03-03 17:38:41 +08:00
|
|
|
this.fields = response.data.fields
|
|
|
|
this.data = response.data.data
|
2021-03-15 15:51:34 +08:00
|
|
|
const datas = this.data
|
2021-05-26 11:00:41 +08:00
|
|
|
if (response.data.status === 'warnning') {
|
|
|
|
this.$warning(response.data.msg, 3000)
|
2021-05-25 17:48:29 +08:00
|
|
|
}
|
2021-05-26 11:00:41 +08:00
|
|
|
if (response.data.status === 'error') {
|
|
|
|
this.$error(response.data.msg, 3000)
|
2021-05-25 17:48:29 +08:00
|
|
|
}
|
2021-03-15 15:51:34 +08:00
|
|
|
this.$refs.plxTable.reloadData(datas)
|
2021-03-03 17:38:41 +08:00
|
|
|
})
|
2021-03-03 15:06:52 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
resetData() {
|
2021-03-03 17:38:41 +08:00
|
|
|
this.fields = []
|
|
|
|
this.data = []
|
2021-03-03 15:06:52 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
</style>
|