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> <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> </template>
<script type="text/jsx"> <script type="text/jsx">
@ -21,12 +21,14 @@ export default {
return { return {
loading: true, loading: true,
method: 'get', method: 'get',
iConfig: {},
autoConfig: {}, autoConfig: {},
meta: {} meta: {}
} }
}, },
computed: { computed: {
iConfig() {
return Object.assign(this.config, this.autoConfig)
}
}, },
watch: { watch: {
config: { config: {
@ -36,11 +38,11 @@ export default {
deep: true deep: true
} }
}, },
mounted() { created() {
this.optionUrlMetaAndGenCols() this.optionUrlMetaAndGenCols()
}, },
methods: { 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` 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.$store.dispatch('common/getUrlMeta', { url: url }).then(data => {
this.meta = data.actions[this.method.toUpperCase()] || {} this.meta = data.actions[this.method.toUpperCase()] || {}
@ -141,7 +143,6 @@ export default {
} }
} }
this.autoConfig.columns = columns this.autoConfig.columns = columns
this.iConfig = Object.assign(this.config, this.autoConfig)
} }
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -24,7 +24,7 @@ export default {
hasTree: true, hasTree: true,
columns: [ columns: [
'name', 'users_amount', 'user_groups_amount', 'assets_amount', '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: { columnsMeta: {
name: { name: {
@ -82,11 +82,11 @@ export default {
children: [ children: [
{ {
value: '1', value: '1',
label: this.$t('common.Validity') label: this.$t('common.Yes')
}, },
{ {
value: '0', value: '0',
label: this.$t('common.Invalidity') label: this.$t('common.No')
} }
] ]
}, },