| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <template>
- <page-list
- :list="list"
- :columns="columns"
- :group-actions="groupActions"
- :single-actions="singleActions"
- :export-data-options="exportDataOptions" />
- </template>
- <script>
- import get from 'lodash/get'
- import * as R from 'ramda'
- import { mapGetters } from 'vuex'
- import expectStatus from '@/constants/expectStatus'
- import { getNameFilter } from '@/utils/common/tableFilter'
- import WindowsMixin from '@/mixins/windows'
- import ListMixin from '@/mixins/list'
- import ColumnsMixin from '../mixins/columns'
- import SingleActionsMixin from '../mixins/singleActions'
- export default {
- name: 'CloudaccountList',
- mixins: [WindowsMixin, ListMixin, ColumnsMixin, SingleActionsMixin],
- props: {
- id: String,
- getParams: {
- type: [Object, Function],
- default: () => ({}),
- },
- cloudaccount: Object,
- },
- data () {
- return {
- list: this.$list.createList(this, {
- id: this.id,
- resource: 'samlusers',
- getParams: this.getParam,
- apiVersion: 'v1',
- steadyStatus: Object.values(expectStatus.samluser).flat(),
- filterOptions: {
- name: getNameFilter(),
- },
- }),
- groupActions: [
- {
- label: this.$t('cloudenv.text_104'),
- permission: 'samlusers_create',
- action: () => {
- this.createDialog('SamluserCreateDialog', {
- onManager: this.onManager,
- cloudaccount: this.cloudaccount,
- defaultDomainId: this.userInfo.projectDomainId,
- defaultProjectId: this.userInfo.projectId,
- userId: this.userInfo.id,
- })
- },
- meta: () => {
- return {
- validate: (this.$store.getters.isAdminMode || get(this.cloudaccount, 'domain_id') === this.$store.getters.userInfo.projectDomainId),
- buttonType: 'primary',
- }
- },
- },
- {
- label: this.$t('table.action.delete'),
- permission: 'samlusers_delete',
- action: () => {
- this.createDialog('DeleteResDialog', {
- vm: this,
- data: this.list.selectedItems,
- columns: this.columns,
- title: this.$t('table.action.delete'),
- name: this.$t('res.samlusers'),
- onManager: this.onManager,
- })
- },
- meta: () => this.$getDeleteResult(this.list.selectedItems),
- },
- ],
- }
- },
- computed: {
- ...mapGetters(['userInfo']),
- exportDataOptions () {
- return {
- title: this.$t('dictionary.samluser'),
- downloadType: 'local',
- items: [
- { field: 'id', title: 'ID' },
- ...this.columns,
- { field: 'manager', title: this.$t('common_624', [this.$t('dictionary.cloudprovider')]) },
- ],
- }
- },
- },
- watch: {
- cloudEnv (val) {
- this.$nextTick(() => {
- this.list.fetchData(0)
- })
- },
- },
- created () {
- this.initSidePageTab('samluser-detail')
- this.list.fetchData()
- },
- methods: {
- getParam () {
- const ret = {
- ...(R.is(Function, this.getParams) ? this.getParams() : this.getParams),
- }
- if (this.cloudEnv) ret.cloud_env = this.cloudEnv
- return ret
- },
- handleOpenSidepage (row) {
- this.sidePageTriggerHandle(this, 'SamluserSidePage', {
- id: row.id,
- resource: 'samlusers',
- getParams: this.getParams,
- refresh: this.refresh,
- apiVersion: 'v1',
- }, {
- list: this.list,
- })
- },
- },
- }
- </script>
|