apijson-table: add hook_viewedit · APIJSON/APIJSON-Python@3607318
Repository navigation
Commit 3607318
Browse files
zhangchunlin committed apijson-table: add hook_viewedit
1 parent 9a23815 commit 3607318
2 files changed
Lines changed: 10 additions & 4 deletionsFile tree
- demo/apps/tables/templates/Tables
- uliweb_apijson/apijson/templates/vue
demo/apps/tables/templates/Tables/list.html
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
@@ -7,7 +7,7 @@
| ||
7 | 7 | <card>
|
8 | 8 | <div style="min-height: 600px;">
|
9 | 9 | {{if role!="ADMIN":}}
|
10 | | - <div class="alert alert-warning" role="alert">You should <a class="btn btn-primary btn-sm" href="{{=url_for('uliweb_apps.login.views.login')}}" role="button">login</a> with user <strong>admin</strong> to view all the tables</div>
|
| 10 | + <div class="alert alert-warning" role="alert">You should <a class="btn btn-primary btn-sm" href="{{=url_for('uliweb_comapps.auth.login.views.login')}}" role="button">login</a> with user <strong>admin</strong> to view all the tables</div>
|
11 | 11 | {{pass #if}}
|
12 | 12 | <div id="app" class='box'>
|
13 | 13 | <div class="box-body">
|
|
uliweb_apijson/apijson/templates/vue/inc_apijson_table.html
Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
@@ -8,15 +8,16 @@
| ||
8 | 8 | "custom_tcolumns_render_generator",
|
9 | 9 | "hook_init", //hook_init(vm), will invoke in mounted()
|
10 | 10 | "hook_ajax_params", //hook_ajax_params(method,action,params), will invoke before ajax action
|
11 | | - "hook_add" //hook_add(vm), customize the add action
|
| 11 | + "hook_add", //hook_add(vm), customize the add action
|
| 12 | + "hook_viewedit" //hook_viewedit(vm), customize the add action
|
12 | 13 | ],
|
13 | 14 | template: `<div>
|
14 | 15 | <div v-if="config_editable && config_add_fields!=null"><i-button type="primary" @click="add">Add</i-button> <br><br> </div>
|
15 | 16 | <Spin size="large" fix v-if="loading"></Spin>
|
16 | 17 | <i-table stripe border :columns="tcolumns" :data="tlist" @on-sort-change="table_on_sort_change"></i-table>
|
17 | 18 | <page :total="total" :page-size="query_count" :current.sync="current_page" :page-size-opts="[10, 20, 50, 100]" show-sizer @on-change="page_on_change" @on-page-size-change="page_on_page_size_change"></page>
|
18 | 19 | <modal v-model="modal_add" title="Add">
|
19 | | - <i-form @submit.native.prevent :label-width="80">
|
| 20 | + <i-form @submit.native.prevent :label-width="100">
|
20 | 21 | <form-item v-for="item in add_items" :key="item.key" :label="item.title">
|
21 | 22 | <i-input v-if="item.component=='input'" v-model="item.value"></i-input>
|
22 | 23 | <checkbox v-if="item.component=='checkbox'" v-model="item.value"></checkbox>
|
@@ -31,7 +32,7 @@
| ||
31 | 32 | </div>
|
32 | 33 | </modal>
|
33 | 34 | <modal v-model="modal_view" :title="viewedit_label">
|
34 | | - <i-form @submit.native.prevent :label-width="80">
|
| 35 | + <i-form @submit.native.prevent :label-width="100">
|
35 | 36 | <form-item v-for="item in viewedit_items" :key="item.key" :label="item.title">
|
36 | 37 | <i-input v-if="item.component=='input'" v-model="item.value" :readonly="!editable(item)"></i-input>
|
37 | 38 | <checkbox v-if="item.component=='checkbox'" v-model="item.value" :disabled="!editable(item)"></checkbox>
|
@@ -246,6 +247,11 @@
| ||
246 | 247 | })
|
247 | 248 | },
|
248 | 249 | show: function(params){
|
| 250 | + if (this.hook_viewedit!=null) {
|
| 251 | + this.hook_viewedit(this)
|
| 252 | + return
|
| 253 | + }
|
| 254 | +
|
249 | 255 | var row = params.row
|
250 | 256 | this.viewedit_items = []
|
251 | 257 | if (this.config_viewedit_fields!=null) {
|
|