columns.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import i18n from '@/locales'
  2. export const getAccessUrlTableColumn = () => {
  3. return {
  4. field: 'access_url',
  5. title: i18n.t('cloudenv.text_96'),
  6. minWidth: 100,
  7. showOverflow: 'ellipsis',
  8. slots: {
  9. default: ({ row }, h) => {
  10. if (!row.access_url) return '-'
  11. let txt
  12. Object.keys(i18n.t('cloudAccountAccessType')).forEach(k => {
  13. if (row.access_url.indexOf(k) > -1) {
  14. let _k = k
  15. if (row.brand !== 'Aliyun' && k === 'InternationalCloud') {
  16. _k = 'Internation'
  17. }
  18. txt = i18n.t('cloudAccountAccessType')[_k]
  19. }
  20. })
  21. return txt ||
  22. [
  23. <a class="link-color" target="_blank" href={ row.access_url }>{ row.access_url }</a>,
  24. ]
  25. },
  26. },
  27. }
  28. }
  29. export const getAccountTableColumn = () => {
  30. return {
  31. field: 'account',
  32. title: i18n.t('cloudenv.text_353'),
  33. showOverflow: 'ellipsis',
  34. minWidth: 160,
  35. slots: {
  36. default: ({ row }, h) => {
  37. const subscribeIds = (row.account && row.account.split('/')) || []
  38. const text = subscribeIds.length > 1 ? subscribeIds[1] : subscribeIds[0]
  39. return [
  40. <list-body-cell-wrap message={text} copy hideField={true}>
  41. <span>{text}</span>
  42. </list-body-cell-wrap>,
  43. ]
  44. },
  45. },
  46. }
  47. }