浏览代码

支持自动生成数据表设计文档。

sybotan 5 年之前
父节点
当前提交
0dcba5afd6

+ 1 - 17
docs/.vuepress/components/BaseTable.vue

@@ -25,23 +25,7 @@
     export default{
         data: function () {
             return {
-                tableData: [{
-                    date: '2016-05-02',
-                    name: '王小虎',
-                    address: '上海市普陀区金沙江路 1518 弄'
-                }, {
-                    date: '2016-05-04',
-                    name: '王小虎',
-                    address: '上海市普陀区金沙江路 1517 弄'
-                }, {
-                    date: '2016-05-01',
-                    name: '王小虎',
-                    address: '上海市普陀区金沙江路 1519 弄'
-                }, {
-                    date: '2016-05-03',
-                    name: '王小虎',
-                    address: '上海市普陀区金沙江路 1516 弄'
-                }]
+                tableData: []
             };
         },
         components: {},

+ 86 - 0
docs/.vuepress/components/TableDesig.vue

@@ -0,0 +1,86 @@
+<template>
+    <el-table
+            :data="tableData"
+            :header-cell-style="headerStyle"
+            border
+            stripe
+            fit
+            style="width: 100%;margin-top: 25px;">
+        <el-table-column
+                fixed
+                prop="ColumnName"
+                label="字段名"
+                width="150">
+        </el-table-column>
+        <el-table-column
+                prop="Description"
+                min-width="200"
+                label="说明">
+        </el-table-column>
+        <el-table-column
+                prop="ColumnType"
+                min-width="120"
+                label="类型">
+        </el-table-column>
+        <el-table-column
+                prop="CharMaxLength"
+                min-width="60"
+                label="长度">
+        </el-table-column>
+        <el-table-column
+                prop="Nullable"
+                align="center"
+                label="不是 null">
+        </el-table-column>
+        <el-table-column
+                prop="Default"
+                min-width="260"
+                label="默认值">
+        </el-table-column>
+    </el-table>
+</template>
+
+<script>
+    import Vue from "vue";
+    import ElementUI from "element-ui";
+    import Axios from "axios";
+    import "element-ui/lib/theme-chalk/index.css";
+    import Opt from "../opt"
+
+    Vue.use(ElementUI);
+
+    export default{
+        data: function () {
+            return {
+                tableData: [],
+                headerStyle: {
+                    backgroundColor: '#e1e4e5',
+                    color: '#2b2b2b',
+                    lineHeight: '30px'
+                }, // 列表样式
+            };
+        },
+        components: {},
+        created: function () {
+            this.getData()
+        },
+        mounted: function () {
+            // alert(this.schema);
+        },
+        props: ["sys", "schema", "table"],
+        computed: {},
+        methods: {
+            getData(){
+                Axios.get(`${Opt.databaseDoc[this.sys]}/--database-doc--/column-list?schema=${this.schema}&table=${this.table}`,{}).then(res=>{
+                    this.tableData = res.data;
+                })
+            }
+        },
+    }
+</script>
+
+<style scoped>
+    /deep/ table{
+        margin: 0;
+    }
+</style>

+ 5 - 0
docs/.vuepress/opt.js

@@ -0,0 +1,5 @@
+module.exports = {
+    databaseDoc: {
+        datacenter: "http://localhost:8680"
+    }
+};

+ 16 - 0
docs/dev/data-center/db/table.md

@@ -0,0 +1,16 @@
+# 表设计
+## data
+### project
+
+<TableDesig :sys="'datacenter'" :schema="'data'" :table="'project'"/>
+
+### building
+
+<TableDesig :sys="'datacenter'" :schema="'data'" :table="'building'"/>
+
+### floor
+
+<TableDesig :sys="'datacenter'" :schema="'data'" :table="'floor'"/>
+
+## security
+<TableDesig :sys="'datacenter'" :schema="'security'" :table="'user'"/>

+ 3 - 1
docs/dev/data-center/index.js

@@ -29,7 +29,9 @@ const content = [
     {
         title: "数据库设计",
         path: "/dev/data-center/db/",
-        children: []
+        children: [
+            ["/dev/data-center/db/table", "表设计"],
+        ]
     }
 ];