Skip to content

Commit 46d4ac8

Browse files
committed
func_change_get_params -> func_change_params; move action from OK button to Add button
1 parent f30a2bf commit 46d4ac8

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

uliweb_apijson/apijson/templates/vue/inc_apijson_table.html

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
<script>
22
Vue.component('apijson-table', {
33
delimiters: ['{', '}'],
4-
props: ["table_name","config","func_change_get_params"],
4+
props: ["table_name","config","func_change_params"],
55
template: `<div>
66
<div v-if="config_editable && config_add_fields!=null"><i-button type="primary" @click="add">Add</i-button> <br><br> </div>
77
<i-table stripe border :columns="tcolumns" :data="tlist" @on-sort-change="table_on_sort_change"></i-table>
88
<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>
9-
<modal v-model="modal_add" title="Add" @on-ok="real_add">
9+
<modal v-model="modal_add" title="Add">
1010
<i-form @submit.native.prevent :label-width="80">
1111
<form-item v-for="item in add_items" :key="item.key" :label="item.title">
1212
<i-input v-if="item.type=='input'" v-model="item.value"></i-input>
1313
<checkbox v-if="item.type=='checkbox'" v-model="item.value"></checkbox>
1414
<i-input v-if="item.type=='textarea'" v-model="item.value" type="textarea" :autosize="{minRows: 2,maxRows: 5}"></i-input>
1515
</form-item>
16+
<form-item v-if="config_editable" label="action">
17+
<i-button type="info" icon="plus" @click="real_add">Add</i-button>
18+
</form-item>
1619
</i-form>
1720
</modal>
1821
<modal v-model="modal_view" :title="viewedit_label">
@@ -119,8 +122,8 @@
119122
"[]":arr_params,
120123
"total@":"/[]/total"
121124
}
122-
if (thisp.func_change_get_params!=null) {
123-
params = thisp.func_change_get_params(params)
125+
if (thisp.func_change_params!=null) {
126+
params = thisp.func_change_params("apijson_get",params)
124127
}
125128
$.ajax({
126129
type: "POST",
@@ -219,6 +222,9 @@
219222
}
220223
}
221224
params[thisp.table_name] = record_params
225+
if (thisp.func_change_params!=null) {
226+
params = thisp.func_change_params("apijson_put",params)
227+
}
222228
$.ajax({
223229
type: "POST",
224230
url: "{{=url_for('uliweb_apijson.apijson.views.ApiJson.put')}}",
@@ -230,6 +236,7 @@
230236
title: 'success update #'+row.id+' in table '+thisp.table_name,
231237
desc: data.msg
232238
})
239+
thisp.modal_view = false
233240
thisp.update_list()
234241
}
235242
else {
@@ -296,7 +303,9 @@
296303
post_params[d.key] = d.value
297304
}
298305
params[this.table_name] = post_params
299-
306+
if (thisp.func_change_params!=null) {
307+
params = thisp.func_change_params("apijson_post",params)
308+
}
300309
$.ajax({
301310
type: "POST",
302311
url: "{{=url_for('uliweb_apijson.apijson.views.ApiJson.post')}}",
@@ -316,6 +325,7 @@
316325
desc: result.msg
317326
})
318327
thisp.update_list()
328+
thisp.modal_add = false
319329
}
320330
})
321331
},

0 commit comments

Comments
 (0)