| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- import {
- getNameDescriptionTableColumn,
- getStatusTableColumn,
- getBrandTableColumn,
- getAccountTableColumn,
- getTimeTableColumn,
- getPublicScopeTableColumn,
- getProjectTableColumn,
- getTagTableColumn,
- } from '@/utils/common/tableColumn'
- import i18n from '@/locales'
- const Areas = {
- mainland: i18n.t('network.cdn.area.mainland'),
- overseas: i18n.t('network.cdn.area.overseas'),
- global: i18n.t('network.cdn.area.global'),
- }
- const ServiceTypes = {
- web: i18n.t('network.cdn.service_type.web'),
- download: i18n.t('network.cdn.service_type.download'),
- media: i18n.t('network.cdn.service_type.media'),
- }
- export const getAreaColumn = ({ field = 'area', title = i18n.t('network.cdn.area') } = {}) => {
- return {
- field,
- title,
- slots: {
- default: ({ row }, h) => {
- const area = row.area && row.area.toLowerCase()
- return Areas[area] || area || '-'
- },
- },
- }
- }
- export const getServiceTypeColumn = ({ field = 'service_type', title = i18n.t('network.cdn.service_type') } = {}) => {
- return {
- field,
- title,
- slots: {
- default: ({ row }, h) => {
- const serviceType = row.service_type && row.service_type.toLowerCase()
- return ServiceTypes[serviceType] || serviceType || '-'
- },
- },
- }
- }
- export const getCnameTableColumn = ({ field = 'cname', title = i18n.t('network.cdn.cname') } = {}) => {
- return {
- field,
- title,
- slots: {
- default: ({ row }, h) => {
- return row.cname || '-'
- },
- },
- }
- }
- export const getDomainTableColumn = ({ field = 'external_id', title = i18n.t('network.cdn.domain') } = {}) => {
- return {
- field,
- title,
- slots: {
- default: ({ row }, h) => {
- return row.external_id || '-'
- },
- },
- }
- }
- export default {
- created () {
- this.columns = [
- getNameDescriptionTableColumn({
- onManager: this.onManager,
- hideField: true,
- addLock: true,
- slotCallback: row => {
- return (
- <side-page-trigger onTrigger={ () => this.handleOpenSidepage(row) }>{ row.name }</side-page-trigger>
- )
- },
- }),
- getStatusTableColumn({ statusModule: 'cdnDomain', vm: this }),
- getTagTableColumn({ onManager: this.onManager, resource: 'cdn_domains', columns: () => this.columns }),
- getAreaColumn({}),
- getCnameTableColumn({}),
- getServiceTypeColumn({}),
- getBrandTableColumn(),
- getAccountTableColumn(),
- getPublicScopeTableColumn({ vm: this, resource: 'cdn_domains' }),
- getProjectTableColumn(),
- getTimeTableColumn(),
- ]
- },
- }
|