Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
OrangeM21 2020-06-16 18:22:55 +08:00
commit dba6276f36
7 changed files with 20 additions and 17 deletions

View File

@ -1,5 +1,5 @@
<template>
<DataTable ref="dataTable" v-loading="loading" :config="iConfig" v-bind="$attrs" v-on="$listeners" />
<DataTable v-if="!loading" ref="dataTable" v-loading="loading" :config="iConfig" v-bind="$attrs" v-on="$listeners" />
</template>
<script type="text/jsx">
@ -21,12 +21,14 @@ export default {
return {
loading: true,
method: 'get',
iConfig: {},
autoConfig: {},
meta: {}
}
},
computed: {
iConfig() {
return Object.assign(this.config, this.autoConfig)
}
},
watch: {
config: {
@ -36,11 +38,11 @@ export default {
deep: true
}
},
mounted() {
created() {
this.optionUrlMetaAndGenCols()
},
methods: {
optionUrlMetaAndGenCols() {
async optionUrlMetaAndGenCols() {
const url = (this.config.url.indexOf('?') === -1) ? `${this.config.url}?draw=1&display=1` : `${this.config.url}&draw=1&display=1`
this.$store.dispatch('common/getUrlMeta', { url: url }).then(data => {
this.meta = data.actions[this.method.toUpperCase()] || {}
@ -141,7 +143,6 @@ export default {
}
}
this.autoConfig.columns = columns
this.iConfig = Object.assign(this.config, this.autoConfig)
}
}
}

View File

@ -739,7 +739,6 @@ export default {
},
computed: {
hasSelect() {
console.log(this.columns.length && this.columns[0].type === 'selection')
return this.columns.length && this.columns[0].type === 'selection'
},
selectable() {

View File

@ -1,5 +1,5 @@
<template>
<TreeTable :table-config="tableConfig" :header-actions="headerActions" :tree-setting="treeSetting" />
<TreeTable ref="TreeTable" :table-config="tableConfig" :header-actions="headerActions" :tree-setting="treeSetting" />
</template>
<script type="text/jsx">
@ -29,7 +29,8 @@ export default {
const initialUrl = vm.tableConfig.initialUrl
const nodeId = node.meta.node.id
const url = initialUrl.replace('/assets/', `/nodes/${nodeId}/assets/`)
vm.tableConfig.url = url
// vm.tableConfig.url = url
vm.$refs.TreeTable.handleUrlChange(url)
}
},
getShowUrl: {

View File

@ -68,7 +68,9 @@ export default {
this.dataTable.getList()
},
search(attrs) {
if (Object.keys(attrs).length > 0) {
return this.dataTable.search(attrs, true)
}
},
handleDateChange(attrs) {
this.$set(this.extraQuery, 'date_from', attrs[0].toISOString())
@ -77,10 +79,11 @@ export default {
// date_from: attrs[0].toISOString(),
// date_to: attrs[1].toISOString()
// }
return this.dataTable.searchDate({
const query = {
date_from: attrs[0].toISOString(),
date_to: attrs[1].toISOString()
})
}
return this.dataTable.searchDate(query)
},
toggleRowSelection(row, isSelected) {
return this.dataTable.toggleRowSelection(row, isSelected)

View File

@ -13,7 +13,6 @@ export default {
data() {
return {
initial: {
},
fields: [
[this.$t('common.Basic'), ['name', 'assets', 'comment']]

View File

@ -99,11 +99,11 @@ export default {
children: [
{
value: '1',
label: this.$t('common.Validity')
label: this.$t('common.Yes')
},
{
value: '0',
label: this.$t('common.Invalidity')
label: this.$t('common.No')
}
]
},

View File

@ -24,7 +24,7 @@ export default {
hasTree: true,
columns: [
'name', 'users_amount', 'user_groups_amount', 'assets_amount',
'nodes_amount', 'system_users_amount', 'is_active', 'actions'
'nodes_amount', 'system_users_amount', 'is_valid', 'actions'
],
columnsMeta: {
name: {
@ -82,11 +82,11 @@ export default {
children: [
{
value: '1',
label: this.$t('common.Validity')
label: this.$t('common.Yes')
},
{
value: '0',
label: this.$t('common.Invalidity')
label: this.$t('common.No')
}
]
},