mirror of https://github.com/veops/cmdb.git
delay render
This commit is contained in:
parent
4d000d9805
commit
029c12365a
|
@ -20,6 +20,10 @@ export default {
|
||||||
type: [String, Function],
|
type: [String, Function],
|
||||||
default: 'key'
|
default: 'key'
|
||||||
},
|
},
|
||||||
|
loaded: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
data: {
|
data: {
|
||||||
type: Function,
|
type: Function,
|
||||||
required: true
|
required: true
|
||||||
|
@ -265,6 +269,14 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
|
if (!this.loaded) {
|
||||||
|
return (
|
||||||
|
<div style="width: 100%; height:160px; text-align: center; line-height:160px">
|
||||||
|
<a-spin tip="Loading...">
|
||||||
|
</a-spin>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
const props = {}
|
const props = {}
|
||||||
const localKeys = Object.keys(this.$data)
|
const localKeys = Object.keys(this.$data)
|
||||||
const showAlert = (typeof this.alert === 'object' && this.alert !== null && this.alert.show) && typeof this.rowSelection.selectedRowKeys !== 'undefined' || this.alert
|
const showAlert = (typeof this.alert === 'object' && this.alert !== null && this.alert.show) && typeof this.rowSelection.selectedRowKeys !== 'undefined' || this.alert
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
ref="table"
|
ref="table"
|
||||||
size="middle"
|
size="middle"
|
||||||
rowKey="ci_id"
|
rowKey="ci_id"
|
||||||
|
:loaded="tableLoaded"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:data="loadInstances"
|
:data="loadInstances"
|
||||||
:alert="options.alert"
|
:alert="options.alert"
|
||||||
|
@ -172,6 +173,7 @@ export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
|
tableLoaded: false,
|
||||||
loadTip: '',
|
loadTip: '',
|
||||||
pageSizeOptions: ['10', '25', '50', '100'],
|
pageSizeOptions: ['10', '25', '50', '100'],
|
||||||
form: this.$form.createForm(this),
|
form: this.$form.createForm(this),
|
||||||
|
@ -191,6 +193,7 @@ export default {
|
||||||
instanceList: [],
|
instanceList: [],
|
||||||
columns: [],
|
columns: [],
|
||||||
loadInstances: parameter => {
|
loadInstances: parameter => {
|
||||||
|
this.tableLoaded = false
|
||||||
const params = Object.assign(parameter, this.$refs.search.queryParam)
|
const params = Object.assign(parameter, this.$refs.search.queryParam)
|
||||||
let q = `q=_type:${this.$router.currentRoute.meta.typeId}`
|
let q = `q=_type:${this.$router.currentRoute.meta.typeId}`
|
||||||
Object.keys(params).forEach(key => {
|
Object.keys(params).forEach(key => {
|
||||||
|
@ -219,6 +222,10 @@ export default {
|
||||||
result.totalPage = Math.ceil(res.numfound / params.pageSize)
|
result.totalPage = Math.ceil(res.numfound / params.pageSize)
|
||||||
result.data = Object.assign([], res.result)
|
result.data = Object.assign([], res.result)
|
||||||
result.data.forEach((item, index) => (item.key = item.ci_id))
|
result.data.forEach((item, index) => (item.key = item.ci_id))
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.tableLoaded = true
|
||||||
|
})
|
||||||
|
|
||||||
if (res.numfound) {
|
if (res.numfound) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setColumnWidth()
|
this.setColumnWidth()
|
||||||
|
|
Loading…
Reference in New Issue