meetingTabMixin.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import { getTabIndex, getMeeting, getManage, getCurTabStatus, getMeetingMemberTypeDicts, getMembers, getSubjectSelectedIndex, getUserMap, getOfficeNameMap, getDicts } from '@/utils/meetingUtils'
  2. import { mapGetters } from 'vuex';
  3. export default {
  4. filters: {
  5. replaceMeetingName: function (value, meeting) {
  6. if (value) {
  7. return value.replace(/#会议名称#/, meeting.meetingName);
  8. }
  9. return '';
  10. }
  11. },
  12. props: {
  13. meetingId: {
  14. type: String,
  15. default: ''
  16. },
  17. comIndex: {
  18. type: [Number, String],
  19. default: 0
  20. }
  21. },
  22. computed: {
  23. ...mapGetters({
  24. inSelectSubjects: 'meeting/inSelectSubjects',
  25. noStartStatus: 'meeting/noStartStatus',
  26. userCanVote: 'meeting/userCanVote',
  27. role: 'meeting/role',
  28. canVoteSubjects: 'meeting/canVoteSubjects',
  29. }),
  30. isEnd: function() {
  31. return this.$store.state.meeting.isEnd;
  32. },
  33. tabIndex: function() {
  34. return getTabIndex(this);
  35. },
  36. meeting: function() {
  37. return getMeeting(this);
  38. },
  39. manage: function() {
  40. return getManage(this);
  41. },
  42. curTabStatus: function() {
  43. var index = this.comIndex;
  44. if (this.subTabIndex <= this.comIndex) {
  45. index = this.comIndex + this.inSelectSubjects.length - 1;
  46. }
  47. return getCurTabStatus(this, index);
  48. },
  49. user: function() {
  50. return this.$store.state.user.user;
  51. },
  52. userMap: function() {
  53. return getUserMap(this);
  54. },
  55. officeNameMap: function() {
  56. return getOfficeNameMap(this);
  57. },
  58. userOfficeMap: function() {
  59. return this.$store.state.meeting.userOfficeMap;
  60. },
  61. meetingSessions() {
  62. return this.$store.state.meeting.meetingSessions || [];
  63. },
  64. subTabIndex() {
  65. return this.$store.state.meeting.subTabIndex;
  66. },
  67. tabStatus: function() {
  68. return this.$store.state.meeting.tabStatus || [];
  69. },
  70. meetingMemberTypeMap: function() {
  71. return getMeetingMemberTypeDicts(this).array2Obj('value', 'label');
  72. },
  73. members: function() {
  74. return getMembers(this);
  75. },
  76. member: function() {
  77. return this.members[this.members.indexOf(this.user.userId, 'userId')];
  78. },
  79. voteOptionMap: function() {
  80. return getDicts(this, 3).array2Obj('value', 'label');
  81. },
  82. ratingItemMap: function() {
  83. return getDicts(this, 2).array2Obj('value', 'label');
  84. },
  85. subjectSelectedIndex: function() {
  86. return getSubjectSelectedIndex(this);
  87. },
  88. subjectVoteRefresh: function() {
  89. return this.$store.state.meeting.subjectVoteRefresh;
  90. },
  91. myVoteDetailMap: function() {
  92. return this.$store.state.meeting.voteInfo.myVoteDetailMap || {};
  93. },
  94. voteSubjectIds: function() {
  95. return this.$store.state.meeting.voteInfo.voteSubjectIds || [];
  96. },
  97. disabledSubjectIds: function () {
  98. return this.$store.state.meeting.disabledSubjectIds || [];
  99. },
  100. voteStep: function() {
  101. return this.$store.state.meeting.voteInfo.voteStep || 1;
  102. },
  103. meetingSubjects() {
  104. return this.$store.state.meeting.meetingSubjects;
  105. }
  106. },
  107. methods: {
  108. getSubjectIndex(subjectId) {
  109. let index = this.meetingSubjects.indexOf(subjectId, 'id');
  110. return index == -1 ? '' : (index + 1);
  111. }
  112. }
  113. }