index.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <base-side-page
  3. @cancel="cancelSidePage"
  4. :title="$t('dictionary.contact')"
  5. icon="res-contact"
  6. :res-name="detailData.name"
  7. :actions="params.actions"
  8. :current-tab="params.windowData.currentTab"
  9. :tabs="detailTabs"
  10. :loaded="loaded"
  11. @tab-change="handleTabChange">
  12. <template v-slot:actions>
  13. <actions :options="singleActions" :row="detailData" button-type="link" button-size="small" />
  14. </template>
  15. <component
  16. :is="params.windowData.currentTab"
  17. :id="listId"
  18. :data="detailData"
  19. :res-id="data.id"
  20. res-type="receiver"
  21. :onManager="onManager" />
  22. </base-side-page>
  23. </template>
  24. <script>
  25. import * as R from 'ramda'
  26. import SidePageMixin from '@/mixins/sidePage'
  27. import WindowsMixin from '@/mixins/windows'
  28. import Actions from '@/components/PageList/Actions'
  29. import ColumnsMixin from '../mixins/columns'
  30. import SingleActionsMixin from '../mixins/singleActions'
  31. import ContactDetail from './Detail'
  32. export default {
  33. name: 'ContactSidePage',
  34. components: {
  35. Actions,
  36. ContactDetail,
  37. },
  38. mixins: [SidePageMixin, WindowsMixin, ColumnsMixin, SingleActionsMixin],
  39. data () {
  40. return {
  41. detailTabs: [
  42. { label: this.$t('system.text_159'), key: 'contact-detail' },
  43. { label: this.$t('system.text_17'), key: 'event-drawer' },
  44. ],
  45. }
  46. },
  47. computed: {
  48. listId () {
  49. switch (this.params.windowData.currentTab) {
  50. case 'event-drawer':
  51. return 'EventListForContactSidePage'
  52. default:
  53. return ''
  54. }
  55. },
  56. },
  57. methods: {
  58. parseDetail (detail) {
  59. const ret = {
  60. enabled: true,
  61. email: {
  62. enabled: false,
  63. verified: false,
  64. contact: '',
  65. },
  66. mobile: {
  67. enabled: false,
  68. verified: false,
  69. contact: '',
  70. },
  71. }
  72. if (!R.is(String, detail)) return ret
  73. const arr = JSON.parse(detail)
  74. arr.forEach(item => {
  75. ret[item.contact_type] = item
  76. if (!item.enabled) {
  77. ret.enabled = false
  78. }
  79. })
  80. return ret
  81. },
  82. },
  83. }
  84. </script>