TableDesig.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <el-table
  3. :data="tableData"
  4. :header-cell-style="headerStyle"
  5. border
  6. stripe
  7. fit
  8. style="width: 100%;margin-top: 25px;">
  9. <el-table-column
  10. fixed
  11. prop="ColumnName"
  12. label="字段名"
  13. width="150">
  14. </el-table-column>
  15. <el-table-column
  16. prop="Description"
  17. min-width="200"
  18. label="说明">
  19. </el-table-column>
  20. <el-table-column
  21. prop="ColumnType"
  22. min-width="120"
  23. label="类型">
  24. </el-table-column>
  25. <el-table-column
  26. prop="CharMaxLength"
  27. min-width="60"
  28. label="长度">
  29. </el-table-column>
  30. <el-table-column
  31. prop="Nullable"
  32. align="center"
  33. label="不是 null">
  34. </el-table-column>
  35. <el-table-column
  36. prop="Default"
  37. min-width="260"
  38. label="默认值">
  39. </el-table-column>
  40. </el-table>
  41. </template>
  42. <script>
  43. import Vue from "vue";
  44. import ElementUI from "element-ui";
  45. import Axios from "axios";
  46. import "element-ui/lib/theme-chalk/index.css";
  47. import Opt from "../opt"
  48. Vue.use(ElementUI);
  49. export default{
  50. data: function () {
  51. return {
  52. tableData: [],
  53. headerStyle: {
  54. backgroundColor: '#e1e4e5',
  55. color: '#2b2b2b',
  56. lineHeight: '30px'
  57. }, // 列表样式
  58. };
  59. },
  60. components: {},
  61. created: function () {
  62. this.getData()
  63. },
  64. mounted: function () {
  65. // alert(this.schema);
  66. },
  67. props: ["sys", "schema", "table"],
  68. computed: {},
  69. methods: {
  70. getData(){
  71. Axios.get(`${Opt.databaseDoc[this.sys]}/--database-doc--/column-list?schema=${this.schema}&table=${this.table}`,{}).then(res=>{
  72. this.tableData = res.data;
  73. })
  74. }
  75. },
  76. }
  77. </script>
  78. <style scoped>
  79. /deep/ table{
  80. margin: 0;
  81. }
  82. </style>