CommentPanel.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div class="comment-tabs-warp" v-if="showStatus">
  3. <a-tabs @change="handleChange" :animated="false">
  4. <a-tab-pane tab="评论" key="comment" class="comment-list-tab">
  5. <comment-list :tableName="tableName" :dataId="dataId" :datetime="datetime1"></comment-list>
  6. </a-tab-pane>
  7. <a-tab-pane tab="文件" key="file">
  8. <comment-files :tableName="tableName" :dataId="dataId" :datetime="datetime2"></comment-files>
  9. </a-tab-pane>
  10. <a-tab-pane tab="日志" key="log">
  11. <data-log-list :tableName="tableName" :dataId="dataId" :datetime="datetime3"></data-log-list>
  12. </a-tab-pane>
  13. </a-tabs>
  14. </div>
  15. <a-empty v-else description="新增页面不支持评论" />
  16. </template>
  17. <script>
  18. /**
  19. * 评论区域
  20. */
  21. import { propTypes } from '/@/utils/propTypes';
  22. import { computed, ref } from 'vue';
  23. import CommentList from './CommentList.vue';
  24. import CommentFiles from './CommentFiles.vue';
  25. import DataLogList from './DataLogList.vue';
  26. export default {
  27. name: 'CommentPanel',
  28. components: {
  29. CommentList,
  30. CommentFiles,
  31. DataLogList,
  32. },
  33. props: {
  34. tableName: propTypes.string.def(''),
  35. dataId: propTypes.string.def(''),
  36. },
  37. setup(props) {
  38. const showStatus = computed(() => {
  39. if (props.dataId && props.tableName) {
  40. return true;
  41. }
  42. return false;
  43. });
  44. const datetime1 = ref(1);
  45. const datetime2 = ref(1);
  46. const datetime3 = ref(1);
  47. function handleChange(e) {
  48. let temp = new Date().getTime();
  49. if (e == 'comment') {
  50. datetime1.value = temp;
  51. } else if (e == 'file') {
  52. datetime2.value = temp;
  53. } else {
  54. datetime3.value = temp;
  55. }
  56. }
  57. // VUEN-1978【bug】online关联记录和他表字段存在问题 20 修改完数据,再次打开不切换tab的时候,修改日志没有变化
  58. function reload() {
  59. let temp = new Date().getTime();
  60. datetime1.value = temp;
  61. datetime2.value = temp;
  62. datetime3.value = temp;
  63. }
  64. return {
  65. showStatus,
  66. handleChange,
  67. datetime1,
  68. datetime2,
  69. datetime3,
  70. reload
  71. };
  72. },
  73. };
  74. </script>
  75. <style lang="less" scoped>
  76. .comment-tabs-warp {
  77. height: 100%;
  78. overflow: visible;
  79. > .ant-tabs {
  80. overflow: visible;
  81. }
  82. }
  83. //antd3升级后,表单右侧讨论样式调整
  84. ::v-deep(.ant-tabs-top .ant-tabs-nav, .ant-tabs-bottom .ant-tabs-nav, .ant-tabs-top div .ant-tabs-nav, .ant-tabs-bottom div .ant-tabs-nav) {
  85. margin: 0 16px 0;
  86. }
  87. </style>