columns.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // import * as R from 'ramda'
  2. import {
  3. getNameDescriptionTableColumn,
  4. getBrandTableColumn,
  5. getAccountTableColumn,
  6. getRegionTableColumn,
  7. getProjectDomainTableColumn,
  8. getStatusTableColumn,
  9. getTagTableColumn,
  10. } from '@/utils/common/tableColumn'
  11. // import VueI18n from 'vue-i18n'
  12. import i18n from '@/locales'
  13. // import { getTagColor, getTagTitle } from '@/utils/common/tag'
  14. export default {
  15. created () {
  16. this.columns = [
  17. getNameDescriptionTableColumn({
  18. onManager: this.onManager,
  19. hideField: true,
  20. edit: false,
  21. slotCallback: row => {
  22. return (
  23. <side-page-trigger onTrigger={() => this.handleOpenSidepage(row, '')}>{row.name}</side-page-trigger>
  24. )
  25. },
  26. }),
  27. getTagTableColumn({ onManager: this.onManager, resource: 'waf_instances', columns: () => this.columns, tipName: this.$t('network.waf') }),
  28. getStatusTableColumn({ statusModule: 'waf', vm: this }),
  29. {
  30. field: 'type',
  31. title: i18n.t('network.waf.type'),
  32. slots: {
  33. default: ({ row }) => {
  34. const ret = []
  35. const type = this.$getI18n(`network.waf.type.${row.type}`, row.type)
  36. ret.push(<div>{type}</div>)
  37. if (row.brand === 'Qcloud') {
  38. ret.push(<list-body-cell-wrap hide-field copy field="cname" row={row}>
  39. <span class='text-weak'>{row.cname}</span>
  40. </list-body-cell-wrap>)
  41. }
  42. return ret
  43. },
  44. },
  45. formatter: ({ row }) => {
  46. const ret = []
  47. const type = this.$getI18n(`network.waf.type.${row.type}`, row.type)
  48. ret.push(type)
  49. if (row.brand === 'Qcloud') {
  50. ret.push(row.cname)
  51. }
  52. return ret.join(',')
  53. },
  54. },
  55. getBrandTableColumn(),
  56. getAccountTableColumn(),
  57. getProjectDomainTableColumn(),
  58. getRegionTableColumn(),
  59. ]
  60. },
  61. }