table-1.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <el-col class="list">
  3. <el-col :span="24" class="btn">
  4. <el-button type="primary" size="large" @click="toAdd()">添加表</el-button>
  5. </el-col>
  6. <div class="table">
  7. <el-table :data="list" border size="large" max-height="70vh" :cell-style="{ textAlign: 'center' }" :header-cell-style="{ 'text-align': 'center' }">
  8. <el-table-column prop="name_zh" label="表名中文"> </el-table-column>
  9. <el-table-column prop="name" label="表名"> </el-table-column>
  10. <el-table-column prop="remark" label="备注"> </el-table-column>
  11. <el-table-column fixed="right" label="操作">
  12. <template #default="scope">
  13. <el-button link type="primary" @click.prevent="toEdit(scope.row)">修改</el-button>
  14. <el-button link type="warning">导出</el-button>
  15. <el-button link type="warning">导出ts</el-button>
  16. <el-button link type="danger">删除</el-button>
  17. </template>
  18. </el-table-column>
  19. </el-table>
  20. </div>
  21. </el-col>
  22. </template>
  23. <script setup lang="ts">
  24. import { reactive } from 'vue';
  25. let list: any = reactive([]);
  26. const props = defineProps({ list: Array });
  27. // eslint-disable-next-line vue/no-setup-props-destructure
  28. list = props.list;
  29. const emit = defineEmits(['toAdd', 'toEdit']);
  30. const toAdd = () => {
  31. let query: Object = { type: 'form' };
  32. emit('toAdd', query);
  33. };
  34. const toEdit = (row: { _id: string }) => {
  35. let query: Object = { type: 'form', id: row._id };
  36. emit('toEdit', query);
  37. };
  38. </script>
  39. <style scoped>
  40. .btn {
  41. height: 50px;
  42. margin: 10px 0;
  43. text-align: right;
  44. background: #86b2a5;
  45. }
  46. .table {
  47. background: #ccc;
  48. overflow-y: scroll;
  49. color: #000;
  50. }
  51. .table::-webkit-scrollbar {
  52. width: 1px;
  53. }
  54. .table::-webkit-scrollbar-thumb {
  55. border-radius: 10px;
  56. background: rgba(108, 43, 43, 0.2);
  57. }
  58. .table::-webkit-scrollbar-track {
  59. border-radius: 0;
  60. background: rgba(0, 0, 0, 0.1);
  61. }
  62. </style>