diff --git a/src/api/orgs.js b/src/api/orgs.js new file mode 100644 index 000000000..34ec9acd7 --- /dev/null +++ b/src/api/orgs.js @@ -0,0 +1,15 @@ +import request from '@/utils/request' + +export function getOrgDetail(oid) { + return request({ + url: `/api/v1/orgs/orgs/current/?oid=${oid}`, + method: 'get' + }) +} + +export function getCurrentOrg() { + return request({ + url: `/api/v1/orgs/orgs/current/`, + method: 'get' + }) +} diff --git a/src/components/ListTable/TableAction/LeftSide.vue b/src/components/ListTable/TableAction/LeftSide.vue index e310b47ff..aecf5b623 100644 --- a/src/components/ListTable/TableAction/LeftSide.vue +++ b/src/components/ListTable/TableAction/LeftSide.vue @@ -16,6 +16,7 @@ export default { }, props: { hasCreate: defaultTrue, + canCreate: defaultTrue, hasBulkDelete: defaultTrue, hasBulkUpdate: defaultFalse, hasLeftActions: defaultTrue, @@ -66,7 +67,7 @@ export default { title: this.$t('common.Create'), type: 'primary', has: this.hasCreate, - can: true, + can: this.canCreate, callback: this.handleCreate } ], diff --git a/src/components/ListTable/formatters/ChoicesFormatter.vue b/src/components/ListTable/formatters/ChoicesFormatter.vue index ec1d22bd0..8bf0bbc91 100644 --- a/src/components/ListTable/formatters/ChoicesFormatter.vue +++ b/src/components/ListTable/formatters/ChoicesFormatter.vue @@ -28,6 +28,9 @@ export default { }, hasTips: false, tipStatus(val, vm) { + if (!val) { + return vm.$t('assets.Unknown') + } if (val.status === 0) { return vm.$t('assets.Unreachable') } else if (val.status === 1) { @@ -55,6 +58,9 @@ export default { return this.formatterArgs.tipStatus(this.cellValue, vm) }, tipTime() { + if (!this.cellValue) { + return '' + } return toSafeLocalDateStr(this.cellValue.datetime) } } diff --git a/src/components/ListTable/index.vue b/src/components/ListTable/index.vue index 06230d1fb..d59b104a5 100644 --- a/src/components/ListTable/index.vue +++ b/src/components/ListTable/index.vue @@ -42,21 +42,20 @@ export default { } }, computed: { - dataTable() { return this.$refs.dataTable.$refs.dataTable }, - hasCreateAction() { - const hasLeftAction = this.headerActions.hasLeftActions - if (hasLeftAction === false) { - return false - } - const hasCreate = this.headerActions.hasCreate - if (hasCreate === false) { - return false - } - return true - }, + // hasCreateAction() { + // const hasLeftAction = this.headerActions.hasLeftActions + // if (hasLeftAction === false) { + // return false + // } + // const hasCreate = this.headerActions.hasCreate + // if (hasCreate === false) { + // return false + // } + // return true + // }, iTableConfig() { const config = deepmerge(this.tableConfig, { extraQuery: this.extraQuery }) this.$log.debug('Header actions', this.headerActions) diff --git a/src/layout/components/GenericListPage/index.vue b/src/layout/components/GenericListPage/index.vue index 12f31f98e..39c876f60 100644 --- a/src/layout/components/GenericListPage/index.vue +++ b/src/layout/components/GenericListPage/index.vue @@ -1,16 +1,16 @@ diff --git a/src/layout/components/GenericListTable/index.vue b/src/layout/components/GenericListTable/index.vue new file mode 100644 index 000000000..1f223a184 --- /dev/null +++ b/src/layout/components/GenericListTable/index.vue @@ -0,0 +1,32 @@ + + + + + diff --git a/src/layout/components/GenericTreeListPage/index.vue b/src/layout/components/GenericTreeListPage/index.vue index 7a21bcd70..8b807bbf1 100644 --- a/src/layout/components/GenericTreeListPage/index.vue +++ b/src/layout/components/GenericTreeListPage/index.vue @@ -1,7 +1,7 @@