DetailTable.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <a-card :bordered="false" size="small">
  3. <template #title>
  4. <dialog-selected-tips :name="$t('dictionary.identity_provider')" :count="data.length" :action="$t('system.text_246')" />
  5. </template>
  6. <dialog-table :data="data" :columns="columns" />
  7. </a-card>
  8. </template>
  9. <script>
  10. import {
  11. getNameDescriptionTableColumn,
  12. getCopyWithContentTableColumn,
  13. } from '@/utils/common/tableColumn'
  14. export default {
  15. name: 'IDPDetailTable',
  16. props: {
  17. data: {
  18. type: Array,
  19. required: true,
  20. },
  21. },
  22. data () {
  23. const driverOptions = Object.keys(this.$t('idpDrivers')).reduce((prev, current) => {
  24. prev[current.toLowerCase()] = current
  25. return prev
  26. }, {})
  27. return {
  28. columns: [
  29. getNameDescriptionTableColumn({
  30. edit: false,
  31. editDesc: false,
  32. }),
  33. {
  34. field: 'driver',
  35. title: this.$t('system.text_204'),
  36. minWidth: 80,
  37. showOverflow: 'ellipsis',
  38. formatter: ({ cellValue }) => {
  39. return driverOptions[cellValue] || cellValue
  40. },
  41. },
  42. getCopyWithContentTableColumn({
  43. field: 'template',
  44. title: this.$t('common_550'),
  45. hideField: true,
  46. message: (row) => {
  47. const v = row.template || row.driver
  48. return this.$t('idpTmplTitles')[v] ? this.$t(`idpTmplTitles.${v}`) : v || '-'
  49. },
  50. slotCallback: (row) => {
  51. const v = row.template || row.driver
  52. return this.$t('idpTmplTitles')[v] ? this.$t(`idpTmplTitles.${v}`) : v || '-'
  53. },
  54. }),
  55. {
  56. minWidth: 120,
  57. field: 'project_domain',
  58. title: this.$t('common_548'),
  59. slots: {
  60. default: ({ row }, h) => {
  61. if (!row.project_domain) return this.$t('system.text_15')
  62. return [
  63. <list-body-cell-wrap copy field={'project_domain'} row={row} hideField={true} message={row.project_domain}>
  64. {row.project_domain}{this.$t('dictionary.domain')}
  65. </list-body-cell-wrap>,
  66. ]
  67. },
  68. },
  69. },
  70. ],
  71. }
  72. },
  73. }
  74. </script>