index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <script lang="ts" setup>
  2. import { ref } from 'vue';
  3. import mainData from '/src/views/reportManage/dataCenter/combinedDisplay/components/tableData/mainData.vue';
  4. import monthlyComparativeData
  5. from '/src/views/reportManage/dataCenter/combinedDisplay/components/tableData/monthlyComparativeData.vue';
  6. import planInfo from '/src/views/reportManage/dataCenter/combinedDisplay/components/tableData/planInfo.vue';
  7. // 筛选查询
  8. const selectorRef = ref(null);
  9. const taskIds = ref({});
  10. const dayDate = ref(null);
  11. const weekDate = ref(null);
  12. const monthDate = ref(null);
  13. const monthCurrentDate = ref({});
  14. const monthQueryParams = ref({
  15. taskIds,
  16. monthCurrentDate,
  17. });
  18. // 表格
  19. const showTable = ref('mainData'); // 初始显示表格
  20. const currentTable: any = {
  21. mainData,
  22. monthlyComparativeData,
  23. planInfo
  24. };
  25. const panes = [
  26. { label: '主数据', name: 'mainData' },
  27. { label: '月度对比数据', name: 'monthlyComparativeData' },
  28. { label: '计划销售额', name: 'planInfo' },
  29. ];
  30. // function updateDataChange(newId) {
  31. // if (selectorRef.value) {
  32. // taskIds.value = newId.value;
  33. // }
  34. // }
  35. //
  36. // const handelDateChange = (date) => {
  37. // monthCurrentDate.value = date;
  38. // };
  39. //
  40. // const processingDateChange = (date) => {
  41. // dayDate.value = date.dayDate;
  42. // weekDate.value = date.weekDate;
  43. // monthDate.value = date.monthDate;
  44. // };
  45. function handleButtonClick(tableName) {
  46. showTable.value = tableName;
  47. }
  48. </script>
  49. <template>
  50. <div>
  51. <component :is="currentTable[showTable]"
  52. ref="mainDataComponent"
  53. :dayDate="dayDate"
  54. :monthCurrentDate="monthCurrentDate"
  55. :monthDate="monthDate"
  56. :taskIds="taskIds"
  57. :weekDate="weekDate"
  58. >
  59. <template #table-header>
  60. <div class="custom-button my">
  61. <!--<el-button-->
  62. <!-- v-for="pane in panes"-->
  63. <!-- :key="pane.name"-->
  64. <!-- :type="showTable === pane.name ? 'primary' : 'default'"-->
  65. <!-- @click="handleButtonClick(pane.name)">-->
  66. <!-- {{ pane.label }}-->
  67. <!--</el-button>-->
  68. <el-radio-group
  69. v-model="showTable"
  70. aria-label="size control"
  71. @change="handleButtonClick">
  72. <el-radio-button
  73. v-for="pane in panes"
  74. :key="pane.name"
  75. :label="pane.name">
  76. {{ pane.label }}
  77. </el-radio-button>
  78. </el-radio-group>
  79. </div>
  80. </template>
  81. </component>
  82. </div>
  83. </template>
  84. <style scoped>
  85. .custom-card-style {
  86. z-index: 999;
  87. position: sticky;
  88. top: 0;
  89. }
  90. .demonstration {
  91. color: var(--el-text-color-secondary);
  92. font-size: 14px;
  93. margin: 10px;
  94. }
  95. .custom-button {
  96. z-index: 8;
  97. position: absolute;
  98. /* color: #3a83f7 !important; */
  99. }
  100. .my {
  101. margin: 0.8rem 0;
  102. }
  103. </style>