Skip to content
Merged

Sync #47

Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
apijson-table: add hook_viewedit
  • Loading branch information
zhangchunlin committed Jan 16, 2020
commit 3607318dbbab557af737243aeb246c024d79e340
2 changes: 1 addition & 1 deletion demo/apps/tables/templates/Tables/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<card>
<div style="min-height: 600px;">
{{if role!="ADMIN":}}
<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>
<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>
{{pass #if}}
<div id="app" class='box'>
<div class="box-body">
Expand Down
12 changes: 9 additions & 3 deletions uliweb_apijson/apijson/templates/vue/inc_apijson_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
"custom_tcolumns_render_generator",
"hook_init", //hook_init(vm), will invoke in mounted()
"hook_ajax_params", //hook_ajax_params(method,action,params), will invoke before ajax action
"hook_add" //hook_add(vm), customize the add action
"hook_add", //hook_add(vm), customize the add action
"hook_viewedit" //hook_viewedit(vm), customize the add action
],
template: `<div>
<div v-if="config_editable && config_add_fields!=null"><i-button type="primary" @click="add">Add</i-button> <br><br> </div>
<Spin size="large" fix v-if="loading"></Spin>
<i-table stripe border :columns="tcolumns" :data="tlist" @on-sort-change="table_on_sort_change"></i-table>
<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>
<modal v-model="modal_add" title="Add">
<i-form @submit.native.prevent :label-width="80">
<i-form @submit.native.prevent :label-width="100">
<form-item v-for="item in add_items" :key="item.key" :label="item.title">
<i-input v-if="item.component=='input'" v-model="item.value"></i-input>
<checkbox v-if="item.component=='checkbox'" v-model="item.value"></checkbox>
Expand All @@ -31,7 +32,7 @@
</div>
</modal>
<modal v-model="modal_view" :title="viewedit_label">
<i-form @submit.native.prevent :label-width="80">
<i-form @submit.native.prevent :label-width="100">
<form-item v-for="item in viewedit_items" :key="item.key" :label="item.title">
<i-input v-if="item.component=='input'" v-model="item.value" :readonly="!editable(item)"></i-input>
<checkbox v-if="item.component=='checkbox'" v-model="item.value" :disabled="!editable(item)"></checkbox>
Expand Down Expand Up @@ -246,6 +247,11 @@
})
},
show: function(params){
if (this.hook_viewedit!=null) {
this.hook_viewedit(this)
return
}

var row = params.row
this.viewedit_items = []
if (this.config_viewedit_fields!=null) {
Expand Down