3
3
delimiters : [ '{' , '}' ] ,
4
4
props : [
5
5
"table" ,
6
- "tableui" ,
7
6
"model" ,
8
7
"request"
9
8
] ,
12
11
<row>
13
12
<i-col span="4">
14
13
<i-menu :active-name="current_menu_item" @on-select="on_select">
15
- <menu-item name="table_config " @on-select="current_menu_item='table_config '">table config </menu-item>
14
+ <menu-item name="table_param " @on-select="current_menu_item='table_param '">table param </menu-item>
16
15
<menu-item name="tableui_config" @on-select="current_menu_item='tableui_config'">table ui config</menu-item>
17
16
<menu-item name="model_config" @on-select="current_menu_item='model_config'">model config</menu-item>
18
17
<menu-item name="request_config" @on-select="current_menu_item='request_config'">request config</menu-item>
19
18
</i-menu>
20
19
</i-col>
21
20
<i-col span="8">
22
- <div v-if="current_menu_item=='table_config '">
23
- <h3>settings.APIJSON_TABLES.{ table.table_name} </h3>
21
+ <div v-if="current_menu_item=='table_param '">
22
+ <h3>table parameter </h3>
24
23
<pre>
25
24
{table_json}
26
25
</pre>
26
+ <h3>example backend code</h3>
27
+ <pre>
28
+ table = functions.get_apijson_table("{table.model_name}", role="{table.role}", request_tag="{table.request_tag}", tableui_name="{table.tableui_name}")
29
+ </pre>
30
+ <h3>example frontend code</h3>
31
+ <pre>
32
+ <apijson-table :table="table"></apijson-table>
33
+ </pre>
27
34
</div>
28
35
<div v-if="current_menu_item=='tableui_config'">
29
36
<h3>settings.APIJSON_TABLE_UI.{table.tableui_name}</h3>
@@ -38,7 +45,7 @@ <h3>settings.APIJSON_MODELS.{table.model_name}</h3>
38
45
</pre>
39
46
</div>
40
47
<div v-if="current_menu_item=='request_config'">
41
- <h3>settings.APIJSON_TABLE_CONFIG .{table.request_tag||table.model_name}</h3>
48
+ <h3>settings.APIJSON_REQUESTS .{table.request_tag||table.model_name}</h3>
42
49
<pre style="height: 25pc; overflow-y: scroll;">
43
50
{request_json}
44
51
</pre>
@@ -48,15 +55,15 @@ <h3>settings.APIJSON_TABLE_CONFIG.{table.request_tag||table.model_name}</h3>
48
55
</div>` ,
49
56
data : function ( ) {
50
57
return {
51
- current_menu_item : "table_config"
58
+ current_menu_item : "table_param" ,
59
+ table_param : { } ,
60
+ tableui : { } ,
61
+ tableui_json : ""
52
62
}
53
63
} ,
54
64
computed : {
55
65
table_json : function ( ) {
56
- return JSON . stringify ( this . table , null , 2 )
57
- } ,
58
- tableui_json : function ( ) {
59
- return JSON . stringify ( this . tableui , null , 2 )
66
+ return JSON . stringify ( this . table_param , null , 2 )
60
67
} ,
61
68
model_json : function ( ) {
62
69
return JSON . stringify ( this . model , null , 2 )
@@ -69,6 +76,19 @@ <h3>settings.APIJSON_TABLE_CONFIG.{table.request_tag||table.model_name}</h3>
69
76
on_select : function ( data ) {
70
77
this . current_menu_item = data
71
78
}
79
+ } ,
80
+ mounted : function ( ) {
81
+ this . table_param = JSON . parse ( JSON . stringify ( this . table ) )
82
+ delete this . table_param . tableui
83
+ //remove __id field, look like vuejs add this
84
+ var tableui = JSON . parse ( JSON . stringify ( this . table . tableui ) )
85
+ if ( tableui . table_fields != null ) {
86
+ for ( let index = 0 ; index < tableui . table_fields . length ; index ++ ) {
87
+ if ( tableui . table_fields [ index ] . __id != null )
88
+ delete tableui . table_fields [ index ] . __id
89
+ }
90
+ this . tableui_json = JSON . stringify ( tableui , null , 2 )
91
+ }
72
92
}
73
93
} )
74
94
</ script >
0 commit comments