basicTable.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <div>
  3. <div class="basicHeader">
  4. <span class="demonstration">选择时间:</span>
  5. <el-date-picker v-model="timeValue" type="month" placeholder="请选择时间" style="margin:0 15px"></el-date-picker>
  6. <el-button class="search-button" icon="Plus" type="success" @click="Touch()">
  7. 生成
  8. </el-button>
  9. </div>
  10. <div style="margin: 0 15px">
  11. <el-table :data="tableData" border stripe :header-cell-style="{ background: '#FAFAFA !important', color: 'black' }"
  12. height="42rem">
  13. <el-table-column prop="reportName" label="报告名称" width=""></el-table-column>
  14. <el-table-column prop="reportDate" label="报告统计时间" width=""></el-table-column>
  15. <el-table-column label="操作" width="140">
  16. <template #default="scope">
  17. <el-button type="primary" size="small" @click.prevent="preview(scope.row)" link>
  18. 预览
  19. </el-button>
  20. <el-button type="primary" size="small" @click="download(scope.$index, scope.row)" link>
  21. 下载
  22. </el-button>
  23. </template>
  24. </el-table-column>
  25. </el-table>
  26. </div>
  27. </div>
  28. </template>
  29. <script setup>
  30. /*----------------------------------依赖引入-----------------------------------*/
  31. import { useStore } from 'vuex'
  32. import { ElMessage, ElNotification } from 'element-plus'
  33. import { ref, onMounted, watch, getCurrentInstance, reactive, toRefs } from 'vue'
  34. /*----------------------------------接口引入-----------------------------------*/
  35. /*----------------------------------组件引入-----------------------------------*/
  36. /*----------------------------------store引入-----------------------------------*/
  37. /*----------------------------------公共方法引入-----------------------------------*/
  38. /*----------------------------------公共变量-----------------------------------*/
  39. const store = useStore()
  40. const props = defineProps({}) //数据双向绑定
  41. const emit = defineEmits([]);
  42. const { proxy } = getCurrentInstance();
  43. /*----------------------------------变量声明-----------------------------------*/
  44. const state = reactive({
  45. timeValue: '',
  46. tableData: [
  47. {
  48. reportName: '钦江路333号月度用电报告_2021年6月',
  49. reportDate: '2021-06-01 00:00:00-2021-06-30 24:00:00',
  50. },
  51. {
  52. reportName: '钦江路333号月度用电报告_2021年6月',
  53. reportDate: '2021-06-01 00:00:00-2021-06-30 24:00:00',
  54. },
  55. ],
  56. })
  57. const { timeValue, tableData } = toRefs(state)
  58. const Touch = () => {
  59. console.log('')
  60. }
  61. const download = () => {
  62. console.log('')
  63. }
  64. const preview = () => {
  65. console.log('')
  66. }
  67. </script>